Magnetostatic solver
Project description
OpenMagnets
OpenMagnets is a magnetostatic solver with a Python API and a native Fortran core.
public API
SurfaceMeshTetraMeshMaterialProblemSolveResultload_obj(...)has_native()backend_info()reload_backend()require_backend()
install
pip install openmagnets
source build
- Python 3.11+
gfortranninja- build isolation support through
pip
rebuild from source
python scripts/build_native.py
quick start
from openmagnets import Material, Problem, load_obj
surface = load_obj("part.obj")
mesh = surface.voxel_tetrahedralize(
padding=0.01,
resolution=(12, 12, 12),
inside_region_id=10,
outside_region_id=0,
region_names={
0: "air",
10: "magnet",
},
)
problem = Problem(
mesh=mesh,
materials={
0: Material(name="air", mu_r=1.0),
10: Material(name="magnet", mu_r=1.05, magnetization=[0.0, 0.0, 8.0e5]),
},
)
result = problem.solve()
print(result.cell_B.shape)
gradients
SolveResult reconstructs the cell centered gradients
cell_grad_B = result.cell_grad_B
cell_grad_H = result.cell_grad_H
print(cell_grad_B.shape)
print(result.sample_grad_B([[0.0, 0.0, 0.0]], outside="nearest")[0])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
openmagnets-0.1.1.tar.gz
(22.9 kB
view details)
File details
Details for the file openmagnets-0.1.1.tar.gz.
File metadata
- Download URL: openmagnets-0.1.1.tar.gz
- Upload date:
- Size: 22.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ced10a0583c7fe0d1c09c2b2d150ab0a19d4b5013291e4fac7969c1402b41f7d
|
|
| MD5 |
b8598275b377dcf53caf538d42eb87c1
|
|
| BLAKE2b-256 |
66933589cf915d63e1ec89960b57d29b08c74ce2909576b231425b0a4d568d1e
|
Provenance
The following attestation bundles were made for openmagnets-0.1.1.tar.gz:
Publisher:
publish.yml on CoolPhys/openmagnets
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openmagnets-0.1.1.tar.gz -
Subject digest:
ced10a0583c7fe0d1c09c2b2d150ab0a19d4b5013291e4fac7969c1402b41f7d - Sigstore transparency entry: 1238269710
- Sigstore integration time:
-
Permalink:
CoolPhys/openmagnets@55dcf6179e35f3af23bf224b789e768125f8ede6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/CoolPhys
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@55dcf6179e35f3af23bf224b789e768125f8ede6 -
Trigger Event:
workflow_dispatch
-
Statement type: