Electric and magnetic field calculations with finite-element methods

This article is the first in an extended series that constitutes an on-line course in field solution techniques. Field Precision finite-element software covers a broad spectrum of physics and engineering applications, including charged particle accelerators and X-ray imaging. The core underlying most of our software packages is the calculation of electric and magnetic fields over three-dimensional volumes. In this area, our software has high accuracy and achieves the fastest speed of any available 3D package. An important feature for small laboratories, universities and consultants is that the cost is far below that competing products.

Magnetic field analysis with MagView

Figure 1. Magnetic field analysis with MagView.

To use our electric and magnetic fields software effectively, researchers should have a background in electromagnetism and should be able to make informed decisions about solution strategies. First-time users of finite-element software may feel intimidated by these requirements. My motivation in writing this series is to share my 30 years’  experience in field calculations − I hope to build users’ knowledge and experience in steps so they can apply finite-element programs confidently. In the end, readers will be able to solve real-world problems with the following programs:

  • EStat (2D electrostatics)
  • HiPhi (3D electrostatics)
  • PerMag (2D magnetostatics)
  • Magnum (3D magnetostatics)

To begin, it’s important to understand the difference between 2D and 3D programs. All finite-element programs solve fields in three-dimensions, but often systems have geometric symmetries that can be utilized to reduce the amount of work. The term 2D applies to the following cases:

  • Cylindrical systems with variations in r and z but no variation in θ (azimuth)
  • Planar systems with variations in x and y and a long length in z

Which brings us to the first directive of finite-element calculations: never use a 3D code for  a calculation that could be handled by a 2D code. The 3D calculation would increase the complexity and run time with no payback in accuracy.

We need to clarify the meaning of static in electrostatics and magnetostatics. The implication is that the fields are constant or vary slowly in time. The criterion of slow variation is that the systems do not emit electromagnetic radiation. Examples of electrostatic applications are power lines, insulator design, paint coating, ink-jet printing and biological sorting. Magnetostatic applications include MRI magnets, particle separation and permanent magnet devices. A following coarse will cover simulations of electromagnetic radiation (e.g., microwave devices).

Before getting started, it’s important to have a clear understanding of the purpose of computer calculations of electric and magnetic fields. Numerical methods should be used when it is not possible to generate accurate results with analytic methods. Numerical solutions are necessary in the following circumstances:

  • The system has a complex asymmetric geometry
  • The solution volume contains many objects with different material properties
  • Materials have complex properties (e.g., saturation of iron in magnetic circuits)

In an ideal case, a user makes analytic estimates of field values and then applies numerical methods to improve the accuracy. The initial analysis gives an understanding of the physics involved and the anticipated scales of quantities, essential information for effective numerical-solution setups. The worst case is when a user hopes that the program is an omniscient black box that will figure everything out. No matter what software manufacturers claim, using a field program without understanding fields is at best a gamble. Sometimes you may get lucky, but most of the time considerable effort is wasted generating meaningless results.

In summary, I would like to help you become an informed software user. I suggest you start by downloading a free textbook that will help you brush up on electric and magnetic field theory. The book also gives a detailed description of the the FEM techniques I will discuss:

