emulsim.elements.spherical_droplets module
Provides a simulation element representing spherical droplets.
- class SphericalDropletsElement(data: ndarray | None = None, parameters: dict[str, Any] | None = None)[source]
Bases:
ArrayElementBaseElement representing many spherical droplets.
- Parameters Dictionary:
droplet_concentration: Concentration inside droplets that is used to calculate the total amount of material in droplets (default=1.0)
plot_args: Extra arguments for plotting this element (default={})
- Parameters:
data – The data describing the state
parameters – Additional parameters that affect the element
Parameters of SphericalDropletsElement:
- plot_args
Extra arguments for plotting this element (Default value:
{})- droplet_concentration
Concentration inside droplets that is used to calculate the total amount of material in droplets (Default value:
1.0)
- data: np.recarray
- droplet_class
alias of
SphericalDroplet
- property droplet_count: int
the number of droplets in the emulsion
This only counts droplets with non-zero radius.
- Type:
- classmethod empty(maxcount: int, *, dim: int | None = None, droplet: SphericalDroplet | None = None, parameters: dict[str, Any] | None = None) SphericalDropletsElement[source]
Create empty SphericalDropletsElement that can be filled with droplets later.
Since
SphericalDropletsElementneeds to know what kind of droplets it describes, this information needs to be supplied, either in form of an example droplet (via the droplet argument) or via setting the dimension of space (via the dim argument).- Parameters:
maxcount (int) – Sets the maximal number of droplets that can be stored in this element.
dim (int) – Dimensionality of the space to determine dtype of position
droplet (
SphericalDroplet) – Example of a droplet to define the kind of emulsionparameters (dict) – Additional parameters. Call
show_parameters()for details.
- Returns:
The initialized element
- Return type:
- classmethod from_droplets(droplets: Emulsion, *, copy: bool = False, maxcount: int | None = None, parameters: dict[str, Any] | None = None) SphericalDropletsElement[source]
Create SphericalDropletsElement from a list of droplets.
- Parameters:
droplets (
droplets.emulsions.Emulsion) – The state of this element given as an emulsion.copy (bool) – Flag indicating whether the droplets are copied, so they are not modified during the simulation.
maxcount (int) – If supplied, sets the maximal number of droplets that can be stored in this element. If maxcount > len(droplets), the additional entries are initialized as zero.
parameters (dict) – Additional parameters. Call
show_parameters()for details.
- classmethod from_random(num: int, bounds: FieldElementBase | FieldBase | GridBase, radius: float | tuple[float, float], *, remove_overlapping: bool = True, maxcount: int | None = None, rng: Generator | None = None, parameters: dict[str, Any] | None = None) SphericalDropletsElement[source]
Create SphericalDropletsElement with random droplets.
- Parameters:
num (int) – The number of droplets
bounds – Boundaries of the space in which droplets are placed. This can be any of
FieldElementBase,FieldBase, orGridBase.radius (float or tuple of float) – Radius of the droplets that are created. If two numbers are given, they specify the bounds of a uniform distribution from which the radius of each individual droplet is chosen.
remove_overlapping (bool) – Flag determining whether overlapping droplets are removed. If enabled, the resulting element might contain less than num droplets.
maxcount (int) – If supplied, sets the maximal number of droplets that can be stored in this element. If maxcount > num, the additional entries are initialized as zero.
rng (
Generator) – Random number generator (default:default_rng())parameters (dict) – Additional parameters. Call
show_parameters()for details.
- parameters_default = [Parameter(name='droplet_concentration', default_value=1, cls=<class 'float'>, description='Concentration inside droplets that is used to calculate the total amount of material in droplets', choices=None, required=False, hidden=False, extra={})]
parameters (with default values) of this subclass
- Type:
- plot(ax=None, *args, **kwargs)[source]
Plot all droplets of this element.
- Parameters:
{PLOT_ARGS}
**kwargs – All additional arguments are forwarded to
droplets.emulsions.Emulsion.plot().