3-Dimensional Natural Convection

Numerical methods and mathematical models of Elmer
Post Reply
MrChips
Posts: 33
Joined: 12 Jul 2016, 00:16
Antispam: Yes
Location: Canada

3-Dimensional Natural Convection

Post by MrChips »

I'm am trying to expand on a test case (naturalconvection3) that Peter developed in response to a previous thread I posted on non-boussinesq convection. This test case is done in 2-dimensions and I am trying to turn it into a simple 3-dimension case. I created a cylindrical mesh using Salome and converted the resulting UNV file in elmergrid to a mesh format (I used -autoclean as well).

Elmersolver either crashes or ends with 'invalid memory reference'. Here's what I have tried:

-Re-meshing with different mesh densities, including increasing mesh density along the boundary walls
-Changing the viscosity
-Lowering the convergence tolerance
-If I disable the Navier-Stokes solver and only run it with heat conduction I can get a solution. I tried this thinking there might be something wrong with the mesh I created (first time creating a 3D body)

This is the first time I have run a 3D case so I am sure I am missing something. If anybody has time to look at the case I would appreciate it.
Happy holidays!

-Clayton

Code: Select all

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

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

Constants
  Gravity(4) = 0 0 -1 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) = 1
  Name = "Body 1"
  Equation = 1
  Material = 1
  Body force = 1
  Initial condition = 1
End

Solver 2
  Equation = Heat Equation
  Procedure = "HeatSolve" "HeatSolver"
  Variable = Temperature
  Stabilize = False
  Bubbles = True
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-3
  Nonlinear Timestepping = Logical True
  Nonlinear System Convergence Tolerance = 1.0e-3
  Nonlinear System Max Iterations = 1
  Nonlinear System Newton After Iterations = 1000
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 0.6
  Linear System Solver = Iterative
  Linear System Iterative Method = GCR
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-6
  Linear System Preconditioning = ILU0
  Linear System Abort Not Converged = False
  Linear System Residual Output = 10
End

Solver 1
  Equation = Navier-Stokes
  Procedure = "FlowSolve" "FlowSolver"
  Variable = Flow Solution[Velocity:2 Pressure:1]
  !Stabilize = False
  Bubbles = True
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-3
  Nonlinear Timestepping = Logical True
  Nonlinear System Convergence Tolerance = 1.0e-3
  Nonlinear System Max Iterations = 1
  Nonlinear System Newton After Iterations = 1000
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 0.6
  Linear System Solver = Iterative
  Linear System Iterative Method = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-8
  Linear System Preconditioning = ILU2
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = True
  Linear System Residual Output = 10
End

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

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

Body Force 1
  Name = "Buoyancy"
  Flow Bodyforce 3 = -9.82
  !Pressure Single Node = real 0.0
End

Initial Condition 1
  Name = "Initial Guess for Air"
  Velocity 2 = 0.0
  Velocity 1 = 1.0e-9
  Temperature = 298
End

Boundary Condition 1
  Target Boundaries(1) = 1 
  Name = "Top"
  Temperature = 298
End

Boundary Condition 2
  Target Boundaries(1) = 3 
  Name = "Bottom"
  Temperature = 298.5
End

Boundary Condition 3
  Target Boundaries(1) = 2 
  Name = "Side"
End

Boundary Condition 3
  Target Boundaries(1) = 1 2 3 
  Name = "Drop Tube"
  Noslip wall BC = True
End

Attachments
wellmesh.zip
(496.83 KiB) Downloaded 300 times
case.sif
(3.5 KiB) Downloaded 288 times
dmitry
Posts: 53
Joined: 09 Dec 2014, 16:52
Antispam: Yes
Location: Russia

Re: 3-Dimensional Natural Convection

Post by dmitry »

Hi!
I just have look at SIF. I don't try to run the case.
One thing, I've spotted is:

Code: Select all

  Variable = Flow Solution[Velocity:2 Pressure:1]
In 3D case it should be

Code: Select all

  Variable = Flow Solution[Velocity:3 Pressure:1]
in order to initialize three components of Velocity vector.
Good luck! ;)
raback
Site Admin
Posts: 4823
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: 3-Dimensional Natural Convection

Post by raback »

