CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Pressure boundary condition on walls in Stokes flow (groovyBC)

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree4Likes
  • 1 Post By wildfire230
  • 2 Post By RobertHB
  • 1 Post By Santiago

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 6, 2019, 11:30
Default Pressure boundary condition on walls in Stokes flow (groovyBC)
  #1
Senior Member
 
Join Date: Jul 2013
Posts: 114
Rep Power: 9
wildfire230 is on a distinguished road
Hi all,


I have done a lot of searching to find an answer to this question, but unfortunately I haven't been very successful.


It seems to be very common in the OpenFOAM community to use the zeroGradient boundary condition for pressure on all solid walls in most simulations. However, it is obvious from the Navier-Stokes equations that this boundary condition cannot be correct in general. I realize it is a reasonable approximation for certain types of flows, but it is certainly not general.


In fact, for some flows, such as low Reynolds number flows past obstacles, the errors due to zeroGradient pressure boundary conditions could be the same order of magnitude as the solution itself.


My question is, what should we do? What is the analytically correct pressure boundary condition on channel walls, and has it been successfully implemented into OpenFOAM?


I am specifically interested in the zero Reynolds number, Stokes flow limit, but I am also interested in the general case. For Stokes flow I have tried using groovyBC as follows:
Code:
type groovyBC;
valueExpression "0";
value uniform 0;
gradientExpression "normal() & lapU";
fractionExpression "0";
where lapU is calculated in my solver as fvc::laplacian(U).
I'm not 100% sure if this is working correctly or not, but it seems to make the solver less stable compared to simply using zeroGradient.


I would greatly appreciate any thoughts or advice on this issue. It seems to be a key question regarding the use of OpenFOAM which I have not seen a satisfactory answer for.


Best regards
Krapf likes this.
wildfire230 is offline   Reply With Quote

Old   February 12, 2019, 16:07
Default
  #2
Senior Member
 
Join Date: Jul 2013
Posts: 114
Rep Power: 9
wildfire230 is on a distinguished road
Any ideas? I've been trying to just write a boundary element method solver from scratch, but it would be much more convenient to figure this out with OpenFOAM.

Last edited by wildfire230; February 20, 2019 at 15:23.
wildfire230 is offline   Reply With Quote

Old   February 20, 2019, 15:24
Default
  #3
Senior Member
 
Join Date: Jul 2013
Posts: 114
Rep Power: 9
wildfire230 is on a distinguished road
Sorry for the bump, I still haven't had any luck finding an answer.
wildfire230 is offline   Reply With Quote

Old   February 21, 2019, 03:27
Default
  #4
Senior Member
 
Robert
Join Date: May 2015
Location: Bremen, GER
Posts: 294
Rep Power: 8
RobertHB is on a distinguished road
Quote:
Originally Posted by wildfire230 View Post
Sorry for the bump, I still haven't had any luck finding an answer.
Hey,
i'm dealing with Stokes flows myself and i gotta admit that i did not think about differences in the pressure variable or BC treatment until now. What i found is that the velocity field corresponds perfectly to analytical profiles even with the p zeroGradient BC. That was/is good enough for me.
Santiago and wildfire230 like this.
__________________
If you liked my answer to your question, please consider leaving a "Like" in return
RobertHB is offline   Reply With Quote

Old   February 21, 2019, 08:34
Default
  #5
Senior Member
 
Join Date: Jul 2013
Posts: 114
Rep Power: 9
wildfire230 is on a distinguished road
Thanks for the response. Out of curiosity, does your flow have any fine geometric features like flow through a narrow gap or something like that? My suspicion is that these errors might be a problem when the velocity gradients are large.
wildfire230 is offline   Reply With Quote

Old   February 21, 2019, 09:03
Default
  #6
Senior Member
 
Robert
Join Date: May 2015
Location: Bremen, GER
Posts: 294
Rep Power: 8
RobertHB is on a distinguished road
My inlet and outlet are cylinders with a diameter of 0.8 and 0.7mm and the domain in 0.5mm heigh. Nothing narrower in my case.
__________________
If you liked my answer to your question, please consider leaving a "Like" in return
RobertHB is offline   Reply With Quote

Old   November 23, 2020, 08:08
Default
  #7
New Member
 
Join Date: Sep 2018
Posts: 6
Rep Power: 4
christiank_ucl is on a distinguished road
Hi,
I was wondering if you have looked further into this problem?

