CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   How many boundary conditions do we need for the pressure? (https://www.cfd-online.com/Forums/main/245524-how-many-boundary-conditions-do-we-need-pressure.html)

Winston Virtaus July 4, 2023 17:08

Quote:

Originally Posted by FMDenaro (Post 852763)
I had no problem with Neumann conditions, tested both on analytical solutions and on the 3D backward facing step.
On outflow I adopted fully developed flow, that is zero normal derivative for the velocity. Consequently, at the outflow you have the Poisson equation only in a plane.


Yes, I have confidence in the method now. I was planning to apply this later to external flows also and see how well it works e.g. in nozzle type flows where a jet exits into theoretically zero pressure environment.

FMDenaro July 4, 2023 17:21

Quote:

Originally Posted by Winston Virtaus (Post 852771)
Yes, I have confidence in the method now. I was planning to apply this later to external flows also and see how well it works e.g. in nozzle type flows where a jet exits into theoretically zero pressure environment.




Just remember to consider always the Hodge decomposition. On an outflow, if you apply a normal derivative of the velocity to be zero, then you have a relation for the second derivative of the pressure along the normal direction to use in the Poisson equation. If you do all correctly, on a staggered grid you will be able to drive the div V = 0 constraint to machine precision.

Winston Virtaus July 4, 2023 18:10

Quote:

Originally Posted by FMDenaro (Post 852772)
Just remember to consider always the Hodge decomposition. On an outflow, if you apply a normal derivative of the velocity to be zero, then you have a relation for the second derivative of the pressure along the normal direction to use in the Poisson equation. If you do all correctly, on a staggered grid you will be able to drive the div V = 0 constraint to machine precision.


The decomposition seems indeed to be the preferred method to think about valid boundary conditions, I'll keep this in mind!

Usually I have been using the standard do-nothing boundary condition with zero normal velocity gradient and zero pressure at outlet. Previously I have also tried the traction-free boundary condition where pressure is set by the normal velocity gradient but this didn't provide much benefit as an outlet condition over the standard boundary condition. I didn't pay much attention if these were consistent with the decomposition.

Winston Virtaus August 24, 2023 23:41

I was able to some more testing on the Neumann pressure boundary conditions on cell centered grids. Hopefully soon proceeding to more complex 3D cases from the backwards facing step case. No scaling tests yet perfomed though. :)

Quote:

Originally Posted by FMDenaro (Post 852772)
Just remember to consider always the Hodge decomposition. On an outflow, if you apply a normal derivative of the velocity to be zero, then you have a relation for the second derivative of the pressure along the normal direction to use in the Poisson equation.

It was mentioned a while back that a zero gradient condition for velocity would lead to a zero second gradient of pressure via the Hodge decomposition. Is it a bad idea to assume a constant
pressure gradient across the boundary cell even if there is a nonzero velocity gradient present e.g. in wall boundaries?

I mean that if intermediate velocity gradients at boundary are set to be equal to physical velocity gradients before intermediate velocity field is computed (not implying same boundary values, but same gradients), wouldnt zero second gradient of pressure be a direct consequence of the Hodge decomposition?

FMDenaro August 25, 2023 04:19

Quote:

Originally Posted by Winston Virtaus (Post 855851)
I was able to some more testing on the Neumann pressure boundary conditions on cell centered grids. Hopefully soon proceeding to more complex 3D cases from the backwards facing step case. No scaling tests yet perfomed though. :)



It was mentioned a while back that a zero gradient condition for velocity would lead to a zero second gradient of pressure via the Hodge decomposition. Is it a bad idea to assume a constant
pressure gradient across the boundary cell even if there is a nonzero velocity gradient present e.g. in wall boundaries?

I mean that if intermediate velocity gradients at boundary are set to be equal to physical velocity gradients before intermediate velocity field is computed (not implying same boundary values, but same gradients), wouldnt zero second gradient of pressure be a direct consequence of the Hodge decomposition?




The Hodge decomposition is a relation between continuous vector fields, therefore you can apply any derivative on it.

From a rigorous mathematical aspect, that is no longer true on confinement boundary where derivative is defined only from the interior.
However, let assume any derivative can be done also on the boundary, the issue would be when you prescribe some approximation for the derivative.

Thus, yes, if you assume the velocities derivative are the same the second derivative of the pressure will vanish on the boundary. A different issue is what that means in the physics of that region.

