Example b211k: Explicit LR2 over a 2d square.

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


The comfile run by this example is as follows:

# Example b211k - Explicitly solve the LR2 model over a square sheet 
# of tissue, using the Adams integrator.

# 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;
}

#Set up problem size
fem define para;r;$example/test;

#Define geometry of the problem
#  Define underlying geometry
fem define base;r;$example/test;
fem define mesh;r;$example/test;
#  Define grid geometry
fem define grid;r;$example/test;
fem update grid geometry;
fem update grid metric;
#  Some useful groups
fem group grid external as boundary;
fem group grid grid 1889,2353,1881,1888,1946 as stimulus_site;

#Define equation to solve
#  Define monodomain with LR2 kinetics
fem define equa;r;$example/test;

#Define material properties for the problem

#  Define cellular material properties
fem define cell;r;$example/lr;
#  Define cell variants and spatially varying material parameters
if ($TESTING) {
    # When testing we don't won't to apply a stimulus as we start from a
    # solution that is already stimuluated
    fem define mate;r;$example/test_noStim cell;
} else {
    fem define mate;r;$example/test cell;
}
#  Define the continuum material parameters
fem define mate;r;$example/test;
fem update grid material;

#Define continuum initial conditions
#  Set no-flux boundary condition
fem define init;r;$example/test;

#Define the explicit solve, using the adams integrator
fem def solv;r;$example/test;


# The geometry could be exported to CMGUI via these commands
fem export node;test as sheet;
fem export elem;test as sheet;

#Solve the problem

#  Initialise the solve
fem solve to 0;

#  Open a binary history file to store the membrane potential (YQ(1))
fem open history;test write variables yq niqlist 1 binary unit 21;

# For testing, we simply read in a previous solution and solve one time 
# step.
if ($TESTING) {
    set echo;
    fem read matrix;$example/test binary;
    fem solve restart to 1;
    fem write history time 10 variables yq binary unit 21;
    fem export elem;test_1010 field as sheet;
} else {
    # Loop through time
    for $HUN ( 0..0 ) {
        for $TEN ( 0..1 ) {
            for $UNIT ( 0..9 ) {
                # Solve for the current time
                fem solve restart to "${HUN}${TEN}$UNIT";
                # Write the membrane potential to the history file
                fem write history time "${HUN}${TEN}$UNIT" variables yq binary unit 21;
                #  Export the field to CMGUI
                fem export elem;test_1${HUN}${TEN}$UNIT field as sheet;
            }
        }
    }
}

#  Close the history file
fem close history binary unit 21;

if (!$TESTING) {
    # Calculate the binary signal file from the history file
    fem evaluate electrode;test history test from grid binary;
    
    # Define UnEmap export properties
    fem define export;r;$example/test;

    # Export the binary signal file to UnEmap
    fem export signal;test electrode signal test;
}


Files used by this example are:

Name                Modified     Size

example_b211k.com 23-Jan-2003 3.0k lr.ipcell 23-Jan-2003 4.5k test.binmat 23-Jan-2003 990k test.ipbase 10-Apr-2000 1.1k test.ipcell 10-Apr-2000 13k test.ipequa 26-May-2003 1.4k test.ipexpo 10-Apr-2000 661 test.ipgrid 06-Mar-2003 538 test.ipinit 10-Apr-2000 213 test.ipmatc 30-Jan-2003 727 test.ipmate 10-Apr-2000 3.2k test.ipmesh 10-Apr-2000 765 test.ippara 12-Nov-2002 5.9k test.ipsolv 23-Jan-2003 1.3k test.ipsolv.old 10-Apr-2000 1.3k test_noStim.ipmatc 30-Jan-2003 724

Download the entire example:

Name                                 Modified     Size

examples_b_b2_b21_b211_b211k.tar.gz 19-Aug-2006 247k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmSuccessSun Mar 6 00:12:35 201615
cm-debugFailureSun Mar 6 00:06:57 20160
last breakFri Apr 15 00:17:00 20110
last successThu Apr 7 01:16:00 201163
mips-irix
cmSuccessSun Aug 19 03:13:07 2007102
cm-debugSuccessWed Aug 15 04:01:25 2007369
cm-debug-clear-mallocSuccessSat Aug 18 05:20:02 2007433
cm-debug-clear-malloc7SuccessMon Aug 20 04:44:11 2007396
cm64SuccessSun Aug 19 03:14:53 2007104
cm64-debugSuccessTue Aug 21 03:21:13 2007404
cm64-debug-clear-mallocSuccessThu Apr 1 11:16:44 2004170
rs6000-aix
cmSuccessWed Mar 4 01:15:47 200913
cm-debugSuccessMon Mar 2 01:28:48 2009123
cm64SuccessWed Mar 4 01:16:21 200913
cm64-debugSuccessTue Mar 3 01:38:00 2009125
x86_64-linux
cmSuccessSun Mar 6 00:01:47 20169
cm-debugSuccessSat Mar 5 00:04:24 201624

Testing status by file:


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

Input last modified: Mon May 26 18:09:59 2003


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