
[Sponsors] 
Pressure difference as an input to simpleFoam 

LinkBack  Thread Tools  Search this Thread  Display Modes 
May 5, 2022, 06:01 

#21 
New Member
Zhen Liao
Join Date: Apr 2022
Posts: 16
Rep Power: 4 
I used the fvSchemes that is the same as the tutorials case pitzDaily.
And I haven't simulated a more complex geometry yet. I'm now simulated a channel/fracture with some roughness, the newest result seems good to me. I'll try to model some fracture network later. Maybe you can try Tobermory's advice, i.e., adjust the tolerances, residualControls, and add a minIter? 

June 6, 2022, 23:58 
Encountered a problem: Final residual = nan

#22  
New Member
Zhen Liao
Join Date: Apr 2022
Posts: 16
Rep Power: 4 
Quote:
These days I'm simulating water flow through a 2D rough fracture under a pressure gradient by simpleFoam. The setting for the fvSolution is as follows: Code:
solvers { p { solver GAMG; tolerance 1e8; relTol 0; smoother GaussSeidel; minIter 1; } U { solver smoothSolver; smoother symGaussSeidel; tolerance 1e8; relTol 0; minIter 1; } } SIMPLE { nNonOrthogonalCorrectors 0; consistent yes; residualControl { p 1e6; U 1e6; } } relaxationFactors { fields { p 0.3; } equations { U 0.7; } } Code:
Time = 1000 smoothSolver: Solving for Ux, Initial residual = 0.000291035, Final residual = 9.60557e09, No Iterations 10 smoothSolver: Solving for Uy, Initial residual = 0.000322102, Final residual = 7.96566e09, No Iterations 10 GAMG: Solving for p, Initial residual = 0.00108005, Final residual = 8.47719e09, No Iterations 56 time step continuity errors : sum local = 1.84608e06, global = 7.58599e09, cumulative = 4.27814e05 ExecutionTime = 20234.6 s ClockTime = 20234 s Time = 2000 smoothSolver: Solving for Ux, Initial residual = 6.59773e05, Final residual = 6.16032e09, No Iterations 9 smoothSolver: Solving for Uy, Initial residual = 7.23523e05, Final residual = 5.38957e09, No Iterations 9 GAMG: Solving for p, Initial residual = 0.000254187, Final residual = 8.27609e09, No Iterations 33 time step continuity errors : sum local = 1.97593e06, global = 1.4394e07, cumulative = 3.39222e05 ExecutionTime = 36473.9 s ClockTime = 36474 s Time = 4000 smoothSolver: Solving for Ux, Initial residual = 0.0163418, Final residual = 6.67672e09, No Iterations 17 smoothSolver: Solving for Uy, Initial residual = 0.017233, Final residual = 9.55891e09, No Iterations 16 GAMG: Solving for p, Initial residual = 0.0172172, Final residual = 7.92271e09, No Iterations 71 time step continuity errors : sum local = 3.07673e05, global = 2.52422e07, cumulative = 3.41828e05 ExecutionTime = 60182 s ClockTime = 60182 s Time = 4702 smoothSolver: Solving for Ux, Initial residual = 0.992508, Final residual = 5.36214e+08, No Iterations 1000 smoothSolver: Solving for Uy, Initial residual = 0.996478, Final residual = 1.43153e+09, No Iterations 1000 GAMG: Solving for p, Initial residual = 1, Final residual = nan, No Iterations 1000 time step continuity errors : sum local = nan, global = nan, cumulative = nan ExecutionTime = 84536.6 s ClockTime = 84536 s Time = 4703 smoothSolver: Solving for Ux, Initial residual = nan, Final residual = nan, No Iterations 1000 smoothSolver: Solving for Uy, Initial residual = nan, Final residual = nan, No Iterations 1000 GAMG: Solving for p, Initial residual = nan, Final residual = nan, No Iterations 1000 time step continuity errors : sum local = nan, global = nan, cumulative = nan ExecutionTime = 84926.2 s ClockTime = 84926 s Can you give me some advice? Thank you very much! PS, though the fracture is pretty rough, the perssure gradient is relative small so that the Re is small and the flow should not get to turbulence. 

June 7, 2022, 02:45 

#23  
Senior Member
Josh Williams
Join Date: Feb 2021
Location: Scotland
Posts: 113
Rep Power: 5 
Quote:
Quote:


June 7, 2022, 09:05 

