CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Random Access To Arbitrary Points In Solution Domain (http://www.cfd-online.com/Forums/openfoam/60892-random-access-arbitrary-points-solution-domain.html)

marhamat November 8, 2007 07:16

Hi everybody I want to acce
 
Hi everybody

I want to access to given points in the solution domain randomly.

Do OpenFOAM have useful libraries or functions for this goal?

If not,How i can do that?
Ideas are welcome. (-:

With kind regards
Marhamat

gschaider November 8, 2007 10:20

Hi Marhamat! I want to acce
 
Hi Marhamat!

Quote:

I want to access to given points in the solution domain randomly.
Could you be a bit more precise? I guess what you wanted to say is: "I want to access the value of a field at one (or more) points in space". If that is so and you are satisfied with cell values (=no interpolation) and you have the point stored in the variable pt you might do it like this:

lable cellID=mesh.findCell(pt);
if(cellID>=0) {
Info << "Value: " << T[cellID] << endl;
} else {
Info << pt << " is outside" << endl;
}

Bernhard

marhamat November 8, 2007 17:11

Thanks alot Bernhard Clearl
 
Thanks alot Bernhard

Clearly the coordinate of grids in some limited points is important for me.
But i want to access these points randomly and in different time steps.
For example in a channel that it's dimensions are(8 4 4)m , with (100*60*60)grids I want to find the coordinate of 100 points that limited in (2<x<4;1<y<2;1<z<2).
And this stochatic access be reptatable in different time steps.

Regards
Marhamat

gschaider November 8, 2007 18:43

Hi Marhamat! Look in the Do
 
Hi Marhamat!

Look in the Doxygen for the Random-class. Use that to construct your points. Then apply the above recipie.

Bernhard


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