CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   what happened to pointVolInterpolation? (http://www.cfd-online.com/Forums/openfoam-programming-development/88479-what-happened-pointvolinterpolation.html)

oskarb May 18, 2011 08:35

what happened to pointVolInterpolation?
 
How can I interpolate a pointScalarField to a volScalarField?

The forum thread http://www.cfd-online.com/Forums/ope...alarfield.html and http://openfoamwiki.net/index.php/PointVolInterpolation say that the pointVolInterpolation class can be used.

But I can't find pointVolInterpolation in OpenFoam 1.6.

Oskar

oskarb May 19, 2011 05:49

As there seems to be no reply on this issue, I think I will mark pointVolInterpolation as broken for versions newer than 1.5 in http://openfoamwiki.net/index.php/Op...%28OpenFOAM%29 and http://openfoamwiki.net/index.php/Op...lInterpolation. Any objections?

I do appreciate recommendations how to replace the pointVolInterpolation functionality.

thx
Oskar

hjasak May 19, 2011 18:43

Works beautifully in 1.6-ext.

Hrv

Goab June 1, 2012 15:43

How does it work?
 
Good Morning Dr. Jasak

I know it's been a while since you answered this thread, however since you've used pointVolInterpolation I'm sure you can help me.

I've been reading thoroughly pointVolInterpolation.H, pointVolInterpolation.C and pointVolInterpolate.C and, unfortunately I'm still unable to use the function. Possibly is a silly mistake due to my lack of knowledge but still is giving me a hard time.

What I'm trying to do is to interpolate a volVectorField to points, change the values with simple arithmetic and interpolate them back to a volVectorField (whether the same or a different one).

What I have this far is:
Code:


pointField alphaP = interpVolPoint.interpolate(alpha);
point& pt = alphaP[pointI]

forAll(alphaP, pointI)       
{           
    double px=3.0*pt.x()+15;           
    double py=2.0pt.y()+16;           
    double pz=pt.z()+14;       
}
pointField pt = pointVolInterpolation interpPointVol (mesh);
beta = interpPointVol.interpolate(pt);

Whenever I try with this code it gives me an error, apparently it was not the right definition or use.

In an attempt to make it work, I wrote:

Code:

const pointMesh pMesh(mesh);   
const volMesh vMesh(mesh);
pointField betaP (mesh.points());

pointVolInterpolation pointToVol (pMesh,mesh);

**beta=pointToVol.interpolate(betaP);

And it seem so recognize waht I'm trynig to do, I mean, it compiles, however when I add the last line (**), it gives me an error:

Code:


no matching function for call to ‘Foam::pointVolInterpolation::interpolate(Foam::pointField&)’
simpleRBCFoam.C:180:30: note: candidates are:
pointVolInterpolation.H:142:14: note: template<class Type> void Foam::pointVolInterpolation::interpolate(const Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh>&, Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) const
pointVolInterpolation.H:151:59: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::pointVolInterpolation::interpolate(const Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh>&) const
pointVolInterpolation.H:159:59: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::pointVolInterpolation::interpolate(const Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh> >&) const
make: *** [Make/linux64GccDPOpt/simpleRBCFoam.o] Error 1

I'm really sorry about bothering you with this old threat, I'm sure you have more challenging projects at hand, however, since I started to work on this field I've seen your name on many, (fantastic, by the way) articles and research, as a result, I'm sure that if there's someone who can help me is you.

Thank you very much.

Jorge.

bigphil June 5, 2012 08:49

Quote:

Originally Posted by Goab (Post 364357)
What I'm trying to do is to interpolate a volVectorField to points, change the values with simple arithmetic and interpolate them back to a volVectorField (whether the same or a different one).

Hi Jorge,

pointVolInterpolation interpolates values from mesh points to mesh cell centres.

I think you should use volPointInterpolation which interpolates from cell centres to points.
You can use volPointInterpolation like this:
Code:

    // Create point mesh                                                                                                                                     
    pointMesh pMesh(mesh);

    // Create point interpolation                                                                                                                           
    volPointInterpolation pointInterpolation(mesh);

    pointVectorField pointField
      (
      IOobject
      (
        "pointDU",
        runTime.timeName(),
        mesh
        ),
      pMesh,
      dimensionedVector("zero", dimLength, vector::zero)
      );

    // Calculate mesh points displacement                                                                                                                   
    pointInterpolation.interpolate(volField, pointField);


Best regards,
Philip

Goab June 5, 2012 09:11

Fantastic
 
Hello Philip,

Thank you so much for you reply, I was getting worried.

Regarding volPointInterpolation, I agree with you, that was the first part of my problem and I had it almost solved, of course, what you sent me will help me to enhance my solution, however, my real problem is with pointVolInterpolation, as you said, to interpolate mesh points to mesh cells.

Hope you know and can help me.

Regards,
Jorge

Arnoldinho September 8, 2012 17:56

Hi Jorge,

I ran into the same trouble when trying to interpolate from point to volume values. As your last post is rather old, you might already have found the solution. If not, here we go:

Your "betaP" is defined as a pointField, but is has to be a pointScalarField or pointVectorField, defined in the way already described by bigphil. Then you can use it in the same way as the volume->point interpolation - although I had to use a "temporary" copy field as the solver otherwise complained about incompatible meshes.

The following snippet interpolates vol->points and back points->vol.
Code:

scalarField gP = interpolateVolToPoints.interpolate(gammaM);
gammaP.internalField() = gP;
gammaM = interpolatePointsToVol.interpolate(gammaP);

Greetings,
Arne

Fanfei November 20, 2014 10:53

Quote:

Originally Posted by bigphil (Post 364825)
Hi Jorge,

pointVolInterpolation interpolates values from mesh points to mesh cell centres.

I think you should use volPointInterpolation which interpolates from cell centres to points.
You can use volPointInterpolation like this:
Code:

    // Create point mesh                                                                                                                                     
    pointMesh pMesh(mesh);

    // Create point interpolation                                                                                                                           
    volPointInterpolation pointInterpolation(mesh);

    pointVectorField pointField
      (
      IOobject
      (
        "pointDU",
        runTime.timeName(),
        mesh
        ),
      pMesh,
      dimensionedVector("zero", dimLength, vector::zero)
      );

    // Calculate mesh points displacement                                                                                                                   
    pointInterpolation.interpolate(volField, pointField);


Best regards,
Philip

Hi Philip:
I want to interpolated from face to point . when i create point mesh with
pointMesh pMesh(mesh);
the error occured as below:
pFoam.C:141:31: error: variable ‘const Foam::pointMesh pMesh’ has initializer but incomplete type
const pointMesh pMesh(mesh);
what's the matter with it?

Best regards
Fan Fei

bigphil November 24, 2014 05:28

Hi Fan Fei,

You must include the pointMesh.H header file at the top of your solver in order to use it:
Code:

#include "fvCFD.H"

// put it here
#include "pointMesh.H"

However, volPointInterpolation interpolates from cell centres to points; it does not interpolate from faces to points.
You may have to write your own interpolator.

Philip

Fanfei November 24, 2014 05:45

Quote:

Originally Posted by bigphil (Post 520759)
Hi Fan Fei,

You must include the pointMesh.H header file at the top of your solver in order to use it:
Code:

#include "fvCFD.H"

// put it here
#include "pointMesh.H"

However, volPointInterpolation interpolates from cell centres to points; it does not interpolate from faces to points.
You may have to write your own interpolator.

Philip

Hi Philip
Thank you for your reply, this problem has been solved now. I use primitivePatchInterpolation for interpolated from face to point. As i set pointScalarFiled. There're some errors as
/home/administrator/foam/foam-extend-3.1/src/foam/lnInclude/GeometricField.H: In constructor ‘Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensioned<Type>&, const Foam::word&) [with Type = Foam::Vector<double>; PatchField = Foam::pointPatchField; GeoMesh = Foam::pointMesh; Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::pointMesh]’:
/home/administrator/foam/foam-extend-3.1/src/foam/lnInclude/GeometricField.H:304:73: error: incomplete type ‘Foam::pointPatchField<Foam::Vector<double> >’ used in nested name specifier
const word& patchFieldType=PatchField<Type>::calculatedType()
^
pFoam.C:154:5: note: when instantiating default argument for call to Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensioned<Type>&, const Foam::word&) [with Type = Foam::Vector<double>; PatchField = Foam::pointPatchField; GeoMesh = Foam::pointMesh; Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::pointMesh]
);
^
Is it lack of the pointFields.H, or some another mistake? [/SIZE]

