cfsem 2.4.2__tar.gz → 2.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cfsem-2.4.2 → cfsem-2.5.0}/.github/workflows/test_python.yml +4 -1
- {cfsem-2.4.2 → cfsem-2.5.0}/CHANGELOG_PYTHON.md +18 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/CHANGELOG_RUST.md +6 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/Cargo.lock +1 -1
- {cfsem-2.4.2 → cfsem-2.5.0}/Cargo.toml +1 -1
- cfsem-2.5.0/PKG-INFO +27 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/cfsem/__init__.py +28 -51
- {cfsem-2.4.2 → cfsem-2.5.0}/cfsem/bindings.py +21 -29
- cfsem-2.5.0/cfsem/solenoid_stress/solenoid_1d.py +317 -0
- cfsem-2.5.0/cfsem/solenoid_stress/solenoid_handcalc.py +91 -0
- cfsem-2.5.0/cfsem/solenoid_stress/thick_wall_cylinder_handcalc.py +69 -0
- cfsem-2.5.0/cfsem/types.py +7 -0
- cfsem-2.5.0/docs/python/solenoid_stress.md +5 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/examples/helmholtz.py +3 -1
- {cfsem-2.4.2 → cfsem-2.5.0}/examples/inductance.py +1 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/mkdocs.yml +2 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/pyproject.toml +22 -2
- cfsem-2.5.0/test/__init__.py +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/test/test_electromagnetics.py +2 -2
- {cfsem-2.4.2 → cfsem-2.5.0}/test/test_funcs.py +2 -1
- cfsem-2.5.0/test/test_solenoid_stress.py +290 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/uv.lock +1578 -1357
- cfsem-2.4.2/PKG-INFO +0 -124
- cfsem-2.4.2/cfsem/types.py +0 -7
- {cfsem-2.4.2 → cfsem-2.5.0}/.cargo/config.toml +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/.github/workflows/release_python.yml +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/.github/workflows/release_rust.yml +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/.github/workflows/test_rust.yml +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/.gitignore +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/.readthedocs.yml +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/CONTRIBUTING.md +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/LICENSE +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/README.md +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/benches/circular_filament.rs +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/benches/linear_filament.rs +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/build_docs.sh +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/cfsem/py.typed +0 -0
- {cfsem-2.4.2/test → cfsem-2.5.0/cfsem/solenoid_stress}/__init__.py +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/docs/assets/logo.svg +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/docs/index.md +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/docs/javascripts/mathjax.js +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/docs/python/example_outputs/.placeholder +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/docs/python/examples.md +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/docs/python/filament.md +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/docs/python/flux_density.md +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/docs/python/force.md +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/docs/python/grad_shafranov.md +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/docs/python/inductance.md +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/docs/python/math.md +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/docs/python/types.md +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/docs/python/vector_potential.md +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/docs/requirements.txt +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/docs/stylesheets/extra.css +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/katex-header.html +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/src/lib.rs +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/src/math.rs +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/src/mesh.rs +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/src/physics/biotsavart.rs +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/src/physics/circular_filament.rs +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/src/physics/gradshafranov.rs +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/src/physics/linear_filament.rs +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/src/physics/mesh_filament.rs +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/src/physics/mod.rs +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/src/physics/point_source.rs +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/src/python.rs +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/src/testing.rs +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/test/test_examples.py +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/test/test_filaments.py +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/test/test_gradshafranov.py +0 -0
- {cfsem-2.4.2 → cfsem-2.5.0}/test/test_math.py +0 -0
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.5.0 2025-08-05
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
* Add `solenoid_stress` module
|
|
8
|
+
* 1D finite-difference solver for solenoid stress given arbitrary B-field, current density, and surface load
|
|
9
|
+
* Generalizes over both long-solenoid stress and ideal thick-walled pressure vessel stress
|
|
10
|
+
* Tested against handcalcs for both ideal solenoid & thick-walled pressure vessel
|
|
11
|
+
* 1D handcalc for solenoid stress under uniform current density and linear B-field profile
|
|
12
|
+
* 1D handcalc for thick-walled pressure vessel
|
|
13
|
+
|
|
14
|
+
## 2.4.3 2025-07-07
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
* Configure linter to be slightly more strict
|
|
19
|
+
* Format and resolve new lints
|
|
20
|
+
|
|
3
21
|
## 2.4.2 2025-06-16
|
|
4
22
|
|
|
5
23
|
### Changed
|
cfsem-2.5.0/PKG-INFO
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cfsem
|
|
3
|
+
Version: 2.5.0
|
|
4
|
+
Classifier: Programming Language :: Rust
|
|
5
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
7
|
+
Requires-Dist: numpy>=2
|
|
8
|
+
Requires-Dist: interpn>=0.2.5
|
|
9
|
+
Requires-Dist: findiff>=0.12.1
|
|
10
|
+
Requires-Dist: pydantic>=2
|
|
11
|
+
Requires-Dist: pydantic-numpy>=6
|
|
12
|
+
Requires-Dist: pytest>=7.1.3 ; extra == 'dev'
|
|
13
|
+
Requires-Dist: coverage>=6.5.0 ; extra == 'dev'
|
|
14
|
+
Requires-Dist: ruff>=0.6.2 ; extra == 'dev'
|
|
15
|
+
Requires-Dist: pyright==1.1.402 ; extra == 'dev'
|
|
16
|
+
Requires-Dist: scipy>=1.8 ; extra == 'dev'
|
|
17
|
+
Requires-Dist: mkdocs>=1.6.0 ; extra == 'dev'
|
|
18
|
+
Requires-Dist: mkdocs-material>=9.5.25 ; extra == 'dev'
|
|
19
|
+
Requires-Dist: mkdocstrings[python]>=0.25.1 ; extra == 'dev'
|
|
20
|
+
Requires-Dist: matplotlib>=3.9 ; extra == 'dev'
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Summary: Quasi-steady electromagnetics including filamentized approximations, Biot-Savart, and Grad-Shafranov.
|
|
24
|
+
Home-Page: https://github.com/cfs-energy/cfsem-py
|
|
25
|
+
Author-email: Commonwealth Fusion Systems <jlogan@cfs.energy>
|
|
26
|
+
License-Expression: MIT
|
|
27
|
+
Requires-Python: >=3.9, <3.14
|
|
@@ -1,30 +1,28 @@
|
|
|
1
1
|
"""Quasi-steady electromagnetics calcs"""
|
|
2
2
|
|
|
3
|
-
from typing import Tuple
|
|
4
3
|
import numpy as np
|
|
5
|
-
from numpy.typing import NDArray
|
|
6
4
|
from interpn import MulticubicRectilinear
|
|
7
|
-
|
|
8
|
-
from cfsem.types import Array3xN
|
|
5
|
+
from numpy.typing import NDArray
|
|
9
6
|
|
|
10
7
|
from cfsem.bindings import (
|
|
8
|
+
body_force_density_circular_filament_cartesian,
|
|
9
|
+
body_force_density_linear_filament,
|
|
10
|
+
filament_helix_path,
|
|
11
11
|
flux_circular_filament,
|
|
12
|
-
flux_density_linear_filament,
|
|
13
12
|
flux_density_biot_savart,
|
|
14
13
|
flux_density_circular_filament,
|
|
14
|
+
flux_density_circular_filament_cartesian,
|
|
15
|
+
flux_density_dipole,
|
|
16
|
+
flux_density_linear_filament,
|
|
15
17
|
gs_operator_order2,
|
|
16
18
|
gs_operator_order4,
|
|
17
19
|
inductance_piecewise_linear_filaments,
|
|
18
|
-
|
|
20
|
+
mutual_inductance_circular_to_linear,
|
|
19
21
|
rotate_filaments_about_path,
|
|
20
|
-
vector_potential_linear_filament,
|
|
21
22
|
vector_potential_circular_filament,
|
|
22
|
-
|
|
23
|
-
mutual_inductance_circular_to_linear,
|
|
24
|
-
flux_density_dipole,
|
|
25
|
-
body_force_density_circular_filament_cartesian,
|
|
26
|
-
body_force_density_linear_filament,
|
|
23
|
+
vector_potential_linear_filament,
|
|
27
24
|
)
|
|
25
|
+
from cfsem.types import Array3xN
|
|
28
26
|
|
|
29
27
|
from .cfsem import ellipe, ellipk
|
|
30
28
|
|
|
@@ -171,9 +169,7 @@ def mutual_inductance_piecewise_linear_filaments(
|
|
|
171
169
|
return inductance # [H]
|
|
172
170
|
|
|
173
171
|
|
|
174
|
-
def flux_density_ideal_solenoid(
|
|
175
|
-
current: float, num_turns: float, length: float
|
|
176
|
-
) -> float:
|
|
172
|
+
def flux_density_ideal_solenoid(current: float, num_turns: float, length: float) -> float:
|
|
177
173
|
"""
|
|
178
174
|
Axial B-field on centerline of an ideal (infinitely long) solenoid.
|
|
179
175
|
|
|
@@ -194,8 +190,8 @@ def flux_density_ideal_solenoid(
|
|
|
194
190
|
def self_inductance_lyle6(r: float, dr: float, dz: float, n: float) -> float:
|
|
195
191
|
"""
|
|
196
192
|
Self-inductance of a cylindrically-symmetric coil of rectangular
|
|
197
|
-
cross-section, estimated to 6th order.
|
|
198
|
-
|
|
193
|
+
cross-section, estimated to 6th order.
|
|
194
|
+
|
|
199
195
|
This estimate is viable up to an L/D of about 1.5, above which it
|
|
200
196
|
rapidly accumulates error and eventually produces negative values.
|
|
201
197
|
|
|
@@ -239,13 +235,7 @@ def self_inductance_lyle6(r: float, dr: float, dz: float, n: float) -> float:
|
|
|
239
235
|
f = (
|
|
240
236
|
ml
|
|
241
237
|
+ (1 + u + v - 8 * (w + ww)) / 12.0 # 0th order in d/a
|
|
242
|
-
+ (
|
|
243
|
-
da2
|
|
244
|
-
* (
|
|
245
|
-
cd2 * (221 + 60 * ml - 6 * v)
|
|
246
|
-
+ 3 * bd2 * (69 + 60 * ml + 10 * u - 64 * w)
|
|
247
|
-
)
|
|
248
|
-
)
|
|
238
|
+
+ (da2 * (cd2 * (221 + 60 * ml - 6 * v) + 3 * bd2 * (69 + 60 * ml + 10 * u - 64 * w)))
|
|
249
239
|
/ 5760.0 # 2nd order
|
|
250
240
|
+ (
|
|
251
241
|
da2**2
|
|
@@ -275,9 +265,7 @@ def self_inductance_lyle6(r: float, dr: float, dz: float, n: float) -> float:
|
|
|
275
265
|
return self_inductance # [H]
|
|
276
266
|
|
|
277
267
|
|
|
278
|
-
def mutual_inductance_of_circular_filaments(
|
|
279
|
-
rzn1: NDArray, rzn2: NDArray, par: bool = True
|
|
280
|
-
) -> float:
|
|
268
|
+
def mutual_inductance_of_circular_filaments(rzn1: NDArray, rzn2: NDArray, par: bool = True) -> float:
|
|
281
269
|
"""
|
|
282
270
|
Analytic mutual inductance between a pair of ideal cylindrically-symmetric coaxial filaments.
|
|
283
271
|
|
|
@@ -294,16 +282,12 @@ def mutual_inductance_of_circular_filaments(
|
|
|
294
282
|
float: [H] mutual inductance
|
|
295
283
|
"""
|
|
296
284
|
|
|
297
|
-
m = mutual_inductance_of_cylindrical_coils(
|
|
298
|
-
rzn1.reshape((3, 1)), rzn2.reshape((3, 1)), par
|
|
299
|
-
)
|
|
285
|
+
m = mutual_inductance_of_cylindrical_coils(rzn1.reshape((3, 1)), rzn2.reshape((3, 1)), par)
|
|
300
286
|
|
|
301
287
|
return m # [H]
|
|
302
288
|
|
|
303
289
|
|
|
304
|
-
def mutual_inductance_of_cylindrical_coils(
|
|
305
|
-
f1: NDArray, f2: NDArray, par: bool = True
|
|
306
|
-
) -> float:
|
|
290
|
+
def mutual_inductance_of_cylindrical_coils(f1: NDArray, f2: NDArray, par: bool = True) -> float:
|
|
307
291
|
"""
|
|
308
292
|
Analytical mutual inductance between two coaxial collections of ideal filaments.
|
|
309
293
|
|
|
@@ -324,16 +308,12 @@ def mutual_inductance_of_cylindrical_coils(
|
|
|
324
308
|
|
|
325
309
|
# Using n2 as the current per filament is equivalent to examining a 1A reference current,
|
|
326
310
|
# which gives us the flux per amp (inductance)
|
|
327
|
-
m = np.sum(
|
|
328
|
-
n1 * flux_circular_filament(n2, r2, z2, r1, z1, par)
|
|
329
|
-
) # [H] total mutual inductance
|
|
311
|
+
m = np.sum(n1 * flux_circular_filament(n2, r2, z2, r1, z1, par)) # [H] total mutual inductance
|
|
330
312
|
|
|
331
313
|
return m # [H]
|
|
332
314
|
|
|
333
315
|
|
|
334
|
-
def filament_coil(
|
|
335
|
-
r: float, z: float, w: float, h: float, nt: float, nr: int, nz: int
|
|
336
|
-
) -> NDArray:
|
|
316
|
+
def filament_coil(r: float, z: float, w: float, h: float, nt: float, nr: int, nz: int) -> NDArray:
|
|
337
317
|
"""
|
|
338
318
|
Create an array of filaments from coil cross-section, evenly spaced
|
|
339
319
|
_inside_ the winding pack. No filaments are coincident with the coil surface.
|
|
@@ -365,9 +345,7 @@ def filament_coil(
|
|
|
365
345
|
return filaments # [m], [m], [dimensionless]
|
|
366
346
|
|
|
367
347
|
|
|
368
|
-
def self_inductance_circular_ring_wien(
|
|
369
|
-
major_radius: NDArray, minor_radius: NDArray
|
|
370
|
-
) -> NDArray:
|
|
348
|
+
def self_inductance_circular_ring_wien(major_radius: NDArray, minor_radius: NDArray) -> NDArray:
|
|
371
349
|
"""
|
|
372
350
|
Wien's formula for the self-inductance of a circular ring
|
|
373
351
|
with thin circular cross section.
|
|
@@ -391,21 +369,19 @@ def self_inductance_circular_ring_wien(
|
|
|
391
369
|
ra2 = (minor_radius / major_radius) ** 2 # [], (rho / a)^2, dimensionless
|
|
392
370
|
# Equation 7 in Rosa & Cohen lacks the factor of 1e-7
|
|
393
371
|
# because it is not in SI base units.
|
|
394
|
-
self_inductance = (
|
|
395
|
-
MU_0 * major_radius * ((1 + 0.125 * ra2) * np.log(8 * ar) - 0.0083 * ra2 - 1.75)
|
|
396
|
-
) # [H]
|
|
372
|
+
self_inductance = MU_0 * major_radius * ((1 + 0.125 * ra2) * np.log(8 * ar) - 0.0083 * ra2 - 1.75) # [H]
|
|
397
373
|
return self_inductance # [H]
|
|
398
374
|
|
|
399
375
|
|
|
400
376
|
def self_inductance_distributed_axisymmetric_conductor(
|
|
401
377
|
current: float,
|
|
402
|
-
grid:
|
|
403
|
-
mesh:
|
|
404
|
-
b_part:
|
|
378
|
+
grid: tuple[NDArray, NDArray],
|
|
379
|
+
mesh: tuple[NDArray, NDArray],
|
|
380
|
+
b_part: tuple[NDArray, NDArray],
|
|
405
381
|
psi_part: NDArray,
|
|
406
382
|
mask: NDArray,
|
|
407
|
-
edge_path:
|
|
408
|
-
) ->
|
|
383
|
+
edge_path: tuple[NDArray, NDArray],
|
|
384
|
+
) -> tuple[float, float, float]:
|
|
409
385
|
"""
|
|
410
386
|
Calculation of a distributed conductor's self-inductance from two components:
|
|
411
387
|
|
|
@@ -546,7 +522,8 @@ def self_inductance_annular_ring(r: float, a: float, b: float) -> float:
|
|
|
546
522
|
and `(b/r)^2`.
|
|
547
523
|
|
|
548
524
|
References:
|
|
549
|
-
[1] E. B. Rosa and F. W. Grover,
|
|
525
|
+
[1] E. B. Rosa and F. W. Grover,
|
|
526
|
+
“Formulas and tables for the calculation of mutual and self-inductance (Revised),”
|
|
550
527
|
BULL. NATL. BUR. STAND., vol. 8, no. 1, p. 1, Jan. 1912,
|
|
551
528
|
doi: [10.6028/bulletin.185](https://doi.org/10.6028/bulletin.185)
|
|
552
529
|
|
|
@@ -5,30 +5,33 @@ This fulfills the function of typing stubs, while also guaranteeing arrays are
|
|
|
5
5
|
passed as contiguous and reallocating into contiguous inputs if necessary.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
from cfsem.types import Array3xN
|
|
9
|
-
|
|
10
8
|
from numpy import ascontiguousarray, float64, zeros_like
|
|
11
9
|
from numpy.typing import NDArray
|
|
12
10
|
|
|
13
|
-
from .
|
|
14
|
-
|
|
15
|
-
from .cfsem import flux_density_circular_filament as em_flux_density_circular_filament
|
|
11
|
+
from cfsem.types import Array3xN
|
|
12
|
+
|
|
16
13
|
from .cfsem import (
|
|
17
|
-
|
|
14
|
+
body_force_density_circular_filament_cartesian as em_body_force_density_circular_filament_cartesian,
|
|
18
15
|
)
|
|
19
16
|
from .cfsem import (
|
|
20
|
-
|
|
17
|
+
body_force_density_linear_filament as em_body_force_density_linear_filament,
|
|
21
18
|
)
|
|
19
|
+
from .cfsem import filament_helix_path as em_filament_helix_path
|
|
20
|
+
from .cfsem import flux_circular_filament as em_flux_circular_filament
|
|
21
|
+
from .cfsem import flux_density_circular_filament as em_flux_density_circular_filament
|
|
22
22
|
from .cfsem import (
|
|
23
|
-
|
|
23
|
+
flux_density_circular_filament_cartesian as em_flux_density_circular_filament_cartesian,
|
|
24
24
|
)
|
|
25
|
-
|
|
25
|
+
from .cfsem import flux_density_dipole as em_flux_density_dipole
|
|
26
|
+
from .cfsem import flux_density_linear_filament as em_flux_density_linear_filament
|
|
26
27
|
from .cfsem import gs_operator_order2 as em_gs_operator_order2
|
|
27
28
|
from .cfsem import gs_operator_order4 as em_gs_operator_order4
|
|
28
29
|
from .cfsem import (
|
|
29
30
|
inductance_piecewise_linear_filaments as em_inductance_piecewise_linear_filaments,
|
|
30
31
|
)
|
|
31
|
-
from .cfsem import
|
|
32
|
+
from .cfsem import (
|
|
33
|
+
mutual_inductance_circular_to_linear as em_mutual_inductance_circular_to_linear,
|
|
34
|
+
)
|
|
32
35
|
from .cfsem import rotate_filaments_about_path as em_rotate_filaments_about_path
|
|
33
36
|
from .cfsem import (
|
|
34
37
|
vector_potential_circular_filament as em_vector_potential_circular_filament,
|
|
@@ -36,11 +39,6 @@ from .cfsem import (
|
|
|
36
39
|
from .cfsem import (
|
|
37
40
|
vector_potential_linear_filament as em_vector_potential_linear_filament,
|
|
38
41
|
)
|
|
39
|
-
from .cfsem import (
|
|
40
|
-
body_force_density_linear_filament as em_body_force_density_linear_filament,
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
from .cfsem import flux_density_dipole as em_flux_density_dipole
|
|
44
42
|
|
|
45
43
|
|
|
46
44
|
def flux_circular_filament(
|
|
@@ -290,9 +288,7 @@ def inductance_piecewise_linear_filaments(
|
|
|
290
288
|
xyzfil1 = _3tup_contig(xyzfil1)
|
|
291
289
|
dlxyzfil1 = _3tup_contig(dlxyzfil1)
|
|
292
290
|
|
|
293
|
-
return em_inductance_piecewise_linear_filaments(
|
|
294
|
-
xyzfil0, dlxyzfil0, xyzfil1, dlxyzfil1, self_inductance
|
|
295
|
-
)
|
|
291
|
+
return em_inductance_piecewise_linear_filaments(xyzfil0, dlxyzfil0, xyzfil1, dlxyzfil1, self_inductance)
|
|
296
292
|
|
|
297
293
|
|
|
298
294
|
def gs_operator_order2(rs: NDArray[float64], zs: NDArray[float64]) -> Array3xN:
|
|
@@ -381,9 +377,7 @@ def filament_helix_path(
|
|
|
381
377
|
return helix # [m]
|
|
382
378
|
|
|
383
379
|
|
|
384
|
-
def rotate_filaments_about_path(
|
|
385
|
-
path: Array3xN, angle_offset: float, fils: Array3xN
|
|
386
|
-
) -> Array3xN:
|
|
380
|
+
def rotate_filaments_about_path(path: Array3xN, angle_offset: float, fils: Array3xN) -> Array3xN:
|
|
387
381
|
"""
|
|
388
382
|
Rotate a path of point about another path.
|
|
389
383
|
|
|
@@ -436,9 +430,7 @@ def flux_density_circular_filament_cartesian(
|
|
|
436
430
|
"""
|
|
437
431
|
ifil, rfil, zfil = _3tup_contig((ifil, rfil, zfil))
|
|
438
432
|
xyzp = _3tup_contig(xyzp)
|
|
439
|
-
bx, by, bz = em_flux_density_circular_filament_cartesian(
|
|
440
|
-
ifil, rfil, zfil, xyzp, par
|
|
441
|
-
) # [T]
|
|
433
|
+
bx, by, bz = em_flux_density_circular_filament_cartesian(ifil, rfil, zfil, xyzp, par) # [T]
|
|
442
434
|
|
|
443
435
|
return bx, by, bz # type: ignore
|
|
444
436
|
|
|
@@ -562,9 +554,7 @@ def body_force_density_linear_filament(
|
|
|
562
554
|
ifil = ascontiguousarray(ifil).flatten()
|
|
563
555
|
obs = _3tup_contig(obs)
|
|
564
556
|
j = _3tup_contig(j)
|
|
565
|
-
jxbx, jxby, jxbz = em_body_force_density_linear_filament(
|
|
566
|
-
xyzfil, dlxyzfil, ifil, obs, j, par
|
|
567
|
-
) # [N/m^3]
|
|
557
|
+
jxbx, jxby, jxbz = em_body_force_density_linear_filament(xyzfil, dlxyzfil, ifil, obs, j, par) # [N/m^3]
|
|
568
558
|
|
|
569
559
|
return jxbx, jxby, jxbz # type: ignore
|
|
570
560
|
|
|
@@ -572,7 +562,8 @@ def body_force_density_linear_filament(
|
|
|
572
562
|
def _3tup_contig(
|
|
573
563
|
t: Array3xN,
|
|
574
564
|
) -> tuple[NDArray[float64], NDArray[float64], NDArray[float64]]:
|
|
575
|
-
"""Make contiguous references or copies to arrays in a 3-tuple.
|
|
565
|
+
"""Make contiguous references or copies to arrays in a 3-tuple.
|
|
566
|
+
Only copies data if it is not already contiguous."""
|
|
576
567
|
return (
|
|
577
568
|
ascontiguousarray(t[0]).flatten(),
|
|
578
569
|
ascontiguousarray(t[1]).flatten(),
|
|
@@ -583,5 +574,6 @@ def _3tup_contig(
|
|
|
583
574
|
def _2tup_contig(
|
|
584
575
|
t: tuple[NDArray[float64], NDArray[float64]],
|
|
585
576
|
) -> tuple[NDArray[float64], NDArray[float64]]:
|
|
586
|
-
"""Make contiguous references or copies to arrays in a 2-tuple.
|
|
577
|
+
"""Make contiguous references or copies to arrays in a 2-tuple.
|
|
578
|
+
Only copies data if it is not already contiguous."""
|
|
587
579
|
return (ascontiguousarray(t[0]).flatten(), ascontiguousarray(t[1]).flatten())
|