I am running similar simulations- Stokes flow past confined cylinders. I have run the boundary conditions dp/dn=0 and the boundary condition you mention dp/dn=lap(u).n and the velocity fields are exactly the same but dp/dr is different on the cylinder. When setting the boundary condition dp/dn=0, and then extracting the normal gradient of the pressure on the cylinder I found this to be a non-zero value - I am not sure if this is because of how the value is calculated or is some other numerical artefact.
Best regards,
Christian
christiank_ucl is offline   Reply With Quote

Old   November 23, 2020, 08:57
Default
  #8
Senior Member
 
Join Date: Jul 2013
Posts: 114
Rep Power: 9
wildfire230 is on a distinguished road
To be honest, I have not thought about this problem much in a while. If you are setting dp/dn=0, and then you calculate dp/dn and it is not zero, that must be some numerical artifact though I am sure.
wildfire230 is offline   Reply With Quote

Old   November 23, 2020, 09:48
Default What you say is not correct
  #9
Senior Member
 
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 317
Rep Power: 12
Santiago is on a distinguished road
Quote:
Originally Posted by wildfire230 View Post
Hi all,

It seems to be very common in the OpenFOAM community to use the zeroGradient boundary condition for pressure on all solid walls in most simulations. However, it is obvious from the Navier-Stokes equations that this boundary condition cannot be correct in general. I realize it is a reasonable approximation for certain types of flows, but it is certainly not general.
This statement is not true. Mathematically speaking, the projection method for the solution of the incompressible N-S equations REQUIRES NO BOUNDARY CONDITIONS for the pressure Poisson equation, since all weak formulations only require p to be L2 continuous (not H1, or sobolev, hence no boundary data). SEE HERE FOR DETAILS. You only need that the initial velocity field is divergence-free EVERYWHERE, including the boundaries.

However, when implementing SEGREGATED solver in real life, well, you get boundary conditions for p. Using a Natural BC (zeroGradient) or a projection of the momentum eqn on the wall (not like you proposed) for the pressure just affects the regularity (smoothness) of the solution. In low-order methods this shouldn't produce any problems, and the effects on turbulence quantities are negligible, so long you keep your deltaT around the kolmogorov time scale and you use a good turbulence model, etc...
Santiago is offline   Reply With Quote

Old   November 24, 2020, 10:10
Default
  #10
New Member
 
Join Date: Sep 2018
Posts: 6
Rep Power: 4
christiank_ucl is on a distinguished road
Hi Wildfire,

Thank you for your quick reply. I was wondering when you were working on it if you tried different ways of implementing the boundary condition as I've tried the way you describe:

{
type groovyBC;
valueExpression "0";
value uniform 0;
gradientExpression "normal() & Lap_U";
fractionExpression "0";

}

and I am seeing quite odd results. For example, when I refine the mesh, dp/dr on the cylinder does not converge to the analytical solution.



I also tried the boundary condition



{

type groovyBC;
valueExpression "0";
value uniform 0;
variables "grad_temp=-snGrad(Lap_U);"
gradientExpression "grad_temp;"
fractionExpression "0";
}


but the above is not giving results close to the other implementation or the analytical solution.


If you had any thoughts or experiences to share about these points, that'd be great!
Thanks,
c
christiank_ucl is offline   Reply With Quote

Old   November 24, 2020, 10:59
Default
  #11
Senior Member
 
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 317
Rep Power: 12
Santiago is on a distinguished road
Quote:
Originally Posted by christiank_ucl View Post
Hi Wildfire,

Thank you for your quick reply. I was wondering when you were working on it if you tried different ways of implementing the boundary condition as I've tried the way you describe:

{
type groovyBC;
valueExpression "0";
value uniform 0;
gradientExpression "normal() & Lap_U";
fractionExpression "0";

}

and I am seeing quite odd results. For example, when I refine the mesh, dp/dr on the cylinder does not converge to the analytical solution.



I also tried the boundary condition



{

type groovyBC;
valueExpression "0";
value uniform 0;
variables "grad_temp=-snGrad(Lap_U);"
gradientExpression "grad_temp;"
fractionExpression "0";
}


but the above is not giving results close to the other implementation or the analytical solution.


If you had any thoughts or experiences to share about these points, that'd be great!
Thanks,
c
Have you tried using zeroGradient?
Santiago is offline   Reply With Quote

Old   November 24, 2020, 11:15
Default
  #12
Senior Member
 
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 317
Rep Power: 12
Santiago is on a distinguished road
Quote:
Originally Posted by christiank_ucl View Post
Hi,
I was wondering if you have looked further into this problem?

I am running similar simulations- Stokes flow past confined cylinders. I have run the boundary conditions dp/dn=0 and the boundary condition you mention dp/dn=lap(u).n and the velocity fields are exactly the same but dp/dr is different on the cylinder. When setting the boundary condition dp/dn=0, and then extracting the normal gradient of the pressure on the cylinder I found this to be a non-zero value - I am not sure if this is because of how the value is calculated or is some other numerical artefact.
Best regards,
Christian
Where are you post-processing your results/calculating grad(p)?
Santiago is offline   Reply With Quote

