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

error in operator& use

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   November 26, 2014, 10:30
Default error in operator& use
  #1
New Member
 
Bharat Bhushan Sharma
Join Date: Nov 2014
Posts: 8
Rep Power: 2
bharat.gmail is on a distinguished road
Dear All Foamers,

I am bit new to openfoam programming and have been working on writing a solver based on existing solver. But I am getting following error. Can you tell me what is the problem. Actually same piece of code works very well in other solvers but in my code, while compiling I get error's mentioned below.

CODE:
Code:
surfaceScalarField phiUf("phiUf",(fvc::interpolate(phiU,"phiU")) & mesh.Sf());

//- phiH

surfaceScalarField phiH("phiH", (fsf*Kf*(ROL-ROV)*hlg*g/nuv) & mesh.Sf());
ERROR'S:
Code:
updateSbProperties.H:95:51: error: no match for ‘operator&’ in ‘Foam::fvc::interpolate(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&) [with Type = double]((* & Foam::word(((const char*)"phiU"), 1))) & mesh.Foam::fvMesh::Sf()’
updateSbProperties.H:95:51: note: candidates are:
/opt/openfoam230/src/OpenFOAM/lnInclude/wordI.H:167:19: note: Foam::word Foam::operator&(const Foam::word&, const Foam::word&)
/opt/openfoam230/src/OpenFOAM/lnInclude/wordI.H:167:19: note:   no known conversion for argument 1 from ‘Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >’ to ‘const Foam::word&’
/opt/openfoam230/src/OpenFOAM/lnInclude/FieldFunctions.C:774:1: note: template<class Type1, class Type2> Foam::tmp<Foam::Field<typename Foam::innerProduct<Type1, Type2>::type> > Foam::operator&(const Foam::UList<T>&, const Foam::UList<StringType>&)
/opt/openfoam230/src/OpenFOAM/lnInclude/FieldFunctions.C:774:1: note: template<class Type1, class Type2> Foam::tmp<Foam::Field<typename Foam::innerProduct<Type1, Type2>::type> > Foam::operator&(const Foam::UList<T>&, const Foam::tmp<Foam::Field<Type2> >&)
/opt/openfoam230/src/OpenFOAM/lnInclude/FieldFunctions.C:774:1: note: template<class Type1, class Type2> Foam::tmp<Foam::Field<typename Foam::innerProduct<Type1, Type2>::type> > Foam::operator&(const Foam::tmp<Foam::Field<Type> >&, const Foam::UList<StringType>&)
/opt/openfoam230/src/OpenFOAM/lnInclude/FieldFunctions.C:774:1: note: template<class Type1, class Type2> Foam::tmp<Foam::Field<typename Foam::innerProduct<Type1, Type2>::type> > Foam::operator&(const Foam::tmp<Foam::Field<Type> >&, const Foam::tmp<Foam::Field<Type2> >&)
You can see that this code for getting phi is standard and is giving no error in original solver but I dont understand why I am getting these mismatch error's for operator&.

Please tell me how to sort it out.

Thanks & Regards,

Bharat Bhushan Sharma

Last edited by wyldckat; December 6, 2014 at 06:49. Reason: Added [CODE][/CODE]
bharat.gmail is offline   Reply With Quote

Old   November 26, 2014, 10:43
Default
  #2
Member
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 30
Rep Power: 3
floquation is on a distinguished road
What OF version are you using?

I'm not an expert, but judging from the error and judging from a search on "fvc::interpolate" (in OF-2.3.x), I can't help but notice that your interpolate has two arguments, whereas the search results always (I went through the first 40 results) have one argument.

So change
Code:
surfaceScalarField phiUf("phiUf",(fvc::interpolate(phiU,"phiU")) & mesh.Sf());
to
Code:
surfaceScalarField phiUf("phiUf",(fvc::interpolate(phiU)) & mesh.Sf());
and see if that works.
floquation is offline   Reply With Quote

Old   November 26, 2014, 18:58
Default
  #3
New Member
 
Bharat Bhushan Sharma
Join Date: Nov 2014
Posts: 8
Rep Power: 2
bharat.gmail is on a distinguished road
Quote:
Originally Posted by floquation View Post
What OF version are you using?

I'm not an expert, but judging from the error and judging from a search on "fvc::interpolate" (in OF-2.3.x), I can't help but notice that your interpolate has two arguments, whereas the search results always (I went through the first 40 results) have one argument.

So change
Code:
surfaceScalarField phiUf("phiUf",(fvc::interpolate(phiU,"phiU")) & mesh.Sf());
to
Code:
surfaceScalarField phiUf("phiUf",(fvc::interpolate(phiU)) & mesh.Sf());
and see if that works.


.

I tried your suggestion but same errors came again. I think it has some thing to do with the datatype of return value of fvc::interpolate(phiU). Thanks for your reply. ANd mine is version 2.3.0-OF.
Please somebody suggest me what I have to do to remove this error.

Thanks & Regards,

BHarat Bhushan Sharma
bharat.gmail is offline   Reply With Quote

Old   December 6, 2014, 06:53
Default
  #4
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,251
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings to all!

@Bharat Bhushan Sharma: The problem is that you're trying to interpolate a surface scalar field, which isn't a standard interpolation in OpenFOAM. As detailed here: https://github.com/wyldckat/reconstr...te-fields/wiki
Quote:
More specifically, it will interpolate the fields that exist in the cell centres onto the face centres. This operation is only done for the following field interpolations:
  • Interpolate volScalarField to surfaceScalarField.
  • Interpolate volVectorField to surfaceVectorField.
Best regards,
Bruno
wyldckat is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On



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