Commit e2c830dd authored by T.J. Corona's avatar T.J. Corona

Add PyARC workflow.

parent d1157fce
<?xml version="1.0"?>
<cmb-resources>
<!-- Simulation Template -->
<attribute id="simbuilder" role="template">
<include href="internal/pyarc-simbuilder.sbt" />
</attribute>
<!-- Export Template -->
<attribute id="export" role="template">
<include href="internal/pyarc-export.sbt" />
</attribute>
</cmb-resources>
#=============================================================================
#
# Copyright (c) Kitware, Inc.
# All rights reserved.
# See LICENSE.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the above copyright notice for more information.
#
#=============================================================================
"""
Export script for PyARC workflows
"""
import sys
#from PyARC import PyARC
sys.dont_write_bytecode = True
import smtk
if 'pybind11' == smtk.wrappingProtocol():
import smtk.attribute
import smtk.model
import smtk.simulation
from internal.writers import pyarc_writer
ExportScope = type('ExportScope', (object,), dict())
# ---------------------------------------------------------------------
def ExportCMB(spec):
'''Entry function, called by CMB to write export files
Returns boolean indicating success
Parameters
----------
spec: Top-level object passed in from CMB
'''
print 'Enter ExportCMB()'
# Initialize scope instance to store spec values and other info
scope = ExportScope()
scope.logger = spec.getLogger()
scope.sim_atts = spec.getSimulationAttributes()
if scope.sim_atts is None:
msg = 'ERROR - No simulation attributes'
print msg
raise Exception(msg)
scope.model_manager = scope.sim_atts.refModelManager()
mask = int(smtk.model.MODEL_ENTITY)
model_ents = scope.model_manager.entitiesMatchingFlags(mask, True)
if not model_ents:
msg = 'No model - cannot export'
print 'WARNING:', msg
scope.logger.addWarning(msg)
print 'Abort export - check logger'
return False
elif len(model_ents) > 1:
msg = 'Multiple models - using first one'
print 'WARNING:', msg
scope.logger.addWarning(msg)
scope.model_ent = model_ents.pop()
# Get export spec attribute
scope.export_atts = spec.getExportAttributes()
if scope.export_atts is not None:
att_list = scope.export_atts.findAttributes('ExportSpec')
if len(att_list) > 1:
msg = 'More than one ExportSpec instance -- ignoring all'
print 'WARNING:', msg
scope.logger.addWarning(msg)
return False
export_spec_att = att_list[0]
# Initialize solver list
solver_item = export_spec_att.findString('Analysis')
if solver_item is None:
msg = 'Missing \"Analysis\" item -- cannot export'
scope.logger.addError(msg)
raise Exception(msg)
if not solver_item.isSet(0):
msg = 'Analysis item is not set -- cannot export'
scope.logger.addError(msg)
raise Exception(msg)
solver_string = solver_item.value(0)
#print 'solver_string:', solver_string
scope.solver_list = solver_string.split('.')
# Get output filename (path)
output_path = None
file_item = export_spec_att.findFile('OutputFile')
if file_item is not None:
output_path = file_item.value(0)
if not output_path:
raise Exception('No output file specified')
scope.output_path = output_path
reload(pyarc_writer)
writer = pyarc_writer.PyARCWriter()
success = writer.write(scope)
if success:
print 'Successfully wrote', scope.output_path
return success
<?xml version="1.0"?>
<SMTK_AttributeSystem Version="2">
<Definitions>
<AttDef Type="ExportSpec" Label="Settings" BaseType="" Version="0">
<ItemDefinitions>
<String Name="Analysis" Label="Analysis" Version="">
<DiscreteInfo>
<Value Enum="DIF3D">dif3d</Value>
<Value Enum="MCC3">mcc3</Value>
<Value Enum="MCC3 + DIF3D">mcc3.dif3d</Value>
</DiscreteInfo>
</String>
<File Name="OutputFile" Label="Output File" Version="0" NumberOfRequiredValues="1"
FileFilters="PyARC files (*.son);;All files (*.*)">
<BriefDescription>The pyarc file to write</BriefDescription>
</File>
<File Name="PythonScript" Label="Python Script" Version="0" AdvanceLevel="1" NumberOfRequiredValues="1"
ShouldExist="true" FileFilters="Python files (*.py);;All files (*.*)">
<DefaultValue>NEAMS.py</DefaultValue>
</File>
</ItemDefinitions>
</AttDef>
</Definitions>
<Views>
<View Type="Instanced" Title="Export Settings" TopLevel="true" FilterByCategory="false">
<InstancedAttributes>
<Att Name="Options" Type="ExportSpec" />
</InstancedAttributes>
</View>
</Views>
</SMTK_AttributeSystem>
<?xml version="1.0"?>
<SMTK_AttributeSystem Version="2">
<Includes>
<File>templates/dif3d.sbt</File>
<File>templates/mcc3.sbt</File>
</Includes>
<Views>
<View Type="Group" Name="PyARC" Label="PyARC" TopLevel="true"
TabPosition="North" FilterByCategory="false" FilterByAdvanceLevel="false">
<Views>
<View Title="DIF3D" />
<View Title="MCC3" />
</Views>
</View>
<View Type="Instanced" Title="DIF3D" Label="DIF3D">
<InstancedAttributes>
<Att Name="dif3d-instance" Type="dif3d" />
</InstancedAttributes>
</View>
<View Type="Instanced" Title="MCC3" Label="MCC3">
<InstancedAttributes>
<Att Name="mcc3-instance" Type="mcc3" />
</InstancedAttributes>
</View>
</Views>
</SMTK_AttributeSystem>
<?xml version="1.0"?>
<SMTK_AttributeSystem Version="2">
<Definitions>
<AttDef Type="dif3d" BaseType="" Unique="true" Associations="">
<ItemDefinitions>
<Double Name="power" Label="Power (W)" NumberOfRequiredValues="1">
<BriefDescription>power of the full core in W (doesn't include the symmetry)</BriefDescription>
<RangeInfo><Min Inclusive="false">0</Min></RangeInfo>
</Double>
<String Name="geometry_type" Label="Geometry Type" NumberOfRequiredValues="1">
<DiscreteInfo DefaultIndex="1">
<Value Enum="Hexagonal Infinite Lattice">hexagonal_infinite_lattice</Value>
<Value Enum="Hexagonal Full Core">hexagonal_full_core</Value>
<Value Enum="Hexagonal Sixth Core">hexagonal_sixth_core</Value>
<Value Enum="Hexagonal Third Core">hexagonal_third_core</Value>
<Value Enum="Triangular Full Core">triangular_full_core</Value>
</DiscreteInfo>
</String>
<String Name="Cross Sections">
<ChildrenDefinitions>
<File Name="isotxs" Label="Cross Sections File" NumberOfValues="1" ShouldExist="true">
<BriefDescription>Name of mcc3 isotxs file</BriefDescription>
</File>
</ChildrenDefinitions>
<DiscreteInfo DefaultIndex="0">
<Structure>
<Value Enum="From mcc3 Computation">previous</Value>
</Structure>
<Structure>
<Value Enum="From file">fromfile</Value>
<Items>
<Item>isotxs</Item>
</Items>
</Structure>
</DiscreteInfo>
</String>
<Void Name="run_dif3d" Label="Run dif3d" Optional="true" IsEnabledByDefault="true"/>
<Double Name="max_axial_mesh_size" Label="Maximum Axial Mesh Size (m)"
NumberOfRequiredValues="1" Optional="true" IsEnabledByDefault="true">
<BriefDescription>maximal axial distance between each
calculation node used in the DIF3D model.</BriefDescription>
<RangeInfo><Min Inclusive="false">0</Min></RangeInfo>
<DefaultValue>.05</DefaultValue>
</Double>
<String Name="dif_options" Label="Options">
<BriefDescription>Additional options</BriefDescription>
<DetailedDescription>
The user needs to specify variant option with polynomial
and angular approximation and anisotropic
scattering. Default values are provided but higher/lower
fidelity may be needed depending on the core analyzed.
</DetailedDescription>
<ChildrenDefinitions>
<Int Name="polynomial_approx_source"
Label="Polynomial Approximation Source" NumberOfRequiredValues="1">
<RangeInfo><Min Inclusive="true">1</Min></RangeInfo>
<DefaultValue>6</DefaultValue>
</Int>
<Int Name="polynomial_approx_fluxes"
Label="Polynomial Approximation Fluxes" NumberOfRequiredValues="1">
<RangeInfo>
<Min Inclusive="true">1</Min>
<Max Inclusive="true">12</Max>
</RangeInfo>
<DefaultValue>6</DefaultValue>
</Int>
<Int Name="polynomial_approx_leakages"
Label="Polynomial Approximation Leakages" NumberOfRequiredValues="1">
<RangeInfo><Min Inclusive="true">0</Min></RangeInfo>
<DefaultValue>1</DefaultValue>
</Int>
<Int Name="angular_approx"
Label="Angular Approximation" NumberOfRequiredValues="1">
<RangeInfo>
<Min Inclusive="true">1</Min>
<Max Inclusive="true">60</Max>
</RangeInfo>
<DefaultValue>3</DefaultValue>
</Int>
<Int Name="anisotropic_scattering_approx"
Label="Anisotropic Scattering Approximation" NumberOfRequiredValues="1">
<RangeInfo><Min Inclusive="true">0</Min></RangeInfo>
<RangeInfo><Max Inclusive="true">1</Max></RangeInfo>
<DefaultValue>0.5</DefaultValue>
</Int>
<Void Name="omega_acceleration" Label="Omega Acceleration"
Optional="true" IsEnabledByDefault="true"/>
<Int Name="hex_triangular_subdivision"
Label="Hexagon Triangular Subdivision" NumberOfRequiredValues="1">
<RangeInfo><Min Inclusive="true">0</Min></RangeInfo>
<DefaultValue>1</DefaultValue>
</Int>
<Void Name="course_mesh_rebalance" Label="Course Mesh Rebalance"
Optional="true" IsEnabledByDefault="false"/>
</ChildrenDefinitions>
<DiscreteInfo DefaultIndex="0">
<Structure>
<Value Enum="Variant Options">variant_options</Value>
<Items>
<Item>polynomial_approx_source</Item>
<Item>polynomial_approx_fluxes</Item>
<Item>polynomial_approx_leakages</Item>
<Item>angular_approx</Item>
<Item>anisotropic_scattering_approx</Item>
<Item>omega_acceleration</Item>
</Items>
</Structure>
<Structure>
<Value Enum="dif_fd_options">dif_fd_options</Value>
<Items>
<Item>hex_triangular_subdivision</Item>
</Items>
</Structure>
<Structure>
<Value Enum="dif_nod_options">dif_nod_options</Value>
<Items>
<Item>course_mesh_rebalance</Item>
</Items>
</Structure>
</DiscreteInfo>
</String>
<Group Name="rebus" Label="Rebus" AdvanceLevel="0">
<ItemDefinitions>
<Double Name="cycle_length" Label="Cycle Length (days)"
NumberOfRequiredValues="1">
<BriefDescription>cycle length in equivalent full power days</BriefDescription>
<RangeInfo><Min Inclusive="false">0</Min></RangeInfo>
</Double>
<Double Name="shutdown_time_between_cycle"
Label="Shutdown Time between Cycles (days)">
<BriefDescription>shutdown time between cycles in days</BriefDescription>
<RangeInfo><Min Inclusive="true">0</Min></RangeInfo>
</Double>
<Int Name="num_cycles" Optional="true" IsEnabledByDefault="true"
Label="Number of Cycles" NumberOfRequiredValues="1">
<BriefDescription>number of cycles to be performed</BriefDescription>
<RangeInfo><Min Inclusive="true">1</Min></RangeInfo>
<DefaultValue>1</DefaultValue>
</Int>
<Int Name="num_subintervals" Optional="true" IsEnabledByDefault="true"
Label="Number of Subintervals" NumberOfRequiredValues="1">
<BriefDescription>number of subintervals within each cycle</BriefDescription>
<RangeInfo><Min Inclusive="true">1</Min></RangeInfo>
<DefaultValue>1</DefaultValue>
</Int>
<Group Name="decay_chain" Label="Decay Chain">
<ItemDefinitions>
<String Name="list_isotopes" Label="List of Isotopes"
NumberOfRequiredValues="1" Extensible="True">
</String>
<String Name="list_lumped_elements" Label="List of Lumped Elements"
NumberOfRequiredValues="0" Extensible="True" Optional="true" IsEnabledByDefault="false">
</String>
<String Name="list_dummy_elements" Label="List of Dummy Elements"
NumberOfRequiredValues="0" Extensible="True" Optional="true" IsEnabledByDefault="false">
</String>
<File Name="decay_chain_text_file" Label="Decay Chain Text File" ShouldExist="true">
<BriefDescription>Name of decay chain text file</BriefDescription>
</File>
</ItemDefinitions>
</Group>
</ItemDefinitions>
</Group>
</ItemDefinitions>
</AttDef>
</Definitions>
</SMTK_AttributeSystem>
<?xml version="1.0"?>
<SMTK_AttributeSystem Version="2">
<Definitions>
<AttDef Type="mcc3" BaseType="" Unique="true" Associations="">
<ItemDefinitions>
<Void Name="force_mixture_calc" Label="Force Mixture Calculation" Optional="true" IsEnabledByDefault="false"/>
<String Name="xslib" Label="Cross Section Library" AdvanceLevel="0" NumberOfRequiredValues="1">
<BriefDescription>The cross section library used by mcc3</BriefDescription>
<DetailedDescription>endf7.0 and endf7.1 are the only
cross section library currently available</DetailedDescription>
<DiscreteInfo DefaultIndex="0">
<Value Enum="endf7.0">endf7.0</Value>
<Value Enum="endf7.1">endf7.1</Value>
</DiscreteInfo>
</String>
<String Name="Energy Group">
<ChildrenDefinitions>
<String Name="egroupname" Label="Energy Group Structure"
AdvanceLevel="0" NumberOfRequiredValues="1">
<BriefDescription>Predefined energy group</BriefDescription>
<DetailedDescription>choose either ANL33, ANL70, ANL230,
ANL1041, or ANL2082</DetailedDescription>
<DiscreteInfo DefaultIndex="0">
<Value Enum="ANL33">ANL33</Value>
<Value Enum="ANL70">ANL70</Value>
<Value Enum="ANL230">ANL230</Value>
<Value Enum="ANL1041">ANL1041</Value>
<Value Enum="ANL2082">ANL2082</Value>
</DiscreteInfo>
</String>
<Double Name="egroupvals" Label="Energy Group Values (eV)"
NumberOfRequiredValues="1" Extensible="true">
<BriefDescription>list the boundaries (not including 0)
of the energy groups in eV</BriefDescription>
</Double>
</ChildrenDefinitions>
<DiscreteInfo DefaultIndex="0">
<Structure>
<Value Enum="Predefined">egroupname</Value>
<Items>
<Item>egroupname</Item>
</Items>
</Structure>
<Structure>
<Value Enum="Custom">egroupvals</Value>
<Items>
<Item>egroupvals</Item>
</Items>
</Structure>
</DiscreteInfo>
</String>
<Int Name="scattering_order"
Label="Scattering Order" NumberOfRequiredValues="1">
<BriefDescription>list the boundaries (not including 0)
of the energy groups in eV</BriefDescription>
<RangeInfo><Min Inclusive="true">0</Min></RangeInfo>
</Int>
<String Name="inelastic_treatment"
Label="Inelastic Scattering Treatment" Optional="true" IsEnabledByDefault="false">
<DiscreteInfo DefaultIndex="0">
<Value Enum="Approximate">approximate</Value>
<Value Enum="Rigorous">rigorous</Value>
</DiscreteInfo>
</String>
<File Name="lumped_element_text_file" Label="Lumped Element Text File"
Optional="true" IsEnabledByDefault="false" NumberOfValues="1" ShouldExist="true">
<BriefDescription>Name of lumped element file</BriefDescription>
<DetailedDescription>
Name of file containing composition of the lumped element
used in the material definition or in the decay chain.
</DetailedDescription>
</File>
<Group Name="rzmflx_code_options" Label="RZ Core Options" AdvanceLevel="0">
<BriefDescription>RZ Core options.</BriefDescription>
<ItemDefinitions>
<String Name="code" Label="Code" AdvanceLevel="0" NumberOfRequiredValues="1">
<DiscreteInfo DefaultIndex="0">
<Value Enum="twodant">twodant</Value>
</DiscreteInfo>
</String>
<String Name="finegroup_egroupname" Label="Energy Group Structure"
AdvanceLevel="0" NumberOfRequiredValues="1">
<BriefDescription>Predefined energy group</BriefDescription>
<DetailedDescription>This is the fine-group structure
that should be used in the RZ calculation. It is
recommended to use the ANL1041 group structure. It
should contain more energy groups than the one used with
mcc3.</DetailedDescription>
<DiscreteInfo DefaultIndex="0">
<Value Enum="ANL33">ANL33</Value>
<Value Enum="ANL70">ANL70</Value>
<Value Enum="ANL230">ANL230</Value>
<Value Enum="ANL1041">ANL1041</Value>
<Value Enum="ANL2082">ANL2082</Value>
</DiscreteInfo>
</String>
<String Name="R_boundaries"
Label="Boundaries in the R direction (m)"
NumberOfRequiredValues="1" Extensible="true"
Optional="true" IsEnabledByDefault="true">
<BriefDescription>Boundaries of the different areas in the R direction.(Example: cylinder at radius 0.126125 should be written as cylinder0_126125)</BriefDescription>
</String>
<Double Name="R_nodes_distance"
Label="Distance between nodes in the R direction (m)"
NumberOfRequiredValues="1" Optional="true" IsEnabledByDefault="true">
<BriefDescription>distance between each node in the R direction, recommended 0.05 m.</BriefDescription>
<DefaultValue>.05</DefaultValue>
</Double>
<String Name="Z_boundaries"
Label="Boundaries in the Z direction (m)"
NumberOfRequiredValues="1" Extensible="true"
Optional="true" IsEnabledByDefault="true">
<BriefDescription>Boundaries of the different areas in the Z direction.(Example: plane at z=38.0 should be written as z38_0)</BriefDescription>
</String>
<Double Name="Z_nodes_distance"
Label="Distance between nodes in the Z direction (m)"
NumberOfRequiredValues="1" Optional="true" IsEnabledByDefault="true">
<BriefDescription>distance between each node in the Z direction, recommended 0.08 m.</BriefDescription>
<DefaultValue>.08</DefaultValue>
</Double>
<Int Name="SN_angular_order"
Label="SN Angular Order" NumberOfRequiredValues="1">
<BriefDescription>angular order for the transport approximation with SN method. Recommended 12</BriefDescription>
<RangeInfo><Min Inclusive="false">0</Min></RangeInfo>
<DefaultValue>18</DefaultValue>
</Int>
<String Name="core_2d_geometry"
Label="core 2d geometry"
NumberOfRequiredValues="1" Extensible="true"
Optional="true" IsEnabledByDefault="true" AdvanceLevel="11">
<BriefDescription>A value needed by PyARC but is not documented. For now just hide it.</BriefDescription>
<DefaultValue>a</DefaultValue>
</String>
</ItemDefinitions>
</Group>
</ItemDefinitions>
</AttDef>
</Definitions>
</SMTK_AttributeSystem>
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment