9 Code snippet generator for fixed time stepping in the Runge-Kutta schemes
12 def __init__(self, time_step_relaxation, use_enclave_tasking):
19 tarch::mpi::Rank::getInstance().isGlobalMaster()
24 if use_enclave_tasking:
25 predicate +=
"""and (_solverState == SolverState::Primary or _solverState == SolverState::PrimaryAfterGridInitialisation) """
28 if (""" + predicate +
""") {
29 logInfo( "startTimeStep()", "Solver {{SOLVER_NAME}}:" );
30 logInfo( "startTimeStep()", "t_{min,global} = " << _minTimeStamp );
31 logInfo( "startTimeStep()", "t_{max,global} = " << _maxTimeStamp );
32 logInfo( "startTimeStep()", "t_{min,this-step} = " << _minTimeStampThisTimeStep );
33 logInfo( "startTimeStep()", "t_{max,this-step} = " << _maxTimeStampThisTimeStep );
34 if (_minTimeStepSize > _maxTimeStepSize ) {
35 logInfo( "startTimeStep()", "dt_{min} = <not yet known>" );
36 logInfo( "startTimeStep()", "dt_{max} = <not yet known>" );
39 logInfo( "startTimeStep()", "dt_{min,this-step} = " << _minTimeStepSize );
40 logInfo( "startTimeStep()", "dt_{max,this-step} = " << _maxTimeStepSize );
42 logInfo( "startTimeStep()", "h_{min} = " << _minVolumeH << " (volume size)");
43 logInfo( "startTimeStep()", "h_{max} = " << _maxVolumeH << " (volume size)" );
44 logInfo( "startTimeStep()", "lambda_{max} = " << _maxEigenvalue );
45 logInfo( "startTimeStep()", "#updates = " << _patchUpdates << " (no of patches)" );
49 if use_enclave_tasking:
50 clear_max_eigenvalue =
"""if (_solverState == SolverState::Primary or _solverState == SolverState::PrimaryAfterGridInitialisation) {
54 clear_max_eigenvalue =
"""if (_solverState == SolverState::TimeStep or _solverState == SolverState::TimeStepAfterGridInitialisation) {
58 return statistics + clear_max_eigenvalue
64 The superclass takes the admissible cell size and divides it by the
65 maximum eigenvalue. The Finite Volume solvers however operate with
66 patches, i.e. we have to devide by the volume count per axis.
70 if ( tarch::la::greater(_maxEigenvalue, 0.0 ) ) {
71 _admissibleTimeStepSize = """ + str(self.
_time_step_relaxation) +
""" * _minVolumeHThisTimeStep / _maxEigenvalue;
72 if ( std::isnan(_admissibleTimeStepSize) or std::isinf(_admissibleTimeStepSize) ) {
73 ::tarch::triggerNonCriticalAssertion( __FILE__, __LINE__, "_admissibleTimeStepSize>0", "invalid (NaN of inf) time step size: " + std::to_string(_admissibleTimeStepSize) );
75 if (tarch::la::smallerEquals(_admissibleTimeStepSize,0.0,1e-10) ) {
76 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" );
82if (_solverState==SolverState::Secondary) {
83""" + code_snippet +
"""
Code snippet generator for all fixed time stepping solvers.
Code snippet generator for fixed time stepping in the Runge-Kutta schemes.
create_start_time_step_implementation(self)
__init__(self, time_step_relaxation, use_enclave_tasking)
create_finish_time_step_implementation(self)
The superclass takes the admissible cell size and divides it by the maximum eigenvalue.