
[Sponsors] 
July 31, 2018, 17:02 
simpleFoam

#1 
Member
Gurpreet Singh
Join Date: Jan 2017
Posts: 36
Rep Power: 5 
Hi Dear OpenFOAM Users,
I am trying to run steady state, incompressible and laminar flow through the circular pipe using OpenFOAM 5.0 version with “simpleFoam” solver. I made an axissymmetric mesh using Pointwise Meshing tool. The domain is of size ( Length of the pipe=5.0 m and radius of the pipe = 0.1 m ). I gave 200 mesh points in the axial and 10 mesh points in the radial direction. I have calculated the first cell height near the wall = (Radius/38). Input parameters: Velocity at the inlet = 1.0 m/s Density = 1.0 kg/m^3 Dynamics Viscosity = 2.0*10^3 kg/ms Based on these parameters, calculated Reynolds Number = 100 I run this case for 1000 iterations and I would like to know your valuable suggestions on..... (1): How to check whether my solution has converged or not? What parameters should I look at in the terminal? (2): The solver stopped iterating when endTime value reaches to 1000. I want to learn how can I tell the simpleFoam solver that stop iterating when it satisfies the convergence criteria set in the “ fvSolution ” file? (3): Why does the solver not stop iterating after reaching the Residual value equal to “ tolerance = 1e06 ” set in the fvSolution file. (4): What are the functions of the “ residualControl ” parameters defined in the fvSolution subdirectory “SIMPLE ” residualControl { p 1e2; U 1e3; "(kepsilonomegafv2)" 1e3; } I am attaching here some snapshots of simulation results. I will be very thankful to you for your valuable suggestions on these very basic questions. 

July 31, 2018, 17:55 

#2  
Member
Robin Kamenicky
Join Date: Mar 2016
Posts: 65
Rep Power: 7 
Hi Gurpreet,
Quote:
Quote:
Quote:
Quote:
Kind regards, Robin 

August 1, 2018, 03:16 

#3  
Senior Member
Robert
Join Date: May 2015
Location: Bremen, GER
Posts: 294
Rep Power: 8 
Quote:
Quote:
Quote:
Quote:
Code:
residualControl { p 1e2; U 1e3; "(kepsilonomegafv2)" 1e3; }
__________________
If you liked my answer to your question, please consider leaving a "Like" in return 

August 1, 2018, 16:28 

#4  
Member
Gurpreet Singh
Join Date: Jan 2017
Posts: 36
Rep Power: 5 
Quote:
Thanks a lot for your valuable comments on this topic. I still have a few doubts about this topic that I would like to ask... (1): You explained in the question #1 that convergence can be checked by looking at the residual levels of each variable such as Pressure, Ux, Uy and Uz. The solver will stop iterating further when one of the condition is satisfied first like endTime set in a controlDict file or residualControl set in the fvSolution. The residualControl will set the initial residual for all the variables and is the stopping criteria for the solver. In my simulation, Ux, P, and Uy already satisfied the convergence criteria given by residualControl (p 1e2 , U 1e3), except Uz. My question is as I am solving for a 2dimensional problem in XY plane. Uz (blue line) that one is highly unstable and does not converge. Will it affect my solution as I am solving the 2d problem if Uz has not converged? (2): As you explained in question # 3 that Tolerance defines the "Final residual" per timestep. I am unable to understand the difference between the Initial residual and the Final Residual. Can you please explain the difference between Initial and Final Residual? 

August 1, 2018, 16:30 

#5  
Member
Gurpreet Singh
Join Date: Jan 2017
Posts: 36
Rep Power: 5 
Quote:
Thanks a lot for your valuable comments on this topic. I still have a few doubts about this topic that I would like to ask... (1): You explained in the question #1 that convergence can be checked by looking at the residual levels of each variable such as Pressure, Ux, Uy and Uz. The solver will stop iterating further when one of the condition is satisfied first like endTime set in a controlDict file or residualControl set in the fvSolution. The residualControl will set the initial residual for all the variables and is the stopping criteria for the solver. In my simulation, Ux, P, and Uy already satisfied the convergence criteria given by residualControl (p 1e2 , U 1e3), except Uz. My question is as I am solving for a 2dimensional problem in XY plane. Uz (blue line) that one is highly unstable and does not converge. Will it affect my solution as I am solving the 2d problem if Uz has not converged? (2): As you explained in question # 3 that Tolerance defines the "Final residual" per timestep. I am unable to understand the difference between the Initial residual and the Final Residual. Can you please explain the difference between Initial and Final Residual? As you told me that Initial residual will set the criteria for stopping the iterating process. 

August 1, 2018, 16:54 

#6  
Member
Gurpreet Singh
Join Date: Jan 2017
Posts: 36
Rep Power: 5 
Quote:
Thanks a lot for your valuable comments on these basic questions. I still have a few doubts... (1): You explained that when the initial residual of all fields will satisfy the values in residualControls your simulation stops. Do I always need to look at only the initial residual values of all the variables in the terminal to check convergence? (2): It's not enough to check the convergence by looking at the initial residual. How should I proceed further to check the convergence of fields such as pressure drop, velocity profile etc? For this simulation, I plot the U_ magnitude vs radius of the pipe at different locations of the pipe. How can I know the convergence of field variables like Pressure drop, Velocity profile or shear stress? (3): When initial residual of all fields will satisfy the values in residualControls(p 1e3; U 1e3) your simulation stops. But at Time =999 in the log file, the initial residuals of Ux and p are less than the defined initial residuals in the residualControl. Due to this reason, Ux and P are not iterating further. But when you look at the Uy initial residual at a terminal at Time =999, why is it iterating further though it already satisfied the initial residual stopping criteria (U 1e3)? Uz is still iterating as it's not satisfying the stop iterating criteria. 

August 2, 2018, 02:57 

#7  
Senior Member
Robert
Join Date: May 2015
Location: Bremen, GER
Posts: 294
Rep Power: 8 
Quote:
Quote:
Quote:
Code:
solvers { "(UUFinal)" { tolerance 1e8; //Final residual for the variable per interation (final res. = relTol*inti. res) [...] } } SIMPLE { residualControl //Final residual for the solver to be considered converged. { p 1e6; U 1e6; } } Code:
Starting time loop Time = 1 smoothSolver: Solving for Ux, Initial residual = 1, Final residual = 9.10208e09, No Iterations 70 smoothSolver: Solving for Uz, Initial residual = 1, Final residual = 8.67753e09, No Iterations 64 Pressure gradient source: uncorrected Ubar = 0.000961546, pressure gradient = 9773.22 GAMG: Solving for p, Initial residual = 1, Final residual = 9.45473e09, No Iterations 37 time step continuity errors : sum local = 1.04551e08, global = 5.57877e17, cumulative = 5.57877e17 Pressure gradient source: uncorrected Ubar = 0.862177, pressure gradient = 1348.27 ExecutionTime = 0.17 s ClockTime = 1 s Time = 2 smoothSolver: Solving for Ux, Initial residual = 0.440793, Final residual = 9.80625e09, No Iterations 83 smoothSolver: Solving for Uz, Initial residual = 0.432395, Final residual = 8.15222e09, No Iterations 71 Pressure gradient source: uncorrected Ubar = 2.2077, pressure gradient = 10467.9 GAMG: Solving for p, Initial residual = 0.61368, Final residual = 6.8185e09, No Iterations 37 time step continuity errors : sum local = 1.06108e08, global = 8.51502e18, cumulative = 6.43027e17 Pressure gradient source: uncorrected Ubar = 1.13004, pressure gradient = 75.906 ExecutionTime = 0.2 s ClockTime = 1 s [...] Time = 364 smoothSolver: Solving for Ux, Initial residual = 1.00501e08, Final residual = 6.31539e09, No Iterations 1 smoothSolver: Solving for Uz, Initial residual = 9.01276e08, Final residual = 8.14041e09, No Iterations 2 Pressure gradient source: uncorrected Ubar = 1, pressure gradient = 11.4978 GAMG: Solving for p, Initial residual = 9.89647e07, Final residual = 9.45194e09, No Iterations 2 time step continuity errors : sum local = 4.58536e09, global = 3.02712e17, cumulative = 4.64292e15 Pressure gradient source: uncorrected Ubar = 1, pressure gradient = 11.4978 ExecutionTime = 7.33 s ClockTime = 8 s SIMPLE solution converged in 364 iterations The solver progresses with the next timestep: For Time = 2 the initial residual is smaller than the one from the previous timestep but larger than my residual control setting. The solver iterates until the final residual becomes smaller than the tolerance level. Again 1e9. Fast foreward to my last timestep: The Initial residual of all variables is smaller than my residualControl setting. The solver iterates one last time until the tolerance criterion is fulfilled, then terminates. Quote:
In timestep 1000 your Initial Residual matches your tolerance level, so you don't solve for the variable any more. Your simulation does not terminate due to the residualControl because your Uz does not match the residualControl value.
__________________
If you liked my answer to your question, please consider leaving a "Like" in return 

August 3, 2018, 16:04 

#8  
Member
Gurpreet Singh
Join Date: Jan 2017
Posts: 36
Rep Power: 5 
Quote:
I am using "Wedge"boundary condition as its is a axis symmetric problem and made this mesh on Pointwise tool. But I do not know wjy Openfoam is solving for Uz component of velocity as I gave Wedge boundary condition in Z direction and solving in xy plane. Do you have any idea? 

August 4, 2018, 12:54 

#9  
Member
Robin Kamenicky
Join Date: Mar 2016
Posts: 65
Rep Power: 7 
Hi Gurpreet,
I am very sorry for late answer. However, it seems that Robert has answered all your questions very well. Quote:
Printing U_magnitude vs radius and hence velocity profile is great way to be ensured that simulation converges. We can consider a simulation to be converged when nothing changes with subsequent "time" steps. Thus, if the velocity profile at defined location does not changes. You can check quite a bit of values in paraview, use 6.2 Postprocessing command line interface (CLI) or possibly pyFoam (Although I do not have much experience with it so I am not sure). Quote:
When the wedge BC is used it still apparently solve the governing equations in the third directions. Despite that it is claimed to be BC for 2D cases. Also other assumptions than for empty BC are used as it is a bit described in OpenFOAM guide (anlge about 1°, geometry running along the centre line straddling one of the coordinate plates, one element thick). It is axisymmetric BC, therefore geometry, boundary conditions as well as flow should be axisymmetric. This leads to the conclusion that perpendicular flow to the 2D plane should be minor and not influence the main flow patterns. You can have a look at the U_z in paraview. I would expect it to be a few magnitudes lower than U_y and U_x. If you still feel hesitating about the role of the U_z then make sure that the U converged. So print a few velocity profiles and make yourself sure that those do not change (or the change is negligible) as the "time" goes. I hope I answered rest of your questions, if something is not clear let me know. Kind regards, Robin 

Tags 
convergence criterion, residuals, tolerances 
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
interFoam vs. simpleFoam channel flow comparison  DanM  OpenFOAM Running, Solving & CFD  12  January 31, 2020 15:26 
MPI error with simpleFoam  blaise  OpenFOAM Running, Solving & CFD  0  November 7, 2015 14:01 
simpleFoam parallel solver & Fluent polyhedral mesh  Zlatko  OpenFOAM Running, Solving & CFD  3  September 26, 2014 06:53 
Laminar simpleFoam and inviscid simpleFoam  herenger  OpenFOAM Running, Solving & CFD  7  July 11, 2013 06:27 
Trying to run a benchmark case with simpleFoam  spsb  OpenFOAM  3  February 24, 2012 09:07 