Core modules

The core modules of morphosolver.

morphosolver.core.tissuebase

class morphosolver.core.tissuebase.TissueBase(mesh0=<sphinx.ext.autodoc.importer._MockObject object>, params={})[source]

TissueBase defines the problem geometry and mechanics. It is a base class, where init() and update() functions should be overridden by the derived class.

Parameters:
  • mesh0 (dolfin.Mesh) – A mesh of the initial condition
  • params (dict) – A dictionary of parameters
init()[source]

Virtual initialisation function. It ss only run once before the start of the simulation.

plotMesh()[source]

Virtual iupdate function. Is run at every time-step of the simulation before solving the growth mechanics by the call to the solve() function.

update(dt)[source]

Virtual iupdate function. Is run at every time-step of the simulation before solving the growth mechanics by the call to the solve() function.

Parameters:dt (float) – A time-step, passed by the Simulator object.

morphosolver.core.simulator

class morphosolver.core.simulator.Simulator(tissue, outputDir='/home/docs/checkouts/readthedocs.org/user_builds/morphosolver/checkouts/latest/docs/source')[source]

Handles running the simulation of the problem defined by a morphosolver.core.tissuebase.TissueBase object

Parameters:
run(dt, n, growthOn=True)[source]

Runs the simulation

Parameters:
  • dt (float) – A time-step
  • n (int) – Number of time-steps
  • growthOn (bool) – Enable growth. Defaults to True

morphosolver.core.chemical

class morphosolver.core.chemical.Chemical(tissue, name)[source]

Bases: morphosolver.core.util.SmartFunction

Chemical defines a concentration field which can be subject to diffusion and user-specified reaction.

Parameters:
setDiffusion(D)[source]

Set diffusion

Parameters:D (float) – Diffusion rate
setReaction(R)[source]

Set reaction term

Parameters:R (dolfin.cpp.function.GenericFunction) – Reaction term
update(dt)[source]

Update function by calculating reaction-diffusion step

Parameters:dt (float) – Time-step

morphosolver.core.util

Collection of the utility functions.

class morphosolver.core.util.SmartFunction(name, functionSpace0=None, function=None, functionSpace=None)[source]

Smart function is a derivative of the dolfin.Function with an extended functionality. It allows to specify two function spaces (dolfin.FunctionSpace) for both an initial and current conditions. The state of the Smart functions are automatically saved at each simulation step to the outputDir

Parameters:
  • name (str) – Name of the function. The name is used for a filename, where the function state will be saved.
  • functionSpace0 (dolfin.FunctionSpace) – Function space of the initial condition.
  • functionSpace (dolfin.FunctionSpace) – Function space of the current condition. Either supplied at the initialisation or is derived from the supplied function.
class morphosolver.core.util.GenericDomain(func)[source]

A helper class to define a subdomain with a given function. Derivative of dolfin.SubDomain.

Parameters:func (lambda(x, onBoundary)) – A lambda function, which returns true if the point x is inside the defined subdomain.