amici.ode_model.ConservationLaw
- class amici.ode_model.ConservationLaw(identifier, name, value, coefficients, state_id)[source]
A conservation law defines the absolute the total amount of a (weighted) sum of states
- __init__(identifier, name, value, coefficients, state_id)[source]
Create a new ConservationLaw instance.
- Parameters
identifier (
sympy.core.symbol.Symbol
) – unique identifier of the ConservationLawname (
str
) – individual name of the ConservationLaw (does not need to be unique)value (
sympy.core.expr.Expr
) – formula (sum of states)coefficients (
typing.Dict
[sympy.core.symbol.Symbol
,sympy.core.expr.Expr
]) – coefficients of the states in the sumstate_id (
sympy.core.symbol.Symbol
) – identifier of the state that this conservation law replaces
Methods Summary
__init__
(identifier, name, value, ...)Create a new ConservationLaw instance.
get_id
()ModelQuantity identifier
get_name
()ModelQuantity name
get_ncoeff
(state_id)Computes the normalized coefficient a_i/a_j where i is the index of the provided state_id and j is the index of the state that is replaced by this conservation law.
get_val
()ModelQuantity value
Returns the expression that allows computation of x_rdata for the state that this conservation law replaces.
set_val
(val)Set ModelQuantity value
Methods
- __init__(identifier, name, value, coefficients, state_id)[source]
Create a new ConservationLaw instance.
- Parameters
identifier (
sympy.core.symbol.Symbol
) – unique identifier of the ConservationLawname (
str
) – individual name of the ConservationLaw (does not need to be unique)value (
sympy.core.expr.Expr
) – formula (sum of states)coefficients (
typing.Dict
[sympy.core.symbol.Symbol
,sympy.core.expr.Expr
]) – coefficients of the states in the sumstate_id (
sympy.core.symbol.Symbol
) – identifier of the state that this conservation law replaces
- get_id()
ModelQuantity identifier
- Return type
- Returns
identifier of the ModelQuantity
- get_ncoeff(state_id)[source]
Computes the normalized coefficient a_i/a_j where i is the index of the provided state_id and j is the index of the state that is replaced by this conservation law. This can be used to compute both dtotal_cl/dx_rdata (=ncoeff) and dx_rdata/dx_solver (=-ncoeff).
- Parameters
state_id – identifier of the state
- Return type
- Returns
normalized coefficent of the state
- get_val()
ModelQuantity value
- Return type
- Returns
value of the ModelQuantity
- get_x_rdata()[source]
Returns the expression that allows computation of x_rdata for the state that this conservation law replaces.
- Returns
x_rdata expression
- set_val(val)
Set ModelQuantity value
- Returns
value of the ModelQuantity