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/)
-   -   about phi in fvm::div(phi,U) (https://www.cfd-online.com/Forums/openfoam-programming-development/181680-about-phi-fvm-div-phi-u.html)

longyun000 December 19, 2016 06:37

about phi in fvm::div(phi,U)
 
hi,
I am new in openfoam. When reading codes, I can't understand the phi in fvm::div(phi, U). It stands for △·(UU), why don't we write as fvm::div(U, U) and what does phi means exactly.
thanks a lot

agustinvo December 19, 2016 08:23

Hi,
phi is actually the flux through the cells (so it is not a volVectorField, but a surfaceScalarField). For incompressible solver phi=U, but in case of compressible flows, phi=rho*U. This is why phi is used, you only change its definition in createFields.

longyun000 December 21, 2016 02:34

thx very much~~

Tobi December 21, 2016 07:50

By the way, your equation is wrong. Be careful with laplacian and nabla!

@agustinvo, you missed the face area!

openfoam_aero June 6, 2022 14:58

Quote:

Originally Posted by longyun000 (Post 630383)
hi,
I am new in openfoam. When reading codes, I can't understand the phi in fvm::div(phi, U). It stands for △·(UU), why don't we write as fvm::div(U, U) and what does phi means exactly.
thanks a lot

Just to add to the answers- the reason why we don’t write \Nabla.(U U) is simply because it is a non-linear equation. OpenFOAM deals with non linearity by using the value of flux from the previous iteration. If you see createFields.H, you will notice that at the end of the code is createPhi.H. This will be called first and the flux will be created. When the iteration loop begins, it will use this flux and calculate the unknown velocity. For the next iteration, the previous iterations flux will be used to calculate the velocity of the current iteration.

Tobi June 6, 2022 15:16

Not 100 % or you did not write it carefully.


First of all, the fluxes are different compared to the velocities as its on the surface and not in the cell center. You are right, the fluxes are created (firstly) by the actual velocities, after constructing the velocity matrix (momentum predictor is not needed), we solve the pressure equation which gives us the correction of the fluxes. These correction are used to recalculate the new velocity field.

The flux calculation might be repeated even though, the velocity matrix is not re-built (updated) only the velocities. See, A and H operator. We repeat until the solution is satisfied and the continuity is fine.

This is mainly PISO + non-Ortho correctors.
In PIMPLE we also update the velocity matrix.

Cheers.

openfoam_aero June 6, 2022 15:27

Quote:

Originally Posted by Tobi (Post 829352)
Not 100 % or you did not write it carefully.


First of all, the fluxes are different compared to the velocities as its on the surface and not in the cell center. You are right, the fluxes are created (firstly) by the actual velocities, after constructing the velocity matrix (momentum predictor is not needed), we solve the pressure equation which gives us the correction of the fluxes. These correction are used to recalculate the new velocity field.

The flux calculation might be repeated even though, the velocity matrix is not re-built (updated) only the velocities. See, A and H operator. We repeat until the solution is satisfied and the continuity is fine.

This is mainly PISO + non-Ortho correctors.
In PIMPLE we also update the velocity matrix.

Cheers.

Thanks for correcting Tobi! Agree on the clarity of the matter. But I had one question
Suppose we have an equation which is not non-linear. In that case, would it be incorrect to calculate the flux before the momentum predictor step? Say it is a linear PDE (coupled, similar to NSE). I would assume that we do not need the flux calculation before momentum predictor since there is no requirement to handle non-linearity. By making this flux calculation from existing velocity, the flux Correction after the pressure equation solution will be applied to the previous iteration flux, not the current one. In such a case, would it be correct to add the flux calculation AFTER momentum predictor step?


All times are GMT -4. The time now is 06:25.