Mortar does not conserve heat flux

Numerical methods and mathematical models of Elmer
Post Reply
Aerosmite
Posts: 5
Joined: 23 Mar 2023, 16:55
Antispam: Yes

Mortar does not conserve heat flux

Post by Aerosmite »

Hello everyone!

I have tried to use mortar with a rotational projector to design the air gap of an electric machine. The flux looks quite good in the rotor but there is a discontinuity when it go inside the stator. I have 33W dissipated in each pole of my rotor (6 in total) and my stator has 36 slots, so I except to receive 6/36*33W = 5.5W in each slot, but unfortunately it seems to still be 33W according to ParaView...

Maybe this feature only works for the same number of slices in the rotor and the stator? Here are some screenshots of the problem and my sif file (I don't define periodic boundaries as I know my result won't have any lateral flux). Also my convergence is very slow, so if you have some tips to make it faster it would be greatly appreciated ;)

Code: Select all

Header
  CHECK KEYWORDS "Warn"
  Mesh DB "mesh" ""
End

Simulation
  Coordinate System = Cartesian 3D
  Simulation Type = Steady state
  Output File = case.dat
  Output Variable 1 = Temperature
End

Constants
  Stefan Boltzmann = 5.6704e-08
End

! main
Equation 1
  Active Solvers(4) = 1 3 4 5   ! heat_solver, flux_solver, mat_solver, bndy_solver, 
End


! heat_solver
Solver 1
  Equation = HeatSolver
  Procedure = "HeatSolve" "HeatSolver"
  Variable = "Temperature"
  Apply Mortar BCs = True
  Export Lagrange Multiplier = True
  Stabilize = True
  Bubbles = True
  Lumped Mass Matrix = False
  Nonlinear System Newton After Iterations = 2
  Nonlinear System Newton After Tolerance = 0.01
  Nonlinear System Convergence Without Constraints = True
  Nonlinear System Relaxation Factor = 1
  Nonlinear System Convergence Tolerance = 1e-08
  Steady State Convergence Tolerance = 1e-08
  Nonlinear System Max Iterations = 50
  Linear System Solver = Iterative
  Linear System Iterative Method = BiCGStabL
  Linear System Max Iterations = 300
  Linear System Convergence Tolerance = 1e-08
  Linear System Preconditioning = ILU0
  Linear System ILUT Tolerance = 0.001
  Linear System Precondition Recompute = 1
  Linear System Abort Not Converged = False
  Linear System Residual Output = 10
End

! translate_solver
Solver 2
  Equation = RigidMeshMapper
  Procedure = "RigidMeshMapper" "RigidMeshMapper"
  Exec Solver = Before all
End

! flux_solver
Solver 3
  Equation = Flux and Gradient
  Procedure = "FluxSolver" "FluxSolver"
  Calculate Flux = True
  Calculate Grad = True
  Target Variable = Temperature
  Flux Coefficient = Heat Conductivity
End

! mat_solver
Solver 4
  Equation = SaveMaterials
  Procedure = "SaveData" "SaveMaterials"
  Exec Solver = after timestep
  Parameter 1 = Density
  Parameter 2 = Heat Capacity
End

! bndy_solver
Solver 5
  Equation = SaveBoundaryValues
  Procedure = "SaveData" "SaveBoundaryValues"
  Exec Solver = after timestep
  Parameter 1 = Heat Transfer Coefficient
  Parameter 2 = External Temperature
End

! scalar_solver
Solver 6
  Equation = SaveScalars
  Procedure = "SaveData" "SaveScalars"
  Filename = case.dat
  Exec Solver = after all
  Variable 1 = Temperature
  Operator 1 = nonlin converged
  Variable 2 = Temperature
  Operator 2 = nonlin iter
  Variable 3 = Temperature
  Operator 3 = steady state change
  Operator 4 = partitions
  Operator 5 = cpu time
  Variable 6 = Temperature
  Operator 6 = max
  Variable 7 = Temperature Flux
  Mask Name 7 = jacket
  Operator 7 = Boundary Int
  Variable 8 = Density
  Operator 8 = Int
  Variable 9 = Density
  Mask Name 9 = s_winding_slot
  Operator 9 = Body Int
End

! scalar_solver2
Solver 7
  Equation = SaveScalars2
  Procedure = "SaveData" "SaveScalars"
  Filename = case2.dat
  Exec Solver = after all
  Variable 1 = Temperature
  Mask Name 1 = s_iron
  Operator 1 = Body Mean
  Variable 2 = Temperature
  Mask Name 2 = s_iron
  Operator 2 = Body Max
  Variable 3 = Temperature
  Mask Name 3 = s_winding_slot
  Operator 3 = Body Mean
  Variable 4 = Temperature
  Mask Name 4 = s_winding_slot
  Operator 4 = Body Max
  Variable 5 = Temperature
  Mask Name 5 = housing
  Operator 5 = Body Mean
  Variable 6 = Temperature
  Mask Name 6 = housing
  Operator 6 = Body Max
  Variable 7 = Temperature
  Mask Name 7 = s_ENCA_resin
  Operator 7 = Body Mean
  Variable 8 = Temperature
  Mask Name 8 = s_ENCA_resin
  Operator 8 = Body Max
  Variable 9 = Temperature
  Mask Name 9 = s_ALKA_cap
  Operator 9 = Body Mean
  Variable 10 = Temperature
  Mask Name 10 = s_ALKA_cap
  Operator 10 = Body Max
  Variable 11 = Temperature
  Mask Name 11 = s_winding_head_W2
  Operator 11 = Body Mean
  Variable 12 = Temperature
  Mask Name 12 = s_winding_head_W2
  Operator 12 = Body Max
  Variable 13 = Temperature
  Mask Name 13 = s_winding_head
  Operator 13 = Body Mean
  Variable 14 = Temperature
  Mask Name 14 = s_winding_head
  Operator 14 = Body Max
  Variable 15 = Temperature
  Mask Name 15 = rotor
  Operator 15 = Body Mean
  Variable 16 = Temperature
  Mask Name 16 = rotor
  Operator 16 = Body Max
End

! scalar_solver3
Solver 8
  Equation = SaveScalars3
  Procedure = "SaveData" "SaveScalars"
  Filename = case_points.dat
  Save Coordinates(4,3) = Real 0.0602 0.0 0.04 0.061 0.0 0.04 0.0677 0.0 0.04 0.0744 0.0 0.04
  Exec Solver = after all
End

! data_solver
Solver 9
  Equation = ResultOutputSolver
  Procedure = "ResultOutputSolve" "ResultOutputSolver"
  Exec Solver = after timestep
  Output File Name = case
  Output Format = vtu
  Single Precision = True
  Binary Output = True
  Save Geometry Ids = True
  Calculate Loads = True
End


! s_air_gap
Material 1
  Density = 1.2
  Heat Capacity = 7e-05
  Heat Conductivity = 1000.0
End

! s_iron
Material 2
  Density = 7593.70493096647
  Heat Capacity = 474.9989636387775
  Heat Conductivity(3) = Variable Temperature
	Real
		293.15 31.37123668639053 31.37123668639053 2.0972545470964747
		393.15 34.458021696252466 34.458021696252466 2.109714640833059
	End

End

! housing
Material 3
  Density = 7800
  Heat Capacity = 480
  Heat Conductivity(3) = Variable Temperature
	Real
		293.15 49.5 49.5 49.5
		873.15 34.5 34.5 34.5
	End

End

! s_ENCA_resin
Material 4
  Density = 1690
  Heat Capacity = 1400
  Heat Conductivity = Real 0.585
End

! s_ALKA_cap
Material 5
  Density = 7800
  Heat Capacity = 480
  Heat Conductivity = Real 49.5
End

! s_winding_slot
Material 6
  Density = 4764.057352568158
  Heat Capacity = 593.1482649712046
  Heat Conductivity(3) = Variable Temperature
	Real
		293.15 1.2929851858067132 1.2929851858067132 169.92861755967462
		373.15 1.29290180578144 1.29290180578144 166.05371302576418
		473.15 1.2928634878417973 1.2928634878417973 164.33153323291512
		573.15 1.2928243595762183 1.2928243595762183 162.60935344006603
	End

End

! s_winding_head_leg
Material 7
  Density = 4764.057352568158
  Heat Capacity = 593.1482649712046
  Heat Conductivity(3) = Variable Temperature
	Real
		293.15 1.2929851858067132 1.2929851858067132 169.92861755967462
		373.15 1.29290180578144 1.29290180578144 166.05371302576418
		473.15 1.2928634878417973 1.2928634878417973 164.33153323291512
		573.15 1.2928243595762183 1.2928243595762183 162.60935344006603
	End

End

! s_winding_head_top_W1
Material 8
  Density = 3913.055337047106
  Heat Capacity = 689.6162206283718
  Heat Conductivity(3, 3) = Variable Temperature
	Real
		293.15 33.12406566289853 0.0 12.693566388431861 0.0 38.14507636765602 0.0 12.693566388431861 0.0 6.054599542968676
	End

End

! s_winding_head_top_W2
Material 9
  Density = 3913.055337047106
  Heat Capacity = 689.6162206283718
  Heat Conductivity(3, 3) = Variable Temperature
	Real
		293.15 33.12406566289853 0.0 -12.693566388431865 0.0 38.14507636765602 0.0 -12.693566388431865 0.0 6.0545995429686785
	End

End

! s_winding_head_mid
Material 10
  Density = 3913.055337047106
  Heat Capacity = 689.6162206283718
  Heat Conductivity(3) = Variable Temperature
	Real
		293.15 38.14507636765602 38.14507636765602 38.14507636765602
		373.15 37.276393995411745 37.276393995411745 37.276393995411745
		473.15 36.89031294108096 36.89031294108096 36.89031294108096
		573.15 36.50423188675017 36.50423188675017 36.50423188675017
	End

End

! s_winding_head_bot_W1
Material 11
  Density = 3913.055337047106
  Heat Capacity = 689.6162206283718
  Heat Conductivity(3, 3) = Variable Temperature
	Real
		293.15 26.726157127826824 0.0 17.12837885974377 0.0 38.14507636765602 0.0 17.12837885974377 0.0 12.452508078040383
		373.15 26.124747536150274 0.0 16.727469688892185 0.0 37.276393995411745 0.0 16.727469688892185 0.0 12.185189462073488
		473.15 25.85745417100196 0.0 16.549288155118475 0.0 36.89031294108096 0.0 16.54928815511847 0.0 12.066380708403267
		573.15 25.590160668694466 0.0 16.371106827083533 0.0 36.50423188675017 0.0 16.37110682708353 0.0 11.94757164612489
	End

End

! s_winding_head_bot_W2
Material 12
  Density = 3913.055337047106
  Heat Capacity = 689.6162206283718
  Heat Conductivity(3, 3) = Variable Temperature
	Real
		293.15 26.726157127826824 0.0 -17.12837885974377 0.0 38.14507636765602 0.0 -17.12837885974377 0.0 12.452508078040383
		373.15 26.124747536150274 0.0 -16.727469688892185 0.0 37.276393995411745 0.0 -16.727469688892185 0.0 12.185189462073488
		473.15 25.85745417100196 0.0 -16.549288155118475 0.0 36.89031294108096 0.0 -16.54928815511847 0.0 12.066380708403267
		573.15 25.590160668694466 0.0 -16.371106827083533 0.0 36.50423188675017 0.0 -16.37110682708353 0.0 11.94757164612489
	End

End

! s_winding_head_W1
Material 13
  Density = 3913.055337047106
  Heat Capacity = 689.6162206283718
  Heat Conductivity(3) = Variable Temperature
	Real
		293.15 1.0335888382111917 38.14507636765602 38.14507636765602
		373.15 1.0335430028120203 37.276393995411745 37.276393995411745
		473.15 1.033521938324274 36.89031294108096 36.89031294108096
		573.15 1.0335004280691926 36.50423188675017 36.50423188675017
	End

End

! s_winding_head_W2
Material 14
  Density = 3913.055337047106
  Heat Capacity = 689.6162206283718
  Heat Conductivity(3) = Variable Temperature
	Real
		293.15 1.0335888382111917 38.14507636765602 38.14507636765602
		373.15 1.0335430028120203 37.276393995411745 37.276393995411745
		473.15 1.033521938324274 36.89031294108096 36.89031294108096
		573.15 1.0335004280691926 36.50423188675017 36.50423188675017
	End

End

! r_air_gap
Material 15
  Density = 1.2
  Heat Capacity = 7e-05
  Heat Conductivity = 1000.0
End

! r_magnet
Material 16
  Density = 7400
  Heat Capacity = 460
  Heat Conductivity(3) = Variable Temperature
	Real
		293.15 7.6 7.6 7.6
		413.15 7.6 7.6 7.6
	End

End

! r_sleeve
Material 17
  Density = 1800
  Heat Capacity = 1000
  Heat Conductivity = Real 0.4
End

! r_inter_magnet
Material 18
  Density = 1690
  Heat Capacity = 1400
  Heat Conductivity = Real 0.585
End

! r_carrier
Material 19
  Density = 7800
  Heat Capacity = 480
  Heat Conductivity(3) = Variable Temperature
	Real
		293.15 49.5 49.5 49.5
		873.15 34.5 34.5 34.5
	End

End

! r_shaft
Material 20
  Density = 7800
  Heat Capacity = 480
  Heat Conductivity(3) = Variable Temperature
	Real
		293.15 49.5 49.5 49.5
		873.15 34.5 34.5 34.5
	End

End


! s_iron
Body 1
  Target Bodies(1) = 1
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 2  ! s_iron
  Body Force = 4  ! s_iron
  s_iron = Logical True
End

! s_winding_slot
Body 2
  Target Bodies(1) = 2
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 6  ! s_winding_slot
  Body Force = 1  ! s_winding_slot
  s_winding_slot = Logical True
End

! s_winding_head_W1
Body 3
  Target Bodies(1) = 3
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 13  ! s_winding_head_W1
  Body Force = 2  ! s_winding_head_W1
  s_winding_head_W1 = Logical True
End

! s_winding_head_W2
Body 4
  Target Bodies(1) = 4
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 14  ! s_winding_head_W2
  Body Force = 3  ! s_winding_head_W2
  s_winding_head_W2 = Logical True
End

! s_winding_head_leg
Body 5
  Target Bodies(1) = 5
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 7  ! s_winding_head_leg
  s_winding_head_leg = Logical True
End

! s_winding_head_mid
Body 6
  Target Bodies(1) = 6
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 10  ! s_winding_head_mid
  s_winding_head_mid = Logical True
End

! s_winding_head_top_W1
Body 7
  Target Bodies(1) = 7
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 8  ! s_winding_head_top_W1
  s_winding_head_top_W1 = Logical True
End

! s_winding_head_top_W2
Body 8
  Target Bodies(1) = 8
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 9  ! s_winding_head_top_W2
  s_winding_head_top_W2 = Logical True
End

! s_winding_head_bot_W1
Body 9
  Target Bodies(1) = 9
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 11  ! s_winding_head_bot_W1
  s_winding_head_bot_W1 = Logical True
End

! s_winding_head_bot_W2
Body 10
  Target Bodies(1) = 10
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 12  ! s_winding_head_bot_W2
  s_winding_head_bot_W2 = Logical True
End

! s_air_gap
Body 11
  Target Bodies(1) = 11
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 1  ! s_air_gap
  s_air_gap = Logical True
End

! housing
Body 12
  Target Bodies(1) = 12
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 3  ! housing
  housing = Logical True
End

! s_ENCA_resin
Body 13
  Target Bodies(1) = 13
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 4  ! s_ENCA_resin
  s_ENCA_resin = Logical True
End

! s_ALKA_cap
Body 14
  Target Bodies(1) = 14
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 5  ! s_ALKA_cap
  s_ALKA_cap = Logical True
End

! r_shaft
Body 15
  Target Bodies(1) = 15
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 20  ! r_shaft
  Body Force = 6  ! r_shaft
  r_shaft = Logical True
End

! r_magnet
Body 16
  Target Bodies(1) = 16
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 16  ! r_magnet
  Body Force = 5  ! r_magnet
  r_magnet = Logical True
End

! r_inter_magnet
Body 17
  Target Bodies(1) = 17
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 18  ! r_inter_magnet
  Body Force = 7  ! r_inter_magnet
  r_inter_magnet = Logical True
End

! r_carrier
Body 18
  Target Bodies(1) = 18
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 19  ! r_carrier
  Body Force = 8  ! r_carrier
  r_carrier = Logical True
End

! r_sleeve
Body 19
  Target Bodies(1) = 19
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 17  ! r_sleeve
  Body Force = 9  ! r_sleeve
  r_sleeve = Logical True
End

! r_air_gap
Body 20
  Target Bodies(1) = 20
  Equation = 1  ! main
  Initial Condition = 1  ! T_init
  Material = 15  ! r_air_gap
  Body Force = 10  ! r_air_gap
  r_air_gap = Logical True
End


! slot_liner_top
Boundary Condition 1
  Target Boundaries(1) = 10
  Heat Gap = True
  Heat Transfer Coefficient = 313.5
End

! slot_liner_bottom
Boundary Condition 2
  Target Boundaries(1) = 4
  Heat Gap = True
  Heat Transfer Coefficient = 313.5
End

! contact_housing
Boundary Condition 3
  Target Boundaries(1) = 1
  Heat Gap = True
  Heat Transfer Coefficient = 7700.0
End

! jacket
Boundary Condition 4
  Target Boundaries(1) = 2
  External Temperature = 293.625
  Heat Transfer Coefficient = 5798.161322047642
End

! r_air_gap
Boundary Condition 5
  Target Boundaries(1) = 11
  Mortar BC = 6
  Rotational Projector = True
  Rotational Projector Periods = 36
  Level Projector = True
  Level Projector Generic = True
  Save Projector = True
End

! s_air_gap
Boundary Condition 6
  Target Boundaries(1) = 12
End


! s_winding_slot
Body Force 1
  Heat Source = 219.24522095482507
End

! s_winding_head_W1
Body Force 2
  Heat Source = 209.6874100682609
End

! s_winding_head_W2
Body Force 3
  Heat Source = 216.3373744840316
End

! s_iron
Body Force 4
  Heat Source = 0.0
End

! r_magnet
Body Force 5
  Heat Source = 361.9205749677066
  Mesh Translate 1 = Real 1e-05
End

! r_shaft
Body Force 6
  Mesh Translate 1 = Real 1e-05
End

! r_inter_magnet
Body Force 7
  Mesh Translate 1 = Real 1e-05
End

! r_carrier
Body Force 8
  Mesh Translate 1 = Real 1e-05
End

! r_sleeve
Body Force 9
  Mesh Translate 1 = Real 1e-05
End

! r_air_gap
Body Force 10
  Mesh Translate 1 = Real 1e-05
End


! T_init
Initial Condition 1
  Temperature = 343.15
End

Image
Image
raback
Site Admin
Posts: 4828
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Mortar does not conserve heat flux

Post by raback »

Hi,

Without looking deeper into the problem I spot one issue from the picture: the stator and rotor should cover the same angle. The code make some tricks so that it can map the surface on each other. This cannot be done if they have different length. And there cannot even exist a solution which would have different periodicity for stator and rotor.

Btw, if you want continuous heat flux you can also for the FluxSolver (Apply Mortar BCs = True). Finite elements will standard Galerkin approximation is not conservative but the results improve when mesh is improved.

-Peter
Aerosmite
Posts: 5
Joined: 23 Mar 2023, 16:55
Antispam: Yes

Re: Mortar does not conserve heat flux

Post by Aerosmite »

Good morning,

Thanks for your very quick response! Unfortunately using Galerkin in the flux solver won't modify the temperature computed in the stator beforehand with a flux too high.

As my rotor is very fast, I believe a mixing-plane boundary condition would be perfect : https://www.cfd-online.com/Wiki/Best_pr ... layer_mesh. Is it implemented somewhere in Elmer? I can't find it on the documentation.

Mathieu
Aerosmite
Posts: 5
Joined: 23 Mar 2023, 16:55
Antispam: Yes

Re: Mortar does not conserve heat flux

Post by Aerosmite »

Up, still interested to know if such "mixing plane" condition exists, as otherwise I will have to copy several times the mesh to have the same angle for rotor and stator, which is not optimal.
Or maybe it is possible to set conforming mesh conditions just like surfaces but for duplicated volumes?

Mathieu
raback
Site Admin
Posts: 4828
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Mortar does not conserve heat flux

Post by raback »

Hi

No, there is no way of not having the slave and master occupy the same angle. The periodicity of the system defines the angle and I have hard time understanding how slave and master sides could have different periodicity.

-Peter
Aerosmite
Posts: 5
Joined: 23 Mar 2023, 16:55
Antispam: Yes

Re: Mortar does not conserve heat flux

Post by Aerosmite »

Hello,

Thanks for the reply, yes you're right it makes no sense to have different periodicity. I duplicated the stator so that its angle matches the rotor and now it works with mortar, thanks!

However, as the air velocity is very high in the air gap and I don't model it with CFD, I would like to impose the air gap temperature to be uniform. I tried to set the conductivity very high to reproduce this effect but I have convergence issues (the air gap is very thin). Is there a boundary condition parameter to do this? I wasn't able to find it myself in the docs.

Mathieu
Post Reply