Peano
Loading...
Searching...
No Matches
FixedTimeSteppingCodeSnippets.py
Go to the documentation of this file.
1# This file is part of the ExaHyPE2 project. For conditions of distribution and
2# use, please see the copyright notice at www.peano-framework.org
4
5
7 """
8 Code snippet generator for fixed time stepping in the Runge-Kutta schemes
9 """
10 def __init__(self, normalised_time_step_size):
11 self._normalised_time_step_size = normalised_time_step_size
12
14 """
15 The outcome is used before we actually roll over the accumulation variables
16 and other stuff.
17 """
18 return """
19 if (
20 tarch::mpi::Rank::getInstance().isGlobalMaster()
21 and
22 (_maxVolumeH > 0.0 or _maxVolumeHThisTimeStep > 0.0)
23 and
24 isFirstGridSweepOfTimeStep()
25 ) {
26 logInfo("startTimeStep(...)", "Solver {{SOLVER_NAME}}:");
27 logInfo("startTimeStep(...)", "t = " << _minTimeStampThisTimeStep);
28 logInfo("startTimeStep(...)", "dt = " << getTimeStepSize());
29 logInfo("startTimeStep(...)", "h_{min} = " << _minVolumeHThisTimeStep << " (volume size)");
30 logInfo("startTimeStep(...)", "h_{max} = " << _maxVolumeHThisTimeStep << " (volume size)");
31 }
32"""
33
35 return """
36 if (isLastGridSweepOfTimeStep()) {
37 assertion(_minVolumeH >= 0.0);
38 assertion(MaxAdmissibleVolumeH > 0.0);
39 if (_minVolumeHThisTimeStep <= MaxAdmissibleVolumeH) {
40 _timeStepSize = """ + str(self._normalised_time_step_size) + """ * _minVolumeHThisTimeStep / MaxAdmissibleVolumeH;
41 } else {
42 _timeStepSize = 0.0;
43 }
44 }
45"""