obtaining wall distance for UDF
Hi all,
I need to calculate the distance from wall in my UDF. Apparently C_WALL_DIST(c,t) is no longer available and I cannot use it in my UDF. Does anybody know any other solution? Or if fluent has replaced it with some other kind of Macro? Thanks, Ali |
Moving post to the fluent forum. Please ensure you post on the right forum in future.
|
Hi,
which version of Fluent are you using ? I am using C_WALL_DIST for v14.5 and v16, it works. Write your UDF here if you want. Fanch |
Hi,
I am using Fluent v 16.2 and it does not work there. |
Maybe you can try like this :
C_UDMI(c,t,0) = C_STORAGE_R(c,t,SV_WALL_DIST) It is strange as in the headers file of v16.2, in the mem.h file, C_WALL_DIST is defined : #define C_WALL_DIST(c,t) C_STORAGE_R(c,t,SV_WALL_DIST) Fanch |
Do you use #include "mem.h" at the beginning of your UDF code ?
Fanch |
Fanch,
Yes, I have included "mem.h" file. I tried what you recommended but I received a segmentation error. C_UDMI(c,t,0) = C_STORAGE_R(c,t,SV_WALL_DIST) I have defined a UDM, so that would not be the problem. Are you sure that C_WALL_DIST is defined in mem.h? How can I see the content of that? is there anyway that I can see the content of that header file? Thanks, Ali |
If Fluent is installed on your local computer, you can go to this directory :
C:\Program Files\ANSYS Inc\v162\fluent\fluent16.2.0\src et you have all the headers file, with the definitions of all functions. I only use C_WALL_DIST in DEFINE_ON_DEMAND macro. I don't understand why it is not working for you :/ I can show you my code if you want, maybe it comes from the loop you are using or something else Fanch |
Unfortunately I cannot access those files since I run fluent from a remote machine and I do not have admin privileges.
That would be great if you can do it. I can compare it with my own code and I will post my code in the next post for you to see. thanks, Ali |
#include "udf.h"
#include "mem.h" #include "math.h" #include "dll.h" /* do not think it is useful in this case */ DEFINE_ON_DEMAND(y_plus) { #if RP_NODE Domain *d; Thread *t; cell_t c; face_t f; d= Get_Domain(1); if (! Data_Valid_P()) return; thread_loop_c(t,d) { begin_c_loop(c,t) { C_UDMI(c,t,1) = C_WALL_DIST(c,t); } end_c_loop(c,t) } #endif } |
Fanch,
I receive segmentation error whenever I use C_WALL_DIST. I even replicated the same code that you have posted here in another UDF and received the same error. I double-checked everything like UDMs and UDSs and everything seems to be fine. It successfully is compiled but if I hook it to fluent, I will receive the error. I will post my UDF here in the next post for you to see. |
In this function I have to use wall distance macro to find F2 and this is where the segmentation error is produced.
real F2(cell_t c, Thread *t){ real c1,c2,d1; c1=2*sqrt(C_UDSI(c,t,k))/(betastar*C_UDSI(c,t,w)*C_WALL_DIST(c,t)); c2=500*C_MU_L(c,t)/C_R(c,t)/(pow(C_WALL_DIST(c,t),2)*C_UDSI(c,t,w)); d1= MAX(c1,c2); return tanh(d1*d1); } If I replace the C_WALL_DIST(c,t) with some constant value the error will go away. |
Fanch,
did you try my code? |
I asked a UDF specialist and he said this macro (C_WALL_DIST) is still available and it just has to be filled first.
Unfortunately I cannot ask him anymore. Does anybody know what does that mean? |
All times are GMT -4. The time now is 18:06. |