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

How many boundary conditions do we need for the pressure?

Register Blogs Community New Posts Updated Threads Search

Like Tree7Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 31, 2023, 03:02
Default
  #61
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,777
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by Winston Virtaus View Post
I was able to get hopefully some better divergence error estimate numbers by monitoring directly the divergence of the mac-like face velocities during runtime. However, I havent yet switched to the APM procedure which would be the more correct choice.

The solver was tried on a 3D channel flow @ Retau = 395 to see if it produced any different behaviour to the backward facing step case.

In the channel flow case the maximum divergence error is around O(1e-7) and its located roughly in the buffer layer region. Usually third cell from the wall.

In the backward facing step case the maximum divergence is now around O(1e-5) and its located far in the downstream where the grid is stretched in the stream-wise direction. Usually second or third cell near the wall.

Any comments on these values now? Is the incompressibility constraint satisfied atleast somewhat acceptably?
Compare these values to the magnitude of your local truncation error.
I suggest also to check if a grid refinement reduces these values.
FMDenaro is offline   Reply With Quote

Old   September 1, 2023, 22:47
Default
  #62
Member
 
Join Date: Apr 2021
Location: Finland
Posts: 41
Rep Power: 5
Winston Virtaus is on a distinguished road
I'm still working on how the divergence error scales on different grids but I thought I'd ask a quick question about the local truncation error you mentioned.

