Example simulations available from the Chaste website
The downloads section of the public Chaste website contains the files required for three simulations in the tarball simulations.tgz. Download and unpack, which will result in the following folders being created:
- simulations/propagation1d
- simulations/propagation3dparallel
- simulations/s1s2protocol
Also, if you haven't done so already, download meshalyzer from the downloads page and unpack.
Running a simple example: propagation in a tissue fibre
Running the simulation
Change directory to simulations/propagation1d
cd simulations/propagation1d
In this folder you will find the following files:
- ChasteParameters.xml -- this file describes the simulation, and can be used to override the default parameter values (in releases of the executable up to and including version 2.0, the default parameters were read in from another xml file, ChasteDefaults.xml).
- ChasteParameters_2_1.xsd -- XML schema for input validation (in general never has to be altered or touched).
Run the simulation by doing
<path_to_chaste>/Chaste.sh ChasteParameters.xml
Note: in releases up to and including version 2.0, the executable would be called directly (ie: <path_to_chaste>/Chaste ChasteParameters.xml), in release 2.1 the executable should be called via the shell script Chaste.sh; as above.
A folder called testoutput will appear once the simulation has finished.
Visualising the results
Move into the newly created output folder
cd testoutput/ChasteResults
In this folder you will find the following files and folders:
- progress_status.txt -- this file can be viewed whilst the simulation is running to gauge how long it will take
- SimulationResults.h5 -- the output of the simulation, in HDF5 format
- output (folder) -- contains the output converted into meshalyzer format
Move now into the Meshalyzer-compatible output folder
cd output
Launch Meshalyzer with
<path_to_meshalyzer>/meshalyzer SimulationResults_mesh
and visualise the results by loading the SimulationResults_V.dat file.
Understanding the XML parameters file
Open ChasteParameters.xml (it is sensible to do this in a web-browser or XML editor in order to get syntax highlighting). The file should be reasonably readable; it defines:
- a 1D simulation that lasts for 500ms
- the use of the monodomain model
- to use bidomain, the only thing that needs to be done is to change Mono to Bi
- a Luo-Rudy cell model as the default cell model
- a 1D autogenerated mesh of length 4cm
- a stimulated region in the first 0.2cm (stimulus is applied every 100ms)
- note: in the Cuboid definition, y and z coordinates are ignored in 1D simulations
- output directory and filenames
- physiological parameters: conductivities, capacitance, surface-area-to-volume ratio
- in monodomain problems, the defined intracellular conductivity is used not a harmonic mean. The extracellular conductivity is therefore ignored, as are the components in the transverse (sheet) and normal directions since this is a 1D simulation.
- Numerical parameters including timesteps and KSP (linear solver) options
Running a 2D tissue simulation instead
Now we are going to change our geometry description to create a tissue sheet instead of a fibre.
Go to ChasteParameters.xml and find the following section:
<Mesh unit="cm"> <Fibre x="4.0" inter_node_space="0.01"/> </Mesh>
We can change the geometry to be a tissue sheet:
<Mesh unit="cm"> <Sheet x="2.0" y="2.0" inter_node_space="0.03"/> </Mesh>
In addition, the following parameters need to be modified:
<SpaceDimension>2</SpaceDimension> <SimulationDuration unit="ms">30.0</SimulationDuration>
Rerun the simulation and follow the previous section to visualise the results.
Further examples
3D on a realistic cardiac geometry
The files in
- simulations/propagation3dparallel
define a simulation on a 3D geometry, which can be run identically to above, or in parallel by doing (with 4 processes, say):
<path_to_chaste>/Chaste.sh -np 4 ChasteParameters.xml
Open the parameters XML file. The main difference in this file is that it defines a mesh to be loaded, rather than autogenerated, in this case with prefix heart_chaste2_renum_i_triangles. The executable will look for files heart_chaste2_renum_i_triangles.node, .ele and .face (or .edge in 2D). See the FileFormats.html page supplied with the executable for more information on file formats.
Also note that in this simulation no fibre directions are provided (conductivity_media="NoFibreOrientation"), hence the isotropic conductivities defined later on.
S1-S2 protocol on a sheet
The other simulation
- simulations/s1s2protocol
defines a simulation in 2D in which two stimuli are defined, one at t=0ms on one edge to start regular electrical activity, and a second at t=255ms in a rectangular region which causes a re-entrant wave to occur.
