Example ed6: Isosurface calculation on a torso

This example demonstrates how to create a potential isosurface with in a torso mesh (BE) using domain solutions. This makes use of several Perl routines. In the main example directory there is an example_cmiss command file which can be run using 'cmiss' and will do both the back and front end calculations/visualisation. There is also an example_cmgui command file which performs the visualisation in cmgui only.


The comfile run by this example is as follows:

if( !$example ) {
  $example = ".";
}
$FBnone = "\033[0m";
$Fgreen   = "\033[32m";

print( "$Fgreen" );
# This example is designed to go through the whole process of getting a potential
# isosurface within a boundary element torso. This is achieved by putting the torso
# inside a box and then defining a grid over the box. A domain solution is then performed
# at each grid point to get an element based representation of the potential field. Some
# Perl routines are then used to convert this field (after exporting) into a shape function
# which is either zero or one, and an extended potential field where the values outside the
# torso are given approximate values to get a smooth potential field throughout the box.
print( "$FBnone" );

print( "$Fgreen" );
# Set up the three regions for the example
print( "$FBnone" );
$Torso = 1;
$Heart = 2;
$Box = 3;

print( "$Fgreen" );
# Set up the two classes for the example
print( "$FBnone" );
$Dipole = 1;
$Grid = 2;

print( "$Fgreen" );
# Define the problem setup - 3d with 3 regions
print( "$FBnone" );
fem define para;r;$example/torsotimedep 
fem define regi;r;$example/torsouno     
fem define coor 3,1

print( "$Fgreen" );
# Read in the geometry of the 3 regions
print( "$FBnone" );
fem define node;r;$example/torsotimedep region $Torso,$Heart  
fem define node;r;$example/volume reg $Box
fem define base;r;$example/volume                 
fem define elem;r;$example/torsotimedep region $Torso,$Heart 
fem define elem;r;$example/volume reg $Box

print( "$Fgreen" );
# Define a finite difference grid over the box that encloses the
# torso. The potential field will be evaluated at these points.
print( "$FBnone" );
fem define grid;r;$example/45k reg $Box
fem update grid geom reg $Box

print( "$Fgreen" );
# Define a quasistatic Laplace equation in the torso regions
# along with the material parameters and initial conditions etc.
print( "$FBnone" );
fem define equa;r;$example/torsotimedep region $Torso,$Heart class $Dipole lock
fem define mate;r;$example/torsotimedep region $Torso,$Heart
fem define init;r;$example/torsotimedep region $Torso,$Heart
fem define sour;r;$example/test region $Heart 
fem define coup;r;$example/torsotimedep
fem define solv;r;$example/torsotimedep coupled region $Torso,$Heart

print( "$Fgreen" );
# A grid equation needs to be defined so we have a grid class in
# which to store the potentials. Here a Laplace equation is used for
# this purpose.
print( "$FBnone" );
fem define equa;r;$example/volume cl $Grid reg $Box

print( "$Fgreen" );
# Solve the torso problem. In this case it has been set up to solve for
# only the time step that we want to export the potentials from.
print( "$FBnone" );
fem solve coupled region $Torso,$Heart class $Dipole

print( "$Fgreen" );
# Export the geometry of the torso and epicardial surfaces
print( "$FBnone" );
fem export node;hearttorso as hearttorso
fem export elem;hearttorso as hearttorso

print( "$Fgreen" );
# Export the potential field over the torso and epicardial surfaces
print( "$FBnone" );
fem export node;field as hearttorso field
fem export elem;field as hearttorso field

print( "$Fgreen" );
# Perform a boundary element domain solution at each of the grid points
# to find the value of the potential field. There are two easy ways to get a
# better, smoother potential isosurface but both take substantially longer.
# They involve:
#   Increasing grid density
#   Using adaptive integration 
# This evaluation provides linear speedup with accurate answers when 
# mulitprocessing (if not it certainly has done in the past).
print( "$FBnone" );
fem evaluate solution grid element 345 optimise iy 1 potential

print( "$Fgreen" );
# Export the geometry of the box that encloses the torso
print( "$FBnone" );
fem export node;geom as test reg $Box
fem export elem;geom as test reg $Box

print( "$Fgreen" );
# Export the element based field that contains the potential field evaluated
# at all grid points in the torso. All points outside the torso have been set to
# 0.0mV based of the C(P) coefficient that is calculated by the boundary element
# method.
print( "$FBnone" );
fem export elem;spote as test field reg $Box class $Grid iy 1 

system( "$example/CreateIsosurface.pl" );
#system( 'cmgui example_cmgui' );

Additional testing commands:



Files used by this example are:

Name                     Modified     Size

example_ed6.com 09-Jan-2002 4.2k 3dhearttorso.iphist 09-Jan-2002 160k 45k.ipgrid 06-Mar-2003 605 CreateIsosurface.pl 09-Jan-2002 5.9k example_cm.com 09-Jan-2002 4.2k example_cmgui.com 09-Jan-2002 4.6k example_cmiss.com 09-Jan-2002 8.2k field.exelem 09-Jan-2002 185k field.exnode 09-Jan-2002 35k geom.exelem 09-Jan-2002 3.6k geom.exnode 09-Jan-2002 1.0k hearttorso.exelem 09-Jan-2002 190k hearttorso.exnode 09-Jan-2002 93k spote.exelem 09-Jan-2002 95k spotePOTEN.exelem 09-Jan-2002 112k spoteSHAPE.exelem 09-Jan-2002 90k test.ipsour 09-Jan-2002 84k test_output.com 09-Jan-2002 0 torsotimedep.ipcoup 21-Aug-2002 464 torsotimedep.ipcoup.old 09-Jan-2002 413 torsotimedep.ippara 26-Feb-2003 5.9k torsotimedep.irelem 09-Jan-2002 109k torsotimedep.irequa 26-May-2003 3.3k torsotimedep.irinit 09-Jan-2002 160k torsotimedep.irmate 09-Jan-2002 156 torsotimedep.irnode 09-Jan-2002 249k torsotimedep.irsolv 13-Apr-2007 2.0k torsouno.ipregi 09-Jan-2002 120 volume.ipbase 18-Feb-2002 6.8k volume.ipelem 09-Jan-2002 422 volume.ipequa 26-May-2003 1.1k volume.ipnode 09-Jan-2002 1.9k

Download the entire example:

Name                      Modified     Size

examples_e_ed_ed6.tar.gz 14-Apr-2007 346k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmSuccessSun Mar 6 00:17:51 201627
mips-irix
cmSuccessSun Aug 19 04:13:06 2007211
cm64SuccessSun Aug 19 04:16:59 2007199
rs6000-aix
cmSuccessWed Mar 4 01:21:57 200934
cm64SuccessWed Mar 4 01:21:41 200935

Testing status by file:


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

Input last modified: Fri Apr 13 10:43:21 2007


CMISS Help / Examples / e / ed / ed6