integration⚓︎
Time stepping (integration) tools.
FD_Jac(func, eps=1e-07)
⚓︎
Finite-diff approx. of Jacobian of func
.
The function func(x)
must be compatible with x.ndim == 1
and 2
,
where, in the 2D case, each row is seen as one function input.
Returns:
Type | Description |
---|---|
function
|
The first input argument is that of which the derivative is taken. |
Examples:
integrate_TLM(TLM, dt, method='approx')
⚓︎
Compute the resolvent.
The resolvent may also be called
- the Jacobian of the step func.
- the integral of (with M as the TLM):
The tangent linear model (TLM)
is assumed constant (for each method
below).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
method
|
str
|
Warning "'analytic' typically requries higher inflation in the ExtKF." |
'approx'
|
See Also
FD_Jac
.
rk4(f, x, t, dt, stages=4, s=0)
⚓︎
Runge-Kutta (explicit, non-adaptive) numerical (S)ODE solvers.
For ODEs, the order of convergence equals the number of stages
.
For SDEs with additive noise (s>0
), the order of convergence
(both weak and strong) is 1 for stages
equal to 1 or 4.
These correspond to the classic Euler-Maruyama scheme and the Runge-Kutta
scheme for S-ODEs respectively, see grudzien2020a
for a DA-specific discussion on integration schemes and their discretization errors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
f
|
function
|
The time derivative of the dynamical system. Must be of the form |
required |
x
|
ndarray or float
|
State vector of the forcing term |
required |
t
|
float
|
Starting time of the integration |
required |
dt
|
float
|
Integration time step. |
required |
stages
|
int
|
The number of stages of the RK method.
When |
4
|
s
|
float
|
The diffusion coeffient (std. dev) for models with additive noise. Default: 0, yielding deterministic integration. |
0
|
Returns:
Type | Description |
---|---|
ndarray
|
State vector at the new time, |
with_recursion(func, prog=False)
⚓︎
Make function recursive in its 1st arg.
Return a version of func
whose 2nd argument (k
)
specifies the number of times to times apply func on its output.
!!! warning Only the first argument to func
will change,
so, for example, if func
is step(x, t, dt)
,
it will get fed the same t
and dt
at each iteration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func
|
function
|
Function to recurse with. |
required |
prog
|
bool or str
|
Enable/Disable progressbar. If |
False
|
Returns:
Name | Type | Description |
---|---|---|
fun_k |
function
|
A function that returns the sequence generated by recursively
running |
Examples:
with_rk4(dxdt, autonom=False, stages=4, s=0)
⚓︎
Wrap dxdt
in rk4
.