CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   solve equation (

michaelsmit March 19, 2011 12:05

solve equation
Hello everyone

I would like to solve a equation that looks like this:

ddt(f) + div(F) = k*laplacian(f)

f is a volScalarField
F is a volVectorField and function of f
k is a scalar

How can I solve this in openFoam? Is it like this?

fvScalarMatrix feqn

solve feqn;


Bernhard March 19, 2011 15:05

Did you try it like this? You can just compile your solver, which then gives you at an error at solve feqn; Afaik it should be solve(feqn); or feqn.solve().

alberto March 20, 2011 15:26

I think you have to write the divergence term as:

fvm::div(F1, f)

where F = F1*f


michaelsmit March 23, 2011 10:25

Thank you for your replies!

"solve feqn" should be "feqn.solve()" of course, you are right :).

But actually I don't get to solve anything yet. I'm still stuck at the div part. I tried fvm::div(F1,f), but I get the error

no matching function for call to ‘div(Foam::volVectorField&, Foam::volScalarField&)’

Should it maybe be fvc::div?

alberto March 24, 2011 06:35

Sorry, I missed the fact F was a volVectorField. If you can assume F lagged, you can use fvc::div(F), which discretises it explicitly.

All times are GMT -4. The time now is 17:28.