Winston Virtaus August 25, 2023 22:28

Quote:

Originally Posted by FMDenaro (Post 855864)
The Hodge decomposition is a relation between continuous vector fields, therefore you can apply any derivative on it.

From a rigorous mathematical aspect, that is no longer true on confinement boundary where derivative is defined only from the interior.
However, let assume any derivative can be done also on the boundary, the issue would be when you prescribe some approximation for the derivative.

Thus, yes, if you assume the velocities derivative are the same the second derivative of the pressure will vanish on the boundary. A different issue is what that means in the physics of that region.


Its good to hear zero second derivative of pressure has some validity behind it. Its a convenient option to use numerically so i decided to go with that route.

Currently I'm using v* = v(n+1) +deltaT*gradP(n) for intermediate velocity step and the dP/dn = (v*-v).n at the Poisson step.
Are there any rules of thumb to make an assessment if the resulting v is actually divergence free enough after the projection step? Average Div(v) is approximately O(1e-4) at Co=1 in the backwards facing step case.

FMDenaro August 25, 2023 23:37

Quote:

Originally Posted by Winston Virtaus (Post 855903)
Its good to hear zero second derivative of pressure has some validity behind it. Its a convenient option to use numerically so i decided to go with that route.

Currently I'm using v* = v(n+1) +deltaT*gradP(n) for intermediate velocity step and the dP/dn = (v*-v).n at the Poisson step.
Are there any rules of thumb to make an assessment if the resulting v is actually divergence free enough after the projection step? Average Div(v) is approximately O(1e-4) at Co=1 in the backwards facing step case.

In a staggered arrangement of the variables you must have in each cell the divergence-free constraint verified at the same error of the stop there should in an iterative solver. That can be also zero at the roundoff level. On non-staggered arrangement, the constraint is satisfied up to the magnitude of the local truncation error. At least in a general case, some specific method can produce the same error of the staggered case.
Check the max error of the div V condition and the position.

Winston Virtaus August 26, 2023 20:12

Quote:

Originally Posted by FMDenaro (Post 855907)
In a staggered arrangement of the variables you must have in each cell the divergence-free constraint verified at the same error of the stop there should in an iterative solver. That can be also zero at the roundoff level. On non-staggered arrangement, the constraint is satisfied up to the magnitude of the local truncation error. At least in a general case, some specific method can produce the same error of the staggered case.
Check the max error of the div V condition and the position.

The largest divergence seems to be at the boundary cells close to the 90 degree corner where flow separates due to abrupt expansion of the channel height. There div(V) is around O(100) which is many orders of magnitude higher than the average would suggest. Both positive and negative values of divergence occur in the boundary and the high divergence is limited only to a couple of cells. In the internal cells I can see some divergence errors O(10) occuring further away from the corner at the shearing layer that is formed after the backward step. The errors approach the average levels O(1e-3 to 1e-4) fairly quickly in the streamwise direction.

The only physical interpretations of div(V) I currently have is that its related to the rate of change of volume per unit volume and its related to fluid normal stresses via the Newtonian fluid stress tensor but nothing conclusive yet.
So this in a way leads to the question that are the divergence numbers indicative of the solution quality on itself or should they be evaluated in relation to some other physical quantity? Perhaps get div(V) so low that it would constitute to less than 0.1% of the normal stresses? :rolleyes:

The face fluxes have been in general adjustable via solver tolerance but div(V) at cell center has been harder to get down to arbitrary levels which is probably due to the inevitable local truncation error like you pointed out.

FMDenaro August 26, 2023 21:42

Quote:

Originally Posted by Winston Virtaus (Post 855935)
The largest divergence seems to be at the boundary cells close to the 90 degree corner where flow separates due to abrupt expansion of the channel height. There div(V) is around O(100) which is many orders of magnitude higher than the average would suggest. Both positive and negative values of divergence occur in the boundary and the high divergence is limited only to a couple of cells. In the internal cells I can see some divergence errors O(10) occuring further away from the corner at the shearing layer that is formed after the backward step. The errors approach the average levels O(1e-3 to 1e-4) fairly quickly in the streamwise direction.

