CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

compilation problem with "fvPatch::lookupPatchField"

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 3 Post By Ya_Squall2010

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 23, 2010, 10:41
Default compilation problem with "fvPatch::lookupPatchField"
  #1
Member
 
YS
Join Date: Jan 2010
Posts: 96
Rep Power: 16
Ya_Squall2010 is on a distinguished road
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!!!
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 is offline   Reply With Quote

Old   May 24, 2010, 07:57
Default
  #2
Member
 
YS
Join Date: Jan 2010
Posts: 96
Rep Power: 16
Ya_Squall2010 is on a distinguished road
forgot to say that I'm using OF 1.6. The compiling passes without errors if I remove the red part.
Ya_Squall2010 is offline   Reply With Quote

Old   May 25, 2010, 06:28
Default
  #3
Member
 
YS
Join Date: Jan 2010
Posts: 96
Rep Power: 16
Ya_Squall2010 is on a distinguished road
problem solved.
Ya_Squall2010 is offline   Reply With Quote

Old   May 25, 2010, 09:48
Default
  #4
New Member
 
Misha Marie Gregersen
Join Date: Nov 2009
Posts: 7
Rep Power: 17
Misha is on a distinguished road
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?
Misha is offline   Reply With Quote

Old   May 25, 2010, 10:29
Default
  #5
Member
 
YS
Join Date: Jan 2010
Posts: 96
Rep Power: 16
Ya_Squall2010 is on a distinguished road
Quote:
Originally Posted by Misha View Post
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.
jherb, randolph and TeddyL like this.
Ya_Squall2010 is offline   Reply With Quote

Old   October 20, 2014, 13:06
Default
  #6
New Member
 
Join Date: Oct 2014
Posts: 2
Rep Power: 0
Swcfd is on a distinguished road
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 is offline   Reply With Quote

Old   October 23, 2014, 06:16
Default
  #7
New Member
 
Join Date: Oct 2014
Posts: 2
Rep Power: 0
Swcfd is on a distinguished road
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?
Swcfd is offline   Reply With Quote

Old   October 27, 2014, 11:24
Default
  #8
New Member
 
Song
Join Date: Nov 2011
Posts: 12
Rep Power: 15
songwukong is on a distinguished road
you'd better give more information.:)
songwukong is offline   Reply With Quote

Old   June 19, 2021, 10:51
Default
  #9
New Member
 
Outside US and Canada
Join Date: Apr 2020
Posts: 11
Rep Power: 6
Rabeyia Manzoor Illahi is on a distinguished road
Can you please tell how did you include this file?
Rabeyia Manzoor Illahi is offline   Reply With Quote

Old   November 15, 2021, 23:01
Default
  #10
New Member
 
Zhang Qibo
Join Date: Oct 2021
Posts: 7
Rep Power: 5
Gareth_CN is on a distinguished road
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
Gareth_CN is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF compilation problem on Linux System Nitin Pathak Fluent UDF and Scheme Programming 6 September 29, 2018 21:26
[Commercial meshers] Handling cyclic BC from gambit to openfoam for a cascade airfoil problem - OF 1.6 maverick OpenFOAM Meshing & Mesh Conversion 2 June 18, 2011 05:36
Velocity profiles problem behind the elbow (3D problem) kabat73 FLUENT 8 May 9, 2010 05:26
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 20:13
Is this problem well posed? Thomas P. Abraham Main CFD Forum 5 September 8, 1999 15:52


All times are GMT -4. The time now is 00:52.