CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Some questions about the functions ddtPhiCorr(rUA, U, phi) and adjustPhi(phi, U, p) (https://www.cfd-online.com/Forums/openfoam/115157-some-questions-about-functions-ddtphicorr-rua-u-phi-adjustphi-phi-u-p.html)

lzgwhy March 25, 2013 07:29

Some questions about the functions ddtPhiCorr(rUA, U, phi) and adjustPhi(phi, U, p)
 
Dear all,

I am reading the icoFoam codes, where I find two functions ddtPhiCorr(rUA, U, phi) and adjustPhi(phi, U, p):

volScalarField rUA = 1.0/UEqn.A();

U = rUA*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi);

adjustPhi(phi, U, p);


Could you tell me why the two functions are used here? And where could I find the explanation of these two functions in official documentation? Thank you very much!

lwhy

fumiya March 25, 2013 10:04

I'm afraid there aren't any official documents regrading this topic, but you can refer to the source code.

1) adjustPhi(phi, U, p)
  • source: https://github.com/OpenFOAM/OpenFOAM...hi/adjustPhi.C
  • This function is to adjust the flux phi to obey continuity(total flux into the domain equals total flux out from the domain).
    This is achieved in the following way:

    Total flux = massIn - fixedMassOut - massCorr * adjustableMassOut
    where
    • massCorr = (massIn - fixedMassOut)/adjustableMassOut
    • massIn: Total flux into the domain
    • fixedMassOut: Total flux out from the domain through the boundaries on which the velocity is prescribed
    • adjustableMassOut: Total flux from the domain through the boundaries on which the velocity is NOT fixed

    We can make the total flux equal 0 by adjusting the adjustableMassOut by multiplying it by massCorr.

2)ddtPhiCorr(rUA, U, phi)
You might want to read the following thread
http://www.cfd-online.com/Forums/ope...rua-u-phi.html
Hope this helps,
Fumiya

LESlie June 5, 2013 10:15

Quote:

Originally Posted by fumiya (Post 416256)
I'm afraid there aren't any official documents regrading this topic, but you can refer to the source code.

1) adjustPhi(phi, U, p)
  • source: https://github.com/OpenFOAM/OpenFOAM...hi/adjustPhi.C
  • This function is to adjust the flux phi to obey continuity(total flux into the domain equals total flux out from the domain).
    This is achieved in the following way:

    Total flux = massIn - fixedMassOut - massCorr * adjustableMassOut
    where
    • massCorr = (massIn - fixedMassOut)/adjustableMassOut
    • massIn: Total flux into the domain
    • fixedMassOut: Total flux out from the domain through the boundaries on which the velocity is prescribed
    • adjustableMassOut: Total flux from the domain through the boundaries on which the velocity is NOT fixed

Thanks for the explanation and sorry for my maybe stupid question.

Why is adjustPhi taken away in, e.g. compressibleInterFoam? Shouldn't the flux still be adjusted to satisfy continuity at the boundary?

Best regards,
Lesie

abtinansari December 25, 2014 14:16

adjustPhi is taken away from compressible solvers because you are no longer solving Poisson equation for getting the pressure. look at post #4 in http://www.cfd-online.com/Forums/ope...adjustphi.html

so there are no singularities to be dealt with. for example lets look at pEqn in laminarSMOKE :

fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvc::div(phi)
- fvm::laplacian(rho*rUA, p)
);


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