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

Problem calculating grad(U) while adding a source term

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 26, 2022, 16:19
Default Problem calculating grad(U) while adding a source term
  #1
New Member
 
Dimas
Join Date: Oct 2021
Posts: 5
Rep Power: 5
dimasbarile is on a distinguished road
Hi everyone! Im trying to compile a source term which uses grad(U) for the force calculation in OpenFOAM 2.4.0. For some reason the following line does not work:


Code:
volTensorField gradU = fvc::grad(U);
I saw several posts where this line is valid but when i try to compile the following error appears:


Code:
error: no matching function for call to ‘grad(const vectorField&)’
 volTensorField gradU = fvc::grad(U);
                                   ^
In file included from /home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcGrad.H:124:0,
                 from /home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvc.H:49,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_SourceTemplates.C:61,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.H:374,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.C:58:
/home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcGrad.C:51:1: note: candidate: template<class Type> Foam::tmp<Foam::GeometricField<typename Foam::outerProduct<Foam::Vector<double>, Type>::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::grad(const Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>&)
 grad
 ^
/home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcGrad.C:51:1: note:   template argument deduction/substitution failed:
In file included from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.H:374:0,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.C:58:
sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_SourceTemplates.C:439:35: note:   ‘const vectorField {aka const Foam::Field<Foam::Vector<double> >}’ is not derived from ‘const Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>’
 volTensorField gradU = fvc::grad(U);
                                   ^
In file included from /home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcGrad.H:124:0,
                 from /home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvc.H:49,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_SourceTemplates.C:61,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.H:374,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.C:58:
/home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcGrad.C:68:1: note: candidate: template<class Type> Foam::tmp<Foam::GeometricField<typename Foam::outerProduct<Foam::Vector<double>, Type>::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::grad(const Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >&)
 grad
 ^
/home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcGrad.C:68:1: note:   template argument deduction/substitution failed:
In file included from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.H:374:0,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.C:58:
sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_SourceTemplates.C:439:35: note:   ‘const vectorField {aka const Foam::Field<Foam::Vector<double> >}’ is not derived from ‘const Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >’
 volTensorField gradU = fvc::grad(U);
                                   ^
In file included from /home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcGrad.H:124:0,
                 from /home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvc.H:49,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_SourceTemplates.C:61,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.H:374,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.C:58:
/home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcGrad.C:91:1: note: candidate: template<class Type> Foam::tmp<Foam::GeometricField<typename Foam::outerProduct<Foam::Vector<double>, Type>::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::grad(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
 grad
 ^
/home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcGrad.C:91:1: note:   template argument deduction/substitution failed:
In file included from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.H:374:0,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.C:58:
sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_SourceTemplates.C:439:35: note:   ‘const vectorField {aka const Foam::Field<Foam::Vector<double> >}’ is not derived from ‘const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>’
 volTensorField gradU = fvc::grad(U);
                                   ^
In file included from /home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcGrad.H:124:0,
                 from /home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvc.H:49,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_SourceTemplates.C:61,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.H:374,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.C:58:
/home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcGrad.C:113:1: note: candidate: template<class Type> Foam::tmp<Foam::GeometricField<typename Foam::outerProduct<Foam::Vector<double>, Type>::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::grad(const Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >&, const Foam::word&)
 grad
 ^
/home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcGrad.C:113:1: note:   template argument deduction/substitution failed:
In file included from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.H:374:0,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.C:58:
sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_SourceTemplates.C:439:35: note:   ‘const vectorField {aka const Foam::Field<Foam::Vector<double> >}’ is not derived from ‘const Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >’
 volTensorField gradU = fvc::grad(U);
                                   ^
In file included from /home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcGrad.H:124:0,
                 from /home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvc.H:49,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_SourceTemplates.C:61,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.H:374,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.C:58:
/home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcGrad.C:142:1: note: candidate: template<class Type> Foam::tmp<Foam::GeometricField<typename Foam::outerProduct<Foam::Vector<double>, Type>::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::grad(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
 grad
 ^
/home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcGrad.C:142:1: note:   template argument deduction/substitution failed:
In file included from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.H:374:0,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.C:58:
sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_SourceTemplates.C:439:35: note:   ‘const vectorField {aka const Foam::Field<Foam::Vector<double> >}’ is not derived from ‘const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>’
 volTensorField gradU = fvc::grad(U);
                                   ^
In file included from /home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcGrad.H:124:0,
                 from /home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvc.H:49,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_SourceTemplates.C:61,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.H:374,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.C:58:
/home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcGrad.C:159:1: note: candidate: template<class Type> Foam::tmp<Foam::GeometricField<typename Foam::outerProduct<Foam::Vector<double>, Type>::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::grad(const Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >&)
 grad
 ^
/home/dbarile/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude/fvcGrad.C:159:1: note:   template argument deduction/substitution failed:
In file included from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.H:374:0,
                 from sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_Source.C:58:
sources/derived/actuationDiskV10b_calib_Source/actuationDiskV10b_calib_SourceTemplates.C:439:35: note:   ‘const vectorField {aka const Foam::Field<Foam::Vector<double> >}’ is not derived from ‘const Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >’
 volTensorField gradU = fvc::grad(U);
dimasbarile is offline   Reply With Quote

Old   October 6, 2022, 00:47
Default
  #2
Member
 
Tatsuya Shimizu
Join Date: Jul 2012
Posts: 42
Rep Power: 14
LongGe is on a distinguished road
Hi

The error occurs because the "U" used in your code is a vectorField.


NOTE: How to convert vectorField to volVectorField
How to convert vectorField to volVectorField

NOTE: difference volVectorField and vectorField
difference volVectorField and vectorField
__________________
Our Work: https://www.idaj.co.jp/product/ennovacfd/openfoam_gui/
Powered by Ennova : https://ennova-cfd.com/
Ennova's Channel Partners : http://www.wolfdynamics.com/
LongGe is offline   Reply With Quote

Old   October 12, 2022, 17:00
Default
  #3
New Member
 
Dimas
Join Date: Oct 2021
Posts: 5
Rep Power: 5
dimasbarile is on a distinguished road
Quote:
Originally Posted by LongGe View Post
Hi

The error occurs because the "U" used in your code is a vectorField.


NOTE: How to convert vectorField to volVectorField
How to convert vectorField to volVectorField

NOTE: difference volVectorField and vectorField
difference volVectorField and vectorField

Thank you very much LongGe! Now it's working fine
dimasbarile is offline   Reply With Quote

Reply

Tags
grad u, no matching function, source term


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
Problem with coded source term for multiphaseEulerFoam shuji_type97 OpenFOAM Running, Solving & CFD 2 July 22, 2022 02:37
SU2-7.0.1 on ubuntu 18.04 hyunko SU2 Installation 7 March 16, 2020 05:37
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 10:07
[foam-extend.org] problem when installing foam-extend-1.6 Thomas pan OpenFOAM Installation 7 September 9, 2015 22:53
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 14:59


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