CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   DivphiU expression in incompressible solvers (http://www.cfd-online.com/Forums/openfoam-pre-processing/62243-divphiu-expression-incompressible-solvers.html)

vvqf November 15, 2005 10:26

In OpenFoam, the term (U . )U
 
In OpenFoam, the term (U . )U in N-S equation is expressed as div(phi,U),where phi is surfaceScalarField, and phi = linearInterpolate(Uo) & mesh.Sf(). I don't understand this.

I think it can also expressed as U . U, (inner product),which in OpenFoam is U & fvc::grad(U)).(why not in this way?)

in OpenFoam, div(phi,U) is said to mean . (UU), and flux f=U
see User Guide U-110

createPhi.H
#ifndef createPhi_H
#define createPhi_H

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info<< "Reading/calculating face flux field phi\n" << endl;

surfaceScalarField phi
(
IOobject
(
"phi",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
linearInterpolate(U) & mesh.Sf()
);

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif


grtabor November 15, 2005 11:29

U & fvc::grad(U)) wouldn't be
 
U & fvc::grad(U)) wouldn't be conservative. The FVM for all transport equations is to discretise

div(phi q)

where q is the unknown variable - could be k, epsilon, temperature, whatever... or in this case any of the components of the velocity. Applying Gauss theorem to the cell converts this into a sum of the fluxes through the faces of the cell, which is what ensures conservation. Of course you do need to get the flux from somewhere, which is what the interpolation is there for.

It is a bit difficult to grasp at first, but we do need to make a distinction between velocity and flux. This is standard practice in FV CFD codes. not just FOAM. Have a look at a textbook in the area (my favourite is Versteeg + Malalasekera)

Gavin

vvqf November 23, 2005 05:50

if the term (U•)U could be n
 
if the term (U•)U could be non-conservative, mathematically, put the physical meaning aside, is it ok to use U & fvc::grad(U))?

or will it cause a inconvergent solution when using the solver, like the residual very large, even "nan" ?

hjasak November 23, 2005 09:59

You can do whatever you like,
 
You can do whatever you like, but the

U & fvc::grad(U)

will be explicit, with the appropriate effects on stability, convergence etc. I would go for

div(U U) - U div(U)

which is the same as U & grad(U) but can be made implicit in both terms (or course, you need to write this in the FOAM language. Mind the fluxes, etc.) :-)

Have fun,

Hrv

vvqf November 24, 2005 07:09

it is really nice of you to an
 
it is really nice of you to anwer my question.
Yes, it is of some fun, but as well as *&^%#@ http://www.cfd-online.com/OpenFOAM_D...part/happy.gif

I would not think of expressing the term in div()terms, and also difficult for me to transform in this way.

I want to ask further:
2 vectors : a, b
Could you give me suggestion what is the proper way to express
<a,b> + <b,a> ?

Thanks again.

vvqf November 24, 2005 07:19

sorry. it should be +
 
sorry. it should be
<a,b> + <b,a>

Exactly, I wanna solve U
<u',u> + <u,u'>

vvqf November 25, 2005 08:46

at first, I thought your trans
 
at first, I thought your transformation
U & fvc::grad(U) = div(U U) - U div(U)
is wrong. later i think there is a mistake in
Programmer's Guide, page P-28
equation (2.5)
should it be : dTij/dxj ?

dT11/dx1 + dT12/dx2 + dT13/dx3
dT21/dx1 + dT22/dx2 + dT23/dx3
dT31/dx1 + dT32/dx2 + dT33/dx3

vvqf November 25, 2005 09:14

if so, then i can come to the
 
if so, then i can come to the conclusion :
(U'•)U = •(U U') = U'•(U)
Then,
(U'•)U = fvm::div(phi, U')
is that right?

http://www.cfd-online.com/OpenFOAM_D...tml?1132700141


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