CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Solver details (http://www.cfd-online.com/Forums/openfoam-solving/60454-solver-details.html)

 grtabor July 22, 2005 06:28

Hi. I'm looking at the foam::f

Hi. I'm looking at the foam::fvm namespace to try and understand the various operations. Most are pretty obvious; however I'm stuck about the source operators. Can someone tell me what the difference between Su, Sp and SuSp is, please? Thanks

Gavin

 henry July 22, 2005 06:32

Su: Explicit source -> contrib

Su: Explicit source -> contribution to the source
Sp: Implicit source -> contribution to the diagonal
SuSp: Stabilised implicit source -> contribution to the diagonal or source depending on sign of first argument for stability.

 grtabor July 25, 2005 11:23

Thanks. Am I right in thinking

Thanks. Am I right in thinking that the Implicit source is generally more stable? What determines which of these operators to use?

Basically I am (with a PhD student) developing swirl inlets for LES; we are trying to encorporate a body force term to drive the swirl motion. We have created a field 'swirl' to drive this and have just added it into the UEqn object

fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
+ sgsModel->divB(U)
==
);

How does this differ from use of the operators?

Gavin

 mattijs July 25, 2005 11:45

Implicit source can be more st

Implicit source can be more stable.

Its only use is to create a larger diagonal term (to aid the solver) so it only can be used if the linerization of the source term has a negative dependency on the variable you're solving for.

e.g. source S linearized with respect to U:
S = f(U) = Sp*U+Su

So now in your discretized U eqn you can add -Sp to the diagonal which will help the solver to converge.

 hjasak July 25, 2005 14:12

Easy. Think source or sink:

Easy. Think source or sink:
- if the variable is not bounded above (think k) and the rhs term is positive, you can just keep it as explicit. There will be no advantage of making it implicit as it would reduce the diagonal dominance and either break the iterative solver or make it work harder.
- if the variable is bounded below by zero (again think k), you need to make sure that the discretised version honours this. In that case, the sink term must go to zero when k goes to zero - this will stop it going below. Also, a negative rhs term on linearisation (thanks, Mattijs) will enhance the diagonal dominance, so you get a double benefit.
- if you cannot tell for sure whether the term is positivi or negative (say, it's a complex coupling term), using SuSp will make a decision for you on a cell-by-cell basis. However, you'll have to be extra-careful with boundedness and consistency of this kind of term.

In your case, you'll probably want to make drag terms implicit and the terms making the flow swirl explicit (source of energy, right?)

Good luck,

Hrv

 maka October 24, 2005 05:50

I understand Mattijs comment b

I understand Mattijs comment but can any body explain more about Hrv comment:
"variable is not bounded above"
"bounded below by zero"
"you'll have to be extra-careful with boundedness and consistency of this kind of term"

Thanks,
Maka

 mattijs October 24, 2005 14:06

"not bounded above" : no upper

"not bounded above" : no upper limit for the variable. k does not have an upper value. E.g. a phase fraction (e.g. 'gamma') does.

"bounded below by zero" : k cannot go negative.

 mabinty June 26, 2009 09:48

Dear all!

I kindly ask for clarification concerning the operator fvm::SuSp(). The code says (src/finiteVolume/finiteVolume/fvm):

Foam::fvm::SuSp
(
const DimensionedField<scalar, volMesh>& susp,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
....

fvm.diag() += mesh.V()*max(susp.field(), scalar(0));

fvm.source() -= mesh.V()*min(susp.field(), scalar(0))
*vf.internalField();

....

}

Do I get it right that, if the source is written as

S(phi) = Su + Sp*phi

fvm::SuSp() checks whether (-Sp) is >0 and adds (-Sp)*V to the diagonal coefficients, or (-Sp) is <0 and adds -(-Sp)*V*phi=Sp*V*phi to the source? So say I have a source term like

S(phi) = P*phi

and P changes its sign. Hence I have to write

- fvm::SuSp((-P), phi)