User Tools

Site Tools


pyfemm

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.

www.femm.info_examples_coilgun_coilgun_files_image002.jpgpyFEMM_coilgun_force_sm.png

Figure 1: Plot of force on projectile created by coilgun.py using the Matplotlib package.

DC Magnetics: <html>Demo2</html> Example

Demo2.py builds a coil with an iron core and plots flux density in the core.

pyFEMM_demo2.png

Electrostatics: Microstrip Example

strips.py computes the capacitance of coupled microstrip lines.

pyFEMM_strips.png

Heat Flow: Microstrip Example

htutor.py computes the heat flow through a rectangular chimney.

pyFEMM_chimney.png

Current Flow

ACElec2.py Cylindrical capacitor as described here. pyFEMM_ACElec2.png

DC Magnetics: Roters1b Example

roters1.zip is the same as RotersExample but with a 0.8A coil current. www.femm.info_examples_roters1b_roters1b_files_image002.jpg
pyFEMM_roters_results.png

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 Phase3.png


pyfemm.txt · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki