Skip to main content

MagnetiCalc calculates the magnetic field of arbitrary loops of wire.

Project description

MagnetiCalc

License: ISC Donate API Documentation PyPI version

What does MagnetiCalc do?

MagnetiCalc calculates the magnetic field of arbitrary air coils, examples included. Inside a VisPy-accelerated PyQt5 GUI, the static magnetic flux density (B-field due to DC currents) is displayed in interactive 3D, using multiple metrics for highlighting this field's properties. All parameters and presets can interactively be changed inside the GUI.

Who needs MagnetiCalc?

MagnetiCalc does its job for hobbyists, students, engineers and researchers of magnetic phenomena. I designed MagnetiCalc from scratch, because I didn't want to mess around with expensive and/or overly complex simulation software whenever I needed to solve a magnetostatic problem.

How does it work?

The field calculation is implemented using the Biot-Savart law [1], employing multiprocessing techniques. The use of easily constrainable "sampling volumes" allows for selective calculation over arbitrary shapes.

The shape of any wire is modeled as a 3D piecewise linear curve. Arbitrary loops of wire are sliced into differential current elements, each of which contributes to the total magnetic flux density at some fixed 3D grid point.

At each grid point, the field is displayed using colored arrows and/or dots; field color and alpha transparency are individually mapped using one of the various available metrics.

[1]: Jackson, Klassische Elektrodynamik, 5. Auflage, S. 204, (5.4).

Screenshot

Example

(Screenshot taken from the latest GitHub release.)

Installation

Tested with Python 3.8 in Ubuntu 20.04.

Prerequisites

The following dependency packages have to be installed first (Ubuntu 20.04):

sudo apt install python3-dev
sudo apt-get install --reinstall libxcb-xinerama0

Option A: Automatic install via pip

Install MagnetiCalc to the user site-packages directory and start it from there:

pip3 install magneticalc
python3 -m magneticalc

Option B: Manual download

Clone the latest version of MagnetiCalc from GitHub and start it directly:

pip3 install --upgrade PyQt5 qtawesome vispy matplotlib numpy colorit si-prefix
git clone https://github.com/shredEngineer/MagnetiCalc
cd MagnetiCalc
python3 -m magneticalc

For debugging, you may also install / uninstall the package in a virtual environment:

pip install .
…
pip uninstall magneticalc -y

ToDo

  • Add support for adding, editing and removing sampling volume constraints; the SamplingVolume module already supports constraints, but the GUI currently doesn't.
  • Add support for calculation of compensation factor, i.e. the ratio of total vector sum to metric limits.
  • Add support for calculation of self-inductance; a loop detector creates polygons over which the B-field is integrated, yielding the loop magnetic flux .
  • Add support for different media with arbitrary geometry and permeability.
  • Add support for multiple wires, study mutual induction.
  • Add support for vector potential (A-field) and electric E-field calculation.
  • Move the field and metric calculations directly to the OpenGL shader engines, thus most likely drastically shortening overall computation time.

Contribute

You are invited to contribute to MagnetiCalc in any way you like! :)

If this software has been helpful to you in some way or another, please let me and others know!

License

Copyright © 2020, Paul Wilhelm, M. Sc. <anfrage@paulwilhelm.de>

ISC License

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

MagnetiCalc-1.5.4.tar.gz (36.2 kB view hashes)

Uploaded Source

Built Distribution

MagnetiCalc-1.5.4-py3-none-any.whl (62.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page