Commit af991e8c authored by John Tourtellott's avatar John Tourtellott
Browse files

Update S3P workflow files

* Add WaveguideFrequency option
* Move Postprocess option to boundary-condition flag
parent e9855d62
......@@ -535,22 +535,41 @@ def write_eigensolver(scope):
# ---------------------------------------------------------------------
def write_frequency_scan(scope):
'''Writes S3P FrequencyScan section
'''Writes S3P WaveguideFrequency line or FrequencyScan section
'''
print('Write FrequencyScan')
att = scope.sim_atts.findAttributes('FrequencyInfo')[0]
# Added single WaveguideFrequency March 2020
mode = 'scan' # for backward compatibility
mode_item = att.findString('FrequencyMode')
if mode_item is not None:
mode = mode_item.value()
if mode == 'waveguide':
freq_item = att.itemAtPath('FrequencyMode/WaveguideFrequency')
if freq_item is None:
raise RuntimeError('FrequencyMode/WaveguideFrequency item not found')
print('Write WaveguideFrequency')
scope.output.write('\nWaveguideFrequency: %g\n' % freq_item.value(0))
return
print('Write FrequencyScan')
scope.output.write('\n')
scope.output.write('FrequencyScan:\n')
scope.output.write('{\n')
# Make list of (smtk_item_name, s3p_file_keyword)
# Make list of (smtk_item_path, s3p_file_keyword)
prefix = '' if mode_item is None else 'FrequencyMode/'
item_spec = [
('StartingFrequency', 'Start'),
('EndingFrequency', 'End'),
('FrequencyInterval','Interval')]
for item_name,s3p_keyword in item_spec:
item = att.findDouble(item_name)
(prefix + 'StartingFrequency', 'Start'),
(prefix + 'EndingFrequency', 'End'),
(prefix + 'FrequencyInterval','Interval')]
for item_path,s3p_keyword in item_spec:
item = att.itemAtPath(item_path)
if item is None:
raise RuntimeError('Item {} not found'.format(item_path))
scope.output.write(' %s: %g\n' % (s3p_keyword, item.value(0)))
scope.output.write('}\n')
......@@ -880,12 +899,12 @@ def write_postprocess(scope):
prefix = prefix_item.value(0)
scope.output.write(' ModeFile: %s\n' % prefix)
# Write port numbers assigned to post processing
ports_item = toggle_item.find('ports')
for i in range(ports_item.numberOfGroups()):
ref_item = ports_item.item(i, 0)
ref_att = ref_item.value(0)
ent_string = utils.format_entity_string(scope, ref_att)
scope.output.write(' PortNumber: %s\n' % ent_string)
# Check all Waveguide attributes for Postprocess option
waveguide_atts = scope.sim_atts.findAttributes('Waveguide')
for waveguide_att in waveguide_atts:
pp_item = waveguide_att.findVoid('Postprocess')
if pp_item and pp_item.isEnabled():
ent_string = utils.format_entity_string(scope, waveguide_att)
scope.output.write(' PortNumber: %s\n' % ent_string)
scope.output.write('}\n')
......@@ -160,33 +160,51 @@
<Min Inclusive="true">0.0</Min>
</RangeInfo>
</Double>
<Double Name="StartingFrequency" Label="Starting Frequency" Version="0" Units="Hz">
<Categories>
<Cat>S3P</Cat>
</Categories>
<DefaultValue>1.0e9</DefaultValue>
<RangeInfo>
<Min Inclusive="false">0.0</Min>
</RangeInfo>
</Double>
<Double Name="EndingFrequency" Label="Ending Frequency" Version="0" Units="Hz">
<Categories>
<Cat>S3P</Cat>
</Categories>
<DefaultValue>1.0e9</DefaultValue>
<RangeInfo>
<Min Inclusive="false">0.0</Min>
</RangeInfo>
</Double>
<Double Name="FrequencyInterval" Label="Frequency Interval" Version="0" Units="Hz">
<Categories>
<Cat>S3P</Cat>
</Categories>
<DefaultValue>1.0e9</DefaultValue>
<RangeInfo>
<Min Inclusive="false">0.0</Min>
</RangeInfo>
</Double>
<String Name="FrequencyMode" Label="Mode">
<Categories><Cat>S3P</Cat></Categories>
<ChildrenDefinitions>
<Double Name="WaveguideFrequency" Label="Waveguide Frequency" Version="0" Units="Hz">
<DefaultValue>1.0e9</DefaultValue>
<RangeInfo>
<Min Inclusive="false">0.0</Min>
</RangeInfo>
</Double>
<Double Name="StartingFrequency" Label="Starting Frequency" Version="0" Units="Hz">
<DefaultValue>1.0e9</DefaultValue>
<RangeInfo>
<Min Inclusive="false">0.0</Min>
</RangeInfo>
</Double>
<Double Name="EndingFrequency" Label="Ending Frequency" Version="0" Units="Hz">
<DefaultValue>1.0e9</DefaultValue>
<RangeInfo>
<Min Inclusive="false">0.0</Min>
</RangeInfo>
</Double>
<Double Name="FrequencyInterval" Label="Frequency Interval" Version="0" Units="Hz">
<DefaultValue>1.0e9</DefaultValue>
<RangeInfo>
<Min Inclusive="false">0.0</Min>
</RangeInfo>
</Double>
</ChildrenDefinitions>
<DiscreteInfo>
<Structure>
<Value Enum="Waveguide Frequency">waveguide</Value>
<Items>
<Item>WaveguideFrequency</Item>
</Items>
</Structure>
<Structure>
<Value Enum="Frequency Scan">scan</Value>
<Items>
<Item>StartingFrequency</Item>
<Item>EndingFrequency</Item>
<Item>FrequencyInterval</Item>
</Items>
</Structure>
</DiscreteInfo>
</String>
</ItemDefinitions>
</AttDef>
......@@ -204,7 +222,7 @@
<Cat>Omega3P</Cat>
</Categories>
</String>
<Group Name="ports" Label="Ports to be Post-Processed" NumberOfRequiredGroups="0" Extensible="true">
<!-- <Group Name="ports" Label="Ports to be Post-Processed" NumberOfRequiredGroups="0" Extensible="true">
<ItemDefinitions>
<AttributeRef Name="Port" Label="Port to be Postprocessed" Version="0" NumberOfRequiredValues="1" Extensible="true">
<AttDef>Waveguide</AttDef>
......@@ -213,7 +231,7 @@
</Categories>
</AttributeRef>
</ItemDefinitions>
</Group>
</Group> -->
</ItemDefinitions>
</Group>
</ItemDefinitions>
......
......@@ -99,7 +99,7 @@
<Categories>
<Cat>T3P</Cat>
</Categories>
</Double>
</Double>
</ItemDefinitions>
</AttDef>
......@@ -139,6 +139,11 @@
<DefaultValue>1</DefaultValue>
<RangeInfo><Min Inclusive="true">0</Min></RangeInfo>
</Int>
<Void Name="Postprocess" Label="Postprocess" Optional="true" IsEnabledByDefault="false">
<Categories>
<Cat>S3P</Cat>
</Categories>
</Void>
</ItemDefinitions>
</AttDef>
<AttDef Type="HFormulation" Label="HFormulation" AdvanceLevel="99" Version="0">
......
Supports Markdown
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