Example b2118: Explicit Luo-Rudy 2 model

This example solves the monodomain equation using the Luo Rudy phase 2 model on a 2d strip of elements.


The comfile run by this example is as follows:


#Example b2118 - Explicit 2d Luo-Rudy over a 2d strip of elements

# Assign some useful variables
# The file format

$FORMAT = "binary"

# The signals to export ???

$VARIABLES = 1

# The finish time of the integration

$TEND = 10

# The grid points to be stimulated

$STIMULUS_SITE = "xi1=low oneoff element 1"

# The name of the output files

$OUTPUT_FILE = "lr"

# Define the model size
fem define parameter;r;biline;example

# Define the model geometry and grid scheme
fem define node;r;biline;example
fem define base;r;biline;example
fem define elem;r;biline;example
fem define grid;r;biline;example
fem update grid geometry
fem update grid metric

# Define some grid groups
fem group grid external as boundary
#fem group grid grid 2,11,20,29,38,47,56,65,74 as stimulus_site
{
  my $command = "fem group grid $STIMULUS_SITE as stimulus_site";
  cmiss $command or die "Error in cmiss command \"$command\".\n";
}

# Define the model - Monodomain, Luo-Rudy
fem define equa;r;biline;example

# Define the cellular material parameters
fem define cell;r;lr_double_pulse;example

# Define the spatially varying cellular parameters
fem def mate;r;biline;example cell

# Define the continuum material parameters
fem define mate;r;biline;example
fem update grid material

# Define the initial conditions - zero flux on the boundary
fem define init;r;biline;example

# Use the adaptive Adams solver, fully explicit
fem define solv;r;biline;example

# Initialise the solve
fem solve to 0

# Create a history file to store the required variables at all 
# grid points
fem open history;$OUTPUT_FILE write variables yq niqlist $VARIABLES $FORMAT

# Export the geometry
fem export node;$OUTPUT_FILE as biline
fem export element;$OUTPUT_FILE as biline
fem export element;numbers as biline grid_numbers

# Export the cellular material parameters
fem export element;parameters as biline field cell

# Integrate the model

for $TIME ( 0..$TEND ) 
{
  # Display the current time
  print " TIME = ".sprintf("%7.1f",${TIME})." ms\n"

  # Solve the model for the current time
  fem solve restart to $TIME

  # Write the new variable values to the history file
  fem write history time $TIME variables yq $FORMAT

  # Export the solution field
  fem export element;${OUTPUT_FILE}."_1".sprintf("%05d",$TIME) field as biline
}

# Close the history file
fem close history $FORMAT

# Export the UnEMAP signal file
fem evaluate electrode;$OUTPUT_FILE history $OUTPUT_FILE from grid yq iy $VARIABLES $FORMAT
fem define export;r;biline;example
fem export signal;$OUTPUT_FILE electrode signal $OUTPUT_FILE

Files used by this example are:

Name                    Modified     Size

example_b2118.com 18-Dec-2002 2.5k biline.ipbase 10-Apr-2000 1.1k biline.ipcell 10-Apr-2000 2.0k biline.ipelem 10-Apr-2000 2.6k biline.ipequa 26-May-2003 2.3k biline.ipexpo 20-Nov-2001 659 biline.ipgrid 06-Mar-2003 1.3k biline.ipinit 10-Apr-2000 212 biline.ipmatc 29-Jan-2003 1.0k biline.ipmate 10-Apr-2000 1.7k biline.ipnode 10-Apr-2000 2.8k biline.ippara 12-Nov-2002 5.9k biline.ipsolv 03-Oct-2001 1.3k display.com 20-Nov-2001 1.9k lr_double_pulse.ipcell 20-Nov-2001 4.5k movie.com 20-Nov-2001 88

Download the entire example:

Name                                 Modified     Size

examples_b_b2_b21_b211_b2118.tar.gz 19-Aug-2006 32k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmSuccessSun Mar 6 00:04:54 20167
cm-debugSuccessSat Mar 5 00:25:13 201615
mips-irix
cmSuccessSun Aug 19 02:09:59 200741
cm-debugSuccessWed Aug 15 02:30:57 2007142
cm-debug-clear-mallocSuccessSat Aug 18 02:48:29 2007152
cm-debug-clear-malloc7SuccessMon Aug 20 02:48:02 2007145
cm64SuccessSun Aug 19 02:11:32 200741
cm64-debugSuccessTue Aug 21 02:36:29 2007155
cm64-debug-clear-mallocSuccessThu Apr 1 11:12:05 200466
rs6000-aix
cmSuccessWed Mar 4 01:12:04 20095
cm-debugSuccessMon Mar 2 01:19:21 200949
cm64SuccessWed Mar 4 01:11:30 20096
cm64-debugSuccessTue Mar 3 01:28:13 200954
x86_64-linux
cmSuccessSun Mar 6 00:01:17 20164
cm-debugSuccessSat Mar 5 00:02:32 201610

Testing status by file:


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

Input last modified: Mon Feb 14 11:12:45 2005


CMISS Help / Examples / b / b2 / b21 / b211 / b2118