Example b2141: Torso and one ventricle fixed point iterations

This example demonstrates how to couple a single ventricle and a single torso region through a multiple surface fixed point iteration

The comfile run by this example is as follows:

#Example b2141
# This example demonstrates how to couple a single ventricle
#  and a single torso region through a multiple surface fixed
#  point iteration

# Problem classes

# Problem regions

# Iteration variables

# Define problem geometry
fem define para;r;torsoslice;example
fem define regi;r;torsoslice;example
fem define node;r;cavity3;example reg $CAVITY
fem define node;r;ventcl3;example reg $VENTCL
fem define node;r;bemhrt3;example reg $BEMHRT
fem define node;r;gridht;example  reg $GRIDHT
fem define base;r;linear;example
fem define elem;r;cavity3;example reg $CAVITY
fem define elem;r;ventcl3;example reg $VENTCL
fem define elem;r;bemhrt3;example reg $BEMHRT
fem define elem;r;gridht;example  reg $GRIDHT

# Define finite difference grid
fem define grid;r;gridht;example reg $GRIDHT
fem update grid geom reg $GRIDHT
fem update grid metric reg $GRIDHT
fem group grid xi2=0 as endocardium reg $GRIDHT
fem group grid xi2=1 as epicardium reg $GRIDHT
fem group grid external as boundary reg $GRIDHT
fem group grid line 1 xidirn 2 as stimulus reg $GRIDHT

# Create node to grid mapping
fem update node grid grid_reg $GRIDHT bem_reg $BEMHRT
fem update node geomet from grid reg $BEMHRT

# Define equations
fem define equa;r;cavity;example reg $CAVITY class $TLPL lock
fem define equa;r;ventcl;example reg $VENTCL class $BLPL lock
fem define equa;r;gridht;example reg $GRIDHT class $TMEM,$EXTC lock

# Define material parameters
fem define mate;r;cavity;example reg $CAVITY class $TLPL
fem define mate;r;ventcl;example reg $VENTCL class $BLPL
fem define mate;r;gridht;example reg $GRIDHT class $TMEM,$EXTC
fem define cell;r;gridht;example reg $GRIDHT class $TMEM,$EXTC
fem update grid material reg $GRIDHT class $TMEM,$EXTC

# Define initial conditions
fem define init;r;cavity;example reg $CAVITY class $TLPL
fem define init;r;ventcl;example reg $VENTCL class $BLPL
fem define init;r;gridht;example reg $GRIDHT class $TMEM,$EXTC

# Define grid to boundary element coupling
fem up elem region $GRIDHT,$VENTCL,$CAVITY class $EXTC,$BLPL,$TLPL grids boundary

# Define solution parameters
fem define solv;r;gridht;example reg $GRIDHT class $TMEM
fem define solv;r;gridht;example reg $GRIDHT class $EXTC
fem define solv;r;cavity;example reg $CAVITY class $TLPL
fem define solv;r;ventcl;example reg $VENTCL class $BLPL

# Solve the passive torso problems
fem solve reg $CAVITY class $TLPL
fem solve reg $VENTCL class $BLPL

# Solve the bidomain problem
fem solve activ coupled to 0 reg $GRIDHT,$CAVITY,$VENTCL class $TMEM,$EXTC,$TLPL,$BLPL

for $TEN ( 0..0 ) {
  for $UNIT (0..0) {
    for $DECI ( 0..9 ) {
      for $HUND ( 0..9 ) {

        # Solve a bidomain time step
        fem solve activ coupled transmembrane restart to "$TEN$UNIT".'.'."$DECI$HUND" reg $GRIDHT class $TMEM,$EXTC noupdate
        $NUM_ITERS = 0
        $FINISHED = 0

        # Find a converged solution
        while( !$FINISHED && $NUM_ITERS<=$MAX_ITERS ) {

          fem solve activ coupled extra rest reg $GRIDHT,$CAVITY,$VENTCL cl $TMEM,$EXTC,$TLPL,$BLPL noupdate static alpha $ALPHA1
          fem update init from grid region $CAVITY,$BEMHRT,$GRIDHT class $EXTC,$TLPL,$EXTC alpha $ALPHA2
          fem update init from grid region $VENTCL,$BEMHRT,$GRIDHT class $EXTC,$BLPL,$EXTC alpha $ALPHA2
          fem solve reg $CAVITY class $TLPL
          fem solve reg $VENTCL class $BLPL
          fem check conv grid_reg $BEMHRT grid_cl $EXTC bem_reg $CAVITY bem_cl $TLPL grid_update_cl $EXTC return POTE1 FLUX1
          fem check conv grid_reg $BEMHRT grid_cl $EXTC bem_reg $VENTCL bem_cl $BLPL grid_update_cl $EXTC return POTE2 FLUX2

          $FINISHED = (abs($POTE1)<=$POTE_TOL && abs($FLUX1)<=$FLUX_TOL && abs($POTE2)<=$POTE_TOL && abs($FLUX2)<=$FLUX_TOL)
          print("Iteration $NUM_ITERS\n");

        # Update the transmembrane potential field
        fem solve activ coupled trans rest reg $GRIDHT,$CAVITY,$VENTCL class $TMEM,$EXTC,$TLPL,$BLPL update static alpha $ALPHA1

        if($NUM_ITERS<$MAX_ITERS) {
          print("Solution converged in $NUM_ITERS iterations\n");
        else {
          print("Solution did not converge in $MAX_ITERS iterations\n");
          print("Outside potential $POTE1 Outside flux $FLUX1\n");

Additional testing commands:

#Testing example b2141
fem list node sol reg 1 cl 1
fem list node sol reg 2 cl 2

Files used by this example are:

Name               Modified     Size

example_b2141.com 06-Jun-2001 4.4k bemhrt3.ipelem 06-Jun-2001 32k bemhrt3.ipnode 06-Jun-2001 38k cavity.ipequa 26-May-2003 1.2k cavity.ipinit 06-Jun-2001 2.2k cavity.ipmate 06-Jun-2001 606 cavity.ipsolv 13-Apr-2007 1.5k cavity3.ipelem 06-Jun-2001 32k cavity3.ipnode 06-Jun-2001 38k gridht.ipcell 06-Jun-2001 1.7k gridht.ipelem 06-Jun-2001 2.2k gridht.ipequa 26-May-2003 1.4k gridht.ipgrid 06-Mar-2003 541 gridht.ipinit 06-Jun-2001 841 gridht.ipmate 06-Jun-2001 1.8k gridht.ipnode 06-Jun-2001 5.1k gridht.ipsolv 13-Apr-2007 1.9k gridht.ipsolv.old 06-Jun-2001 1.4k linear.ipbase 06-Jun-2001 2.2k test_output.com 06-Jun-2001 82 torsoslice.ipbase 06-Jun-2001 2.5k torsoslice.ippara 12-Nov-2002 5.9k torsoslice.ipregi 06-Jun-2001 93 ventcl.ipequa 26-May-2003 1.2k ventcl.ipinit 06-Jun-2001 1.2k ventcl.ipmate 06-Jun-2001 606 ventcl.ipsolv 13-Apr-2007 1.2k ventcl3.ipelem 06-Jun-2001 16k ventcl3.ipnode 06-Jun-2001 19k

Download the entire example:

Name                                 Modified     Size

examples_b_b2_b21_b214_b2141.tar.gz 14-Apr-2007 30k

Testing status by version:

StatusTestedReal time (s)
cmSuccessSun Mar 6 00:04:53 20165
cm-debugSuccessSat Mar 5 00:24:27 201613
cmSuccessSun Aug 19 03:08:52 2007101
cm-debugSuccessWed Aug 15 02:59:00 2007240
cm-debug-clear-mallocSuccessSat Aug 18 03:14:55 2007245
cm-debug-clear-malloc7SuccessMon Aug 20 03:13:37 2007244
cm64SuccessSun Aug 19 03:13:46 2007106
cm64-debugSuccessTue Aug 21 03:46:32 2007265
cm64-debug-clear-mallocSuccessThu Apr 1 11:21:52 2004119
cmSuccessWed Mar 4 01:12:02 20095
cm-debugSuccessMon Mar 2 01:20:14 200942
cm64SuccessWed Mar 4 01:11:31 20096
cm64-debugSuccessTue Mar 3 01:25:00 200940
cmSuccessSun Mar 6 00:01:14 20163
cm-debugSuccessSat Mar 5 00:02:18 20168

Testing status by file:

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

Input last modified: Fri Apr 13 10:39:20 2007

CMISS Help / Examples / b / b2 / b21 / b214 / b2141