Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

OrtnerMichael
Copy link
Member

@OrtnerMichael OrtnerMichael commented Aug 20, 2025

WIP

  • force computation working with collections and paths
  • integration in magpylib interface
  • docs
  • current sheet
  • review

LINK TO DOCS

Biggest changes:


This will completely replace the magpylib_force package.

@fslanovc, @Alexboiboi and @luizenger any anyone else please give it a try and give me feedback on the interface - it should be very intuitive to magpylib users. Here is a simple example:

import numpy as np
import magpylib as magpy

cube = magpy.magnet.Cuboid(
    dimension=(1, 1, 1),
    polarization=(.1, .2, .3)
)
circ = magpy.current.Circle(
    diameter=2,
    current=1e3,
    position=(0, 0, 1),
    meshing=50,
)
F, T = magpy.getFT(cube, circ)

print(f'force: {np.round(F, decimals=2)} N')
# force: [ 13.65  27.31 -81.93] N

print(f'torque: {np.round(T, decimals=2)} Nm')
# torque: [-8.55  4.27 -0.  ] Nm

Also if any of you mange to give me a code review it would be appreciated - but ofc its a few 1000 lines of code ;(

  1. Prio1 the module fieldFT.py
  2. Prio2 the module target_meshing.py
  3. Prio2 class_BaseTarget.py and all inheritance
  4. Prio4 test_force.py

@OrtnerMichael
Copy link
Member Author

the new Logo

image

Magpylib's efficient field and force computations make it ideal for dynamic simulations that require solving equations of motion through time-discretization methods. This example demonstrates how to implement numerical integration schemes to simulate the motion of magnetic objects under electromagnetic forces and torques.

## Formalism
------------------
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this --------------------------- here ?
@OrtnerMichael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants