11"""Quasi-steady electromagnetics calcs"""
22
3- from typing import Tuple
43import numpy as np
5- from numpy .typing import NDArray
64from interpn import MulticubicRectilinear
7-
8- from cfsem .types import Array3xN
5+ from numpy .typing import NDArray
96
107from cfsem .bindings import (
8+ body_force_density_circular_filament_cartesian ,
9+ body_force_density_linear_filament ,
10+ filament_helix_path ,
1111 flux_circular_filament ,
12- flux_density_linear_filament ,
1312 flux_density_biot_savart ,
1413 flux_density_circular_filament ,
14+ flux_density_circular_filament_cartesian ,
15+ flux_density_dipole ,
16+ flux_density_linear_filament ,
1517 gs_operator_order2 ,
1618 gs_operator_order4 ,
1719 inductance_piecewise_linear_filaments ,
18- filament_helix_path ,
20+ mutual_inductance_circular_to_linear ,
1921 rotate_filaments_about_path ,
20- vector_potential_linear_filament ,
2122 vector_potential_circular_filament ,
22- flux_density_circular_filament_cartesian ,
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 ,
2724)
25+ from cfsem .types import Array3xN
2826
2927from .cfsem import ellipe , ellipk
3028
@@ -171,9 +169,7 @@ def mutual_inductance_piecewise_linear_filaments(
171169 return inductance # [H]
172170
173171
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 :
177173 """
178174 Axial B-field on centerline of an ideal (infinitely long) solenoid.
179175
@@ -194,8 +190,8 @@ def flux_density_ideal_solenoid(
194190def self_inductance_lyle6 (r : float , dr : float , dz : float , n : float ) -> float :
195191 """
196192 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+
199195 This estimate is viable up to an L/D of about 1.5, above which it
200196 rapidly accumulates error and eventually produces negative values.
201197
@@ -239,13 +235,7 @@ def self_inductance_lyle6(r: float, dr: float, dz: float, n: float) -> float:
239235 f = (
240236 ml
241237 + (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 )))
249239 / 5760.0 # 2nd order
250240 + (
251241 da2 ** 2
@@ -275,9 +265,7 @@ def self_inductance_lyle6(r: float, dr: float, dz: float, n: float) -> float:
275265 return self_inductance # [H]
276266
277267
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 :
281269 """
282270 Analytic mutual inductance between a pair of ideal cylindrically-symmetric coaxial filaments.
283271
@@ -294,16 +282,12 @@ def mutual_inductance_of_circular_filaments(
294282 float: [H] mutual inductance
295283 """
296284
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 )
300286
301287 return m # [H]
302288
303289
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 :
307291 """
308292 Analytical mutual inductance between two coaxial collections of ideal filaments.
309293
@@ -324,16 +308,12 @@ def mutual_inductance_of_cylindrical_coils(
324308
325309 # Using n2 as the current per filament is equivalent to examining a 1A reference current,
326310 # 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
330312
331313 return m # [H]
332314
333315
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 :
337317 """
338318 Create an array of filaments from coil cross-section, evenly spaced
339319 _inside_ the winding pack. No filaments are coincident with the coil surface.
@@ -365,9 +345,7 @@ def filament_coil(
365345 return filaments # [m], [m], [dimensionless]
366346
367347
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 :
371349 """
372350 Wien's formula for the self-inductance of a circular ring
373351 with thin circular cross section.
@@ -391,21 +369,19 @@ def self_inductance_circular_ring_wien(
391369 ra2 = (minor_radius / major_radius ) ** 2 # [], (rho / a)^2, dimensionless
392370 # Equation 7 in Rosa & Cohen lacks the factor of 1e-7
393371 # 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]
397373 return self_inductance # [H]
398374
399375
400376def self_inductance_distributed_axisymmetric_conductor (
401377 current : float ,
402- grid : Tuple [NDArray , NDArray ],
403- mesh : Tuple [NDArray , NDArray ],
404- b_part : Tuple [NDArray , NDArray ],
378+ grid : tuple [NDArray , NDArray ],
379+ mesh : tuple [NDArray , NDArray ],
380+ b_part : tuple [NDArray , NDArray ],
405381 psi_part : NDArray ,
406382 mask : NDArray ,
407- edge_path : Tuple [NDArray , NDArray ],
408- ) -> Tuple [float , float , float ]:
383+ edge_path : tuple [NDArray , NDArray ],
384+ ) -> tuple [float , float , float ]:
409385 """
410386 Calculation of a distributed conductor's self-inductance from two components:
411387
@@ -546,7 +522,8 @@ def self_inductance_annular_ring(r: float, a: float, b: float) -> float:
546522 and `(b/r)^2`.
547523
548524 References:
549- [1] E. B. Rosa and F. W. Grover, “Formulas and tables for the calculation of mutual and self-inductance (Revised),”
525+ [1] E. B. Rosa and F. W. Grover,
526+ “Formulas and tables for the calculation of mutual and self-inductance (Revised),”
550527 BULL. NATL. BUR. STAND., vol. 8, no. 1, p. 1, Jan. 1912,
551528 doi: [10.6028/bulletin.185](https://doi.org/10.6028/bulletin.185)
552529
0 commit comments