Hi, You will probably also be constrained by memory so using a cheaper preconditioner than ILU2 for N-S equation may be a needed compromise. -Peter
MrChips
Posts: 33
Joined: 12 Jul 2016, 00:16
Antispam: Yes
Location: Canada

Re: 3-Dimensional Natural Convection

Post by MrChips »

Dmitry and Peter, thank you for your replies.

-I modified the velocity component so that it is accounted for in all directions :oops: ;
-I modified how I called out the no-slip boundary condition as it didn't like how I had it defined; and,
-I played around with the pre-conditioners a bit, but I am not worried about memory (20GB) or processing power (10 core) - using a gaming PC and will partition when appropriate.

I was very excited, as I thought I had the simulation running. Then I realized that while I was troubleshooting I increased the viscosity by a couple orders of magnitude and forgot to decrease it again. I ended up with a solution without any convection. I could not reach convergence with the viscosity of air. I am going to try:

-Increasing the mesh density;
-Decreasing the timestep size; and,
-Possibly trying to decrease the viscosity with time to help attain convergence. I'm not quite sure how to do this though.

Any other suggestions would be much appreciated. I've attached updated sif file in case it helps anybody with their runs.

Code: Select all

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

Simulation
  Max Output Level = 4
  Coordinate System = Cartesian
  Coordinate Mapping(3) = 1 2 3
  Simulation Type = Transient
  !Simulation Type = Steady state
  Steady State Max Iterations = 35
  Output Intervals = 1
  Timestepping Method = BDF
  BDF Order = 2
  Timestep intervals = 250
  Timestep Sizes = 0.5
  Solver Input File = case.sif
  Post File = case.vtu
  Coordinate Scaling = 0.001
  Output File = NC3D.result
  Restart File = steadystate.result
End

Constants
  Gravity(4) = 0 0 -1 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) = 1
  Name = "Body 1"
  Equation = 1
  Material = 1
  Body force = 1
  Initial condition = 1
End

Solver 1
  Equation = Heat Equation
  Procedure = "HeatSolve" "HeatSolver"
  Variable = Temperature
  Stabilize = False
  Bubbles = True
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-3
  Nonlinear Timestepping = Logical True
  Nonlinear System Convergence Tolerance = 1.0e-4
  Nonlinear System Max Iterations = 1
  Nonlinear System Newton After Iterations = 10000
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 0.6
  Linear System Solver = Iterative
  Linear System Iterative Method = GCR
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-8
  Linear System Preconditioning = ILU0
  Linear System Abort Not Converged = False
  Linear System Residual Output = 10
End

Solver 2
  Equation = Navier-Stokes
  Procedure = "FlowSolve" "FlowSolver"
  Variable = Flow Solution[Velocity:3 Pressure:1]
  Stabilize = False
  Bubbles = True
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-3
  Nonlinear Timestepping = Logical True
  Nonlinear System Convergence Tolerance = 1.0e-4
  Nonlinear System Max Iterations = 1
  Nonlinear System Newton After Iterations = 10000
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 0.6
  Linear System Solver = Iterative
  Linear System Iterative Method = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-10
  Linear System Preconditioning = ILU2
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = True
  Linear System Residual Output = 10
End

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

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

Body Force 1
  Name = "Buoyancy"
  Flow Bodyforce 3 = -9.82
  Pressure Single Node = real 0.0
End

Initial Condition 1
  Name = "Initial Guess for Air"
  Velocity 2 = 0.0
  Velocity 1 = 1.0e-9
  Temperature = 298
End

Boundary Condition 1
  Target Boundaries(1) = 1 
  Name = "Top"
  Temperature = 298
  Noslip wall BC = True
End

Boundary Condition 2
  Target Boundaries(1) = 3 
  Name = "Bottom"
  Temperature = 300
  Noslip wall BC = True
End

Boundary Condition 3
  Target Boundaries(1) = 2 
  Name = "Side"
  Noslip wall BC = True
End
Cheers,
Clayton
MrChips
Posts: 33
Joined: 12 Jul 2016, 00:16
Antispam: Yes
Location: Canada

Re: 3-Dimensional Natural Convection

Post by MrChips »

What a pain in the butt. It took a long time to do, but I was able to get the model to converge by slow ramping the viscosity from 10-1 to 10-5. However, as I approach the viscosity of air it diverges. Just going from 3.946e-5 to 1.985e-5 causes the Navier-Stokes solver to go to NaN. I started decreasing the timestep sizes and using more expensive preconditioners, but was unable to get convergence at 1.985e-5. The mesh I am using is also much finer than the original.

