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/)
-   -   interFoam's UEqn. (https://www.cfd-online.com/Forums/openfoam-programming-development/123342-interfoams-ueqn.html)

sharonyue September 10, 2013 09:03

interFoam's UEqn.
 
1 Attachment(s)
Hi guys,

In thies UEqn we have:

Code:

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

Can I code it like this:

Code:

solve
        (
            UEqn
        ==
           
                    interface.sigmaK()*fvc::grad(alpha1)
                  - ghf*fvc::grad(rho)
                  - fvc::grad(p_rgh)
        );

Actually Im confused about the difference with the grad() and sngrad(). Any ideas?

eysteinn September 10, 2013 12:34

Quote:

Originally Posted by sharonyue (Post 450936)
Hi guys,

In thies UEqn we have:

Code:

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

Can I code it like this:

Code:

solve
        (
            UEqn
        ==
           
                    interface.sigmaK()*fvc::grad(alpha1)
                  - ghf*fvc::grad(rho)
                  - fvc::grad(p_rgh)
        );

Actually Im confused about the difference with the grad() and sngrad(). Any ideas?

grad() is the "normal" gradient calculated in the cell center while sngrad()
is the surface normal gradient that is defined on the face of the cell.
(Which explains why interface.sigmaK is interpolated from the cell center
to the face before performing the multiplication.)

fvc::reconstruct reconstructs the cell centered values from the face values.

Hope this helps

/Eysteinn

sharonyue September 12, 2013 22:10

2 Attachment(s)
Quote:

Originally Posted by eysteinn (Post 450965)
grad() is the "normal" gradient calculated in the cell center while sngrad()
is the surface normal gradient that is defined on the face of the cell.
(Which explains why interface.sigmaK is interpolated from the cell center
to the face before performing the multiplication.)

fvc::reconstruct reconstructs the cell centered values from the face values.

Hope this helps

/Eysteinn

Hi,

I tried to revise it into this:
Code:

if (pimple.momentumPredictor())
    {
        solve
        (
            UEqn
        ==
                    interface.sigmaK()*fvc::grad(alpha1)
                  - gh*fvc::grad(rho)
                  - fvc::grad(p_rgh)             
        );
    }

Then wmake successfully, Then I made a test on dambreak, I get the totally same result(see the log). So it works, but I dont know why Weller make it interpolating U then reconstruct it, it would be easy in my way.

eysteinn September 13, 2013 06:11

I have not used this solver, but my (wild) guess is that this is used to resolve some
convergence problems with the momentum equation.

When you ran the cavity case was the momentumPredictor set to yes
under pimple in the system/fvSolution?

/Eysteinn

sharonyue September 15, 2013 20:17

Quote:

Originally Posted by eysteinn (Post 451493)
I have not used this solver, but my (wild) guess is that this is used to resolve some
convergence problems with the momentum equation.

When you ran the cavity case was the momentumPredictor set to yes
under pimple in the system/fvSolution?

/Eysteinn

Sorry, I did not, so the log is absolutely the same. While I tried to set it to yes, but the result is almost the same. not differ much.:rolleyes:

hchen July 9, 2016 05:43

Hi

I am also curious about it. Anybody has a comment on this issue?

akidess July 11, 2016 02:36

Using cell centered values is not consistent and can lead to problems. I think you can find details in S. S. Deshpande, L. Anumolu, and M. F. Trujillo, Computational Science & Discovery 5, 014016+ (2012), ISSN 1749-4699, URL http://dx.doi.org/10.1088/1749-4699/5/1/014016. (which anyone working with interFoam should read).


All times are GMT -4. The time now is 11:24.