Peano
Loading...
Searching...
No Matches
FixedSubcyclingTimeSteppingCodeSnippets.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
3import exahype2.solvers.FixedSubcyclingTimeSteppingCodeSnippets
4
5
6class FixedSubcyclingTimeSteppingCodeSnippets( exahype2.solvers.FixedSubcyclingTimeSteppingCodeSnippets ):
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, remove_accumulation_errors):
13 super( FixedSubcyclingTimeSteppingCodeSnippets, self ).__init__(remove_accumulation_errors)
14
15 self._normalised_time_step_size = normalised_time_step_size
16 self._use_enclave_tasking = use_enclave_tasking
17
18
20 """
21
22 The outcome is used before we actually roll over the accumulation variables
23 and other stuff.
24
25 """
26 predicate = """
27 tarch::mpi::Rank::getInstance().isGlobalMaster()
28 and
29 _maxVolumeH>0.0
30 """
31
33 predicate += """and (_solverState == SolverState::Primary or _solverState == SolverState::PrimaryAfterGridInitialisation) """
34
35 return """
36 if (""" + predicate + """) {
37 logInfo( "step()", "Solver {{SOLVER_NAME}}:" );
38 logInfo( "step()", "t_{min,global} = " << _minTimeStampThisTimeStep );
39 logInfo( "step()", "t_{max,global} = " << _maxTimeStampThisTimeStep );
40 logInfo( "step()", "t_{min,this-step} = " << _localMinTimeStampThisTimeStep );
41 logInfo( "step()", "t_{max,this-step} = " << _localMaxTimeStampThisTimeStep );
42 if (_minTimeStepSize > _maxTimeStepSize ) {
43 logInfo( "step()", "dt_{min} = <not yet known>" );
44 logInfo( "step()", "dt_{max} = <not yet known>" );
45 }
46 else {
47 logInfo( "step()", "dt_{min} = " << _minTimeStepSizeThisTimeStep );
48 logInfo( "step()", "dt_{max} = " << _maxTimeStepSizeThisTimeStep );
49 }
50 logInfo( "step()", "h_{min} = " << _minVolumeH << " (volume size)");
51 logInfo( "step()", "h_{max} = " << _maxVolumeH << " (volume size)" );
52 logInfo( "step()", "#updates = " << _patchUpdates << " (no of patches)" );
53 }
54"""
55
56
58 """
59
60 The superclass takes the admissible cell size and divides it by the
61 maximum eigenvalue. The Finite Volume solvers however operate with
62 patches, i.e. we have to devide by the volume count per axis.
63
64 """
65 return """
66 assertion( _minVolumeH >= 0.0 );
67 assertion( MaxAdmissibleVolumeH > 0.0 );
68 if (_minVolumeH <= MaxAdmissibleVolumeH) {
69 _timeStepSize = """ + str(self._normalised_time_step_size) + """ * _minVolumeH / MaxAdmissibleVolumeH;
70 }
71 else {
72 _timeStepSize = 0.0;
73 }
74"""
create_finish_time_step_implementation(self)
The superclass takes the admissible cell size and divides it by the maximum eigenvalue.
__init__(self, normalised_time_step_size, use_enclave_tasking, remove_accumulation_errors)
create_start_time_step_implementation(self)
The outcome is used before we actually roll over the accumulation variables and other stuff.