Example 811f: Cardiac cycle simulation using a model of a rat LV

Simulation of the whole cardiac cyle. The various phases of the cardiac cycle are simulated with appropriate boundary conditions.

The model is first passively inflated during the diastasis and atrial contraction phase.

During the isovolumic phases a cavity region is included and coupled to the wall region. The isovolumic contraction is simulated by incrementing active fibre tension (incrementing the CA parameter). The coupling with the incompressible cavity region results in an increased cavity pressure.

The rapid ejection phase is simulated by incrementing the pressure. At each pressure increment a specified volume is given in a file. The CA parameter (active fiber tension) is adjusted to obtain the desired volume. The pressure-volume relationship may be changed to e.g. a Windkessel-model by adjusting the values in the file.

The reduced ejection phase is simulated by keeping CA constant and reducing the pressure slightly.

Isovolumic relaxation is simulated similarly to IVC.

The rapid filling phase is simulated by reducing the CA and pressures down to 0.

Created by Espen Remme May 2004.
 


The comfile run by this example is as follows:

# Example 811f


set num_threads 4
use MyFunc;

$INFLATION = 1;
$IVC = 1;
$EJECTION = 1;
$REDUCED = 1;
$IVR = 1;
$RECOIL = 1;

$output = "./output/"
$outputInit = "./outputInit/"
if( ! -d ${output})
{
    mkdir ${output};
}
if( ! -d ${$outputInit})
{
    mkdir ${outputInit};
}

# Regions
$WALL = 1;
$LV_CAVITY = 3; #This needs to be 3 due to some hack in cmiss that only changes the cavity volume variable for region 3
$iterations = 30

$PstartEjection = 8 # kPa
$Psystole = 9.5; #kPa
$Pee = 8.75; #kPa
$Pla = 1; #kPa

$TRUE=1;
$FALSE=0;
$time = 1;


fem def param;r;full_big
fem define coor;r;rcCoord reg $WALL
fem define base;r;basisfuncs
#
fem define nodes;r;finalMeshRefined reg $WALL
fem define elements;r;finalMeshRefined reg $WALL
fem define fibre;r;fibresRefined reg $WALL
fem define element;r;fibresRefined fibre reg $WALL
$name = "heartOriginal"
$file = $output.$name
fem export nodes;$file as $name offset 0000
fem export elements;$file as $name offset_elem 0000
  
# Material groups
fem group nodes 1,18,35,52 as apexNodes
fem group nodes 2..5,19..22,36..39,53..56 as subApexNodes
fem group nodes 6..17,23..34,40..51,57..68 as normalNodes
fem group nodes 14..17,31..34,48..51,65..68 as baseNodes
# Boundary Condition groups
fem group nodes 1,18,35,52 as fixedApexNodes
fem group nodes 14..17,31..34,48..51,65..68 as fixedBaseNodes
fem group nodes 14,16 as y_axisNodes
fem group nodes 15,17 as z_axisNodes
# Residual strains groups
fem group nodes 6..13 as nodes095
fem group nodes 40..47 as nodes098
fem group nodes 1..5,14..22,31..39,48..56,65..68 as nodes100
fem group nodes 57..64 as nodes103
fem group nodes 23..30 as nodes105
#
fem define equation;r;equation reg $WALL lock
fem define material;r;inhomo_nodes reg $WALL
$return = MyFunc::changeCalcium(0);
fem define active;r;calcium0xx

fem define initial;r;x_Base_node_restricted reg $WALL
fem define solve;r;solve reg $WALL

#####################################################################
if ($INFLATION)
{
  read com;solveInflation
} else
{
  fem define initial;r;$output."wall_inflated_Anode" reg $WALL
  fem define solve;r;solve reg $WALL
  #fem solve increment 0.0
}
$name = "heartInflated"
$file = $output.$name
fem export nodes;$file field as $name offset 2000
fem export elements;$file field as $name offset_elem 2000
if(0)
{
  fem update geometry from solution
  $name = "heartInflated"
  $file = $output.$name
  fem define nodes;w;$file reg $WALL
}


#die("Stop")
#####################################################################
if($IVC || $EJECTION)
{
  # Set up cavity region geometry
  fem define region;r;regions
  fem define coord;r;cavityCoord region $LV_CAVITY
  fem define node;r;cavity region $LV_CAVITY
  fem define element;r;cavity2 region $LV_CAVITY

  fem list elements deformed total cavity_volume region $LV_CAVITY; # Defines and sets the var $LV_CAVITY_VOLUME
  # This function should ideally have worked, but it was a qwuick hack made for the pig heart (ecample_811d) and
  # work needs to be done in OPELEM.f to make it more general and make sure the calculated volume is the
  # same as for the "fem list element deformed total region $LV_CAVITY" further down.
  print "\nLV cavity volume = ${LV_CAVITY_VOLUME}\n";
  $DIASTOLIC_LV_CAVITY_VOLUME = $LV_CAVITY_VOLUME;

  $name = "cavityOriginal"
  $file = $output.$name
  fem export nodes;$file as $name offset 0 reg $LV_CAVITY
  fem export elements;$file as $name offset_elem 0 reg $LV_CAVITY
}

if($IVC)
{
  read com;solveIVC
} else
{
  #die("");
  $Cactn = MyFunc::findCalcium($output."calciumEndIVC.ipacti");
  print "Calcium after IVC: $Cactn\n";
  fem define active;r;$output."calciumEndIVC"
  fem define initial;r;$output."wall_endIVC" region $WALL
  fem define initial;w;$output."temp" region $WALL
  $return = MyFunc::editInitFile(0.3);
  fem define initial;r;$output."ejection" reg $WALL
  fem define solve;r;solve reg $WALL
  fem eval resid wrt geom reg $WALL
  #fem solve increment 0.0 iter 20 error 1.0e-1
  $return = MyFunc::editInitFile(1);
  fem define initial;r;$output."ejection" reg $WALL
} # if $IVC
$name = "heartIVC"
$file = $output.$name
fem export nodes;$file field as $name offset 3000
fem export elements;$file field as $name offset_elem 3000
if(0)
{
  fem update geometry from solution
  $name = "heartIVC"
  $file = $output.$name
  fem define nodes;w;$file reg $WALL
}


