diabayes.forward_models.Forward#

class diabayes.forward_models.Forward(friction_model: FrictionModel, state_evolution: Dict[str, Callable], stress_transfer: StressTransfer[BC])[source]#

The Forward class assembles the various components that comprise a forward model, such that Forward.__call__ takes some variables and returns the rate of change of these variables

\[\frac{\mathrm{d} \vec{X}}{\mathrm{d}t} = f \left( \vec{X} \right)\]

This forward ODE can then be solved by any ODE solver.

The Forward class is instantiated by providing a friction model, a “state” evolution law, and a stress transfer model.

Examples

>>> from diabayes.forward_models import ageing_law, rsf, springblock, Forward
>>> foward_model = Forward(rsf, {"theta": ageing_law}, springblock)
>>> X_dot = forward_model(variables=..., params=..., friction_constants=..., block_constants=...)
__init__(friction_model: FrictionModel, state_evolution: Dict[str, Callable], stress_transfer: StressTransfer[BC]) None[source]#

Methods

__init__(friction_model, state_evolution, ...)

call(t, variables, params, ...)

Calculate the rate of change of the variables, defining the ODE to be solved.

set_initial_values(**kwargs)

Set the initial values of the variables.

call(t: Float, variables: Variables, params: RSFParams | CNSParams, friction_constants: RSFConstants, block_constants: BC) Variables#

Calculate the rate of change of the variables, defining the ODE to be solved.

Parameters:
  • t (Float) – Current value of time [s]

  • variables (diabayes.Variables) – The instantaneous values of the variables for which the time derivative will be computed

  • params (_Params) – The forward model (invertible) parameters

  • friction_constants (_Constants) – The forward model constants

  • block_constants (_BlockConstants) – The constants associated with the stress transfer

Returns:

dvars – The instantaneous rate of change of the variables

Return type:

Variables

set_initial_values(**kwargs) None[source]#

Set the initial values of the variables. This sets the values as self.variables, which is a Variables object.

Parameters:

**kwargs (dict) – Key-value pairs of variable names and corresponding values