The only physical interpretations of div(V) I currently have is that its related to the rate of change of volume per unit volume and its related to fluid normal stresses via the Newtonian fluid stress tensor but nothing conclusive yet.
So this in a way leads to the question that are the divergence numbers indicative of the solution quality on itself or should they be evaluated in relation to some other physical quantity? Perhaps get div(V) so low that it would constitute to less than 0.1% of the normal stresses? :rolleyes:

The face fluxes have been in general adjustable via solver tolerance but div(V) at cell center has been harder to get down to arbitrary levels which is probably due to the inevitable local truncation error like you pointed out.


But what about the grid arrangement ? The error seems due to some bug.
Have you used the same discrete operators for Div V and Div Grad p ?

Winston Virtaus August 26, 2023 23:02

Quote:

Originally Posted by FMDenaro (Post 855937)
But what about the grid arrangement ? The error seems due to some bug.
Have you used the same discrete operators for Div V and Div Grad p ?

Block-structured grid with co-located arrangement.

Linear interpolation is used for the source term and compact laplacian for div(grad(p)). The schemes should be consistent.

I'll try to double check everything.

Its possible my post processing step has the bug. I'll try to post process the source term of the Poisson equation.

FMDenaro August 27, 2023 04:24

Quote:

Originally Posted by Winston Virtaus (Post 855939)
Block-structured grid with co-located arrangement.

Linear interpolation is used for the source term and compact laplacian for div(grad(p)). The schemes should be consistent.

I'll try to double check everything.

Its possible my post processing step has the bug. I'll try to post process the source term of the Poisson equation.




Let me remark that a projection method on co-located grid and linear flux reconstruction produces a div v error of the order of the local truncation error in case of the compact DivGrad operator (Approximate Projection Method), as I've shown here (see Eq.(27)):


https://www.researchgate.net/publica...cHJvZmlsZSJ9fQ


and also here



https://www.researchgate.net/publica...taggered_grids





Now, if your solution is performed using non-dimensional variables, the high error in the divergence-free constraint is due to some error in prescribing the BCs.


I strongly suggest to use a standard test-case, single block structured, such as a simple Poiseuille solution to test your code.

Winston Virtaus August 27, 2023 18:17

Quote:

Originally Posted by FMDenaro (Post 855944)
Let me remark that a projection method on co-located grid and linear flux reconstruction produces a div v error of the order of the local truncation error in case of the compact DivGrad operator (Approximate Projection Method), as I've shown here (see Eq.(27)):


https://www.researchgate.net/publica...cHJvZmlsZSJ9fQ


and also here



https://www.researchgate.net/publica...taggered_grids





Now, if your solution is performed using non-dimensional variables, the high error in the divergence-free constraint is due to some error in prescribing the BCs.


I strongly suggest to use a standard test-case, single block structured, such as a simple Poiseuille solution to test your code.


Thanks, I'll take a look!

Just to clarify, there are three options that I can think of currently to estimate the divergence at postprocessing. All options have 1/s unit if normalised via cell volume or m3/s if not normalised.
Option 1: Interpolate cell-centre velocity to cell faces, perform dot product with face area vector and calculate div(V) using 1/Volume*sum(Vf*Sf).
Option 2: Calculate div(V) as trace(grad(V)). Values are usually equal to option 1 within some roundoff error and slightly dependent on grad(V) discretisation choice.

Option 3: Calculate div(V) directly from the face fluxes which are decomposed as Vf = Vf* - deltaT*dP/dn and perform dot product with face area vector and calculate div(V) using 1/Volume*sum(Vf*Sf).
The values that were reported earlier were obtained from option 1 (unit 1/s) so it seems that they were per unit volume. I referred to the values given by options 1-2 as divergence of cell centre velocity and option 3 as divergence of fluxes. Which was probably abit inaccurate. The level of divergence of the decomposed face fluxes can usually be reduced via tightening Poisson solver tolerance.

If option 1 is used without the cell volume normalisation (unit m3/s), the largest divergence is in the same area as before but the values are now substantially lower. Roughly O(1e-8) at flow separation point and O(1e-9) at the shear layer. Which correspond to about 0.01% and 0.001% of flowrate through the domain. The flowrates are of course dependent on the width of the domain now that my case is actually 2D but it shouldn't affect the percentages.

If option 3 is used, the divergence is around O(1e-12-1e-13) and its scattered fairly well throughout the domain without any visible problem areas.

Should I be mainly looking at the values obtained from option 1 in m3/s units?

FMDenaro August 27, 2023 23:29

