|
[Sponsors] |
Pressure difference as an input to simpleFoam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 29, 2021, 09:22 |
Pressure difference as an input to simpleFoam
|
#1 |
New Member
Ahmad Mahmoud
Join Date: Aug 2021
Posts: 2
Rep Power: 0 |
I have a problem where I am required to simulate the flow through a reconstructed geometry of a human vessel (pipe flow), where the pressure at the inlet and at the outlet is known, in order to find the resultant flow rate.
My question is how should I set up a case in openFoam using the simpleFoam solver, where the pressures are the input and no velocity is specified. I have tried doing this by setting the velocity boundary condition to zero gradient at both ends, and the pressure as fixed value for both values, but the results were usually unstable and did not converge satisfactorily. I have tried with k-epsilon turbulence models as well as k-omega SST and even fully laminar, but none of them would converge. What appropriate boundary conditions should I use and how can I improve the stability and convergence of the problem? Thank in advance! |
|
August 29, 2021, 21:00 |
|
#2 |
Member
Francisco T
Join Date: Nov 2011
Location: Melbourne, Australia
Posts: 64
Blog Entries: 1
Rep Power: 15 |
That seems correct. Check the file attached, which is a microchannel (100microns x 20) the velocity is generated correctly with pressure. This case is laminar.
microch_vel.png microchannel100x20Pressure.zip Perhaps you can try laminar first and then add turbulence later? What issues are you having? Cheers Francisco |
|
August 31, 2021, 03:10 |
|
#3 |
Member
Andreas P.
Join Date: May 2017
Posts: 41
Rep Power: 9 |
Maybe you can try the pressureInletUniformVelocity instead of zeroGradient for one side. This sets velocity to a constant value over the whole inlet in one direction, which made simulations stable in my case...
https://www.openfoam.com/documentati...d.html#details |
|
September 6, 2021, 06:52 |
|
#4 | |
New Member
Ahmad Mahmoud
Join Date: Aug 2021
Posts: 2
Rep Power: 0 |
Quote:
What value would I set i to. Note that I do not have vales for the velocity or the flux, that is the value i am after. |
||
September 6, 2021, 07:04 |
|
#5 |
Member
Andreas P.
Join Date: May 2017
Posts: 41
Rep Power: 9 |
The "value" field ist just a dummy field for this boundary condition, that will be overwritten by the calculation of the boundary condition. So you can just set it to 0.
|
|
September 6, 2021, 12:21 |
|
#6 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 747
Rep Power: 14 |
Another suggestion is to apply a total pressure boundary condition at the upstream end; the ESI documentation page (https://www.openfoam.com/documentati...tions-subsonic) suggests that this gives good stability ... my experience is a bit mixed though. Let us know what ends up working for you.
|
|
September 6, 2021, 13:44 |
|
#7 |
Senior Member
|
Aha!
What has your experience with subsonic cases been? I am working on a jet-in-co-flow with transonic jet to (hopefully) clarify convergence issues. What are in your experience are point to look into? Would pressure-velocity coupled solver help in these cases? Thx, Domenico. |
|
April 24, 2022, 01:04 |
Have you solved the problem yet?
|
#8 | |
New Member
Zhen Liao
Join Date: Apr 2022
Posts: 16
Rep Power: 4 |
Quote:
Have you solved the problem yet? What boundary conditions are appropriate? These days I met the same stability and convergence problem when I simulated the plane-Poiseuille flow (plane-parallel plates with pressure gradient). I chose the simpleFoam solver, and set simulationType as laminar in the turbulenceProperties file, and the boundary and initial conditions are showed in the followed figure. According to my result, it didn’t converge even after 200000 time steps (attached figure 2). But, one good point is the simulated outlet flux is matched quite well with the calculated flux by the theoretical equation (Cubic law: v=-△Pw^2/(12μL) (m/s)). |
||
April 24, 2022, 01:11 |
Attached OpenFOAM case
|
#9 | |
New Member
Zhen Liao
Join Date: Apr 2022
Posts: 16
Rep Power: 4 |
Quote:
https://drive.google.com/drive/folde...Th?usp=sharing |
||
April 24, 2022, 06:08 |
|
#10 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 747
Rep Power: 14 |
If you look at the log file that you posted, you'll see that it is doing zero iterations on the solvers for Ux and p ... which means that it has stopped solving. You need to adjust the solver tolerances to force it to solve to a tighter residual level, or add a minIter line in the solver instructions to force it to always do at least 1 iteration. That will keep it solving ... up to the limit posed by your grid design. Hope that helps.
|
|
April 24, 2022, 10:05 |
Add a minIter line? Meaning of "No Iterations X" and different tolerances
|
#11 | |
New Member
Zhen Liao
Join Date: Apr 2022
Posts: 16
Rep Power: 4 |
Quote:
Actually I conducted some other cases by setting different tolerances. As you can see from the attached figure, if the tolerances are bigger (cases name highlight by yellow), it can converge very fast, but the outlet flux didn’t match the theoretical value well (the theoretical averaged flow rate v = 0.4464 m/s); while if the tolerances are smaller, it’ll converge very hard. And how to add a minIter line in the solver intructions? I also a little confused about the exact meaning of “No Iterations X” in the log file. As you can see in my results, X can equal to nonzero in the converged cases. BTW, I wonder what’s the difference between the “tolerance” and “residualControl”? What are the exact meanings of “tolerance”, “relTol” and “residualControl”? What do these three values control? What settings are appropriate for them? Are there any tips or rules for people to obey? |
||
April 24, 2022, 10:31 |
Problem of pressureInletUniformVelocity
|
#12 | |
New Member
Zhen Liao
Join Date: Apr 2022
Posts: 16
Rep Power: 4 |
Quote:
I tried the pressureInletUniformVelocity type for the inlet (cases name highlight by green), it indeed converges very fast, but the calculated outlet flow rate didn’t match the theoretical value (v = 0.4464 m/s) well. I also tried the pressureInletVelocity type (cases name highlight by blue), it seems still has the stability and convergence problem. |
||
April 24, 2022, 11:26 |
|
#13 | |
New Member
Zhen Liao
Join Date: Apr 2022
Posts: 16
Rep Power: 4 |
Quote:
I wonder which solver did you use for your case? simpleFoam, pisoFoam or pimpleFoam? I'm a little confused because I see seetings for PISO, SIMPLE & PIMPLE in the fvSolution file. |
||
April 24, 2022, 13:49 |
|
#14 | |||
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 747
Rep Power: 14 |
Quote:
Code:
p { solver GAMG; tolerance 1e-08; relTol 0.01; smoother GaussSeidel; minIter 1; } Quote:
Quote:
|
||||
April 25, 2022, 00:55 |
|
#15 | |
New Member
Zhen Liao
Join Date: Apr 2022
Posts: 16
Rep Power: 4 |
Quote:
Thank you very much for your patience! I have gone through the User Guide, it didn’t introduce much about the “No Iterations” and tolerance. I’ll refer to the book you recommended. According to my limited understanding, the values of “No Iterations” will lower from a high value towards to 0, right? So, when the values of Ux & p equal to 0, does it means Ux & p have converged (i.e., stopped solving/iterating)? So a better result maybe that when the whole simulation is converged, all the “No Iterations” values equal to 0? I mean, each variables (Ux, Uy, p) converged, then the whole simulation converged? And I have run some cases by adding the minIter and lowering the tolerances, hope they will show better results. |
||
April 25, 2022, 05:07 |
|
#16 | |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 747
Rep Power: 14 |
The main issue is that although the residual values are normalised, their magnitude can vary from problem to problem, so a solver tolerance value that works for one problem may not be effective in another. That's why you need to keep an eye on your log file and adjust your solver settings from case to case.
Quote:
For most SIMPLE simulations, you should have a small number of velocity and turbulence inner iterations (maybe even just one) and rather more pressure iterations - sometimes a few hundred. This should be the case all the way through to "convergence", i.e. until you decide that the solution is not changing significantly and you can stop the run. To decide the latter, use the residuals of course, but also monitor quantities that are of interest to you (eg velocity in a key point in the flow, macro quantity like drag on a wing, etc etc). |
||
April 29, 2022, 14:02 |
|
#17 | |
Senior Member
Josh Williams
Join Date: Feb 2021
Location: Scotland
Posts: 113
Rep Power: 5 |
Quote:
In my experience with pressure driven flow, it is best when the inlet is pressureInletVelocity and the outlet is pressureInletOutletVelocity. See attached figure where the flowrate calculated by OpenFOAM shows excellent agreement to the analytical flowrate I design the pressure BCs to replicate. |
||
May 4, 2022, 00:45 |
|
#18 |
New Member
Zhen Liao
Join Date: Apr 2022
Posts: 16
Rep Power: 4 |
Hi Tobermory,
You're right, the number of iterations do not need to drop to zero, I misunderstood this point. Thank you very much for your patient and careful reply! And I found that for my cases, if I set tolerances to 10e-8, residualControls to 10e-6, they can converge much better. |
|
May 4, 2022, 00:57 |
|
#19 |
New Member
Zhen Liao
Join Date: Apr 2022
Posts: 16
Rep Power: 4 |
Hi Josh,
Thank you for you advice! According to my newest result, if I set inlet is pressureInletVelocity and the outlet is zeroGradient, and set tolerances to 10e-8, residualControls to 10e-6, it can converge better and match the theoretical value well. I'll try to set the outlet to pressureInletOutletVelocity to see if it can perform better! |
|
May 4, 2022, 03:35 |
|
#20 |
Senior Member
Josh Williams
Join Date: Feb 2021
Location: Scotland
Posts: 113
Rep Power: 5 |
I am working on something similar; flow in human airways taken from CT scans, with time-varying pressure defined at outlets. For a simple one bifurcation case, the BCs I mentioned above work very well (as I showed). But when the geometry gets more complex it fails (timestep gets very small as few cells at the outlet have big courant number).
Is your geometry complex like this? What fvSchemes are you using? I think my velocity BCs and pressure BCs are okay, so I think there is something else causing this. |
|
Tags |
boundary condition, internal flow, pipe flow, simplefoam convergence, simplefoam pressure bc |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Difference between p (pressure) and static pressure | PeterShi | OpenFOAM Post-Processing | 2 | March 19, 2019 17:23 |
pressure in incompressible solvers e.g. simpleFoam | chrizzl | OpenFOAM Running, Solving & CFD | 13 | March 28, 2017 06:49 |
Pressure difference at INLET and OUTLET. | lovegne | FLUENT | 2 | January 27, 2017 08:28 |
Neumann pressure BC and velocity field | Antech | Main CFD Forum | 0 | April 25, 2006 03:15 |
Hydrostatic pressure in 2-phase flow modeling (CFX4.2) | HB &DS | CFX | 0 | January 9, 2000 14:19 |