Example i22: Magnetic Analytic Test Problem - Inverse Problem

Computes the orientation and location of a single dipole within a sphere given magnetic field recordings at a single time point at 6 "electrode" locations. The dipole from which the original magnetic field were created was located at (0,0,1) and had an orientation of (1,0,0).


The comfile run by this example is as follows:

#Example i22

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

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

$interpolation = 'cubic'
$interpolation = 'linear'

fem define para;r;$example/torsotimedep
fem define coor 3,1
fem define base;r;$example/bi$interpolation
fem define node;r;$example/sphere_$resolution reg 1
fem define elem;r;$example/sphere_$resolution reg 1

#
# Export geometry
#
fem export node;$OUT/sphere  as sphere
fem export elem;$OUT/sphere  as sphere

#
# Setup problem
#
fem define equa;r;$example/laplace_$interpolation reg 1 class 1 lock
fem define mate;r;$example/laplace reg 1 class 1

#
# Solve and export potential due to a dipole
#
fem define sour;r;$example/dipole_true reg 1 class 1
fem de anal;r;$example/eccentricdipole reg 1 class 1
fem de init;g                 reg 1 class 1

fem define solv;r;$example/nosalu_$interpolation reg 1 class 1
fem solve reg 1 class 1
fem export node;$OUT/sphere_pot as sphere field
fem export elem;$OUT/sphere_pot as sphere field

#
# Evaluate input/recorded magnetic field
#
fem def data;r;$example/elec field num_field 3
fem eval solu mag from MFI nss 1
fem li matr matric MFI nss 1 value
fem up data field from MFI nss 1
fem export data;$OUT/input as input field_num 1..3 field_name mag

#
# Adjusted dipole
#
fem define sour;r;$example/dipole_guess reg 1 class 1
fem up source
fem de anal;r;$example/eccentricdipole  reg 1 class 1
fem de init;g                  reg 1 class 1
fem define solv;r;$example/nosalu_$interpolation reg 1 class 1
fem solve                      reg 1 class 1



Additional testing commands:

#Testing example i22

#
# Evaluate adjusted/guess magnetic field
#
fem eval solu mag from MFI nss 2
fem li matr matric MFI nss 2 value
fem up data field from MFI nss 2
fem export data;$OUT/optim as optim field_num 1..3 field_name mag

#
# Optimise
#
fem def opti;r;$example/optimise
fem eval resid wrt magnetic list 1
fem li sour
optimise
fem eval resid wrt magnetic list 1
fem def sour;w;dipole_optim

Files used by this example are:

Name                    Modified     Size

example_i22.com 20-May-2002 1.5k bicubic.ipbase 20-May-2002 6.8k bilinear.ipbase 20-May-2002 5.7k dipole_guess.ipsour 20-May-2002 307 dipole_true.ipsour 20-May-2002 293 eccentricdipole.ipanal 20-May-2002 720 elec.ipdata 20-May-2002 438 laplace.ipmate 20-May-2002 54 laplace_cubic.ipequa 26-May-2003 1.3k laplace_linear.ipequa 26-May-2003 1.3k nosalu_cubic.ipsolv 13-Apr-2007 1.3k nosalu_linear.ipsolv 13-Apr-2007 1.2k optimise.ipopti 03-Aug-2002 1.5k sphere_2x4.ipelem 20-May-2002 3.1k sphere_2x4.ipnode 20-May-2002 5.7k sphere_4x8.ipelem 20-May-2002 11k sphere_4x8.ipnode 20-May-2002 23k sphere_8x16.ipelem 20-May-2002 43k sphere_8x16.ipnode 20-May-2002 100k test_output.com 14-Aug-2002 402 torsotimedep.ippara 12-Nov-2002 5.9k

Download the entire example:

Name                      Modified     Size

examples_i_i2_i22.tar.gz 19-Jan-2011 20k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmSuccessSun Mar 6 00:03:22 20162
cm-debugSuccessSat Mar 5 00:15:10 20166
mips-irix
cmSuccessSun Aug 19 02:38:01 200764
cm-debugSuccessWed Aug 15 02:50:29 2007217
cm-debug-clear-mallocSuccessSat Aug 18 03:09:39 2007220
cm-debug-clear-malloc7SuccessMon Aug 20 03:09:04 2007219
cm64SuccessSun Aug 19 02:41:44 200767
cm64-debugSuccessTue Aug 21 03:14:27 2007230
cm64-debug-clear-mallocSuccessThu Apr 1 12:35:28 2004111
rs6000-aix
cmSuccessWed Mar 4 01:10:05 20094
cm-debugSuccessMon Mar 2 01:20:56 200942
cm64SuccessWed Mar 4 01:10:06 20093
cm64-debugSuccessTue Mar 3 01:24:15 200943
x86_64-linux
cmSuccessSun Mar 6 00:01:09 20161
cm-debugSuccessSat Mar 5 00:01:56 20162

Testing status by file:


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

Input last modified: Tue Jan 18 11:10:04 2011


CMISS Help / Examples / i / i2 / i22