#24 
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 672
Rep Power: 14 
Just to add to Josh's excellent suggestions  the "nan" value for continuity residual is indeed a sign that your solution has blown up, and I would also suggest checking your mesh quality, boundary conditions and reducing the relaxation factors slightly.
Moving to a transient solver will probably be more stable, but will likely take longer to get to your steady solution, so worth trying a little longer to get the steady solver to work. Of course, a slow approach to a correct solution is better than a fast approach to a junk solution, so take my advice with a pinch of salt! Good luck. 

June 9, 2022, 22:39 

#25  
New Member
Zhen Liao
Join Date: Apr 2022
Posts: 16
Rep Power: 4 
Quote:
I'll try the pimpleFoam later. And, I used the pressuredriven type according to me research objective, but maybe I'll consider the flowdriven ones later. Best! 

June 9, 2022, 22:47 

#26  
New Member
Zhen Liao
Join Date: Apr 2022
Posts: 16
Rep Power: 4 
Quote:
Thank you for your advice. The boundary conditions should be no problem, as it got a good solution when the pressure gradient was small, and there is not any quite skewed mesh. And I tried reducing the relaxation factor to 0.5 & 0.3, both of them encountered the same problem. I think I'll try the pimpleFoam. Best, 

July 2, 2022, 12:07 
pimpleFoam didn't converged, encountered "core dumped" problem

