Example b2123: 2d heart-torso coupled bidomain

Example b2123 - coupled bidomain - torso This example solves the bidomain equation through to a point where an activation wave is well established and then iterates between the extracellular and the boundary element problem to get the epicardial fluxes to match. The heart is a FE mesh. The torso consists of a BE mesh for the body surface and also a BE mesh around the epicardium.


The comfile run by this example is as follows:

# Example b2123 - coupled bidomain - torso

# Assign region and class variables
# =================================


# Command updated by fixcom.sh on Wed Aug 23 17:50:04 NZT 2000
# Old command: assign variable BEM 1 # Region 1 is a boundary element mesh
$BEM = 1 # Region 1 is a boundary element mesh


# Command updated by fixcom.sh on Wed Aug 23 17:50:04 NZT 2000
# Old command: assign variable GRID 2 # Region 2 is grid points over a FEM mesh
$GRID = 2 # Region 2 is grid points over a FEM mesh


# Command updated by fixcom.sh on Wed Aug 23 17:50:04 NZT 2000
# Old command: assign variable LAPLACE 1 # Class 1 is the generalised Laplace equation
$LAPLACE = 1 # Class 1 is the generalised Laplace equation


# Command updated by fixcom.sh on Wed Aug 23 17:50:04 NZT 2000
# Old command: assign variable TMEMBRANE 2 # Class 2 is the transmembrane potential
$TMEMBRANE = 2 # Class 2 is the transmembrane potential


# Command updated by fixcom.sh on Wed Aug 23 17:50:04 NZT 2000
# Old command: assign variable EXTCELLR 3 # Class 3 is the extracellular potential
$EXTCELLR = 3 # Class 3 is the extracellular potential


# Command updated by fixcom.sh on Wed Aug 23 17:50:04 NZT 2000
# Old command: assign variable EXTUPDATE 4 # Class 4 is used for the extracellular matrix with
$EXTUPDATE = 4 # Class 4 is used for the extracellular matrix with

                    # flux boundary conditions.

# Define the problem
# ==================

# Read in parameters and reallocate arrays
fem define para;r;2dheart;example


# Define 2 regions
fem define regi;r;2dheart;example

# Define a 2d cubic-linear and a 1d cubic basis 
fem define base;r;2dheart;example

# Define the problem geometry
fem define node;r;ref;example reg all
fem define elem;r;ref;example reg all

# Generate a grid scheme over the FE mesh
fem define grid;r;2dheart;example reg $GRID

# Use default fibre angles
fem define fibr;d reg $GRID
fem define elem;r;ref;example fibre reg $GRID

# Compute global grid point coordinates and generate metric tensors
fem update grid geom reg $GRID
fem update grid metric reg $GRID
fem group grid external as boundary reg 2

# Define the generalised Laplace equation
fem define equa;r;torsoslice;example reg $BEM class $LAPLACE lock

# Define the grid equations (Fitzhugh-Nagumo ionic current model)
fem define equa;r;fhn2;example reg $GRID class $TMEMBRANE,$EXTCELLR,$EXTUPDATE lock

# Define the material properties of the 2 meshes
fem define mate;r;torsoslice;example reg $BEM class $LAPLACE
fem define mate;r;fhn;example reg $GRID class $TMEMBRANE,$EXTCELLR
fem define cell;r;fhn;example reg $GRID class $TMEMBRANE,$EXTCELLR

# Update the grid material according to the fibre angles
fem update grid mate reg $GRID class $TMEMBRANE,$EXTCELLR

# Define potentials on the heart, no flux on torso
fem define init;r;torsoslice;example reg $BEM class $LAPLACE

# Define initial activation from the middle of the septum
fem define init;r;2dheart;example reg $GRID class $TMEMBRANE,$EXTCELLR

# Define the solution procedure for the 2 problems
fem define solv;r;torsoslice;example reg $BEM class $LAPLACE
fem define solv;r;2dheart;example reg $GRID class $TMEMBRANE
fem define solv;r;2dheart2;example reg $GRID class $EXTCELLR
fem define solv;r;2dheart3;example reg $GRID class $EXTUPDATE

# Solve the problem
# =================

# Solve the bidomain problem for 10ms (1000 iterations)
fem solve to 10 reg $GRID class $TMEMBRANE,$EXTCELLR,$EXTUPDATE

# Update the potential and the arc length derivative of potential
# at the nodes on the heart from the extracellular solution 
fem update node potential reg $BEM,$GRID

# Solve the generalised Laplace equation
fem solve reg $BEM class $LAPLACE

# Check the boundary fluxes to see of they match
fem update node potential reg $BEM,$GRID check

# Loop to converge boundary fluxes
# ================================


# Command updated by fixcom.sh on Wed Aug 23 17:50:04 NZT 2000
# Old command: DO A=1..4
for $A ( 1..4 ) 
{

# Using the the flux and derivative values from the BE problem
# interpolate to find a flux value at each epicardial grid point.
# Solve the extracellular update equation using these flux values.
fem solve iterate 1 reg $GRID,$BEM class $TMEMBRANE,$EXTCELLR,$EXTUPDATE,$LAPLACE

# Update the potential and the arc length derivative of potential
# at the nodes on the heart from the new extracellular solution
fem update node potential reg $BEM,$GRID

# Resolve the generalised Laplace problem
fem solve reg $BEM class $LAPLACE

# Check to see what the difference in the bounday fluxes are
fem update node potential reg $BEM,$GRID check

# Command updated by fixcom.sh on Wed Aug 23 17:50:04 NZT 2000
# Old command: ENDDO
}



# Draw the results to the screen
# ==============================

# Open a 2d graphics window
fem define window;c

# Draw the extracellular potential field over the grid point mesh
fem dr field grid 1 zmin=-21 zmax=9 noscale reg $GRID class $EXTCELLR

# Draw the resultant potential field on the body surface
fem dr field zmin=-21 zmax=9 noscale reg $BEM class $LAPLACE elem 16..27

# Draw white lines to show the FE heart mesh
fem dr lines reg 2 rgb=white







Files used by this example are:

Name                        Modified     Size

example_b2123.com 20-Nov-2001 5.0k 2dheart.ipbase 10-Apr-2000 2.5k 2dheart.ipgrid 06-Mar-2003 4.4k 2dheart.ipinit 10-Apr-2000 1.8k 2dheart.ippara 12-Nov-2002 5.9k 2dheart.ipregi 10-Apr-2000 93 2dheart.ipsolv 13-Apr-2007 1.8k 2dheart.ipsolv.old 10-Apr-2000 1.5k 2dheart2.ipsolv 13-Apr-2007 1.8k 2dheart2.ipsolv.old 10-Apr-2000 1.5k 2dheart3.ipsolv 13-Apr-2007 1.8k 2dheart3.ipsolv.old 10-Apr-2000 1.5k fhn.ipcell 10-Apr-2000 3.4k fhn.ipmate 10-Apr-2000 1.7k fhn.ipmate_cell_old 10-Apr-2000 5.2k fhn2.ipequa 26-May-2003 4.5k output.com 10-Apr-2000 107 ref.ipelfb 10-Apr-2000 5.6k ref.irelem 10-Apr-2000 18k ref.irnode 10-Apr-2000 29k ref_old.irelem 10-Apr-2000 18k torsoslice.ipcell 10-Apr-2000 633 torsoslice.ipequa 26-May-2003 6.4k torsoslice.ipinit 10-Apr-2000 6.0k torsoslice.ipmate 10-Apr-2000 633 torsoslice.ipmate_cell_old 10-Apr-2000 633 torsoslice.ipsolv 13-Apr-2007 1.5k

Download the entire example:

Name                                 Modified     Size

examples_b_b2_b21_b212_b2123.tar.gz 14-Apr-2007 22k

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

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


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