mpacts.commands.continuum. compartmentmodeldiffusion

In order to be able to use this module import it like this:

import mpacts.commands.continuum.compartmentmodeldiffusion
#or assign it to a shorter name
import mpacts.commands.continuum.compartmentmodeldiffusion as com

GridRD_2D

class mpacts.commands.continuum.compartmentmodeldiffusion.GridRD_2D(sim, grid_pc=None, node_name='vertices', cell_name='triangles')

Bases: object

The interface to the mesh for reaction-diffusion on its surface.

Constructor:
Parameters:

parent – Parent of the grid, in most case it is the Simulation object.

Keyword Arguments:
 
  • grid_pc – Reference to the particle container containing the actual grid. If None the necessary particle container will be created. Default value: None
  • node_name – The name of the sub-particle container containing the nodes of the grid. Default value: vertices
  • cell_name – The name of the sub-particle container containing the cells of the grid. Default value: triangles
GridRD_2D(name, parent, **kwargs)
add_background_decay(name, rate, **kwargs)

For species with name, add a background decay command. \frac{{\mathrm d}N}{{\mathrm d}t} = - \text{rate} \cdot N You can add an arbitrary number of commands like this for each species, and you can use predicates (in key word arguments) to restrict the decay term to certain conditions (spatial, temporal, ...)

add_diffusion(names, rates, **kwargs)

For a list of species with names, add diffusion on the grid with a specified list of rates that can be interpreted as diffusivities (typically, m^2/s). This instantiates a fixed grid contact detector. Actual diffusion will only happen between ‘contacts’ of this fixed list contact detector. Hence, make sure that the required connections (typically, all triangle-triangle common edge couples) are added before starting the simulation. The reference to the contact detector is stored in the attribute self.fl.

add_mesh(x, vil, **kwargs)

Adds a mesh with nodes x and triangles vil to the GridRD object. Only call this function when all the commands on the GridRD_2D have been set up already. Furthermore, in ‘kwargs’ you can provide initial conditions to be used in the simulation. These are all set for the triangles for the triangles of the mesh.

Parameters:
  • x – List of nodes’ positions.
  • vil – List of triplets of indeces to list x representing the triangle between the given nodes.
add_particle_exchange(pc2, names, rates, **kwargs)

For a list of species with names, add mass exchange between particles in a given pc (pc2) with rates specified in a list rates. This will instantiate a contact detector (kwarg contactdetector, default MultiGridContactDetector), that can be configured with key word arguments keep_distance, and update_every. The rates are here usually defined as exchange rates (units 1/s). i.e. \frac{{\mathrm d}N}{{\mathrm d}t} = k N

add_particle_source(pc2, name, **kwargs)

Uses particle from other particle container as source term. Simply set an array dNAME_dt with NAME the name of the species to the value that you want to produce. Locally this amount will be directly transferred to the Diffusion grid. Hint: Not many geometrytags are accepted. If your particle has a position x, just pass argument

GeometryTag2 = GeometryTag_ComposedParticle() in kwargs, (with GeometryTag_ComposedParticle imported from mpacts.core.geometrytags). If your particle has no position x, it might be worthwile to simply compute it from children/sibling arrays that do have this property.
add_species(name)

Add a new chemical species with given name, and add all regular infrastructure commands. Note that this species will not do anything yet, since no diffusion, nor reaction is defined for it!

fixed_boundary_condition(name, value, predicate=None)

Adds a fixed boundary condition (also known as Dirichlet boundary condition) on species with name for mesh triangles that obey a certain predicate. The value is specified as a concentration (n/area) The default automatically sets a predicate (self.is_boundary) that labels all triangles with at least one ‘free’ edge. Hint: You can use boolean operators on this predicate to specify more refined boundary conditions.

initial_condition(name, value, **kwargs)

Adds an initial condition by means of an ExecuteOnce command to set a concentration value for species with name name. An additional filtering predicate might be given in key word arguments.

probe_at_particles(pc2, name, **kwargs)

Measure the concentration of species with name at particles from pc. By setting an array with name of pc2 to the local concentration in the grid.