Example b211l: Implicit LR2 over a 2d square.

Implicitly solve the LR2 model over a square sheet of tissue, using the Adams integrator. If the geometry and fields are exported, they can be viewed using the cmiss_input/cmiss_input/movie.com command file. The signal file can be viewed using UnEMAP.


The comfile run by this example is as follows:

# Example b211k - Implicitly solve the LR2 model over a square sheet 
# of tissue, using the Adams integrator. If the geometry and fields
# are exported, they can be viewed using the draw.com command file. The
# signal file can be viewed using UnEMAP.

# 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 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 implicit solve, using the adams integrator
fem def solve;r;$example/test;

#The geometry can be exported to CMGUI via these commands
#fem export node;test as sheet              !Export node geometry
#fem export elem;test as sheet              !Export element geometry

#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;
                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_b211l.com 23-Jan-2003 3.2k draw.com 20-Nov-2001 2.2k lr.ipcell 23-Jan-2003 4.5k movie.com 10-Apr-2000 441 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 13-Apr-2007 2.2k test.ipsolv.old 10-Apr-2000 1.8k test_noStim.ipmatc 30-Jan-2003 724

Download the entire example:

Name                                 Modified     Size

examples_b_b2_b21_b211_b211l.tar.gz 14-Apr-2007 270k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmSuccessSun Mar 6 00:08:00 201610
cm-debugFailureSun Mar 6 00:06:57 20160
last breakFri Apr 15 00:17:00 20110
last successThu Apr 7 00:58:00 201138
mips-irix
cmSuccessSun Aug 19 02:35:00 200763
cm-debugSuccessWed Aug 15 02:55:02 2007238
cm-debug-clear-mallocSuccessSat Aug 18 03:17:14 2007251
cm-debug-clear-malloc7SuccessMon Aug 20 03:17:52 2007254
cm64SuccessSun Aug 19 02:36:54 200764
cm64-debugSuccessTue Aug 21 03:30:55 2007249
cm64-debug-clear-mallocSuccessThu Apr 1 11:16:20 2004107
rs6000-aix
cmSuccessWed Mar 4 01:13:13 20098
cm-debugSuccessMon Mar 2 01:28:25 200972
cm64SuccessWed Mar 4 01:13:16 20098
cm64-debugSuccessTue Mar 3 01:29:39 200971
x86_64-linux
cmSuccessSun Mar 6 00:01:23 20166
cm-debugSuccessSat Mar 5 00:03:57 201614

Testing status by file:


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

Input last modified: Fri Apr 13 10:38:04 2007


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