Example 91: Inert gas mixing in a symmetric conducting + multi-branching respiratory model

This example simulates mixing of sulphur-hexafloride with nitrogen in a model of the airways. The model uses a symmetric conducting airway system, based on Weibel's model A, down to generation 16. Because the model is symmetric, only a single pathway needs to be considered. Attached to the end of the terminal conducting airway is a multi-branching point model (see modeling work by Paiva et al. for a description) of a single pulmonary acinus, with geometry based on the morphological study of Haefeli- Bleuer and Weibel. The figures below show the respiratory portion of the model at end inspiration and end expiration, with the gas concentration field coloured.

Created by Merryn Howatson Tawhai.

Concentrations at end of inspiration

Concentrations at end of expiration

Sulphur-hexafloride is washed in (red). The concentration front can clearly be seen at the end of inspiration. At the end of expiration there are only small concentration differences in the acinus model.


The comfile run by this example is as follows:

# If the example path is not set, default to current directory
if (! defined $example) {
    $example = "./";
}
# Drop off the trailing / in the example path
$chopped = chop $example;
if ($chopped ne "/") {
    $example .= $chopped;
}

$filename = "scamba";
$RADIUS = 1;
$INSPIRATION = 1;
$EXPIRATION = 2;
$dt = 0.05;
$T_insp = 1.0;
$T_expn = 1.0;
$NUM_EXPORTS=1;
$time = 0.0;
$flow_in = 0.5; #litres
$flow_out = -0.5; #litres
$v_t = $flow_in * $T_insp; #in litres
$FIXED_NODE = 1;
$FLUX_NODE = 1;
$initial = 0.0;
$concentration = 1.0;
$material = "o2n2";
$NUM_BREATHS = 10;
$N=0;

fem de param;r;"$example/$filename";      #set up parameters for array dimensioning
fem de coor;r;"$example/$filename";        #3d rectangular cartesian
fem de base;r;"$example/$filename";        #linear basis function with 4 gauss points
fem de mesh;r;"$example/$filename" as conducting field; 
fem de;add mesh;c airway multi_hbw basis_function 1 as respiratory field radius_field 1 alveolar_field 2; 
fem update mesh geometry elem conducting radius_field 1 anatomical weibel;
fem update mesh geometry elem respiratory radius_field 1 anatomical hbw;
fem group node in element respiratory as respiratory;

#DEFINE THE PROBLEM SETUP FOR INSPIRATION
fem de equa;r;"$example/$filename" class $INSPIRATION;
fem de mate;r;"$example/$material" class $INSPIRATION;
fem de moti;c lung elem respiratory uniform flow_field 3 inlet_flow $flow_in class $INSPIRATION;
fem de init;c lung fixed node $FIXED_NODE conc $concentration initial $initial class $INSPIRATION;
fem de solve;r;"$example/${filename}_insp" name $material;

#DEFINE THE PROBLEM SETUP FOR EXPIRATION
fem de equa;r;"$example/$filename" class $EXPIRATION;
fem de mate;r;"$example/$material" class $EXPIRATION;
fem de moti;c lung elem respiratory uniform flow_field 3 inlet_flow $flow_out class $EXPIRATION;
fem de init;c lung flux node $FLUX_NODE class $EXPIRATION;
fem de solve;r;"$example/${filename}_expn" class $EXPIRATION name $material;

$restart = "";
$time_end = 0.0;

for (my $j = 0; $j < $NUM_BREATHS; $j++){

    for (my $i = 0; $i < $NUM_EXPORTS; $i++){
	$time_end = $time_end + $T_insp/$NUM_EXPORTS;
	print "FEM solve $restart to $time_end delta_t $dt class $INSPIRATION\n";
	fem solve $restart to $time_end delta_t $dt class $INSPIRATION;
	$N++;
	$restart = "restart";

    }
    fem update solution class $EXPIRATION substitute solution class $INSPIRATION;
    
    for (my $i = 0; $i < $NUM_EXPORTS; $i++){
	$time_end = $time_end + $T_expn/$NUM_EXPORTS;
	print "FEM solve $restart to $time_end delta_t $dt class $EXPIRATION\n";
	fem solve $restart to $time_end delta_t $dt class $EXPIRATION;
	$N++;
    }
    
    fem update solution class $INSPIRATION substitute solution class $EXPIRATION;
    fem update solution class $INSPIRATION nodes $FIXED_NODE substitute constant $concentration;
}

#fem evaluate pulmonary Sn for $NUM_BREATHS ev_start 0.75 ev_end 0.95 vt $v_t;

Additional testing commands:

FEM list node solution class $INSPIRATION;
FEM list node solution class $EXPIRATION;




Files used by this example are:

Name                Modified     Size

example_91.com 07-Jul-2004 2.9k o2n2.ipmate 07-Jul-2004 296 scamba.ipbase 10-Apr-2000 893 scamba.ipcoor 10-Apr-2000 688 scamba.ipequa 11-Sep-2007 1.7k scamba.ipmesh 31-Mar-2004 2.4k scamba.ippara 01-Dec-2006 5.8k scamba.ipsolv 13-Apr-2007 2.3k scamba_expn.ipsolv 13-Apr-2007 2.3k scamba_insp.ipsolv 13-Apr-2007 2.3k test_output.com 07-Jul-2004 88

Download the entire example:

Name                  Modified     Size

examples_9_91.tar.gz 12-Sep-2007 155k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmFailureSun Mar 6 00:05:10 20161
last breakThu Sep 10 00:11:00 20091
last successSun Aug 16 01:27:00 200923
cm-debugFailureSun Mar 6 00:05:10 20160
last breakThu Sep 10 00:11:00 20091
last successFri Aug 21 00:57:00 200938
mips-irix
cmSuccessSun Aug 19 03:34:53 2007137
cm-debugFailureMon Jun 26 08:52:21 2006454249
last breakWed Jun 21 02:41:00 2006454249
last successWed May 31 03:21:00 2006311
cm-debug-clear-mallocFailureMon Mar 27 09:33:10 2006189106
last breakSat Mar 25 05:01:00 2006189106
last successSat Mar 11 05:42:00 2006313
cm-debug-clear-malloc7FailureThu Mar 23 13:22:30 2006213882
last breakThu Mar 23 02:20:00 200639603
last successMon Mar 13 05:05:00 2006315
cm64SuccessSun Aug 19 03:29:37 2007124
cm64-debugFailureThu Jun 8 12:42:56 2006200531
last breakTue Jun 6 05:00:00 2006200531
last successTue May 30 04:26:00 2006321
rs6000-aix
cmSuccessWed Mar 4 01:15:47 200912
cm-debugSuccessMon Mar 2 01:17:22 200955
cm64SuccessWed Mar 4 01:14:55 200913
cm64-debugSuccessTue Mar 3 01:25:31 200953
x86_64-linux
cmFailureSun Mar 6 00:01:24 20161
last breakThu Sep 10 00:10:00 20091
last successSun Aug 16 01:07:00 200911
cm-debugFailureSun Mar 6 00:01:24 20160
last breakThu Sep 10 00:10:00 20093
last successFri Aug 21 00:29:00 200925

Testing status by file:


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

Input last modified: Tue Sep 11 10:52:24 2007


CMISS Help / Examples / 9 / 91