#die("")
#####################################################################
if($EJECTION)
{
  read com;solveEjection
} else
{
  $Cactn = MyFunc::findCalcium($output."calciumEndRapidEjection.ipacti");
  print "Calcium = ", $Cactn, "\n";
  $return = MyFunc::changeCalcium($Cactn);
  fem define active;r;"calcium0xx"
  #fem define active;r;"calcium100"
  fem define initial;r;$output."endRapidEjection" region $WALL
  fem define initial;w;$output."temp" region $WALL
  $return = MyFunc::editInitFile(0);
  fem define initial;r;$output."ejection" reg $WALL
  fem define solve;r;solve reg $WALL
  fem eval resid wrt geom reg $WALL
  #fem solve increment 0.0 iter 20 error 1.0e-1
} # if $EJECTION
$name = "heartRapidEjection"
$file = $output.$name
fem export nodes;$file field as $name offset 4000
fem export elements;$file field as $name offset_elem 4000
if(0)
{
  fem update geometry from solution
  $name = "deformedEndEjection"
  $file = $output.$name
  fem define nodes;w;$file reg $WALL
}

if($REDUCED)
{
  read commands;${example}solveReduced; 
} else
{
  $Cactn = MyFunc::findCalcium($output."calciumEndEjection.ipacti");
  print "Calcium = ", $Cactn, "\n";
  $return = MyFunc::changeCalcium($Cactn);
  fem define active;r;$output."calciumEndEjection"
  fem define initial;r;$output."endEjection" region $WALL
  #fem define initial;w;$output."temp" region $WALL
  #$return = MyFunc::editInitFile(0);
  #fem define initial;r;$output."ejection" reg $WALL
  fem define solve;r;solve reg $WALL
  #fem define nodes;r;finalMeshRefined reg $WALL
  fem eval resid wrt geom reg $WALL
  #die("");
  #fem solve increment 0.0 iter 20 error 1.0e-1
} # if $EJECTION
$name = "heartReducedEjection"
$file = $output.$name
fem export nodes;$file field as $name offset 5000
fem export elements;$file field as $name offset_elem 5000
$name = "heartEndEjection"
$file = $output.$name
fem export nodes;$file field as $name offset 5000
fem export elements;$file field as $name offset_elem 5000




#die("");
#####################################################################
if($IVR)
{
  read com;solveIVR
} else
{
  fem define active;r;$output."calciumEndIVR"
  fem define initial;r;$output."wall_endIVR" region $WALL
  fem define initial;w;$output."temp" region $WALL
  $return = MyFunc::editInitFile(0);
  fem define initial;r;$output."ejection" reg $WALL
  fem define solve;r;solve reg $WALL
  fem eval resid wrt geom reg $WALL
}

$name = "heartIVR"
$file = $output.$name
fem export nodes;$file field as $name offset 6000
fem export elements;$file field as $name offset_elem 6000

  
if($RECOIL)
{  
  read com;solveRecoil
}

$name = "heartEndCycle"
$file = $output.$name
fem export nodes;$file field as $name offset 7000
fem export elements;$file field as $name offset_elem 7000



Files used by this example are:

Name                           Modified     Size

example_811f.com 24-Aug-2005 7.0k MyFunc.pm 31-Jul-2004 8.1k MySubs.pm 31-Jul-2004 4.4k basisfuncs.ipbase 04-May-2004 16k calcium0xx.ipacti 04-May-2004 1.1k cavity.ipnode 04-May-2004 44k cavity2.ipelem 04-May-2004 13k cavityCoord.ipcoor 04-May-2004 678 coupled.ipcoup 04-May-2004 437 equation.ipequa 04-May-2004 2.1k equationRegions.irequa 04-May-2004 3.8k export.com 04-May-2004 558 fibresRefined.ipelfb 04-May-2004 12k fibresRefined.ipfibr 04-May-2004 12k finalMeshRefined.ipelem 04-May-2004 47k finalMeshRefined.ipnode 04-May-2004 153k full_big.ippara 04-May-2004 5.8k inhomo_nodes.ipmate 04-May-2004 17k initCavity.ipinit 04-May-2004 12k materialCavityIVC.ipmate 04-May-2004 390 rcCoord.ipcoor 04-May-2004 678 regions.ipregi 04-May-2004 93 solve.ipsolv 16-Aug-2010 2.2k solve.ipsolv.old 13-Apr-2007 2.1k solveEjection.com 04-May-2004 7.4k solveIVC.com 04-May-2004 4.0k solveIVR.com 04-May-2004 2.7k solveInflation.com 04-May-2004 911 solveRecoil.com 04-May-2004 3.1k solveReduced.com 04-May-2004 2.4k solveRegion.irsolv 16-Aug-2010 2.6k solveRegion.irsolv.old 13-Apr-2007 2.4k x_Base_node_restricted.ipinit 04-May-2004 9.8k

Download the entire example:

Name                           Modified     Size

examples_8_81_811_811f.tar.gz 17-Aug-2010 58k

Html last generated: Sun Mar 6 05:50:33 2016

Input last modified: Mon Aug 16 11:22:36 2010


CMISS Help / Examples / 8 / 81 / 811 / 811f