kipe.examples.fitzhugh_nagumo module
FitzHugh-Nagumo model, solved with RK4, as a minimal kipe forward solver.
This is a common benchmark problem [Ram+07] with the following properties:
Attracting limit cycle: small errors are attenuated (in contrast to chaotic Lorenz63 problem).
Nonlinearity
Signed states (possible problem with Lotka-Volterra)
The public members of Solver, together with FieldSpec, are the complete
kipe interface; the private methods are the model. This module is fully independent of kipe.
Ramsay, J.O., Hooker, G., Campbell, D. and Cao, J. (2007), Parameter estimation for differential equations: a generalized smoothing approach. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 69: 741-796. https://doi.org/10.1111/j.1467-9868.2007.00610.x
- type kipe.examples.fitzhugh_nagumo.NDArray_f64 = NDArray[float64]
- type kipe.examples.fitzhugh_nagumo.State = dict[str, NDArray_f64]
- type kipe.examples.fitzhugh_nagumo.Parameters = dict[str, float]
- class kipe.examples.fitzhugh_nagumo.FieldSpec(local_size: int, kind: Literal['distributed', 'replicated'] = 'replicated')[source]
Bases:
objectLayout of one state field on the current MPI rank.
- local_size: int
the owned entries for a distributed field, the full size for a replicated one.
- Type:
Number of entries of the field held by this rank
- kind: Literal['distributed', 'replicated'] = 'replicated'
each entry is owned by exactly one rank (e.g., the owned dofs of a finite element function).
replicated: every rank holds the full, identical field (e.g., the state of FHN or a small lumped-parameter model).- Type:
distributed
- class kipe.examples.fitzhugh_nagumo.Solver(dt: float = 0.05, v0: float = -1.0, w0: float = 1.0, a: float = 0.2, b: float = 0.2, c: float = 3.0)[source]
Bases:
objectFitzHugh-Nagumo solver with a fixed RK4 time step.
The defaults are the setup of [Ram+07].
- Parameters:
dt – time step size
v0 – initial value of \(v\)
w0 – initial value of \(w\)
a – nominal value of \(a\)
b – nominal value of \(b\)
c – nominal value of \(c\)
- property state_spec: dict[str, FieldSpec]
two scalars,
vandw.- Type:
Names and layout of the state fields
- nominal_parameters() Parameters[source]
Return the estimable parameters and their nominal values.
- Returns:
parameter name -> nominal value dict (a new dict)
- initial_state() tuple[float, State][source]
Return the start time and the initial state.
- Returns:
start time
t0 = 0initial state \((v_0, w_0)\)
- propagate(t0: float, t1: float, state: State, parameters: Parameters) State[source]
Propagate the state from
t0tot1with RK4 steps.- Parameters:
t0 – time of
statet1 – target time
state – state at
t0parameters – parameter values for this call, overriding the nominal values
- Returns:
state at
t1- Raises:
ValueError – if
t1 - t0is not a positive multiple ofdt