# Replicating Scalable Wall Function with a UDF

 Register Blogs Members List Search Today's Posts Mark Forums Read

 August 4, 2017, 02:30 Replicating Scalable Wall Function with a UDF #1 New Member   Yousef Join Date: Dec 2015 Posts: 14 Rep Power: 10 Hi, I am having trouble replicating the Scalable Wall Function in Fluent using a UDF. The theory seems straightforward: basically the Standard Wall Function implemented a minimum limit on y* > 11.225. My starting point is the standard WF UDF provided in the Fluent UDF manual, which I have verified to be an accurate implementation of the SWF in Fluent code (for ks = 0). The next step where I am having trouble is implementing the y* limiter to achieve the Scalable Wall Function. I am using an If condition to impose a lower limit of 11.225 on the terms F_STORAGE_R(f,t,SV_WALL_YPLUS) and yPlus (i.e. y*) as shown in the UDF below. The problem is that this does not seem sufficient to replicate the results from the Scalable WF in Fluent (more details below code). Code: ```#include "udf.h" DEFINE_WALL_FUNCTIONS(scalable, f, t, c0, t0, wf_ret, yPlus, Emod) { real wf_value; //Limiters for Scalable wall function if(F_STORAGE_R(f,t,SV_WALL_YPLUS) < 11.225) F_STORAGE_R(f,t,SV_WALL_YPLUS) = 11.225; if(yPlus < 11.225) yPlus = 11.225; //standard wall function (Zero roughness) switch (wf_ret) { case UPLUS_LAM: wf_value = yPlus; break; case UPLUS_TRB: wf_value = log(Emod*yPlus)/KAPPA; break; case DUPLUS_LAM: wf_value = 1.0; break; case DUPLUS_TRB: wf_value = 1./(KAPPA*yPlus); break; case D2UPLUS_TRB: wf_value = -1./(KAPPA*yPlus*yPlus); break; default: printf("Wall function return value unavailable\n"); } return wf_value; }``` The UDF is tested with with a mesh of y+ well below 11.225. In the "Viscous Model" window in Fluent, the "UDF - y+" is set to 0 to prevent triggering the laminar equations (UPLUS_LAM and DUPLUS_LAM) in the UDF. Comparing flow variables at the wall from the above UDF with the Scalable WF in Fluent, Ystar (y*) is identical for both cases. This is expected as it is manually limited to 11.225. However, Yplus (y+) is significantly lower in the UDF compared to scalable WF (approx 11.3). The variation in y+ is very odd considering that the wall shear (tau-w) and consequently wall shear velocity (u-tau) are almost identical from the UDF and scalable WF. My understanding is that the wall functions first and foremost calculate the wall shear, and then based on the that the other flow variables are calculated. Considering the equation y+ = (rho/mu)*u-tau*Yp, it seems the only way to account for the differences in y+ is by altering the first cell centroid height Yp? Any thoughts or comments are greatly appreciated. Thanks.