@@ -30,7 +30,7 @@ struct DefineResolution end
3030
3131 DefineJacobian ()(getdp_problem, workspace)
3232 DefineIntegration ()(getdp_problem)
33- DefineMaterialProps ()(getdp_problem, workspace)
33+ DefineMaterialProps ()(getdp_problem, workspace; temp_dependent_sigma = false )
3434 DefineConstants ()(getdp_problem, frequency)
3535 DefineDomainGroups ()(getdp_problem, f, workspace, active_cond)
3636 DefineConstraint ()(getdp_problem, f)
5555
5656 DefineJacobian ()(getdp_problem, workspace)
5757 DefineIntegration ()(getdp_problem)
58- DefineMaterialProps ()(getdp_problem, workspace)
58+ DefineMaterialProps ()(getdp_problem, workspace; temp_dependent_sigma = true )
5959 DefineConstants ()(getdp_problem, frequency, workspace)
6060 DefineDomainGroups ()(getdp_problem, f, workspace)
6161 DefineConstraint ()(getdp_problem, workspace)
118118
119119end
120120
121- @inline function (f:: DefineMaterialProps )(problem:: GetDP.Problem , workspace:: FEMWorkspace )
121+ @inline function (f:: DefineMaterialProps )(problem:: GetDP.Problem , workspace:: FEMWorkspace ;
122+ temp_dependent_sigma:: Bool = false )
122123 # Create material properties function
123124 func = GetDP. Function ()
124125
@@ -132,12 +133,20 @@ end
132133 )
133134 add_space! (func)
134135 GetDP. add! (func, " nu" , expression = 1 / (mat. mu_r * μ₀), region = [tag])
135- GetDP. add! (
136- func,
137- " sigma" ,
138- expression = isinf (mat. rho) ? 0.0 : 1 / mat. rho,
139- region = [tag],
140- )
136+
137+ sigma0 = isinf (mat. rho) ? 0.0 : 1 / mat. rho
138+ if temp_dependent_sigma && sigma0 != 0.0 && mat. alpha != 0.0
139+ # Temperature-dependent σ(T) = σ₀ / (1 + α·(T - T₀))
140+ # $1 receives {T} (Kelvin) from sigma[{T}] in Galerkin terms
141+ T0_K = mat. T0 + 273.15
142+ GetDP. add! (func, " sigma" ,
143+ expression = " $sigma0 / (1.0 + $(mat. alpha) * (\$ 1 - $T0_K ))" ,
144+ region = [tag])
145+ else
146+ # Constant sigma (insulator, no temp coeff, or non-thermal formulation)
147+ GetDP. add! (func, " sigma" , expression = sigma0, region = [tag])
148+ end
149+
141150 GetDP. add! (func, " epsilon" , expression = mat. eps_r * ε₀, region = [tag])
142151 GetDP. add! (func, " k" , expression = mat. kappa, region = [tag])
143152 end
296305 inds_reg = Int[]
297306 cables_reg = Dict {Int, Vector{Int}} ()
298307 boundary_reg = Int[]
308+ earth_surface_reg = Int[]
299309 is_magneto_thermal = fem_formulation isa MagnetoThermal
300310
301311 for tag in keys (workspace. core. physical_groups)
320330 surface_type == 3 && push! (material_reg[:DomainInf ], tag)
321331
322332 else
323- decode_boundary_tag (tag)[1 ] == 2 && push! (boundary_reg, tag)
333+ curve_type, layer_idx, _ = decode_boundary_tag (tag)
334+ curve_type == 2 && push! (boundary_reg, tag)
335+ # Earth-air interface (curve_type=3, layer_idx=1) for thermal Dirichlet BC
336+ (curve_type == 3 && layer_idx == 1 ) && push! (earth_surface_reg, tag)
324337 end
325338 end
326339 inds_reg = sort (inds_reg)
371384
372385 GetDP. add! (group, " Domain_Mag" , [" DomainCC" , " DomainC" ], " Region" )
373386 GetDP. add! (group, " Sur_Dirichlet_Mag" , boundary_reg, " Region" )
374- GetDP. add! (group, " Sur_Dirichlet_The" , boundary_reg, " Region" )
387+ GetDP. add! (group, " Sur_Dirichlet_The" , vcat ( boundary_reg, earth_surface_reg) , " Region" )
375388 GetDP. add! (group, " Sur_Convection_Thermal" , [], " Region" )
376389
377390 problem. group = group
429442 case! (voltage, " " )
430443
431444 # Current_2D
445+ # GetDP's complex (frequency-domain) formulation uses peak amplitudes:
446+ # a(t) = Re[ Â · exp(jωt) ]
447+ # Time-averaged Joule losses: P = 0.5·σ·|E|² = (I_peak/√2)²·R = I_rms²·R
448+ # User specifies RMS currents, so we scale by √2 to get peak amplitudes.
432449 current = assign! (constraint, " Current_2D" )
433450 for (idx, curr) in enumerate (workspace. energizations)
434- case! (current, " Con_$idx " , value = " Complex[$(real (curr)) , $(imag (curr)) ]" )
451+ peak_curr = curr * sqrt (2 ) # RMS → peak conversion
452+ case! (current, " Con_$idx " , value = " Complex[$(real (peak_curr)) , $(imag (peak_curr)) ]" )
435453 end
436454
437455 temp = assign! (constraint, " DirichletTemp" )
@@ -1029,20 +1047,34 @@ end
10291047 output_dir = joinpath (" results" , lowercase (resolution_name))
10301048 output_dir = replace (output_dir, " \\ " => " /" ) # for compatibility with Windows paths
10311049
1032- # Construct the final Operation vector
1033- GetDP. add! (resolution, resolution_name, [sys_mag, sys_the],
1034- Operation = [
1035- " CreateDir[\" $(output_dir) \" ]" ,
1036- " InitSolution[Sys_Mag]" ,
1037- " InitSolution[Sys_The]" ,
1050+ # Construct the final Operation vector with iterative Picard coupling
1051+ ops = [
1052+ " CreateDir[\" $(output_dir) \" ]" ,
1053+ " InitSolution[Sys_Mag]" ,
1054+ " InitSolution[Sys_The]" ,
1055+ # Solve thermal with zero source to initialize T = Tambient everywhere
1056+ # (prevents negative sigma from T=0K initial condition)
1057+ " Generate[Sys_The]" ,
1058+ " Solve[Sys_The]" ,
1059+ ]
1060+ # Picard iterations: Mag → The coupling with temperature-dependent σ
1061+ n_picard = 10
1062+ for _ in 1 : n_picard
1063+ append! (ops, [
10381064 " Generate[Sys_Mag]" ,
10391065 " Solve[Sys_Mag]" ,
10401066 " Generate[Sys_The]" ,
10411067 " Solve[Sys_The]" ,
1042- " SaveSolution[Sys_Mag]" ,
1043- " SaveSolution[Sys_The]" ,
1044- " PostOperation[LineParams]" ,
1045- ]
1068+ ])
1069+ end
1070+ append! (ops, [
1071+ " SaveSolution[Sys_Mag]" ,
1072+ " SaveSolution[Sys_The]" ,
1073+ " PostOperation[LineParams]" ,
1074+ ])
1075+
1076+ GetDP. add! (resolution, resolution_name, [sys_mag, sys_the],
1077+ Operation = ops
10461078 )
10471079 # Add the resolution to the problem
10481080 problem. resolution = resolution
0 commit comments