CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   gradient of pressure (https://www.cfd-online.com/Forums/openfoam-programming-development/123089-gradient-pressure.html)

sharonyue September 4, 2013 04:37

gradient of pressure
 
1 Attachment(s)
Hi All,

In VOF, we have this equation:

{p_d} = p - \rho g \cdot h

In the code, it reads:

\nabla {p_d} = \nabla p - \rho g - g \cdot h\nabla \rho

Well,Shouldn't it be

\nabla {p_d} = \nabla p - g \cdot h\nabla \rho  - \rho \nabla(g \cdot h)?

sharonyue September 8, 2013 21:22

hello? no one is here :D

Sylv September 11, 2013 10:09

And in the source code, how it looks? Do you have a piece of code?

sharonyue September 11, 2013 19:58

Quote:

Originally Posted by Sylv (Post 451144)
And in the source code, how it looks? Do you have a piece of code?

In interFoam's UEqn's code:

Code:

fvVectorMatrix UEqn
    (
        fvm::ddt(rho, U)
      + fvm::div(rhoPhi, U)
      + turbulence->divDevRhoReff(rho, U)
    );

    UEqn.relax();

    if (pimple.momentumPredictor())
    {
        solve
        (
            UEqn
        ==
            fvc::reconstruct
            (
                (
                    fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
                  - ghf*fvc::snGrad(rho)
                  - fvc::snGrad(p_rgh)
                ) * mesh.magSf()
            )
        );
    }

Its:
\nabla {p_d} = \nabla p - \rho g - g \cdot h\nabla \rho

but why?

Sylv September 16, 2013 04:32

mmmh, I'm not familiar with interFoam, so I don't know the hypothesis involved in the design of this solver, and by extend, in the selection of the equations.

Regarding your first post, I agree with you, the following equation seems the right one: \nabla {p_d} = \nabla p - g \cdot h\nabla \rho  - \rho \nabla(g \cdot h). BUT, as I said, it might have a dozen of hypothesis which explain the selection of the first equation.

What about validation and/or papers on interFoam? If the equations were really wrong, somebody should have noticed it. Look at this page, it might help you: http://openfoamwiki.net/index.php/InterFoam

Bernhard September 16, 2013 04:39

\nabla(g\cdot h)=g
There is no difference between the two, nor any underlying assumption, because

\nabla( g\cdot h)=\nabla (g_x x + g_y y + g_z z) =(g_x, g_y, g_z),
only assuming that g is a constant.

sharonyue September 16, 2013 04:43

Quote:

Originally Posted by Sylv (Post 451947)
mmmh, I'm not familiar with interFoam, so I don't know the hypothesis involved in the design of this solver, and by extend, in the selection of the equations.

Regarding your first post, I agree with you, the following equation seems the right one: \nabla {p_d} = \nabla p - g \cdot h\nabla \rho  - \rho \nabla(g \cdot h). BUT, as I said, it might have a dozen of hypothesis which explain the selection of the first equation.

What about validation and/or papers on interFoam? If the equations were really wrong, somebody should have noticed it. Look at this page, it might help you: http://openfoamwiki.net/index.php/InterFoam

Thank you man, I think Bernhard is rite, its only math...
Thank you both.


All times are GMT -4. The time now is 20:27.