48 const double b = 0.5/a;
52 add(x, (1. - b)*dt, dxdt, x1);
57 add(x1, b*dt, dxdt, x);
83 add(3./4, x, 1./4, y, y);
89 add(1./3, x, 2./3, y, x);
147 for (
int i = 0; i < s; i++)
165 for (
int l = 0, i = 1; i < s; i++)
167 add(x, a[l++]*dt, k[0], y);
168 for (
int j = 1; j < i; j++)
170 y.
Add(a[l++]*dt, k[j]);
176 for (
int i = 0; i < s; i++)
178 x.
Add(b[i]*dt, k[i]);
188 const double RK6Solver::a[] =
191 .1923996296296296296296296296296296296296e-1,
192 .7669337037037037037037037037037037037037e-1,
196 1.318683415233148260919747276431735612861,
198 -5.042058063628562225427761634715637693344,
199 4.220674648395413964508014358283902080483,
200 -41.87259166432751461803757780644346812905,
202 159.4325621631374917700365669070346830453,
203 -122.1192135650100309202516203389242140663,
204 5.531743066200053768252631238332999150076,
205 -54.43015693531650433250642051294142461271,
207 207.0672513650184644273657173866509835987,
208 -158.6108137845899991828742424365058599469,
209 6.991816585950242321992597280791793907096,
210 -.1859723106220323397765171799549294623692e-1,
211 -54.66374178728197680241215648050386959351,
213 207.9528062553893734515824816699834244238,
214 -159.2889574744995071508959805871426654216,
215 7.018743740796944434698170760964252490817,
216 -.1833878590504572306472782005141738268361e-1,
217 -.5119484997882099077875432497245168395840e-3
219 const double RK6Solver::b[] =
221 .3438957868357036009278820124728322386520e-1,
224 .2582624555633503404659558098586120858767,
225 .4209371189673537150642551514069801967032,
226 4.405396469669310170148836816197095664891,
227 -176.4831190242986576151740942499002125029,
228 172.3641334014150730294022582711902413315
230 const double RK6Solver::c[] =
233 .9593333333333333333333333333333333333333e-1,
241 const double RK8Solver::a[] =
249 .3613975628004575124052940721184028345129,
251 -1.341524066700492771819987788202715834917,
252 1.370126503900035259414693716084313000404,
253 .490472027972027972027972027972027972028e-1,
256 .2350972042214404739862988335493427143122,
257 .180855592981356728810903963653454488485,
258 .6169289044289044289044289044289044289044e-1,
261 .1123656831464027662262557035130015442303,
262 -.3885046071451366767049048108111244567456e-1,
263 .1979188712522045855379188712522045855379e-1,
264 -1.767630240222326875735597119572145586714,
268 -6.061889377376669100821361459659331999758,
269 5.650823198222763138561298030600840174201,
270 65.62169641937623283799566054863063741227,
271 -1.180945066554970799825116282628297957882,
274 -41.50473441114320841606641502701994225874,
275 -4.434438319103725011225169229846100211776,
276 4.260408188586133024812193710744693240761,
277 43.75364022446171584987676829438379303004,
278 .787142548991231068744647504422630755086e-2,
279 -1.281405999441488405459510291182054246266,
282 -45.04713996013986630220754257136007322267,
283 -4.731362069449576477311464265491282810943,
284 4.514967016593807841185851584597240996214,
285 47.44909557172985134869022392235929015114,
286 .1059228297111661135687393955516542875228e-1,
287 -.5746842263844616254432318478286296232021e-2,
288 -1.724470134262485191756709817484481861731,
291 -60.92349008483054016518434619253765246063,
292 -5.95151837622239245520283276706185486829,
293 5.556523730698456235979791650843592496839,
294 63.98301198033305336837536378635995939281,
295 .1464202825041496159275921391759452676003e-1,
296 .6460408772358203603621865144977650714892e-1,
297 -.7930323169008878984024452548693373291447e-1,
298 -3.301622667747079016353994789790983625569,
301 -118.011272359752508566692330395789886851,
302 -10.14142238845611248642783916034510897595,
303 9.139311332232057923544012273556827000619,
304 123.3759428284042683684847180986501894364,
305 4.623244378874580474839807625067630924792,
306 -3.383277738068201923652550971536811240814,
307 4.527592100324618189451265339351129035325,
308 -5.828495485811622963193088019162985703755
310 const double RK8Solver::b[] =
312 .4427989419007951074716746668098518862111e-1,
317 .3541049391724448744815552028733568354121,
318 .2479692154956437828667629415370663023884,
319 -15.69420203883808405099207034271191213468,
320 25.08406496555856261343930031237186278518,
321 -31.73836778626027646833156112007297739997,
322 22.93828327398878395231483560344797018313,
323 -.2361324633071542145259900641263517600737
325 const double RK8Solver::c[] =
334 .901802041735856958259707940678372149956,
375 gamma = (3. - sqrt(3.))/6.;
377 else if (gamma_opt == 2)
379 gamma = (2. - sqrt(2.))/2.;
381 else if (gamma_opt == 3)
383 gamma = (2. + sqrt(2.))/2.;
387 gamma = (3. + sqrt(3.))/6.;
434 const double a = 1./sqrt(3.)*cos(M_PI/18.) + 0.5;
435 const double b = 1./(6.*(2.*a-1.)*(2.*a-1.));
439 add(x, (0.5-a)*dt,
k,
y);
440 add(x, (2.*a)*dt,
k,
z);
445 z.
Add((1.-4.*a)*dt,
k);
446 x.
Add((1.-2.*b)*dt,
k);
469 const double a = 0.435866521508458999416019;
470 const double b = 1.20849664917601007033648;
471 const double c = 0.717933260754229499708010;
475 add(x, (c-a)*dt,
k,
y);
480 x.
Add((1.-a-b)*dt,
k);
501 rho_inf = (rho_inf > 1.0) ? 1.0 : rho_inf;
502 rho_inf = (rho_inf < 0.0) ? 0.0 : rho_inf;
504 alpha_m = 0.5*(3.0 - rho_inf)/(1.0 + rho_inf);
511 out <<
"Generalized alpha time integrator:" << std::endl;
512 out <<
"alpha_m = " <<
alpha_m << std::endl;
513 out <<
"alpha_f = " <<
alpha_f << std::endl;
514 out <<
"gamma = " <<
gamma << std::endl;
518 out<<
"Second order"<<
" and ";
522 out<<
"First order"<<
" and ";
527 out<<
"Stable"<<std::endl;
531 out<<
"Unstable"<<std::endl;
544 if (
first && (dt_fac1 != 0.0))
556 add(
y, dt_fac2*dt,
k, x);
629 a_[0] = (2.0+pow(2.0,1.0/3.0)+pow(2.0,-1.0/3.0))/6.0;
630 a_[1] = (1.0-pow(2.0,1.0/3.0)-pow(2.0,-1.0/3.0))/6.0;
634 b_[1] = 1.0/(2.0-pow(2.0,1.0/3.0));
635 b_[2] = 1.0/(1.0-pow(2.0,2.0/3.0));
639 MFEM_ASSERT(
false,
"Unsupported order in SIAVSolver");
646 for (
int i=0; i<order_; i++)
virtual void Init(TimeDependentOperator &_f)
Associate a TimeDependentOperator with the ODE solver.
void PrintProperties(std::ostream &out=mfem::out)
virtual void Init(Operator &P, TimeDependentOperator &F)
void SetRhoInf(double rho_inf)
void Step(Vector &q, Vector &p, double &t, double &dt)
virtual void Init(TimeDependentOperator &_f)
Associate a TimeDependentOperator with the ODE solver.
virtual void Init(TimeDependentOperator &f)
Associate a TimeDependentOperator with the ODE solver.
virtual void Step(Vector &x, double &t, double &dt)
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in]...
void SetSize(int s)
Resize the vector to size s.
Base abstract class for time dependent operators.
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
virtual void SetTime(const double _t)
Set the current time.
virtual void Step(Vector &x, double &t, double &dt)
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in]...
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
virtual void Step(Vector &x, double &t, double &dt)
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in]...
void add(const Vector &v1, const Vector &v2, Vector &v)
virtual void Step(Vector &x, double &t, double &dt)
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in]...
virtual void Init(TimeDependentOperator &_f)
Associate a TimeDependentOperator with the ODE solver.
virtual void Init(TimeDependentOperator &_f)
Associate a TimeDependentOperator with the ODE solver.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
virtual ~ExplicitRKSolver()
virtual void Step(Vector &x, double &t, double &dt)
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in]...
virtual void Init(TimeDependentOperator &_f)
Associate a TimeDependentOperator with the ODE solver.
bool isExplicit() const
True if type is EXPLICIT.
virtual void ImplicitSolve(const double dt, const Vector &x, Vector &k)
Solve the equation: k = f(x + dt k, t), for the unknown k at the current time t.
virtual void Step(Vector &x, double &t, double &dt)
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in]...
ExplicitRKSolver(int _s, const double *_a, const double *_b, const double *_c)
virtual void Step(Vector &x, double &t, double &dt)
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in]...
virtual void Init(TimeDependentOperator &_f)
Associate a TimeDependentOperator with the ODE solver.
virtual void Init(TimeDependentOperator &_f)
Associate a TimeDependentOperator with the ODE solver.
virtual void Init(TimeDependentOperator &_f)
Associate a TimeDependentOperator with the ODE solver.
virtual void Mult(const Vector &x, Vector &y) const
Perform the action of the operator: y = k = f(x, t), where k solves the algebraic equation F(x...
virtual void Init(TimeDependentOperator &_f)
Associate a TimeDependentOperator with the ODE solver.
TimeDependentOperator * F_
void SetSize(int nsize)
Change logical size of the array, keep existing entries.
Vector & Add(const double a, const Vector &Va)
(*this) += a * Va
void Step(Vector &q, Vector &p, double &t, double &dt)
void Step(Vector &q, Vector &p, double &t, double &dt)
virtual void Step(Vector &x, double &t, double &dt)
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in]...
virtual void Step(Vector &x, double &t, double &dt)
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in]...
virtual void Init(TimeDependentOperator &_f)
Associate a TimeDependentOperator with the ODE solver.
virtual void Step(Vector &x, double &t, double &dt)
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in]...
TimeDependentOperator * f
Pointer to the associated TimeDependentOperator.
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
virtual void Step(Vector &x, double &t, double &dt)
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in]...
SDIRK23Solver(int gamma_opt=1)
virtual void Init(TimeDependentOperator &_f)
Associate a TimeDependentOperator with the ODE solver.