CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Wall distance in BC (

Sylvain June 14, 2011 04:19

Wall distance in BC
Hi everybody,

I'm trying to design a boundary condition which prescribes the velocity and other scalars in function of the distance from the ground instead of the z coordinate.
To do so, I planned to use the wallDist function included inside wallDist.H

But if you use this function you need to define the mesh variable, included inside createMesh.H, which requires the runtime variable include in createtime.H, which requires itself variables included in setRootCase.H, which requires the argc and argv variables that I can hardly find.

I didn't found any example of BC which uses the wallDist function, and then I wonder if this function defined in the fvmesh class can be used for the fvPatchfield class. More, I'm surprised that there is no BC which is based on the distance to the wall, so I guess that it is maybe more tricky than it appears…

Thus I have two questions: first, is it possible to use walldist.H for a boundary condition, and if yes how? Second, is there any other way to calculate the wall distance to prescribe a BC?

Thanks ahead for any comments


julien.decharentenay June 14, 2011 19:54


I was thinking of doing something similar, but has not found the time to even start to investigate (and my knowledge of OpenFOAM is still limited).

My avenue of exploration were:
1) Look at the wall distance calculation in the domain and recover it on the boundary face (using a zero gradient approximation);
2) Alternatively, try to calculate the wall distance on the face itself (on the 2d approximation).

I would really appreciate if you can keep me updated on your progress (and I will do so if I get to it).


All times are GMT -4. The time now is 17:40.