|
[Sponsors] |
February 21, 2017, 18:13 |
obtaining wall distance for UDF
|
#1 |
Senior Member
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17 |
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 |
|
February 21, 2017, 22:58 |
|
#2 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,728
Rep Power: 143 |
Moving post to the fluent forum. Please ensure you post on the right forum in future.
|
|
February 23, 2017, 08:59 |
|
#3 |
Member
Join Date: Feb 2015
Posts: 32
Rep Power: 11 |
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 |
|
February 23, 2017, 10:46 |
|
#4 |
Senior Member
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17 |
Hi,
I am using Fluent v 16.2 and it does not work there. |
|
February 23, 2017, 11:08 |
|
#5 |
Member
Join Date: Feb 2015
Posts: 32
Rep Power: 11 |
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 |
|
February 23, 2017, 11:09 |
|
#6 |
Member
Join Date: Feb 2015
Posts: 32
Rep Power: 11 |
Do you use #include "mem.h" at the beginning of your UDF code ?
Fanch |
|
February 23, 2017, 11:25 |
|
#7 |
Senior Member
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17 |
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 |
|
February 23, 2017, 11:30 |
|
#8 |
Member
Join Date: Feb 2015
Posts: 32
Rep Power: 11 |
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 |
|
February 23, 2017, 11:33 |
|
#9 |
Senior Member
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17 |
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 |
|
February 23, 2017, 11:40 |
|
#10 |
Member
Join Date: Feb 2015
Posts: 32
Rep Power: 11 |
#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 } |
|
February 27, 2017, 14:19 |
|
#11 |
Senior Member
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17 |
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. |
|
February 27, 2017, 14:24 |
|
#12 |
Senior Member
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17 |
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. |
|
February 28, 2017, 11:32 |
|
#13 |
Senior Member
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17 |
Fanch,
did you try my code? |
|
March 11, 2017, 22:46 |
|
#14 |
Senior Member
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17 |
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? |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Nearest wall Distance | miz_miz | CFX | 15 | March 2, 2015 14:07 |
problem with cyclicAMI and wall distance | Maff | OpenFOAM Bugs | 5 | August 14, 2014 14:41 |
Wrong wall distance with cyclic boundaries | sebastian | OpenFOAM Bugs | 4 | October 31, 2012 10:24 |
Minimum Allowable Wall Distance | rks171 | Main CFD Forum | 7 | June 16, 2012 15:39 |