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):
if not att_list:
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
type_map = {
'ModeVoltageMonitor': 'ModeVoltage',
......@@ -667,15 +654,21 @@ def write_monitor(scope):
scope.output.write('}\n')
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)
if item is None or not item.isMemberOf(scope.categories):
continue
if not item.isEnabled():
continue
if not item.isSet():
continue
if item.numberOfValues() > 1:
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:
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
if type_string == 'Power':
......
......@@ -42,7 +42,7 @@
<Cat>T3P</Cat>
</Categories>
</String>
<Double Name="timeStart" Label="Start Time" Units="s">
<Double Name="TimeStart" Label="Start Time" Units="s">
<BriefDescription>Time when recording fields starts</BriefDescription>
<Categories>
<Cat>T3P</Cat>
......@@ -50,7 +50,7 @@
<DefaultValue>0.0</DefaultValue>
<RangeInfo><Min Inclusive="true">0</Min></RangeInfo>
</Double>
<Double Name="timeEnd" Label="End Time" Units="s">
<Double Name="TimeEnd" Label="End Time" Units="s">
<BriefDescription>Time when recording fields ends</BriefDescription>
<Categories>
<Cat>T3P</Cat>
......@@ -78,13 +78,13 @@ the distance from the front of the bunch and greater than 0</BriefDescription>
<Cat>T3P</Cat>
</Categories>
</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>
<Categories>
<Cat>T3P</Cat>
</Categories>
</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>
<Categories>
<Cat>T3P</Cat>
......@@ -116,7 +116,7 @@ the distance from the front of the bunch and greater than 0</BriefDescription>
<Cat>T3P</Cat>
</Categories>
</ModelEntity>
<Double Name="timeStart" Label="Start Time" Units="s">
<Double Name="TimeStart" Label="Start Time" Units="s">
<BriefDescription>Time when recording power starts</BriefDescription>
<Categories>
<Cat>T3P</Cat>
......
......@@ -265,7 +265,7 @@ SMTK_AttributeSystem(Version="2")
DiscreteInfo(DefaultIndex=0)
Value(Enum="1 = Full Cell") 1
Value(Enum="0 = Half Cell") 0
Value(Enum="3 = Quarter Cell") 2
Value(Enum="2 = Quarter Cell") 2
String(Name="SurfaceResistance" Label="Surface Resistance")
BriefDescription Nonlinear surface resistance
......
......@@ -278,15 +278,43 @@ SMTK_AttributeSystem(Version="2")
String(Name="Placeholder" AdvanceLevel="99")
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")
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
AttributeRef(Name="Emitter" Label="Emitter" NumberOfRequiredValues="1" Version="0")
AttDef Emitter
File(Name="SEYFilename" Label="SEY Filename" Version="0" ShouldExist="true")
BriefDescription File containing secondary emission data for the selected surface
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
File(Name="SEYFilename" Label="SEY Filename" Version="0" ShouldExist="true")
BriefDescription File containing secondary emission data for the selected surface
......@@ -303,12 +331,6 @@ SMTK_AttributeSystem(Version="2")
DefaultValue 1000
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
AttDef(Type="Track3PModelSelectorAtt" Version="0")
ItemDefinitions
......@@ -445,11 +467,13 @@ SMTK_AttributeSystem(Version="2")
View(Type="ModelEntity" Title="Track3PMultipacting" ModelEntityFilter="rf")
AttributeTypes
Att(Type="Track3PMaterialMultipactingPrimary")
Att(Type="Track3PMaterialMultipactingSecondary")
Att(Type="Track3PAbsorber")
View(Type="ModelEntity" Title="Track3PDarkCurrent" ModelEntityFilter="rf")
AttributeTypes
Att(Type="Track3PMaterialDarkCurrentPrimary")
Att(Type="Track3PMaterialDarkCurrentSecondary")
Att(Type="Track3PAbsorber")
= '\n'
......
......@@ -482,7 +482,7 @@
<DiscreteInfo DefaultIndex="0">
<Value Enum="1 = Full Cell">1</Value>
<Value Enum="0 = Half Cell">0</Value>
<Value Enum="3 = Quarter Cell">2</Value>
<Value Enum="2 = Quarter Cell">2</Value>
</DiscreteInfo>
</Int>
<String Name="SurfaceResistance" Label="Surface Resistance">
......
......@@ -453,21 +453,71 @@
</String>
</ItemDefinitions>
</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">
<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>
<AttributeRef Name="Emitter" Label="Emitter" NumberOfRequiredValues="1" Version="0">
<AttDef>Emitter</AttDef>
<File Name="SEYFilename" Label="SEY Filename" Version="0" ShouldExist="true">
<BriefDescription>File containing secondary emission data for the selected surface</BriefDescription>
<Categories>
<Cat>Track3P</Cat>
</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>
</Group>
</ItemDefinitions>
</AttDef>
<AttDef Type="Track3PMaterialDarkCurrentSecondary" BaseType="Track3PMaterial" Label="Secondary" Version="0">
<AttDef Type="Track3PMaterialDarkCurrentSecondary" BaseType="Track3PMaterial" Label="Secondary" Version="1">
<ItemDefinitions>
<File Name="SEYFilename" Label="SEY Filename" Version="0" ShouldExist="true">
<BriefDescription>File containing secondary emission data for the selected surface</BriefDescription>
......@@ -495,16 +545,6 @@
<Min Inclusive="true">1</Min>
</RangeInfo>
</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>
</AttDef>
<!-- Selector attribute - used by selector view-->
......@@ -689,12 +729,14 @@
</View>
<View Type="ModelEntity" Title="Track3PMultipacting" ModelEntityFilter="rf">
<AttributeTypes>
<Att Type="Track3PMaterialMultipactingPrimary"></Att>
<Att Type="Track3PMaterialMultipactingSecondary"></Att>
<Att Type="Track3PAbsorber"></Att>
</AttributeTypes>
</View>
<View Type="ModelEntity" Title="Track3PDarkCurrent" ModelEntityFilter="rf">
<AttributeTypes>
<Att Type="Track3PMaterialDarkCurrentPrimary"></Att>
<Att Type="Track3PMaterialDarkCurrentSecondary"></Att>
<Att Type="Track3PAbsorber"></Att>
</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
* Monitor Boundary ----> side set 1
* End Time ------------> NOT checked
* 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:
{
File: pillboxwg.ncdf
......@@ -72,6 +72,16 @@ TimeStepping:
DT: 1e-12
}
Monitor:
{
Type: Power
Name: power
TimeStart: 0.0
TimeStep: 2e-12
TimeEnd: 5e-09
ReferenceNumber: 1
}
Monitor:
{
Type: ModeVoltage
......@@ -88,16 +98,6 @@ Monitor:
}
}
Monitor:
{
Type: Power
Name: power
TimeStart: 0.0
TimeStep: 2e-12
TimeEnd: 5e-09
ReferenceNumber: 1
}
LinearSolver:
{
Solver: MUMPS
......
// Generated by CMB 28-Jun-2018 18:11
// Generated by CMB 23-Jul-2018 15:52
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
Side set 1 --------> Absorber
Side set 2 --------> Absorber
Side set 6 --------> Secondary
Primary ---------> on (checked)
Side set 6 --------> Primary
Emitter ---------> Emitter-0
Secondary -------> on (checked)
## Postprocess
......
......@@ -194,10 +194,7 @@ class Track3PWriter(basewriter.BaseWriter):
# Emitters are assigned to model entities via the material attributes
mat_list = self.scope.sim_atts.findAttributes('Track3PMaterial')
for mat_att in mat_list:
primary_item = mat_att.findGroup('Primary')
if primary_item is None or not primary_item.isEnabled():
continue
emitter_item = primary_item.find('Emitter')
emitter_item = mat_att.find('Emitter')
if emitter_item is None or not emitter_item.isSet(0):
continue
......@@ -294,28 +291,37 @@ class Track3PWriter(basewriter.BaseWriter):
# Traverse sorted_dict and write materials
for id_string, att in sorted_dict.iteritems():
# Look for primary material option
primary_item = att.findGroup('Primary')
if primary_item and primary_item.isEnabled():
if 'Primary' in att.type():
self.start_command('Material')
self.scope.output.write(' Type: Primary\n')
self.scope.output.write(' %s: %s\n' % (keyword, id_string))
self.finish_command()
# Write either Secondary or Absorber
self.start_command('Material')
if 'Secondary' in att.type():
# Primary type can include optional secondary item
secondary_item = att.find('Secondary')
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(' %s: %s\n' % (keyword, id_string))
self._write_secondary_material_items(att, track3p_sim)
self.finish_command()
elif 'Absorber' in att.type():
self.start_command('Material')
self.scope.output.write(' Type: Absorber\n')
self.scope.output.write(' %s: %s\n' % (keyword, id_string))
self.finish_command()
else:
raise Exception('Unrecognized material type %s' % att.type())
self.finish_command() # Material (Secondary or Absorber)
def _write_secondary_material_items(self, att, track3p_sim):
'''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