Here's a shot with the viscosity at 3.946e-5.
Image

I imagine the only thing else I can do is increase the mesh density again. However, 200 timesteps at 0.5 per takes me about 4 hours to run. For such a 'simple' run case the coupled system is extremely difficult to run through. Anyways, I would attach the mesh, but it is over the size limit for attachments. The case file is below though. You'll see the variable viscosity with time function. I'm hoping that it helps somebody else and if anybody has any other ideas they would be appreciated.

Cheers!
Clayton

Code: Select all

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

Simulation
  Max Output Level = 4
  Coordinate System = Cartesian
  Coordinate Mapping(3) = 1 2 3
  Simulation Type = Transient
  !Simulation Type = Steady state
  Steady State Max Iterations = 35
  Output Intervals = 1
  Timestepping Method = BDF
  BDF Order = 2
  Timestep intervals = 400
  Timestep Sizes = 0.25
  Solver Input File = case.sif
  Post File = caseG.vtu
  Coordinate Scaling = 0.001
  Output File = NC3D650.result
  Restart File = NC3D550.result
  Restart Position = 200
End

Constants
  Gravity(4) = 0 0 -1 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) = 1
  Name = "Body 1"
  Equation = 1
  Material = 1
  Body force = 1
  Initial condition = 1
End

Solver 1
  Equation = Heat Equation
  Procedure = "HeatSolve" "HeatSolver"
  Variable = Temperature
  Stabilize = False
  Bubbles = True
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-3
  Nonlinear Timestepping = Logical True
  Nonlinear System Convergence Tolerance = 1.0e-4
  Nonlinear System Max Iterations = 1
  Nonlinear System Newton After Iterations = 10000
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 0.66
  Linear System Solver = Iterative
  Linear System Iterative Method = GCR
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-8
  Linear System Preconditioning = ILU0
  Linear System Abort Not Converged = False
  Linear System Residual Output = 10
End

Solver 2
  Equation = Navier-Stokes
  Procedure = "FlowSolve" "FlowSolver"
  Variable = Flow Solution[Velocity:3 Pressure:1]
  Stabilize = False
  Bubbles = True
  Optimize Bandwidth = True
  Steady State Convergence Tolerance = 1.0e-3
  Nonlinear Timestepping = Logical True
  Nonlinear System Convergence Tolerance = 1.0e-4
  Nonlinear System Max Iterations = 1
  Nonlinear System Newton After Iterations = 10000
  Nonlinear System Newton After Tolerance = 1.0e-3
  Nonlinear System Relaxation Factor = 0.66
  Linear System Solver = Iterative
  Linear System Iterative Method = BiCGStab
  Linear System Max Iterations = 500
  Linear System Convergence Tolerance = 1.0e-10
  Linear System Preconditioning = ILU3
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = True
  Linear System Residual Output = 10
End

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

Material 1
  Name = "Air (room temperature)"
  Reference Temperature = 298
  !Viscosity = Variable Time
  !  MATC "if (tx<200) ((-0.00000981585*tx)+0.001983); else (0.00001983);"  
  Viscosity = 3.946e-5
  Heat expansion Coefficient = 3.43e-3
  Compressibility Model = Perfect Gas
  Reference Pressure = 101325
  Heat Conductivity = 0.0257
  Relative Permittivity = 1.00059
  Sound speed = 343.0
  Heat Capacity = 1005.0
  Density = 1.205
End

Body Force 1
  Name = "Buoyancy"
  Flow Bodyforce 3 = -9.82
  !Pressure Single Node = real 0.0
End

Initial Condition 1
  Name = "Initial Guess for Air"
  Velocity 2 = 0.0
  Velocity 1 = 1.0e-9
  Temperature = 298
End

Boundary Condition 1
  Target Boundaries(1) = 1 
  Name = "Top"
  Temperature = 298
  Noslip wall BC = True
End

Boundary Condition 2
  Target Boundaries(1) = 3 
  Name = "Bottom"
  Temperature = 300
  Noslip wall BC = True
End

Boundary Condition 3
  Target Boundaries(1) = 2 
  Name = "Side"
  Noslip wall BC = True
End
Post Reply