3import exahype2.solvers.OptimisticAdaptiveTimeSteppingCodeSnippets
9 Code snippet generator for fixed time stepping in the Runge-Kutta schemes
19 tarch::mpi::Rank::getInstance().isGlobalMaster()
21 _maxGridCellHThisTimeStep>0.0
23 isFirstGridSweepOfTimeStep()
25 logInfo( "startTimeStep()", "Solver {{SOLVER_NAME}}:" );
26 logInfo( "startTimeStep()", "t = " << _minTimeStampThisTimeStep );
27 logInfo( "startTimeStep()", "dt = " << getAdmissibleTimeStepSize() );
28 if (_cancelOptimisticTasks) {
29 logInfo( "startTimeStep()", "dt_{predicted} = " << getPredictedAdmissibleTimeStepSize() << " [cancel predicted tasks]" );
32 logInfo( "startTimeStep()", "dt_{predicted} = " << getPredictedAdmissibleTimeStepSize() );
34 logInfo( "startTimeStep()", "h_{min} = " << _minGridCellHThisTimeStep << " (individual grid cell within a patch)");
35 logInfo( "startTimeStep()", "h_{max} = " << _maxGridCellHThisTimeStep << " (individual grid cell within a patch)" );
36 logInfo( "startTimeStep()", "lambda_{max} = " << _maxEigenvalue );
39 if (isFirstGridSweepOfTimeStep()) {
48 The superclass takes the admissible cell size and divides it by the
49 maximum eigenvalue. The Finite Volume solvers however operate with
50 patches, i.e. we have to devide by the volume count per axis.
55 isLastGridSweepOfTimeStep()
57 tarch::la::greater(_maxEigenvalue, 0.0 )
59 const double optimalTimeStepSize = """ + str(self.
_time_step_relaxation) +
""" * _minGridCellHThisTimeStep / _maxEigenvalue / (2*{{RK_ORDER}}-1);
61 const double Threshold = 0.95;
64 tarch::la::smallerEquals(_predictedAdmissibleTimeStepSize,optimalTimeStepSize)
66 tarch::la::greaterEquals(_predictedAdmissibleTimeStepSize,optimalTimeStepSize*Threshold)
68 _admissibleTimeStepSize = _predictedAdmissibleTimeStepSize;
69 _predictedAdmissibleTimeStepSize = 0.5 * (optimalTimeStepSize + _predictedAdmissibleTimeStepSize);
70 _cancelOptimisticTasks = false;
73 _admissibleTimeStepSize = optimalTimeStepSize;
74 _predictedAdmissibleTimeStepSize = Threshold * optimalTimeStepSize;
75 _cancelOptimisticTasks = true;
78 if ( std::isnan(_admissibleTimeStepSize) or std::isinf(_admissibleTimeStepSize) ) {
79 ::tarch::triggerNonCriticalAssertion( __FILE__, __LINE__, "_admissibleTimeStepSize>0", "invalid (NaN of inf) time step size: " + std::to_string(_admissibleTimeStepSize) );
81 if (tarch::la::smallerEquals(_admissibleTimeStepSize,0.0,1e-10) ) {
82 logWarning( "finishTimeStep(...)", "degenerated time step size of " << std::to_string(_admissibleTimeStepSize) << ". Problem might be extremely stiff (and can't be solved) or there could be a bug in the eigenvalue computation" );
Code snippet generator for fixed time stepping in the Runge-Kutta schemes.
create_start_time_step_implementation(self)
__init__(self, time_step_relaxation)
create_finish_time_step_implementation(self)
The superclass takes the admissible cell size and divides it by the maximum eigenvalue.