In the Analysis of the local truncation error in the pressure-free projection method for incompressible flows: a new accurate expression of the intermediate boundary conditions paper its mentioned that the splitting error of the pressure free method can be estimated as
efs = deltaT*[grad(phi)-grap(p)]-deltaT^2/2Re*div(grad(grad(p)) + O(deltaT^3) (equation 24).

If first order implicit Euler is used for the diffusion term in the v* equation, does this then imply that I'm getting only the first order approximation of p i.e. grad(phi) = grad(p)? And if this is indeed the case, would the equation 24 splitting error reduce to efs = -deltaT^2/2Re*div(grad(grad(phi))). Of which the local truncation error part is LTE = efs/deltaT?
Winston Virtaus is offline   Reply With Quote

Old   September 2, 2023, 03:47
Default
  #63
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,777
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by Winston Virtaus View Post
I'm still working on how the divergence error scales on different grids but I thought I'd ask a quick question about the local truncation error you mentioned.

In the Analysis of the local truncation error in the pressure-free projection method for incompressible flows: a new accurate expression of the intermediate boundary conditions paper its mentioned that the splitting error of the pressure free method can be estimated as
efs = deltaT*[grad(phi)-grap(p)]-deltaT^2/2Re*div(grad(grad(p)) + O(deltaT^3) (equation 24).

If first order implicit Euler is used for the diffusion term in the v* equation, does this then imply that I'm getting only the first order approximation of p i.e. grad(phi) = grad(p)? And if this is indeed the case, would the equation 24 splitting error reduce to efs = -deltaT^2/2Re*div(grad(grad(phi))). Of which the local truncation error part is LTE = efs/deltaT?



Using an implicit scheme for the diffusive term would produce always the presence of the diffusive-like term in the error. You can simply check what happens for the implicit Euler scheme by following the procedure in my paper: in the CN scheme cancel the part at time tn and in the part at tn+1 use 1 instead of (1/2).
The expression you get will be quite similar, the only difference is that since you use a first order accurate method, it makes no sense consider higher order terms in the efs.
FMDenaro is offline   Reply With Quote

Old   September 4, 2023, 23:50
Default
  #64
Member
 
Join Date: Apr 2021
Location: Finland
Posts: 41
Rep Power: 5
Winston Virtaus is on a distinguished road
Following similar analysis for the Implicit Euler as the Crank-Nicholson show in the paper, this was the result:

efs = deltaT*(grad(phi)-grad(p)) - 1/(2*Re)*deltaT^2*div(grad(grad(p))= 1/(2*Re)*deltaT^2*div(grad(grad(phi))) + O(deltaT^3)

leading to error proportional to O(deltaT^2). Is this correct now?

It seems that the Crank-Nicholson option would exactly cancel this leading term.

I hope the procedure was followed properly now

Last edited by Winston Virtaus; September 5, 2023 at 00:09. Reason: small edit
Winston Virtaus is offline   Reply With Quote

Old   September 5, 2023, 04:31
Default
  #65
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,777
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by Winston Virtaus View Post
Following similar analysis for the Implicit Euler as the Crank-Nicholson show in the paper, this was the result:

efs = deltaT*(grad(phi)-grad(p)) - 1/(2*Re)*deltaT^2*div(grad(grad(p))= 1/(2*Re)*deltaT^2*div(grad(grad(phi))) + O(deltaT^3)

leading to error proportional to O(deltaT^2). Is this correct now?

It seems that the Crank-Nicholson option would exactly cancel this leading term.

I hope the procedure was followed properly now



To confirm your result I should repeat all the procedure for the implicit Euler, but I see a coefficient 1/(2*Re), why? The implicit Euler should produce only 1/Re.
FMDenaro is offline   Reply With Quote

Old   September 5, 2023, 21:02
Default
  #66
Member
 
Join Date: Apr 2021
Location: Finland
Posts: 41
Rep Power: 5
Winston Virtaus is on a distinguished road
I think it was due to some calculation error in the higher order terms.

However I could do a lower order approximation to the splitting error as

\textbf{e}_{fs} = \textbf{v}^{n+1}-(\textbf{v}^{*n+1}-\textbf{v}') = \textbf{v}^{n}+\Delta t\frac{\partial \textbf{v}}{\partial t}|^n - \textbf{v}^{*n}-\Delta t\frac{\partial \textbf{v}^*}{\partial t}|^n+\Delta t \nabla \langle \phi \rangle^{n+1}\hspace{1cm}(1)

which can be further reduced into

\textbf{e}_{fs} = \Delta t(\textbf{R}^n+\textbf{P}^n)-\Delta t\textbf{R}^{*n}+\Delta t\nabla \langle \phi \rangle^{n+1}= \Delta t [\nabla \langle \phi \rangle^{n+1}+\textbf{P}^n]= \Delta t[\nabla\langle\phi\rangle^{n+1}-\nabla\langle p\rangle^{n+1}]\hspace{1cm}(2)

assuming

\textbf{v}^n = \textbf{v}^{*n}, \textbf{R}^{*n} = \textbf{R}^n\hspace{1cm}(3)

but I'm not exactly sure if the above assumption is correct.

Then using

(I-\frac{\Delta t}{Re}\nabla^2)\nabla\langle\phi\rangle^{n+1}=\nabla\langle p' \rangle ^{n+1}\hspace{1cm}(4)

the resulting split error would be

\textbf{e}_{fs} =\frac{\Delta t}{Re}\nabla^2\nabla\langle \phi \rangle^{n+1}\hspace{1cm}(5)

Any thoughts?
Winston Virtaus is offline   Reply With Quote

Old   September 6, 2023, 04:02
Default
  #67
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,777
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by Winston Virtaus View Post
I think it was due to some calculation error in the higher order terms.

However I could do a lower order approximation to the splitting error as

\textbf{e}_{fs} = \textbf{v}^{n+1}-(\textbf{v}^{*n+1}-\textbf{v}') = \textbf{v}^{n}+\Delta t\frac{\partial \textbf{v}}{\partial t}|^n - \textbf{v}^{*n}-\Delta t\frac{\partial \textbf{v}^*}{\partial t}|^n+\Delta t \nabla \langle \phi \rangle^{n+1}\hspace{1cm}(1)

which can be further reduced into

\textbf{e}_{fs} = \Delta t(\textbf{R}^n+\textbf{P}^n)-\Delta t\textbf{R}^{*n}+\Delta t\nabla \langle \phi \rangle^{n+1}= \Delta t [\nabla \langle \phi \rangle^{n+1}+\textbf{P}^n]= \Delta t[\nabla\langle\phi\rangle^{n+1}-\nabla\langle p\rangle^{n+1}]\hspace{1cm}(2)

assuming

\textbf{v}^n = \textbf{v}^{*n}, \textbf{R}^{*n} = \textbf{R}^n\hspace{1cm}(3)

but I'm not exactly sure if the above assumption is correct.

Then using

(I-\frac{\Delta t}{Re}\nabla^2)\nabla\langle\phi\rangle^{n+1}=\nabla\langle p' \rangle ^{n+1}\hspace{1cm}(4)

the resulting split error would be

\textbf{e}_{fs} =\frac{\Delta t}{Re}\nabla^2\nabla\langle \phi \rangle^{n+1}\hspace{1cm}(5)

Any thoughts?



In my paper I distinguish the case of the continuous formulation from that of the discrete one (but only for the AB/CN scheme). Following the discrete approach, the implicit Euler scheme should introduce the first order error, according to what you get.
FMDenaro is offline   Reply With Quote

Old   September 6, 2023, 23:09
Default
  #68
Member
 
Join Date: Apr 2021
Location: Finland
Posts: 41
Rep Power: 5
Winston Virtaus is on a distinguished road
Thanks for the confirmation!

The paper is indeed very comprehensive and rigorous. The time-discrete analysis was abit harder to follow due to the inverse operator so thats why I followed the continuous analysis.

Its going to be interesting to see what kind of splitting error numbers I get when the error relation is postprocessed. The relation seems rather cheap to compute, is it customary to keep tracking it during runtime too?
Winston Virtaus is offline   Reply With Quote

Old   September 7, 2023, 04:08
Default
  #69
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,777
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by Winston Virtaus View Post
Thanks for the confirmation!

The paper is indeed very comprehensive and rigorous. The time-discrete analysis was abit harder to follow due to the inverse operator so thats why I followed the continuous analysis.

Its going to be interesting to see what kind of splitting error numbers I get when the error relation is postprocessed. The relation seems rather cheap to compute, is it customary to keep tracking it during runtime too?



You should consider Eq.(26) as general infos for the discrete equations. In case of the implicit Euler equation, I would expect the splitting error in the form dt*O(LTE)= O(dt^2).
But it is not customary to keep a trace of that during a run.
The aim of the paper is to provide the framework and show the congruent accuracy order of the BCs for the intermediate velocity.
FMDenaro is offline   Reply With Quote

Old   September 7, 2023, 22:34
Default
  #70
Member
 
Join Date: Apr 2021
Location: Finland
Posts: 41
Rep Power: 5
Winston Virtaus is on a distinguished road
Thanks! I'll take a look.
Winston Virtaus is offline   Reply With Quote

Old   September 23, 2023, 17:30
Default
  #71
Member
 
Join Date: Apr 2021
Location: Finland
Posts: 41
Rep Power: 5
Winston Virtaus is on a distinguished road
I did some more testing on the boundary conditions in a simpler test case to which a closed form solution is available:

Poisseule flow between infinite parallel plates at Re≈26.6
  • Peak flow velocity of 1 m/s
  • Pressure gradient of 1 m/s2
  • Mesh resolution was 16x16x16.
  • Timestep roughly 1e-3 seconds.
Boundary conditions
  • Dirichlet for physical velocity
  • Taylor series based BCs for intermediate velocity
  • Neumann conditions for pressure
I decided to calculate the actual error from the analytical solution. The correct APM formula is also used for face velocities.

Is the divergence error now low enough compared to the velocity and pressure gradient errors?
Attached Images
File Type: png results.png (40.1 KB, 13 views)
File Type: png errors.png (32.5 KB, 12 views)
File Type: png velocityDivergence.png (13.4 KB, 13 views)
Winston Virtaus is offline   Reply With Quote

Old   September 23, 2023, 17:41
Default
  #72
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,777
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by Winston Virtaus View Post
I did some more testing on the boundary conditions in a simpler test case to which a closed form solution is available:

Poisseule flow between infinite parallel plates at Re≈26.6
  • Peak flow velocity of 1 m/s
  • Pressure gradient of 1 m/s2
  • Mesh resolution was 16x16x16.
  • Timestep roughly 1e-3 seconds.
Boundary conditions
  • Dirichlet for physical velocity
  • Taylor series based BCs for intermediate velocity
  • Neumann conditions for pressure
I decided to calculate the actual error from the analytical solution. The correct APM formula is also used for face velocities.

Is the divergence error now low enough compared to the velocity and pressure gradient errors?



I suppose you have the height of 1m, the magnitude of the error seems quite congruent for a second order scheme. However, I would suggest to check further the BC at the inflow, there (and at the two corners), it appears some peaks. Since you are prescribing Dirichlet conditions both at inflow and outflow, I see a different distribution of the errors.
FMDenaro is offline   Reply With Quote

Old   September 23, 2023, 23:08
Default
  #73
Member
 
Join Date: Apr 2021
Location: Finland
Posts: 41
Rep Power: 5
Winston Virtaus is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
I suppose you have the height of 1m, the magnitude of the error seems quite congruent for a second order scheme. However, I would suggest to check further the BC at the inflow, there (and at the two corners), it appears some peaks. Since you are prescribing Dirichlet conditions both at inflow and outflow, I see a different distribution of the errors.

Yes quite close, channel height was 0.2m

So ideally i should expect a similar error pattern near both inlet and outlet?

Its very well possible that there are still inconsistencies in the boundary conditions.
FMDenaro likes this.

Last edited by Winston Virtaus; September 23, 2023 at 23:08. Reason: quick edit
Winston Virtaus is offline   Reply With Quote

Old   September 24, 2023, 22:46
Default Enquiry: CFD Modeling of Bio-pesticide Sprayer Optimization for Agricultural Applicat
  #74
New Member
 
Ogbe Idoko
Join Date: Sep 2023
Posts: 1
Rep Power: 0
Ogbency001 is on a distinguished road
I want to achieve the following objectives and need your guide Develop a simplified CFD model to simulate the bio-pesticide
sprayer application process.

Analyze the spray pattern and droplet behaviour using the CFD
model.

Optimize the sprayer design and operational parameters to
enhance spray coverage and droplet size distribution.

Validate the CFD model by comparing the simulated spray
characteristics with available experimental data or previous
studies

Question1: Which solver in OpenFoam is best for this ?
Question 2: I have learn many tutorial and know how to do simulation based on the tutotial but can not find any on pesticide sprayer; what should I do
Ogbency001 is offline   Reply With Quote

Old   September 25, 2023, 23:27
Default
  #75
Member
 
Join Date: Apr 2021
Location: Finland
Posts: 41
Rep Power: 5
Winston Virtaus is on a distinguished road
Quote:
Originally Posted by Ogbency001 View Post
I want to achieve the following objectives and need your guide Develop a simplified CFD model to simulate the bio-pesticide
sprayer application process.

Analyze the spray pattern and droplet behaviour using the CFD
model.

Optimize the sprayer design and operational parameters to
enhance spray coverage and droplet size distribution.

Validate the CFD model by comparing the simulated spray
characteristics with available experimental data or previous
studies

Question1: Which solver in OpenFoam is best for this ?
Question 2: I have learn many tutorial and know how to do simulation based on the tutotial but can not find any on pesticide sprayer; what should I do

Most likely an VOF-based solver like interFoam would be the way to go.

These guys had some nice results with that solver: https://www.youtube.com/watch?v=jUOQwt6lWS8
Winston Virtaus is offline   Reply With Quote

Old   October 8, 2023, 13:15
Default
  #76
Member
 
Join Date: Apr 2021
Location: Finland
Posts: 41
Rep Power: 5
Winston Virtaus is on a distinguished road
It seems that the source of the error has something to do with the second derivative of pressure.

This time the inlet and outlet physical velocity boundary conditions are constructed via low order upwinding/downwinding and the normal velocity component is altered to achieve the target flowrate which leads to the situation where both the normal gradient of physical velocity and second derivative of pressure basically vanish. As result, something interesting happens to the errors:
  • Maximum error of pressure is reduced almost by a factor of 10. Its now also almost uniform throughout the domain.
  • The velocity divergence is lower and more uniform with symmetric but opposite errors in inlet and outlet region
  • Velocity error is basically uniform in the streamwise direction and changes in the wall normal direction fairly smoothly.
Currently I'm resetting the velocity at the boundary to its physical value after each time-step, so the 3rd derivative of pressure is not taken into account at the boundary.

I'm thinking the Poisson solver part is working properly, but the intermediate velocity step could need some tweaking to help cancel out the third derivative of pressure at the APM step.
Attached Images
File Type: png results2.png (19.5 KB, 6 views)
File Type: png errors2.png (27.4 KB, 7 views)
File Type: png velocityDivergence2.png (17.9 KB, 7 views)
Winston Virtaus is offline   Reply With Quote

Old   October 8, 2023, 13:51
Default
  #77
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,777
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Now seems working better, as further check you can see if the divergence error depends on a grid refinement as should be for the APM.
FMDenaro is offline   Reply With Quote

Old   October 9, 2023, 22:33
Default
  #78
Member
 
Join Date: Apr 2021
Location: Finland
Posts: 41
Rep Power: 5
Winston Virtaus is on a distinguished road
Thanks for the input!

Two different tests were performed to see the divergence error scaling:
  • In the first plot mesh size was fixed to 0.04 m and timestep was changed from roughly Co=1 to Co=0.01
  • On the second plot timestep was fixed to Co=0.6 and mesh size was instead changed. The mesh size was reduced from about 0.1 m to about 0.01 m by splitting the mesh equally in all directions between runs.
All plots are on a double logarithmic scale.

It looks like there is still some inconsistency in the code.
Attached Images
File Type: png timeStepScaling.png (13.3 KB, 8 views)
File Type: png meshScaling.png (11.5 KB, 6 views)

Last edited by Winston Virtaus; October 9, 2023 at 23:03. Reason: quick edit
Winston Virtaus is offline   Reply With Quote

Old   October 10, 2023, 03:52
Default
  #79
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,777
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by Winston Virtaus View Post
Thanks for the input!

Two different tests were performed to see the divergence error scaling:
  • In the first plot mesh size was fixed to 0.04 m and timestep was changed from roughly Co=1 to Co=0.01
  • On the second plot timestep was fixed to Co=0.6 and mesh size was instead changed. The mesh size was reduced from about 0.1 m to about 0.01 m by splitting the mesh equally in all directions between runs.
All plots are on a double logarithmic scale.

It looks like there is still some inconsistency in the code.
You should do the test at constant dt/h ratio, that could solve your issue.
Winston Virtaus likes this.
FMDenaro is offline   Reply With Quote

Old   October 10, 2023, 09:27
Default
  #80
Senior Member
 
Matthew
Join Date: Mar 2022
Location: United Kingdom
Posts: 175
Rep Power: 4
hunt_mat is on a distinguished road
Quote:
Originally Posted by kinematic_presser View Post
Hello guys,
I am still somewhat new to CFD (just starting my masters degree) so please bear with me if my question is dumb.

I am simulating fluid flow in a channel for an assignment. The aim of the assignment is to simulate 2 dimensional incompressible Poiseulle flow, moving from left to right. It is a very simple simulation. There are no obstacles and it is a simple rectangular domain. For the velocity, I enforce a velocity inlet condition at the inlet and a homogeneous Neumann condition at the outlet. I enforce a homogeneous Dirichlet condition (no-slip) at the top and bottom wall. This all makes sense to me as the INSE are second order in u .

But, when I was looking over some example tutorial cases in OpenFOAM, I noticed that their simulations were enforcing a boundary condition for the pressure on both the inlet AND the outlet, and correspondingly, on both the bottom AND the top wall. They typically used a homogeneous Neumann condition on the top and the bottom wall, a homogeneous Neumann condition on the inlet, and a Dirichlet condition on the outlet.

This does not make sense to me from a mathematical point of view, because the INSE are first order in p in both the x and y coordinate, so specifying boundary conditions at only, for example, the bottom and left wall should already be enough to fully specify the solution.

I know that the INSE are invariant under constant pressure shifts p --> p+p0 which gives the system a little extra freedom. I also know that typically the pressure is simulated using the pressure Poisson equation, which is of course second order. But this is a consequence of the INSE, not a governing equation in its own right.

I would appreciate some elucidation on this topic. Thanks.
It is possible to obtain a Poisson equation for the pressure, so that means you need boundary conditions for all your boundaries.
hunt_mat is offline   Reply With Quote

Reply

Tags
pressure b.c


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
What are the best settings for a channel flow simulation? Ashkan Kashani CFX 3 October 13, 2022 21:36
Fail to converge when solving with a fabricated solution zizhou FLUENT 0 March 22, 2021 06:33
Basic Nozzle-Expander Design karmavatar CFX 20 March 20, 2016 08:44
Problem in setting Boundary Condition Madhatter92 CFX 12 January 12, 2016 04:39
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 07:00


All times are GMT -4. The time now is 19:22.