josie.general.schemes.time package¶
Submodules¶
josie.general.schemes.time.euler module¶
- class josie.general.schemes.time.euler.ExplicitEuler(problem, *args, **kwargs)¶
Bases:
josie.scheme.time.TimeScheme
Implements the explicit euler scheme
- step(mesh, dt, t)¶
For
ExplicitEuler
, we just accumulate once the fluxes at time . So nothing to do.
- time_order: float = 1¶
josie.general.schemes.time.rk module¶
Classes associated to the implementation of Runge-Kutta time schemes
- class josie.general.schemes.time.rk.ButcherTableau(a_s, b_s, c_s)¶
Bases:
object
A class to store the RK coefficients.
Generally coefficients for a generic Runge-Kutta method are stored in a mnemonic structure called Butcher Tableau.
For example:
- Parameters
a_s (numpy.ndarray) – The coefficients stored in a
np.ndarray
. The order of storage isb_s (numpy.ndarray) – The coefficients stored in a
np.ndarray
. The order of storage isc_s (numpy.ndarray) – The coefficients stored in a
np.ndarray
. The order of storage is ldots`
- a_s¶
The coefficients stored in a
np.ndarray
. The order of storage is- Type
numpy.ndarray
- b_s¶
The coefficients stored in a
np.ndarray
. The order of storage is- Type
numpy.ndarray
- c_s¶
The coefficients stored in a
np.ndarray
. The order of storage is- Type
numpy.ndarray
- a_s: numpy.ndarray¶
- b_s: numpy.ndarray¶
- c_s: numpy.ndarray¶
- class josie.general.schemes.time.rk.RK(problem, butcher)¶
Bases:
josie.scheme.time.TimeScheme
A generic Runge-Kutta explicit method
- problem¶
An instance of
Problem
representing the physical problem that this scheme discretizes
- butcher¶
An instance of
ButcherTableau
that provides the coefficient of the Runge-Kutta method
- k(mesh, dt, t, step)¶
Recursive function that computes all the coefficients from to
The highest value is stored in
_fluxes
- post_init(cells)¶
A Runge-Kutta method needs to store intermediate steps. It needs additional storage slots, where is the number of steps of the Runge-Kutta method
- Parameters
cells (
MeshCellSet
) – AMeshCellSet
containing the state of the mesh cells
- pre_step(cells)¶
Zero-out the array containing the values
- Parameters
cells (
MeshCellSet
) – AMeshCellSet
containing the state of the mesh cells
- step(mesh, dt, t)¶
This method implements the accumulation over all the neighbours of a specific cell of the numerical fluxes. It can be overridden by, for example, a
TimeScheme
in order to implement multi-step accumulation- Parameters
mesh (
Mesh
) – AMesh
containing the state of the meshdt (
float
) – Time stept (
float
) – The current time instant of the simulation
- time_order: float¶
- class josie.general.schemes.time.rk.RK2(problem)¶
Bases:
josie.general.schemes.time.rk.RK2Alpha
Implements the explicit 2nd-order Runge-Kutta scheme with
- time_order: float = 2¶
- class josie.general.schemes.time.rk.RK2Alpha(problem, alpha)¶
Bases:
josie.general.schemes.time.rk.RK
Implements the explicit 2nd-order Runge-Kutta scheme with a tunable parameter
- Parameters
problem (Problem) – An instance of
Problem
representing the physical problem that this scheme discretizesalpha (float) – The value of the alpha coefficient
- num_steps: int¶
- time_order: float¶