Example i57: 3D Bent Cylinder with Slow Waves and Dipole Calculations

This example simulates the slow wave activity in a 3D bent cylinder that mimics a part of the curved small intestine. The cylinder has eight elements into the wall, four around and one along the length. The eight element layers are in turn grouped into three cell types: the inner circular muscle (CM) has five element layers, the middle interstitial Cells of Cajal (ICC) has one element layer and outer longitudinal muscle (LM) has two element layers. The cell model is the Aliev models encoded in CellML. A single dipole vector at each time step is also computed over the entire domain.

Bent Cylinder Solution


The comfile run by this example is as follows:


#
# Intestinal electrical activity using a bent cylinder geometry.
#
# This example was created as part of Liren Li's 4th Year Project (2006)
#

$HISTFILE="intestine";
$intestine = 1;
$active1 = 1;
$Vm = 1;


if(!defined $example) 
{  
    $example='.' ;
    $OUTPUT="output";
} else{
    $OUTPUT=".";
}

fem def para;r;$example/bended_cylinder;
fem def coor 3,1;

#
# Read in geometry of the duodenum
#
fem def node;r;$example/bended_cylinder reg 1;
fem def base;r;$example/cylinder reg 1;
fem def elem;r;$example/bended_cylinder reg 1;

#
# Add fibre into the CM and LM layers
#  
# LKC 6-MAR-2007 default fibres does not appear to initialise the derivative values
#fem def fibr;d; 
#
fem def fibre;r;$example/intestine fibre reg 1;
fem def elem;r;$example/intestine fibre reg 1;


#
# Apply different grid schemes to each layer
#
fem define grid;r;$example/intestine reg 1;
fem update grid geometry reg 1;

#
# Group the faces to allow connection
#
fem group grid face xi3 low element 385..512 as ICC1 reg 1;
fem group grid face xi3 low element 641..768 as ICC2 reg 1;

#
# Create subgroups to define layer groups
#
fem group grid element 1..128 as ELEMSa reg 1;
fem group grid element 513..640 as ELEMSb reg 1;
fem group grid element 257..384 as ELEMSc reg 1;
fem group grid element 769..896 as ELEMSd reg 1;
fem group grid element 129..256 as ELEMSe reg 1;
fem group grid element 641..768 as ELEMSf reg 1;
fem group grid element 385..512 as ELEMSg reg 1;
fem group grid element 897..1024 as ELEMSh reg 1;

#
# Group the different layers
#
fem group grid grid ELEMSg,ELEMSh as LM reg 1;	
fem group grid grid ELEMSf as ICC reg 1;
fem group grid grid ELEMSa,ELEMSb,ELEMSc,ELEMSd,ELEMSe as CM reg 1;
fem group grid external as boundary reg 1;

#
# Cut the connection in the xi3 direction ie. between ICC and LM
#
fem update grid conn grid ICC1 direction 3 reg 1;

#
# Cut the connection in the -xi3 direction ie. between ICC and CM
#
fem update grid conn grid ICC2 direction -3 reg 1;	

#
# Define the activation in the duodenum
#
fem define equa;r;$example/ICCcmiss_mono reg 1 class 1;
fem define cell;r;$example/ICCcmiss_mono reg 1 class 1;
fem define mate;r;$example/epsilon_curve/generated reg 1 class 1 cell;
#fem define mate;r;ICCcmiss_mono_ref reg 1 class 1 cell
fem define mate;r;$example/ICCcmiss_mono reg 1 class 1;
fem define init;r;$example/ICCcmiss_mono reg 1 class 1;

fem define solv;r;$example/ICCcmiss_mono reg 1 class 1;

fem solve to 0 reg 1 class 1;

fem exp node;$OUTPUT/intestine reg $intestine as intestine;
fem exp elem;$OUTPUT/intestine reg $intestine as intestine;
fem exp elem;$OUTPUT/field reg $intestine class $active1 field as intestine;
fem exp elem;$OUTPUT/grid reg $intestine class $active1 as intestine grid_numbers;
fem exp elem;$OUTPUT/fibre as intestine fibre;

fem export node;$OUTPUT/Domain as Domain reg 1;
fem export elem;$OUTPUT/Domain grid_numbers as Domain reg 1;

# Solve with a time step of 0.02s
$step=0.02;
$counter=50; #export every 50th step, ie every second
$cnt=10;
$over_time=5;
$end = $over_time/$step;
for $M ( 0..$end ) {

    $time=$M*$step;

    fem solve restart to $time reg $intestine class $Vm;

    # Reconnect layers
    fem up grid stim grid ICC1,ICC2 diff 0.3 up_pot direct 3 reg $intestine cl $Vm;
	
    # Export the electrical activity solution after the final step
    if($counter>=49) {
	print "Exporting solution for time: $time\n";
	fem def sour;c grid one_dipole grregion $intestine grclass $active1 time $time;
	fem exp ele;$OUTPUT/intestine_mono_pot_$time reg $intestine class $Vm field as intestine;
#	 system( "bzip2 -f $OUTPUT/intestine_mono_pot_$time.exelem &");
	$counter=0;
    }else{
	$counter++;
    }

}

fem define sour;w;dipole_elem grid grregion $intestine grclass $active1;
fem export sour;$OUTPUT/dipole_all as dipole;



Files used by this example are:

Name                      Modified     Size

example_i57.com 06-Mar-2007 3.7k ICCcmiss_mono.ipcell 07-Feb-2007 3.5k ICCcmiss_mono.ipequa 07-Feb-2007 1.5k ICCcmiss_mono.ipinit 07-Feb-2007 214 ICCcmiss_mono.ipmate 07-Feb-2007 2.6k ICCcmiss_mono.ipsolv 13-Apr-2007 2.1k ICCcmiss_mono_ref.ipmatc 07-Feb-2007 2.4k ICCcmiss_new.cml 07-Feb-2007 8.9k bended_cylinder.ipelem 07-Feb-2007 533k bended_cylinder.ipnode 07-Feb-2007 2.2M bended_cylinder.ippara 12-Feb-2007 5.9k cylinder.ipbase 07-Feb-2007 7.4k dipole_elem.ipsour 07-Feb-2007 34k draw.com 07-Feb-2007 6.1k epsilon_curve/ 08-Feb-2007 - intestine.ipelfb 07-Feb-2007 178k intestine.ipfibr 07-Feb-2007 657k intestine.ipgrid 07-Feb-2007 614

Download the entire example:

Name                      Modified     Size

examples_i_i5_i57.tar.gz 29-Jan-2009 1.3M

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmSuccessSun Feb 25 04:12:50 20072216
cm-debugSuccessTue Feb 20 05:54:10 20076402
mips-irix
cmSuccessSat Feb 10 02:58:18 20075240
cm-debugSuccessWed Feb 14 11:14:14 200735375
cm64SuccessSat Feb 10 06:26:23 20075425
cm64-debugSuccessSun Feb 11 15:44:00 200738211
rs6000-aix
cmSuccessWed Mar 4 02:17:07 2009672
cm64SuccessWed Mar 4 02:20:30 2009693
x86_64-linux
cmSuccessSun Mar 6 00:08:38 2016234
cm-debugSuccessSat Mar 5 00:34:19 20161427

Testing status by file:


Graphical output from this problem is given here.


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

Input last modified: Wed Jan 28 10:30:48 2009


CMISS Help / Examples / i / i5 / i57