#27  
New Member
Zhen Liao
Join Date: Apr 2022
Posts: 16
Rep Power: 4 
Quote:
These days I have tried the pimpleFoam based on the tutorials cases under the folder “/tutorials/incompressible/pimpleFoam/laminar”. I’m not sure how much time it’ll cost for my case, and I want the solver stops when the tolerance conditions are reached, so I add the residualControl as follows: Code:
PIMPLE { nCorrectors 2; nNonOrthogonalCorrectors 0; // //nOuterCorrectore 2; // //momentumPredictor off; // residualControl { p 1e5; U 1e5; } } Code:
Courant Number mean: 0.446783 max: 0.669648 deltaT = 1e05 Time = 0.28842 smoothSolver: Solving for Ux, Initial residual = 6.23778e09, Final residual = 4.37402e10, No Iterations 1 smoothSolver: Solving for Uy, Initial residual = 9.99837e07, Final residual = 4.41101e09, No Iterations 2 GAMG: Solving for p, Initial residual = 1.55179e10, Final residual = 8.75098e12, No Iterations 1 time step continuity errors : sum local = 4.11461e15, global = 2.19722e15, cumulative = 1.15507e08 GAMG: Solving for p, Initial residual = 1.54756e10, Final residual = 8.86012e12, No Iterations 1 time step continuity errors : sum local = 4.16583e15, global = 1.83124e15, cumulative = 1.15507e08 ExecutionTime = 8412.92 s ClockTime = 8413 s PIMPLE solution converged in 0.28842 iterations End According to the log file, the solver didn’t stop until it got the endTime (1.5), even though the residuals were much smaller than I set in the residualControl (1e5). Code:
Courant Number mean: 0.00192971 max: 0.0112378 Time = 1.5 smoothSolver: Solving for Ux, Initial residual = 7.56505e07, Final residual = 2.84178e11, No Iterations 1 smoothSolver: Solving for Uy, Initial residual = 7.75426e07, Final residual = 2.8357e11, No Iterations 1 GAMG: Solving for p, Initial residual = 6.71212e08, Final residual = 1.28297e08, No Iterations 1 time step continuity errors : sum local = 2.6825e15, global = 5.42384e16, cumulative = 1.31311e10 GAMG: Solving for p, Initial residual = 3.53864e08, Final residual = 1.1966e08, No Iterations 1 time step continuity errors : sum local = 2.50191e15, global = 3.23207e18, cumulative = 1.31311e10 ExecutionTime = 68419.4 s ClockTime = 71020 s End Finalising parallel run Code:
Courant Number mean: 1.2346e+102 max: 4.57473e+103 Time = 2.08499 smoothSolver: Solving for Ux, Initial residual = 0.730531, Final residual = 6.64896e05, No Iterations 1000 smoothSolver: Solving for Uy, Initial residual = 0.738381, Final residual = 8.22353e05, No Iterations 1000 GAMG: Solving for p, Initial residual = 0.989074, Final residual = 8.75592e08, No Iterations 53 time step continuity errors : sum local = 1.26262e+95, global = 7.77481e+93, cumulative = 1.23051e+94 GAMG: Solving for p, Initial residual = 0.262815, Final residual = 9.00335e08, No Iterations 45 time step continuity errors : sum local = 1.59688e+96, global = 5.21253e+94, cumulative = 3.98202e+94 ExecutionTime = 40376.8 s ClockTime = 40934 s Courant Number mean: 1.17916e+103 max: 5.25875e+104 Time = 2.085 smoothSolver: Solving for Ux, Initial residual = 0.71156, Final residual = 0.00334101, No Iterations 1000 smoothSolver: Solving for Uy, Initial residual = 0.720883, Final residual = 0.00112397, No Iterations 1000 srun: error: n0045: tasks 12: Floating point exception (core dumped) srun: error: n0045: tasks 0,3: Floating point exception (core dumped) I’m not sure if there are some settings are wrong. I attached the fvSolution, fvSchemes, controlDict files, maybe you can have a look. Thank you! 

July 2, 2022, 12:18 

#28  
New Member
Zhen Liao
Join Date: Apr 2022
Posts: 16
Rep Power: 4 
Quote:
Hi everyone, these are my files: p: Code:
dimensions [0 2 2 0 0 0 0]; internalField uniform 0; boundaryField { "(INLET_1INLET_2INLET_3INLET_4INLET_5INLET_6INLET_7INLET_8)" { type fixedValue; value uniform 0.01; } "(OUTLET_1OUTLET_2OUTLET_3OUTLET_4OUTLET_5OUTLET_6OUTLET_7OUTLET_8)" { type fixedValue; value uniform 0; } WALL { type zeroGradient; } "(TOPBOTTOM)" { type empty; } } Code:
dimensions [0 1 1 0 0 0 0]; internalField uniform (0 0 0); boundaryField { "(INLET_1INLET_2INLET_3INLET_4INLET_5INLET_6INLET_7INLET_8)" { type pressureInletVelocity; phi phi; rho rho; value uniform (0 0 0); } "(OUTLET_1OUTLET_2OUTLET_3OUTLET_4OUTLET_5OUTLET_6OUTLET_7OUTLET_8)" { type zeroGradient; } WALL { type noSlip; } "(TOPBOTTOM)" { type empty; } } Code:
solvers { p { solver GAMG; tolerance 1e7; relTol 0; smoother DICGaussSeidel; minIter 5; // } pFinal { $p; relTol 0; } U { solver smoothSolver; smoother symGaussSeidel; tolerance 1e07; relTol 0; minIter 5; // } UFinal { $U; relTol 0; } } PIMPLE { nCorrectors 2; nNonOrthogonalCorrectors 0; // //nOuterCorrectore 2; // //momentumPredictor off; // residualControl { p 1e5; U 1e5; } } relaxationFactors { equations { ".*" 1; } } Code:
ddtSchemes { default Euler; } gradSchemes { default Gauss linear; } divSchemes { default none; div(phi,U) Gauss linearUpwind grad(U); div((nuEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes { default Gauss linear corrected; } interpolationSchemes { default linear; } snGradSchemes { default corrected; } Code:
application pimpleFoam; startFrom latestTime; startTime 0; stopAt endTime; endTime 3; deltaT 0.00001; writeControl adjustableRunTime; writeInterval 0.1; purgeWrite 0; writeFormat ascii; writePrecision 6; writeCompression off; timeFormat general; timePrecision 6; runTimeModifiable yes; adjustTimeStep no; // maxCo 3; functions { #includeFunc flowRatePatch(name=INLET_1) #includeFunc flowRatePatch(name=OUTLET_1) #includeFunc patchAverage(name=INLET_1,p) #includeFunc patchAverage(name=OUTLET_1,p) } Code:
Create time Create polyMesh for time = 0 Time = 0 Mesh stats points: 1461944 internal points: 0 faces: 2854285 internal faces: 1392335 cells: 707770 faces per cell: 6 boundary patches: 19 point zones: 0 face zones: 5 cell zones: 1 Overall number of cells of each type: hexahedra: 707770 prisms: 0 wedges: 0 pyramids: 0 tet wedges: 0 tetrahedra: 0 polyhedra: 0 Checking topology... Boundary definition OK. Cell to face addressing OK. Point usage OK. Upper triangular ordering OK. Face vertices OK. Number of regions: 1 (OK). Checking patch topology for multiply connected surfaces... Patch Faces Points Surface topology INLET_1 35 72 ok (nonclosed singly connected) INLET_2 21 44 ok (nonclosed singly connected) INLET_3 24 50 ok (nonclosed singly connected) INLET_4 29 60 ok (nonclosed singly connected) INLET_5 23 48 ok (nonclosed singly connected) INLET_6 55 112 ok (nonclosed singly connected) INLET_7 23 48 ok (nonclosed singly connected) INLET_8 26 54 ok (nonclosed singly connected) OUTLET_1 26 54 ok (nonclosed singly connected) OUTLET_2 21 44 ok (nonclosed singly connected) OUTLET_3 24 50 ok (nonclosed singly connected) OUTLET_4 28 58 ok (nonclosed singly connected) OUTLET_5 23 48 ok (nonclosed singly connected) OUTLET_6 24 50 ok (nonclosed singly connected) OUTLET_7 23 48 ok (nonclosed singly connected) OUTLET_8 16 34 ok (nonclosed singly connected) WALL 45989 92010 ok (nonclosed singly connected) TOP 707770 730972 ok (nonclosed singly connected) BOTTOM 707770 730972 ok (nonclosed singly connected) Checking geometry... Overall domain bounding box (1.05767 1.34728 5e06) (1.3494 1.05778 0) Mesh has 2 geometric (nonempty/wedge) directions (1 1 0) Mesh has 2 solution (nonempty) directions (1 1 0) All edges aligned with or perpendicular to nonempty directions. Boundary openness (3.20635e18 3.0694e19 2.91732e17) OK. Max cell openness = 2.54883e16 OK. Max aspect ratio = 2.74176 OK. Minimum face area = 1.28173e10. Maximum face area = 7.11969e09. Face area magnitudes OK. Min volume = 5.61444e15. Max volume = 3.55984e14. Total volume = 1.87478e08. Cell volumes OK. Mesh nonorthogonality Max: 59.1436 average: 20.7321 Nonorthogonality check OK. Face pyramids OK. Max skewness = 1.82248 OK. Coupled point location match (average 0) OK. Mesh OK. End 

April 11, 2023, 05:03 

#29  
Senior Member
Farzad Faraji
Join Date: Nov 2019
Posts: 205
Rep Power: 7 
Dear Josh Williams
I am using simpleFoam, and my residuals goes down and then they start to increase again. What should I do for these types of residuals? My parameter of interest which is drag coefficient(Cd) has reached to a constant value without any change and it is stable. What should I do? can I rely on my Cd results? Thanks, Farzad Quote:


May 10, 2023, 04:14 

#30 
Senior Member
Josh Williams
Join Date: Feb 2021
Location: Scotland
Posts: 113
Rep Power: 5 
Hi,
In my opinion, I would not rely simply on drag to verify if your simulation has converged (although I have heard this in the past). Drag is just estimated based on the surface pressure, if the pressure has converged to an incorrect solution (as shown by your residuals the velocity and pressure not converged very well), then the drag coefficient will be incorrect (although it may be 'converged' to a constant/steady value, it is still incorrect). Let me try to make sense of your residuals. although I am not sure what your application is, I guess it is an external flow around some object since you are interested in drag coefficient. The residuals go down as the flow is developing (it is steady so it is going well), then some unsteadiness begins to emerge (maybe vortex streets) and simpleFoam can no longer capture it (so your residuals increase). I think you should use pimpleFoam with the tolerance at around 1e6 (maximum, I usually go for between 1e8 to 1e12). 

March 9, 2024, 12:21 

#31 
New Member
Sina Sadrghi
Join Date: Mar 2024
Posts: 1
Rep Power: 0 
Hi, Josh, I working on similar BC, a pipe with pressure driven of timevaring, can I have or can you share your p and U file for BC? I am stucked why my results are far from experimental.
cheers! 

Tags 
boundary condition, internal flow, pipe flow, simplefoam convergence, simplefoam pressure bc 
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Difference between p (pressure) and static pressure  PeterShi  OpenFOAM PostProcessing  2  March 19, 2019 16:23 
pressure in incompressible solvers e.g. simpleFoam  chrizzl  OpenFOAM Running, Solving & CFD  13  March 28, 2017 05:49 
Pressure difference at INLET and OUTLET.  lovegne  FLUENT  2  January 27, 2017 07:28 
Neumann pressure BC and velocity field  Antech  Main CFD Forum  0  April 25, 2006 02:15 
Hydrostatic pressure in 2phase flow modeling (CFX4.2)  HB &DS  CFX  0  January 9, 2000 13:19 