CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   OpenFOAM class declaration error with volScalarField (https://www.cfd-online.com/Forums/openfoam-programming-development/217974-openfoam-class-declaration-error-volscalarfield.html)

raunakbardia June 2, 2019 15:46

OpenFOAM class declaration error with volScalarField
 
3 Attachment(s)
Hi everyone,

I am currently using OpenFOAM v1706.

I am trying to declare a class with the internal field of a volScalarField object and a volVectorField object. During class instantiation, I simply want them to be initialized with a uniform zero value. Even though I have copied the constructors used in other OpenFOAM libraries, I am not able to make them work.

Here is the code definition for the volScalarField object.

In .H file, the variable is defined as:

Code:

volScalarField::Internal alphaSource_;
Class instantiation in the .C file uses the following code:
Code:

    alphaSource_
    (   
        IOobject
        (   
          "alphaSource",
            mesh_.time().timeName(),
            mesh_
        ), 
        mesh_,
        dimensionedScalar("zero", dimVol, 0)
    )

I have attached the error log, but I believe the main error is the following:
Quote:

In file included from /usr/local/openfoam/v1706/OpenFOAM-v1706/src/finiteVolume/lnInclude/fvMesh.H:58:0,
from phaseChangeAdvection.H:57,
from phaseChangeAdvection.C:29:
/usr/local/openfoam/v1706/OpenFOAM-v1706/src/OpenFOAM/lnInclude/DimensionedField.H: In instantiation of ‘class Foam::DimensionedField<double, Foam::volMesh>’:
/usr/local/openfoam/v1706/OpenFOAM-v1706/src/OpenFOAM/lnInclude/GeometricField.H:81:7: required from ‘class Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>’
phaseChangeAdvection.H:110:23: required from here
/usr/local/openfoam/v1706/OpenFOAM-v1706/src/OpenFOAM/lnInclude/DimensionedField.H:84:40: error: invalid use of incomplete type ‘class Foam::volMesh’
typedef typename GeoMesh::Mesh Mesh;

Any help would be much appreciated. I have always come across some or the other error in instantiating a volScalarField object in a class but every time I have used a workaround. Don't want to keep ignoring this forever.


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