CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Definition of a variable in a class (

u396852 September 25, 2012 02:54

Definition of a variable in a class
2 Attachment(s)
I am trying to define a variable in a following class.

Foam::viscosityModels::EllisLaw::calcNu() const

dimensionedScalar current_time(U_.time());

const volScalarField& old_visc = U_.mesh().lookupObject<volScalarField>("visco_old" );


I want a variable AB which is "old_visc*strain_rate()".

I tried all the definitions for AB. (double, volScalarField etc)
but in all cases it gives compilation error for the definition.
The C++ file and the error message image is attached with the thread.
Please respond if any one has some comments on it.

Thanks and regards,

Bernhard September 25, 2012 03:19

Please put ALL (or at least the first few) the error messages in your post. It is a bit difficult to read from the screenshot. Also, what is the return type of the function strainRate()? Is it volSymmTensorField? I would assume the type of a volScalarField*volSymmTensorField to be again volSymmTensorField?

u396852 September 25, 2012 04:07

1 Attachment(s)
Thanks Bernhard for such a quich response.

The function strain_rate() returns "mag(fvc::grad(U_))".

I am attaching the full output of the command "wmake libso" in the error.txt file. Please let me know if you need any further information.

Thnaks and regards,

Bernhard September 26, 2012 04:50

You're calling the function strain_rate(), but in the code it is called strainRate(), where is strainRate() defined exactly, and how? Also, I see an error message in line 89 of EllisLaw.C, but that line appears to be commented. And, why did you define AB and BC as const?

All times are GMT -4. The time now is 12:03.