Example 993: Compressible mechanics for a simple solid cuboid.

This example uses the same process as in 991, but with simplifications to the boundary conditions and projections. View the resulting deformation and pressure field using 'draw.com'.


The comfile run by this example is as follows:

#Example_993  Compressible mechanics for a simple solid cuboid.
# Uses the same process as in 991, but with simplifications to
# the boundary conditions and projections.
# View the resulting deformation and pressure field using 'draw.com'.

# 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;
$posture = 'Upright';
#read com;SpecifyProblem;
read com;SubjectInfo;    #read in subject-specific information
read com;SubjectSetup;   #subject-specific info to set problem

print "$volume, $Vstep, $ref_pct, $density, $scale_0 \n";

fem de node;r;refined;
fem de elem;r;refined;

# Note: to get the refined mesh:
#fem de node;r;cuboid;
#fem de elem;r;cuboid basis 1;
#fem update node derivative 1;
#fem update node derivative 2;
#fem update node derivative 3;
#fem refine xi 1 ntimes 2;
#fem refine xi 2 ntimes 2;
#fem refine xi 3 ntimes 3;
#fem de node;w;refined;
#fem de elem;w;refined;

fem group elem all as all_elements;
fem group node in elem all_elements as all_nodes;
fem group elem all external s3=0 as s3_0;
fem group elem all external s3=1 as s3_1;
fem group elem all external s2=0 as s2_0;
fem group elem all external s2=1 as s2_1;
fem group elem all external s1=0 as s1_0;
fem group elem all external s1=1 as s1_1;

fem group node in elem s3_0 xi3=0 as xi3_0;
fem group node in elem s3_1 xi3=1 as xi3_1;
fem group node in elem s2_0 xi2=0 as xi2_0;
fem group node in elem s2_1 xi2=1 as xi2_1;
fem group node in elem s1_0 xi1=0 as xi1_0;
fem group node in elem s1_1 xi1=1 as xi1_1;

fem group node xi1_0,xi1_1,xi2_0,xi2_1,xi3_0,xi3_1 as outer_nodes;

fem group face all external as outer_faces;
fem group face all elem s1_0 external xi1 low as xi1_0_faces;
fem group face all elem s1_1 external xi1 high as xi1_1_faces;
fem group face all elem s2_0 external xi2 low as xi2_0_faces; 
fem group face all elem s2_1 external xi2 high as xi2_1_faces;
fem group face all elem s3_0 external xi3 low as xi3_0_faces; 
fem group face all elem s3_1 external xi3 high as xi3_1_faces;

fem group face xi1_0_faces,xi1_1_faces as xi1_faces;
fem group face xi2_0_faces,xi2_1_faces as xi2_faces;
fem group face xi3_0_faces,xi3_1_faces as xi3_faces;

fem group node outer_nodes as project_z;
fem group node outer_nodes as project_y;
fem group node outer_nodes as project_x;

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 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 solve increment 1 iterate $iterate error $error; #no extra G
read com;ModifyInitial;
fem de initial;w;${grav_path}.'Initial'.${posture}.${lung}.${volume};

#..CALCULATE THE PRESSURES NEAR THE SURFACE
fem evalu press surface faces outer_faces at 0.95 field 1;
fem update field 1 multiply constant 1/98; #Pa to cmH2O
fem export node;deformed0 as cuboid field;
fem export elem;deformed0 as cuboid field;

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

### 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;
    read com;ModifyInitial;
    $sum_increment = $sum_increment + $increment;
}

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

fem de data;c fill_volume spread xi spacing 0.5;
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 de data;w;output field num_field 2;

#..CALCULATE THE PRESSURES NEAR THE SURFACE
fem evalu press surface faces outer_faces at 0.95 field 1;
fem update field 1 multiply constant 1/98; #Pa to cmH2O

fem export node;reference as cuboid;
fem export elem;reference as cuboid;

fem export node;deformed as cuboid field;
fem export elem;deformed as cuboid field;

