68 void resetDt(
Real a_dt);
84 void resetDt(
Real a_dt);
95 template <
class X,
class FI,
class FE,
class dX>
106 void advance(
Real a_time, X& a_state);
109 void resetDt(
Real a_dt);
114 static const int s_nStages = 6;
116 static const Real s_aE[s_nStages][s_nStages];
117 static const Real s_aI[s_nStages][s_nStages];
118 static const Real s_b[s_nStages];
119 static const Real s_c[s_nStages];
126 dX m_kE[s_nStages-1];
127 dX m_kI[s_nStages-1];
141 template <
class X,
class FI,
class FE,
class dX>
146 for (
int stage = 0; stage < s_nStages; stage++)
148 m_phi[stage].define(a_state);
151 for (
int stage = 0; stage < s_nStages-1; stage++)
153 m_kE[stage].define(a_state);
154 m_kI[stage].define(a_state);
156 m_kEfinal.define(a_state);
157 m_rhs.define(a_state);
159 m_fI.define(a_state, m_dt, s_gamma);
161 m_fE.define(a_state, m_dt);
168 template <
class X,
class FI,
class FE,
class dX>
175 if (
Abs(m_dt - a_dt) > m_dt*reltol)
186 template <
class X,
class FI,
class FE,
class dX>
192 for (
int stage = 0; stage < s_nStages; stage++)
194 t[stage] = a_time + s_c[stage] * m_dt;
198 m_phi[0].copy(a_state);
199 for (
int stage = 1; stage < s_nStages; stage++)
201 m_fE(m_kE[stage-1], t[stage-1], m_phi[stage-1]);
202 m_fI(m_kI[stage-1], t[stage-1], m_phi[stage-1]);
208 for (
int j = 0; j < stage; j++)
210 m_rhs.increment(m_kE[j], s_aE[stage][j]);
211 m_rhs.increment(m_kI[j], s_aI[stage][j]);
215 m_phi[stage].define(a_state);
216 m_fI.solve(m_phi[stage], m_rhs, t[stage]);
224 const int stageFinal = s_nStages-1;
225 Real tFinal = t[stageFinal];
227 m_fE(m_kEfinal, tFinal, m_phi[stageFinal]);
228 a_state.copy(m_phi[stageFinal]);
229 for (
int j = 0; j < s_nStages-1; j++)
231 a_state.increment(m_kE[j], s_b[j] - s_aE[stageFinal][j]);
234 a_state.increment(m_kEfinal, s_b[stageFinal] );
237 template<
class X,
class FI,
class FE,
class dX>
241 template<
class X,
class FI,
class FE,
class dX>
245 template<
class X,
class FI,
class FE,
class dX>
247 {0., 0., 0., 0., 0., 0.},
248 {0.5, 0., 0., 0., 0., 0.},
249 {0.221776, 0.110224, 0., 0., 0., 0.},
250 {-0.04884659515311857, -0.17772065232640102, 0.8465672474795197, 0., 0., 0.},
251 {-0.15541685842491548, -0.3567050098221991, 1.0587258798684427, 0.30339598837867193, 0., 0.},
252 { 0.2014243506726763, 0.008742057842904185, 0.15993995707168115, 0.4038290605220775, 0.22606457389066084, 0.}
255 template<
class X,
class FI,
class FE,
class dX>
257 {0., 0., 0., 0., 0., 0.},
258 {0.25, 0.25, 0., 0., 0., 0.},
259 {0.137776, -0.055776, 0.25, 0., 0., 0.},
260 {0.14463686602698217, -0.22393190761334475, 0.4492950415863626, 0.25, 0., 0.},
261 {0.09825878328356477, -0.5915442428196704, 0.8101210538282996, 0.283164405707806, 0.25, 0.},
262 {0.15791629516167136, 0., 0.18675894052400077, 0.6805652953093346, -0.27524053099500667, 0.25}
265 template<
class X,
class FI,
class FE,
class dX>
267 {0.15791629516167136, 0., 0.18675894052400077, 0.6805652953093346, -0.27524053099500667, 0.25};
void copy(const XConcept &a_state)
#define CH_assert(cond)
Definition: CHArray.H:37
void define(const XConcept &a_state)
bool m_isDefined
Definition: ARK4.H:123
void increment(const dXConcept &a_increment, Real a_factor=1.)
dX m_kEfinal
Definition: ARK4.H:128
dX m_rhs
Definition: ARK4.H:129
FI m_fI
Definition: ARK4.H:130
~XConcept()
Definition: ARK4.H:41
void advance(Real a_time, X &a_state)
Definition: ARK4.H:187
void define(const X &a_state, Real a_dt)
Definition: ARK4.H:142
Real m_dt
Definition: ARK4.H:124
double Real
Definition: REAL.H:33
static ARK4< XConcept, FIConcept, FEConcept, dXConcept > testConcept
Definition: ARK4.H:136
~FIConcept()
Definition: ARK4.H:92
T Abs(const T &a_a)
Definition: Misc.H:53
~dXConcept()
Definition: ARK4.H:57
bool isDefined() const
Definition: ARK4.H:111
FE m_fE
Definition: ARK4.H:131
static const Real s_gamma
Definition: ARK4.H:115
~FEConcept()
Definition: ARK4.H:73
void resetDt(Real a_dt)
Definition: ARK4.H:169