Example 991: Initial example for parenchymal soft tissue mechanics


The comfile run by this example is as follows:

#Example_991  Compressible mechanics for a simple solid lung.

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

read com;BasicSetup;
read com;SpecifyProblem; #specify the subject, lung
read com;SubjectInfo;    #read in subject-specific information
read com;SubjectSetup;   #subject-specific info to set problem
fem de node;r;lung;
fem de elem;r;lung basis 1;
read com;GroupingLung;   #node,elem,face groupings
read com;ScaleLungToReference;

fem de data;c from_node node outer_nodes; #calculates data points and Xi coords
fem de xi;w;LungSurfacePoints coupled_nodes;

# FIELDS (DEFAULT FIELDS)
fem de field;d field_var 16 deriv; # for cubic BFs
fem de elem;d field;
# FIBRES (DEFAULT FIELDS)
fem def fibr;d;
fem def elem;d fibre;
# EQUATION (PROBLEM TYPE)
fem def equa;r;Compressible;
# MATERIAL PROPERTIES FOR PROBLEM TYPE
fem de mate;r;SEDF;
fem update material density $density;
# INITIAL CONDITIONS SET FIXED DISPLACEMENTS AND FORCES
fem de init;r;FixSurface;
# FIT ALVEOLAR PRESSURES
fem de fit;r;Pressure field;
# STORE THE REFERENCE GEOMETRY IN FIELDS
read;InitialiseFields;

###############################################################

#SOLVE WITHOUT GRAVITY TO GET EXPANDING FORCES
fem de solve;r;GMRES;
fem evaluate pressure gauss initial 1; #updates ratio deformed:undeformed
fem evaluate pressure gauss; #updates ratio deformed:undeformed
fem solve increment 0 iterate $iterate error $error;

#..CHANGE THE SIZE OF THE LUNG TO MATCH THE CAVITY (update solution)
$cavity_scale = ($volume/$ref_pct)**(1/3);
print "scale cavity by $cavity_scale \n";
for $ni (1..3) {fem update solution niy 1 depvar $ni node all_nodes multiply constant $cavity_scale};

#..CALCULATE THE FORCES REQUIRED TO MAINTAIN THIS GEOMETRY
fem update field $P substitute constant 0; #Pa to cmH2O
fem solve increment 1 iterate $iterate error $error; #no extra G
$Fscale = 0.7; #amount of scaling on the force that is added to initial forces
read com;ModifyInitial;
fem de initial;w;'Initial'.${posture}.${lung}.${volume};

########################

### ADD GRAVITY ###

# INITIAL CONDITIONS SET FIXED DISPLACEMENTS AND FORCES
read com;SetInitial;

# STORE THE CURRENT GEOMETRY (ZERO GRAVITY) IN FIELDS. USE AS PLEURAL SURFACE
for my $j (1..3){
    $njj[$j] = 4 + $j;
    $njs[$j] = 10 + $j;
    fem update field $njj[$j] substitute solution niy 1 depvar $j;
    fem update field $njs[$j] substitute solution niy 1 depvar $j;
}

$sum_increment = $increment;
for ($j = 1; $j <= $Gnsteps; $j++){
    fem de solve;r;GMRES;
    fem update field $P substitute constant 0; #Pa to cmH2O
    fem evaluate pressure gauss; #updates ratio deformed:undeformed
    fem solve increment $sum_increment iterate $iterate error $error;
    read com;Project$posture;
    read com;OutputInitial;
    fem eval reac node; # outer_nodes;
    $Fscale = $increment; #amount of scaling on the force that is added to initial forces
    read com;ModifyInitial;
    $sum_increment = $sum_increment + $increment;

}

#..EXPORT THE RESULTS
$i = $volume;
read com;ExportResults;

fem de data;c fill_volume spacing 8;
fem de data;c from_xi deformed;
fem update data field num_field 2;
fem evaluate compressible data recoil field 1; #in Pa
fem evaluate compressible data ratio field 2;  #dimensionless

fem export data;$posture field_num 1,2 as result;
fem de data;w;$posture field num_field 2;
$rhot = 1000 * $density *($ref_pct)/$volume; #g/cm^3
print "target density = $rhot \n";

$size = 10;
system "perl solution_bin.pl $posture z $size $density $rhot";
system "perl solution_bin.pl $posture y $size $density $rhot";
system "perl solution_bin.pl $posture x $size $density $rhot";

fem quit;

Files used by this example are:

Name                           Modified     Size

example_991.com 06-Mar-2012 3.7k BasicSetup.com 08-Apr-2011 362 BiCubic_Surface.ipbase 08-Apr-2011 1.5k Compressible.ipequa 08-Apr-2011 2.2k ExportResults.com 08-Apr-2011 473 FixSurface.ipinit 06-Mar-2012 7.4k GMRES.ipsolv 08-Apr-2011 2.7k GroupingLung.com 06-Mar-2012 5.4k Header.ipinit 08-Apr-2011 8.9k HeaderFix.ipinit 08-Apr-2011 7.1k HeaderFixOut.ipinit 01-Dec-2011 7.2k HeaderProne.ipinit 08-Apr-2011 9.7k HeaderSupine.ipinit 06-Mar-2012 7.4k HeaderUpright.ipinit 06-Mar-2012 7.4k Increment.com 08-Apr-2011 298 InitialSupineLeft100.ipinit 01-Dec-2011 1.8M InitialiseFields.com 08-Apr-2011 343 LU.ipsolv 08-Apr-2011 3.2k LungSurfacePoints.ipxi 06-Mar-2012 14k MDCT.left 01-Dec-2011 318 ModifyInitial.com 06-Mar-2012 636 OutputInitial.com 06-Mar-2012 1.7k Pressure.ipbase 08-Apr-2011 1.1k Pressure.ipfit 08-Apr-2011 1.4k ProjectProne.com 08-Apr-2011 1.4k ProjectSupine.com 06-Mar-2012 2.0k ProjectUpright.com 06-Mar-2012 619 RunLung.com 08-Apr-2011 3.8k SEDF.ipmate 06-Mar-2012 2.1k ScaleLungToReference.com 06-Mar-2012 150 SetInitial.com 08-Apr-2011 966 SlideSupineLeft100.ipinit 01-Dec-2011 913k SpecifyProblem.com 06-Mar-2012 72 SubjectInfo.com 06-Mar-2012 56 SubjectSetup.com 06-Mar-2012 776 Supine.exdata 01-Dec-2011 178k Supine.ipdata 01-Dec-2011 229k Supine.out.x.10 01-Dec-2011 774 Supine.out.y.10 01-Dec-2011 963 Supine.out.z.10 01-Dec-2011 1.4k TriCubic_Vol.ipbase 08-Apr-2011 1.9k linear.ipsolv 06-Mar-2012 2.3k linear.ipsolv.old 13-Apr-2007 2.2k lung.ipelem 08-Apr-2011 44k lung.ipnode 06-Mar-2012 403k lung.ippara 08-Apr-2011 5.9k lungDSupineLeft0.exelem 01-Dec-2011 288k lungDSupineLeft100.exnode 01-Dec-2011 184k lungFinalSupineLeft100.ipinit 01-Dec-2011 1.8M lungUSupineLeft0.exelem 01-Dec-2011 306k lungUSupineLeft100.exnode 01-Dec-2011 903k plot.gnu 01-Dec-2011 408 solution_bin.pl 01-Dec-2011 6.9k

Download the entire example:

Name                      Modified     Size

examples_9_99_991.tar.gz 07-Mar-2012 881k

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

Input last modified: Tue Mar 6 12:52:45 2012


CMISS Help / Examples / 9 / 99 / 991