coupled fluid flow and heat simulation

Numerical methods and mathematical models of Elmer
Post Reply
fjullien
Posts: 4
Joined: 19 Mar 2020, 00:25
Antispam: Yes

coupled fluid flow and heat simulation

Post by fjullien »

Hi,

I'm trying to learn how to do a coupled fluid flow and heat simulation.
I have a simple geometry with a cube (air) and a hot plate:
cube.png
(93.89 KiB) Not downloaded yet
Steady state does converge after I set in solver Navier-Stokes:

Nonlinear System Newton After Iterations = 100
Nonlinear System Newton After Tolerance = 0.0

However, in Transient mode, it fails after on the second timestep:

Code: Select all

MAIN: -------------------------------------
MAIN:  Time: 2/10   20.000000000000000
MAIN: Estimated time left:  4.3 hours
MAIN: -------------------------------------
MAIN: 
...
FlowSolve: -------------------------------------
FlowSolve:  NAVIER-STOKES ITERATION           1
FlowSolve: -------------------------------------
FlowSolve: 
...
     490 0.3719E-03
     500 0.7719E-01
     501 0.7719E-01
ERROR:: IterSolve: Numerical Error: Too many iterations were needed.
Note: The following floating-point exceptions are signalling: IEEE_UNDERFLOW_FLAG IEEE_DENORMAL
STOP 1
Anyone could check my sif file ?

Code: Select all

Header
  CHECK KEYWORDS Warn
  Mesh DB "." "."
  Include Path ""
  Results Directory ""
End

Simulation
  Max Output Level = 5
  Coordinate System = Cartesian
  Coordinate Mapping(3) = 1 2 3
  Simulation Type = Transient
  Steady State Max Iterations = 1
  Output Intervals = 1
  Timestepping Method = BDF
  BDF Order = 1
  Timestep intervals = 10
  Timestep Sizes = 10
  Coordinate Scaling = 0.001
  Solver Input File = case.sif
  Post File = case.vtu
End

Constants
  Gravity(4) = 0 -1 0 9.82
  Stefan Boltzmann = 5.67e-08
  Permittivity of Vacuum = 8.8542e-12
  Boltzmann Constant = 1.3807e-23
  Unit Charge = 1.602e-19
End

Body 1
  Target Bodies(1) = 3
  Name = "Body 1"
  Equation = 1
  Material = 1
  Body Force = 1
  Initial condition = 1
End

Solver 1
  Equation = Result Output
  Single Precision = True
  Output Format = Vtu
  Output File Name = case
  Procedure = "ResultOutputSolve" "ResultOutputSolver"
  Exec Solver = Always
End

Solver 3
  Equation = Heat Equation
  Procedure = "HeatSolve" "HeatSolver"
  Variable = Temperature
  Exec Solver = After Timestep
  Stabilize = True
  Bubbles = False
  Lumped Mass Matrix = False
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-5
  Nonlinear System Convergence Tolerance = 1.0e-7
  Nonlinear System Max Iterations = 20
  Nonlinear System Newton After Iterations = 3
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 1
  Linear System Solver = Iterative
  Linear System Iterative Method = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-10
  BiCGstabl polynomial degree = 2
  Linear System Preconditioning = ILU0
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = True
  Linear System Residual Output = 10
  Linear System Precondition Recompute = 1
End

Solver 2
  Equation = Navier-Stokes
  Variable = Flow Solution[Velocity:3 Pressure:1]
  Procedure = "FlowSolve" "FlowSolver"
  Exec Solver = After Timestep
  Stabilize = False
  Bubbles = True
  Lumped Mass Matrix = False
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-5
  Nonlinear System Convergence Tolerance = 1.0e-7
  Nonlinear System Max Iterations = 20
  Nonlinear System Newton After Iterations = 100
  Nonlinear System Newton After Tolerance = 0.0
  Nonlinear System Relaxation Factor = 1
  Linear System Solver = Iterative
  Linear System Iterative Method = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-7
  BiCGstabl polynomial degree = 2
  Linear System Preconditioning = ILU0
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = True
  Linear System Residual Output = 10
  Linear System Precondition Recompute = 1
End

Equation 1
  Name = "Equation 1"
  Convection = Computed
  Active Solvers(3) = 1 3 2
End

Material 1
  Name = "Air (room temperature)"
  Heat expansion Coefficient = 3.43e-3
  Relative Permittivity = 1.00059
  Heat Conductivity = 0.0257
  Heat Capacity = 1005.0
  Viscosity = 1.983e-5
  Reference Temperature = 293
  Sound speed = 343.0
  Density = 1.205
