CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Gradient operator implicit discretization (

diegon November 29, 2006 06:54

In order to build a solver for
In order to build a solver for combustion I need to discretize the radiative transfer equation.
The RTE contains the term:


where I is a scalar and s a vector.
My problem comes from the gradient operator for which is avaible only the explicit representation but I need an implicit form to solve for I.
So I have thought to use some math and rewrite it in a form containg operator having an implicit discretization such as divergence:


Should it work?

hartinger November 29, 2006 08:32

Yep, looks correct, should wor
Yep, looks correct, should work.

surfaceScalarField sf = fvc::surfaceInterpolate(s)& mesh.Sf();
& mesh.Sf()
s * grad(I) := fvm::div(sf, I) - fvm::Sp(fvc::div(fs), I);

the 'Sp' - thing adds a coefficient to the diagonal of the implicit matrix.

Taking this opportunity, why is there no implicit grad implementation? Anybody?

pierre and markus

hartinger November 29, 2006 08:34

ignore second & mesh.Sf()
ignore second & mesh.Sf()

P & M

hjasak November 29, 2006 08:50

Implicit gradient operator:
Implicit gradient operator:

- firstly, the diagonal would be zero.
- secondly, the matrix coefficients would be vectors for a gradient and vectors transpose for a divergence
- thirdly, you cannot solve the equation

grad(thingy) = rhs

beucase the diagonal of the gradient matrix equals zero for a uniform mesh

Implicit gradient matrix makes sense only for implicit block coupled (e.g. pressure velocity) algorithms, and I'm pretty sure noone is quite there yet with OpenFOAM.


diegon November 29, 2006 09:54

The equation I need to discret
The equation I need to discretize is not


but it contains the "s*grad(I)" that I have thought to sobstitute it with "div(s*I)-I*div(s)".

hartinger November 29, 2006 10:24

Hrv, thanks, does make sense.
Hrv, thanks, does make sense.

Diego, we decribed the implementation of "s*grad(I)" as "div(s*I)-I*div(s)", which would be one of the terms for the matrix setup (:= means defined as)

fvScalarMatrix yourEqn
+ fvm::div(sf, I) - fvm::Sp(fvc::div(fs), I)


diegon November 29, 2006 10:35

Ok thanks so it seems it c
Ok thanks

so it seems it could not work.

hartinger November 29, 2006 10:48

yes, it can you can't have
yes, it can

you can't have the term "s*grad(I)" implicitly, but you can replace that with the term you suggested "div(s*I)-I*div(s)", for which we gave the actual implementation.
The "fvm::"-prefix means in Foam-speak implicit. More precise, it is the "fvm" namespace in which all implicit functions for the Finite Volume Method (fvm) are defined.

"fvc::" denotes "Finite Volume Calculus", all explicit stuff.

So again, your reasoning is right, you can do it as you suggested.

P & M

diegon November 29, 2006 10:55

Sorry but I did not get what J
Sorry but I did not get what Jasak was writing so I guessed it would not have worked.

Thank you again.

matteoc December 27, 2006 07:23

Hi Diego, I think that "s"
Hi Diego,

I think that "s" is a const vector, once u have decided the direction of the radiation...
so div(s) must be equal to zero.

So, I think u can write:
s&grad(I) = div(sI)


Erik May 2, 2007 05:52

Hi This might be a dumb que

This might be a dumb question but is this why the pressure is solved in a semi-discretised form of the momentum equation (A and H decompositions and solving through Jacobi metod) i.e. to find another way of implementing an implicit form of grad(p)?


hjasak May 2, 2007 05:58

Do you know CFX? They impleme
Do you know CFX? They implement a pressure-based block solver and they indeed have an implicit grad (and div!) to form a 2x2 block matrix system.

No such thing in OpenFOAM at the moment.


Erik May 2, 2007 06:22

Thank you Hrv! I guess this
Thank you Hrv!

I guess this is the reason for the special treatment of grad(p) then.

I dont know about CFX. I am fairly new to the field of CFD and keen on using and learning more about OpenFOAM.

My problem is that I am trying to implement a different momentum equation involving gradients of density as well as the gradient of pressure. I would like to know how to formulate this in a similar manner to the one done in the PISO-loop. Ive looked through your Ph.D and found some information on the subject but I would like to see some DOC (if available) on how to get the momentum equation in the semi-discretised form. Is such DOC available to your knowledge?


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