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

No matching function for call to "FOAM::GeometricField<double, FOAM::fvPatchField, >"

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 14, 2021, 03:52
Default No matching function for call to "FOAM::GeometricField<double, FOAM::fvPatchField, >"
  #1
New Member
 
Teresa Sun
Join Date: Jun 2021
Posts: 21
Rep Power: 5
Teresa Sun is on a distinguished road
Dear Foamers,
This issues happen while building a new eddy viscosity model which is based on Smagorinsky model.


Error messages

Code:
../turbulenceModels/lnInclude/QR.C:91:10: error: no matching function for call to ‘Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField()’
   91 |          0;
      |          ^
In file included from /software/software/OpenFOAM/v2006-foss-2020a/OpenFOAM-v2006/src/OpenFOAM/lnInclude/GeometricField.H:792,
                 from /software/software/OpenFOAM/v2006-foss-2020a/OpenFOAM-v2006/src/OpenFOAM/lnInclude/GeometricScalarField.H:40,
                 from /software/software/OpenFOAM/v2006-foss-2020a/OpenFOAM-v2006/src/OpenFOAM/lnInclude/GeometricFields.H:40,
                 from /software/software/OpenFOAM/v2006-foss-2020a/OpenFOAM-v2006/src/finiteVolume/lnInclude/volFields.H:39,
                 from /software/software/OpenFOAM/v2006-foss-2020a/OpenFOAM-v2006/src/finiteVolume/lnInclude/nearWallDist.H:41,
                 from ../turbulenceModels/lnInclude/turbulenceModel.H:49,
                 from ../turbulenceModels/lnInclude/TurbulenceModel.H:40,
                 from lnInclude/IncompressibleTurbulenceModel.H:42,
                 from turbulentTransportModels/turbulentTransportModels.H:28,
                 from turbulentTransportModels/turbulentTransportModels.C:28:


The modified codes are
Code:
// * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //

template<class BasicTurbulenceModel>		
tmp<volScalarField> QR<BasicTurbulenceModel>::k 
(			
    const tmp<volTensorField>& gradU		
) const
{                                             
      volSymmTensorField  D(symm(gradU));       
      volScalarField      q1(dimensionedScalar("q1", dimensionSet(0, 0, -2, 0, 0, 0, 0), 1e-5));   
//    volScalarField      k1(dimensionedScalar("k1", dimensionSet(0, 0, -1, 0, 0, 0, 0), 0));   
      volScalarField      r(max(-det(D),dimensionedScalar("r1", dimensionSet(0, 0, -3, 0, 0, 0, 0), 0)));
      volScalarField      q((1.0/2.0)*(dev(D) && D));
	


//     if ( q <= (dimensionedScalar("q1", dimensionSet(0, 0, -2, 0, 0, 0, 0), 1e-6)))   
     if ( q <= q1 )  
     {         
     return tmp<volScalarField>
     (
        new volScalarField
        (
        	IOobject
        	(
        	    IOobject::groupName("k", this->alphaRhoPhi_.group()),
        	    this->runTime_.timeName(),
        	    this->mesh_
        	),
//              dimensionedScalar ("k",dimensionSet(0, 0, -1, 0, 0, 0, 0), 0);
//        	this->k = k1;
        	0;
        )      
      );
      }	
      return tmp<volScalarField>
      (
	new volScalarField
	(
		IOobject
		(
			IOobject::groupName("k", this->alphaRhoPhi_.group()),
			this->runTime_.timeName(),
			this->mesh_
		),
		mag(r)/q;
	)
      );	
}
, in which the uncommand lines were several attempts which didn't work.

Any pointer would be great appreciated!

Teresa
Teresa Sun is offline   Reply With Quote

Old   December 14, 2021, 13:10
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Teresa Sun View Post
Code:
../turbulenceModels/lnInclude/QR.C:91:10: error: no matching function for call to ‘Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField()’
   91 |          0;
      |          ^


...
     return tmp<volScalarField>
     (
        new volScalarField
        (
            IOobject
            (
                IOobject::groupName("k", this->alphaRhoPhi_.group()),
                this->runTime_.timeName(),
                this->mesh_
            ),
//              dimensionedScalar ("k",dimensionSet(0, 0, -1, 0, 0, 0, 0), 0);
//            this->k = k1;
            0;
        )      
      );

That's the problem when you stare at code too long. You have an ';' in your creation of

tmp<volScalarField>. The flood of compiler errors doesn't really help with finding it.
olesen is offline   Reply With Quote

Old   December 14, 2021, 13:17
Default
  #3
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
[QUOTE=Teresa Sun;818460]
Code:
      return tmp<volScalarField>
      (
    new volScalarField
    (
        IOobject
        (
            IOobject::groupName("k", this->alphaRhoPhi_.group()),
            this->runTime_.timeName(),
            this->mesh_
        ),
        mag(r)/q;
    )
      );

