CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

obtaining wall distance for UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 21, 2017, 18:13
Default obtaining wall distance for UDF
  #1
Senior Member
 
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17
alinik is on a distinguished road
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
alinik is offline   Reply With Quote

Old   February 21, 2017, 22:58
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,705
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Moving post to the fluent forum. Please ensure you post on the right forum in future.
ghorrocks is offline   Reply With Quote

Old   February 23, 2017, 08:59
Default
  #3
Member
 
Join Date: Feb 2015
Posts: 32
Rep Power: 11
fanch33 is on a distinguished road
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
fanch33 is offline   Reply With Quote

Old   February 23, 2017, 10:46
Default
  #4
Senior Member
 
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17
alinik is on a distinguished road
Hi,

I am using Fluent v 16.2 and it does not work there.
alinik is offline   Reply With Quote

Old   February 23, 2017, 11:08
Default
  #5
Member
 
Join Date: Feb 2015
Posts: 32
Rep Power: 11
fanch33 is on a distinguished road
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
fanch33 is offline   Reply With Quote

Old   February 23, 2017, 11:09
Default
  #6
Member
 
Join Date: Feb 2015
Posts: 32
Rep Power: 11
fanch33 is on a distinguished road
Do you use #include "mem.h" at the beginning of your UDF code ?

Fanch
fanch33 is offline   Reply With Quote

Old   February 23, 2017, 11:25
Default
  #7
Senior Member
 
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17
alinik is on a distinguished road
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
alinik is offline   Reply With Quote

Old   February 23, 2017, 11:30
Default
  #8
Member
 
Join Date: Feb 2015
Posts: 32
Rep Power: 11
fanch33 is on a distinguished road
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
fanch33 is offline   Reply With Quote

Old   February 23, 2017, 11:33
Default
  #9
Senior Member
 
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17
alinik is on a distinguished road
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
alinik is offline   Reply With Quote

Old   February 23, 2017, 11:40
Default
  #10
Member
 
Join Date: Feb 2015
Posts: 32
Rep Power: 11
fanch33 is on a distinguished road
#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
}
fanch33 is offline   Reply With Quote

Old   February 27, 2017, 14:19
Default
  #11
Senior Member
 
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17
alinik is on a distinguished road
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.
alinik is offline   Reply With Quote

Old   February 27, 2017, 14:24
Default
  #12
Senior Member
 
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17
alinik is on a distinguished road
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.
alinik is offline   Reply With Quote

Old   February 28, 2017, 11:32
Default
  #13
Senior Member
 
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17
alinik is on a distinguished road
Fanch,

did you try my code?
alinik is offline   Reply With Quote

Old   March 11, 2017, 22:46
Default
  #14
Senior Member
 
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17
alinik is on a distinguished road
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?
alinik is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 02:34.