CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   In pointPatchField, how to read coordinate values of mesh (https://www.cfd-online.com/Forums/openfoam/146085-pointpatchfield-how-read-coordinate-values-mesh.html)

nbyjn December 18, 2014 08:40

In pointPatchField, how to read coordinate values of mesh
 
Hello foamers:
I want to write a new boundary based on oscillatingDisplacementPointPatchField. I want to give this boundary different values based on the mesh's coordinate values. Not a single value of the patch's coordinate, I mean different values on different girds. In this field, I can't use mesh.C() because "mesh" is not defined.
Do you have any idea? Thank you!

JNSN December 18, 2014 11:03

This may work
Code:

const polyMesh& mesh = this->dimensionedInternalField().mesh()();

nbyjn December 19, 2014 05:51

Quote:

Originally Posted by JNSN (Post 524543)
This may work
Code:

const polyMesh& mesh = this->dimensionedInternalField().mesh()();

Thank you for your quick reply!
But I think polyMesh only contains patch/face information, you can't get mesh coordinates from this.

kmooney December 19, 2014 15:44

I'm a little confused. Are you trying to, from a boundary condition, access the point positions of boundary mesh?

nbyjn December 19, 2014 23:52

Quote:

Originally Posted by kmooney (Post 524726)
I'm a little confused. Are you trying to, from a boundary condition, access the point positions of boundary mesh?

Yes, that's my point! Please forgive my poor English.
Do you have any ideas?
Thank you!

kmooney December 20, 2014 13:21

Try this from within updateCoeffs()

[CODE]
const pointPatch& ptPatch = this->patch();
pointField myPoints = ptPatch.localPoints();
[/CODE

I hope that helps!

We actually have a pretty thorough discussion of this type of boundary condition in The OpenFOAM Technology Primer:
http://www.sourceflux.de/book/

I urge you to consider picking up a copy!

Cheers,
Kyle


All times are GMT -4. The time now is 05:50.