21 "\n\tExplicit solver: \n\t"
22 " RK : 1 - Forward Euler, 2 - RK2(0.5), 3 - RK3 SSP, 4 - RK4, 6 - RK6,\n\t"
23 " AB : 11 - AB1, 12 - AB2, 13 - AB3, 14 - AB4, 15 - AB5\n";
26 "\n\tImplicit solver: \n\t"
27 " (L-Stab): 21 - Backward Euler, 22 - SDIRK23(2), 23 - SDIRK33,\n\t"
28 " (A-Stab): 32 - Implicit Midpoint, 33 - SDIRK23, 34 - SDIRK34,\n\t"
29 " GA : 40 -- 50 - Generalized-alpha,\n\t"
30 " AM : 51 - AM1, 52 - AM2, 53 - AM3, 54 - AM4\n";
33 "\n\tIMEX solver: \n\t"
34 " (L-Stab): 61 - Forward Backward Euler, 62 - IMEXRK2(2,2,2),\n\t"
35 " 63 - IMEXRK2(2,3,2), 64 - IMEX_DIRK_RK3\n";
43 if (ode_solver_type < 20)
55 using ode_ptr = std::unique_ptr<ODESolver>;
56 switch (ode_solver_type)
60 case 2:
return ode_ptr(
new RK2Solver(0.5));
73 MFEM_ABORT(
"Unknown ODE solver type: " << ode_solver_type);
79 using ode_ptr = std::unique_ptr<ODESolver>;
80 switch (ode_solver_type)
112 MFEM_ABORT(
"Unknown ODE solver type: " << ode_solver_type );
118 using ode_ptr = std::unique_ptr<ODESolver>;
119 switch (ode_solver_type)
123 case 62:
return ode_ptr(
new IMEXRK2);
127 default: MFEM_ABORT(
"Unknown ODE solver type: " << ode_solver_type );
134 for (
int i = 0; i < smax; i++)
136 idx[i] = smax - i - 1;
137 data[i].SetSize(vsize, mem_type);
145 MFEM_ASSERT_INDEX_IN_RANGE(i,0,ss);
151 MFEM_ASSERT_INDEX_IN_RANGE(i,0,ss);
157 MFEM_ASSERT_INDEX_IN_RANGE(i,0,ss);
163 MFEM_ASSERT_INDEX_IN_RANGE(i,0,smax);
164 data[idx[i]] = state;
170 data[idx[0]] = state;
176 os << ss <<
"/" <<smax<<std::endl;
178 for (
int i = 0; i < ss; i++) { data[idx[i]].Print(os); }
187 MFEM_ABORT(
"The ODE solver does not support the implicit variable type.");
199 const int usz =
u.Size();
245 add(x, (1. -
b)*dt, dxdt, x1);
250 add(x1,
b*dt, dxdt, x);
276 add(3./4, x, 1./4, y, y);
282 add(1./3, x, 2./3, y, x);
340 for (
int i = 0; i < s; i++)
358 for (
int l = 0, i = 1; i < s; i++)
360 add(x, a[l++]*dt, k[0], y);
361 for (
int j = 1; j < i; j++)
363 y.
Add(a[l++]*dt, k[j]);
369 for (
int i = 0; i < s; i++)
371 x.
Add(b[i]*dt, k[i]);
381const real_t RK6Solver::a[] =
384 .1923996296296296296296296296296296296296e-1,
385 .7669337037037037037037037037037037037037e-1,
389 1.318683415233148260919747276431735612861,
391 -5.042058063628562225427761634715637693344,
392 4.220674648395413964508014358283902080483,
393 -41.87259166432751461803757780644346812905,
395 159.4325621631374917700365669070346830453,
396 -122.1192135650100309202516203389242140663,
397 5.531743066200053768252631238332999150076,
398 -54.43015693531650433250642051294142461271,
400 207.0672513650184644273657173866509835987,
401 -158.6108137845899991828742424365058599469,
402 6.991816585950242321992597280791793907096,
403 -.1859723106220323397765171799549294623692e-1,
404 -54.66374178728197680241215648050386959351,
406 207.9528062553893734515824816699834244238,
407 -159.2889574744995071508959805871426654216,
408 7.018743740796944434698170760964252490817,
409 -.1833878590504572306472782005141738268361e-1,
410 -.5119484997882099077875432497245168395840e-3
412const real_t RK6Solver::b[] =
414 .3438957868357036009278820124728322386520e-1,
417 .2582624555633503404659558098586120858767,
418 .4209371189673537150642551514069801967032,
419 4.405396469669310170148836816197095664891,
420 -176.4831190242986576151740942499002125029,
421 172.3641334014150730294022582711902413315
423const real_t RK6Solver::c[] =
426 .9593333333333333333333333333333333333333e-1,
434const real_t RK8Solver::a[] =
442 .3613975628004575124052940721184028345129,
444 -1.341524066700492771819987788202715834917,
445 1.370126503900035259414693716084313000404,
446 .490472027972027972027972027972027972028e-1,
449 .2350972042214404739862988335493427143122,
450 .180855592981356728810903963653454488485,
451 .6169289044289044289044289044289044289044e-1,
454 .1123656831464027662262557035130015442303,
455 -.3885046071451366767049048108111244567456e-1,
456 .1979188712522045855379188712522045855379e-1,
457 -1.767630240222326875735597119572145586714,
461 -6.061889377376669100821361459659331999758,
462 5.650823198222763138561298030600840174201,
463 65.62169641937623283799566054863063741227,
464 -1.180945066554970799825116282628297957882,
467 -41.50473441114320841606641502701994225874,
468 -4.434438319103725011225169229846100211776,
469 4.260408188586133024812193710744693240761,
470 43.75364022446171584987676829438379303004,
471 .787142548991231068744647504422630755086e-2,
472 -1.281405999441488405459510291182054246266,
475 -45.04713996013986630220754257136007322267,
476 -4.731362069449576477311464265491282810943,
477 4.514967016593807841185851584597240996214,
478 47.44909557172985134869022392235929015114,
479 .1059228297111661135687393955516542875228e-1,
480 -.5746842263844616254432318478286296232021e-2,
481 -1.724470134262485191756709817484481861731,
484 -60.92349008483054016518434619253765246063,
485 -5.95151837622239245520283276706185486829,
486 5.556523730698456235979791650843592496839,
487 63.98301198033305336837536378635995939281,
488 .1464202825041496159275921391759452676003e-1,
489 .6460408772358203603621865144977650714892e-1,
490 -.7930323169008878984024452548693373291447e-1,
491 -3.301622667747079016353994789790983625569,
494 -118.011272359752508566692330395789886851,
495 -10.14142238845611248642783916034510897595,
496 9.139311332232057923544012273556827000619,
497 123.3759428284042683684847180986501894364,
498 4.623244378874580474839807625067630924792,
499 -3.383277738068201923652550971536811240814,
500 4.527592100324618189451265339351129035325,
501 -5.828495485811622963193088019162985703755
503const real_t RK8Solver::b[] =
505 .4427989419007951074716746668098518862111e-1,
510 .3541049391724448744815552028733568354121,
511 .2479692154956437828667629415370663023884,
512 -15.69420203883808405099207034271191213468,
513 25.08406496555856261343930031237186278518,
514 -31.73836778626027646833156112007297739997,
515 22.93828327398878395231483560344797018313,
516 -.2361324633071542145259900641263517600737
518const real_t RK8Solver::c[] =
527 .901802041735856958259707940678372149956,
535 stages(s_), state(s_)
552 if (state.
Size() >= stages -1)
555 f->
Mult(x, state[0]);
557 for (
int i = 0; i < stages; i++)
559 x.
Add(a[i]*dt, state[i]);
580 else if (fabs(dt-dt_) >10*std::numeric_limits<real_t>::epsilon())
588 mfem::out <<
" - Time step changed" << std::endl;
589 mfem::out <<
" - Purging time stepping history" << std::endl;
590 mfem::out <<
" - Will run Runge-Kutta to rebuild history" << std::endl;
595const real_t AB1Solver::a[] =
597const real_t AB2Solver::a[] =
599const real_t AB3Solver::a[] =
600{23.0/12.0,-4.0/3.0, 5.0/12.0};
601const real_t AB4Solver::a[] =
602{55.0/24.0,-59.0/24.0, 37.0/24.0,-9.0/24.0};
603const real_t AB5Solver::a[] =
604{1901.0/720.0,-2774.0/720.0, 2616.0/720.0,-1274.0/720.0, 251.0/720.0};
608 stages(s_), state(s_)
627 else if (fabs(dt-dt_) > 10*std::numeric_limits<real_t>::epsilon())
635 mfem::out <<
" - Time step changed" << std::endl;
636 mfem::out <<
" - Purging time stepping history" << std::endl;
637 mfem::out <<
" - Will run Runge-Kutta to rebuild history" << std::endl;
641 if ((state.
Size() == 0)&&(stages>1))
647 if (state.
Size() >= stages )
650 for (
int i = 0; i < stages; i++)
652 x.
Add(a[i+1]*dt, state[i]);
660 x.
Add(a[0]*dt, state[0]);
672const real_t AM1Solver::a[] =
674const real_t AM2Solver::a[] =
675{5.0/12.0, 2.0/3.0, -1.0/12.0};
676const real_t AM3Solver::a[] =
677{3.0/8.0, 19.0/24.0,-5.0/24.0, 1.0/24.0};
678const real_t AM4Solver::a[] =
679{251.0/720.0,646.0/720.0,-264.0/720.0, 106.0/720.0, -19.0/720.0};
733 gamma = (3. - sqrt(3.))/6.;
735 else if (gamma_opt == 2)
737 gamma = (2. - sqrt(2.))/2.;
739 else if (gamma_opt == 3)
741 gamma = (2. + sqrt(2.))/2.;
745 gamma = (3. + sqrt(3.))/6.;
800 const real_t a = 1./sqrt(3.)*cos(M_PI/18.) + 0.5;
801 const real_t b = 1./(6.*(2.*
a-1.)*(2.*
a-1.));
820 x.
Add((1.-2.*
b)*dt,
k);
847 const real_t a = 0.435866521508458999416019;
848 const real_t b = 1.20849664917601007033648;
849 const real_t c = 0.717933260754229499708010;
893 add(x, dt/2.0,
k,
y);
921 const real_t a = (2.0 - sqrt(2.0)) / 2.0;
922 const real_t b = (1.0 - 2.0*
a) / (4.0*
a);
964 const real_t a = (3.0 + sqrt(3.0)) / 6.0;
965 const real_t b = (1.0 - 2.0*
a) / (4.0*
a);
966 const real_t b_2 = 1.0 / ( 12.0*
a*(1.0 - 2.0*
a) );
967 const real_t b_3 = (1.0 - 3.0*
a) / ( 3.0*(1.0 - 2.0*
a) );
973 x.
Add((1.0-b_2-b_3)*dt,
k);
1004 rho_inf = (rho_inf > 1.0) ? 1.0 : rho_inf;
1005 rho_inf = (rho_inf < 0.0) ? 0.0 : rho_inf;
1008 alpha_m = 0.5*(3.0 - rho_inf)/(1.0 + rho_inf);
1009 alpha_f = 1.0/(1.0 + rho_inf);
1015 os <<
"Generalized alpha time integrator:" << std::endl;
1016 os <<
"alpha_m = " <<
alpha_m << std::endl;
1017 os <<
"alpha_f = " <<
alpha_f << std::endl;
1018 os <<
"gamma = " <<
gamma << std::endl;
1022 os<<
"Second order"<<
" and ";
1026 os<<
"First order"<<
" and ";
1031 os<<
"Stable"<<std::endl;
1035 os<<
"Unstable"<<std::endl;
1042 if (state.
Size() == 0)
1044 f->
Mult(x,state[0]);
1064 state[0] *= (1.0-(1.0/
alpha_m));
1136 a_[0] = (2.0+pow(2.0,1.0/3.0)+pow(2.0,-1.0/3.0))/6.0;
1137 a_[1] = (1.0-pow(2.0,1.0/3.0)-pow(2.0,-1.0/3.0))/6.0;
1141 b_[1] = 1.0/(2.0-pow(2.0,1.0/3.0));
1142 b_[2] = 1.0/(1.0-pow(2.0,2.0/3.0));
1146 MFEM_ASSERT(
false,
"Unsupported order in SIAVSolver");
1153 for (
int i=0; i<order_; i++)
1166 p.Add(b_[i] * dt,
dp_);
1178 " [0--10] - GeneralizedAlpha(0.1 * s),\n\t"
1179 " 11 - Average Acceleration, 12 - Linear Acceleration\n\t"
1180 " 13 - CentralDifference, 14 - FoxGoodwin";
1185 switch (ode_solver_type)
1206 MFEM_ABORT(
"Unknown ODE solver type: " << ode_solver_type);
1229 x.
Add(0.5*dt, dxdt);
1234 x.
Add(0.5*dt, dxdt);
1249 os <<
"Newmark time integrator:" << std::endl;
1250 os <<
"beta = " << beta << std::endl;
1251 os <<
"gamma = " << gamma << std::endl;
1255 os<<
"Second order"<<
" and ";
1259 os<<
"First order"<<
" and ";
1262 if ((gamma >= 0.5) && (beta >= (gamma + 0.5)*(gamma + 0.5)/4))
1264 os<<
"A-Stable"<<std::endl;
1266 else if ((gamma >= 0.5) && (beta >= 0.5*gamma))
1268 os<<
"Conditionally stable"<<std::endl;
1272 os<<
"Unstable"<<std::endl;
1279 real_t fac0 = 0.5 - beta;
1280 real_t fac2 = 1.0 - gamma;
1322 os <<
"Generalized alpha time integrator:" << std::endl;
1323 os <<
"alpha_m = " <<
alpha_m << std::endl;
1324 os <<
"alpha_f = " <<
alpha_f << std::endl;
1325 os <<
"beta = " <<
beta << std::endl;
1326 os <<
"gamma = " <<
gamma << std::endl;
1330 os<<
"Second order"<<
" and ";
1334 os<<
"First order"<<
" and ";
1341 os<<
"Stable"<<std::endl;
1345 os<<
"Unstable"<<std::endl;
1389 x *= 1.0 - 1.0/fac1;
1390 x.
Add (1.0/fac1,
xa);
1392 dxdt *= 1.0 - 1.0/fac1;
1393 dxdt.
Add (1.0/fac1,
va);
1395 state[0] *= 1.0 - 1.0/fac5;
1437 double gamma = 1 - sqrt(2)/2;
1438 double delta = 1 - 1/(2*gamma);
1448 add(x, dt*gamma, k1_exp, y);
1458 f -> SetTime(t + dt);
1461 x.
Add(dt*(1-gamma), k_imp);
1471 x.
Add(dt*gamma, k_imp);
1488 double gamma = 1 - sqrt(2)/2;
1489 double delta = -2*sqrt(2)/3;
1499 add(x, dt*gamma, k1_exp, y);
1518 f -> SetTime(t + dt);
1520 x.
Add(dt*(1-gamma), k_imp);
1528 x.
Add(dt*gamma, k_imp);
1547 double gamma = 0.4358665215;
1548 double b1 = 1.208496649;
1549 double b2 = -0.644363171;
1550 double a_31 = 0.3212788860;
1551 double a_32 = 0.3966543747;
1552 double a_41 = -0.105858296;
1553 double a_42 = 0.5529291479;
1554 double a_43 = 0.5529291479;
1563 add(x, dt*gamma, k1_exp, y);
1571 add(x, dt*a_31, k1_exp, y);
1574 y.
Add(dt*a_32, k2_exp);
1577 add(x, dt*(1-gamma)/2, k2_imp, y);
1583 add(x, dt*a_41, k1_exp, y);
1585 y.
Add(dt*a_42, k2_exp);
1587 y.
Add(dt*a_43, k3_exp);
1593 x.
Add(dt*b1, k2_imp);
1594 x.
Add(dt*b2, k3_imp);
1599 x.
Add(dt*b1, k2_exp);
1600 x.
Add(dt*b2, k3_exp);
1601 x.
Add(dt*gamma, k4_exp);
1604 x.
Add(dt*gamma, k3_imp);
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void CheckTimestep(real_t dt)
AdamsBashforthSolver(int s_, const real_t *a_)
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
std::unique_ptr< ODESolver > RKsolver
std::unique_ptr< ODESolver > RKsolver
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
AdamsMoultonSolver(int s_, const real_t *a_)
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
void Print(std::ostream &out=mfem::out, int width=4) const
Prints array to stream with width elements per row.
The classical midpoint method.
Backward Euler ODE solver. L-stable.
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
virtual ~ExplicitRKSolver()
ExplicitRKSolver(int s_, const real_t *a_, const real_t *b_, const real_t *c_)
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
The classical forward Euler method.
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void PrintProperties(std::ostream &os=mfem::out)
void Init(SecondOrderTimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void Step(Vector &x, Vector &dxdt, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void SetRhoInf(real_t rho_inf)
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
void PrintProperties(std::ostream &os=mfem::out)
Forward-backward Euler method.
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
Second order, 2/3-stage implicit-explicit (IMEX) Runge-Kutta (RK) method.
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
Second order, two-stage implicit-explicit (IMEX) Runge-Kutta (RK) method.
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
Third order, 3/4-stage implicit-explicit (IMEX) Runge-Kutta (RK) method.
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
Implicit midpoint method. A-stable, not L-stable.
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void Step(Vector &x, Vector &dxdt, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
void PrintProperties(std::ostream &os=mfem::out)
TimeDependentOperator * f
Pointer to the associated TimeDependentOperator.
virtual void Init(TimeDependentOperator &f_)
Associate a TimeDependentOperator with the ODE solver.
static MFEM_EXPORT std::unique_ptr< ODESolver > SelectImplicit(const int ode_solver_type)
static MFEM_EXPORT std::string Types
static MFEM_EXPORT std::unique_ptr< ODESolver > Select(const int ode_solver_type)
virtual void ComputeSlopeFromState(const real_t dt, const Vector &u, Vector &k)
Compute the finite-difference slope, , and store it in k.
virtual bool SupportsImplicitVariableType(ImplicitVariableType var) const
Returns true if the ODESolver supports the given ImplicitVariableType, var, and returns false otherwi...
static MFEM_EXPORT std::string ImplicitTypes
static MFEM_EXPORT std::unique_ptr< ODESolver > SelectIMEX(const int ode_solver_type)
static MFEM_EXPORT std::string ExplicitTypes
static MFEM_EXPORT std::unique_ptr< ODESolver > SelectExplicit(const int ode_solver_type)
static MFEM_EXPORT std::string IMEXTypes
void Increment()
Increment the stage counter.
const Vector & Get(int i) const override
Get the ith state vector.
void Set(int i, Vector &state) override
Set the ith state vector.
void SetSize(int vsize, MemoryType mem_type)
Set the number of stages and the size of the vectors.
void Append(Vector &state) override
Add state vector and increment state size.
void ShiftStages()
Shift the stage counter for the next timestep.
void Print(std::ostream &os=mfem::out) const
Print state data.
int Size() const override
Get the current number of stored stages.
void Reset()
Reset the stage counter.
virtual MemoryClass GetMemoryClass() const
Return the MemoryClass preferred by the Operator.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
Third-order, strong stability preserving (SSP) Runge-Kutta method.
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
The classical explicit fourth-order Runge-Kutta method, RK4.
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void Step(Vector &x, real_t &t, real_t &dt) override
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)
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void Step(Vector &q, Vector &p, real_t &t, real_t &dt) override
void Step(Vector &q, Vector &p, real_t &t, real_t &dt) override
TimeDependentOperator * F_
virtual void Init(Operator &P, TimeDependentOperator &F)
void Step(Vector &q, Vector &p, real_t &t, real_t &dt) override
Abstract class for solving systems of ODEs: d2x/dt2 = f(x,dx/dt,t)
SecondOrderTimeDependentOperator * f
Pointer to the associated TimeDependentOperator.
void MidPointStep(Vector &x, Vector &dxdt, real_t &t, real_t &dt)
static MFEM_EXPORT std::string Types
Help info for SecondOrderODESolver options.
void EulerStep(Vector &x, Vector &dxdt, real_t &t, real_t &dt)
static MFEM_EXPORT SecondOrderODESolver * Select(const int ode_solver_type)
Function selecting the desired SecondOrderODESolver.
virtual void Init(SecondOrderTimeDependentOperator &f)
Associate a TimeDependentOperator with the ODE solver.
Base abstract class for second order time dependent operators.
virtual void Mult(const Vector &x, const Vector &dxdt, Vector &y) const
Perform the action of the operator: y = k = f(x,@ dxdt, t), where k solves the algebraic equation F(x...
virtual void ImplicitSolve(const real_t fac0, const real_t fac1, const Vector &x, const Vector &dxdt, Vector &k)
Solve the equation: k = f(x + fac0 k, dxdt + fac1 k, t), for the unknown k at the current time t.
Base abstract class for first order time dependent operators.
bool isExplicit() const
True if type is EXPLICIT.
virtual ImplicitVariableType GetImplicitVariableType() const
Returns the ImplicitVariableType for ImplicitSolve().
virtual void ImplicitSolve(const real_t gamma, const Vector &u, Vector &k)
Solve for the unknown k, at the current time t, the following equation:
virtual bool ImplicitVarTypeIsState() const
Returns true if implicit variable is STATE and false otherwise. Used by ODESolver to identify the sta...
void Mult(const Vector &u, Vector &k) const override
Perform the action of the operator (u,t) -> k(u,t) where t is the current time set by SetTime() and k...
virtual void SetEvalMode(const EvalMode new_eval_mode)
Set the evaluation mode of the time-dependent operator.
virtual void SetTime(const real_t t_)
Set the current time.
void Step(Vector &x, real_t &t, real_t &dt) override
Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
void Init(TimeDependentOperator &f_) override
Associate a TimeDependentOperator with the ODE solver.
void Neg()
(*this) = -(*this)
virtual real_t * ReadWrite(bool on_dev=true)
Shortcut for mfem::ReadWrite(vec.GetMemory(), vec.Size(), on_dev).
void SetSize(int s)
Resize the vector to size s.
Vector & Add(const real_t a, const Vector &Va)
(*this) += a * Va
real_t u(const Vector &xvec)
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
void add(const Vector &v1, const Vector &v2, Vector &v)
MemoryType GetMemoryType(MemoryClass mc)
Return a suitable MemoryType for a given MemoryClass.
MemoryType
Memory types supported by MFEM.
void forall(int N, lambda &&body)
real_t p(const Vector &x, real_t t)