Example cellml/simple_purkinjes: Single element cube using CellML with two cell types.

This example models a singles element cube with two different cell types, each with their own CellML model. Diagonally through the cube are lines of Hodkin-Huxley type cells (Purkinje-like cells) and the remainder of the tissue is modelled using the Noble 98 ventricular cell model. The image below shows the simulation results at 50 ms, with an iso-surface in the potential field drawn at Vm = 0 mV. You can imagine the Hodgkin-Huxley cells running through the middle each of the red arms of the iso-surface.

The Hodgkin-Huxley "Purkinje fibres" are stimulated with a 0.5 ms pulse at time 0 ms and the activation wave propagates out through the tissue.


The comfile run by this example is as follows:

# Example b211c - like b211c but we arbitrarily break the cube into 
# different regions of different cell types (all modelled with N98)

# Set-up some useful variables
$output = ".";
$format = "binary";
# If the example path is not set, default to current directory
if (! defined $example) {
    $example = "./";
}
# Drop off the trailing / in the example path
$chopped = chop $example;
if ($chopped ne "/") {
    $example .= $chopped;
}

# The purkinje fibre grid points
$purkinje = "92,98,146,152,183,187,219,223,274,276,292,294,365,436,438,454,456,507,511,543,547,578,584,632,638";
# and the cardiac cells
$cardiac = "1..91,93..97,99..145,147..151,153..182,184..186,188..218,220..222,224..273,275,277..291,293,295..364,366..435,437,439..453,455,457..506,508..510,512..542,544..546,548..577,579..583,585..631,633..637,639..729";

# Define the problem size
fem define parameters;r;$example/minimal;

# Define the geometry - need a tri-cubic Hermite basis for the geometry
# and a tri-linear for the fibres and grid-based FEM
fem define coordinate;r;$example/emech;
fem define node;r;$example/emech-1x1x1-cubic;
fem define base;r;$example/emech-cubic-linear;
fem define element;r;$example/emech-1x1x1-cubic;

# Need to calculate the nodal derivatives since they are not in the
# ip files
fem update node derivative 1 linear;
fem update node derivative 2 linear;
fem update node derivative 3 linear;

fem group element 1 as ALL_ELEMENTS;

# Define 0 degree fibre orientation
fem define fibre;r;$example/emech-0deg;
fem define element;r;$example/emech-1x1x1-linear fibre;

# Define one grid scheme which is 9x9x9 grid points
fem define grid;r;$example/cell-9x9x9;
fem update grid geometry;
fem update grid metric;
fem group grid external as boundary;
# Set the purkinje fibres
fem group grid grid $purkinje as purkinje;
fem group grid grid $cardiac as cardiac;

# Define the model to use - CellML
fem define equation;r;$example/n98;

# Define the cellular material parameters
fem define cell;r;$example/n98_hh;
fem define material;r;$example/n98_hh cell;

# Define the continuum material parameters - using a 2:1 conductivity 
# ratio (fibre:(sheet/normal))
fem define material;r;$example/n98;
fem update grid material;

# Define the default no-flux boundary condition
fem define initial;r;$example/n98;

# Define the integrator - implicit Adams
fem define solve;r;$example/implicit_grid_based_fem;

# Export the geometry
fem export node;$output/3dcube as cube;
fem export element;$output/3dcube as cube;
fem export element;$output/grid_numbers as cube grid_numbers;

# Export the cellular material fields
fem export fieldml;$output/cell_fields cellml;

# Grab the membrane potential index
fem inquire cell_variable V return_variables VM_ARRAY,VM_IDX;

# Create a history file to hold the membrane potential at all grid
# points through time
fem open history;$output/cube write variables $VM_ARRAY niqslist $VM_IDX $format;

# Initialise the solve
fem solve to 0;

# The time loop
for $time ( 0..5 ) {
    # Solve the model
    fem solve restart to $time;
    # Write the solution to the history file
    fem write history time $time variables $VM_ARRAY $format;
    # Export the potential field for use in CMGUI
    fem export element;$output/potential_$time field as cube;
    # also export FieldML - more for testing than anything useful yet
    fem export fieldml;$output/cells_$time cellml;
}

# Close the history file
fem close history $format;

# Create a CMISS signal file from the history file
fem evaluate electrode;$output/Vm history $output/cube from grid $VM_ARRAY iy $VM_IDX $format;

# Export the membrane potential at all grid points to a UnEMAP signal
# file
fem define export;r;$example/cube;
fem export signal;$output/Vm electrode signal $output/Vm;

# For testing we compare the generated CMISS signal files
if ($TESTING) {
    fem compare signal;Vm basis both masterfile $example/Vm comparefile Vm $format;
}

Files used by this example are:

Name                            Modified     Size

simple_purkinjes.com 10-Apr-2003 3.8k Vm.binsig 10-Apr-2003 51k cell-9x9x9.ipgrid 12-Sep-2003 610 cube.ipexpo 10-Apr-2003 660 emech-0deg.ipfibr 10-Apr-2003 6.9k emech-1x1x1-cubic.ipelem 10-Apr-2003 573 emech-1x1x1-cubic.ipnode 10-Apr-2003 15k emech-1x1x1-linear.ipelfb 10-Apr-2003 377 emech-cubic-linear.ipbase 10-Apr-2003 7.4k emech.ipcoor 10-Apr-2003 570 hh.cml 09-Jun-2003 37k implicit_grid_based_fem.ipsolv 15-Apr-2007 2.2k minimal.ippara 10-Apr-2003 5.9k n98.cml 09-Jun-2003 204k n98.ipequa 26-May-2003 1.5k n98.ipinit 10-Apr-2003 237 n98.ipmate 10-Apr-2003 1.8k n98_collocation.ipequa 26-May-2003 1.5k n98_hh.ipcell 11-Jun-2003 26k n98_hh.ipmatc 26-Nov-2004 732

Download the entire example:

Name                                     Modified     Size

examples_cellml_simple_purkinjes.tar.gz 16-Apr-2007 170k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmSuccessSun Mar 6 00:07:25 20169
cm-debugSuccessSat Mar 5 00:31:48 201620
mips-irix
cmSuccessSun Aug 19 03:01:11 200789
cm-debugSuccessWed Aug 15 03:08:01 2007256
cm-debug-clear-mallocSuccessSat Aug 18 03:28:08 2007271
cm-debug-clear-malloc7SuccessMon Aug 20 03:23:00 2007267
cm64SuccessSun Aug 19 03:07:02 2007101
cm64-debugSuccessTue Aug 21 04:09:11 2007274
cm64-debug-clear-mallocSuccessThu Apr 1 11:54:28 2004259
rs6000-aix
cmSuccessWed Mar 4 01:14:54 200911
cm-debugSuccessMon Mar 2 01:23:16 200956
cm64SuccessWed Mar 4 01:14:58 200911
cm64-debugSuccessTue Mar 3 01:26:39 200956
x86_64-linux
cmSuccessSun Mar 6 00:01:20 20165
cm-debugSuccessSat Mar 5 00:03:42 201612

Testing status by file:


Html last generated: Sun Mar 6 05:51:21 2016

Input last modified: Sun Apr 15 11:59:50 2007


CMISS Help / Examples / cellml / simple_purkinjes