Example 8113: Deformation of a rectangular-cartesian canine left ventricle model

Deformation of a rectangular-cartesian left ventricle model


The comfile run by this example is as follows:


#set num_threads 12;
#
$TRUE = 1;
$FALSE = 0;

{
  eval { require Time::HiRes };
  if( $@ )
    {
      print "warning: $@";
    }
  else
    {
      import Time::HiRes qw(time);
    }
}

sub cpu_time()
  {
    # Add user/system parent/child cpu_times.
    my $result = 0;
    map { $result += $_ } times;
    $result;
  }

sub print_timing($$$)
  {
    my ($message,$wall,$cpu) = @_;
    printf "%s: %.3fs wall, %.3fs cpu.\n", $message, $wall, $cpu;
  }

sub print_memory_use()
  {
    # Different operating systems have different data and ps uses different
    # arguments so try a series of commands in an attempt to collect the
    # information.
    system qw(ps -o vsz -p), $$;
    system qw(ps -l -p), $$;
    system qw(ps v), $$;
  }

#
# Solve for or read in deformations
#
$MAX_PRESS = 10;
$SOLVE_INFLATION = $TRUE;
$WALL = 1;

$example =~ s|/$||; # remove any trailing slash

fem define para;r;$example/lv
fem define coord;r;$example/rc3d            
fem define base;r;$example/lv                                            # Geometry and fibres
fem define;add bases;r;$example/3Linear-2PressAuxXi3_3x3x3Gauss $WALL;   #9 Pressure
fem define node;r;$example/lv                          #refined in Xi 2 at 0.8 elements 3..8,31..40
fem define element;r;$example/lv
fem define fibre;r;$example/lv
fem define element;r;$example/lv fibre 


fem export nodes;lv as lv    
fem export elements;lv as lv 


fem group nodes 4,17,59,2 as some_base
#
fem group elements 3..8,13..18,21..30,61..66 as epi
fem group elements 31..32,39..42,49..50,67..68,75..76 as sept
fem group elements 33..38,43..48,51..60,69..74 as lv_endo
fem group elements 61..76 as base
fem group elements 3..8,13..18,21..60 as ventricle 


fem define equation;r;$example/finelas_tch_incomp region $WALL lock;
fem define material;r;$example/lv gauss region $WALL;
fem define active;r;$example/active0_00 region $WALL;
fem define initial;r;$example/lv region $WALL;
fem define solve;r;$example/newton region $WALL;

		print "\033[0;30;43m    Increase cavity pressures incrementally to simulate diastole    \033[0m\n"; 
    #
		set out;steps_inflate on;
		$NAME1 = "heart_def_00";
		$NAME2 = "_active_0000";
		$ITERS = 50;
		$TOL = 0.001;

($wall_setup,$cpu_setup) = (time, cpu_time);
print_timing 'setup', $wall_setup - $^T, $cpu_setup;

		for $PRESS ( 0..10 ) 
# 		for $PRESS ( 0..30 ) 
		{
				if ($PRESS < 1) 
				{
						$FILENAME = ${NAME1}."0".${PRESS}.${NAME2}; 
            $INCREM = 0.0;
        } elsif ($PRESS < 10) {
		        $FILENAME = ${NAME1}."0".${PRESS}.${NAME2};
            $INCREM = 0.1;
        } else {
            $FILENAME = ${NAME1}.${PRESS}.${NAME2};
            $INCREM = 0.1;
        }

        fem solve increment $INCREM iter $ITERS error $TOL;
        fem define initial;w;${FILENAME};
        #
        fem update gauss stress fibre components Piola;
        fem export gauss;${FILENAME}."_gauss_stress" yg as gauss_stress;
        fem update gauss strain fibre components ;
        fem export gauss;${FILENAME}."_gauss_strain" yg as gauss_strain;
        #
        fem export nodes;${FILENAME}  as heart;
        fem export nodes;${FILENAME}_def field as heart;
        fem export elements;${FILENAME} as heart;
        fem export elements;${FILENAME}_def field as wall;
    }

($wall_solve,$cpu_solve) = (time, cpu_time);
print_timing 'solve', $wall_solve - $wall_setup, $cpu_solve - $cpu_setup;

# fem export nodes;$filename field as heart

print_memory_use;

Files used by this example are:

Name                                    Modified     Size

example_8113.com 18-Jan-2005 3.4k 3Linear-2PressAuxXi3_3x3x3Gauss.ipbase 01-Feb-2001 1.9k active0_00.ipacti 03-Mar-2004 777 finelas_tch_incomp.ipequa 18-Jan-2005 2.0k lv.exelem 01-Feb-2001 400k lv.exnode 01-Feb-2001 129k lv.ipbase 01-Feb-2001 11k lv.ipelem 01-Feb-2001 74k lv.ipelfb 01-Feb-2001 23k lv.ipfibr 01-Feb-2001 58k lv.ipinit 18-Jan-2005 13k lv.ipmate 18-Jan-2005 7.3k lv.ipnode 01-Feb-2001 301k lv.ippara 12-Nov-2002 5.8k newton.ipsolv 16-Aug-2010 2.7k newton.ipsolv.old 13-Apr-2007 2.5k output/ 18-Jan-2005 - rc3d.ipcoor 01-Feb-2001 728 steps_inflate.out 01-Feb-2001 179k view_def.com 01-Feb-2001 3.4k viewheart.com 09-Nov-2001 624

Download the entire example:

Name                           Modified     Size

examples_8_81_811_8113.tar.gz 17-Aug-2010 4.2M

Testing status by version:

StatusTestedReal time (s)
hpc_cmo64_irixSuccessSun Jul 31 04:15:32 20056967
rs6000-aix
cm64SuccessWed Mar 4 02:46:35 20091767
x86_64-linux
cmSuccessSun Mar 6 00:25:49 20161078

Testing status by file:


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

Input last modified: Mon Aug 16 11:22:37 2010


CMISS Help / Examples / 8 / 81 / 811 / 8113