@@ -117,19 +117,31 @@ Outputs::Outputs(Mesh *pm, ParameterInput *pin, SimTime *tm) {
117
117
op.block_name .assign (pib->block_name );
118
118
119
119
Real dt = 0.0 ; // default value == 0 means that initial data is written by default
120
- // for temporal drivers, setting dt to tlim ensures a final output is also written
120
+ int dn = - 1 ;
121
121
if (tm != nullptr ) {
122
- dt = pin->GetOrAddReal (op.block_name , " dt" , tm ->tlim );
122
+ dn = pin->GetOrAddInteger (op.block_name , " dn" , -1.0 );
123
+
124
+ // If this is a dn controlled output (dn >= 0), soft disable dt based triggering
125
+ // (-> dt = -1), otherwise setting dt to tlim ensures a final output is also
126
+ // written for temporal drivers.
127
+ const auto tlim = dn >= 0 ? -1 : tm ->tlim ;
128
+ dt = pin->GetOrAddReal (op.block_name , " dt" , tlim);
123
129
}
124
130
// if this output is "soft-disabled" (negative value) skip processing
125
- if (dt < 0.0 ) {
131
+ if (dt < 0.0 && dn < 0 ) {
126
132
pib = pib->pnext ; // move to next input block name
127
133
continue ;
128
134
}
135
+
136
+ PARTHENON_REQUIRE_THROWS (!(dt >= 0.0 && dn >= 0 ),
137
+ " dt and dn are enabled for the same output block, which "
138
+ " is not supported. Please set at most one value >= 0." );
129
139
// set time of last output, time between outputs
130
140
if (tm != nullptr ) {
131
141
op.next_time = pin->GetOrAddReal (op.block_name , " next_time" , tm ->time );
132
142
op.dt = dt;
143
+ op.next_n = pin->GetOrAddInteger (op.block_name , " next_n" , tm ->ncycle );
144
+ op.dn = dn;
133
145
}
134
146
135
147
// set file number, basename, id, and format
@@ -259,8 +271,6 @@ Outputs::Outputs(Mesh *pm, ParameterInput *pin, SimTime *tm) {
259
271
if (op.file_type == " hst" ) {
260
272
pnew_type = new HistoryOutput (op);
261
273
num_hst_outputs++;
262
- } else if (op.file_type == " vtk" ) {
263
- pnew_type = new VTKOutput (op);
264
274
} else if (op.file_type == " ascent" ) {
265
275
pnew_type = new AscentOutput (op);
266
276
} else if (op.file_type == " histogram" ) {
@@ -438,9 +448,19 @@ void Outputs::MakeOutputs(Mesh *pm, ParameterInput *pin, SimTime *tm,
438
448
OutputType *ptype = pfirst_type_;
439
449
while (ptype != nullptr ) {
440
450
if ((tm == nullptr ) ||
441
- ((ptype->output_params .dt >= 0.0 ) &&
442
- ((tm ->ncycle == 0 ) || (tm ->time >= ptype->output_params .next_time ) ||
443
- (tm ->time >= tm ->tlim ) || (signal == SignalHandler::OutputSignal::now) ||
451
+ // output is not soft disabled and
452
+ (((ptype->output_params .dt >= 0.0 ) || (ptype->output_params .dn >= 0 )) &&
453
+ // either dump initial data
454
+ ((tm ->ncycle == 0 ) ||
455
+ // or by triggering time or cycle based conditions
456
+ ((ptype->output_params .dt >= 0.0 ) &&
457
+ ((tm ->time >= ptype->output_params .next_time ) ||
458
+ (tm ->tlim > 0.0 && tm ->time >= tm ->tlim ))) ||
459
+ ((ptype->output_params .dn >= 0 ) &&
460
+ ((tm ->ncycle >= ptype->output_params .next_n ) ||
461
+ (tm ->nlim > 0 && tm ->ncycle >= tm ->nlim ))) ||
462
+ // or by manual triggers
463
+ (signal == SignalHandler::OutputSignal::now) ||
444
464
(signal == SignalHandler::OutputSignal::final ) ||
445
465
(signal == SignalHandler::OutputSignal::analysis &&
446
466
ptype->output_params .analysis_flag )))) {
0 commit comments