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/)
-   -   pointVolInterpolation, How to use it? (http://www.cfd-online.com/Forums/openfoam-programming-development/102648-pointvolinterpolation-how-use.html)

Goab May 30, 2012 15:46

pointVolInterpolation, How to use it?
 
Hello Foamers,

Possibly this is well known but I'm having a hard time making it work.

I've been searching throughout the forum and I've seen that apparently pointVolInterpolation works correctly ( what happened to pointVolInterpolation?) I already found it and I've been reading the code, however I haven't been able to use it.

I'm using simpleFoam and what I want to do is to take a volVectorField, get its points using volPointInterpolation and change them by multiplying them by a factor and adding some constants to each component (x,y,z), and finally, after that get again a volVectorField using those values.

What I have so far is:

Code:

volVectorField alpha
    (
        IOobject
        (
            "alpha",
            runTime.timeName(),
            mesh,
            IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        ),
        mesh
    );

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

forAll(P, pointI)
        {
            double px=3.0*pt.x()+15;
            double py=2.0pt.y()+16;
            double pz=pt.z()+14;
        }

volVectorField beta
    (
        IOobject
        (
            "beta",
            runTime.timeName(),
            mesh,
            IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        ),
        mesh
    );

pointField pt = pointVolInterpolation interpPointVol (mesh);
beta = interpPointVol.interpolate(pt);

When I use volPointInterpolation, even when I change the values, it works perfectly, however when I try to create again the volVectorField out of those values, it crashes.

Hope you can help me.

Thank you.


All times are GMT -4. The time now is 08:11.