File split-rk.hxx

Defines

SPLITRK_HXX
class SplitRK : public Solver

Public Functions

inline explicit SplitRK(Options *opt = nullptr)
~SplitRK() = default
virtual int init(int nout, BoutReal tstep) override

Initialise the solver NOTE: nout and tstep should be passed to run, not init. Needed because of how the PETSc TS code works

virtual int run() override

Run the solver, calling monitors nout times, at intervals of tstep. This function is called by solve(), and is specific to each solver type

This should probably be protected, since it shouldn’t be called by users.

Private Functions

void take_step(BoutReal curtime, BoutReal dt, Array<BoutReal> &start, Array<BoutReal> &result)

Take a combined step Uses 2nd order Strang splitting

Note: start and result can be the same

void take_diffusion_step(BoutReal curtime, BoutReal dt, Array<BoutReal> &start, Array<BoutReal> &result)

Take a step of the diffusion terms Uses the Runge-Kutta-Legendre 2nd order method

Note: start and result can be the same

void take_advection_step(BoutReal curtime, BoutReal dt, Array<BoutReal> &start, Array<BoutReal> &result)

Take a step of the advection terms Uses the Strong Stability Preserving Runge-Kutta 3rd order method

Note: start and result can be the same

Private Members

int nstages = {2}

Number of stages in the RKL.

BoutReal out_timestep = {0.0}

The output timestep.

int nsteps = {0}

Number of output steps.

BoutReal timestep = {0.0}

The internal timestep.

bool adaptive = {true}

Adapt timestep using tolerances?

BoutReal atol = {1e-10}

Absolute tolerance.

BoutReal rtol = {1e-5}

Relative tolerance.

BoutReal max_timestep = {1.0}

Maximum timestep.

BoutReal max_timestep_change = {2.0}

Maximum factor by which the timestep should be changed.

int mxstep = {1000}

Maximum number of internal steps between outputs.

int adapt_period = {1}

Number of steps between checks.

bool diagnose = {false}

Turn on diagnostic output.

int nlocal = {0}
int neq = {0}

Number of variables on local processor and in total.

Array<BoutReal> state

System state.

Array<BoutReal> u1

Temporary time-stepping arrays These are used by both diffusion and advection time-step routines

Array<BoutReal> u2
Array<BoutReal> u3
Array<BoutReal> dydt
Array<BoutReal> state1

Arrays used for adaptive timestepping.

Array<BoutReal> state2