/*************************************************************************/ /* UDF for inlet conditions, CFD project "Wind flow through tree canopy" */ /*************************************************************************/ #include "udf.h" /*************************************************************************/ /* Constants used by the UDFs */ #define alpha 0.22 #define zb 9.0 #define Ub 5.6 /*************************************************************************/ /* Velocity profile */ DEFINE_PROFILE(u_pro, thread, position) { real x[ND_ND],z; face_t f; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); z = x[1]; F_PROFILE(f,thread,position) = Ub*pow((z/zb),alpha); } end_f_loop(f, thread) } /*************************************************************************/ /* Turbulent dissipation rate profile */ DEFINE_PROFILE(eps_pro, thread, position) { real x[ND_ND],z; face_t f; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); z = x[1]; F_PROFILE(f,thread,position) = 0.906*alpha*(Ub/zb)*pow((z/zb),(alpha-1)); } end_f_loop(f, thread) } /*************************************************************************/