# How-to index

As well as ensuring that Chaste functions as expected, the many Chaste tests can be effective for learning how to use Chaste. There are often aspects of Chaste’s capabilities that do not warrant a full user tutorial, but are still worth noting. Equally, users often ask “how do I do…”, and in many cases there is already a test that does something similar and can be used as a basis.

This page contains a (probably partial) index of links to useful code. Some of the links are to code in tutorials. The others are links to test code. For the latter, note that since tests are written primarily for checking functionality, they are not commented to the same degree as user tutorials. Nevertheless, they should be reasonably readable and useful.

Note that this page is generated automatically based on tags in the Chaste code. Do not edit it manually, as your changes will be overwritten!

## Cardiac

### Cell Models

- Get a cardiac cell model to (roughly) a steady state, given a regular stimulus, using the
`SteadyStateRunner`

class.

### Electro-mechanics

- Set heterogeneous contraction models by using a contraction cell factory.
- Run electro-mechanics with mechano-electric feedback
- Run electro-mechanics with inflation pressures
- Run electro-mechanical simulations using bidomain instead of monodomain
- Run basic electro-mechanics simulations; specify different models, boundary conditions, fibres
- Visualise results in Cmgui (very brief description)

### Output

- Specify output formats (for different visualisers)
- Collect and print timings to benchmark different parts of the cardiac code.
- Only output data for particular nodes
- Output data using a light-weight output modifier. This can be used in addition to regular HDF5 output or can replace it.
- Output all cell model state variables for the cell model used in a particular simulation
- Use the
`SingleTraceOutputModifier`

to output based on a global index (index AFTER any permutation has been applied) - Calculating and outputting ionic currents (‘derived quantities’) in a single cell simulation using OdeSolution - see also chaste_codegen documentation.
- Calculating and outputting ionic currents (‘derived quantities’) in a tissue simulation using HeartConfig - see also chaste_codegen documentation.
- On large-scale parallel simulations it is advantageous to cache HDF5 output and only write to disk at end of simulation (or at checkpoint). This is achieved with
`SetUseHdf5DataWriterCache()`

### Post-processing

- Compute action potential properties (APD50, APD90, max upstroke velocities, etc) given voltage traces.
- Convert already generated simulation (HDF5) results to text, VTK or Meshalyzer format.
- Convert already generated simulation (HDF5) results to Cmgui format.
- Compute pseudo-ECGs

### Problem definition

- Use a CVODE adaptor solver in a tissue simulation
- Use a native CVODE cell in a tissue simulation
- Specify fibre directions
- Fix phi_e at particular nodes (note: this is not required)
- Set discrete
**ellipsoid**areas to have heterogeneous (intra- and/or extra-cellular) conductivity tensors. - Run bidomain simulations with a perfusing bath, and apply shocks using electrodes
- Tell Chaste that a mesh has been modified
- Save (‘checkpoint’) and reload simulations
- Do a monodomain simulation with equivalent conductivities to a bidomain simulation.
- Set discrete
**cuboid**areas to have heterogeneous (intra- and/or extra-cellular) conductivity tensors. - Generate a slab (cuboid) mesh rather than read a mesh in, and pass it to solver
- Read in a mesh from file, via
`HeartConfig`

. - Use a genuinely Neumann intracellular stimulus, rather than default volume stimulus
- Set up and run basic bidomain simulations
- Use different cell models, defined using CellML files
- Generate fibre field definitions for cardiac geometries using a mathematical rule approach

### Solver

- Using specialised Backward Euler implementation to solve the cell models (allows for much larger timesteps)
- Use state-variable interpolation to improve accuracy
- Run using (simple, user-defined) time-adaptivity
- Run using operator-splitting

## Cell Based

### Simulation

- Time various aspects of a cell-based simulation using
`CellBasedEventHandler`

. - Save and load (‘checkpoint’) a cell-based simulation to file.

## Continuum mechanics

- Write strain after solve
- Get or output stresses during a solve
- Solve nonlinear elasticity problems
- Visualise nonlinear elasticity problems solutions, including visualisng strains
- Specify more complicated boundary conditions in elasticity problems
- Solve Stokes’ flow problems (this functionality is work-in-progress).

### Ventilation

- Solve a simple ventilation problem with no time variation.
- Solve a simple ventilation problem defined in a file.
- Solve a simple ventilation problem with no time variation.
- Solve a simple ventilation problem defined in a file.

## General

- Read and use parameters from the command line
- Use mock (pretend) command line arguments

### Archiving

- Use a binary rather than ascii boost archive format, for speed and smaller file sizes.

## Lung

### Anatomy definition

- Generate a complete conducting airway model given segmentations of CT airways and lobes.

### Simulation

- Simulate ventilation on a full lung geometry with acinar dynamics over a breathing cycle.
- Calculate transfer impedance of an airway tree using a simple impedance model
- Calculate ventilation distribution in an airway tree for a given flow rate at the trachea

## Mesh

- Construct a distributed regular mesh (rectangle in 2D or cuboid in 3D) which does not have a default split plane. The default is for parallel code to split 2-D meshes into slices in the y-dimension and 3-D meshes in the z-dimension.
- Write meshes to file
- Convert a linear tetrahedral mesh to quadratic and write back to file.
- Apply transformations to meshes

## PDE

- Evaluate integrals (using a solution from a PDE solve say) over a finite element mesh
- Write a solver for coupled nonlinear PDEs (advanced)
- Define and solve a particular type of coupled ODE/PDE system
- Define and solve linear elliptic or parabolic PDEs
- Output results to file for time-dependent PDE solvers
- Define and solve nonlinear elliptic PDEs
- Write new PDE solvers (especially for linear coupled elliptic/parabolic systems)

## Creating new how-tos

Any C-style block comment found in a test file that looks like the following will be given an entry in the index:

- HOW_TO_TAG Section/Subsection
- Short description (ideally one-liner)

The short description may run over multiple lines; it will be considered to end either at the end of the comment, or at a blank comment line, whichever comes first.
This index is automatically updated by a GitHub Actions workflow triggered by any new commit pushed to the `develop`

branch.