Example i27: Tangential Dipole in a Sphere - Tangential Volume Contributions

Computes the magnetic field due to a tangential dipole in a sphere of radius 2 mm. The magnetic field due to the volume conductor should be zero normal to the sphere. The magnetic fields are evaluated on the edges of a cube with vertices located at +/- 5 mm.


The comfile run by this example is as follows:

#Example i21

if(!defined $example) 
{  
    $example='.' ;
    $OUT="output"; unless (-d $OUT) {mkdir $OUT};
} else{
    $OUT=".";
}

$resolution = '16x16';
$resolution = '4x4';
$resolution = '8x8';


$interpolation = 'cubic';
#$interpolation = 'linear';

fem define para;r;$example/torsotimedep;
fem define coor 3,1;
fem define regi;r;$example/two;
fem define base;r;$example/bi$interpolation;


if(0)
{
    fem def mesh;r;sphere_$resolution;
    fem def node;w;sphere_$resolution;
    fem def elem;w;sphere_$resolution;
    fem export node;$OUT/sphere as sphere;
    fem export elem;$OUT/sphere as sphere;
    quit;
} else
{
    fem define node;r;$example/sphere_$resolution reg 1;
    fem define elem;r;$example/sphere_$resolution reg 1;
    fem export node;$OUT/sphere as sphere;
    fem export elem;$OUT/sphere as sphere;
}

fem define node;r;$example/cube reg 2;
fem define elem;r;$example/cube reg 2;

#
# Export geometry
#
fem export node;$OUT/cube   as cube reg 2;
fem export elem;$OUT/cube   as cube reg 2;


fem define grid;r;$example/cube   reg 2;
fem update grid geometr            reg 2;
fem define equa;r;$example/laplace_bem_$interpolation reg 1 class 1 lock;
fem define mate;r;$example/laplace reg 1 class 1;
fem define sour;r;$example/dipole  reg 1 class 1;

fem li sour;

fem de anal;r;$example/eccentricdipole reg 1 cl 1;
fem de init;g reg 1 cl 1;
fem define solv;r;$example/nosalu_$interpolation reg 1 class 1;
fem define equa;r;$example/laplace_grid reg 2 class 2 lock;

#
# Solve and export potential due to a dipole
#
fem solve reg 1 class 1;
fem export node;$OUT/sphere_pot as sphere field;
fem export elem;$OUT/sphere_pot as sphere field;


#
# Read in perl subroutine: WriteGradPhiExelem
#  which combines 3 scalar exelem files into a vector field
#
read com;$example/perl;


#
# Full magnetic field
#

fem li sour;
fem export source;$OUT/dipole as dipole;


for $TYPE ("dipole","volume","both")
{
    printf("\n");
    printf("*** Evalutating Magnetic Field from $TYPE\n");

    fem eval solu magnet grid elem 551 iy 1 $TYPE;

    $DXFILENAME="tmp_x";
    $DYFILENAME="tmp_y";
    $DZFILENAME="tmp_z";
    $OUTPUTNAME="$OUT/H_$TYPE";

    fem export elem;$DXFILENAME as cube field reg 2 class 2 iy 2 grid_numbers;
    fem export elem;$DYFILENAME as cube field reg 2 class 2 iy 3;
    fem export elem;$DZFILENAME as cube field reg 2 class 2 iy 4;

    #
    # Combine the 3 scalar field into a single vector field
    #
    
    &WriteGradPhiExelem($DXFILENAME,$DYFILENAME,$DZFILENAME,$OUTPUTNAME);
}




Files used by this example are:

Name                       Modified     Size

example_i27.com 30-Jan-2009 2.5k README.txt 30-Jan-2009 610 bicubic.ipbase 30-Jan-2009 6.8k bilinear.ipbase 30-Jan-2009 5.7k cube.ipelem 30-Jan-2009 447 cube.ipgrid 30-Jan-2009 601 cube.ipnode 30-Jan-2009 2.1k dipole.ipsour 30-Jan-2009 311 draw.com 30-Jan-2009 2.5k eccentricdipole.ipanal 30-Jan-2009 720 laplace.ipmate 30-Jan-2009 54 laplace_bem_cubic.ipequa 30-Jan-2009 1.3k laplace_bem_linear.ipequa 30-Jan-2009 1.3k laplace_grid.ipequa 30-Jan-2009 1.2k nosalu_cubic.ipsolv 30-Jan-2009 1.3k nosalu_linear.ipsolv 30-Jan-2009 1.2k perl.com 30-Jan-2009 2.4k sphere_16x16.ipelem 30-Jan-2009 84k sphere_16x16.ipmesh 30-Jan-2009 985 sphere_16x16.ipnode 30-Jan-2009 211k sphere_4x4.ipelem 30-Jan-2009 5.7k sphere_4x4.ipmesh 30-Jan-2009 983 sphere_4x4.ipnode 30-Jan-2009 12k sphere_8x8.ipelem 30-Jan-2009 21k sphere_8x8.ipmesh 30-Jan-2009 983 sphere_8x8.ipnode 30-Jan-2009 51k torsotimedep.ippara 30-Jan-2009 5.9k two.ipregi 30-Jan-2009 93

Download the entire example:

Name                      Modified     Size

examples_i_i2_i27.tar.gz 15-Jan-2011 35k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmSuccessSun Mar 6 00:02:53 20161
cm-debugSuccessSat Mar 5 00:07:12 20163
rs6000-aix
cmSuccessTue Jan 18 10:59:25 20111
cm-debugSuccessTue Jan 18 10:59:40 20111
cm64SuccessTue Jan 18 10:59:30 20111
cm64-debugSuccessTue Jan 18 10:59:35 20111
x86_64-linux
cmSuccessSun Mar 6 00:01:09 20160
cm-debugSuccessSat Mar 5 00:01:46 20162

Testing status by file:


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

Input last modified: Fri Jan 14 11:17:07 2011


CMISS Help / Examples / i / i2 / i27