Skip to content

Commit 0104b41

Browse files
author
Othman Abujazar
committed
Merge branch 'main' into thermal_physnums_fix
merge the main into branch
2 parents 3aac11c + fbd6ec6 commit 0104b41

76 files changed

Lines changed: 4133 additions & 3221 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

codecheck.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
echo "---- code check ---------"
3+
echo "ruff"
4+
ruff check --fix $(git ls-files '*.py')
5+
echo "pycodestyle"
6+
pycodestyle $(git ls-files '*.py')
7+
echo "pylint"
8+
pylint $(git ls-files '*.py')
9+
#echo "pytests"
10+
#pytest tests -s

docs/wordlist

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,6 @@ timemax
449449
NbSetpsPerPeriod
450450
NbSteps
451451

452-
453-
454-
455452
# electrostatic
456453
Kapton
457454
Capacitances
@@ -526,6 +523,18 @@ xlsxwriter
526523
Thermoset
527524
Polyphenylene
528525

526+
# mdb
527+
mdb
528+
CoreMaterial
529+
CoreType
530+
CoreGeometry
531+
DataSource
532+
eps
533+
ListAlt
534+
InterpolationLinear
535+
536+
537+
529538
# logging
530539
FEMMTLogger
531540
asctime

femmt/component.py

Lines changed: 265 additions & 361 deletions
Large diffs are not rendered by default.

femmt/drawing.py

Lines changed: 63 additions & 68 deletions
Large diffs are not rendered by default.

femmt/electro_magnetic/fields.pro

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@ PostOperation Map_local UsingPost MagDyn_a {
1717
//Print[ Mag_h_real, OnElementsOf Domain, File StrCat[DirResFields, "Mag_h_real", ExtGmsh], LastTimeStepOnly ] ;
1818
//Print[ Mag_h_imag, OnElementsOf Domain, File StrCat[DirResFields, "Mag_h_imag", ExtGmsh], LastTimeStepOnly ] ;
1919

20-
// Core Loss Density
21-
If(Flag_Generalized_Steinmetz_loss)
22-
Print[ piGSE, OnElementsOf Domain, File StrCat[DirResFields, "piGSE", ExtGmsh], LastTimeStepOnly ] ;
23-
EndIf
24-
25-
If(Flag_Steinmetz_loss)
26-
Print[ pSE, OnElementsOf Domain, File StrCat[DirResFields, "pSE", ExtGmsh], LastTimeStepOnly ] ;
27-
Print[ pSE_density, OnElementsOf Domain, File StrCat[DirResFields, "pSE_density", ExtGmsh], LastTimeStepOnly ] ;
28-
EndIf
2920

3021
//Print[ mur, OnElementsOf Domain, File StrCat[DirResFields, "mur", ExtGmsh], LastTimeStepOnly ] ;
3122
//Print[ mur_norm, OnElementsOf Domain, File StrCat[DirResFields, "mur_norm", ExtGmsh], LastTimeStepOnly ] ;

femmt/electro_magnetic/fields_time.pro

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,6 @@ PostOperation Map_local UsingPost MagDyn_a {
1919
//Print[ Mag_h_real, OnElementsOf Domain, File StrCat[DirResFields, "Mag_h_real", ExtGmsh], LastTimeStepOnly ] ;
2020
//Print[ Mag_h_imag, OnElementsOf Domain, File StrCat[DirResFields, "Mag_h_imag", ExtGmsh], LastTimeStepOnly ] ;
2121

22-
// Core Loss Density
23-
If(Flag_Generalized_Steinmetz_loss)
24-
Print[ piGSE, OnElementsOf Domain, File StrCat[DirResFields, "piGSE", ExtGmsh], LastTimeStepOnly ] ;
25-
EndIf
26-
27-
If(Flag_Steinmetz_loss)
28-
Print[ pSE, OnElementsOf Domain, File StrCat[DirResFields, "pSE", ExtGmsh], LastTimeStepOnly ] ;
29-
Print[ pSE_density, OnElementsOf Domain, File StrCat[DirResFields, "pSE_density", ExtGmsh], LastTimeStepOnly ] ;
30-
EndIf
31-
3222
//Print[ mur, OnElementsOf Domain, File StrCat[DirResFields, "mur", ExtGmsh], LastTimeStepOnly ] ;
3323
//Print[ mur_norm, OnElementsOf Domain, File StrCat[DirResFields, "mur_norm", ExtGmsh], LastTimeStepOnly ] ;
3424
//Print[ nur_re, OnElementsOf Domain, File StrCat[DirResFields, "nur_re", ExtGmsh], LastTimeStepOnly ] ;

femmt/electro_magnetic/ind_axi_python_controlled.pro

Lines changed: 22 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,11 @@ Group{
112112
DomainCC += Region[{DomainS}] ;
113113
// the linear and non linear domains to air and all windings
114114

115-
If(Flag_NL)
116-
Domain_Lin = Region[{Air}];
117-
For n In {1:n_windings}
118-
Domain_Lin += Region[{Winding~{n}, StrandedWinding~{n}}];
119-
EndFor
120-
Domain_Lin_NoJs = Region[{Air}];
121-
Domain_NonLin = Region[{Core}];
122-
Else
123-
Domain_Lin = Region[{Air, Core}];
124-
For n In {1:n_windings}
125-
Domain_Lin += Region[{Winding~{n}, StrandedWinding~{n}}];
126-
EndFor
127-
Domain_Lin_NoJs = Region[{Air, Core}];
128-
Domain_NonLin = Region[{}];
129-
EndIf
115+
Domain_Lin = Region[{Air, Core}];
116+
For n In {1:n_windings}
117+
Domain_Lin += Region[{Winding~{n}, StrandedWinding~{n}}];
118+
EndFor
119+
Domain_Lin_NoJs = Region[{Air, Core}];
130120
// Initialize the main domain to the core and core-shell domains
131121
Domain = Region[{DomainC, DomainCC}] ;
132122

@@ -208,7 +198,7 @@ Function {
208198
EndFor
209199

210200
If(Flag_Conducting_Core)
211-
sigma[#{Core}] = Complex[sigma_core, sigma_core_imag];
201+
sigma[#{Core}] = Complex[sigma_core_real, sigma_core_imag];
212202
sigma[#{Air}] = 0.;
213203
EndIf
214204
If(!Flag_Conducting_Core)
@@ -226,33 +216,16 @@ Function {
226216

227217
// Hysteresis Loss
228218
// Imaginary Part Of Permeability
229-
// Liste von Lukas hinterlegen
230-
//mu_imag[ #{Core} ] = mu0 * f_mu_imag[$1, $2];
231-
232-
If(!Flag_NL)
233-
If(Flag_Fixed_Loss_Angle)
234-
mu[#{Core}] = Complex[mu0*mur_real, -mu0*mur_imag] ;
235-
nu[#{Core}] = 1/mu[$1, $2] ;
236-
ElseIf(Flag_Permeability_From_Data)
237-
mu[#{Core}] = Complex[mu0*f_mu_real[$1], -mu0*f_mu_imag[$1]] ;
238-
nu[#{Core}] = 1/mu[$1, $2] ;
239-
Else
240-
mu[#{Core}] = mu0*mur ;
241-
nu[#{Core}] = 1/mu[$1, $2] ;
242-
EndIf
243219

220+
If(Flag_Fixed_Loss_Angle)
221+
mu[#{Core}] = Complex[mu0*mur_real, -mu0*mur_imag] ;
222+
nu[#{Core}] = 1/mu[$1, $2] ;
223+
ElseIf(Flag_Permeability_From_Data)
224+
mu[#{Core}] = Complex[mu0*f_mu_real[$1], -mu0*f_mu_imag[$1]] ;
225+
nu[#{Core}] = 1/mu[$1, $2] ;
244226
Else
245-
//nu[ #{Core} ] = nu_3kW[$1] ;
246-
//h[ #{Core} ] = h_3kW[$1];
247-
//dhdb_NL[ #{Core} ]= dhdb_3kW_NL[$1] ;
248-
//dhdb[ #{Core} ] = dhdb_3kW[$1] ;
249-
250-
//nu[ #{Core} ] = nu_N95[$1] ;
251-
nu[ #{Core} ] = nu~{Core_Material}[$1] ;
252-
h[ #{Core} ] = h~{Core_Material}[$1];
253-
//dhdb_NL[ #{Core} ]= dhdb_95_NL[$1] ;
254-
dhdb_NL[ #{Core} ]= dhdb_95100_NL[$1] ;
255-
dhdb[ #{Core} ] = dhdb~{Core_Material}[$1] ;
227+
mu[#{Core}] = mu0*mur ;
228+
nu[#{Core}] = 1/mu[$1, $2] ;
256229
EndIf
257230

258231
// Excitation Current
@@ -409,10 +382,14 @@ Resolution {
409382
CreateDir[DirResValsWinding~{n}];
410383
EndFor
411384

412-
// Non-linear iteration is always called. If system is linear, convergence will be achieved after one iteration.
413-
IterativeLoop[Nb_max_iter, stop_criterion, relaxation_factor]{
414-
GenerateJac[A] ; SolveJac[A] ;
415-
}
385+
If(!Flag_Permeability_From_Data)
386+
Generate[A] ; Solve[A] ;
387+
Else
388+
IterativeLoop[Nb_max_iter, stop_criterion, relaxation_factor]{
389+
GenerateJac[A] ; SolveJac[A] ;
390+
}
391+
EndIf
392+
416393

417394
SaveSolution[A] ;
418395

@@ -575,33 +552,6 @@ PostProcessing {
575552

576553

577554

578-
// ------------------------------------------------------------------------------------------------
579-
// Steinmetz Core Loss
580-
581-
// for piecewise linear currents
582-
// iGSE Integral explicitely solved
583-
// needs the result of Magb at peak current to evaluate the peak flux density
584-
// (Norm[{d a}]*2) is delta_B
585-
586-
If(Flag_Generalized_Steinmetz_loss)
587-
{ Name piGSE ; Value { Integral { [ Freq * ki * (Norm[{d a}]*2)^(beta-alpha) * (
588-
((Norm[{d a}]*2 / t_rise )^alpha) * t_rise +
589-
((Norm[{d a}]*2 / t_fall )^alpha) * t_fall
590-
// 10 abschnitte reinbauen
591-
// python überprüfung + vorfaktoren zu NULL
592-
) ] ; In Core ; Jacobian Vol ; Integration II ;} } }
593-
EndIf
594-
595-
If(Flag_Steinmetz_loss)
596-
{ Name pSE ; Value { Integral { [ CoefGeo * ki * Freq^alpha * (Norm[{d a}])^beta
597-
] ; In Core ; Jacobian Vol ; Integration II ;} } }
598-
599-
{ Name pSE_density ; Value { Integral { [ CoefGeo* ki * Freq^alpha * (Norm[{d a}])^beta
600-
] ; In Core ; Jacobian Vol ; Integration II ;} } }
601-
EndIf
602-
603-
604-
605555
// ------------------------------------------------------------------------------------------------
606556
// Hysteresis Losses (According To Complex Core Parameters)
607557

femmt/electro_magnetic/ind_axi_python_controlled_time.pro

Lines changed: 16 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -119,21 +119,12 @@ Group{
119119
DomainCC += Region[{DomainS}] ;
120120
// the linear and non linear domains to air and all windings
121121

122-
If(Flag_NL)
123-
Domain_Lin = Region[{Air}];
124-
For n In {1:n_windings}
125-
Domain_Lin += Region[{Winding~{n}, StrandedWinding~{n}}];
126-
EndFor
127-
Domain_Lin_NoJs = Region[{Air}];
128-
Domain_NonLin = Region[{Core}];
129-
Else
130-
Domain_Lin = Region[{Air, Core}];
131-
For n In {1:n_windings}
132-
Domain_Lin += Region[{Winding~{n}, StrandedWinding~{n}}];
133-
EndFor
134-
Domain_Lin_NoJs = Region[{Air, Core}];
135-
Domain_NonLin = Region[{}];
136-
EndIf
122+
Domain_Lin = Region[{Air, Core}];
123+
For n In {1:n_windings}
124+
Domain_Lin += Region[{Winding~{n}, StrandedWinding~{n}}];
125+
EndFor
126+
Domain_Lin_NoJs = Region[{Air, Core}];
127+
Domain_NonLin = Region[{}];
137128
// Initialize the main domain to the core and core-shell domains
138129
Domain = Region[{DomainC, DomainCC}] ;
139130

@@ -232,7 +223,7 @@ Function {
232223
EndFor
233224

234225
If(Flag_Conducting_Core)
235-
sigma[#{Core}] = Complex[sigma_core, sigma_core_imag];
226+
sigma[#{Core}] = Complex[sigma_core_real, sigma_core_imag];
236227
sigma[#{Air}] = 0.;
237228
EndIf
238229
If(!Flag_Conducting_Core)
@@ -251,33 +242,16 @@ Function {
251242

252243
// Hysteresis Loss
253244
// Imaginary Part Of Permeability
254-
// Liste von Lukas hinterlegen
255-
//mu_imag[ #{Core} ] = mu0 * f_mu_imag[$1, $2];
256-
257-
If(!Flag_NL)
258-
If(Flag_Fixed_Loss_Angle) //should be changed here for time_domain
259-
mu[#{Core}] = mu0*mur_real;
260-
nu[#{Core}] = 1/mu[$1] ;
261-
ElseIf(Flag_Permeability_From_Data) //should be changed here for time_domain
262-
mu[#{Core}] = mu0*f_mu_real[$1];
263-
nu[#{Core] = 1/mu[$1] ;
264-
Else
265-
mu[#{Core}] = mu0*mur ;
266-
nu[#{Core}] = 1/mu[] ;
267-
EndIf
268245

246+
If(Flag_Fixed_Loss_Angle) //should be changed here for time_domain
247+
mu[#{Core}] = mu0*mur_real;
248+
nu[#{Core}] = 1/mu[$1] ;
249+
ElseIf(Flag_Permeability_From_Data) //should be changed here for time_domain
250+
mu[#{Core}] = mu0*f_mu_real[$1];
251+
nu[#{Core] = 1/mu[$1] ;
269252
Else
270-
//nu[ #{Core} ] = nu_3kW[$1] ;
271-
//h[ #{Core} ] = h_3kW[$1];
272-
//dhdb_NL[ #{Core} ]= dhdb_3kW_NL[$1] ;
273-
//dhdb[ #{Core} ] = dhdb_3kW[$1] ;
274-
275-
//nu[ #{Core} ] = nu_N95[$1] ;
276-
nu[ #{Core} ] = nu~{Core_Material}[$1] ;
277-
h[ #{Core} ] = h~{Core_Material}[$1];
278-
//dhdb_NL[ #{Core} ]= dhdb_95_NL[$1] ;
279-
dhdb_NL[ #{Core} ]= dhdb_95100_NL[$1] ;
280-
dhdb[ #{Core} ] = dhdb~{Core_Material}[$1] ;
253+
mu[#{Core}] = mu0*mur ;
254+
nu[#{Core}] = 1/mu[] ;
281255
EndIf
282256

283257
// Excitation Current
@@ -457,7 +431,7 @@ Resolution {
457431
EndFor
458432
InitSolution[A] ;
459433
TimeLoopTheta[time0, timemax, delta_t, 1.]{ // Implicit Euler (theta=1)
460-
If(!Flag_NL)
434+
If(!Flag_Permeability_From_Data)
461435
Generate[A] ; Solve[A] ;
462436
Else
463437
IterativeLoop[Nb_max_iter, stop_criterion, relaxation_factor]{
@@ -605,34 +579,6 @@ PostProcessing {
605579
In DomainS ; Jacobian Vol ; Integration II ; } } }
606580

607581

608-
609-
610-
611-
// ------------------------------------------------------------------------------------------------
612-
// Steinmetz Core Loss
613-
614-
// for piecewise linear currents
615-
// iGSE Integral explicitely solved
616-
// needs the result of Magb at peak current to evaluate the peak flux density
617-
// (Norm[{d a}]*2) is delta_B
618-
619-
If(Flag_Generalized_Steinmetz_loss)
620-
{ Name piGSE ; Value { Integral { [ Freq * ki * (Norm[{d a}]*2)^(beta-alpha) * (
621-
((Norm[{d a}]*2 / t_rise )^alpha) * t_rise +
622-
((Norm[{d a}]*2 / t_fall )^alpha) * t_fall
623-
// 10 abschnitte reinbauen
624-
// python überprüfung + vorfaktoren zu NULL
625-
) ] ; In Core ; Jacobian Vol ; Integration II ;} } }
626-
EndIf
627-
628-
If(Flag_Steinmetz_loss)
629-
{ Name pSE ; Value { Integral { [ CoefGeo * ki * Freq^alpha * (Norm[{d a}])^beta
630-
] ; In Core ; Jacobian Vol ; Integration II ;} } }
631-
632-
{ Name pSE_density ; Value { Integral { [ CoefGeo* ki * Freq^alpha * (Norm[{d a}])^beta
633-
] ; In Core ; Jacobian Vol ; Integration II ;} } }
634-
EndIf
635-
636582
// hysteresis losses need to be studied in time domain simulation
637583
// Hysteresis Losses (According To Complex Core Parameters)
638584
// not true in time_domain

femmt/electro_magnetic/solver.pro

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,6 @@ Formulation {
135135
// Nabla x ( 1/mu Nabla x A)
136136
Galerkin { [ nu[Norm[{d a}], Freq] * Dof{d a} , {d a} ] ;
137137
In Domain_Lin ; Jacobian Vol ; Integration II ; }
138-
If(Flag_NL)
139-
Galerkin { [ nu[{d a}, Freq] * Dof{d a} , {d a} ] ;
140-
In Domain_NonLin ; Jacobian Vol ; Integration II ; }
141-
Galerkin { JacNL [ dhdb_NL[{d a}] * Dof{d a} , {d a} ] ;
142-
In Domain_NonLin ; Jacobian Vol ; Integration II ; }
143-
EndIf
144138

145139
// sigma d/dt A
146140
// technical current direction can be applied with neg. sigma (right hand rule)

femmt/electro_magnetic/solver_time.pro

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,6 @@ Formulation {
127127
// Nabla x ( 1/mu Nabla x A)
128128
Galerkin { [ nu[{d a}] * Dof{d a} , {d a} ] ;
129129
In Domain ; Jacobian Vol ; Integration II ; }
130-
//Galerkin { [ nu[Norm[{d a}], Freq] * Dof{d a} , {d a} ] ;
131-
//In Domain_Lin ; Jacobian Vol ; Integration II ; }
132-
If(Flag_NL)
133-
Galerkin { [ nu[{d a}, Freq] * Dof{d a} , {d a} ] ;
134-
In Domain_NonLin ; Jacobian Vol ; Integration II ; }
135-
Galerkin { JacNL [ dhdb_NL[{d a}] * Dof{d a} , {d a} ] ;
136-
In Domain_NonLin ; Jacobian Vol ; Integration II ; }
137-
EndIf
138130

139131
// sigma d/dt A
140132
// technical current direction can be applied with neg. sigma (right hand rule)

0 commit comments

Comments
 (0)