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/)
-   -   How to use the X coordinate in OpenFOAM (http://www.cfd-online.com/Forums/openfoam-programming-development/109340-how-use-x-coordinate-openfoam.html)

yzf1215 November 15, 2012 09:27

How to use the X coordinate in OpenFOAM
 
I need to use the X coordinate of mesh points to calculate other parameter. How can I read it in source files.

Lieven November 15, 2012 09:54

const volScalarField& xCoord = mesh.C().component(vector::X);

should do the trick.

yzf1215 November 15, 2012 10:23

Quote:

Originally Posted by Lieven (Post 392272)
const volScalarField& xCoord = mesh.C().component(vector::X);

should do the trick.

So, if I want to use scalar, I can just replace vector by scalar?


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