CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   finiteArea mapToSurface (https://www.cfd-online.com/Forums/openfoam-programming-development/198932-finitearea-maptosurface.html)

Andrew.Coughtrie February 20, 2018 12:59

finiteArea mapToSurface
 
Hi Everyone,

Does anyone have any experience using the finiteArea mapToSurface function in OpenFoam 1712?

I was expecting the following to work (as was the case in foam-extend 4.0):

Us.internalField() = vsm.mapToSurface(U.boundaryField());

It doesn't compile complaining that about no matching function call, below is what i'm giving it and what it's expecting and I can see the difference (I think) I just can't work out what I'm doing incorrectly.

The error:
Code:

no matching function for call to ‘Foam::volSurfaceMapping::mapToSurface(const Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::Boundary&)’
        Us.internalField() = vsm.mapToSurface(U.boundaryField());


Code:

candidate: template<class Type> Foam::tmp<Foam::Field<Type> > Foam::volSurfaceMapping::mapToSurface(const typename Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>::Boundary&) const
        tmp<Field<Type>> mapToSurface

Anyone got any suggestions please?

Thanks,

Andy

akabat March 5, 2018 08:21

Hello Andrew,

try:

Us.primitiveFieldRef() = vsm.mapToSurface<vector>(U.boundaryField());

Regards
Alex

Andrew.Coughtrie March 5, 2018 08:37

Thanks Alex,

That works, though I'm curious as to why it is that way and if it was intentional (the mapToVolume function has no such complexities and works the same way as in foam-extend).

Any ideas?

Andrew

akabat March 6, 2018 03:26

Hello Andrew,

the template definition of the function has changed. Maybe due to the use of the field ref mechanism the type information can not directly be provided to the function call and the new call was the least intrusive modification when porting the fa functionality from the ext version.

Regards
Alex

Andrew.Coughtrie March 6, 2018 04:31

Makes sense, could possibly do with this info on how to use in the comments since there are no places where it is used at the moment for reference.

Andrew


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