For that type of code it can be a bit clearer if you use the forwarding factory method instead. Eg,


Code:
return tmp<volScalarField>::New
(
    IOobject
    (
        IOobject::groupName("k", this->alphaRhoPhi_.group()),
        this->runTime_.timeName(),
        this->mesh_
    ),
    mag(r)/q
);
This saves one level of brackets and indentation. I think it makes the code more readable. Also if you don't need to register the field, you can also use volScalarField::New directly (various different forms of that one) to save some typing.
olesen is offline   Reply With Quote

Old   December 16, 2021, 09:44
Default
  #4
New Member
 
Teresa Sun
Join Date: Jun 2021
Posts: 21
Rep Power: 5
Teresa Sun is on a distinguished road
Hi Mark,
thanks for your correction and will change the layout later. The mistake was way too straightforward.
But after correcting the issue is as same as before. Is that because something went wrong about the conversion between dimensioedScalar and volScalarField?

The is issue
Quote:
../turbulenceModels/lnInclude/QR.C:51:25: error: no matching function for call to ‘Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject, Foam::volScalarField&, Foam::dimensionedScalar)’
51 | volScalarField q1
| ^~
In file included from /software/software/OpenFOAM/v2006-foss-2020a/OpenFOAM-v2006/src/OpenFOAM/lnInclude/GeometricField.H:792,
from /software/software/OpenFOAM/v2006-foss-2020a/OpenFOAM-v2006/src/OpenFOAM/lnInclude/GeometricScalarField.H:40,
from /software/software/OpenFOAM/v2006-foss-2020a/OpenFOAM-v2006/src/OpenFOAM/lnInclude/GeometricFields.H:40,
from /software/software/OpenFOAM/v2006-foss-2020a/OpenFOAM-v2006/src/finiteVolume/lnInclude/volFields.H:39,
from /software/software/OpenFOAM/v2006-foss-2020a/OpenFOAM-v2006/src/finiteVolume/lnInclude/nearWallDist.H:41,
from ../turbulenceModels/lnInclude/turbulenceModel.H:49,
from ../turbulenceModels/lnInclude/TurbulenceModel.H:40,
from lnInclude/IncompressibleTurbulenceModel.H:42,
from turbulentTransportModels/turbulentTransportModels.H:28,
from turbulentTransportModels/turbulentTransportModels.C:28:
/software/software/OpenFOAM/v2006-foss-2020a/OpenFOAM-v2006/src/OpenFOAM/lnInclude/GeometricField.C:695:1: note: candidate: ‘Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&, const wordList&, const wordList&) [with Type = double; PatchField = Foam::fvPatchField; GeoMesh = Foam::volMesh; Foam::wordList = Foam::List<Foam::word>]’
695 | Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
The new codes are
Quote:
volScalarField q1
(
IOobject
(
"q1",
this->runTime_.timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
q1,
dimensionedScalar(dimensionSet(0, 0, -2, 0, 0, 0, 0), 1e-5)
);

volScalarField r(max(-det(D),dimensionedScalar("r1", dimensionSet(0, 0, -3, 0, 0, 0, 0), 0)));
volScalarField q((1.0/2.0)*dev(D) && D);


if ( q <= q1 )
{
return 0;
}

return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
IOobject::groupName("k", this->alphaRhoPhi_.group()),
this->runTime_.timeName(),
this->mesh_
),
mag(r)/q
)
);
Teresa Sun is offline   Reply With Quote

Old   December 16, 2021, 10:58
Default
  #5
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Teresa Sun View Post
Hi Mark,
thanks for your correction and will change the layout later. The mistake was way too straightforward.
But after correcting the issue is as same as before. Is that because something went wrong about the conversion between dimensioedScalar and volScalarField?

Not really the problem. At this point you really need to check how the fields are defined, which arguments are expected etc. Either in the header or here: https://www.openfoam.com/documentati...d.html#details


See which constructors are available and pick the one that you think you are using. In your current case you will notice that you are trying something, but not really sure what.
olesen is offline   Reply With Quote

Reply

Tags
dimensionedscalar, eddy viscosity model, les, volscalarfield


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
[Other] refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 2 November 11, 2021 12:04
Elementwise multiplication operator johndeas OpenFOAM Running, Solving & CFD 3 March 9, 2019 14:03
[blockMesh] Errors during blockMesh meshing Madeleine P. Vincent OpenFOAM Meshing & Mesh Conversion 51 May 30, 2016 11:51
Running UDF with Supercomputer roi247 FLUENT 4 October 15, 2015 14:41
A stupid question luckyluke OpenFOAM Running, Solving & CFD 14 August 13, 2007 05:25


All times are GMT -4. The time now is 15:43.