You have no option! You must use exactly the same discrete operators you used to solve the pressure equation, no other choice is correct.
See the papers I addressed.

Winston Virtaus August 28, 2023 16:22

The first paper hopefully clarified some concepts.

So to estimate the divergence we can take a look at two different sets of face velocities:
Set 1: "MAC-like" face velocities that live in the cell faces and are obtained through Vf =V* - deltaT*dP/dn, where V* is an interpolated quantity. Divergence should be obtained down to machine precision.
Set 2: Obtained from linear interpolation of cell-centre variables. Vf = V +deltaT*grad(P). Divergence of this quantity should be monitored due to its sensitivity to truncation errors.
Am I back on the right track? It looks like this is exactly the issue that Rhie-Chow interpolation is trying to reduce. The discrepancy between large and compact stencils.

FMDenaro August 28, 2023 16:41

Quote:

Originally Posted by Winston Virtaus (Post 856026)
The first paper hopefully clarified some concepts.

So to estimate the divergence we can take a look at two different sets of face velocities:
Set 1: "MAC-like" face velocities that live in the cell faces and are obtained through Vf =V* - deltaT*dP/dn, where V* is an interpolated quantity. Divergence should be obtained down to machine precision.
Set 2: Obtained from linear interpolation of cell-centre variables. Vf = V +deltaT*grad(P). Divergence of this quantity should be monitored due to its sensitivity to truncation errors.
Am I back on the right track? It looks like this is exactly the issue that Rhie-Chow interpolation is trying to reduce. The discrepancy between large and compact stencils.


The MAC strategy is effective on staggered grid where you can get machine precision, but you have the APM on your colocated arrangement.
You have to check the divergence-free constraint in each cell, but using the congruent discretization for the div operator. The result should be an error of the magnitude of the local truncation error.
Of course, also the grad operator must be congruent.

Winston Virtaus August 28, 2023 19:30

Thanks for the input, much appreciated! :)

Actually I wasn't aware that the mac-like face velocities werent as effective on co-located grids as I had previously thought.

Should the APM face velocity set Vf = V +deltaT*grad(P) be then used at correction step too and not just in postprocessing?

FMDenaro August 28, 2023 20:29

Quote:

Originally Posted by Winston Virtaus (Post 856032)
Thanks for the input, much appreciated! :)

Actually I wasn't aware that the mac-like face velocities werent as effective on co-located grids as I had previously thought.

Should the APM face velocity set Vf = V +deltaT*grad(P) be then used at correction step too and not just in postprocessing?

The correction step must indeed be performed using the same discretization. In my paper you will find the full procedure for the APM (do not consider the DPM part). Just observe that the check for the divergence-free error is a part of the solver.

Dr Youssef Hafez August 28, 2023 20:38

Sorry I have not followed all the comments here but just wanted to share my view. There is an alternative formulation for the pressure in which no need to use the Poisson's equation for the pressure. In this way the pressure is solved on the element or cell level to enforce the continuity equation which is not needed thus reducing the numebr of equations to only the momentum equations as follows.
The pressure has a mathematical, not a thermodynamic meaning. According to RANS the pressure is not uniquely defined as any pressure function could satisfy the RANS up to an additive constant so a family of parallel pressure surface fields would satisfy the RANS mathematically speaking. However, knowing one pressure value would tie the solution. In fact, from a CFD or mathematical prospective the pressure is just a constraint to enforce the incompressibility constraint or the velocity divergence free condition (Div. V =0).

One possible treatment of the pressure is through expressing the pressure using the penalty approach as:
- p/k = (Div. V) ; or p = - K (Div. V)
where K is a penalty parameter that is supposed to have a very large values (ideally infinite value) so at such very large values Div. (V) =0.0 .
A better formulation is the iterative penalty method which I used in my codes which is:
p (at iteration i+1) = p (at iteration i) - K (Div. V)
In the iterative penalty method smaller values could be taken for k, e.g. k maybe 100 to avoid using very large numbers.
When using the pressure penalty approach, no need to solve the continuity equation on the global scale and in fact the pressure is substituted for using the above mentioned equation in RANS and the pressure is no longer an unknown which reduces the number of unknowns to only the velocities. This is a big computational advantage saving significant memory storage. However, the pressure can be recovered by solving on the element or cell scale using the penalty equation and the obtained values are true within an additive constant. Knowing one value of pressure, the pressure values obtained could be easily scaled.

