pyshqg.core.integration module
Submodule dedicated to integration schemes.
- class pyshqg.core.integration.RungeKuttaModelIntegrator(model, dt, method)
Bases:
objectRunge–Kutta integration class.
The purpose of this class is to implement Runge–Kutta integration schemes.
- model
The model to integrate.
- Type:
pyshqg.core_numpy.model.QGModel
- dt
The integration time step.
- Type:
float
- steps
The scheme integration sub time steps.
- Type:
list of float
- weights
The weights of each integration sub time step.
- Type:
list of float
- __init__(model, dt, method)
Constructor for the Runge–Kutta integration class.
The list of integration sub time steps and the associated weights are constructed for each available schemes. The list of currently available schemes is: - RK4; - RK2; - ABM; - EE.
- Parameters:
model (pyshqg.core_numpy.model.QGModel) – The model to integrate.
dt (float) – The integration time step.
method (str) – The method name.
- forward(state)
Applies an integration step forward in time.
- Parameters:
state (dict of str to numpy.ndarray) – The current QG model state.
- Returns:
state – The integrated QG model state.
- Return type:
dict of str to numpy.ndarray
- run(state, t_start, num_snapshots, num_steps_per_snapshot, variables, use_tqdm=True)
Computes a full trajectory.
- Parameters:
state (dict of str to numpy.ndarray) – The initial QG model state.
t_start (float) – The time of the initial state.
num_snapshots (int) – Number of snapshots to compute.
num_steps_per_snapshot (int) – Number of integration steps between snapshots.
variables (list of str) – List of variables to record.
use_tqdm (bool) – Whether to use tqdm for the main integration loop.
- Returns:
trajectory – The model trajectory.
- Return type:
pyshqg.core_numpy.model.QGModelTrajectory