Skip to content

Commit edf8528

Browse files
committed
first commit
1 parent eb1daed commit edf8528

18 files changed

+1142
-1
lines changed

.gitignore

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Created by https://www.gitignore.io/api/python
2+
# Edit at https://www.gitignore.io/?templates=python
3+
4+
### Python ###
5+
# Byte-compiled / optimized / DLL files
6+
__pycache__/
7+
*.py[cod]
8+
*$py.class
9+
10+
# C extensions
11+
*.so
12+
13+
# Distribution / packaging
14+
.Python
15+
build/
16+
develop-eggs/
17+
dist/
18+
downloads/
19+
eggs/
20+
.eggs/
21+
lib64/
22+
parts/
23+
sdist/
24+
var/
25+
wheels/
26+
share/python-wheels/
27+
*.egg-info/
28+
.installed.cfg
29+
*.egg
30+
MANIFEST
31+
*.pptx
32+
*.ppt
33+
34+
# docs
35+
docs/auto_examples
36+
37+
# sphinx-gallery
38+
auto_examples
39+
40+
# coderunner
41+
tempCodeRunnerFile.py
42+
43+
#temp files
44+
__temp*.py
45+
46+
# PyInstaller
47+
# Usually these files are written by a python script from a template
48+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
49+
*.manifest
50+
*.spec
51+
52+
# Installer logs
53+
pip-log.txt
54+
pip-delete-this-directory.txt
55+
56+
# Unit test / coverage reports
57+
htmlcov/
58+
test-results/
59+
.tox/
60+
.nox/
61+
.coverage
62+
.coverage.*
63+
.cache
64+
nosetests.xml
65+
coverage.xml
66+
*.cover
67+
.hypothesis/
68+
.pytest_cache/
69+
70+
# Translations
71+
*.mo
72+
*.pot
73+
74+
# Django stuff:
75+
*.log
76+
local_settings.py
77+
db.sqlite3
78+
79+
# Flask stuff:
80+
instance/
81+
.webassets-cache
82+
83+
# Scrapy stuff:
84+
.scrapy
85+
86+
# Sphinx documentation
87+
docs/_build/
88+
docs/_autogen/
89+
docs/_auto_examples/
90+
# PyBuilder
91+
target/
92+
93+
# Jupyter Notebook
94+
.ipynb_checkpoints
95+
*.ipynb
96+
97+
# IPython
98+
profile_default/
99+
ipython_config.py
100+
101+
# pyenv
102+
.python-version
103+
104+
# celery beat schedule file
105+
celerybeat-schedule
106+
107+
# SageMath parsed files
108+
*.sage.py
109+
110+
# Environments
111+
.vscode/
112+
.env
113+
.venv
114+
env/
115+
venv/
116+
ENV/
117+
env.bak/
118+
venv.bak/
119+
120+
# Spyder project settings
121+
.spyderproject
122+
.spyproject
123+
124+
# Rope project settings
125+
.ropeproject
126+
127+
# mkdocs documentation
128+
/site
129+
130+
# mypy
131+
.mypy_cache/
132+
.dmypy.json
133+
dmypy.json
134+
135+
# Pyre type checker
136+
.pyre/
137+
138+
### Python Patch ###
139+
.venv/
140+
141+
.DS_Store

LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
SAL Software License Agreement
2+
3+
1. Grant of License:
4+
SAL ("Licensor") hereby grants to the authorized user ("Licensee") a non-exclusive, non-transferable license to use the software provided under this Agreement (the "Software") solely for Licensee’s internal business operations.
5+
6+
2. Restrictions:
7+
a. The Licensee shall not, and shall not permit any third parties to, modify, adapt, translate, decompile, reverse engineer, disassemble, attempt to derive the source code of, or create derivative works from the Software.
8+
b. The Licensee shall not sell, redistribute, sublicense, rent, lease, or lend the Software to any third party.
9+
c. The Software may contain confidential information and trade secrets of SAL, and the Licensee agrees to maintain the confidentiality of the Software using at least as great a degree of care as it uses to maintain the confidentiality of its own most confidential information.
10+
11+
3. Intellectual Property Rights:
12+
All title, ownership rights, and intellectual property rights in and to the Software shall remain with SAL and/or its suppliers. This Agreement does not transfer any ownership rights in the Software to the Licensee.
13+
14+
4. Termination:
15+
This License is effective until terminated. The License will terminate immediately without notice from SAL if the Licensee fails to comply with any provision of this Agreement. Upon termination, the Licensee must destroy all copies of the Software.
16+
17+
5. Disclaimer of Warranty:
18+
The Software is provided "AS IS," without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement.
19+
20+
6. Limitation of Liability:
21+
In no event shall SAL be liable for any special, incidental, indirect, or consequential damages whatsoever arising out of or related to the use of or inability to use the Software, even if SAL has been advised of the possibility of such damages.
22+
23+
7. General:
24+
This Agreement constitutes the entire agreement between the parties relating to the Software and supersedes all prior or contemporaneous oral or written communications, proposals, and representations with respect to its subject matter.
25+
26+
8. Governing Law:
27+
This Agreement shall be governed by and construed in accordance with the laws of the jurisdiction in which SAL is registered, without regard to its conflict of law provisions.
28+
29+
By using the Software, the Licensee agrees to be bound by the terms of this Agreement.

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Magpy-Force
2+
3+
This package provides force and torque computation for Magpylib objects.