End

Body Force 1
  Name = "BodyForce 1"
  Boussinesq = True
End

Initial Condition 1
  Name = "InitialCondition 1"
  Velocity 1 = 0
  Temperature = 293
  Velocity 2 = 1e-9
End

Boundary Condition 1
  Target Boundaries(1) = 2 
  Name = "Wall"
  Noslip wall BC = True
  Temperature = 293
End

Boundary Condition 2
  Target Boundaries(1) = 1 
  Name = "Plate"
  Noslip wall BC = True
  Temperature = 300
End
My mesh file and ElmerGUI project:
https://www.dropbox.com/s/9hvv0l9th9dzo ... e.zip?dl=0

I did try to set ILU(3) for Navier-Stokes but it craches ElmerSolver :(

Code: Select all

: ....Assembly done
DefUtils::DefaultDirichletBCs: Setting Dirichlet boundary conditions
DefUtils::DefaultDirichletBCs: Dirichlet boundary conditions set
FlowSolve: Dirichlet conditions done
CRS_IncompleteLU: ILU(3) (Real), Starting Factorization:

Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation.

Backtrace for this error:
#0  0x7f32ffd902ed in ???
#1  0x7f32ffd8f503 in ???
#2  0x7f32ff9c2f1f in ???
#3  0x7f3300271d99 in __generalutils_MOD_i2s
        at /build/elmerfem-csc-eg-mNdSQS/elmerfem-csc-eg-8.4-0ppa0/fem/src/GeneralUtils.F90:199
#4  0x7f330028f333 in initializeilu1
        at /build/elmerfem-csc-eg-mNdSQS/elmerfem-csc-eg-8.4-0ppa0/fem/src/CRSMatrix.F90:3333
#5  0x7f3300298fa0 in __crsmatrix_MOD_crs_incompletelu
        at /build/elmerfem-csc-eg-mNdSQS/elmerfem-csc-eg-8.4-0ppa0/fem/src/CRSMatrix.F90:3083
#6  0x7f33002cdfe6 in __itersolve_MOD_itersolver
        at /build/elmerfem-csc-eg-mNdSQS/elmerfem-csc-eg-8.4-0ppa0/fem/src/IterSolve.F90:712
#7  0x7f3300381799 in __solverutils_MOD_solvelinearsystem
        at /build/elmerfem-csc-eg-mNdSQS/elmerfem-csc-eg-8.4-0ppa0/fem/src/SolverUtils.F90:12857
#8  0x7f330037c319 in __solverutils_MOD_solvesystem
        at /build/elmerfem-csc-eg-mNdSQS/elmerfem-csc-eg-8.4-0ppa0/fem/src/SolverUtils.F90:13236
#9  0x7f33004ca00e in __defutils_MOD_defaultsolve
        at /build/elmerfem-csc-eg-mNdSQS/elmerfem-csc-eg-8.4-0ppa0/fem/src/DefUtils.F90:3263
#10  0x7f32dfbc3d61 in flowsolver_
        at /build/elmerfem-csc-eg-mNdSQS/elmerfem-csc-eg-8.4-0ppa0/fem/src/modules/FlowSolve.F90:1261
#11  0x7f330038b8fb in __mainutils_MOD_singlesolver
        at /build/elmerfem-csc-eg-mNdSQS/elmerfem-csc-eg-8.4-0ppa0/fem/src/MainUtils.F90:5161
#12  0x7f330039f1a8 in __mainutils_MOD_solveractivate
        at /build/elmerfem-csc-eg-mNdSQS/elmerfem-csc-eg-8.4-0ppa0/fem/src/MainUtils.F90:5403
#13  0x7f33003a19df in __mainutils_MOD_solveequations
        at /build/elmerfem-csc-eg-mNdSQS/elmerfem-csc-eg-8.4-0ppa0/fem/src/MainUtils.F90:2962
#14  0x7f330059c189 in execsimulation
        at /build/elmerfem-csc-eg-mNdSQS/elmerfem-csc-eg-8.4-0ppa0/fem/src/ElmerSolver.F90:2441
#15  0x7f330059c189 in elmersolver_
        at /build/elmerfem-csc-eg-mNdSQS/elmerfem-csc-eg-8.4-0ppa0/fem/src/ElmerSolver.F90:477
#16  0x5586d9a5117b in solver
        at /build/elmerfem-csc-eg-mNdSQS/elmerfem-csc-eg-8.4-0ppa0/fem/src/Solver.F90:69
#17  0x5586d9a50ece in main
        at /build/elmerfem-csc-eg-mNdSQS/elmerfem-csc-eg-8.4-0ppa0/fem/src/Solver.F90:34
Thanks in advance.

Franck.
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: coupled fluid flow and heat simulation

Post by raback »

Hi

You might look at some good practices from:
https://github.com/ElmerCSC/elmerfem/bl ... 3/case.sif

It may be a parameter problem. I.e. you cannot resolve the flow with the given resolution. You might ease the parameters to see whether this is the reason.

ILU3 probably runs out of memory.

-Peter
fjullien
Posts: 4
Joined: 19 Mar 2020, 00:25
Antispam: Yes

Re: coupled fluid flow and heat simulation

Post by fjullien »

Looks like it works with a smaller timestep.

Thanks for your help.

Franck.
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: coupled fluid flow and heat simulation

Post by kevinarden »

32,000 solid cube elements. Time step size = 1
Temperature at 13 seconds, one half section of model
t13s.png
(108.02 KiB) Not downloaded yet
mesh.zip
(653.83 KiB) Downloaded 258 times
case.sif
(3.45 KiB) Downloaded 269 times
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: coupled fluid flow and heat simulation

Post by raback »

Nice simulation!

You might adopt some strategies from the test case. For example, having just one nonlinear iteration and using the resources on the coupled system level usually makes sense for natural convection when the nonlinearity comes mainly from the coupling of the two equations. Also the "nonlinear timestepping" could have an advantage.

-Peter
fjullien
Posts: 4
Joined: 19 Mar 2020, 00:25
Antispam: Yes

Re: coupled fluid flow and heat simulation

Post by fjullien »

Thanks @kevinarden for your example.

I now changed my heat source from a contant 300K plate to a 50W heat flux and it seems to work (it is computing right now).

This is just the first step of a more complex simulation I would like to do.
My goal is to simulate a system with one or more bodies (heat flux) attached to a heatsink and all of this inside a volume of air (something like this: viewtopic.php?t=4168).

However, I don't know if it could be something I could do in a productive way using Elmer.
I spend so much time to prepare my simple cube-plate mesh in salome.
If I had to do this for a complex heatsink (an enclosure designed by extruded aluminium) with a lot of boundary surfaces that could become hard work.

In the mean time I'll look at comercial tools.

I'm an electronic engineer and I think I miss a lot of thermodynamics theory to work efficiently with Elmer.

Franck.
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: coupled fluid flow and heat simulation

Post by kevinarden »

Have you been through the salome tutorials on salome's site? Meshing should be much more efficient than that. Using geometry groups to create element groups is very helpful. Groups of volumes become bodies in elmer and groups of faces become boundaries.
fjullien
Posts: 4
Joined: 19 Mar 2020, 00:25
Antispam: Yes

Re: coupled fluid flow and heat simulation

Post by fjullien »

kevinarden wrote: 19 Mar 2020, 16:44 Groups of volumes become bodies in elmer and groups of faces become boundaries.
That's what I figured out after I followed this tutorial: https://www.youtube.com/watch?v=7PnblWYxYQQ

I could try to work on the system I described to at least see if I can make it and help other people to run this kind of simulation (I think there is a lot of electronic engineers interested in this setup).

I'll be back here when I have something.

Franck.
annier
Posts: 1168
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: coupled fluid flow and heat simulation

Post by annier »

fjullien wrote: 19 Mar 2020, 12:21 Looks like it works with a smaller timestep.
In context of ElmerSolver,in order to attain convergence in the numerical solution, especially when coupling navier-stokes equations with heat equation, the timestep size can be designed an order smaller than the length scale size .
E.g. if the length of a cube is 1 mm = 1.0E-03 m, then the times step size can be chosen to be equal to or smaller than 1.0E-04 s = 0.1 ms.


Yours Sincerely,
Anil Kunwar
Anil Kunwar
Faculty of Mechanical Engineering, Silesian University of Technology, Gliwice
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: coupled fluid flow and heat simulation

Post by mzenker »

fjullien wrote: 19 Mar 2020, 16:08 However, I don't know if it could be something I could do in a productive way using Elmer.
I spend so much time to prepare my simple cube-plate mesh in salome.
If I had to do this for a complex heatsink (an enclosure designed by extruded aluminium) with a lot of boundary surfaces that could become hard work.
Note that the meshing tool is not part of Elmer, so you have the choice. Elmer can import many formats.
If that helps, you can also use a geometry from another source (CAD). Just export to STEP format and import that one into Salomé or gmsh.

Matthias
Post Reply