Example i21: Magnetic Analytic Test Problem - Forward Problem

Computes a magnetic field at 6 "electrodes" from a fixed dipole source located within the sphere for a single time point. The magnetic field is then compared to an analytic solution.


The comfile run by this example is as follows:

#Example i21

$OUT = '.'
if (!defined $example)
{
  $example ='.'
}

$resolution = '2x4'
$resolution = '4x8'

$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( $resolution eq '2x4' ) {
  fem define node;r;$example/sphere_1 reg 1
  fem define elem;r;$example/sphere_1 reg 1
} elsif( $resolution eq '4x8' ) {
  fem define node;r;$example/sphere_2 reg 1
  fem define elem;r;$example/sphere_2 reg 1
}

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

#
# Export geometry
#
fem export node;$OUT/sphere as sphere
fem export elem;$OUT/sphere as sphere
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 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 eval solu magnet grid elem 551 iy 1 both analytic
fem eval solu magnet grid elem 551 iy 1 both

fem export elem;$OUT/xpote as cube field reg 2 class 2 iy 2 grid_numbers
fem export elem;$OUT/ypote as cube field reg 2 class 2 iy 3
fem export elem;$OUT/zpote as cube field reg 2 class 2 iy 4

#
# Combine the 3 scalar field into a single vector field
#
$DXFILENAME="$OUT/xpote.exelem";
$DYFILENAME="$OUT/ypote.exelem";
$DZFILENAME="$OUT/zpote.exelem";
$OUTPUTNAME="$OUT/H_both.exelem";
&WriteGradPhiExelem($DXFILENAME,$DYFILENAME,$DZFILENAME,$OUTPUTNAME);

#
# Export the magnetic field at "electrodes"
#
fem def data;r;$example/elec field num 3
fem eval solu mag data
fem export data;$OUT/elec as elec num_field 3 field_name mag

Additional testing commands:

#Testing example i21

fem li data

Files used by this example are:

Name                       Modified     Size

example_i21.com 20-May-2002 2.3k bicubic.ipbase 20-May-2002 6.8k bilinear.ipbase 20-May-2002 5.7k cube.ipelem 20-May-2002 447 cube.ipgrid 06-Mar-2003 604 cube.ipnode 20-May-2002 2.1k dipole.ipsour 20-May-2002 293 eccentricdipole.ipanal 20-May-2002 720 elec.ipdata 20-May-2002 438 laplace.ipmate 20-May-2002 54 laplace_bem_cubic.ipequa 26-May-2003 1.3k laplace_bem_linear.ipequa 26-May-2003 1.3k laplace_grid.ipequa 26-May-2003 1.2k nosalu_cubic.ipsolv 13-Apr-2007 1.3k nosalu_linear.ipsolv 13-Apr-2007 1.2k perl.com 20-May-2002 2.3k sphere_1.ipelem 20-May-2002 3.1k sphere_1.ipnode 20-May-2002 5.7k sphere_2.ipelem 20-May-2002 11k sphere_2.ipnode 20-May-2002 23k test_output.com 20-May-2002 34 torsotimedep.ippara 12-Nov-2002 5.9k two.ipregi 20-May-2002 93

Download the entire example:

Name                      Modified     Size

examples_i_i2_i21.tar.gz 19-Jan-2011 11k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmSuccessSun Mar 6 00:02:52 20161
cm-debugSuccessSat Mar 5 00:13:35 20164
mips-irix
cmSuccessSun Aug 19 01:42:22 200711
cm-debugSuccessWed Aug 15 01:44:58 200745
cm-debug-clear-mallocSuccessSat Aug 18 02:00:44 200760
cm-debug-clear-malloc7SuccessMon Aug 20 01:55:46 2007121
cm64SuccessSun Aug 19 01:43:01 200711
cm64-debugSuccessTue Aug 21 01:48:25 200751
cm64-debug-clear-mallocSuccessThu Apr 1 12:33:36 200439
rs6000-aix
cmSuccessWed Mar 4 01:08:32 20091
cm-debugSuccessMon Mar 2 01:11:13 200912
cm64SuccessWed Mar 4 01:08:32 20092
cm64-debugSuccessTue Mar 3 01:15:56 200913
x86_64-linux
cmSuccessSun Mar 6 00:01:08 20160
cm-debugSuccessSat Mar 5 00:01:51 20163

Testing status by file:


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

Input last modified: Tue Jan 18 11:26:45 2011


CMISS Help / Examples / i / i2 / i21