43 const double safety = 0.9;
44 const double max_ratio = 4.0;
45 const double pshrnk = 1.0/7.0;
46 const double pgrow = 1.0/8.0;
53 Dprintf((
" RKF8 integration step "));
73 (*ip)->SetState((*ip)->GetOldState() + 0.25*
A1[i]);
85 (*ip)->SetState((*ip)->GetOldState() + (5.0*
A1[i] +
A2[i]) / 72.0);
97 (*ip)->SetState((*ip)->GetOldState() + (
A1[i] + 3.0*
A3[i]) / 32.0);
109 (*ip)->SetState((*ip)->GetOldState() + ( 106.0 *
A1[i]
124 (*ip)->SetState((*ip)->GetOldState() + 1.0 / 48.0 *
A1[i]
126 + 125.0 / 528.0 *
A5[i]);
138 (*ip)->SetState((*ip)->GetOldState() - 1263.0 / 2401.0 *
A1[i]
139 + 39936.0 / 26411.0 *
A4[i]
140 - 64125.0 / 26411.0 *
A5[i]
141 + 5520.0 / 2401.0 *
A6[i]);
153 (*ip)->SetState((*ip)->GetOldState() + 37.0 / 392.0 *
A1[i]
154 + 1625.0 / 9408.0 *
A5[i]
156 + 61.0 / 6720.0 *
A7[i]);
168 (*ip)->SetState((*ip)->GetOldState() + 17176.0 / 25515.0 *
A1[i]
169 - 47104.0 / 25515.0 *
A4[i]
170 + 1325.0 / 504.0 *
A5[i]
171 - 41792.0 / 25515.0 *
A6[i]
172 + 20237.0 / 145800.0 *
A7[i]
173 + 4312.0 / 6075.0 *
A8[i]);
185 (*ip)->SetState((*ip)->GetOldState() - 23834.0 / 180075.0 *
A1[i]
186 - 77824.0 / 1980825.0 *
A4[i]
187 - 636635.0 / 633864.0 *
A5[i]
188 + 254048.0 / 300125.0 *
A6[i]
189 - 183.0 / 7000.0 *
A7[i]
191 - 324.0 / 3773.0 *
A9[i]);
203 (*ip)->SetState((*ip)->GetOldState() + 12733.0 / 7600.0 *
A1[i]
204 - 20032.0 / 5225.0 *
A4[i]
205 + 456485.0 / 80256.0 *
A5[i]
206 - 42599.0 / 7125.0 *
A6[i]
207 + 339227.0 / 912000.0 *
A7[i]
208 - 1029.0 / 4180.0 *
A8[i]
209 + 1701.0 / 1408.0 *
A9[i]
210 + 5145.0 / 2432.0 *
A10[i]);
222 (*ip)->SetState((*ip)->GetOldState() - 27061.0 / 204120.0 *
A1[i]
223 + 40448.0 / 280665.0 *
A4[i]
224 - 1353775.0 / 1197504.0 *
A5[i]
225 + 17662.0 / 25515.0 *
A6[i]
226 - 71687.0 / 1166400.0 *
A7[i]
227 + 98.0 / 225.0 *
A8[i]
229 + 3773.0 / 11664.0 *
A10[i]);
241 (*ip)->SetState((*ip)->GetOldState() + 11203.0 / 8680.0 *
A1[i]
242 - 38144.0 / 11935.0 *
A4[i]
243 + 2354425.0 / 458304.0 *
A5[i]
244 - 84046.0 / 16275.0 *
A6[i]
245 + 673309.0 / 1636800.0 *
A7[i]
246 + 4704.0 / 8525.0 *
A8[i]
247 + 9477.0 / 10912.0 *
A9[i]
248 - 1029.0 / 992.0 *
A10[i]
249 + 729.0 / 341.0 *
A12[i]);
261 (*ip)->SetState((*ip)->GetOldState()+ 31.0/720.0 * (
A1[i]+
A13[i])
263 +16807.0/79200.0 * (
A7[i]+
A8[i])
264 + 243.0/1760.0 * (
A9[i]+
A12[i]));
277 eerr = fabs( -1.0 / 480.0 *
A1[i]
278 - 16.0 / 375.0 *
A6[i]
279 - 2401.0 / 528000.0 *
A7[i]
280 + 2401.0 / 132000.0 *
A8[i]
281 + 243.0 / 14080.0 *
A9[i]
282 - 2401.0 / 19200.0 *
A10[i]
283 - 19.0 / 450.0 *
A11[i]
284 + 243.0 / 1760.0 *
A12[i]
285 + 31.0 / 720.0 *
A13[i]
289 if(terr < eerr*ratio) {
298 ratio = pow(ratio,pshrnk);
308 _Print(
"\n Integrator[%lu] ",(
unsigned long)n);
313 ratio =
min(pow(ratio,pgrow),max_ratio);
Runge-Kutta-Fehlberg 8th order.
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
Implementation of class CalendarList interface is static - using global functions in SQS namespace...
double max(double a, double b)
double SIMLIB_RelativeError
relative error
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
virtual void Integrate(void) override
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.
IntegratorContainer::iterator Iterator
#define _SetTime(t, x)
macro for simple assignement to internal time variables
double SIMLIB_MinStep
minimal step
double SIMLIB_DeltaTime
Time-SIMLIB_StepStartTime.
double SIMLIB_OptStep
optimal step
double SIMLIB_MaxStep
max. step