S. Humphries, Finite-element Methods for Electromagnetics (http://www.fieldp.com/femethods.html)
(Originally published by CRC Press)

The next article in the series describes how to download and to setup field-solution software packages for a trial or a purchase.


[1] Contact us : techinfo@fieldp.com.

[2] Field Precision home page: www.fieldp.com.

How to make your computer sound like a typewriter, redux

In a blog last year (How to make your computer sound like a typewriter), I described how to add typewriter sounds to a computer keyboard using Jingle Keyboard freeware. I recorded a sound set from an IBM Selectric and made it available to use with the program. The article, which also touched on why you might want your computer to sound like a typewriter, proved unusually popular. Hence, this year’s extension.

Selectric sounds are fine for a desktop, but what about portables? To fill the gap, I recorded a sound set from the classic, ironically-named Royal Quiet Deluxe, the laptop of the 50s. Figure 1 shows my machine, appropriately covered with WhiteOut spots.

Royal Quiet Deluxe

Figure 1. The Royal Quiet Deluxe.


The original blog explained how to obtain and to install Jingle Keyboard. Here’s how to install the new sounds. Download and unzip this file (RoyalQuietDeLuxe.zip) to create a directory RoyalQuietDeluxe that contains nine WAV sound files for the typewriter operations supported in Jingle Keyboard.

  1. Move the RoyalQuietDeluxe directory to C:\Program Files (x86)\Jingle Keyboard\Sounds\.
  2. If necessary, un-mute Jingle Keyboard.
  3. Right-click on the tray icon and choose Preferences.
  4. Choose the Other tab. Un-check the box if you don’t want the program to run at StartUp. It may take a couple starts to get the idea.
  5. Click the Sounds tab to show the display of Fig. 2, my recommended settings. Un-check the mouse button operations (whoever heard of a typewriter with a mouse?).
  6. Choose each of the 10 other operations in sequence. Click the Find sound button, navigate to the Sounds/RoyalQuietDeluxe directory and pick the corresponding WAV file. (I used Arrows.wav for the function keys.)
  7. Click the Save as button in the Sound scheme box, supply the name RoyalQuietDeluxe and save the scheme. This option will be used as the default. Any future changes you make to the scheme are automatically saved — there is no need to use the Save as button again.
Preferences dialog in Jingle Keyboard

Figure 2. Preferences dialog in Jingle Keyboard.


[1] Contact us : techinfo@fieldp.com.

[2] Field Precision home page: www.fieldp.com.

FP File Organizer: new feature

I feel there are two programs that are essential for efficient use of a personal computer:

  • text editor
  • two-window file manager

Regarding text editors, people who use NotePad or Word may as well tie a cement block to their mouse. The freeware ConText editor is such a good choice that I would not attempt to duplicate its function. On the other hand, I have created a freeware file manager, FP File Organizer. The idea was to incrementally add all the features I ever wanted in a file manager. For example:

  • A clear and logical layout of controls makes FP File Organizer quick to learn and easy to use. There is no menu or toolbar. Navigation commands are grouped at the top while file-operation buttons occupy the space between the windows. Advanced features that are used less frequently are called from a popup menu.
  • A Backup command makes it easy to coordinate code and documents between computers via a USB drive. The command copies files and replaces files only if the source has a more recent modification time. The user has the option to generate a text log of changes made.
  • Several advanced functions are useful for data organization (e.g., create text listings of directory contents, determine directory sizes, copy full file paths to the clipboard, launch a terminal window in the current directory, show the total available storage,…).
  • Users can define custom commands with pass parameters to run external programs.

The program has had the capability to save frequently-accessed file locations (paths) in a list. Clicking the Add location button adds the currently-active directory to the list. The Saved locations button brings up a dialog showing the list with the option to go to any of the entries. In a year’s use of the File Organizer, I found that I was not using the feature, instead wasting time navigating to common locations. I decided that a list of paths was not something that compelled your interest, so I added the option to personalize entries.

Saved locations dialog

Figure 1. Saved locations dialog.

Figure 1 shows the new look of the Saved locations dialog. Anticipating that users will define more entries, the dialog is now resizable The Path column has been supplemented with a Name column. When a location is added, the program creates a name based on the lowest level of the path . Users can edit the names to make them more descriptive of the function or content of the directory. It is possible to arrange the locations by dragging the entries or automatically alphabetizing them by name. The active directory can be switched to a saved location by double-clicking the name or path. Finally, both the names and the paths are preserved in the configuration file between sessions.

The FP File Organizer is available at no charge at http://www.fieldp.com/fpfileorganizer.html. There are no ads in the full-functioned program and the installer does not add hidden programs or taskbars. Even if you already have a favorite file manager, the special features our program make it a good supplement.


[1] Contact us : techinfo@fieldp.com.

[2] Field Precision home page: www.fieldp.com.

Parallel processing optimization

The Professional version of the 3D field-solution programs Aether, HiPhi, Magnum, HeatWave, RFE3 and field updates in OmniTrak use parallel processing routines of OpenMP to achieve significant reductions in run-time on multi-core computers. Some users have reported that the programs sometimes fail to implement parallel processing. This article addresses two topics:

  • The limitations of parallel processing and how our programs avoid memory conflicts.
  • Modifications to the programs in the most recent version to ensure that they utilize the full parallel-processing capabilities of the computer.

Consider the application of parallel processing in a boundary-value field solution (e.g., HiPhi, Magnum,…). The discrete form of the partial differential equations are solved by an iterative method where values of the primary function (e.g., electrostatic potential, reduced potential,…) are corrected to comply with values on neighboring mesh points. An optimal method alternately corrects odd and even mesh points. It is not necessary to proceed in sequence. Different parts of the mesh may be corrected simultaneously — hence, the appeal of parallel processing. The constraint is that two processes may not change the same mesh memory location simultaneously. Because our programs use structured conformal meshes, an easy and efficient solution is to assign processes to different layers of the mesh along the z direction (index K). Each process works in tandem from the top to the bottom of its assigned layer so there is no danger of overlap.

There are two reasons why we need to avoid thin processing layers:

  • There is overhead associated with MP organization, so that increasing the number of processors may give diminishing returns. For example, little speed advantage is gained by assigning three processors to layers two indices thick verses one processor to a layer with ΔK = 6.
  • A safety factor is necessary to ensure that there is never a memory overlap.

For these reasons, we set the minimum processor layer thickness to ΔK= 5. In previous versions, the programs simply skipped a parallel calculation if

ΔK = Kmax/NProc ≤ 5.

(Here, NProc is the number of processors requested in the PARALLEL command.) In this case, parallel processing would appear to fail if a solution had large dimensions in x-y, small dimension in z and the user specified a large value of NProc.

To eliminate the sometimes mysterious behavior, the current programs use the following logic.

  1. If NProc = 1, the program performs a non-parallel calculation.
  2. If NProc > 1, the program calculates the quantity NProcMax = Kmax/5. If NProc ≤ NProcMax, the program opens NProc processes. Otherwise, the number of processes equals NProcMax.

In this way, the program uses the maximum number of processors consistent with avoiding memory overlap.


[1] Contact us : techinfo@fieldp.com.

[2] Field Precision home page: www.fieldp.com.

Converting video formats

This year’s major project at Field Precision is educational — a full-length video course on how to calculate static electric and magnetic fields with finite-element methods. Of course, the sub-context is the essential techniques and insights to use our software effectively (e.g., how to design meshes for maximum speed and accuracy…).

In preparation, I updated my copy of Camtasia to the latest version (8.4). I use the program to capture events on the computer screen and for general video editing. There were many improvements since I purchased Version 6.0, so the update was well worth the cost. I also got a good webcam and an entry-level  camcorder with plenty of features for the application. Even though the JVC GZ-EX210 cost less than $130, it provides resolution up to 1920×1080 pixels.

Of course, issues arose. The camcorder creates downloadable interleaved video/audio streams in MTS format (H264 video, AC3 audio). Camtasia refuses to import the files directly. An error message appears in the program that directs you to a particularly unhelpful help site. The only workable option was to download a video converter to change files to a format recognized by Camtasia, such as AVI.

The video converters available on the Internet constitute a particularly nasty snake pit, so I will offer some useful tips in this article. A basic search for video-converter software yields an infinity of options, mostly pay-for programs and misleading “download for free programs” (yes, you can download them for free, but they won’t work for free). After further searching, I found the article Top free video converters (Tomas Ondik, 02/13/2012) that lists seven freeware programs for Windows: Freemake Video Converter, Any Video Converter, Format Factory, Free Studio, Koyote Free Video Converter, 4Free Video Converter and Hamster Free Video Converter. I tried them all.

The Ondik article did not list links, so I searched for download sites. Here, you have to be cautious. If you can’t find the official site, you can run into problems — download sites like CNet use other people’s freeware and attach toolbars and other plague-ware via special downloaders.

Here is my assessment of the seven programs. First, the rejects:

  • Format Factory: no longer available.
  • Free Studio: to be avoided vigorously. Not only does it try to install plague-ware, but it adds hidden programs that are almost impossible to remove (thankfully I had WinPatrol Plus to provide warnings).
  • Koyote: I got so tired of un-checking the multiple plague-ware options that I cancelled the install.
  • Hamster: halfway through, the installer displays a terrifying screen of Cyrillic characters.

Three programs worked well and could qualify as freeware. The links point to their official sites:

In all cases, choose the Custom install option so you can uncheck plague-ware. All programs produced AVI files of comparable quality that were recognized by Camtasia. 4Free is relatively slow and displays an exhortation to upgrade ($29.95) every time you make a conversion. AnyVideoConverter also encouraged you to upgrade with each conversion. The program had extensive options to make files for specific tablets and phones, a feature I wouldn’t need. Their Ultimate package ($49.95) allows you to appropriate DVDs and NetFlix streams. For my application, FreeMake was the best choice. It had a simple interface and made quick conversions. I gave the $9.99 suggested donation to support their development.

Finally, many Internet pages suggest that VLC Media Player can be used for video conversions. I doubt this is true. The sequence of operations is counter-intuitive, and all my attempts at converting the MTS files to AVI produced output with audio but no video.


[1] Contact us : techinfo@fieldp.com.

[2] Field Precision home page: www.fieldp.com.