cminject.actions package

A collection of subclasses of cminject.base.Action. Contains (at least):

  • actions that model Brownian motion by applying a random force after every integration step

  • actions that model other physical changes required by devices (e.g., .temperature.MolecularFlowUpdateTemperature)

  • a simple action to track the particle’s trajectory

class cminject.actions.TrackTrajectory

Bases: cminject.base.Action

Appends the array of tracked properties to the trajectory of the particle.

__call__(particle: cminject.base.Particle, time: float) bool

Does some thing with a Particle instance. Must return True if the particle’s phase_space_position is changed, or if its position or velocity is changed (since these two properties are directly derived from phase_space_position). Note that a “change” entails overwriting the whole property as well as changing only parts of it.

Parameters
  • particle – The Particle instance.

  • time – The current time.

Returns

True if the phase space position of a particle was changed in any way. False otherwise.

Submodules

cminject.actions.brownian_motion module

Actions that model Brownian motion by applying a random force (with a reasonable spectral intensity) after every integration step.

class cminject.actions.brownian_motion.MolecularFlowBrownianMotionStep(field: cminject.fields.fluid_flow.MolecularFlowDragForceField)

Bases: cminject.base.Action, cminject.utils.global_config.ConfigSubscriber

Models brownian motion based on the fluctuation-dissipation-theorem and a numerical representation of the delta function

__call__(particle: cminject.particles.spherical.ThermallyConductiveSphericalParticle, time: float) bool

Does some thing with a Particle instance. Must return True if the particle’s phase_space_position is changed, or if its position or velocity is changed (since these two properties are directly derived from phase_space_position). Note that a “change” entails overwriting the whole property as well as changing only parts of it.

Parameters
  • particle – The Particle instance.

  • time – The current time.

Returns

True if the phase space position of a particle was changed in any way. False otherwise.

config_change(key: cminject.utils.global_config.ConfigKey, value: Any)

Will be called whenever the value of any subscribed key changes. Will be called once at the time of subscribing, IF the value for the subscribed key(s) is not None.

Parameters
  • key – The ConfigKey that the change occurred for.

  • value – The new value of the configuration value stored for the key key.

Returns

Nothing (unused).

class cminject.actions.brownian_motion.StokesBrownianMotionStep(field: cminject.fields.fluid_flow.StokesDragForceField)

Bases: cminject.base.Action, cminject.utils.global_config.ConfigSubscriber

Models brownian motion for a Stokes drag force field based on the paper: A. Li, G. Ahmadi, Dispersion and deposition of spherical particles from point sources in a turbulent channel flow, Aerosol Sci. Techn. 16 (24) (1992) 209–226. doi:10.1080/02786829208959550

__call__(particle: cminject.particles.spherical.SphericalParticle, time: float) bool

Does some thing with a Particle instance. Must return True if the particle’s phase_space_position is changed, or if its position or velocity is changed (since these two properties are directly derived from phase_space_position). Note that a “change” entails overwriting the whole property as well as changing only parts of it.

Parameters
  • particle – The Particle instance.

  • time – The current time.

Returns

True if the phase space position of a particle was changed in any way. False otherwise.

config_change(key: cminject.utils.global_config.ConfigKey, value: Any)

Will be called whenever the value of any subscribed key changes. Will be called once at the time of subscribing, IF the value for the subscribed key(s) is not None.

Parameters
  • key – The ConfigKey that the change occurred for.

  • value – The new value of the configuration value stored for the key key.

Returns

Nothing (unused).

cminject.actions.temperature module

Actions that affect a Particle’s temperature in some way.

class cminject.actions.temperature.MolecularFlowUpdateTemperature(field: cminject.fields.fluid_flow.MolecularFlowDragForceField)

Bases: cminject.base.Action, cminject.utils.global_config.ConfigSubscriber

Updates the temperature of a ThermallyConductiveSphericalParticle, based on the pressure exerted by a MolecularFlowDragForceField at the point the particle is at, the particle’s specific heat and mass, and the chosen time step. The formulae are described in Nils Roth’s paper, https://arxiv.org/abs/2006.10652

__call__(particle: cminject.particles.spherical.ThermallyConductiveSphericalParticle, time: float) bool

Does some thing with a Particle instance. Must return True if the particle’s phase_space_position is changed, or if its position or velocity is changed (since these two properties are directly derived from phase_space_position). Note that a “change” entails overwriting the whole property as well as changing only parts of it.

Parameters
  • particle – The Particle instance.

  • time – The current time.

Returns

True if the phase space position of a particle was changed in any way. False otherwise.

config_change(key: cminject.utils.global_config.ConfigKey, value: Any)

Will be called whenever the value of any subscribed key changes. Will be called once at the time of subscribing, IF the value for the subscribed key(s) is not None.

Parameters
  • key – The ConfigKey that the change occurred for.

  • value – The new value of the configuration value stored for the key key.

Returns

Nothing (unused).