Physics simulation with Equivalent Magnetic Dipole Method (EMD) 1 for magnet effects. This project was developed as part of the ETH Zürich course Physics-based Simulation in Computer Graphics (252-0546-00L). For more detailed objectives and scope, see our project proposal. We also include additional materials such as the reference papers or mesh objects here.
| Interactions between permanent and induced ferromagnets | Meißner–Ochsenfeld effect of a superconductor |
|---|---|
![]() |
![]() |
On Ubuntu system, run the following command for necessary libraries:
apt-get install xorg-dev libglu1-mesa-dev freeglut3-dev mesa-common-dev libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev
We additionally need to install the reactphysics lib, follow the instructions here https://www.reactphysics3d.com/documentation/index.html#building
To fetch the necessary submodules and build the magnetic problems, run
cd ferro
git submodule update --init --recursive # Initialize and update all git submodules
mkdir build && cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ..
ninja
The examples/ directory contains multiple interactive demo scripts showcasing the use of the ferro module for simulating magnet effects.
examples/my-app: Interactions between four cube-shape permanent magnets and induced spherical ferromagnetsexamples/field_lines: Interactive visualization of field lines of permanent magnetsexamples/dragon: Mesh-based permanent magnet in shape of a dragon moving periodically in the scenario to attract induced spherical ferromagnetsexamples/super_conductor: Meißner–Ochsenfeld effect of a superconductor
If you have successfully built in the previous step, you should be able to see these examples under build/bin/. You can run ./bin/field_lines when locating in the build directory to start with the super conductor example. Have fun playing with them while trying turning magnetization on/off!
Maxwell's equations describe the governing physics underlying electromagnetic phenomena. For magnetostatic problems, the Maxwell's equations can largely simplify (assuming simple homogeneous, isotropic and non-dispersive media with constant parameters):
From the full Maxwell equations:
simplifies, under magnetostatic assumptions, to:
where
Materials experience magnetization only in the presence of an external magnetic field:
This also extends to superconductors:
Note: For a visual comparison of
Leveraging the infinitesimal definition of magnetization
To calculate the magnetic
In the first simplification,
The last approximate equality follows from the assumption of the EDM, allowing us to sum up the aggregated contribution of all
In order to verify the correctness of our implementation, we additionally include an analytical benchmark in examples/benchmark/benchmark.cpp to test the force computation of 3D permanent magnets using analytical formula that has been derived and experimentally verified by Akoun and Yonnet 3.
To reproduce the above tables, first run ./bin/benchmark after building from source. Ensure that the output files benchmark_results_{cellnum}cells.json are present in the examples/benchmark directory.
To visualize the results, use the provided Julia script. If you do not already have the required Julia packages, you can install them by running the following command in the Julia REPL:
using Pkg
Pkg.add(["CairoMakie", "JSON", "Statistics", "Colors"])Then run the visualization script with:
julia akoun_yonnet_benchmark.jl
Execute this command from the examples/benchmark folder containing the results and the script.
We used Blender to render the simulated physics; the associated .blend file can be found here.
We also created a realistic magnet surface, which can be used in your own rendering scenes if desired. The corresponding file is attached in the cloud storage linked above.
Footnotes
-
Magnets in Motion
B. Thomaszewski, A. Gumann, S. Pabst, W. Straßer.
ACM Trans. Graph., 27(5):162, 2008.
doi:10.1145/1409060.1409115 ↩ -
Classical Electrodynamics Jackson JD (John David Jackson).
Wiley; 1999.. 3rd ed. New York, NY
CERN Library ↩ -
3D analytical calculation of the forces exerted between two cuboidal magnets
G. Akoun, J.-P. Yonnet.
IEEE Transactions on Magnetics, 20:1962–1964, 1984.
doi:10.1109/TMAG.1984.1063554 ↩





