emulsim.actors.coupling.fields module
Provides an actor coupling two or more fields.
- class FieldBoundaryExchangeActor(parameters: dict[str, Any] | None = None)[source]
Bases:
ActorBaseActor exchanging material between a field and its boundary.
This actor does move material between support points in the boundary field and the adjacent support points in the bulk field. This is an approximation, which might lead to unphysical situations since material is injected half a discretization size away from the boundary (at the first support point) instead of directly at the boundary via a flux boundary conditions. However, the advantage of this method is that it is suitable for arbitrary PDEs describing the bulk and always ensures material conservation.
Note
The flux is oriented such that positive values move material from the bulk to the boundary. The expression of the exchange flux may depend on the concentrations in the bulk and the boundary, which are available as the variables
bulkandboundaryin the respective expression parameter. In contrast, the names of the actual elements in the entire simulation (e.g., cytosol and membrane) cannot be used to refer to these concentrations. The flux is an area flux, so that the total amount of material transferred between the two fields is proportional to the time step and the boundary area.- Parameters Dictionary:
exchange_flux: The expressions determining the flux from the bulk to the boundary (default=’0’)
- Parameters:
parameters (dict) – Parameters defining the behavior of the actor. Call
show_parameters()for details.
Parameters of FieldBoundaryExchangeActor:
- exchange_flux
The expressions determining the flux from the bulk to the boundary. The expression may depend on the concentration in the bulk (bulk), the concentration in the boundary (boundary), and explicit time (t). (Default value:
'0')
- element_classes: tuple[type[_ElementBase] | tuple[type[_ElementBase], ...], ...] | EllipsisType = (<class 'emulsim.elements.fields.FieldElementBase'>, <class 'emulsim.elements.fields.ScalarBoundaryFieldElement'>)
defines the elements this actor handles and in what order they need to be supplied. An ellipsis (…) indicates that all elements and lists of elements are accepted. Setting this attribute allows internal consistency checks.
- Type:
- evolve(fields: tuple[_ElementBase, ...], t: float, dt: float) None[source]
Evolve the state from time t to t + dt
- Parameters:
fields (tuple of
FieldElementBase) – The state of the individual fieldst (float) – The current time point
dt (float) – The time step
- make_evolver_numba(fields: tuple[_ElementBase, ...]) Callable[[tuple[ndarray, ...], float, float], None][source]
Return a function evolve the state from time t to t + dt
- Parameters:
fields (tuple of
FieldElementBase) – The state of the individual fields- Returns:
- A function with signature
(droplets_data:
ndarray, field_data, t: float, dt: float), evolving droplets_data and field_data
- Return type:
callable
- class FieldCouplingActor(parameters: dict[str, Any] | None = None)[source]
Bases:
ActorBaseActor coupling multiple fields by local interactions.
- Parameters Dictionary:
evolution_rates: The expressions determining the dynamics of the fields (default={})
fields: The name of the fields that this actor affects. (default=[‘a’, ‘b’])
- Parameters:
parameters (dict) – Parameters defining the behavior of the actor. Call
show_parameters()for details.
Parameters of FieldCouplingActor:
- fields
The name of the fields that this actor affects. (Default value:
['a', 'b'])- evolution_rates
The expressions determining the dynamics of the fields (Default value:
{})
- element_classes: tuple[type[_ElementBase] | tuple[type[_ElementBase], ...], ...] | EllipsisType = Ellipsis
defines the elements this actor handles and in what order they need to be supplied. An ellipsis (…) indicates that all elements and lists of elements are accepted. Setting this attribute allows internal consistency checks.
- Type:
- evolve(fields: tuple[_ElementBase, ...], t: float, dt: float) None[source]
Evolve the state from time t to t + dt
- Parameters:
fields (tuple of
FieldElementBase) – The state of the individual fieldst (float) – The current time point
dt (float) – The time step
- make_evolver_numba(fields: tuple[_ElementBase, ...]) Callable[[tuple[ndarray, ...], float, float], None][source]
Return a function evolve the state from time t to t + dt
- Parameters:
fields (tuple of
FieldElementBase) – The state of the individual fields- Returns:
- A function with signature
(droplets_data:
ndarray, field_data, t: float, dt: float), evolving droplets_data and field_data
- Return type:
callable
- class FieldExchangeActor(parameters: dict[str, Any] | None = None)[source]
Bases:
ActorBaseActor exchanging material between two fields on the same grid.
- Parameters Dictionary:
exchange_rate: The expressions determining the exchange from the first field toward the second field (default=’0’)
field_name: The names of the two fields, which appear in exchange_rate (default=(‘c1’, ‘c2’))
- Parameters:
parameters (dict) – Parameters defining the behavior of the actor. Call
show_parameters()for details.
Parameters of FieldExchangeActor:
- exchange_rate
The expressions determining the exchange from the first field toward the second field. The names of the field are set by field_names (Default value:
'0')- field_name
The names of the two fields, which appear in exchange_rate (Default value:
('c1', 'c2'))
- element_classes: tuple[type[_ElementBase] | tuple[type[_ElementBase], ...], ...] | EllipsisType = (<class 'emulsim.elements.fields.FieldElementBase'>, <class 'emulsim.elements.fields.FieldElementBase'>)
defines the elements this actor handles and in what order they need to be supplied. An ellipsis (…) indicates that all elements and lists of elements are accepted. Setting this attribute allows internal consistency checks.
- Type:
- evolve(fields: tuple[FieldElementBase, FieldElementBase], t: float, dt: float) None[source]
Evolve the state from time t to t + dt
- Parameters:
fields (tuple of
FieldElementBase) – The state of the individual fieldst (float) – The current time point
dt (float) – The time step
- make_evolver_numba(fields: tuple[FieldElementBase, FieldElementBase]) Callable[[tuple[ndarray, ...], float, float], None][source]
Return a function evolve the state from time t to t + dt
- Parameters:
fields (tuple of
FieldElementBase) – The state of the individual fields- Returns:
- A function with signature
(droplets_data:
ndarray, field_data, t: float, dt: float), evolving droplets_data and field_data
- Return type:
callable