CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Simple velocity correction difference between ussing grad(p) or pEqn.flux()

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

Like Tree1Likes
  • 1 Post By Voulet

LinkBack Thread Tools Search this Thread Display Modes
Old   July 1, 2021, 02:40
Default Simple velocity correction difference between ussing grad(p) or pEqn.flux()
Join Date: Jun 2019
Posts: 34
Rep Power: 5
Voulet is on a distinguished road
Hi all.

In the SIMPLE algorithm, after solving the pEqn laplacian equation the velocity is corrected like this :

U = HbyA - rAU*fvc::grad(p);

In some other solvers i may see this like this :

U = HbyA + rAU*fvc::reconstruct((-pEqn.flux())/rAUf);
(with rAu being 1/UEqn.A() volScalarField and rAUf the same thing on surfaceScalarField).

According to some of my quick tests these 2 ways provide the same U field.

For me the first form is close to the analytical developpement starting with MU = AU - H = - ∇p
Thus I don't realy undertand why the second form is working. In which form the pEqn.flux is linked to the gradient of pressure ?

Thanks for your help.
Voulet is offline   Reply With Quote

Old   July 4, 2021, 09:37
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 455
Rep Power: 11
Tobermory will become famous soon enough
I don't recognise the second bit of coding you have included in your posting. Maybe it's a better idea to copy the exact coding from the solvers you are interested in, and tell us which ones?

It's fairly standard practice in the solvers to see something like the following:
phi = phiHbyA - pEqn.flux();
e.g. line 37 in pEqn.H of simpleFoam. This line corrects the face fluxes using the pressure gradient. For the latter, the pressure gradient is taken directly from the fvMatrix for the p equation (using the flux() function), rather than calculating it again - this reduces continuity errors I believe. You can find the function in fvMatrix.C, and remember that the volume integral of the gradient of a scalar is equivalent to the surface integral of the scalar at the boundary (i.e. sum of the face fluxes), in case you are wondering how the gradient is linked to the face fluxes.

Last edited by Tobermory; July 4, 2021 at 10:42.
Tobermory is offline   Reply With Quote

Old   July 9, 2021, 01:04
Join Date: Jun 2019
Posts: 34
Rep Power: 5
Voulet is on a distinguished road
Thanks for your explanation. The second statement is from a custom solver of my advisor.

I've found the same way here in compressibleInterFoam: line 141.

But I'm now convinced why your recall on the fact that a gradient Gauss discretization involve face fluxes. You answered my question.
Tobermory likes this.
Voulet is offline   Reply With Quote


simple algorithm, velocity correction

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
Multiphase flow - incorrect velocity on inlet Mike_Tom CFX 6 September 29, 2016 01:27
Velocity correction Pflaume1891 Main CFD Forum 19 August 1, 2016 21:18
Velocity Under-relaxation in SIMPLE type methods Matt U. Main CFD Forum 6 July 4, 2005 05:29
Pressure correction on SIMPLE Diego Nogueira Main CFD Forum 6 October 10, 2004 14:43
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 09:11

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