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

fvmLaplacianUncorrected

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By deepsterblue
  • 1 Post By deepsterblue

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 18, 2021, 13:23
Default fvmLaplacianUncorrected
  #1
New Member
 
Join Date: May 2019
Posts: 6
Rep Power: 7
ecles is on a distinguished road
Hello!

I have been trying to become acquainted with OpenFOAM code. Nonetheless I got stuck in one thing.

In gaussLaplacianScheme.C, we have the following line of code in fvmLaplacian routine:

tmp<fvMatrix<Type>> tfvm = fvmLaplacianUncorrected
(
SfGammaSn,
this->tsnGradScheme_().deltaCoeffs(vf),
vf
);


The object of the second parameter passed should belong to a surfaceScalarField class:

template<class Type, class GType>
tmp<fvMatrix<Type>>
gaussLaplacianScheme<Type, GType>::fvmLaplacianUncorrected
(
const surfaceScalarField& gammaMagSf,
const surfaceScalarField& deltaCoeffs,
const GeometricField<Type, fvPatchField, volMesh>& vf
)


Nonetheless, deltaCoeffs(vf), a pure virtual function declared in snGradScheme.H, is set to return a tmp pointer.

virtual tmp<surfaceScalarField> deltaCoeffs
(
const GeometricField<Type, fvPatchField, volMesh>&
) const = 0;



Should it not be returned as a surfaceScalarField object? What am I missing here? Is there any implicit conversion taking place?

Thank you!
ecles is offline   Reply With Quote

Old   June 20, 2021, 10:57
Default
  #2
Senior Member
 
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 403
Rep Power: 25
deepsterblue will become famous soon enough
The GeometricField class (from which surfaceScalarField is defined) has a constructor that operates on a tmp object. The tmp class also has a const dereference operator overload, which implicitly converts a tmp object to a const reference (check tmp.H). All of this allows tmp objects to be implicitly convertible to the underlying GeometricField, while including reference counting capabilities.
ecles likes this.
__________________
Sandeep Menon
University of Massachusetts Amherst
https://github.com/smenon
deepsterblue is offline   Reply With Quote

Old   July 13, 2021, 22:29
Default
  #3
New Member
 
Join Date: May 2019
Posts: 6
Rep Power: 7
ecles is on a distinguished road
Just to be sure I understood, is the implicit conversion implemented in this routine?

template<class T>
inline Foam::tmp<T>::operator const T&() const
{
return operator()();
}
ecles is offline   Reply With Quote

Old   July 14, 2021, 10:22
Default
  #4
Senior Member
 
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 403
Rep Power: 25
deepsterblue will become famous soon enough
Yup - that's the one.
ecles likes this.
__________________
Sandeep Menon
University of Massachusetts Amherst
https://github.com/smenon
deepsterblue is offline   Reply With Quote

Reply

Tags
fvm::laplacian, laplacianscheme


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



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