Help for a simple CFD test case (NAN when running solver))

General discussion about Elmer
Post Reply
TFLOPs
Posts: 14
Joined: 24 Mar 2017, 00:02
Antispam: Yes

Help for a simple CFD test case (NAN when running solver))

Post by TFLOPs » 24 Mar 2017, 23:31

Hello, I'm desperately trying to run my first own test case:
It's a pipe filled with water (actually I'm using the "cylinder_in_channel.iges" from the Elmer samples directory) with:
- a no-slip boundary condition on side walls and the square obstacle (Boundary Condition 1)
- no boundary conditions on inlet and outlet faces
- a body force along the axis of the pipe

and I'm aiming for a steady state solution with the Navier-Stokes and K-Epsilon solvers

I think I'm missing something obvious, but I can't find what is it.
Here 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 = Steady state
  Steady State Max Iterations = 1
  Output Intervals = 1
  Timestepping Method = BDF
  BDF Order = 1
  Solver Input File = case.sif
  Post File = case.ep
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) = 1
  Name = "Body 1"
  Equation = 1
  Material = 1
  Body Force = 1
End

Solver 3
  Equation = K-Epsilon
  Procedure = "KESolver" "KESolver"
  Exec Solver = Always
  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 = Diagonal
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = False
  Linear System Residual Output = 1
  Linear System Precondition Recompute = 1
End

Solver 2
  Equation = Navier-Stokes
  Procedure = "FlowSolve" "FlowSolver"
  Variable = Flow Solution[Velocity:3 Pressure:1]
  Exec Solver = Always
  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 = Diagonal
  Linear System ILUT Tolerance = 1.0e-3
  Linear System Abort Not Converged = False
  Linear System Residual Output = 1
  Linear System Precondition Recompute = 1
End

Solver 1
  Equation = Result Output
  Output Format = Vtk
  Procedure = "ResultOutputSolve" "ResultOutputSolver"
  Output File Name = case
  Exec Solver = Always
End

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

Material 1
  Name = "Water (room temperature)"
  Viscosity Model = K-Epsilon
  Viscosity = 1.002e-3
  Heat expansion Coefficient = 0.207e-3
  Heat Conductivity = 0.58
  Relative Permittivity = 80.1
  Sound speed = 1497.0
  Heat Capacity = 4183.0
  Density = 998.3
End

Body Force 1
  Name = "BodyForce 1"
  Flow Bodyforce 1 = 1
End

Boundary Condition 1
  Target Boundaries(1) = 2 
  Name = "wall"
  Normal-Tangential Velocity = True
  Noslip wall BC = True
End
If someone can point me any suggestion or problem in the sif file, it would be infinitely appreciated.

Thanks to the Elmer Team and all contributors for providing this beautiful piece of free software ♡^▽^♡

mzenker
Posts: 1729
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Help for a simple CFD test case (NAN when running solver))

Post by mzenker » 27 Mar 2017, 10:32

Hi,

I am no expert in mechanics and CFD, but:

* You didn't tell us what your problem actually is... ;)
* Did you try to run one of the tutorials to start with?

HTH,

Matthias

TFLOPs
Posts: 14
Joined: 24 Mar 2017, 00:02
Antispam: Yes

Re: Help for a simple CFD test case (NAN when running solver))

Post by TFLOPs » 27 Mar 2017, 22:59

Problem is I get an instant NaN when running the solver.
By tweaking up viscosity (increasing) and introducing a relaxation of 0.5 I can get out of the Navier Stokes solver iterations, but when k-epsilon solver starts is a new insta-NaN.
Maybe is only a bad choice of parameters and algorithm for solving the case, but I suspect there's a subtle error other than that

I tried with various tutorial, they are good for learning, but I wanted to see if I really learned something right

mzenker
Posts: 1729
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Help for a simple CFD test case (NAN when running solver))

Post by mzenker » 28 Mar 2017, 10:50

OK - unfortunately I have no experience with those solvers.
One frequent general error is length units - most CADs work in mm, Elmer assumes m by default. But since you use a geometry file from the Elmer samples, this doesn't seem to be the problem.

Someone else has to take over here...

Matthias

annier
Posts: 1089
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: Help for a simple CFD test case (NAN when running solver))

Post by annier » 29 Mar 2017, 07:35

Hi TFLOPs,
1. NaN error in CFD run is a very common thing as you are having a coupling between nonlinear velocity variable and other variables. So, adjusting the simulation run is equally important when you include k-epsilon solver.

2. Type k epsilon in this forum and find the one with a completely running sif.

3. Present your complete test example so that the Elmer experts can check.

4. If you have big geometry/mesh file size , you can compress it as a zip file.


yours sincerely,
Anil Kunwar

TFLOPs
Posts: 14
Joined: 24 Mar 2017, 00:02
Antispam: Yes

Re: Help for a simple CFD test case (NAN when running solver))

Post by TFLOPs » 30 Mar 2017, 22:24

I have yet to find a fully working 3D case with k-epsilon, meanwhile I'm experimenting with many different settings and trying to document me better.
However, here is my full case that refuse to run.
Most settings were taken from the 2D Turbulent Incompressible Step Flow example.

Is a wall law required for the k-epsilon solver in order to work in 3D?
I've read somewhere in this forum that no no-slip boundary should be given when using k-epsilon, but the 2D turbulent incompressible step flow is working well with no wall law and with a no slip boundary
Attachments
case.rar
(1.21 MiB) Downloaded 66 times

TFLOPs
Posts: 14
Joined: 24 Mar 2017, 00:02
Antispam: Yes

Re: Help for a simple CFD test case (NAN when running solver))

Post by TFLOPs » 06 Apr 2017, 00:29

Hello
I'm almost sure that the problem is something related with the k-epsilon turbulence model boundary settings. NaN is immediate.

Here my latest attempt: a small duct (made with gmsh, dimensions are 0.1m x 0.2m x 1m length) filled with air, with a no slip boundary condition on walls, a periodic inlet/outlet and a body force of 10 N/m^3 along the pipe.
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 = Steady state
Steady State Max Iterations = 100
Output Intervals = 1
Timestepping Method = BDF
BDF Order = 1
Solver Input File = case.sif
Post File = case.ep
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) = 1
Name = "Body 1"
Equation = 1
Material = 1
Body Force = 1
End

Solver 2
Equation = K-Epsilon
Procedure = "KESolver" "KESolver"
Exec Solver = Always
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 = 1
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-10
BiCGstabl polynomial degree = 2
Linear System Preconditioning = Diagonal
Linear System ILUT Tolerance = 1.0e-3
Linear System Abort Not Converged = False
Linear System Residual Output = 1
Linear System Precondition Recompute = 1
End

Solver 1
Equation = Navier-Stokes
Variable = Flow Solution[Velocity:3 Pressure:1]
Procedure = "FlowSolve" "FlowSolver"
Exec Solver = Always
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 = 1
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-10
BiCGstabl polynomial degree = 2
Linear System Preconditioning = Diagonal
Linear System ILUT Tolerance = 1.0e-3
Linear System Abort Not Converged = False
Linear System Residual Output = 1
Linear System Precondition Recompute = 1
End

Solver 3
Equation = Result Output
Output Format = Vtu
Procedure = "ResultOutputSolve" "ResultOutputSolver"
Output File Name = case
Scalar Field 1 = Pressure
Vector Field 1 = Velocity
Exec Solver = After Simulation
End

Equation 1
Name = "Equation 1"
NS Convect = False
Active Solvers(3) = 2 1 3
End

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

Body Force 1
Name = "BodyForce 1"
Flow Bodyforce 3 = 10
End

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

Boundary Condition 2
Target Boundaries(1) = 1
Name = "periodic"
Periodic BC Pressure = True
Periodic BC Velocity 3 = True
Periodic BC Velocity 2 = True
Periodic BC Velocity 1 = True
Periodic BC = 3
End

Boundary Condition 3
Target Boundaries(1) = 6
Name = "outlet"
End
Where is the error?

mzenker
Posts: 1729
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Help for a simple CFD test case (NAN when running solver))

Post by mzenker » 06 Apr 2017, 10:38

Hi,

did you check your dimensions?
In gmsh, you are certainly not working in m, are you? If you are working in mm, you need

Coordinate Scaling = 0.001

in the Simulation section.

HTH,

Matthias

TFLOPs
Posts: 14
Joined: 24 Mar 2017, 00:02
Antispam: Yes

Re: Help for a simple CFD test case (NAN when running solver))

Post by TFLOPs » 06 Apr 2017, 20:52

I always use meters when doing things for CFD =)
But I think if that was the issue, then I would see some numbers before the NaN.
If I disable the k-epsilon solver and remove the viscosity model from the material, the simulation run nicely.
When I add the viscosity model to the material and enable the k-epsilon solver, even Navier Stokes gives me an insta-NaN

herrybraun
Posts: 1
Joined: 25 Oct 2017, 17:43
Antispam: Yes
Location: Leeds
Contact:

Re: Help for a simple CFD test case (NAN when running solver))

Post by herrybraun » 25 Oct 2017, 22:52

Hello, you are work on amazing solver but truly my knowledge is zero about this..So sorry..

Post Reply