Old   November 24, 2020, 12:28
Default
  #13
New Member
 
Join Date: Sep 2018
Posts: 6
Rep Power: 4
christiank_ucl is on a distinguished road
Hi Santiago,
I am looking at Stokes flow past a confined cylinder.

Yes, Ive tried dp/dn=0 and also the gradient conditions I described above. For all the pressure gradient boundary conditions, there is no difference in the velocity field or the pressure on the cylinder surface but dp/dr on the cylinder is different.

I have tried two ways of calculating the pressure gradient on the cylinder:
1. Using the foamCalcEx utility to get dp/dx and dp/dy and then taking these values out on the cylinder surface and then calculating dp/dn=dp/dx cos theta + dp/dy sin theta.
2. Using a utility similar to dT/dn for heat flux but changing the variable to pressure.



I have not found consistent values for the two methods. Also, I have not found the values converge when I carried out a mesh independence study.


The main reason for using the full boundary condition (consistent with NS equations) is that even if it is possible (as in there is no effect on the velocity field) to use dp/dn=0 for Stokes flow, I am not sure if dp/dn=0 is valid when the Reynolds number is increased.


Thank you for any advice/thoughts/experience,
Christian
christiank_ucl is offline   Reply With Quote

Old   November 24, 2020, 17:04
Default
  #14
Senior Member
 
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 317
Rep Power: 12
Santiago is on a distinguished road
Quote:
Originally Posted by christiank_ucl View Post
I am not sure if dp/dn=0 is valid when the Reynolds number is increased.
As I explained in earlier posts, setting up either natural boundary condition, or projecting the momentum equation onto walls (or, more precisely, where Dirichlet BCs are used for velocity) for p, it only affects the regularity of the field p. Why? Because the weak formulation of the non-incremental (and incremental) pressure projection method of Chorin (Yanenko, and others) does not require a BC for pressure. The need for BCs for p comes out in some FEM/FVM/FDM because you need to solve algebraic equations derived from the mathematical statements! Since these equations (pressure poisson equation and momentum equations) are derived from one another, if you set dirichlet BCs for velocity, you need to "unconstrain" p (set it to zeroGradient), and viceversa.

On the contrary, as Re increases the zero gradient assumption becomes more similar to the momentum projection onto the BC since (1/Re) laplacian(U)*n --> 0 as Re --> \infty, hence you get more regular p fields using the natural BC for high Re wall-bounded flows. Besides, in wall-bounded turbulent flows velocity behaves linearly (in the mean) close to the wall (in the viscous region), that is: U+ = Y+, hence your laplacian is near zero anyways...

... Long story short:there is no problem with the solution running piso/pimple/ico/Foam using zeroGradient for p, where dirichlet is used for velocity...

I cannot speculate what gone wrong with your 2 attempts, so I will not comment about that.... My suggestion is to produce grad(p) during runtime either by creating a volVectorField using codeStreams, or to use postProcess to produce grad(p) directly from your solution. Like this, at least you are consistent on how the gradients were actually determined.
Santiago is offline   Reply With Quote

Old   November 26, 2020, 10:42
Default
  #15
New Member
 
Join Date: Sep 2018
Posts: 6
Rep Power: 4
christiank_ucl is on a distinguished road
Hi Santiago,
Thank you for the information. Could you please share the references that are relevant for this?
Thanks,
Christian
christiank_ucl is offline   Reply With Quote

Old   November 26, 2020, 12:56
Default
  #16
Senior Member
 
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 317
Rep Power: 12
Santiago is on a distinguished road
Quote:
Originally Posted by christiank_ucl View Post
Hi Santiago,
Thank you for the information. Could you please share the references that are relevant for this?
Thanks,
Christian
References:

LINK 1

LINK 2

LINK 3

LINK 4
christiank_ucl likes this.

Last edited by Santiago; November 26, 2020 at 15:31.
Santiago is offline   Reply With Quote

Reply

Tags
boundary, condition, groovybc, pressure, walls

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wind turbine simulation Saturn CFX 58 July 3, 2020 01:13
Total pressure and mass flow boundary condition at inlet bscphil OpenFOAM Pre-Processing 3 July 9, 2017 14:39
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 06:28
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 07:00
Hydrostatic pressure in 2-phase flow modeling (CFX4.2) HB &DS CFX 0 January 9, 2000 13:19


All times are GMT -4. The time now is 15:16.