fem quit;

Files used by this example are:

Name                         Modified     Size

example_993.com 24-Jun-2011 5.4k BasicSetup.com 24-Jun-2011 362 BiCubic_Surface.ipbase 24-Jun-2011 1.5k Compressible.ipequa 24-Jun-2011 2.2k DSupineRight0.exelem 24-Jun-2011 288k DSupineRight50.exnode 24-Jun-2011 184k DUpright0.exelem 24-Jun-2011 288k DUpright50.exnode 24-Jun-2011 184k ExportResults.com 24-Jun-2011 473 FinalSupineRight50.ipinit 24-Jun-2011 1.8M FinalUpright50.ipinit 24-Jun-2011 1.8M FixSurface.ipinit 24-Jun-2011 20k GMRES.ipsolv 24-Jun-2011 2.7k GroupingLung.com 24-Jun-2011 3.6k Header.ipinit 24-Jun-2011 8.9k HeaderFix.ipinit 24-Jun-2011 7.1k HeaderProne.ipinit 24-Jun-2011 7.4k HeaderSupine.ipinit 24-Jun-2011 7.4k HeaderUpright.ipinit 24-Jun-2011 7.4k Increment.com 24-Jun-2011 298 InitialSupineRight50.ipinit 24-Jun-2011 1.8M InitialUpright50.ipinit 24-Jun-2011 1.8M InitialiseFields.com 24-Jun-2011 343 LU.ipsolv 24-Jun-2011 3.2k Linear_Line.ipbase 24-Jun-2011 893 LungSurfacePoints.ipxi 24-Jun-2011 13k ModifyInitial.com 24-Jun-2011 379 OutputInitial.com 24-Jun-2011 1.6k Pressure.ipbase 24-Jun-2011 1.1k Pressure.ipfit 24-Jun-2011 1.4k ProjectProne.com 24-Jun-2011 619 ProjectSupine.com 24-Jun-2011 1.0k ProjectUpright.com 24-Jun-2011 619 RunLung.com 24-Jun-2011 3.8k SEDF.ipmate 24-Jun-2011 2.1k ScaleLungToReference.com 24-Jun-2011 173 SetInitial.com 24-Jun-2011 966 SlideSupineRight50.ipinit 24-Jun-2011 924k SlideUpright50.ipinit 24-Jun-2011 924k SpecifyProblem.com 24-Jun-2011 73 SubjectInfo.com 24-Jun-2011 2.2k SubjectSetup.com 24-Jun-2011 449 TriCubic_Vol.ipbase 24-Jun-2011 1.9k USupineRight0.exelem 24-Jun-2011 306k USupineRight50.exnode 24-Jun-2011 903k UUpright0.exelem 24-Jun-2011 306k UUpright50.exnode 24-Jun-2011 903k cuboid.exelem 24-Jun-2011 306k cuboid.exnode 24-Jun-2011 903k cuboid.ipelem 24-Jun-2011 419 cuboid.ipnode 24-Jun-2011 2.2k deformed.exelem 24-Jun-2011 288k deformed.exnode 24-Jun-2011 184k deformed0.exelem 24-Jun-2011 288k deformed0.exnode 24-Jun-2011 184k draw.com 24-Jun-2011 986 linear.ipsolv 24-Jun-2011 2.3k linear.ipsolv.old 24-Jun-2011 2.2k lung.ippara 24-Jun-2011 5.9k output.ipdata 24-Jun-2011 13k reference.exelem 24-Jun-2011 306k reference.exnode 24-Jun-2011 903k refined.exelem 24-Jun-2011 287k refined.exnode 24-Jun-2011 139k refined.ipelem 24-Jun-2011 44k refined.ipnode 24-Jun-2011 401k

Download the entire example:

Name                      Modified     Size

examples_9_99_993.tar.gz 25-Jun-2011 893k

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

Input last modified: Fri Jun 24 10:42:48 2011


CMISS Help / Examples / 9 / 99 / 993