Skip to content

Commit

Permalink
Merge pull request #10 from nstauff/update_pyarc
Browse files Browse the repository at this point in the history
updated pyarc plugin and example1c
  • Loading branch information
paulromano authored Feb 18, 2022
2 parents 93ce914 + 0f60c70 commit 745b1c8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
11 changes: 9 additions & 2 deletions examples/example1c_PyARC/example1c.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@

import os
import watts
from astropy import units as u

# Uses Astropy for unit conversion
u.imperial.enable() # Enable imperial units
Quantity = u.Quantity
params = watts.Parameters()

# TH params

params['assembly_pitch'] = 20e-2 # m
params['assembly_length'] = 0.13 # m
params['assembly_pitch'] = Quantity(20, "cm") # 20e-2 m
params['assembly_length'] = Quantity(13, "cm") # 0.13 m
params['temp'] = Quantity(26.85, "Celsius") # 300 K



params.show_summary(show_metadata=False, sort_by='key')

Expand Down
4 changes: 2 additions & 2 deletions examples/example1c_PyARC/pyarc_template
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ geometry{

materials{
material ( LEU ) {
temp = 300
temp = {{ temp }}
adens{
aden ( u235 ) = 2.0e-2 % atom density in at/barn-cm
aden ( u238 ) = 2.0e-2 % atom density in at/barn-cm
Expand All @@ -12,7 +12,7 @@ geometry{
lumped_element_aden( lu35 ) = 1e-3
}
material ( LEU2 ) {
temp = 300
temp = {{ temp }}
adens{
aden ( u236 ) = 2.0e-2 % atom density in at/barn-cm
aden ( u237 ) = 2.0e-2 % atom density in at/barn-cm
Expand Down
8 changes: 7 additions & 1 deletion src/watts/plugin_pyarc.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,15 @@ def prerun(self, params: Parameters) -> None:
params
Parameters used by the PyARC template
"""
# Render the template
# Make a copy of params and convert units if necessary
# The original params remains unchanged

params_copy = super().convert_unit(params, unit_system='si', unit_temperature='K')

print("Pre-run for PyARC Plugin")
self._run_time = time.time_ns()
super().prerun(params, filename=self.pyarc_inp_name)
super().prerun(params_copy, filename=self.pyarc_inp_name)

def run(self, **kwargs: Mapping):
"""Run PyARC
Expand Down

0 comments on commit 745b1c8

Please sign in to comment.