EMfield - a perl program to simulate magnetic fields

Back 

$> EMfield.pl

EMfield.pl: Program to calculate the magnetic field
            of conducting lines (in 2D)

* * *   Version 0.25, written by Michael Panhorst    * * *


    USAGE:
    ------
    EMfield.pl -f <Input text file>
    EMfield.pl -p <Input picture>



Example Input text file:

# Input textfile for EMField Programm!

package EM ;

# Define the Matrix-size:

$MatrixWidth = 100 ;
$MatrixHeight = 100 ;


# Define the Current through all lines

$Current = 100 ;   # in mA


# Define the GridWidth

$GridWidth = 50 ; # in nm


# How many Iteration per Gridwidth

$Iteration = 10 ;


# Define the thickness of the conducting lines

$Thickness = 200 ; # in nm


# Define the conducting lines (The Matrix is zero-indexed!):
# First two vars is the startplace , second two vars is the endpoint
# 5th var is the width of the line (in nm)

$Lines = {
#Straight line
   'straight1' => [ 99 , 90 , 0 , 90 ],
#round line
   'round2' => [ 10 ,  0 , 18 , 60 ],
   'round3' => [ 18 , 60 , 30 , 85 ],
   'round4' => [ 30 , 85 , 40 , 86 ],
   'round5' => [ 40 , 86 , 43 , 88 ],
   'round6' => [ 43 , 88 , 47 , 88 ],
   'round7' => [ 47 , 88 , 50 , 86 ],
   'round8' => [ 50 , 86 , 60 , 85 ],
   'round9' => [ 60 , 85 , 82 , 60 ],
   'round10' => [ 82 , 60 , 90 , 0 ]

};

EMfield

This program uses the PDL and PDL::Graphics libraries to calculate the magnetic field of a current through a conducting line, and to present the result as a coloured image (see section 1.4 for a comprehensive description of the program).

Check out the source code.
Perl (version> 5.6), the PDL, the PDL::Graphics::LUT, PDL::Graphics::PGPLOT and the PDL::IO::Dumper libraries have to be installed.

EMfield runs on GNU/Linux.