TODO.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# DONE SINCE LAST LAST TIME
2+
3+
- magnet-wire force/torque codes completed
4+
- confirmed by FEM
5+
- confirmed by self-consistency
6+
- confirmed by analytical fundamental solutions
7+
- COMSOL confirm ANSYS and bad FE convergence
8+
- We understand the possibilities and limitation (no wire ends) of our force codes
9+
10+
11+
# DONE SINCE LAST TIME
12+
13+
- restructured repository so it can be made installable and used by end-users
14+
- removed unit-dependencies - everything is SI and magpylib 5 compatible
15+
- setting up a testing framework
16+
- physics tests
17+
- interface tests
18+
- FE tests
19+
- self-consistency tests
20+
- vectorization for multiple inputs
21+
- input checks and auto-formatting
22+
- dynamic wire meshing
23+
- some doc-strings
24+
- add License
25+
- making installable, current version is 0.1.2dev
26+
27+
28+
# TODO CRITICAL
29+
30+
- testing
31+
- FE tests wire-wire
32+
- FE tests magnet-wire
33+
- FE tests finite-sized wires magnet
34+
- more interface and meshing tests
35+
- reduce computation effort when no anchor is given or proof that this will not help much
36+
- review and clean up the meshers
37+
- implement dynamic magnet meshing ?
38+
- speed-boost: replace integration using newton_cotes
39+
- profiling
40+
- memory
41+
- performance
42+
- upscaling computation to SAL servers
43+
44+
45+
# TODO UNCRITICAL
46+
47+
- shape handling
48+
- include paths
49+
- avoid sum over all sources if sumup=False
50+
- more doc strings
51+
- make units optional
52+
- include orientations
53+
- allow Collection inputs
54+
- Arc solution
55+
- linting
56+
57+
58+

UNITS_feeback.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Question1
2+
cannot mix sources with units and sources without units in one script. I would have expecetd that unit-less sources are automatically given SI units.
3+
4+
# Problem
5+
markers doesnt work with units :()
6+
7+
8+
import numpy as np
9+
import magpylib as magpy
10+
import matplotlib.pyplot as plt
11+
12+
src = magpy.current.Polyline(
13+
current=(1, "A"),
14+
vertices=([(-1,0,0),(1,0,0)], "mm"),
15+
)
16+
tgt = magpy.current.Polyline(
17+
current=(1, "A"),
18+
vertices=([(-1,0,0),(1,0,0)], "mm"),
19+
position=((0,0,5), "mm"),
20+
)
21+
lvec = tgt.vertices[1]-tgt.vertices[0]
22+
23+
poss = tgt.position + (tgt.vertices[1]+tgt.vertices[0])/2
24+
#B = src.getB(poss)
25+
#F = tgt.current * np.cross(lvec, B)
26+
27+
magpy.show(src, tgt, markers=poss)
28+
29+
# Problem Custom sources
30+
31+
kann custom source nicht vor source mit unit definieren weil die sonst keine quantity bekommt
32+
33+
# Problem Matplotlib backend cannot show dimensionful cubes
34+

example.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from mforce import getFTcube
2+
import magpylib as magpy
3+
4+
# all inputs and output in SI units
5+
6+
cube1 = magpy.magnet.Cuboid(
7+
dimension=(1,1,1),
8+
polarization=(1,1,1),
9+
)
10+
cube2 = cube1.copy(position=(1,0,2))
11+
cube2.mesh = (10,10,10)
12+
13+
F,T = getFTcube(cube1, [cube2, cube2.copy()], anchor=(0,0,0))
14+
print(F)
15+
print(T)

mforce/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from mforce.force import getFTcube
2+
from mforce.force import getFTwire
3+
4+
"""
5+
The mforce package sits on top of magpylib for force computation
6+
"""
7+
8+
# module level dunders
9+
__version__ = "0.1.2dev"
10+
__author__ = "SAL"
11+
__all__ = [
12+
"getFTcube",
13+
"getFTwire",
14+
]

0 commit comments

Comments
 (0)