Commit 755067e5 authored by John Tourtellott's avatar John Tourtellott

Merge branch 'track3p-material-mod' into 'master'

Track3p material mod

See merge request !57
parents 83cbdd6b 5d0bf6ed
...@@ -620,19 +620,6 @@ def write_monitor(scope): ...@@ -620,19 +620,6 @@ def write_monitor(scope):
if not att_list: if not att_list:
return return
# List of <item name, T3P keyword> pairs
item_keyword_table = [
('Point', 'Point'),
('timeStart', 'TimeStart'),
('timeEnd', 'TimeEnd'),
('TimeStep', 'TimeStep'),
('startContour', 'StartContour'),
('endContour', 'EndContour'),
('Smax', 'Smax')
]
# Map attribute type to T3P keyword # Map attribute type to T3P keyword
type_map = { type_map = {
'ModeVoltageMonitor': 'ModeVoltage', 'ModeVoltageMonitor': 'ModeVoltage',
...@@ -667,15 +654,21 @@ def write_monitor(scope): ...@@ -667,15 +654,21 @@ def write_monitor(scope):
scope.output.write('}\n') scope.output.write('}\n')
continue continue
for item_type, keyword in item_keyword_table: item_type_list = \
['Point', 'TimeStart', 'TimeEnd', 'TimeStep', 'StartContour', 'EndContour', 'Smax']
for item_type in item_type_list:
item = att.find(item_type) item = att.find(item_type)
if item is None or not item.isMemberOf(scope.categories): if item is None or not item.isMemberOf(scope.categories):
continue continue
if not item.isEnabled():
continue
if not item.isSet():
continue
if item.numberOfValues() > 1: if item.numberOfValues() > 1:
value_string = utils.format_vector(item) value_string = utils.format_vector(item)
scope.output.write(' %s: %s\n' % (keyword, value_string)) scope.output.write(' %s: %s\n' % (item_type, value_string))
else: else:
scope.output.write(' %s: %s\n' % (keyword, item.value(0))) scope.output.write(' %s: %s\n' % (item_type, item.value(0)))
# PowerMonitor can use analysis end time and interval if not set here # PowerMonitor can use analysis end time and interval if not set here
if type_string == 'Power': if type_string == 'Power':
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<Cat>T3P</Cat> <Cat>T3P</Cat>
</Categories> </Categories>
</String> </String>
<Double Name="timeStart" Label="Start Time" Units="s"> <Double Name="TimeStart" Label="Start Time" Units="s">
<BriefDescription>Time when recording fields starts</BriefDescription> <BriefDescription>Time when recording fields starts</BriefDescription>
<Categories> <Categories>
<Cat>T3P</Cat> <Cat>T3P</Cat>
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<DefaultValue>0.0</DefaultValue> <DefaultValue>0.0</DefaultValue>
<RangeInfo><Min Inclusive="true">0</Min></RangeInfo> <RangeInfo><Min Inclusive="true">0</Min></RangeInfo>
</Double> </Double>
<Double Name="timeEnd" Label="End Time" Units="s"> <Double Name="TimeEnd" Label="End Time" Units="s">
<BriefDescription>Time when recording fields ends</BriefDescription> <BriefDescription>Time when recording fields ends</BriefDescription>
<Categories> <Categories>
<Cat>T3P</Cat> <Cat>T3P</Cat>
...@@ -78,13 +78,13 @@ the distance from the front of the bunch and greater than 0</BriefDescription> ...@@ -78,13 +78,13 @@ the distance from the front of the bunch and greater than 0</BriefDescription>
<Cat>T3P</Cat> <Cat>T3P</Cat>
</Categories> </Categories>
</String> </String>
<Double Name="startContour" Label="Start Contour" Units="m" Optional="true"> <Double Name="StartContour" Label="Start Contour" Units="m" Optional="true">
<BriefDescription>The position where wakefield integration starts. By default it is at beginning of the domain in z</BriefDescription> <BriefDescription>The position where wakefield integration starts. By default it is at beginning of the domain in z</BriefDescription>
<Categories> <Categories>
<Cat>T3P</Cat> <Cat>T3P</Cat>
</Categories> </Categories>
</Double> </Double>
<Double Name="endContour" Label="End Contour" Units="m" Optional="true"> <Double Name="EndContour" Label="End Contour" Units="m" Optional="true">
<BriefDescription>The position where wakefield integration stops. By default it is at end of the domain in z</BriefDescription> <BriefDescription>The position where wakefield integration stops. By default it is at end of the domain in z</BriefDescription>
<Categories> <Categories>
<Cat>T3P</Cat> <Cat>T3P</Cat>
...@@ -116,7 +116,7 @@ the distance from the front of the bunch and greater than 0</BriefDescription> ...@@ -116,7 +116,7 @@ the distance from the front of the bunch and greater than 0</BriefDescription>
<Cat>T3P</Cat> <Cat>T3P</Cat>
</Categories> </Categories>
</ModelEntity> </ModelEntity>
<Double Name="timeStart" Label="Start Time" Units="s"> <Double Name="TimeStart" Label="Start Time" Units="s">
<BriefDescription>Time when recording power starts</BriefDescription> <BriefDescription>Time when recording power starts</BriefDescription>
<Categories> <Categories>
<Cat>T3P</Cat> <Cat>T3P</Cat>
......
...@@ -265,7 +265,7 @@ SMTK_AttributeSystem(Version="2") ...@@ -265,7 +265,7 @@ SMTK_AttributeSystem(Version="2")
DiscreteInfo(DefaultIndex=0) DiscreteInfo(DefaultIndex=0)
Value(Enum="1 = Full Cell") 1 Value(Enum="1 = Full Cell") 1
Value(Enum="0 = Half Cell") 0 Value(Enum="0 = Half Cell") 0
Value(Enum="3 = Quarter Cell") 2 Value(Enum="2 = Quarter Cell") 2
String(Name="SurfaceResistance" Label="Surface Resistance") String(Name="SurfaceResistance" Label="Surface Resistance")
BriefDescription Nonlinear surface resistance BriefDescription Nonlinear surface resistance
......
...@@ -278,15 +278,43 @@ SMTK_AttributeSystem(Version="2") ...@@ -278,15 +278,43 @@ SMTK_AttributeSystem(Version="2")
String(Name="Placeholder" AdvanceLevel="99") String(Name="Placeholder" AdvanceLevel="99")
Categories #[Cat Track3P] Categories #[Cat Track3P]
AttDef(Type="Track3PMaterialMultipactingPrimary" BaseType="Track3PMaterial" Label="Primary" Version="1")
ItemDefinitions
AttributeRef(Name="Emitter" Label="Emitter" NumberOfRequiredValues="1" Version="0")
AttDef Emitter
Categories #[Cat Track3P]
Void(Name="Secondary" Label="Secondary" Optional="true" IsEnabledByDefault="false" Version="0")
Categories #[Cat Track3P]
AttDef(Type="Track3PMaterialMultipactingSecondary" BaseType="Track3PMaterial" Label="Secondary" Version="0") AttDef(Type="Track3PMaterialMultipactingSecondary" BaseType="Track3PMaterial" Label="Secondary" Version="0")
ItemDefinitions ItemDefinitions
Group(Name="Primary" Label="Primary" Optional="true" IsEnabledByDefault="false" Version="0") Void(Name="Placeholder" AdvanceLevel="99")
Categories #[Cat Track3P]
AttDef(Type="Track3PMaterialDarkCurrentPrimary" BaseType="Track3PMaterial" Label="Primary" Version="1")
ItemDefinitions
AttributeRef(Name="Emitter" Label="Emitter" NumberOfRequiredValues="1" Version="0")
AttDef Emitter
Categories #[Cat Track3P]
Group(Name="Secondary" Label="Secondary" Optional="true" IsEnabledByDefault="false" Version="0")
ItemDefinitions ItemDefinitions
AttributeRef(Name="Emitter" Label="Emitter" NumberOfRequiredValues="1" Version="0") File(Name="SEYFilename" Label="SEY Filename" Version="0" ShouldExist="true")
AttDef Emitter BriefDescription File containing secondary emission data for the selected surface
Categories #[Cat Track3P] Categories #[Cat Track3P]
AttDef(Type="Track3PMaterialDarkCurrentSecondary" BaseType="Track3PMaterial" Label="Secondary" Version="0") Int(Name="MinimumNumElectrons" Label="Minimum Number of Electrons" Version="0")
BriefDescription Minimum number of electrons in each secondary macro particle
Categories #[Cat Track3P]
DefaultValue 1000
RangeInfo #[Min(Inclusive="true") 1]
Int(Name="ElasticThreshold" Label="Elastic Threshold" Version="0")
BriefDescription Minimum number of electrons in each secondary reflected-type macro particle
Categories #[Cat Track3P]
DefaultValue 1000
RangeInfo #[Min(Inclusive="true") 1]
AttDef(Type="Track3PMaterialDarkCurrentSecondary" BaseType="Track3PMaterial" Label="Secondary" Version="1")
ItemDefinitions ItemDefinitions
File(Name="SEYFilename" Label="SEY Filename" Version="0" ShouldExist="true") File(Name="SEYFilename" Label="SEY Filename" Version="0" ShouldExist="true")
BriefDescription File containing secondary emission data for the selected surface BriefDescription File containing secondary emission data for the selected surface
...@@ -303,12 +331,6 @@ SMTK_AttributeSystem(Version="2") ...@@ -303,12 +331,6 @@ SMTK_AttributeSystem(Version="2")
DefaultValue 1000 DefaultValue 1000
RangeInfo #[Min(Inclusive="true") 1] RangeInfo #[Min(Inclusive="true") 1]
Group(Name="Primary" Label="Primary" Optional="true" IsEnabledByDefault="false" Version="0")
ItemDefinitions
AttributeRef(Name="Emitter" Label="Emitter" NumberOfRequiredValues="1" Version="0")
AttDef Emitter
Categories #[Cat Track3P]
// Selector attribute - used by selector view // Selector attribute - used by selector view
AttDef(Type="Track3PModelSelectorAtt" Version="0") AttDef(Type="Track3PModelSelectorAtt" Version="0")
ItemDefinitions ItemDefinitions
...@@ -445,11 +467,13 @@ SMTK_AttributeSystem(Version="2") ...@@ -445,11 +467,13 @@ SMTK_AttributeSystem(Version="2")
View(Type="ModelEntity" Title="Track3PMultipacting" ModelEntityFilter="rf") View(Type="ModelEntity" Title="Track3PMultipacting" ModelEntityFilter="rf")
AttributeTypes AttributeTypes
Att(Type="Track3PMaterialMultipactingPrimary")
Att(Type="Track3PMaterialMultipactingSecondary") Att(Type="Track3PMaterialMultipactingSecondary")
Att(Type="Track3PAbsorber") Att(Type="Track3PAbsorber")
View(Type="ModelEntity" Title="Track3PDarkCurrent" ModelEntityFilter="rf") View(Type="ModelEntity" Title="Track3PDarkCurrent" ModelEntityFilter="rf")
AttributeTypes AttributeTypes
Att(Type="Track3PMaterialDarkCurrentPrimary")
Att(Type="Track3PMaterialDarkCurrentSecondary") Att(Type="Track3PMaterialDarkCurrentSecondary")
Att(Type="Track3PAbsorber") Att(Type="Track3PAbsorber")
= '\n' = '\n'
......
...@@ -482,7 +482,7 @@ ...@@ -482,7 +482,7 @@
<DiscreteInfo DefaultIndex="0"> <DiscreteInfo DefaultIndex="0">
<Value Enum="1 = Full Cell">1</Value> <Value Enum="1 = Full Cell">1</Value>
<Value Enum="0 = Half Cell">0</Value> <Value Enum="0 = Half Cell">0</Value>
<Value Enum="3 = Quarter Cell">2</Value> <Value Enum="2 = Quarter Cell">2</Value>
</DiscreteInfo> </DiscreteInfo>
</Int> </Int>
<String Name="SurfaceResistance" Label="Surface Resistance"> <String Name="SurfaceResistance" Label="Surface Resistance">
......
...@@ -453,21 +453,71 @@ ...@@ -453,21 +453,71 @@
</String> </String>
</ItemDefinitions> </ItemDefinitions>
</AttDef> </AttDef>
<AttDef Type="Track3PMaterialMultipactingPrimary" BaseType="Track3PMaterial" Label="Primary" Version="1">
<ItemDefinitions>
<AttributeRef Name="Emitter" Label="Emitter" NumberOfRequiredValues="1" Version="0">
<AttDef>Emitter</AttDef>
<Categories>
<Cat>Track3P</Cat>
</Categories>
</AttributeRef>
<Void Name="Secondary" Label="Secondary" Optional="true" IsEnabledByDefault="false" Version="0">
<Categories>
<Cat>Track3P</Cat>
</Categories>
</Void>
</ItemDefinitions>
</AttDef>
<AttDef Type="Track3PMaterialMultipactingSecondary" BaseType="Track3PMaterial" Label="Secondary" Version="0"> <AttDef Type="Track3PMaterialMultipactingSecondary" BaseType="Track3PMaterial" Label="Secondary" Version="0">
<ItemDefinitions> <ItemDefinitions>
<Group Name="Primary" Label="Primary" Optional="true" IsEnabledByDefault="false" Version="0"> <Void Name="Placeholder" AdvanceLevel="99">
<Categories>
<Cat>Track3P</Cat>
</Categories>
</Void>
</ItemDefinitions>
</AttDef>
<AttDef Type="Track3PMaterialDarkCurrentPrimary" BaseType="Track3PMaterial" Label="Primary" Version="1">
<ItemDefinitions>
<AttributeRef Name="Emitter" Label="Emitter" NumberOfRequiredValues="1" Version="0">
<AttDef>Emitter</AttDef>
<Categories>
<Cat>Track3P</Cat>
</Categories>
</AttributeRef>
<Group Name="Secondary" Label="Secondary" Optional="true" IsEnabledByDefault="false" Version="0">
<ItemDefinitions> <ItemDefinitions>
<AttributeRef Name="Emitter" Label="Emitter" NumberOfRequiredValues="1" Version="0"> <File Name="SEYFilename" Label="SEY Filename" Version="0" ShouldExist="true">
<AttDef>Emitter</AttDef> <BriefDescription>File containing secondary emission data for the selected surface</BriefDescription>
<Categories> <Categories>
<Cat>Track3P</Cat> <Cat>Track3P</Cat>
</Categories> </Categories>
</AttributeRef> </File>
<Int Name="MinimumNumElectrons" Label="Minimum Number of Electrons" Version="0">
<BriefDescription>Minimum number of electrons in each secondary macro particle</BriefDescription>
<Categories>
<Cat>Track3P</Cat>
</Categories>
<DefaultValue>1000</DefaultValue>
<RangeInfo>
<Min Inclusive="true">1</Min>
</RangeInfo>
</Int>
<Int Name="ElasticThreshold" Label="Elastic Threshold" Version="0">
<BriefDescription>Minimum number of electrons in each secondary reflected-type macro particle</BriefDescription>
<Categories>
<Cat>Track3P</Cat>
</Categories>
<DefaultValue>1000</DefaultValue>
<RangeInfo>
<Min Inclusive="true">1</Min>
</RangeInfo>
</Int>
</ItemDefinitions> </ItemDefinitions>
</Group> </Group>
</ItemDefinitions> </ItemDefinitions>
</AttDef> </AttDef>
<AttDef Type="Track3PMaterialDarkCurrentSecondary" BaseType="Track3PMaterial" Label="Secondary" Version="0"> <AttDef Type="Track3PMaterialDarkCurrentSecondary" BaseType="Track3PMaterial" Label="Secondary" Version="1">
<ItemDefinitions> <ItemDefinitions>
<File Name="SEYFilename" Label="SEY Filename" Version="0" ShouldExist="true"> <File Name="SEYFilename" Label="SEY Filename" Version="0" ShouldExist="true">
<BriefDescription>File containing secondary emission data for the selected surface</BriefDescription> <BriefDescription>File containing secondary emission data for the selected surface</BriefDescription>
...@@ -495,16 +545,6 @@ ...@@ -495,16 +545,6 @@
<Min Inclusive="true">1</Min> <Min Inclusive="true">1</Min>
</RangeInfo> </RangeInfo>
</Int> </Int>
<Group Name="Primary" Label="Primary" Optional="true" IsEnabledByDefault="false" Version="0">
<ItemDefinitions>
<AttributeRef Name="Emitter" Label="Emitter" NumberOfRequiredValues="1" Version="0">
<AttDef>Emitter</AttDef>
<Categories>
<Cat>Track3P</Cat>
</Categories>
</AttributeRef>
</ItemDefinitions>
</Group>
</ItemDefinitions> </ItemDefinitions>
</AttDef> </AttDef>
<!-- Selector attribute - used by selector view--> <!-- Selector attribute - used by selector view-->
...@@ -689,12 +729,14 @@ ...@@ -689,12 +729,14 @@
</View> </View>
<View Type="ModelEntity" Title="Track3PMultipacting" ModelEntityFilter="rf"> <View Type="ModelEntity" Title="Track3PMultipacting" ModelEntityFilter="rf">
<AttributeTypes> <AttributeTypes>
<Att Type="Track3PMaterialMultipactingPrimary"></Att>
<Att Type="Track3PMaterialMultipactingSecondary"></Att> <Att Type="Track3PMaterialMultipactingSecondary"></Att>
<Att Type="Track3PAbsorber"></Att> <Att Type="Track3PAbsorber"></Att>
</AttributeTypes> </AttributeTypes>
</View> </View>
<View Type="ModelEntity" Title="Track3PDarkCurrent" ModelEntityFilter="rf"> <View Type="ModelEntity" Title="Track3PDarkCurrent" ModelEntityFilter="rf">
<AttributeTypes> <AttributeTypes>
<Att Type="Track3PMaterialDarkCurrentPrimary"></Att>
<Att Type="Track3PMaterialDarkCurrentSecondary"></Att> <Att Type="Track3PMaterialDarkCurrentSecondary"></Att>
<Att Type="Track3PAbsorber"></Att> <Att Type="Track3PAbsorber"></Att>
</AttributeTypes> </AttributeTypes>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -56,3 +56,7 @@ Power Monitor ---------> New ...@@ -56,3 +56,7 @@ Power Monitor ---------> New
* Monitor Boundary ----> side set 1 * Monitor Boundary ----> side set 1
* End Time ------------> NOT checked * End Time ------------> NOT checked
* Time Intervals ------> 2e-12 * Time Intervals ------> 2e-12
## Save simulation
internal/test/t3p/cavity-quarter/t3p-test2.crf
// Generated by CMB 03-Jul-2018 16:51 // Generated by CMB 23-Jul-2018 16:35
ModelInfo: ModelInfo:
{ {
File: pillboxwg.ncdf File: pillboxwg.ncdf
...@@ -72,6 +72,16 @@ TimeStepping: ...@@ -72,6 +72,16 @@ TimeStepping:
DT: 1e-12 DT: 1e-12
} }
Monitor:
{
Type: Power
Name: power
TimeStart: 0.0
TimeStep: 2e-12
TimeEnd: 5e-09
ReferenceNumber: 1
}
Monitor: Monitor:
{ {
Type: ModeVoltage Type: ModeVoltage
...@@ -88,16 +98,6 @@ Monitor: ...@@ -88,16 +98,6 @@ Monitor:
} }
} }
Monitor:
{
Type: Power
Name: power
TimeStart: 0.0
TimeStep: 2e-12
TimeEnd: 5e-09
ReferenceNumber: 1
}
LinearSolver: LinearSolver:
{ {
Solver: MUMPS Solver: MUMPS
......
// Generated by CMB 28-Jun-2018 18:11 // Generated by CMB 23-Jul-2018 15:52
TotalTime: 20 TotalTime: 20
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -53,9 +53,9 @@ Simulation Model --> Multipacting ...@@ -53,9 +53,9 @@ Simulation Model --> Multipacting
Side set 1 --------> Absorber Side set 1 --------> Absorber
Side set 2 --------> Absorber Side set 2 --------> Absorber
Side set 6 --------> Secondary Side set 6 --------> Primary
Primary ---------> on (checked)
Emitter ---------> Emitter-0 Emitter ---------> Emitter-0
Secondary -------> on (checked)
## Postprocess ## Postprocess
......
...@@ -194,10 +194,7 @@ class Track3PWriter(basewriter.BaseWriter): ...@@ -194,10 +194,7 @@ class Track3PWriter(basewriter.BaseWriter):
# Emitters are assigned to model entities via the material attributes # Emitters are assigned to model entities via the material attributes
mat_list = self.scope.sim_atts.findAttributes('Track3PMaterial') mat_list = self.scope.sim_atts.findAttributes('Track3PMaterial')
for mat_att in mat_list: for mat_att in mat_list:
primary_item = mat_att.findGroup('Primary') emitter_item = mat_att.find('Emitter')
if primary_item is None or not primary_item.isEnabled():
continue
emitter_item = primary_item.find('Emitter')
if emitter_item is None or not emitter_item.isSet(0): if emitter_item is None or not emitter_item.isSet(0):
continue continue
...@@ -294,28 +291,37 @@ class Track3PWriter(basewriter.BaseWriter): ...@@ -294,28 +291,37 @@ class Track3PWriter(basewriter.BaseWriter):
# Traverse sorted_dict and write materials # Traverse sorted_dict and write materials
for id_string, att in sorted_dict.iteritems(): for id_string, att in sorted_dict.iteritems():
# Look for primary material option if 'Primary' in att.type():
primary_item = att.findGroup('Primary')
if primary_item and primary_item.isEnabled():
self.start_command('Material') self.start_command('Material')
self.scope.output.write(' Type: Primary\n') self.scope.output.write(' Type: Primary\n')
self.scope.output.write(' %s: %s\n' % (keyword, id_string)) self.scope.output.write(' %s: %s\n' % (keyword, id_string))
self.finish_command() self.finish_command()
# Write either Secondary or Absorber # Primary type can include optional secondary item
self.start_command('Material') secondary_item = att.find('Secondary')
if 'Secondary' in att.type(): if secondary_item is not None:
self.start_command('Material')
self.scope.output.write(' Type: Secondary\n')
self.scope.output.write(' %s: %s\n' % (keyword, id_string))
self._write_secondary_material_items(att, track3p_sim)
self.finish_command()
elif 'Secondary' in att.type():
self.start_command('Material')
self.scope.output.write(' Type: Secondary\n') self.scope.output.write(' Type: Secondary\n')
self.scope.output.write(' %s: %s\n' % (keyword, id_string)) self.scope.output.write(' %s: %s\n' % (keyword, id_string))
self._write_secondary_material_items(att, track3p_sim) self._write_secondary_material_items(att, track3p_sim)
self.finish_command()
elif 'Absorber' in att.type(): elif 'Absorber' in att.type():
self.start_command('Material')
self.scope.output.write(' Type: Absorber\n') self.scope.output.write(' Type: Absorber\n')
self.scope.output.write(' %s: %s\n' % (keyword, id_string)) self.scope.output.write(' %s: %s\n' % (keyword, id_string))
self.finish_command()
else: else:
raise Exception('Unrecognized material type %s' % att.type()) raise Exception('Unrecognized material type %s' % att.type())
self.finish_command() # Material (Secondary or Absorber)
def _write_secondary_material_items(self, att, track3p_sim): def _write_secondary_material_items(self, att, track3p_sim):
'''Offloads some of the logic from write_materials() '''Offloads some of the logic from write_materials()
......
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