CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Inlet velocity boundary conditions and pressure-poisson equation

Register Blogs Community New Posts Updated Threads Search

Like Tree11Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 11, 2018, 17:51
Default Inlet velocity boundary conditions and pressure-poisson equation
  #1
Senior Member
 
Selig
Join Date: Jul 2016
Posts: 213
Rep Power: 10
selig5576 is on a distinguished road
When operating on a collocated grid when solving the incompressible Navier-Stokes, do you need to do any special treatment for the pressure on the inlet? When solving the PPE I just apply \frac{\partial p}{\partial n} = 0 unless I have an outflow in which I use \frac{\partial^{2} p}{\partial n^{2}} - \frac{1}{\Delta t} \left(\frac{u^{*}_{i+1/2,j,k} - u^{*}_{i-1/2,j,k}}{\Delta x}\right)= 0. The method in which I am doing my collocation is the Rhie-Chow interpolation.
selig5576 is offline   Reply With Quote

Old   April 12, 2018, 04:21
Default
  #2
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,764
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
To be honest I don't understand what are you setting...In inflow you set the known velocity profile and write the boundary condition dp/dn=(1/dt)(u*-u_inflow)
FMDenaro is offline   Reply With Quote

Old   April 12, 2018, 10:20
Default Inlet pressure BC
  #3
Senior Member
 
Selig
Join Date: Jul 2016
Posts: 213
Rep Power: 10
selig5576 is on a distinguished road
I agree with the boundary condition you wrote. What I meant was the way I define the outlet BC for a collocated grid is \frac{\partial}{\partial n}\frac{\partial p}{\partial n} = \frac{\partial u^{*}}{\partial x}. With this you plug it into \nabla^{2} P = \frac{1}{\Delta t} \nabla \cdot u^{*}. (for a projection method)
selig5576 is offline   Reply With Quote

Old   April 12, 2018, 11:00
Default
  #4
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,764
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by selig5576 View Post
I agree with the boundary condition you wrote. What I meant was the way I define the outlet BC for a collocated grid is \frac{\partial}{\partial n}\frac{\partial p}{\partial n} = \frac{\partial u^{*}}{\partial x}. With this you plug it into \nabla^{2} P = \frac{1}{\Delta t} \nabla \cdot u^{*}. (for a projection method)

You first wrote about " a special treatment of the pressure at the inlet", no one being need other than prescribing the velocity profile.

At the outlet, prescribing du/dx=0 you get the relation for the second derivative of the pressure. We already discussed about that, in 2D such condition is equivalent to set v=0 at the outlet. The condition allow to write a 1D poisson equation according to d2p/dy^2 = (1/dt) v* you can solve with the BC.s at the two wall points. After solving this 1D equation you have a pressure profile at the outlet that can be prescribed as Dirichlet condition for the 2D Poisson equation.
FMDenaro is offline   Reply With Quote

Old   April 12, 2018, 11:29
Default Pressure BC
  #5
Senior Member
 
Selig
Join Date: Jul 2016
Posts: 213
Rep Power: 10
selig5576 is on a distinguished road
Yes you are right. I just wanted to make sure that the way I was treating the inlet in the PPE was indeed correct (not forgetting something), which it is. This is how I am doing it.
Attached Files
File Type: pdf PPE-Outlet-BC.pdf (85.0 KB, 25 views)
selig5576 is offline   Reply With Quote

Old   April 12, 2018, 11:35
Default
  #6
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,764
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by selig5576 View Post
Yes you are right. I just wanted to make sure that the way I was treating the inlet in the PPE was indeed correct (not forgetting something), which it is. This is how I am doing it.

In your chosen approximation d/dx=0, you could also simplify Eq.(1) as d2p/dx^2=0. That will produce the 1D Poisson equation at the outlet
FMDenaro is offline   Reply With Quote

Old   April 12, 2018, 11:48
Default Pressure BC
  #7
Senior Member
 
Selig
Join Date: Jul 2016
Posts: 213
Rep Power: 10
selig5576 is on a distinguished road
But that would mean that the R_{nx-1,j,k} would then retain the du^{*}/dx?.
selig5576 is offline   Reply With Quote

Old   April 12, 2018, 11:53
Default
  #8
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,764
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by selig5576 View Post
But that would mean that the R_{nx-1,j,k} would then retain the du^{*}/dx?.
I mean your physical approximation is d/dx=0 at the outlet for all the variables. Therefore du/dx=du*/dx=0 -> d2p/dx^2=0
selig5576 likes this.
FMDenaro is offline   Reply With Quote

Old   April 12, 2018, 11:55
Default
  #9
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,764
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
There is no a unique and exact way to prescibe the outlet condition, you always introduce an approximation. Its validity depends on the type of flow and the distance of the numerical outlet section.
selig5576 likes this.
FMDenaro is offline   Reply With Quote

Old   April 13, 2018, 13:16
Default Outlet BC causing divergence
  #10
Senior Member
 
Selig
Join Date: Jul 2016
Posts: 213
Rep Power: 10
selig5576 is on a distinguished road
I entirely agree on what you say. The reason I posted this thread was I was leading up that my solver (pressure-free PM, AB2-CN integration) for the lid driven cavity in R^3 works perfectly. Even with a jet it works quite well. Though when I test my solver on a channel flow, after 70 iterations of SOR my PPE solver diverges. For sanity I have chosen a domain 80 x 40 x 40 with a kinematic viscosity of 0.01. If I make my inlet smaller then my solver under the same parameters does not diverge. Why would an inlet u = 1 that spans u(1,2:ny-1,2:nz-1) cause a problem? It seems strange to me.
selig5576 is offline   Reply With Quote

Old   April 13, 2018, 14:13
Default
  #11
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,764
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by selig5576 View Post
I entirely agree on what you say. The reason I posted this thread was I was leading up that my solver (pressure-free PM, AB2-CN integration) for the lid driven cavity in R^3 works perfectly. Even with a jet it works quite well. Though when I test my solver on a channel flow, after 70 iterations of SOR my PPE solver diverges. For sanity I have chosen a domain 80 x 40 x 40 with a kinematic viscosity of 0.01. If I make my inlet smaller then my solver under the same parameters does not diverge. Why would an inlet u = 1 that spans u(1,2:ny-1,2:nz-1) cause a problem? It seems strange to me.
divergence in the SOR applied to the pressure equation means you do not fulfill the discrete compatibility condition. That should correspond to an error in setting the BC.s
FMDenaro is offline   Reply With Quote

Old   April 13, 2018, 16:24
Default Outlet BC
  #12
Senior Member
 
