In this tutorial we show how to run a 3D simulation using the monodomain equation.
To go from monodomain to bidomain or vice versa is trivial, and for 2d to 3d is
also very easy.
First include the headers, MonodomainProblem this time.
Here we define a cell factory that gives stimuli to cells in the block
0<x<0.1, 0<y<0.1, 0<z<0.1. Note that it inherits from AbstractCardiacCellFactory<3>
this time (not <2>).
Now define the test
We will auto-generate a mesh this time, and pass it in, rather than
provide a mesh file name. This is how to generate a cuboid mesh with
a given spatial stepsize h.
Using a DistributedTetrahedralMesh is faster than TetrahedralMesh when running on multiple processes.
However, it permutes the node ordering for output. Most of time time this won’t matter, but later in this
test we want to access specific node indices. One method of doing this is to ask HeartConfig to use the
original node ordering for the output.
(In 2D the call is identical, but without the depth parameter).
Set the simulation duration, etc, and create an instance of the cell factory.
One thing that should be noted for monodomain problems, the ‘‘intracellular
conductivity’’ is used as the monodomain effective conductivity (not a
harmonic mean of intra and extracellular conductivities). So if you want to
alter the monodomain conductivity call
HeartConfig::Instance()->SetIntracellularConductivities
Now we declare the problem class, MonodomainProblem<3> instead of BidomainProblem<2>.
The interface for both is the same.
If a mesh-file-name hasn’t been set using HeartConfig, we have to pass in
a mesh using the SetMesh method (must be called before Initialise).
By default data for all nodes is output, but for big simulations, sometimes this
might not be required, and the action potential only at certain nodes required.
The following code shows how to output the results at the first, middle and last
nodes, for example. (The output is written to the HDF5 file; regular visualisation output
will be turned off. HDF5 files can be read using Matlab). We are not using this in this
simulation however (hence the boolean being set to false).
SetWriteInfo is a useful method that means that the min/max voltage is
printed as the simulation runs (useful for verifying that cells are stimulated
and the wave propagating, for example)
Finally, call Initialise and Solve as before
This part is just to check nothing has accidentally been changed in this example