forked from MatthewPeterKelly/RungeKuttaCpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRK_4A.cpp
41 lines (34 loc) · 756 Bytes
/
RK_4A.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include "RK_4A.h"
#include "integrator.h"
using namespace std;
/* 4th-Order Explicit "Classical" Runge-Kutta Method */
/* Time-step coefficients */
static double RK4A__A[] = {
0.0,
0.5,
0.5,
1.0
};
/* Solution weighting coefficients */
static double RK4A__C[] = {
1.0 / 6.0,
1.0 / 3.0,
1.0 / 3.0,
1.0 / 6.0
};
/* Simulation weighting coefficients */
static double RK4A__B[] = {
0.5,
0.0, 0.5,
0.0, 0.0, 1.0
};
static const int RK4A__nStage = 4;
/* Actual integration step happens here */
void rk4Astep(DynFun dynFun,
double tLow, double tUpp, double zLow[], double zUpp[], int nDim)
{
RK_STEP( dynFun,
tLow, tUpp, zLow, zUpp, nDim,
RK4A__A, RK4A__B, RK4A__C, RK4A__nStage);
}