CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   How to get the local coordinate Z via UDF or other way in Fluent (https://www.cfd-online.com/Forums/fluent-udf/157022-how-get-local-coordinate-z-via-udf-other-way-fluent.html)

JoaoSilva July 17, 2015 08:33

How to get the local coordinate Z via UDF or other way in Fluent
 
Hello everyone,

I am trying to simulate the wind flow over a terrain where I need to define the turbulent viscosity via UDF as function of height above the ground.
The problem is that the following UDF give the absolute coordinate z (over the plan z=0) rather than local coordinate (over the ground surface):

#include "udf.h"
#define L -86
#define Ustar 0.4

DEFINE_TURBULENT_VISCOSITY(user_mu_t,c,t)
{
real x[ND_ND];
real mu_t, z;
C_CENTROID(x,c,t);
z=x[2];
mu_t=0.41*Ustar*z/pow((1-16*z/L),-0.25);
return mu_t;
}

I don't know how I can get the height of the terrain (h) for each iteration at the same x and y position that a given cell centroid along the domain given by C_CENTROID(x,c,t). With that I would intend subtract h from z to get the local coordinate z.
This could not the unique way to get local coordinate z, but I don't know another one.

I would appreciate any suggestion to solve this problem.


All times are GMT -4. The time now is 15:14.