Selig
Join Date: Jul 2016
Posts: 213
Rep Power: 10
selig5576 is on a distinguished road
I will have to do some testing on this matter. With that said, the way I implement the outlet BC is exactly how I did it in the PDF doc, but also at the 4 corners of my control volume (I have 8 corners because I'm doing 3D.)

Code:
!Left BC and right BC in the x direction  
!ufs, vfs, wfs refer to the face velocties of u^*, v^*, w^*.

do k=3,nz-2
  do j=3,ny-2
    !Left BC no outflow
     R(2,j,k) = (rho/dt)*(idx*(ufs(2,j,k) - un(1,j,k)) + idy*(vfs(2,j,k) - vfs(2,j-1,k)) + idz*(wfs(2,j,k) - wfs(2,j,k-1)))
     P(2,j,k) = (1.0-omega)*P(2,j,k) + (omega)/(idxx + 2.0*idyy + 2.0*idzz)*(idxx*P(3,j,k) + idyy*(P(2,j+1,k) + P(2,j-1,k)) + idzz*(P(2,j,k+1) + P(2,j,k-1)) - R(2,j,k))
!The outflow BC is only imposted at i=nx-1
     R(nx-1,j,k) = (rho/dt)*(idy*(vfs(nx-1,j,k) - vfs(nx-1,j-1,k)) + idz*(wfs(nx-1,j,k) - wfs(nx-1,j,k-1)))
     P(nx-1,j,k) = (1.0-omega)*P(nx-1,j,k) + (omega)/(2.0*idyy + 2.0*idzz)*(idyy*(P(nx-1,j+1,k) + P(nx-1,j-1,k)) + idzz*(P(nx-1,j,k+1) + P(nx-1,j,k-1)) - R(nx-1,j,k))
  end do
end do
As far as I can see and worked out on paper I don't see any issue in this implementation, but maybe another set of eyes will say otherwise
selig5576 is offline   Reply With Quote

Old   April 13, 2018, 16:30
Default
  #13
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,764
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Check the conditions at the corners where you have both walls and outlet. See also that the magnitude of the (div v) function is the same in each cell or you have some cell having greater magnitude. I assume you do not satisfy exactly the divergence-free constraint but only satisfy up to the local truncation error magnitude.
selig5576 likes this.
FMDenaro is offline   Reply With Quote

Old   April 16, 2018, 16:53
Default Outlet Pressure BC
  #14
Senior Member
 
Selig
Join Date: Jul 2016
Posts: 213
Rep Power: 10
selig5576 is on a distinguished road
I've spent considerable double checking there were no errors in the implementation of my pressure BCs. You are correct in that I am using an approximate projection method (APM), so continuity is only being satisfied up to the LTE.

The only observation I can make is if I reduce my kinematic viscosity to 0.1 from 0.01 my pressure solver does not diverge. At first I thought my cell Reynolds number was being violated but I ensured that I had a cell Reynolds number proportional to O(1).

For clarity I am working with a simple forward Euler scheme to reduce the 'uncertainity' in my code. I've attached two images: one image after 1 time step and the other after ~400 time steps.

EDIT: I also looked at the pressure profile and it seems consistent with what we should expect, pressure decreases as it gets farther from the inlet. I've also included a third image of the velocity profile at t = 1.5

Many thanks!
Attached Images
File Type: png Channelt001.png (14.3 KB, 16 views)
File Type: png Channelt04.png (22.7 KB, 11 views)
File Type: png Channelt15.png (23.1 KB, 11 views)
selig5576 is offline   Reply With Quote

Old   April 16, 2018, 17:03
Default
  #15
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,764
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
In the first figure, I see two blue spots at the inlet that seem unphysical...
FMDenaro is offline   Reply With Quote

Old   April 16, 2018, 17:11
Default Pressure outlet
  #16
Senior Member
 
Selig
Join Date: Jul 2016
Posts: 213
Rep Power: 10
selig5576 is on a distinguished road
I was about to comment on those. In my lid driven cavity test those do not appear. Only when I prescribe an outlet. When doing my SOR routine, I first iterate the interior then the boundaries, finally I prescribe the corners. This is all done in 1 while loop that iterates my PPE. I'm gonna assume I don't need a different while loop for the boundaries than the interior.
selig5576 is offline   Reply With Quote

Old   April 16, 2018, 17:45
Default
  #17
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,764
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by selig5576 View Post
I was about to comment on those. In my lid driven cavity test those do not appear. Only when I prescribe an outlet. When doing my SOR routine, I first iterate the interior then the boundaries, finally I prescribe the corners. This is all done in 1 while loop that iterates my PPE. I'm gonna assume I don't need a different while loop for the boundaries than the interior.

Differences in processing the nodes have effects in terms of convergence rate when using SOR. But in your case the problem appears in the final solution...I can suggest to do a simple test in a plane channel test prescribing the Poiseuille exact solution as initial condition and checking if it is conserved.
FMDenaro is offline   Reply With Quote

Old   April 17, 2018, 13:38
Default Channel flow
  #18
Senior Member
 
Selig
Join Date: Jul 2016
Posts: 213
Rep Power: 10
selig5576 is on a distinguished road
I actually created a 'toy' 2D code for the same problem to maybe help illuminate a fundamental problem in my pressure solver. For 1 time step my pressure profile is correct however these 2 points gradually form near the inlet. To my understanding these are unphysical, but I am not quite sure.
Attached Images
File Type: png Pressurestep2.png (7.6 KB, 7 views)
File Type: png Pressurestep30.png (9.7 KB, 9 views)
Attached Files
File Type: txt Pressure.txt (4.4 KB, 3 views)
selig5576 is offline   Reply With Quote

Old   April 17, 2018, 13:42
Default
  #19
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,764
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
The inlet profile is prescribed as a plug flow? do you see the vertical velocity at the two corners?
selig5576 likes this.
FMDenaro is offline   Reply With Quote

Old   April 17, 2018, 13:47
Default Inlet
  #20
Senior Member
 
Selig
Join Date: Jul 2016
Posts: 213
Rep Power: 10
selig5576 is on a distinguished road
Yes, my inlet is that of a plug flow, in this case u = 1. My inlet profile seems consistent with that of my pressure profile. EDIT: This velocity profile is at step = 30 (not 1)
Attached Images
File Type: png UVelocitystep30.png (10.0 KB, 15 views)
selig5576 is offline   Reply With Quote

Reply


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
Multiphase flow - incorrect velocity on inlet Mike_Tom CFX 6 September 29, 2016 01:27
Wrong flow in ratating domain problem Sanyo CFX 17 August 15, 2015 06:20
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


All times are GMT -4. The time now is 18:42.