Winston Virtaus August 30, 2023 22:59

Quote:

Originally Posted by FMDenaro (Post 856033)
The correction step must indeed be performed using the same discretization. In my paper you will find the full procedure for the APM (do not consider the DPM part). Just observe that the check for the divergence-free error is a part of the solver.

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?

Winston Virtaus August 30, 2023 23:01

Quote:

Originally Posted by Dr Youssef Hafez (Post 856034)
Sorry I have not followed all the comments here but just wanted to share my view. There is an alternative formulation for the pressure in which no need to use the Poisson's equation for the pressure. In this way the pressure is solved on the element or cell level to enforce the continuity equation which is not needed thus reducing the numebr of equations to only the momentum equations as follows.
The pressure has a mathematical, not a thermodynamic meaning. According to RANS the pressure is not uniquely defined as any pressure function could satisfy the RANS up to an additive constant so a family of parallel pressure surface fields would satisfy the RANS mathematically speaking. However, knowing one pressure value would tie the solution. In fact, from a CFD or mathematical prospective the pressure is just a constraint to enforce the incompressibility constraint or the velocity divergence free condition (Div. V =0).

One possible treatment of the pressure is through expressing the pressure using the penalty approach as:
- p/k = (Div. V) ; or p = - K (Div. V)
where K is a penalty parameter that is supposed to have a very large values (ideally infinite value) so at such very large values Div. (V) =0.0 .
A better formulation is the iterative penalty method which I used in my codes which is:
p (at iteration i+1) = p (at iteration i) - K (Div. V)
In the iterative penalty method smaller values could be taken for k, e.g. k maybe 100 to avoid using very large numbers.
When using the pressure penalty approach, no need to solve the continuity equation on the global scale and in fact the pressure is substituted for using the above mentioned equation in RANS and the pressure is no longer an unknown which reduces the number of unknowns to only the velocities. This is a big computational advantage saving significant memory storage. However, the pressure can be recovered by solving on the element or cell scale using the penalty equation and the obtained values are true within an additive constant. Knowing one value of pressure, the pressure values obtained could be easily scaled.


Interesting concept!

Is this mainly used in the FEM-community? I've usually seen penalty approach used for displacement boundary conditions and contact constraints in solid mechanics.

FMDenaro August 31, 2023 03:02

Quote:

Originally Posted by Winston Virtaus (Post 856140)
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.

Winston Virtaus September 1, 2023 22:47

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?

FMDenaro September 2, 2023 03:47

Quote:

Originally Posted by Winston Virtaus (Post 856255)
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.

Winston Virtaus September 4, 2023 23:50

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 :)

FMDenaro September 5, 2023 04:31

Quote:

Originally Posted by Winston Virtaus (Post 856343)
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.

Winston Virtaus September 5, 2023 21:02

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? :D

FMDenaro September 6, 2023 04:02

Quote:

Originally Posted by Winston Virtaus (Post 856429)
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? :D




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.

Winston Virtaus September 6, 2023 23:09

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?

FMDenaro September 7, 2023 04:08

Quote:

Originally Posted by Winston Virtaus (Post 856482)
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.

Winston Virtaus September 7, 2023 22:34

Thanks! I'll take a look. :)

Winston Virtaus September 23, 2023 17:30

3 Attachment(s)
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?

FMDenaro September 23, 2023 17:41

Quote:

Originally Posted by Winston Virtaus (Post 857390)
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.

Winston Virtaus September 23, 2023 23:08

Quote:

Originally Posted by FMDenaro (Post 857391)
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.

Ogbency001 September 24, 2023 22:46

Enquiry: CFD Modeling of Bio-pesticide Sprayer Optimization for Agricultural Applicat
 
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

Winston Virtaus September 25, 2023 23:27

Quote:

Originally Posted by Ogbency001 (Post 857427)
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 October 8, 2023 13:15

3 Attachment(s)
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.

FMDenaro October 8, 2023 13:51

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.

Winston Virtaus October 9, 2023 22:33

2 Attachment(s)
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.

FMDenaro October 10, 2023 03:52

Quote:

Originally Posted by Winston Virtaus (Post 858088)
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.

hunt_mat October 10, 2023 09:27

Quote:

Originally Posted by kinematic_presser (Post 837274)
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.


All times are GMT -4. The time now is 21:39.