CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Tensor driven convection (

petr August 22, 2006 06:26

Hi, I want to distretize im

I want to distretize implicitly the terms:

div((C*C) & V)

and div(V*C)

where C is a vector. This is only possible explicitly using the fvc function. I want to solve for the vector V and for stability reason implicitly. Anybody know if this is possible and how?


david_h August 22, 2006 09:17

Petr, I don't think you can

I don't think you can make the terms fully implicit until a coupled equation capability is introduced into the library.

In the interim, you can modify the method
used for the velocity equations in Reynolds
Stress Transport Models, in which the stress divergence is aranged as an implicit diagonal and an explicit correction.

For the first term:

volScalarField traceCC = (1.0/3.0)*tr(C*C)
volScalarField traceCC = C & C;

fvm::grad( traceC, V)
- fvc::grad( traceC, V)
fvc::div( (C*C) & V)

For the second term (one possiblility might be)
gradC = fvc::div(C)
diagGradC = diag(gradC)
fvm::Su( diagGradC, V )
- diagGradC * V
+ fvc::div(V*C)

hope this helps


petr August 23, 2006 06:06

Dave, thank you for the kind r
Dave, thank you for the kind reply. I understand what you mean, but have some problems implementing. grad does not exist in the fvm scope, do you mean div:

fvm::div( traceCC, V)
- fvc::div( traceCC, V)
+ fvc::div( (C*C) & V)

then traceCC must somehow be interpolated to surfaceScalarField, I think.

for the second term I think you mean gradC = fvc::grad(C)? For some reason diag() is not recognized, but according the programmers guide it should work.
The compiler says:
error: 'diag' was not declared in this scope

Might the name have changed?


david_h August 23, 2006 16:08

Petr, You are correct abou

You are correct about my div/grad substitutions
(In the first expression I misread your post)

To get traceCC as a surfaceScalarField, you could use fvc::interpolate(traceCC),

The diag() function does not appear to have been implemented for volTensorFields. Further, since fvm::Su and fmv:SuSp only take a volScalarField as a first argument, you wouldn't be able to use a tensor anyway. You could try using:
traceGradC = tr(gradC)/3.0;
fvm::Su( traceGradC, V ) - traceGradC * V + fvc::div(V*C);

Also, div( (C*C) & V) would seem be a scalar,
i.e., d_i(C_i C_j V_j)


All times are GMT -4. The time now is 20:54.