CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)

 cheng1988sjtu June 6, 2012 09:37

Question about the fvm::SuSp, and fvm::Sp

Hi Foamers!

When I'm programming with the OpenFOAM, I got confused with the difference between fvm::SuSp, and fvm::Sp, could anybody tell me the difference? As far as I know, fvm::SuSp(a,b) will calculate a*b implicitly or explicitly according to the sign of a, however, when a is positive, is fvm::Sp explicit or implicit? fvm::Sp(a,b) will calculate a*b implicitly anyway.

The second question is related to a phenomenon I found when I'm solving the continuity equation, the exact form should be :

ddt(alpha) + div(phia, alpha) - alpha * div(phia) ==0

This supposed to be solving ddt(alpha) + U_a*grad(alpha) =0, and the implementation I made in the code is : (alpha is a scalar, volume fraction)

fvScalarMatrix alphaEqn
(
fvm::ddt(alpha)
+ fvm::div(phia, alpha, scheme)
- fvm::Sp(fvc::div(phia), alpha, schemer)
);
where phia = fvc::interpolation(Ua) *mesh.Sf()

Interestingly, after this, I got that alpha does not change with time anymore, which means that the equation reduced to ddt(alpha) =0, which is clearly not true if we take the definition of fvm::Sp().

However, my worry is that, in the momentum equation, they are solving :

fvm::ddt(Ua)
+ fvm::div(phia, Ua, "div(phia,Ua)")
- fvm::Sp(fvc::div(phia), Ua)
== ........

I'm wondering if this fvm::Sp( ) makes a difference between the scalar source and vector source. Thanks!!!!

Any idea would be appreciated!!

 cheng1988sjtu June 6, 2012 10:06

Sorry for the mistake I made in the continuity equation

Hi

I made a mistake, I think the exact form for continuity equation should be:

ddt(alpha) + div(alpha*phia) =0

not : ddt(alpha) + U_a*grad(alpha) =0

So, forget about the continuity equation I described, however, the question about the difference between fvm::SuSp() and fvm::Sp() is still valid, Thanks!

Zhen

 rama13 October 10, 2014 04:52

A bit late, but however...

A bit late, but however...this page on the wiki helps a lot in clarifying!

 All times are GMT -4. The time now is 07:14.