emulsim.actors.coupling.point_droplet module

Provides an actor coupling point-like droplets to a field.

class PointDropletActor(parameters: dict[str, Any] | None = None)[source]

Bases: ActorBase

Actor coupling point-like droplets to a field.

For simplicity, these droplets interact with the field only at one point (their position). For a physical correct model, where the exchange flux with the dilute phase is governed by diffusion, this approximation only works in three dimension where it accelerates calculations and is usually a good approximation when the background field varies only little on the length scale of the droplet size. To cover also other dimension, a simple linear exchange flux model is also supported.

Parameters Dictionary:
  • diffusivity: Diffusivity of the droplet material in the dilute phase, which determines the rate if flux_model is diffusion. (default=1.0)

  • equilibrium_concentration: Expression/function determining the equilibrium concentration (default=’1e-5 / radius’)

  • exchange_rate: Rate with which droplet material is exchanged with the dilute phase when the flux_model is linear (default=1)

  • flux_model: Specifies how the exchange of material between the droplet and the dilute phase is modeled (default=’diffusion’)

  • mean_reaction_inside: Mean reaction rate inside the droplet, which determines the production of droplet material per unit volume (default=’0’)

Parameters:

parameters (dict) – Parameters defining the behavior of the actor. Call show_parameters() for details.

Parameters of PointDropletActor:

equilibrium_concentration

Expression/function determining the equilibrium concentration. This can be a mathematical expression as a string or a python function. The expression can contain the variables position, radius, and id denoting the droplet radius, its position vector, and its identity (the index in the list of droplets), respectively. If the value is a function it should have the signature (position, radius, i) and return the equilibrium concentration. it can also be an instance defining a __call__ method that returns the equilibrium concentration and a get_function method that returns a numba compiled function for calculating it.(position, radius, i). (Default value: '1e-5 / radius')

flux_model

Specifies how the exchange of material between the droplet and the dilute phase is modeled. Possible options: 1) ‘diffusion’, which uses a real physical diffusion model. The parameter diffusivity determines rate and the model is only applicable in 3 dimensional systems. 2) ‘linear’, which assumes that the flux is a linear function of the difference between the equilibrium concentration equilibrium_concentration and the actually measured concentration. The parameter exchange_rate defines the pre-factor governing the rate of the exchange. (Default value: 'diffusion')

diffusivity

Diffusivity of the droplet material in the dilute phase, which determines the rate if flux_model is diffusion. (Default value: 1.0)

exchange_rate

Rate with which droplet material is exchanged with the dilute phase when the flux_model is linear. Must be the total flux exchanged from the droplet toward the background field. This can either be a number of an expression, which can depend on the radius R of the droplet. (Default value: 1)

mean_reaction_inside

Mean reaction rate inside the droplet, which determines the production of droplet material per unit volume. This can be an expression that depends on the droplet radius R, its location position, or its identity id (the index in the list of droplets). Use negative values to destroy droplet material inside the droplet. (Default value: '0')

element_classes: tuple[type[_ElementBase] | tuple[type[_ElementBase], ...], ...] | EllipsisType = (<class 'emulsim.elements.spherical_droplets.SphericalDropletsElement'>, (<class 'emulsim.elements.fields.ReservoirElement'>, <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:

tuple

estimate_dt(elements: tuple[SphericalDropletsElement, FieldElementBase]) float[source]

Estimate the maximal time step for simulating this actor.

Parameters:

elements (tuple) – The state of all the droplets and of the field

Returns:

the maximal time step

Return type:

float

evolve(elements: tuple[SphericalDropletsElement, FieldElementBase], t: float, dt: float) None[source]

Evolve the state from time t to t + dt

Parameters:
  • elements (tuple) – The state of all the droplets and of the field

  • t (float) – The current time point

  • dt (float) – The time step

get_equilibrium_concentrations(droplets: SphericalDropletsElement) ndarray[source]

Returns the equilibrium concentration outside each droplet.

Parameters:

droplets (SphericalDropletsElement) – The state of all the droplets

Returns:

The equilibrium concentration for each

droplet with non-zero radius.

Return type:

ndarray

get_flux_outside(radius: float, c_back: float, cEqOut: float) float[source]

Returns the integrated outwards flux at the droplet surface given some imposed concentration value far away.

Parameters:
  • radius (float) – The current droplet radius

  • c_back (float) – The concentration in the background field at the position of the droplet

  • cEqOut (float) – The concentration right at the droplet surface.

Returns:

the integrated flux in the outward normal direction.

Return type:

float

make_evolver_numba(elements: tuple[SphericalDropletsElement, FieldElementBase]) Callable[[tuple[ndarray, ...], float, float], None][source]

Return a function evolve the state from time t to t + dt

Parameters:

elements (tuple) – The state of all the droplets and of the field

Returns:

A function with signature

(droplets_data: ndarray, field_data, t: float, dt: float), evolving droplets_data and field_data

Return type:

callable