Kinetics
Kinetics shared by the chemistry packages: reactors and reactions that a reactor and the sites of a field run.
BrusselatorReactionElement(label, visual=None, *, u=1.0, v=1.0, a=1.0, b=3.0)
Bases: Element
Reactor of the Brusselator, the concentrations u and v of its two intermediates.
The reactions A -> U, B + U -> V + D, 2U + V -> 3U, and U -> E change the concentrations, with the buffered
reactants A and B held at the supplies a and b, which the reactions read as modifiers. The well-mixed
brusselator_ode runs them in one reactor and the reaction-diffusion brusselator at every site of a field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the reactor. |
required |
visual
|
VisualSpec | None
|
How the element is drawn, or |
None
|
u
|
Annotated[float, StateSpec(domain=closed_open(0, oo))]
|
The initial concentration of the autocatalytic intermediate. |
1.0
|
v
|
Annotated[float, StateSpec(domain=closed_open(0, oo))]
|
The initial concentration of the second intermediate. |
1.0
|
a
|
Annotated[float, ParameterSpec(domain=closed_open(0, oo))]
|
The constant supply of the first reactant. |
1.0
|
b
|
Annotated[float, ParameterSpec(domain=closed_open(0, oo))]
|
The constant supply of the second reactant. |
3.0
|
Examples:
>>> from skcomplex.models.chemistry.common.kinetics import BrusselatorReactionElement
>>> BrusselatorReactionElement('reactor').b
3.0
Source code in src/skcomplex/models/chemistry/common/kinetics/_brusselator.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
CubicAutocatalysisInteraction(label, *, target, substrate='u', autocatalyst='v', k=1.0, mode='rate')
Bases: ReactionInteraction
Cubic autocatalysis A + 2B -> 3B at the mass-action rate k a b^2, between two states of the target.
The autocatalyst B converts the substrate A into itself. The reaction is the autocatalytic step of the
Gray-Scott model, with the substrate u and the autocatalyst v, and of the Brusselator and the Schnakenberg
model, 2U + V -> 3U, with the substrate v and the autocatalyst u. A target that is a field reacts at every
site.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the reaction. |
required |
target
|
Annotated[str, RoleSpec()]
|
The path of the reactor, or of the field whose every site reacts. |
required |
substrate
|
str
|
The name of the state of the substrate. |
'u'
|
autocatalyst
|
str
|
The name of the state of the autocatalyst. |
'v'
|
k
|
Annotated[float, ParameterSpec(domain=closed_open(0, oo))]
|
The rate constant. |
1.0
|
mode
|
str
|
The form of the laws, |
'rate'
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
The mode is unknown, or a state name is not an identifier. |
Examples:
>>> from skcomplex.core.system import System
>>> from skcomplex.engine.runtime import Simulation
>>> from skcomplex.models.chemistry.common.kinetics import CubicAutocatalysisInteraction
>>> from skcomplex.models.chemistry.kinetics import CubicAutocatalysisElement
>>> reaction = CubicAutocatalysisInteraction('autocatalysis', target='reactor', substrate='a', autocatalyst='b')
>>> reactor = CubicAutocatalysisElement('reactor', a=1.0, b=0.5)
>>> trajectory = Simulation(System(elements=[reactor], interactions=[reaction]), dt=1.0).check().prepare()
>>> states = trajectory.run(until=10).trajectory_.states
>>> round(float(states[-1].sum()), 6)
1.5
Source code in src/skcomplex/models/chemistry/common/kinetics/_cubic_autocatalysis.py
60 61 62 63 64 65 66 67 68 69 70 71 72 | |