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
3
import
exahype2.solvers.FixedTimeSteppingCodeSnippets
4
5
6
class
FixedTimeSteppingCodeSnippets
(
exahype2.solvers.FixedTimeSteppingCodeSnippets
):
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
13
def
create_start_time_step_implementation
(self):
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
34
def
create_finish_time_step_implementation
(self):
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
"""
exahype2.solvers.FixedTimeSteppingCodeSnippets.FixedTimeSteppingCodeSnippets
Code snippet generator for all fixed time stepping solvers.
Definition
FixedTimeSteppingCodeSnippets.py:6
exahype2.solvers.SolverCodeSnippets.SolverCodeSnippets.create_start_time_step_implementation
create_start_time_step_implementation(self)
Definition
SolverCodeSnippets.py:66
exahype2.solvers.SolverCodeSnippets.SolverCodeSnippets.create_finish_time_step_implementation
create_finish_time_step_implementation(self)
Definition
SolverCodeSnippets.py:71
exahype2.solvers.fv.FixedTimeSteppingCodeSnippets.FixedTimeSteppingCodeSnippets._normalised_time_step_size
_normalised_time_step_size
Definition
FixedTimeSteppingCodeSnippets.py:11
python
exahype2
solvers
fv
FixedTimeSteppingCodeSnippets.py
Generated on Fri Apr 25 2025 14:59:11 for Peano by
1.10.0