This example modells the relaxation of the GOJ using finite elasticity and coupled to a cavity mesh. This involves computing the undeformed state from a deformed mesh.
NOTE: The example reads in the deformed mesh resulted from example_i71 and predicts the undeformed mesh.
#
# This file modells the relaxation of the GOJ.
# Author: Rita Yassi
# Last updated: 26/06/08
# Aim: reverse mechanics, predicting the undeformed mesh from a deformed state
#
#
if (!defined $example)
{
$OUT="output"; unless (-d $OUT) {mkdir $OUT};
$example ='.';
} else
{
$OUT=".";
}
set echo;
set output;output on
# ************* define variables *********************************
# Region
$WALL = "1";
$CAVITY = "2";
# Classes
$TISSUE = "1";
# Solution parameters
$MAX_ITERS = 20;
$TOL = 1.0e-6;
$CAVITY_PRESSURE_NY = 2681;
# *****************************************************************
# ************ define problem *************************************
# *****************************************************************
fem define parameters;r;$example/GOJ;
fem define coor;r;$example/3drc;
# Define all the bases (unit scale factors)
# 1 Geometry
fem define bases;r;$example/3CubicHermite_4x4x4Gauss;
# 2 Faces
fem define ;add bases;r;$example/2CubicHermite_4x4Gauss;
# 3
fem define ;add bases;r;$example/2Linear-CubicHermite_4x4x4Gauss;
# 4 Fibre
fem define ;add bases;r;$example/3Linear_4x4x4Gauss;
# 5
fem define ;add bases;r;$example/Linear-2CubicHermite_4x4x4Gauss;
# 6 Faces
fem define ;add bases;r;$example/Linear-CubicHermite_4x4x4Gauss;
# 7 Faces
fem define ;add bases;r;$example/2Linear_4x4Gauss;
# 8 Faces
fem define ;add bases;r;$example/CubicHermite-Linear_4x4x4Gauss;
# 9 Pressure (pressure is linearly varied within each element)
fem define ;add bases;r;$example/3Linear-2PressAuxXi3_4x4x4Gauss;
# 10 Cavity geometry
fem define ;add bases;r;$example/2CubicHermite-Linear_4x4x4Gauss;
# 11 Cavity pressure
fem define ;add bases;r;$example/PressAuxXi3_4x4x4Gauss;
# *****************************************************************
# **************** Define the wall mesh **************************
# *****************************************************************
fem define nodes;r;$example/GOJ_contract reg $WALL;
fem define elements;r;$example/GOJ_contract reg $WALL;
fem define fibre;r;$example/GOJ_contract reg $WALL;
fem define element;r;$example/GOJ_contract fibre reg $WALL;
$undeformed= "undeformed_GOJ";
# Export initial undefomed geometry
fem export node;$undeformed as $undeformed region $WALL;
fem export elem;$undeformed as $undeformed region $WALL;
# Boundary conditions
# fix the displacements of selected nodes in x
fem group node 230,238,293..294 as fixed_x1 region $WALL;
fem group node 301..302,358,366,403,407 as fixed_x2 region $WALL;
fem group node fixed_x1,fixed_x2 as fixed_x region $WALL;
# fix the displacements of selected nodes in y
fem group node 226,234,289..290 as fixed_y1 region $WALL;
fem group node 297..298,355,362,401,405 as fixed_y2 region $WALL;
fem group node fixed_y1,fixed_y2 as fixed_y region $WALL;
# fix the displacements of bottom nodes in x, y, and z
fem group node 83..84,86,88,92,94..96,178,180,183..184,189..192,321..322,325,327,329,331,333,335 as fixed_botnodes region $WALL;
# group elementes
fem group elem 1..24,33..56,65..80,97..120,129..152,161..176 as AllElem #this is exluding the fundus part
fem group elem 9..24,41..48,65..80,105..120,137..144,161..176 as ActiveElem
fem group elem 97..120,129..152,161..176 as LMElem
# Define static analysis of 3D finite elasticity
fem define equation;r;$example/finelas_tch_incomp class $TISSUE reg $WALL;
# Using the first option of the exponential laws
fem define material;r;$example/GuccioneLaw class $TISSUE reg $WALL;
# Initialise calcium activation to 0
fem define active;r;$example/Ca;
# define initial and boundary conditions
fem define initial;r;$example/GOJ class $TISSUE reg $WALL;
# *****************************************************************
# ****************************** Set up cavity region *******************************
# *****************************************************************
# Cavity region and geometry
fem define region;r;$example/coupled;
fem define coord;r;$example/cavity region $CAVITY;
fem define node;r;$example/Cavity_contract region $CAVITY;
fem define element;r;$example/Cavity_contract region $CAVITY;
# the shared nodes of the cavity must have the same BC as the outer wall
# all displacements and derivatives of the central nodes of the cavity
# must be fixed in all directions with the exception of one node free to
# move in z
fem group node 901..905 as cavity_fixed_nodes region $CAVITY;
fem group node 906 as cavity_free_node region $CAVITY;
$VALVE_NODE = "906";
$VALVE_NODES = "257,259,261,263,265,267,269,271";
# Set up equations, material properties and initial conditions
# for cavity region
fem define equation;r;$example/coupled region $WALL,$CAVITY lock;
# define cavity stiffness
fem define material;r;$example/cavity region $CAVITY;
# set BC
fem define initial;r;$example/cavity region $CAVITY;
# Define cavity-to-wall coupling and solution procedure information
fem define coupling;r;$example/coupled;
fem define solve;r;$example/coupled_lu_nosparse coupled region $WALL,$CAVITY;
fem update solution cavity_reference region $CAVITY;
# Export initial cavity geometry
fem export node;cavity_initial as cavity region $CAVITY;
fem export elem;cavity_initial as cavity region $CAVITY;
# *****************************************************************
# *************************** Relaxation ****************************
# *****************************************************************
$file = "relax";
# define the Ca parameter
fem define active;r;$example/contract_1;
# solve for the undeformed mesh
fem solve coupled undeformed iter $MAX_ITERS error $TOL;
fem export node;GOJ_${file}_1 as GOJ class $TISSUE region $WALL;
fem export elem;GOJ_${file}_1 as GOJ class $TISSUE region $WALL;
###########################################################################
# Note: full simultion takes approximately 4 hours, for simplification
# the code was reduced. The following code can be used to obtain the full
# simulaton. draw.com will use the results obtained from the full code
# to represent the visual effects. If the long code is used, make sure
# you read in the final contracted meshes of the cavity and the GOJ
# from the contraction of the GOJ with no cavity example.
# files will be Cavity_relax2swallow and GOJ_relax2swallow
#
# $file = "swallow2relax";
# $inc=0.04;
# $maxiter = 1/$inc;
#
# for ($iter=1;$iter<$maxiter+1;$iter++) {
# # define the Ca parameter
# fem define active;r;contract_$iter;
# # solve for the undeformed mesh
# fem solve coupled undeformed iter $MAX_ITERS error $TOL;
# fem export node;GOJ_$iter as GOJ class $TISSUE region $WALL;
# fem export elem;GOJ_$iter as GOJ class $TISSUE region $WALL;
#
###########################################################################
# write out the results
fem define node;w;GOJ_$file region $WALL;
fem define elem;w;GOJ_$file region $WALL;
fem define node;w;Cavity_$file region $CAVITY;
fem define elem;w;Cavity_$file region $CAVITY;
set output off