Example 92: Gas mixing in a symmetric conducting/LPM respiratory model


The comfile run by this example is as follows:

#Example_92  Gas mixing in a symmetric conducting/LPM respiratory model
#This exmaple simulates mixing of sulpherhexafloride with nitrogen
#in a full lung model.  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 is considered.  Attached to
#the end of the terminal conducting airway is a lumped parameter model 
#of a single pulmonary acinus, calibrated using simulations in the 
#sca-mba model described in example 91.

# 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 = "scalpm";
$RADIUS = 1;
$ALVEOLI=2;
$INSPIRATION = 1;
$EXPIRATION = 2;
$dt = 0.05;
$T_insp = 1.0;
$T_expn = 1.0;
$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;
$NUM_BREATHS = 10;
$NUM_EXPORTS = 1;

fem de param;r;"$example/$filename";
fem de coor;r;"$example/$filename";
fem de base;r;"$example/$filename";

#CREATE SYMMETRIC CONDUCTING MODEL AND LUMPED PARAMETER RESPIRATORY MODEL
fem de mesh;r;"$example/$filename" as conducting field;
fem de;add mesh;c airway lumped_parameter vol 100 rad_field $RADIUS alveolar_field $ALVEOLI;
fem evaluate ordering;

#CALCULATE RADII AND ALVEOLAR CROSS-SECTIONAL AREA
fem update mesh geometry elem conducting radius_field $RADIUS anatomical weibel;

#DEFINE THE PROBLEM SETUP FOR INSPIRATION
fem de equa;r;"$example/$filename" class $INSPIRATION;
fem de mate;r;"$example/$filename" class $INSPIRATION;
fem de moti;c lung lumped FRC 3.0;
fem de moti;c lung 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";

#DEFINE THE PROBLEM SETUP FOR EXPIRATION
fem de equa;r;"$example/$filename" class $EXPIRATION;
fem de mate;r;"$example/$filename" class $EXPIRATION;
fem de moti;c lung 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" class $EXPIRATION;

#SOLVE FOR FIRST_BREATH
$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;
}

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_92.com 08-Mar-2006 3.2k scalpm.ipbase 10-Apr-2000 893 scalpm.ipcoor 10-Apr-2000 688 scalpm.ipequa 11-Sep-2007 1.7k scalpm.ipmate 23-Oct-2001 239 scalpm.ipmesh 31-Mar-2004 2.4k scalpm.ippara 01-Dec-2006 5.7k scalpm.ipsolv 13-Apr-2007 2.3k test_output.com 07-Jul-2004 85

Download the entire example:

Name                  Modified     Size

examples_9_92.tar.gz 12-Sep-2007 18k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmFailureSun Mar 6 00:05:11 20161
last breakSun Aug 23 02:05:00 20090
last successSun Aug 16 01:18:00 20096
cm-debugFailureSun Mar 6 00:05:46 20160
last breakThu Sep 10 00:11:00 20090
last successFri Aug 21 00:31:00 20098
mips-irix
cmSuccessSun Aug 19 02:07:02 200737
cm-debugFailureThu Jun 8 14:44:49 2006130873
last breakWed Jun 7 02:23:00 2006130873
last successWed May 31 01:49:00 200665
cm-debug-clear-mallocFailureMon Mar 27 09:33:29 2006200110
last breakSat Mar 25 01:58:00 2006200110
last successSat Mar 11 03:01:00 200672
cm-debug-clear-malloc7FailureThu Mar 23 13:24:35 2006213997
last breakThu Mar 23 02:28:00 200639284
last successMon Mar 13 02:44:00 200673
cm64SuccessSun Aug 19 02:04:07 200736
cm64-debugFailureThu Jun 8 12:40:51 2006212159
last breakFri Jun 2 02:00:00 2006378709
last successTue May 30 01:47:00 200665
rs6000-aix
cmSuccessWed Mar 4 01:09:42 20093
cm-debugSuccessMon Mar 2 01:11:06 200910
cm64SuccessWed Mar 4 01:09:43 20093
cm64-debugSuccessTue Mar 3 01:16:04 200910
x86_64-linux
cmFailureSun Mar 6 00:01:24 20160
last breakThu Sep 10 00:10:00 20091
last successSun Aug 16 01:05:00 20093
cm-debugFailureSun Mar 6 00:01:24 20160
last breakThu Sep 10 00:13:00 20091
last successFri Aug 21 00:17:00 20095

Testing status by file:


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

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


CMISS Help / Examples / 9 / 92