Example 962: Ventilation distribution using compliance-resistance model

This example predicts ventilation distribution in a simple airway model geometry using the resistance-compliance model. Poiseuille flow is solved in the conducting airways, and acini are modelled as compliant units.

Created by Annalisa Swan 24 Nov 2010.

Figure displays the normalised ventilation distribution with spheres representing compliant acinar units.

To create an image in order to visualise the results of the simulation, use CMGUI with the file draw.com.

The comfile run by this example is as follows:

# Example 962
# Evaluate airway flows using compliance-resistance model.
# Reads mechanics volume ratio data for each node: either as ipdata file
# or as ipfiel file (set variable $mech_file to choose).

# 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;

## Fields
$nj_Dacin=5; #acinar size (diameter)

## Set up problem
fem de param;r;ventilation;
fem de coor 3,1;
fem de base;r;ventilation;

## Geometry
fem de node;r;test_airways;
fem de elem;r;test_airways 1d;
fem update scale_factor normalise;
fem evaluate ordering; 

## Parameters
$acinus = 10000; #mm3 (volume per acinus)
$dt = 0.05; 
$dPpl  = -3.5 * 98.0665; #convert cmH2O to Pa
$Tbreath = 5.0; #seconds
$ref_vol=$acinus*0.5;# #reference undeformed acinar volume

## Mesh definition -
fem de mesh;c airway field num_field $numFields;
fem update mesh geometry radius_field $nj_radius elem 1 constant 0.5; 
fem update mesh geometry radius_field $nj_radius Rd_H ratio 1.152; 
fem group elem all by terminal as TERMINAL;
fem group node elem TERMINAL xi1=1 as TERMINAL;
fem de moti;c lung 
fem de;add mesh;c airway lumped_parameter volume $acinus;
fem de values;r;ventilation ventilation

## Run ventilation model with volume ratio distribution
$mech_file="ipfiel"; # $mech_file="ipdata";
if($mech_file eq "ipdata"){
      # # EITHER (1) Read ipdata file with volume ratios
      fem de data;r;volume_ratios field num_field 3; #only read in 3 fields (must include num_fields option, otherwise file is read incorrectly)
      fem evaluate flow nbreaths 1 time_step $dt interval $Tbreath read_volumes undeformed $ref_vol data 5 ppl $dPpl# filename ventilation;
}elsif($mech_file eq "ipfiel"){
      # # OR (2)  Read ipfiel file with volume ratios
      $nj_Vratio=6; ## only if volume ratios are read from ipfiel file, same index as in volume_ratios.ipfiel
      fem de;add field;r;volume_ratios; 
      fem de elem;d field; ## req'd for correct exporting of element files
      fem evaluate flow nbreaths 1 time_step $dt interval $Tbreath read_volumes undeformed $ref_vol field $nj_Vratio ppl $dPpl# filename ventilation;

## Export results
fem export node;ventilation_terminal nodes TERMINAL as terminal;
fem export node;ventilation as airways;
fem export elem;ventilation as airways;
# fem de field;w;ventilation values start $nj_flow end $nj_flow;

Additional testing commands:

fem list nodes

Files used by this example are:

Name                  Modified     Size

example_962.com 15-Feb-2011 2.7k cmiss_test.out 25-Nov-2010 9.9k draw.com 25-Feb-2011 1.1k test_airways.ipelem 25-Nov-2010 5.3k test_airways.ipnode 25-Nov-2010 6.8k test_output.com 25-Nov-2010 15 ventilation.ipbase 25-Nov-2010 893 ventilation.ipfiel 25-Nov-2010 4.3k ventilation.ippara 25-Nov-2010 5.8k ventilation.ipvalu 25-Nov-2010 436 ventilation.resist 25-Nov-2010 165 ventilation.shear 25-Nov-2010 95 ventilation_1.extime 25-Nov-2010 288 ventilation_2.extime 25-Nov-2010 288 ventilation_3.extime 25-Nov-2010 288 ventilation_4.extime 25-Nov-2010 288 volume_ratios.ipdata 25-Nov-2010 2.7k volume_ratios.ipfiel 17-Feb-2011 1.9k

Download the entire example:

Name                      Modified     Size

examples_9_96_962.tar.gz 26-Feb-2011 28k

Testing status by version:

StatusTestedReal time (s)
cmFailureSun Mar 6 00:05:47 20161
last breakSun Feb 20 01:46:00 20111
cm-debugFailureSun Mar 6 00:05:12 20161
last breakFri Feb 18 00:29:00 201115
cmFailureSun Mar 6 00:01:24 20160
last breakSun Feb 20 01:10:00 20112
cm-debugFailureSun Mar 6 00:01:24 20160
last breakFri Feb 18 00:28:00 20116

Testing status by file:

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

Input last modified: Fri Feb 25 17:39:29 2011

CMISS Help / Examples / 9 / 96 / 962