Best regards
Fan Fei

bigphil November 24, 2014 05:59

Hi Fan Fei,

Can you post your code segment that does not compile and then post the compilation error, please.

Also be careful of the format of your post; you can use
Code:

... code here ...
to helps make things readable, as outlined here.

Philip

Fanfei November 24, 2014 07:16

Quote:

Originally Posted by bigphil (Post 520770)
Hi Fan Fei,

Can you post your code segment that does not compile and then post the compilation error, please.

Also be careful of the format of your post; you can use
Code:

... code here ...
to helps make things readable, as outlined here.

Philip

Hi Philip:
Code
----------------------------------
pointMesh pMesh(mesh);
pointVectorField pointField
(
IOobject
(
"wallpoint",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
pMesh,
dimensionedVector("q_bed",sqr(dimLength)/sqr(dimTime),vector::zero)
);
-----------------------------------------------------
the error is too long, it's about 502KB, and it can't be upload.
----------------------------------
GeometricField.H: In constructor ‘Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensioned<Type>&, const Foam::word&) [with Type = Foam::Vector<double>; PatchField = Foam::pointPatchField; GeoMesh = Foam::pointMesh; Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::pointMesh]’
GeometricField.H:304:73: error: incomplete type ‘Foam::pointPatchField<Foam::Vector<double> >’ used in nested name specifier
const word& patchFieldType=PatchField<Type>::calculatedType()
-------------------------------------------------------------

Best regards
FanFei

Fanfei November 26, 2014 05:06

Quote:

Originally Posted by Fanfei (Post 520788)
Hi Philip:
Code
----------------------------------
pointMesh pMesh(mesh);
pointVectorField pointField
(
IOobject
(
"wallpoint",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
pMesh,
dimensionedVector("q_bed",sqr(dimLength)/sqr(dimTime),vector::zero)
);
-----------------------------------------------------
the error is too long, it's about 502KB, and it can't be upload.
----------------------------------
GeometricField.H: In constructor ‘Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensioned<Type>&, const Foam::word&) [with Type = Foam::Vector<double>; PatchField = Foam::pointPatchField; GeoMesh = Foam::pointMesh; Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::pointMesh]’
GeometricField.H:304:73: error: incomplete type ‘Foam::pointPatchField<Foam::Vector<double> >’ used in nested name specifier
const word& patchFieldType=PatchField<Type>::calculatedType()
-------------------------------------------------------------

Best regards
FanFei

Hi Fomers:
The problem has solved now. it's need to added the # include "pointFields.H" after the # include "fvCFD.H".

Best Regards
Fanfei


All times are GMT -4. The time now is 14:55.