Commit 5d0bf6ed authored by John Tourtellott's avatar John Tourtellott

Fix bug in T3P power monitor start/end times

parent ff3e704c
......@@ -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>
......
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
......
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