CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   help needed with fvc::div() (

johanna August 31, 2009 03:54

help needed with fvc::div()
I have tried to do an equation that is solved using fvScalarMatrix. One of the terms in this equation is (Ua+Ub)div(kab),
where Ua and Ub are volVectorField and kab is volScalarField and also the unknown of this equation.

I have tried to do this term by using the following
(Ua+Ub) & fvc::div(kab) in the fvScalarMatrix.

I also tried to do this fvc::div(kab) outside the ScalarMatrix to see if it works that way. I get an error message.
"createFields.H:332: error: no matching function for call to 'div(Foam::volScalarField&)' "

Could someone help me and tell me what I'm doing wrong? I don't have a lot of experience with OpenFoam yet.
There are similar equations in my code, that work just fine, but in those the divergence term is normal.


niklas August 31, 2009 04:36

divergence of a scalar!!!
The error message cant be much clearer.

divergence works on vectors...returns a scalar.
grad works on scalars....returns a vector

johanna August 31, 2009 07:12


I have been laughing at myself here when I read your reply.


All times are GMT -4. The time now is 05:06.