Fluxes

mechanica.Fluxes

alias of mechanica.mechanica.MxFluxes

class mechanica.MxFluxes

A flux is defined between a pair of types, and acts on the state vector between a pair of instances.

The indices of the species in each state vector are most likely different, so Mechanica tracks the indices in each type, and the transport constatants.

A flux between a pair of types, and pair of respective species needs:

(1) type A, (2) type B, (3) species id in A, (4) species id in B, (5) transport constant.

Allocates Flux as a single block, member pointers point to offsets in these blocks.

Allocated size is: sizeof(MxFluxes) + 2 * alloc_size * sizeof(int32) + alloc_size * sizeof(float)

static flux(A: MxParticleType, B: MxParticleType, name: std::string const &, k: float const &, decay: float const & = 0.0) MxFluxes *

Alias of fluxFick.

Parameters
  • A (MxParticleType) – first type

  • B (MxParticleType) – second type

  • name (string) – name of species

  • k (float) – transport coefficient

  • decay (float) – optional decay. Defaults to 0.0.

Return type

MxFluxes

Returns

MxFluxes*

static fluxFick(A: MxParticleType, B: MxParticleType, name: std::string const &, k: float const &, decay: float const & = 0.0) MxFluxes *

Creates and binds a Fickian diffusion flux.

Fickian diffusion flux implements the analogous reaction:

\[a.S \leftrightarrow b.S ; k \left(1 - \frac{r}{r_{cutoff}} \right)\left(a.S - b.S\right) ,\]
\[a.S \rightarrow 0 ; \frac{d}{2} a.S ,\]
\[b.S \rightarrow 0 ; \frac{d}{2} b.S ,\]

where \(a.S\) is a chemical species located at object \(a\), and likewise for \(b\), \(k\) is the flux constant, \(r\) is the distance between the two objects, \(r_{cutoff}\) is the global cutoff distance, and \(d\) is an optional decay term.

Automatically updates when running on a CUDA device.

Parameters
  • A (MxParticleType) – first type

  • B (MxParticleType) – second type

  • name (string) – name of species

  • k (float) – transport coefficient

  • decay (float) – optional decay. Defaults to 0.0.

Return type

MxFluxes

Returns

MxFluxes*

static secrete(A: MxParticleType, B: MxParticleType, name: std::string const &, k: float const &, target: float const &, decay: float const & = 0.0) MxFluxes *

Creates a secretion flux by active pumping.

Secretion flux implements the analogous reaction:

\[a.S \rightarrow b.S ; k \left(1 - \frac{r}{r_{cutoff}} \right)\left(a.S - a.S_{target} \right) ,\]
\[a.S \rightarrow 0 ; \frac{d}{2} a.S ,\]
\[b.S \rightarrow 0 ; \frac{d}{2} b.S ,\]

where \(a.S\) is a chemical species located at object \(a\), and likewise for \(b\), \(k\) is the flux constant, \(r\) is the distance between the two objects, \(r_{cutoff}\) is the global cutoff distance, and \(d\) is an optional decay term.

Automatically updates when running on a CUDA device.

Parameters
  • A (MxParticleType) – first type

  • B (MxParticleType) – second type

  • name (string) – name of species

  • k (float) – transport coefficient

  • target (float) – target concentration

  • decay (float) – optional decay. Defaults to 0.0

Return type

MxFluxes

Returns

MxFluxes*

static uptake(A: MxParticleType, B: MxParticleType, name: std::string const &, k: float const &, target: float const &, decay: float const & = 0.0) MxFluxes *

Creates an uptake flux by active pumping.

Uptake flux implements the analogous reaction:

\[a.S \rightarrow b.S ; k \left(1 - \frac{r}{r_{cutoff}}\right)\left(b.S - b.S_{target} \right)\left(a.S\right) ,\]
\[a.S \rightarrow 0 ; \frac{d}{2} a.S ,\]
\[b.S \rightarrow 0 ; \frac{d}{2} b.S ,\]

where \(a.S\) is a chemical species located at object \(a\), and likewise for \(b\), \(k\) is the flux constant, \(r\) is the distance between the two objects, \(r_{cutoff}\) is the global cutoff distance, and \(d\) is an optional decay term.

Automatically updates when running on a CUDA device.

Parameters
  • A (MxParticleType) – first type

  • B (MxParticleType) – second type

  • name (string) – name of species

  • k (float) – transport coefficient

  • target (float) – target concentration

  • decay (float) – optional decay. Defaults to 0.0

Return type

MxFluxes

Returns

MxFluxes*