Git Product home page Git Product logo

shredengineer / magneticalc Goto Github PK

View Code? Open in Web Editor NEW
41.0 2.0 4.0 17.07 MB

MagnetiCalc calculates the magnetic field of arbitrary coils.

Home Page: https://paulwilhelm.de/magneticalc/

License: Other

Python 99.25% Shell 0.75%
magnetic-field field-calculation simulation-modeling engineering education flux-density vector-potential inductance wire coil gui interactive visualization magnetostatics current metric linux python cuda jit

magneticalc's Introduction

MagnetiCalc

PyPI version License: ISC Donate Documentation

🍀 Always looking for beta testers!

What does MagnetiCalc do?

MagnetiCalc calculates the static magnetic flux density, vector potential, energy, self-inductance and magnetic dipole moment of arbitrary coils. Inside an OpenGL-accelerated GUI, the magnetic flux density (B-field, in units of Tesla) or the magnetic vector potential (A-field, in units of Tesla-meter) is displayed in interactive 3D, using multiple metrics for highlighting the field properties.

Experimental feature: To calculate the energy and self-inductance of permeable (i.e. ferrous) materials, different core media can be modeled as regions of variable relative permeability; however, core saturation is currently not modeled, resulting in excessive flux density values.

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 B-field calculation is implemented using the Biot-Savart law [1], employing multiprocessing techniques; MagnetiCalc uses just-in-time compilation (JIT) and, if available, GPU-acceleration (CUDA) to achieve high-performance calculations. Additionally, the use of easily constrainable "sampling volumes" allows for selective calculation over grids of arbitrary shape and arbitrary relative permeabilities µ_r(x) (experimental).

