cfsem 3.0.2__tar.gz → 3.1.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-3.0.2 → cfsem-3.1.0}/.github/workflows/release_python.yml +3 -2
- {cfsem-3.0.2 → cfsem-3.1.0}/CHANGELOG.md +13 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/Cargo.lock +1 -1
- {cfsem-3.0.2 → cfsem-3.1.0}/Cargo.toml +1 -1
- {cfsem-3.0.2 → cfsem-3.1.0}/PKG-INFO +2 -2
- {cfsem-3.0.2 → cfsem-3.1.0}/cfsem/__init__.py +115 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/cfsem/bindings.py +2 -2
- cfsem-3.1.0/examples/inductance_rectangular_coil_set.py +30 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/pyproject.toml +2 -2
- {cfsem-3.0.2 → cfsem-3.1.0}/test/test_electromagnetics.py +114 -1
- {cfsem-3.0.2 → cfsem-3.1.0}/uv.lock +21 -19
- {cfsem-3.0.2 → cfsem-3.1.0}/.cargo/config.toml +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/.github/workflows/release_rust.yml +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/.github/workflows/test_python.yml +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/.github/workflows/test_rust.yml +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/.gitignore +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/.readthedocs.yml +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/CHANGELOG_PYTHON_ARCHIVE.md +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/CHANGELOG_RUST_ARCHIVE.md +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/CONTRIBUTING.md +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/LICENSE +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/README.md +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/benches/circular_filament.rs +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/benches/linear_filament.rs +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/benches/point_source.rs +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/build_docs.sh +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/cfsem/py.typed +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/cfsem/solenoid_stress/__init__.py +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/cfsem/solenoid_stress/solenoid_1d.py +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/cfsem/solenoid_stress/solenoid_handcalc.py +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/cfsem/solenoid_stress/thick_wall_cylinder_handcalc.py +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/cfsem/types.py +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/docs/assets/logo.svg +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/docs/index.md +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/docs/javascripts/mathjax.js +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/docs/python/example_outputs/.placeholder +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/docs/python/examples.md +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/docs/python/filament.md +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/docs/python/flux_density.md +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/docs/python/force.md +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/docs/python/grad_shafranov.md +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/docs/python/inductance.md +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/docs/python/math.md +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/docs/python/solenoid_stress.md +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/docs/python/types.md +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/docs/python/vector_potential.md +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/docs/requirements.txt +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/docs/stylesheets/extra.css +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/examples/helmholtz.py +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/examples/inductance.py +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/katex-header.html +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/mkdocs.yml +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/src/lib.rs +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/src/math.rs +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/src/mesh.rs +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/src/physics/biotsavart.rs +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/src/physics/circular_filament.rs +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/src/physics/gradshafranov.rs +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/src/physics/linear_filament.rs +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/src/physics/mesh_filament.rs +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/src/physics/mod.rs +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/src/physics/point_source.rs +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/src/physics/volumetric.rs +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/src/python.rs +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/src/testing.rs +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/test/__init__.py +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/test/test_examples.py +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/test/test_filaments.py +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/test/test_funcs.py +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/test/test_gradshafranov.py +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/test/test_math.py +0 -0
- {cfsem-3.0.2 → cfsem-3.1.0}/test/test_solenoid_stress.py +0 -0
|
@@ -118,9 +118,10 @@ jobs:
|
|
|
118
118
|
matrix:
|
|
119
119
|
python-version: ['3.13']
|
|
120
120
|
platform:
|
|
121
|
-
- runner: macos-
|
|
121
|
+
- runner: macos-15-intel
|
|
122
122
|
target: x86_64
|
|
123
|
-
|
|
123
|
+
# macos-15 runner is arm64
|
|
124
|
+
- runner: macos-15
|
|
124
125
|
target: aarch64
|
|
125
126
|
steps:
|
|
126
127
|
- uses: actions/checkout@v4
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.1.0 2025-12-19
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
* Add method inductance_matrix_axisymmetric_coaxial_rectangular_coils to calculate inductance matrix for a set of coaxial coils with rectangular cross-section and prescribed current density per coil section
|
|
8
|
+
|
|
9
|
+
## 3.0.3 2025-11-06
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
* Use ternary instead of or-defaulting for array defaults in dipole functions
|
|
14
|
+
* Eliminates issue with ambiguous truthiness of arrays under some circumstances
|
|
15
|
+
|
|
3
16
|
## 3.0.2 2025-11-05
|
|
4
17
|
|
|
5
18
|
### Changed
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cfsem
|
|
3
|
-
Version: 3.0
|
|
3
|
+
Version: 3.1.0
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
7
7
|
Requires-Dist: numpy>=2
|
|
8
|
-
Requires-Dist: interpn[pydantic]>=0.
|
|
8
|
+
Requires-Dist: interpn[pydantic]>=0.8.2,<0.9
|
|
9
9
|
Requires-Dist: findiff>=0.12.1
|
|
10
10
|
Requires-Dist: pydantic>=2
|
|
11
11
|
Requires-Dist: pydantic-numpy>=6
|
|
@@ -292,6 +292,121 @@ def mutual_inductance_of_circular_filaments(rzn1: NDArray, rzn2: NDArray, par: b
|
|
|
292
292
|
return m # [H]
|
|
293
293
|
|
|
294
294
|
|
|
295
|
+
def inductance_matrix_axisymmetric_coaxial_rectangular_coils(
|
|
296
|
+
r: list[float],
|
|
297
|
+
z: list[float],
|
|
298
|
+
dr: list[float],
|
|
299
|
+
dz: list[float],
|
|
300
|
+
td: list[float],
|
|
301
|
+
nr: list[int],
|
|
302
|
+
nz: list[int],
|
|
303
|
+
) -> NDArray:
|
|
304
|
+
"""Inductance matrix for a set of coils with rectangular cross-sections and prescribed turn
|
|
305
|
+
density. Self-inductances are calculated using Lyle's 6th-order formula, mutual inductance
|
|
306
|
+
calculations use filamentized coil model. The filamentization inputs nr and nt are used primarily
|
|
307
|
+
to define the accuracy of the mutual inductance calculations, but do not impact assumed total current
|
|
308
|
+
or current density in each coil.
|
|
309
|
+
|
|
310
|
+
Args:
|
|
311
|
+
r: [m] radii, coil center
|
|
312
|
+
z: [m] axial positions, coil center
|
|
313
|
+
dr: [m] radial sizes of each coil pack
|
|
314
|
+
dz: [m] axial sizes of each coil pack
|
|
315
|
+
td: [turns/m^2] turn density in each coil pack (same as current density at 1A per turn)
|
|
316
|
+
nr: radial discretizations
|
|
317
|
+
nz: axial discretizations
|
|
318
|
+
|
|
319
|
+
Returns:
|
|
320
|
+
m: Mutual inductance matrix in [H] with size (ncoil, ncoil)
|
|
321
|
+
"""
|
|
322
|
+
|
|
323
|
+
# Check that all input lists have the same length
|
|
324
|
+
assert len(np.unique([len(r), len(z), len(dr), len(dz), len(td), len(nr), len(nz)])) == 1, (
|
|
325
|
+
"All input lists must have the same length."
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
# Check for sizes to be positive
|
|
329
|
+
assert all(size > 0 for size in dr), "All coil radial sizes must be positive."
|
|
330
|
+
assert all(size > 0 for size in dz), "All coil axial sizes must be positive."
|
|
331
|
+
|
|
332
|
+
# Check for discretizations to be positive integers
|
|
333
|
+
assert all(isinstance(n, int) and n > 0 for n in nr), (
|
|
334
|
+
"All radial discretizations must be positive integers."
|
|
335
|
+
)
|
|
336
|
+
assert all(isinstance(n, int) and n > 0 for n in nz), (
|
|
337
|
+
"All axial discretizations must be positive integers."
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
# Make sure that rectangular coil don't overlap
|
|
341
|
+
nc = len(r)
|
|
342
|
+
# Calculate turn number per coil
|
|
343
|
+
nt = [td[c] * dr[c] * dz[c] for c in range(nc)]
|
|
344
|
+
|
|
345
|
+
for c1 in range(nc):
|
|
346
|
+
# Corner points of coil 1
|
|
347
|
+
r1_min = r[c1] - dr[c1] / 2
|
|
348
|
+
r1_max = r[c1] + dr[c1] / 2
|
|
349
|
+
z1_min = z[c1] - dz[c1] / 2
|
|
350
|
+
z1_max = z[c1] + dz[c1] / 2
|
|
351
|
+
|
|
352
|
+
for c2 in range(c1 + 1, nc):
|
|
353
|
+
# Corner points of coil 2
|
|
354
|
+
r2_min = r[c2] - dr[c2] / 2
|
|
355
|
+
r2_max = r[c2] + dr[c2] / 2
|
|
356
|
+
z2_min = z[c2] - dz[c2] / 2
|
|
357
|
+
z2_max = z[c2] + dz[c2] / 2
|
|
358
|
+
|
|
359
|
+
# Check for radial overlap
|
|
360
|
+
radial_overlap = (
|
|
361
|
+
(r1_min > r2_min and r1_min < r2_max)
|
|
362
|
+
or (r1_max > r2_min and r1_max < r2_max)
|
|
363
|
+
or (r2_min > r1_min and r2_min < r1_max)
|
|
364
|
+
or (r2_max > r1_min and r2_max < r1_max)
|
|
365
|
+
)
|
|
366
|
+
|
|
367
|
+
# No need to check for axial overlap if no radial overlap
|
|
368
|
+
if not radial_overlap:
|
|
369
|
+
continue
|
|
370
|
+
|
|
371
|
+
# Check for axial overlap
|
|
372
|
+
axial_overlap = (
|
|
373
|
+
(z1_min > z2_min and z1_min < z2_max)
|
|
374
|
+
or (z1_max > z2_min and z1_max < z2_max)
|
|
375
|
+
or (z2_min > z1_min and z2_min < z1_max)
|
|
376
|
+
or (z2_max > z1_min and z2_max < z1_max)
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
assert not axial_overlap, f"Rectangular coils {c1} and {c2} overlap."
|
|
380
|
+
|
|
381
|
+
# Create filaments for each coil
|
|
382
|
+
filaments_list = []
|
|
383
|
+
for c in range(nc):
|
|
384
|
+
filaments = filament_coil(r=r[c], z=z[c], w=dr[c], h=dz[c], nt=nt[c], nr=nr[c], nz=nz[c])
|
|
385
|
+
filaments_list.append(filaments)
|
|
386
|
+
|
|
387
|
+
# Build symmetric inductance matrix
|
|
388
|
+
m = np.zeros((nc, nc), dtype=np.float64)
|
|
389
|
+
for c1 in range(nc):
|
|
390
|
+
for c2 in range(c1, nc):
|
|
391
|
+
if c1 == c2:
|
|
392
|
+
# Use Lyle's formula for self-inductance
|
|
393
|
+
m[c1, c2] = self_inductance_lyle6(
|
|
394
|
+
r=r[c1],
|
|
395
|
+
dr=dr[c1],
|
|
396
|
+
dz=dz[c1],
|
|
397
|
+
n=nt[c1], # Number of turns in the coil
|
|
398
|
+
)
|
|
399
|
+
else:
|
|
400
|
+
# Mutual inductance between different filamentized coils
|
|
401
|
+
m[c1, c2] = mutual_inductance_of_cylindrical_coils(
|
|
402
|
+
f1=filaments_list[c1].T,
|
|
403
|
+
f2=filaments_list[c2].T,
|
|
404
|
+
)
|
|
405
|
+
m[c2, c1] = m[c1, c2] # Symmetric matrix
|
|
406
|
+
|
|
407
|
+
return m # [H]
|
|
408
|
+
|
|
409
|
+
|
|
295
410
|
def self_inductance_axisymmetric_coil(
|
|
296
411
|
f: NDArray,
|
|
297
412
|
section_kind: Literal["rectangular", "circular", "annular"],
|
|
@@ -492,7 +492,7 @@ def flux_density_dipole(
|
|
|
492
492
|
loc = _3tup_contig(loc)
|
|
493
493
|
moment = _3tup_contig(moment)
|
|
494
494
|
xyzp = _3tup_contig(xyzp)
|
|
495
|
-
outer_radius = outer_radius
|
|
495
|
+
outer_radius = outer_radius if outer_radius is not None else zeros_like(loc[0])
|
|
496
496
|
outer_radius = ascontiguousarray(outer_radius).ravel()
|
|
497
497
|
|
|
498
498
|
bx, by, bz = em_flux_density_dipole(loc, moment, xyzp, outer_radius, par) # [T]
|
|
@@ -523,7 +523,7 @@ def vector_potential_dipole(
|
|
|
523
523
|
loc = _3tup_contig(loc)
|
|
524
524
|
moment = _3tup_contig(moment)
|
|
525
525
|
xyzp = _3tup_contig(xyzp)
|
|
526
|
-
outer_radius = outer_radius
|
|
526
|
+
outer_radius = outer_radius if outer_radius is not None else zeros_like(loc[0])
|
|
527
527
|
outer_radius = ascontiguousarray(outer_radius).ravel()
|
|
528
528
|
|
|
529
529
|
ax, ay, az = em_vector_potential_dipole(loc, moment, xyzp, outer_radius, par) # [T]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Example script for calculating the inductance matrix of a set of
|
|
3
|
+
rectangular coaxial coils with prescribed turn density.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import numpy as np
|
|
7
|
+
|
|
8
|
+
import cfsem
|
|
9
|
+
|
|
10
|
+
# Define a set of rectangular coils
|
|
11
|
+
r = [0.1, 0.15] # Radial positions of coil centers [m]
|
|
12
|
+
z = [0.0, 0.2] # Axial positions of coil centers [m]
|
|
13
|
+
dr = [0.05, 0.05] # Radial sizes of coils [m]
|
|
14
|
+
dz = [0.1, 0.1] # Axial sizes of coils [m]
|
|
15
|
+
td = [2500.0, 2500.0] # Turn density at 20mm x 20mm cross-section [turns/m^2]
|
|
16
|
+
nr = [10, 10] # Radial discretizations for mutual inductance
|
|
17
|
+
nz = [10, 10] # Axial discretizations for mutual inductance
|
|
18
|
+
|
|
19
|
+
L = cfsem.inductance_matrix_axisymmetric_coaxial_rectangular_coils(
|
|
20
|
+
r=r,
|
|
21
|
+
z=z,
|
|
22
|
+
dr=dr,
|
|
23
|
+
dz=dz,
|
|
24
|
+
td=td,
|
|
25
|
+
nr=nr,
|
|
26
|
+
nz=nz,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
print("Inductance matrix [H]:")
|
|
30
|
+
print(L)
|
|
@@ -4,7 +4,7 @@ build-backend = "maturin"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cfsem"
|
|
7
|
-
version = "3.0
|
|
7
|
+
version = "3.1.0"
|
|
8
8
|
description = "Quasi-steady electromagnetics including filamentized approximations, Biot-Savart, and Grad-Shafranov."
|
|
9
9
|
authors = [{name = "Commonwealth Fusion Systems", email = "jlogan@cfs.energy"}]
|
|
10
10
|
requires-python = ">=3.10, <3.14"
|
|
@@ -15,7 +15,7 @@ classifiers = [
|
|
|
15
15
|
]
|
|
16
16
|
dependencies = [
|
|
17
17
|
"numpy >= 2",
|
|
18
|
-
"interpn[pydantic]
|
|
18
|
+
"interpn[pydantic]>=0.8.2,<0.9",
|
|
19
19
|
"findiff >= 0.12.1",
|
|
20
20
|
"pydantic >= 2",
|
|
21
21
|
"pydantic-numpy >= 6"
|
|
@@ -7,7 +7,6 @@ import cfsem
|
|
|
7
7
|
|
|
8
8
|
from test import test_funcs as _test
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
@mark.parametrize("r", [0.775, np.pi])
|
|
12
11
|
@mark.parametrize("z", [0.0, np.e / 2, -np.e / 2])
|
|
13
12
|
@mark.parametrize("par", [True, False])
|
|
@@ -762,3 +761,117 @@ def test_vector_potential_linear_against_circular_filament(r, z, par):
|
|
|
762
761
|
assert np.allclose(a_phi, ay, rtol=1e-12, atol=1e-12) # Should match circular calc
|
|
763
762
|
assert np.allclose(az, np.zeros_like(az), atol=1e-9) # Should sum to zero everywhere
|
|
764
763
|
assert np.allclose(ax, np.zeros_like(ax), atol=1e-9) # ...
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
def test_inductance_matrix_axisymmetric_coaxial_rectangular_coils():
|
|
767
|
+
|
|
768
|
+
# Create set of four non-overlapping coaxial rectangular coils and prescribed turn density
|
|
769
|
+
r = [0.5, 1.0, 1.5, 2.0]
|
|
770
|
+
z = [0.0, -0.4, +0.2, 0.6]
|
|
771
|
+
dr = [0.1, 0.2, 0.3, 0.2]
|
|
772
|
+
dz = [0.2, 0.3, 0.3, 0.2]
|
|
773
|
+
td = [10.0, 10.0, 5.0, 5.0]
|
|
774
|
+
nr = [10, 10, 10, 10]
|
|
775
|
+
nz = [10, 10, 10, 10]
|
|
776
|
+
|
|
777
|
+
# Calculate inductance matrix using rectangular coil calc
|
|
778
|
+
L_rectangular_coils = cfsem.inductance_matrix_axisymmetric_coaxial_rectangular_coils(
|
|
779
|
+
r = r,
|
|
780
|
+
z = z,
|
|
781
|
+
dr = dr,
|
|
782
|
+
dz = dz,
|
|
783
|
+
td = td,
|
|
784
|
+
nr = nr,
|
|
785
|
+
nz = nz,
|
|
786
|
+
)
|
|
787
|
+
|
|
788
|
+
# One run with refined filamentization to make sure this does not significantly change results
|
|
789
|
+
L_rectangular_coils_fine = cfsem.inductance_matrix_axisymmetric_coaxial_rectangular_coils(
|
|
790
|
+
r = r,
|
|
791
|
+
z = z,
|
|
792
|
+
dr = dr,
|
|
793
|
+
dz = dz,
|
|
794
|
+
td = td,
|
|
795
|
+
nr = [n*2 for n in nr],
|
|
796
|
+
nz = [n*2 for n in nz],
|
|
797
|
+
)
|
|
798
|
+
assert np.allclose(L_rectangular_coils, L_rectangular_coils_fine, rtol=1e-6)
|
|
799
|
+
|
|
800
|
+
# Compare total inductance against fully filamentized calculation
|
|
801
|
+
nt = [td[c]*dr[c]*dz[c] for c in range(4)]
|
|
802
|
+
filaments = np.vstack([ cfsem.filament_coil(r[i], z[i], dr[i], dz[i], nt[i], nr[i], nz[i]) for i in range(4) ])
|
|
803
|
+
L_fully_filamentized = cfsem.self_inductance_axisymmetric_coil(
|
|
804
|
+
f = filaments.T,
|
|
805
|
+
section_kind = "rectangular",
|
|
806
|
+
section_size = (2e-3, 2e-3),
|
|
807
|
+
)
|
|
808
|
+
assert L_rectangular_coils.sum() == approx(L_fully_filamentized, rel=1e-2)
|
|
809
|
+
|
|
810
|
+
# Compare individual self-inductances against Lyle approx for first coil
|
|
811
|
+
for i in range(4):
|
|
812
|
+
L_lyle = cfsem.self_inductance_lyle6(
|
|
813
|
+
r = r[i],
|
|
814
|
+
dr = dr[i],
|
|
815
|
+
dz = dz[i],
|
|
816
|
+
n = nt[i],
|
|
817
|
+
)
|
|
818
|
+
# Should be identical because self_inductance_axisymmetric_coil uses the same underlying
|
|
819
|
+
# calculation, here we're also testing that self_inductance_axisymmetric_coil is using
|
|
820
|
+
# the correct indexing
|
|
821
|
+
assert L_rectangular_coils[i, i] == L_lyle
|
|
822
|
+
|
|
823
|
+
# Overlap check 1:
|
|
824
|
+
# "Corner" + "Corner" overlap
|
|
825
|
+
with raises(AssertionError):
|
|
826
|
+
# Overlapping coils in r
|
|
827
|
+
cfsem.inductance_matrix_axisymmetric_coaxial_rectangular_coils(
|
|
828
|
+
r = [+1.0, +1.8],
|
|
829
|
+
z = [-0.5, +0.3],
|
|
830
|
+
dr = [1.0, 1.0],
|
|
831
|
+
dz = [1.0, 1.0],
|
|
832
|
+
td = [1.0, 1.0],
|
|
833
|
+
nr = [10, 10],
|
|
834
|
+
nz = [10, 10],
|
|
835
|
+
)
|
|
836
|
+
|
|
837
|
+
# Overlap check 2:
|
|
838
|
+
# "Corner" + "Full R size" overlap
|
|
839
|
+
with raises(AssertionError):
|
|
840
|
+
# Overlapping coils in r
|
|
841
|
+
cfsem.inductance_matrix_axisymmetric_coaxial_rectangular_coils(
|
|
842
|
+
r = [+1.0, +1.8],
|
|
843
|
+
z = [-0.5, +0.3],
|
|
844
|
+
dr = [1.0, 4.0],
|
|
845
|
+
dz = [1.0, 1.0],
|
|
846
|
+
td = [1.0, 1.0],
|
|
847
|
+
nr = [10, 10],
|
|
848
|
+
nz = [10, 10],
|
|
849
|
+
)
|
|
850
|
+
|
|
851
|
+
# Overlap check 3:
|
|
852
|
+
# "Corner" + "Full Z size" overlap
|
|
853
|
+
with raises(AssertionError):
|
|
854
|
+
# Overlapping coils in z
|
|
855
|
+
cfsem.inductance_matrix_axisymmetric_coaxial_rectangular_coils(
|
|
856
|
+
r = [+1.0, +1.8],
|
|
857
|
+
z = [-0.5, +0.3],
|
|
858
|
+
dr = [1.0, 1.0],
|
|
859
|
+
dz = [1.0, 4.0],
|
|
860
|
+
td = [1.0, 1.0],
|
|
861
|
+
nr = [10, 10],
|
|
862
|
+
nz = [10, 10],
|
|
863
|
+
)
|
|
864
|
+
|
|
865
|
+
# Overlap check 4:
|
|
866
|
+
# Coil 1 fully inside Coil 2
|
|
867
|
+
with raises(AssertionError):
|
|
868
|
+
# Overlapping coils in both r and z
|
|
869
|
+
cfsem.inductance_matrix_axisymmetric_coaxial_rectangular_coils(
|
|
870
|
+
r = [+1.5, +1.6],
|
|
871
|
+
z = [-0.1, +0.1],
|
|
872
|
+
dr = [1.0, 2.0],
|
|
873
|
+
dz = [1.0, 2.0],
|
|
874
|
+
td = [1.0, 1.0],
|
|
875
|
+
nr = [10, 10],
|
|
876
|
+
nz = [10, 10],
|
|
877
|
+
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
version = 1
|
|
2
|
-
revision =
|
|
2
|
+
revision = 2
|
|
3
3
|
requires-python = ">=3.10, <3.14"
|
|
4
4
|
resolution-markers = [
|
|
5
5
|
"python_full_version >= '3.11'",
|
|
@@ -48,7 +48,7 @@ wheels = [
|
|
|
48
48
|
|
|
49
49
|
[[package]]
|
|
50
50
|
name = "cfsem"
|
|
51
|
-
version = "3.0
|
|
51
|
+
version = "3.1.0"
|
|
52
52
|
source = { editable = "." }
|
|
53
53
|
dependencies = [
|
|
54
54
|
{ name = "findiff" },
|
|
@@ -75,7 +75,7 @@ dev = [
|
|
|
75
75
|
[package.metadata]
|
|
76
76
|
requires-dist = [
|
|
77
77
|
{ name = "findiff", specifier = ">=0.12.1" },
|
|
78
|
-
{ name = "interpn", extras = ["pydantic"], specifier = ">=0.
|
|
78
|
+
{ name = "interpn", extras = ["pydantic"], specifier = ">=0.8.2,<0.9" },
|
|
79
79
|
{ name = "numpy", specifier = ">=2" },
|
|
80
80
|
{ name = "pydantic", specifier = ">=2" },
|
|
81
81
|
{ name = "pydantic-numpy", specifier = ">=6" },
|
|
@@ -443,27 +443,29 @@ wheels = [
|
|
|
443
443
|
|
|
444
444
|
[[package]]
|
|
445
445
|
name = "interpn"
|
|
446
|
-
version = "0.
|
|
446
|
+
version = "0.8.2"
|
|
447
447
|
source = { registry = "https://pypi.org/simple" }
|
|
448
448
|
dependencies = [
|
|
449
449
|
{ name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
|
|
450
450
|
{ name = "numpy", version = "2.3.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
|
|
451
451
|
]
|
|
452
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
453
|
-
wheels = [
|
|
454
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
455
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
456
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
457
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
458
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
459
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
460
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
461
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
462
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
463
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
464
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
465
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
466
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
452
|
+
sdist = { url = "https://files.pythonhosted.org/packages/08/b9/ce865437f4a1b52349c3c3f58f6423cab3f36462c42b1e6ac1f1a1720777/interpn-0.8.2.tar.gz", hash = "sha256:297c07c20423144bbd498881e4bad08b49375b23e1712c43ea96c2fe5353de1c", size = 1415340, upload-time = "2025-11-13T02:04:16.139Z" }
|
|
453
|
+
wheels = [
|
|
454
|
+
{ url = "https://files.pythonhosted.org/packages/95/03/7038c8a3769c433b049d42102c29443b324a0787f4d1a706c76e582bb1f2/interpn-0.8.2-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:d06b83b67befbc2d992094e68b979819e2c622b7dbafae066a358f43ed789612", size = 561171, upload-time = "2025-11-13T02:04:07.52Z" },
|
|
455
|
+
{ url = "https://files.pythonhosted.org/packages/45/47/6babee99519fb691700418157c3052cc13d3eec266a7c26c8d4a2e756cd7/interpn-0.8.2-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:1e67ad82aa4b8d794e0676a36ed6c5442eaf7a3d0a253d2ad1f3dba2f0c1ecd4", size = 495627, upload-time = "2025-11-13T02:04:05.777Z" },
|
|
456
|
+
{ url = "https://files.pythonhosted.org/packages/bc/4d/ee025c6e71cbf0c7f07dc33ed5283c04722f869d897f31c44751cb8137e2/interpn-0.8.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:28fe42cabe73e06bc707f09f1d73b02c1e06450d7dd181244cba8dcf10824f64", size = 509061, upload-time = "2025-11-13T02:03:54.546Z" },
|
|
457
|
+
{ url = "https://files.pythonhosted.org/packages/87/19/83d1b4b469322d62ea13a5e1ece74cc79faafdac6f770e90546606ada4ae/interpn-0.8.2-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:1347bf47908d2ddf93349d458a1975583fd320daae45e62eda602a8d5b15c5af", size = 394100, upload-time = "2025-11-13T02:03:57.91Z" },
|
|
458
|
+
{ url = "https://files.pythonhosted.org/packages/0c/32/2e648fa80b8082e5a608be8cdd1155b388d120dbd8b4ff33ee68e5b542bb/interpn-0.8.2-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6b95430b2137f643faba7f42e57a3fc3b94c80f00df611728618da122799601b", size = 398544, upload-time = "2025-11-13T02:03:59.553Z" },
|
|
459
|
+
{ url = "https://files.pythonhosted.org/packages/e8/2e/f78de7e14f6ad37cb3463ebd55b064758dc6a0616e6fd7e46f2417e52d2b/interpn-0.8.2-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ed558a2a4b5d21eb7a4f01fdee42c6244207e6744080dbf44733f34fff232ee9", size = 487355, upload-time = "2025-11-13T02:04:01.015Z" },
|
|
460
|
+
{ url = "https://files.pythonhosted.org/packages/bc/39/005eb2c09e19d90887217610c7f53e20f171db5e4f875b78d1356de524d4/interpn-0.8.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c0f19fc58b2d40500101145cd420671d16479524759e27387ecc75b9a0b70bcd", size = 563887, upload-time = "2025-11-13T02:04:02.447Z" },
|
|
461
|
+
{ url = "https://files.pythonhosted.org/packages/f2/0f/79755bb13c4813caacb6622737e3933b46722eaec47a487c0387c939ef5b/interpn-0.8.2-cp310-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:b22d3206435f0c008e7dea8da5800e9f4b666bf2eacf21b094e3833c7059e333", size = 538132, upload-time = "2025-11-13T02:04:09.142Z" },
|
|
462
|
+
{ url = "https://files.pythonhosted.org/packages/92/c5/044c4cb7354c350826415e82173ac38ba64241272e1cfca3c22019239a3b/interpn-0.8.2-cp310-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:e967d886b3ab7220f096fd0ca7e3e0feebf67e8efd9c621dfbe666c44c3bcfcd", size = 663225, upload-time = "2025-11-13T02:04:10.748Z" },
|
|
463
|
+
{ url = "https://files.pythonhosted.org/packages/36/67/2fe23128a89d45d438d3eee1f89cd6f091e24e53767372f0602cd83e002b/interpn-0.8.2-cp310-abi3-musllinux_1_2_i686.whl", hash = "sha256:1be431ada1856f741baeaa6bb3848348980db97cbbf091eec1554441f4313b18", size = 588138, upload-time = "2025-11-13T02:04:12.414Z" },
|
|
464
|
+
{ url = "https://files.pythonhosted.org/packages/fc/bc/f29e1613ba9d66e2129b04880c80b22bf90437f15e2ee5ba83a93f67ba7f/interpn-0.8.2-cp310-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:2d92aa971b0733c5dda0956788c31ca6294959b8c43d16c7f76643ecefb3d75b", size = 554986, upload-time = "2025-11-13T02:04:14.621Z" },
|
|
465
|
+
{ url = "https://files.pythonhosted.org/packages/db/13/18a9e0a100e2931e57453381b9f77c18632ed4bcc44e0cb3f945eee407c6/interpn-0.8.2-cp310-abi3-win32.whl", hash = "sha256:0981f951aa8bfd86a4180af648f2ba50de4bde1954e681ceb163eef95369d485", size = 304919, upload-time = "2025-11-13T02:04:19.279Z" },
|
|
466
|
+
{ url = "https://files.pythonhosted.org/packages/3f/e0/270c6eadb91b47128da19df2d5e480bb9df2af76b884100f0e3405098a91/interpn-0.8.2-cp310-abi3-win_amd64.whl", hash = "sha256:c234363466403bd58712c84ba618e33fdd0413a2cd233ab049057247b9bf7045", size = 506661, upload-time = "2025-11-13T02:04:17.49Z" },
|
|
467
|
+
{ url = "https://files.pythonhosted.org/packages/f6/03/c799ade7354bd731c27511b80038fddd036a329e1cd87bdd7d187e902abd/interpn-0.8.2-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:96ef5e8520711dbb3967b3df5b7d963176cfd8d5b906d146ebb60e95e7c33a57", size = 487660, upload-time = "2025-11-13T02:03:56.605Z" },
|
|
468
|
+
{ url = "https://files.pythonhosted.org/packages/f2/e0/e132ef2630bd691b1cce2fea982776ee5e53d7ab6d5ad405484ab171d567/interpn-0.8.2-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5d07de3386cb94ec46c18278fb61e3dd7f192b0175835a681051545fc51f5ea2", size = 538163, upload-time = "2025-11-13T02:04:04.013Z" },
|
|
467
469
|
]
|
|
468
470
|
|
|
469
471
|
[package.optional-dependencies]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|