pyFEMM -- A Python Interface to FEMM
pyFEMM is a Python interface to Finite Element Method Magnetics (FEMM). The module uses win32com to communicate with FEMM's out-of-proc activex server. The functions in the module wrap interactions with FEMM, making it easy to script FEMM from a Python program.
FEMM is available from the Download page.
The pyFEMM package is available for download here or from PyPI.
Documentation is available at https://www.femm.info/wiki/pyFEMM/manual.pdf
Versions:
v0.1.3, 20Jul2021
- Support for non-Windows machine using a file-based message passing scheme like the one used by FEMM to support legacy or Linux and Mac version of Octave (big thanks to Melina Merkel)
- Fixed an error in the "doargs" function that broke complex numbers being returned by FEMM
- Fixed a bug in "ci_setnodeprop"
- Added "mi_setcomment", "ei_setcomment", "hi_setcomment", and "ci_setcomment" functions to allow the comment field in the problem definition to be programmatically defined
v0.1.1, 11May2020
Bug fix update.
- Fixed errors in the implementation of ci_smartmesh, mi_smartmesh, ei_smartmesh, and hi_smartmesh functions
- Fixed error in mo_showcontourplot
v0.1.0, 17Mar2018
Initial release.
Examples
Several examples show how to use Python to do scripting with FEMM. Most of these examples are presented in Matlab, Mathematica, and Scilab formats in the examples directory of the FEMM distribution.
DC Magnetics: Coilgun Example
Coilgun.zip contains a Python script and a FEMM model for the problem discussed on the CoilGun page. The Python script is a port of the original Lua version. The Matplotlib package is used to make a Matlab-like plot of the resulting forces projectile.
Figure 1: Plot of force on projectile created by coilgun.py using the Matplotlib package.
DC Magnetics: Demo2 Example
Demo2.py builds a coil with an iron core and plots flux density in the core.
Electrostatics: Microstrip Example
strips.py computes the capacitance of coupled microstrip lines.
Heat Flow: Microstrip Example
htutor.py computes the heat flow through a rectangular chimney.
Current Flow
ACElec2.py
Cylindrical capacitor as described here.
DC Magnetics: Roters1b Example
roters1.zip is the same as RotersExample but with a 0.8A coil current.
AC Magnetics: 3-Phase Power Line Example
Phase3.py models a three-phase power line in an unbounded region carrying balanced currents. The script returns the per-meter impedance of each line:
The per-meter 60Hz impedance of each line is 3.807e-05+0.0001629j Ohms
File | Last modified | Size |
---|---|---|
ACElec2.py | 2018-03-20 22:12 | 2Kb |
Phase3.py | 2021-07-17 17:24 | 1Kb |
ReturnErrorMsg.py | 2021-07-17 19:44 | 91b |
coilgun.zip | 2018-03-19 22:57 | 1Kb |
demo2.py | 2018-03-19 22:57 | 4Kb |
htutor.py | 2018-03-20 21:51 | 2Kb |
pyfemm-0.1.0.tar.gz | 2018-03-21 18:38 | 12Kb |
pyfemm-0.1.1.tar.gz | 2020-05-11 19:02 | 13Kb |
pyfemm-013.zip | 2021-07-20 20:16 | 17Kb |
pyfemm-manual.pdf | 2021-07-20 20:19 | 826Kb |
roters1b.zip | 2018-03-21 18:29 | 2Kb |
strips.py | 2018-03-20 20:15 | 5Kb |