The shape of any wire is modeled as a 3D piecewise linear curve. Arbitrary loops of wire are sliced into differential current elements (l), each of which contributes to the total resulting field (A, B) at some fixed 3D grid point (x), summing over the positions of all current elements (x'):



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

The coil's energy E [2] and self-inductance L [3] are calculated by summing the squared B-field over the entire sampling volume; ensure that the sampling volume encloses a large, non-singular portion of the field:



Additionally, the scalar magnetic dipole moment m [4] is calculated by summing over all current elements:


References

[1]: Jackson, Klassische Elektrodynamik, 5. Auflage, S. 204, (5.4).
[2]: Kraus, Electromagnetics, 4th Edition, p. 269, 6-9-1.
[3]: Jackson, Klassische Elektrodynamik, 5. Auflage, S. 252, (5.157).
[4]: Jackson, Klassische Elektrodynamik, 5. Auflage, S. 216, (5.54).

Screenshot

Screenshot

(Screenshot taken from the latest GitHub release.)

Examples

Some example projects can be found in the examples/ folder.

If you feel like your project should also be included as an example, you are welcome to file an issue!

Installation

If you have trouble installing MagnetiCalc, make sure to file an issue so I can help you get it up and running!

Requirements:

  • Python 3.6+

Tested with:

  • Python 3.7 in Linux Mint 19.3
  • Python 3.8 in Ubuntu 20.04
  • Python 3.8.2 in macOS 11.6 (M1)
  • Python 3.8.10 in Windows 10 (21H2)
  • Python 3.10.5 in Ubuntu 20.04

Prerequisites

On some systems, it may be necessary to upgrade pip first: python3 -m pip install pip --upgrade

Note: Windows users need to type python instead of python3

Linux

The following dependencies must be installed first (Ubuntu 20.04):

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

Windows

It is recommended to install Python 3.8.10. Installation will currently fail for Python 3.9+ due to missing dependencies.

On some systems, it may be necessary to install the latest Microsoft Visual C++ Redistributable first.

macOS (M1)

On Apple Silicon, Open Using Rosetta must be enabled for the Terminal app before installing (upgrading) and starting MagnetiCalc.

Option A: Automatic install via pip

This will install (upgrade) MagnetiCalc (and its dependencies) to the user site-packages directory and start it.

PyPI version

Linux & macOS (Intel)

python3 -m pip install magneticalc --upgrade
python3 -m magneticalc

Windows

python -m pip install --upgrade magneticalc
python -m magneticalc

macOS (M1)

Note: On Apple Silicon, JIT must be disabled due to incomplete support, resulting in slow calculations.

python3 -m pip install magneticalc --upgrade
export NUMBA_DISABLE_JIT=1 && python3 -m magneticalc

Juptyer Notebook & Jupyter Lab

From within a Jupyter Notebook, MagnetiCalc can be installed (upgraded) and run like this:

import sys
!{sys.executable} -m pip install magneticalc --upgrade
!{sys.executable} -m magneticalc

Option B: Manual download

Note: Windows users need to type python instead of python3.

Install (upgrade) all dependencies to the user site-packages directory:

python3 -m pip install numpy numba scipy PyQt5 vispy qtawesome sty si-prefix h5py --upgrade

Use Git to clone the latest version of MagnetiCalc from GitHub:

git clone https://github.com/shredEngineer/MagnetiCalc

Enter the cloned directory and start MagnetiCalc:

cd MagnetiCalc
python3 -m magneticalc

Enabling CUDA Support

Tested in Ubuntu 20.04, using the NVIDIA CUDA 10.1 driver and NVIDIA GeForce GTX 1650 GPU.

Please refer to the Numba Installation Guide which includes the steps necessary to get CUDA up and running.

License

Copyright © 2020–2022, Paul Wilhelm, M. Sc. <[email protected]>

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.

License: ISC

Contribute

You are invited to contribute to MagnetiCalc!

General feedback, Issues and Pull Requests are always welcome.

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

Donate

Documentation

The documentation for MagnetiCalc is auto-generated from docstrings in the Python code.

Documentation

Debugging

If desired, MagnetiCalc can be quite verbose about everything it is doing in the terminal:

  • Some modules are blacklisted in Debug.py, but this can easily be changed.
  • Some modules also provide their own debug switches to increase the level of detail.

Data Import/Export and Python API

GUI

MagnetiCalc allows the following data to be imported/exported using the GUI:

  • Import/export wire points from/to TXT file.
  • Export A-/B-fields, wire points and wire current to an HDF5 container for use in post-processing.
    Note: You could use Panoply to open HDF5 files. (The "official" HDFView software didn't work for me.)

API

The API class (documentation) provides basic functions for importing/exporting data programmatically.

Example: Wire Export

Generate a wire shape using NumPy and export it to a TXT file:

from magneticalc import API
import numpy as np

wire = [
    (np.cos(a), np.sin(a), np.sin(16 * a) / 5)
    for a in np.linspace(0, 2 * np.pi, 200)
]

API.export_wire("Custom Wire.txt", wire)

Example: Field Import

Import an HDF5 file containing an A-field and plot it using Matplotlib:

from magneticalc import API
import matplotlib.pyplot as plt

data = API.import_hdf5("examples/Custom Export.hdf5")
axes = data.get_axes()
a_field = data.get_a_field()

ax = plt.figure(figsize=(5, 5), dpi=150).add_subplot(projection="3d")
ax.quiver(*axes, *a_field, length=1e5, normalize=False, linewidth=.5)
plt.show()

The imported data is wrapped in a MagnetiCalc_Data object (documentation) which provides convenience functions for accessing, transforming and reshaping the data:

Method Description
.get_wire_list() Returns a list of all 3D points of the wire.
.get_wire() Returns the raveled wire points as three arrays.
.get_current() Returns the wire current.
.get_dimension() Returns the sampling volume dimension as a 3-tuple.
.get_axes_list() Returns a list of all 3D points of the sampling volume.
.get_axes() Returns the raveled sampling volume coordinates as three arrays.
.get_axes(reduce=True) Returns the axis ticks of the sampling volume.
.get_a_field_list()
.get_b_field_list()
Returns a list of all 3D vectors of the A- or B-field.
.get_a_field()
.get_b_field()
Returns the raveled A- or B-field coordinates as three arrays.
.get_a_field(as_3d=True)
.get_b_field(as_3d=True)
Returns a 3D field for each component of the A- or B-field, indexed over the reduced axes.

ToDo

Functional

  • Add a histogram for every metric.
  • Add an overlay for vector metrics, like gradient or curvature (derived from the fundamental A- and B-fields).
  • Add a list of objects, for wires and permeability groups (constraints), with a transformation pipeline for each object; move the Wire widget to a dedicated dialog window instead. (Add support for multiple wires, study mutual induction.)
  • Interactively display superposition of fields with varying currents.
  • Add (cross-)stress scalar metric: Ratio of absolute flux density contribution to actual flux density at every point.
  • Highlight permeability groups with in the 3D view.
  • Add support for multiple current values and animate the resulting fields.
  • Add support for modeling of core material saturation and hysteresis effects.
  • Provide a means to emulate permanent magnets.

Usability

  • Move variations of each wire preset (e.g. the number of turns) into an individual sub-menu; alternatively, provide a dialog for parametric generation.
  • Add stationary coordinate system and ruler in the bottom left corner.
  • Add support for selective display over a portion of the metric range, enabling a kind of iso-contour display.
  • HDF5 container export from command line, without opening the GUI.

Known Bugs

  • Fix issue where the points of a sampling volume with fractional resolution are not always spaced equidistantly for some sampling volume dimensions.
  • Fix calculation of divergence right at the sampling volume boundary.
  • Fix missing scaling of VisPy markers when zooming.
  • Fix unnecessary shading of VisPy markers.

Performance

  • Parallelize sampling volume calculation which is currently slow.

Code Quality

  • Add unit tests.

Video

A very short demo of MagnetiCalc in action:

Magnetic Field Calculation with Python (MagnetiCalc)

Links

There is also a short article about MagnetiCalc on my personal website: paulwilhelm.de/magneticalc

Appendix: Metrics

Metric Symbol Description
Magnitude Magnitude in space
Magnitude X Magnitude in X-direction
Magnitude Y Magnitude in Y-direction
Magnitude Z Magnitude in Z-direction
Magnitude XY Magnitude in XY-plane
Magnitude XZ Magnitude in XZ-plane
Magnitude YZ Magnitude in YZ-plane
Divergence Divergence
Divergence + Positive Divergence
Divergence – Negative Divergence
Log Magnitude Logarithmic Magnitude in space
Log Magnitude X Logarithmic Magnitude in X-direction
Log Magnitude Y Logarithmic Magnitude in Y-direction
Log Magnitude Z Logarithmic Magnitude in Z-direction
Log Magnitude XY Logarithmic Magnitude in XY-plane
Log Magnitude XZ Logarithmic Magnitude in XZ-plane
Log Magnitude YZ Logarithmic Magnitude in YZ-plane
Log Divergence Logarithmic Divergence
Log Divergence + Positive Logarithmic Divergence
Log Divergence – Negative Logarithmic Divergence
Angle XY Field angle in XY-plane
Angle XZ Field angle in XZ-plane
Angle YZ Field angle in YZ-plane

magneticalc's People

Contributors

cschisholm avatar shredengineer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

magneticalc's Issues

Replicating an air coil

Hello Sir,
Not an issue, but a question instead. Is there any way to copy the loops from the Magpy package to the GUI Magnetic Calc? I tried looking at the documentation for Magpy, but I cannot get every (X,Y,Z) coordinate every loop creates.
Below I attached a video of one loop I created (Magpy)- and in your GUI, I must specify every X,Y, and Z coordinates to form a loop like the one below, either manually or via a text file, and this becomes tedious for me since I am unable to get every coordinate to perfectly copy the loop from Magpy to MagnetiCalc.

loop.mp4

Feature request: loading and saving of data

I found the user interface very intuitive and the calculation seems efficient on my CPU (I don't have a GPU in my laptop).
To enhance usability, I would suggest two changes:

  1. Allow loading a wire by points defined in a text file.
  2. Allow saving the calculated field to a file (I recommend hdf5 for this use case, see below).

Both of these features would allow computation of complex current geometries. The first allowing one to use numpy (or whatever else) to define the coils numerically and then load in the points without having to fill the table by hand. The second would allow one to take the calculated fields of different sets of coils and combine them with the superposition principle and also calculate quantities such as curvature.

Why I think hdf5 is the most suitable file format:
First, the h5py library is excellent for reading and writing these file types.
The file is structured like a dictionary in Python.
Imagine that the evaluation volume is defined by X, Y, Z = numpy.meshgrid(x,y,z) and we have the calculated fields, A and B, which each have three components: A = (A_x, A_y, A_z), B = (B_x, B_y, B_z).
We construct a dictionary
fields = {'x': x, 'y': y, 'z': z, 'A_x': A_x, 'A_y': A_y, 'A_z': A_z, 'B_x': B_x, 'B_y': B_y, 'B_z': B_z}
We can also take the geometry of the wire from Points (here I write xp, yp, zp, I haven't checked the source code for the actual variable names). Let's assume these are the points after stretch and rotate
points = {'x': xp, 'y': yp, 'z': zp}
data = {'fields': fields, 'points': points, 'current': wirecurrent}
To write it in a .h5 file we do

import h5py

def Dict2Group(h5group,data):
    keys = data.keys()
    for key in keys:
        if (isinstance(data[key],dict)):
            group = h5group.create_group(key)
            Dict2Group(group,data[key])
        else:
            h5group[key] = data[key]
    return

f = h5py.File(filename,'w')
Dict2Group(f,data)
f.close()

Then, all of the information which the user could possibly want is saved in one single file for later processing.

Bug: Crashes with open loops

Description: When calculating the field with loops where the end point is not the same as the start point, the program crashes just after the calculation finishes

WARNING: Traceback (most recent call last):
  File "<filter>/.local/lib/python3.7/site-packages/magneticalc/CalculationThread.py", line 180, in on_parameters_valid
    self.gui.model.on_parameters_valid()
  File "<filter>/.local/lib/python3.7/site-packages/magneticalc/Model.py", line 269, in on_parameters_valid
    self.gui.sidebar_right.parameters_widget.update_labels()
  File "<filter>/.local/lib/python3.7/site-packages/magneticalc/Parameters_Widget.py", line 154, in update_labels
    self.energy_units_label.setText(energy_value.split(" ")[1])
IndexError: list index out of range
Aborted (core dumped)

The problem is coming from update_labels in Parameters_Widget.py. Perhaps changing line 154 to self.energy_units_label.setText(energy_value.split(" ")[-1]) would fix it. Otherwise a try-catch might be required.

Platform:

Kernel: 5.4.0-91-generic x86_64
bits: 64
compiler: gcc v: 7.5.0
Desktop: Cinnamon 4.4.8
Distro: Linux Mint 19.3 Tricia base: Ubuntu 18.04 bionic
Python 3.7.4

Also tested (less thoroughly) with Windows 10 and Python 3.8. Both installed via pip.

Minimal example

[DEFAULT]
version = MagnetiCalc v1.9
backend = 0
auto_calculation = True
num_cores = 0
wire_points_base = -0.500000, +0.000000, +0.000000; +0.500000, +0.000000, +0.000000
wire_stretch = 0.1000, 1.0000, 1.0000
wire_slicer_limit = 0.0500
wire_dc = 1.0000
rotational_symmetry_count = 30
rotational_symmetry_radius = 1.0000
rotational_symmetry_axis = 2
rotational_symmetry_offset = 0
sampling_volume_padding = 1, 1, 1
sampling_volume_resolution_exponent = 3
sampling_volume_label_resolution_exponent = 0
field_type = 1
field_distance_limit = 0.0008
color_metric = Log Magnitude
alpha_metric = Magnitude
field_point_scale = 0.0000
field_arrow_head_scale = 0.7500
field_arrow_line_scale = 0.7500
field_boost = 0.0000
display_field_magnitude_labels = True
show_wire_segments = True
show_wire_points = True
show_colored_labels = True
show_coordinate_system = True
show_perspective_info = True
dark_background = True
azimuth = 135
elevation = 35.264389682754654
scale_factor = 3.0000
constraint_count = 0

[User]
auto_calculation = False
rotational_symmetry_count = 1
rotational_symmetry_radius = 0.0000
rotational_symmetry_axis = 2
rotational_symmetry_offset = 0.0000
wire_stretch = +1.000000, +1.000000, +1.000000

Feature Request: Manual override of sampling volume

It would be nice to allow the user to choose the bounds of the sampling volume rather than always creating a volume big enough to cover the coils.
This would be useful in the case of large coils where the user only needs to know the field close to the origin so that the number of points computed can be greatly reduced.

AttributeError: 'CanvasBackend' object has no attribute 'setFocusPolicy' GUI.quit()

Hello,

I've installled it and want to start.

python3 -m pip install magneticalc --upgrade
python3 -m magneticalc

That's the Error log:

MagnetiCalc v1.8.6
Copyright © 2020, Paul Wilhelm, M. Sc. <mailto:[email protected]>
ISC License (see README.md)


main/GUI: Init
main/__init__/Config.set_filename: file:///home/kris/MagnetiCalc/MagnetiCalc.ini
main/__init__/Config.load()
main/__init__/Model: Init
main/__init__/__init__/__init__/Wire_Widget.reinitialize()
main/__init__/__init__/__init__/reinitialize/set_wire/ModelAccess.enter()
main/__init__/__init__/__init__/reinitialize/set_wire/Wire: Init
main/__init__/__init__/__init__/reinitialize/set_wire/__init__/Wire.stretch()
main/__init__/__init__/__init__/reinitialize/set_wire/__init__/Wire._set_rotational_symmetry()
main/__init__/__init__/__init__/reinitialize/set_wire/ModelAccess.exit()
main/__init__/__init__/__init__/SamplingVolume_Widget.reinitialize()
main/__init__/__init__/__init__/reinitialize/Constraint_Editor.reinitialize()
main/__init__/__init__/__init__/reinitialize/set_sampling_volume/ModelAccess.enter()
main/__init__/__init__/__init__/reinitialize/set_sampling_volume/SamplingVolume: Init
main/__init__/__init__/__init__/reinitialize/set_sampling_volume/SamplingVolume_Widget.readjust()
main/__init__/__init__/__init__/reinitialize/set_sampling_volume/ModelAccess.exit()
main/__init__/__init__/__init__/Field_Widget.reinitialize()
main/__init__/__init__/__init__/reinitialize/set_field/ModelAccess.enter()
main/__init__/__init__/__init__/reinitialize/set_field/Field: Init
main/__init__/__init__/__init__/reinitialize/set_field/ModelAccess.exit()
main/__init__/__init__/__init__/Metric_Widget.reinitialize()
main/__init__/__init__/__init__/reinitialize/set_metric/ModelAccess.enter()
main/__init__/__init__/__init__/reinitialize/set_metric/Metric: Init
main/__init__/__init__/__init__/reinitialize/set_metric/ModelAccess.exit()
main/__init__/__init__/__init__/Parameters: Init
main/__init__/__init__/__init__/Display_Widget.reinitialize()
main/__init__/__init__/__init__/reinitialize/Display_Widget.update_label_resolution_combobox()
WARNING: Although PyQt5 is already imported, the PyQt5 backend could not
be used ("cannot import name 'QtOpenGL' from 'PyQt5' (/usr/lib/python3/dist-packages/PyQt5/__init__.py)"). 
Note that running multiple GUI toolkits simultaneously can cause side effects.

(python3:52051): Gtk-WARNING **: 18:42:24.449: gtk_disable_setlocale() must be called before gtk_init()
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/kris/MagnetiCalc/magneticalc/__main__.py", line 49, in <module>
    main()
  File "/home/kris/MagnetiCalc/magneticalc/__main__.py", line 39, in main
    gui = GUI()
  File "/home/kris/MagnetiCalc/magneticalc/GUI.py", line 84, in __init__
    self.vispy_canvas.native.setFocusPolicy(Qt.NoFocus)  # Don't let VisPy gain control -- handle all events in GUI
AttributeError: 'CanvasBackend' object has no attribute 'setFocusPolicy'
GUI.quit()

Goodbye!

Any Ideas?

Pip version doesn't launch

When installed via pip the program doesn't launch on python -m magneticalc with error ModuleNotFoundError: No module named 'magneticalc.QtWidgets2'

I suspect the reason is that the directory is not specified in line 27 of setup.py: package_dir={"magneticalc": "magneticalc"}.
Since there are already __init__.py files in the main and sub directories it might be possible to change the file to

from setuptools import setup, find_packages

version = {}
with open("magneticalc/Version.py") as file:
    exec(file.read(), version)

setup(
    packages=find_packages()
    name="MagnetiCalc",
...

But I'm not sure because I don't have much experience making PyPI releases.

TypeError: setValue(self, int): argument 1 has unexpected type 'float'

bernd@bernd-privat:~/MagnetiCalc$ git describe --tags
v1.15.1-1-g19b6897
bernd@bernd-privat:~/MagnetiCalc$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:        22.04
Codename:       jammy

This is what happens when I try to start it:

bernd@bernd-privat:~/MagnetiCalc$ python3 -m magneticalc

MagnetiCalc v1.15.1
Copyright © 2020–2022, Paul Wilhelm, M. Sc. <mailto:[email protected]>
ISC License (see README.md)

Performance Options: JIT Enabled, CUDA Not Available

main/__init__/Project.open_default()
main/__init__/open_default/Project.load(): Loading defaults
main/__init__/open_default/Project.load(): Creating empty User section
main/__init__/open_default/GUI.validate()
main/__init__/open_default/GUI.validate(): WARNING: Selected backend not available, using default backend
main/__init__/__init__/__init__/Model.set_parameters()
main/__init__/__init__/__init__/set_parameters/__exit__/Statusbar.invalidate()
main/__init__/__init__/__init__/set_parameters/__exit__/invalidate/Statusbar: Pending Calculation
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/bernd/MagnetiCalc/magneticalc/__main__.py", line 57, in <module>
    main()
  File "/home/bernd/MagnetiCalc/magneticalc/__main__.py", line 47, in main
    gui = GUI()
  File "/home/bernd/MagnetiCalc/magneticalc/GUI.py", line 109, in __init__
    self.reload()
  File "/home/bernd/MagnetiCalc/magneticalc/GUI.py", line 117, in reload
    self.sidebar_left.wire_widget.reload()
  File "/home/bernd/MagnetiCalc/magneticalc/Wire_Widget.py", line 299, in reload
    self.rotational_symmetry_count_spinbox.setValue(self.gui.project.get_float("rotational_symmetry_count"))
TypeError: setValue(self, int): argument 1 has unexpected type 'float'
GUI.cleanup()

Goodbye!

[feature] allow calculating or visualizing field in an arbitrary plane only

I would like to be able to visualize the field in one specific plane only, currently I cannot find any way to do this.

Example:

I have a complicated wire loop located flat on the XY plane. A real world example would be for example the boundary wire of a robot lawn mower.

Now I want to visualize what the sensor in the mower is actually seeing, the sensor is always located in a plane of maybe 7 centimeters above the wire loop (or even more if the wire is buried below the surface).

For simulating this I would want to design the wire loop in plane XY and then I would need some way to specify another arbitrary plane (in my case the plane 7cm above the ground) and plot the field only in this plane.

Bonus-killer-feature: It would highlight with colors the points in this plane where the field vector is parallel to that plane because this would be where the mower would think the wire is located. Maybe some kind of heat map where the color depends on the Z-component of the vector (or any other parameter of the field to make it more universal) and then be able to export this 2d heat map as an image. This would be extremely useful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.