56 static const double err_coef = 0.02;
59 static bool DoubleStepFlag;
63 Dprintf((
" RKE integration step "));
84 A1[i] = dthlf*(*ip)->GetOldDiff();
85 (*ip)->SetState((*ip)->GetOldState()+0.5*
A1[i]);
96 A2[i] = dthlf*(*ip)->GetDiff();
97 (*ip)->SetState((*ip)->GetOldState() + 0.25*(
A1[i]+
A2[i]));
103 A3[i] = dthlf*(*ip)->GetDiff();
104 (*ip)->SetState((*ip)->GetOldState() -
A2[i] +
A3[i] +
A3[i]);
117 A4[i] = dthlf*(*ip)->GetDiff();
118 (*ip)->SetState((*ip)->GetOldState() + (
A1[i] + 4.0*
A3[i] +
A4[i]) / 6.0);
134 A5[i] = dthlf*(*ip)->GetDiff();
135 (*ip)->SetState(
si[i] + 0.5*
A5[i]);
146 A6[i] = dthlf * (*ip)->GetDiff();
147 (*ip)->SetState(
si[i] + 0.25*(
A5[i] +
A6[i]));
153 A7[i] = dthlf*(*ip)->GetDiff();
154 (*ip)->SetState((*ip)->GetOldState()
176 DoubleStepFlag =
true;
182 eerr = fabs(( -
A1[i]
187 - dthlf * (*ip)->GetDiff()
191 if(eerr < err_coef*terr)
206 _Print(
"\n Integrator[%lu] ",(
unsigned long)i);
210 DoubleStepFlag =
false;
220 if(wasContractStepFlag) {
228 (*ip)->SetState(
si[i] -
A6[i] +
A7[i] +
A7[i]);
238 (*ip)->SetState(
si[i] + (
A5[i] + 4.0*
A7[i] + dthlf*(*ip)->GetDiff()) / 6.0);
static bool IsEndStepEvent
int _Print(const char *fmt,...)
output of messages to stdout, too
void SIMLIB_Dynamic()
performs evaluation of integrators and status blocks
double SIMLIB_StepStartTime
last step time
double SIMLIB_ContractStep
requested step size
const double & OptStep
optimal integration step
static void StoreState(Memory &di, Memory &si, StatusMemory &xi)
store state of integrators and status variables
Implementation of class CalendarList interface is static - using global functions in SQS namespace...
double max(double a, double b)
double SIMLIB_RelativeError
relative error
static void RestoreState(double dthlf, Memory &di, Memory &si, StatusMemory &xi)
restore state of integrators and status variables
void SIMLIB_warning(const enum _ErrEnum N)
print warning message and continue
const double & Time
model time (is NOT the block)
double SIMLIB_StepSize
actual step
static bool StateCond(void)
check on changes of state conditions
double min(double a, double b)
double SIMLIB_AbsoluteError
absolute error
bool SIMLIB_ContractStepFlag
requests shorter step
Internal header file for SIMLIB/C++.
static Iterator LastIntegrator(void)
static Iterator FirstIntegrator(void)
Main SIMLIB/C++ interface.
virtual void Integrate(void) override
IntegratorContainer::iterator Iterator
#define _SetTime(t, x)
macro for simple assignement to internal time variables
static void GoToState(Memory &di, Memory &si, StatusMemory &xi)
move startpoint to given state
bool SIMLIB_ConditionFlag
double SIMLIB_MinStep
minimal step
double SIMLIB_DeltaTime
Time-SIMLIB_StepStartTime.
Runge-Kutta-England method (default)
double SIMLIB_OptStep
optimal step
double SIMLIB_MaxStep
max. step