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/)
-   -   compilation problem with "fvPatch::lookupPatchField" (https://www.cfd-online.com/Forums/openfoam-programming-development/76351-compilation-problem-fvpatch-lookuppatchfield.html)

Ya_Squall2010 May 23, 2010 09:41

compilation problem with "fvPatch::lookupPatchField"
 
Hi,

I experienced a weired problem when compiling a self-made BC, which is basically a hybrid of fixedvalues and mixed(inletoutlet). The problem comes from the invoking of function 'lookupPatchField' in my implementation of virtual function : updateCoeffs, as highlighted as follows:

template<class Type>
void regularWaveMakerVectorFixedValueFvPatchField<Type> ::updateCoeffs()
{
if (this->updated())
{
return;
}

const fvsPatchField<scalar>& phip = this->patch().lookupPatchField
(
"phi",
reinterpret_cast<const surfaceScalarField*>(0),
reinterpret_cast<const scalar*>(0)
);


this->valueFraction() = 1.0 - pos(phip);

// the rest code is irrelevant here...
... ...
}

But I copied the code exactly the same from the inletOutletFvPatchField.C file. Please advise what's going wrong here, many thanks!!!:confused:
The error msg are as follows:

/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/DimensionedField.H: At global scope:
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/DimensionedField.H: In instantiation of ‘Foam:: DimensionedField<double, Foam::surfaceMesh>’:
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/pointFieldsFwd.H:53: instantiated from ‘Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>’
fields/fvPatchFields/derived/regularWaveMakerScalarFixedValue/regularWaveMakerScalarFixedValueFvPatchField.C:653 : instantiated from ‘void Foam::regularWaveMakerScalarFixedValueFvPatchField <Type>::updateCoeffs() [with Type = double]’
fields/fvPatchFields/derived/regularWaveMakerScalarFixedValue/regularWaveMakerScalarFixedValueFvPatchField.C:248 : instantiated from ‘Foam::regularWaveMakerScalarFixedValueFvPatchFiel d<Type>::regularWaveMakerScalarFixedValueFvPatchFi eld(const Foam::fvPatch&, const Foam:: DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with Type = double]’
lnInclude/fvPatchField.H:143: instantiated from ‘static Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::adddictionaryConstructor ToTable<fvPatchFieldType>::New(const Foam::fvPatch&, const Foam:: DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with fvPatchFieldType = Foam::regularWaveMakerScalarFixedValueFvPatchField <double>, Type = double]’
lnInclude/fvPatchField.H:154: instantiated from ‘Foam::fvPatchField<Type>::adddictionaryConstructo rToTable<fvPatchFieldType>::adddictionaryConstruct orToTable(const Foam::word&) [with fvPatchFieldType = Foam::regularWaveMakerScalarFixedValueFvPatchField <double>, Type = double]’
fields/fvPatchFields/derived/regularWaveMakerScalarFixedValue/regularWaveMakerScalarFixedValueFvPatchFields.C:38 : instantiated from here
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/DimensionedField.H:83: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/DimensionedField.H:92: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/DimensionedField.C:58: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/DimensionedField.C:86: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/DimensionedField.C:101: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/DimensionedFieldIO.C:59: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/DimensionedFieldI.H:44: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.H: In instantiation of ‘Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>’:
fields/fvPatchFields/derived/regularWaveMakerScalarFixedValue/regularWaveMakerScalarFixedValueFvPatchField.C:653 : instantiated from ‘void Foam::regularWaveMakerScalarFixedValueFvPatchField <Type>::updateCoeffs() [with Type = double]’
fields/fvPatchFields/derived/regularWaveMakerScalarFixedValue/regularWaveMakerScalarFixedValueFvPatchField.C:248 : instantiated from ‘Foam::regularWaveMakerScalarFixedValueFvPatchFiel d<Type>::regularWaveMakerScalarFixedValueFvPatchFi eld(const Foam::fvPatch&, const Foam:: DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with Type = double]’
lnInclude/fvPatchField.H:143: instantiated from ‘static Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::adddictionaryConstructor ToTable<fvPatchFieldType>::New(const Foam::fvPatch&, const Foam:: DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with fvPatchFieldType = Foam::regularWaveMakerScalarFixedValueFvPatchField <double>, Type = double]’
lnInclude/fvPatchField.H:154: instantiated from ‘Foam::fvPatchField<Type>::adddictionaryConstructo rToTable<fvPatchFieldType>::adddictionaryConstruct orToTable(const Foam::word&) [with fvPatchFieldType = Foam::regularWaveMakerScalarFixedValueFvPatchField <double>, Type = double]’
fields/fvPatchFields/derived/regularWaveMakerScalarFixedValue/regularWaveMakerScalarFixedValueFvPatchFields.C:38 : instantiated from here
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.H:98: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.H:99: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.H: In instantiation of ‘Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>::GeometricBoundaryField’:
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.H:238: instantiated from ‘Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>’
fields/fvPatchFields/derived/regularWaveMakerScalarFixedValue/regularWaveMakerScalarFixedValueFvPatchField.C:653 : instantiated from ‘void Foam::regularWaveMakerScalarFixedValueFvPatchField <Type>::updateCoeffs() [with Type = double]’
fields/fvPatchFields/derived/regularWaveMakerScalarFixedValue/regularWaveMakerScalarFixedValueFvPatchField.C:248 : instantiated from ‘Foam::regularWaveMakerScalarFixedValueFvPatchFiel d<Type>::regularWaveMakerScalarFixedValueFvPatchFi eld(const Foam::fvPatch&, const Foam:: DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with Type = double]’
lnInclude/fvPatchField.H:143: instantiated from ‘static Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::adddictionaryConstructor ToTable<fvPatchFieldType>::New(const Foam::fvPatch&, const Foam:: DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with fvPatchFieldType = Foam::regularWaveMakerScalarFixedValueFvPatchField <double>, Type = double]’
lnInclude/fvPatchField.H:154: instantiated from ‘Foam::fvPatchField<Type>::adddictionaryConstructo rToTable<fvPatchFieldType>::adddictionaryConstruct orToTable(const Foam::word&) [with fvPatchFieldType = Foam::regularWaveMakerScalarFixedValueFvPatchField <double>, Type = double]’
fields/fvPatchFields/derived/regularWaveMakerScalarFixedValue/regularWaveMakerScalarFixedValueFvPatchFields.C:38 : instantiated from here
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.H:113: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricBoundaryField.C:40: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricBoundaryField.C:77: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricBoundaryField.C:129: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricBoundaryField.C:212: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C: In instantiation of ‘Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>’:
fields/fvPatchFields/derived/regularWaveMakerScalarFixedValue/regularWaveMakerScalarFixedValueFvPatchField.C:653 : instantiated from ‘void Foam::regularWaveMakerScalarFixedValueFvPatchField <Type>::updateCoeffs() [with Type = double]’
fields/fvPatchFields/derived/regularWaveMakerScalarFixedValue/regularWaveMakerScalarFixedValueFvPatchField.C:248 : instantiated from ‘Foam::regularWaveMakerScalarFixedValueFvPatchFiel d<Type>::regularWaveMakerScalarFixedValueFvPatchFi eld(const Foam::fvPatch&, const Foam:: DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with Type = double]’
lnInclude/fvPatchField.H:143: instantiated from ‘static Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::adddictionaryConstructor ToTable<fvPatchFieldType>::New(const Foam::fvPatch&, const Foam:: DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with fvPatchFieldType = Foam::regularWaveMakerScalarFixedValueFvPatchField <double>, Type = double]’
lnInclude/fvPatchField.H:154: instantiated from ‘Foam::fvPatchField<Type>::adddictionaryConstructo rToTable<fvPatchFieldType>::adddictionaryConstruct orToTable(const Foam::word&) [with fvPatchFieldType = Foam::regularWaveMakerScalarFixedValueFvPatchField <double>, Type = double]’
fields/fvPatchFields/derived/regularWaveMakerScalarFixedValue/regularWaveMakerScalarFixedValueFvPatchFields.C:38 : instantiated from here
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:193: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:223: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:250: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:279: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:309: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:333: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
/home/ys/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/GeometricField.C:374: error: invalid use of incomplete type ‘struct Foam::surfaceMesh’
lnInclude/surfaceFieldsFwd.H:47: error: forward declaration of ‘struct Foam::surfaceMesh’
make: *** [Make/linux64GccDPOpt/regularWaveMakerScalarFixedValueFvPatchFields.o] error 1

Ya_Squall2010 May 24, 2010 06:57

forgot to say that I'm using OF 1.6. The compiling passes without errors if I remove the red part.

Ya_Squall2010 May 25, 2010 05:28

problem solved.

Misha May 25, 2010 08:48

Hi, I am having the exact same problem with the compilation of an equivalent boundary condition. Could you please tell me what solved your problem?

Ya_Squall2010 May 25, 2010 09:29

Quote:

Originally Posted by Misha (Post 260152)
Hi, I am having the exact same problem with the compilation of an equivalent boundary condition. Could you please tell me what solved your problem?

check you Fields.C file and make sure to include relevant header files. In my case, I just forgot to include the "surfaceFields.H" file.

Swcfd October 20, 2014 12:06

Dear all,

I have a similar problem. I want to modify the boundary conditions for scalarTransportFoam. I took the fixedValueFvPatchField.C and added a function updateCoeffs(); in this function i wrote

const scalarField& PField = patch().lookupPatchField<volScalarField, scalar>("p")

The problem is, that i can't compile it. The compiler said, that he has a problem with patch(). (the entire text of error is following).
Does anybody have an idea? My OF version is 2.3.0.

Swcfd October 23, 2014 05:16

So here is the complete error:

error: there are no arguments to 'patch' that depend on a template parameter, so a declaration of 'patch' must be available

Why I have to declare patch()? I thought it is declared.
Can anybody help?

songwukong October 27, 2014 10:24

you'd better give more information.:)

Rabeyia Manzoor Illahi June 19, 2021 09:51

Can you please tell how did you include this file?

Gareth_CN November 15, 2021 22:01

Hello,

I am doing a similar work to build a new BC, which is basically a hybrid of fixedvalues and mixed(inletoutlet). The Compilation has been successful but I get the error message as belows when I run "decomposePar" on a test case based on pimpleFoam:

Code:

--> FOAM FATAL ERROR:
    request for surfaceScalarField phi from objectRegistry region0 failed
    available objects of type surfaceScalarField are 0()

    From function const Type& Foam::objectRegistry::lookupObject(const Foam::word&) const [with Type = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>] in file /home/gareth/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 211.

Have you ever encountered similar problems? I would appreciate it if you could give me some suggestions based on your experience.

Best wishes

Gareth


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