|
[Sponsors] |
Atmosperic boundary layer velocity profile udf for a 3D CFD Domain |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 23, 2019, 01:18 |
Atmosperic boundary layer velocity profile udf for a 3D CFD Domain
|
#1 |
New Member
Lookman
Join Date: Sep 2017
Posts: 11
Rep Power: 9 |
I have to run a flow over a complex terrain x,z,y ( y behind the height of the domain)=( 11.6km*8.9km*3km). I am using K-epsilon realizable with a standard wall function. I have a first cell height of 0.004 m( is I physically meaningful because I use this value to get a yplus >30 et <300)
I have been asked to use an atmospheric boundary layer of 500m height on the zy plane as inlet velocity. Below are the modified code I wrote. I would like to ask if something can comment on my code: #include "udf.h" DEFINE_PROFILE(log_velocity,thread,index) { real y[ND_ND]; real x,z; face_t f; begin_f_loop(f,thread) { F_CENTROID(x,f,thread); if y <= 500 y = x[1]; z = x[2]; F_PROFILE(f,thread,index) = 6.5*log(y/0.01)/log(10/0.01); //Note here to express [3*log(x/0.01)/log(10/0.01)] in terms of (x,z); please get the //correct equation. if y > 500 & y <= 3000 F_PROFILE(f,thread,index) = 10; } end_f_loop(f,thread) } |
|
March 27, 2019, 00:30 |
|
#2 |
New Member
Lookman
Join Date: Sep 2017
Posts: 11
Rep Power: 9 |
#include "udf.h"
DEFINE_PROFILE(log_velocity,thread,index) { real x[ND_ND]; real y,z; face_t f; begin_f_loop(f,thread) { F_CENTROID(x,f,thread); y = x[1]; z = x[2]; if (y <= 500){ F_PROFILE(f,thread,index) = 6.5*log(y/0.01)/log(10/0.01)}; if (y > 500 & y <= 3000){ F_PROFILE(f,thread,index) = 10}; } end_f_loop(f,thread) } I modified it a bit, Can someone help comment |
|
April 2, 2019, 22:43 |
|
#3 |
New Member
Lookman
Join Date: Sep 2017
Posts: 11
Rep Power: 9 |
I got this error "C:/Users/PINGWE~1/AppData/Local/Temp/profile1.c.6252.0.c:15: macro `THREAD_T0' used with too many (2) args
C:/Users/PINGWE~1/AppData/Local/Temp/profile1.c.7840.1.c:15: macro `THREAD_T0' used with too many (2) args C:/Users/PINGWE~1/AppData/Local/Temp/profile1.c.8496.2.c:15: macro `THREAD_T0' used with too many (2) args C:/Users/PINGWE~1/AppData/Local/Temp/profile1.c.6336.3.c:15: macro `THREAD_T0' used with too many (2) args C:/Users/PINGWE~1/AppData/Local/Temp/profile1.c.3040.4.c:15: macro `THREAD_T0' used with too many (2) args C:/Users/PINGWE~1/AppData/Local/Temp/profile1.c.10688.5.c:15: macro `THREAD_T0' used with too many (2) args C:/Users/PINGWE~1/AppData/Local/Temp/profile1.c.2772.6.c:15: macro `THREAD_T0' used with too many (2) args C:/Users/PINGWE~1/AppData/Local/Temp/profile1.c.10760.7.c:15: macro `THREAD_T0' used with too many (2) args C:/Users/PINGWE~1/AppData/Local/Temp/profile1.c.12868.8.c:15: macro `THREAD_T0' used with too many (2) args C:/Users/PINGWE~1/AppData/Local/Temp/profile1.c.14184.9.c:15: macro `THREAD_T0' used with too many (2) args C:/Users/PINGWE~1/AppData/Local/Temp/profile1.c.1712.10.c:15: macro `THREAD_T0' used with too many (2) args C:/Users/PINGWE~1/AppData/Local/Temp/profile1.c.9068.11.c:15: macro `THREAD_T0' used with too many (2) args C:/Users/PINGWE~1/AppData/Local/Temp/profile1.c.6000.12.c:15: macro `THREAD_T0' used with too many (2) args C:/Users/PINGWE~1/AppData/Local/Temp/profile1.c.5636.13.c:15: macro `THREAD_T0' used with too many (2) args C:/Users/PINGWE~1/AppData/Local/Temp/profile1.c.15428.14.c:15: macro `THREAD_T0' used with too many (2) args" I modified my udf to this form #include "udf.h" DEFINE_PROFILE(log_velocity,thread,index) { real x[ND_ND]; real y,z; face_t f; cell_t c; Thread *tc; begin_f_loop(f,thread) { F_CENTROID(x,f,thread); y = x[1]; z = x[2]; c = F_C0(f,thread); tc = THREAD_T0(f,thread); y = C_WALL_DIST(c,tc); F_PROFILE(f,thread,index) =3*log(y/0.01)/log((10)/0.01); } end_f_loop(f,thread) |
|
April 3, 2019, 02:00 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Code:
F_C0(f,t) but THREAD_T0(t)) Code:
c = F_C0(f,thread); tc = THREAD_T0(f,thread); why do you use Code:
y = x[1]; and y = C_WALL_DIST(c,tc); best regards |
|
April 3, 2019, 02:40 |
|
#5 |
New Member
Lookman
Join Date: Sep 2017
Posts: 11
Rep Power: 9 |
Thank you AlexanderZ for the reply.
In fact, I am trying to define a boundary condition on the face( log velocity). In the velocity component, I only want a x velocity component. Also, since I am using a RANS K-omega SST, I want the velocity profile to start from the first cell height. I don't have a lot of experience with UDF so I found a example and I tried to modify it to suit my need. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Centrifugal fan | j0hnny | CFX | 13 | October 1, 2019 14:55 |
Periodic Pressure drop | cfd_begin | CFX | 10 | May 25, 2017 08:09 |
Monte Carlo Simulation: H-Energy is not convergating & high Incident Radiation | volleyHC | CFX | 5 | April 3, 2016 06:41 |
Floating point exception: Zero divide | liladhar | CFX | 11 | December 16, 2013 05:07 |
Convective Heat Transfer - Heat Exchanger | Mark | CFX | 6 | November 15, 2004 16:55 |