CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   calculation of phi (https://www.cfd-online.com/Forums/openfoam/67639-calculation-phi.html)

wbetz August 21, 2009 09:44

calculation of phi
 
Where do I have to look (in the source code), if I want to know how phi is calculated in interFoam?

l_r_mcglashan August 22, 2009 06:16

In createFields.H, you'll see the line include "createPhi.H". You can find this in OpenFOAM-1.X/src/finiteVolume/cfdTools/incompressible

It is defined as:

phi = linearInterpolate(U) & mesh.Sf()

I think the best thing to do is to set up your IDE's code assistance, so that you can easily navigate through the source code.

wbetz August 22, 2009 07:02

If phi is calculated from U, what is the advantage of using boundary conditions like fluxCorrectedVelocity, pressureInletVelocity, pressureInletOutletVelocity - which calculate U form the flux(phi)?

l_r_mcglashan August 22, 2009 07:35

I've had a quick look at fluxCorrectedVelocity.
It would be used when you know the pressure at a boundary and the flux through that boundary.
The BC is correcting the velocity component normal to the boundary, based on your knowledge of the flux through that boundary.
I can't think of when I would use it, maybe someone else has?

You could replace all instances of phi with linearInterpolate(U) & mesh.Sf(), but that would make the code messy.

belier1988 November 7, 2018 10:21

Quote:

Originally Posted by wbetz (Post 227154)
If phi is calculated from U, what is the advantage of using boundary conditions like fluxCorrectedVelocity, pressureInletVelocity, pressureInletOutletVelocity - which calculate U form the flux(phi)?

This is a very interesting question. I'v wondered about it during the use of pimpleFoam with the BC types such as pressureInletVelocity. My guess is that at the boundary where pressure is known, phi is calculated from pressure and can be used to give a value to the velocity component normal to the path.
Can anyone provide a better answer to clear things up ?

Tobi November 8, 2018 01:16

Hi all,

this is an ancient thread, but I want to give some hints:
  1. The flux phi is estimated by the velocity rho*U (compressible) or U (incompressible)
  2. However, the flux itself is corrected using the pressure equation, and then, the new velocity is recalculated from the fluxes
  3. So you cannot say, phi is estimated from U, and after that, it is similar to estimate U from the flux phi because of the flux change during the pressure equation.

Lets consider the solver pimpleFoam
  1. At the beginning the flux field is created in createPhi.H while the values are calculated from U; this is an initialization guess (https://github.com/OpenFOAM/OpenFOAM...teFields.H#L29)
  2. Inside the pimple-loop we have several things that change the flux field such as moving meshes, multi-reference frame and so on (I donīt consider that now).
  3. Neglecting the modifications to the phi field based on the above-mentioned functionalities, we go into the UEqn.H (https://github.com/OpenFOAM/OpenFOAM...pleFoam/UEqn.H)
    Here we do not modify the flux field; we construct the momentum matrix, and if the momentum predictor is on, we estimate a new velocity field based on Navier Stokes equation (not required in general).
  4. After that we enter to the pEqn.H. Inside the pressure loop, we update the fluxes according to the new pressure field (https://github.com/OpenFOAM/OpenFOAM...oam/pEqn.H#L51)
    After the pressure is calculated, it is evident that the fluxes are different to the corresponding velocities field (still the old one), thatīs why we need to recalculate the new velocity field from the new fluxes (https://github.com/OpenFOAM/OpenFOAM...oam/pEqn.H#L60)
  5. After correcting the internal domain, we adjust the boundary conditions for U (https://github.com/OpenFOAM/OpenFOAM...oam/pEqn.H#L61)

Now it should be clear, that the flux-corrected boundary conditions are useful because the fluxes are changing during the pressure equation and we recalculate the velocity from the new fluxes.

belier1988 November 14, 2018 05:06

Thanks Tobi, it's more clear for me now. Have a nice day.

Bdew8556 May 28, 2019 20:04

Hey guys.

I know it's meant to be poor form, but this is directly relevant.
Any thoughts??

https://www.cfd-online.com/Forums/op...-matching.html

Diro7 December 29, 2020 05:52

Hello guys,

thanks for the brilliant material.
I have a related question:

Suppose that I have to solve an additional transport equation for a velocity field V (which is not the standard velocity field U, but may depend on it).
I understand that I have to define a new flux field (no problem to create it), but how should I ensure a correct treatment of flux and velocity provided that they don't need to satisfy a coupled pressure equation?

Things should be necessarily easier than in the standard U-p coupling, but I don't understand clearly what bits should I retain from a standard (S,P)IMPLE solver.

For reference, the transport equation for V reads like

\frac{\partial (c V_i)}{\partial t} + \frac{\partial (c V_i V_k)}{\partial x_k} = c F_i

where repeated index summation notation is assumed and c is a "concentration or density" field which satisfies a transport equation of the form

\frac{\partial c}{\partial t} + \frac{\partial (c V_k)}{\partial x_k} = \frac{\partial}{\partial x_k} \left( D \frac{\partial c}{\partial x_k} \right)

The two equations can be implemented rather straightforwardly provided that a new correct flux \phi_c is used. Upon creation it can be defined by interpolation like in a compressible solver, but how should I ensure the correct update of \phi_c like it is done in a pEqn.H?

Thanks in advance to everyone who has some advice :)


All times are GMT -4. The time now is 09:15.