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
9
Code snippet generator for fixed time stepping in the Runge-Kutta schemes
10
11
"""
12
def
__init__(self, normalised_time_step_size, use_enclave_tasking):
13
self.
_normalised_time_step_size
= normalised_time_step_size
14
self.
_use_enclave_tasking
= use_enclave_tasking
15
16
17
def
create_start_time_step_implementation
(self):
18
"""
19
20
The outcome is used before we actually roll over the accumulation variables
21
and other stuff. So we assume that the state is already updated, but the
22
other data is not yet rolled-over.
23
24
I don't want to plot the very first time stamp, where I don't know the
25
cell size yet, so I check _maxCellHThisTimeStep. If we don't know the cell
26
size yet, we haven't done a single grid sweep. In this case, I don't plot
27
anything. The other check isFirstGridSweepOfTimeStep() ensures that I only
28
plot once prior to the first Runge-Kutta step.
29
30
"""
31
predicate =
"""
32
tarch::mpi::Rank::getInstance().isGlobalMaster()
33
and
34
_maxCellHThisTimeStep>0.0
35
and
36
isFirstGridSweepOfTimeStep()
37
"""
38
39
if
self.
_use_enclave_tasking
:
40
predicate +=
"""and (_solverState == SolverState::Primary or _solverState == SolverState::PrimaryAfterGridInitialisation) """
41
42
return
"""
43
if ("""
+ predicate +
""") {
44
logInfo( "startTimeStep()", "Solver {{SOLVER_NAME}}:" );
45
logInfo( "startTimeStep()", "t = " << _minTimeStampThisTimeStep );
46
logInfo( "startTimeStep()", "dt = " << getTimeStepSize() );
47
logInfo( "startTimeStep()", "h_{min} = " << _minCellHThisTimeStep );
48
logInfo( "startTimeStep()", "h_{max} = " << _maxCellHThisTimeStep );
49
}
50
"""
51
52
53
def
create_finish_time_step_implementation
(self):
54
return
"""
55
if ( isLastGridSweepOfTimeStep() ) {
56
assertion( _minCellH >= 0.0 );
57
assertion( MaxAdmissibleCellH > 0.0 );
58
if (_minCellHThisTimeStep <= MaxAdmissibleCellH) {
59
_timeStepSize = """
+ str(self.
_normalised_time_step_size
) +
""" * _minCellHThisTimeStep / {{RK_ORDER}} / {{RK_ORDER}};
60
}
61
else {
62
_timeStepSize = 0.0;
63
}
64
}
65
"""
66
67
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.rkdg.FixedTimeSteppingCodeSnippets.FixedTimeSteppingCodeSnippets._use_enclave_tasking
_use_enclave_tasking
Definition
FixedTimeSteppingCodeSnippets.py:14
exahype2.solvers.rkdg.FixedTimeSteppingCodeSnippets.FixedTimeSteppingCodeSnippets._normalised_time_step_size
_normalised_time_step_size
Definition
FixedTimeSteppingCodeSnippets.py:13
python
exahype2
solvers
rkdg
FixedTimeSteppingCodeSnippets.py
Generated on Tue Mar 18 2025 20:03:03 for Peano by
1.10.0