Example b212c: 2D bidomain rectangle with fibrillation and defibrillation using BR model

This example uses the defibrillation Beeler Reuter model to solve for transmembrane potential in a 14mm by 5mm 2D rectangle .It uses 4 elements each with 40*29 gridpoints. 3 seperate stimulii are applied. Initital stimulus at 1ms to model activation. Primary stimulus from 60ms - 61ms to model fibrillation and a secondary stimulus from 86ms - 95ms to model defibrillation. The resulting action potential for node 600 can be viewed using UNEMAP.

(i) (ii) (iii)

The comfile run by this example is as follows:

# Solving the Beeler-Reuter (Defib) equations in a 5mm by 14mm rectangle.
# This example simulates fibrillation with a spiral waveform, initiated
# at 60ms with a stimulus to the lower left corner of the rectangle.
# Defibrillation is simulated with a monophasic extracellular stimulus
# applied after 86ms.

# Set up for bidomain.

# Define parameter set
fem def para;r;spiral;example

# Define geometry
fem def base;r;spiral;example
fem def node;r;spiral;example
fem def elem;r;spiral;example

# Define fibres
fem def fibr;r;spiral;example
fem def elem;r;spiral;example fibre

# Define grid and useful grid groups.
fem def grid;r;spiral;example
fem update grid geometry
fem update grid metric
fem group grid external as boundary
fem group grid xi1 low as leftbound

# Define Secondary stimulus areas (Defibrillation)
fem group grid xi1 low oneoff as plane1

# Define Primary  stimulus areas  (Fibrillation)
fem group grid grid 3..30,43..70,83..110,123..150,163..190,203..230,243..270,283..310,323..350,363..390,403..430 as p1
fem group grid grid 443..470,483..510,523..550,563..590,603..630,643..670,683..710,723..750,763..790,803..830 as p2
fem group grid grid 843..870,883..910,923..950,963..990,1003..1030,1043..1070,1083..1110, 1123..1150,1163..1190 as p3
fem group grid grid 1203..1230,1243..1270,1283..1310,1323..1350,1363..1390,1403..1430,1443..1470,1483..1510 as p4
fem group grid grid 1523..1550,1563..1590,1603..1630,1643..1670,1683..1710,1723..1750,1763..1790,1803..1830 as p5

#Define Boundaries
fem group grid xi2 low as x1boundary1
fem group grid xi2 high as x1boundary2
fem group grid xi1 low as x2boundary1
fem group grid xi1 high as x2boundary2

# Define bidomain equations and material properties.
fem def equa;r;spiral;example class $VM,$PHI_E
fem def mate;r;spiral;example class $VM,$PHI_E
fem def cell;r;spiral;example class $VM,$PHI_E

#Update grid with material properties
fem update grid material class $VM,$PHI_E

# Define time for extracellular potential and initial conditions.
# Note that for testing purposes the initial stimulus
# times have changed from 60ms -> 2ms, 86ms -> 4ms
# so as to reduce the solution time. 
fem def time;r;spiral;example class $VM,$PHI_E
fem def init;r;spiral;example class $VM,$PHI_E

# Define Solving Parameters
fem def solve;r;spiral;example class $VM
fem def solve;r;spiral;example class $PHI_E

# Define window and solve to 0.
fem define window;c
fem solve to 0 class $VM,$PHI_E
fem draw field grid 1 zmin=-110 zmax=80 noscale class $VM

# Open a binary history file to store the membrane potential
fem open history;spiral write variables yq niqlist 1 class $VM

# Loop through time
# Again, for tesing purposes this
# only runs for the first 5ms.
for $J ( 0..0 ) 
 for $N ( 0..0 ) 
  for $M ( 0,1,2,3,4,5 ) 

   #Solve for new time
   fem solve restart to "${J}${N}$M" class $VM,$PHI_E

   #Draw solution to graphics window
   fem draw field grid 1 zmin=-110 zmax=60 class $VM
   refresh graphics

   #Write solution to file
   fem write history time "${J}${N}$M" variables yq class $VM
   #Print graphics window to frame - for movie viewing (Optional)
   #cmiss("fem gxprint;frame_${J}${N}$M portable width 480 height 480")


#Close history and calculate binary file
fem close history class $VM
fem eval elec;spiral history spiral from grid yq

#export signal files - For Unemap viewing
#electrodes 561-600 >> half way through the first element
fem conv signal infile spiral outfile spiral
fem def expo;r;spiral_sig;example
fem expo signal;spiral_60 elec signal spiral

#export data file - For PostScript viewing
fem def expo;r;spiral_dat;example
#electrode 600 >> RHS - half way through the first element
fem expo signal;spiral_60_node600 elec signal spiral

Files used by this example are:

Name               Modified     Size

example_b212c.com 13-Dec-2002 3.7k spiral.ipbase 13-Dec-2000 1.1k spiral.ipcell 13-Dec-2000 2.0k spiral.ipelem 13-Dec-2000 1.1k spiral.ipelfb 13-Dec-2000 640 spiral.ipequa 26-May-2003 1.6k spiral.ipfibr 30-Jan-2001 1.1k spiral.ipgrid 06-Mar-2003 793 spiral.ipinit 01-Jun-2001 2.4k spiral.ipmate 13-Dec-2000 1.8k spiral.ipnode 13-Dec-2000 1.5k spiral.ippara 12-Nov-2002 5.9k spiral.ipsolv 13-Apr-2007 1.8k spiral.ipsolv.old 14-Dec-2000 1.4k spiral.iptime 30-Jul-2001 758 spiral_dat.ipexpo 13-Dec-2000 408 spiral_sig.ipexpo 13-Dec-2000 664

Download the entire example:

Name                                 Modified     Size

examples_b_b2_b21_b212_b212c.tar.gz 14-Apr-2007 290k

Testing status by version:

StatusTestedReal time (s)
cmSuccessSun Mar 6 00:05:08 20168
cm-debugSuccessSat Mar 5 00:24:14 201615
cmSuccessSun Aug 19 02:44:32 200771
cm-debugSuccessWed Aug 15 03:31:22 2007307
cm-debug-clear-mallocSuccessSat Aug 18 03:51:46 2007320
cm-debug-clear-malloc7SuccessMon Aug 20 03:57:47 2007317
cm64SuccessSun Aug 19 02:48:13 200773
cm64-debugSuccessTue Aug 21 04:22:27 2007290
cm64-debug-clear-mallocSuccessThu Apr 1 11:20:17 2004136
cmSuccessWed Mar 4 01:13:04 20097
cm-debugSuccessMon Mar 2 01:22:31 200952
cm64SuccessWed Mar 4 01:13:04 20097
cm64-debugSuccessTue Mar 3 01:25:42 200952
cmSuccessSun Mar 6 00:01:19 20164
cm-debugSuccessSat Mar 5 00:02:21 201610

Testing status by file:

Graphical output from this problem is given here.

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

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

CMISS Help / Examples / b / b2 / b21 / b212 / b212c