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

cell wall distance using C_WALL_DIST(c,t) or other udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 20, 2016, 00:39
Default cell wall distance using C_WALL_DIST(c,t) or other udf
  #1
Member
 
志新高(Zhixin Gao)
Join Date: Aug 2014
Location: hz.China
Posts: 30
Rep Power: 11
zhixin is on a distinguished road
Hi all,
I've been calculating the cell wall distance of the first layer. I used the C_WALL_DIST(c,t) macro, but the result seems to be untrue, so I used the following udf and got two different result.
Quote:
t=Lookup_Thread(d,11);//*11 is the wall number
begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
c0=F_C0(f,t);
t0=THREAD_T0(t);
C_CENTROID(y,c0,t0);
dist=ND_SUM(pow(x[0]-y[0],2),pow(x[1]-y[1],2),pow(x[2]-y[2],2));
dists=sqrt(dist);
C_UDMI(c0,t0,1)=dists;//*dists stands for the distance between cell centriod of first layer and the face centroid of boundary face
dt=C_WALL_DIST(c0,t0);//*to compare the result between macro and the expression
C_UDMI(c0,t0,2)=dt;
}
end_f_loop(f,t)
So can anyone tell me whether the udf is right or not? Or how does the C_WALL_DIST(c,t) macro get the result?

Best, Gao

Last edited by zhixin; March 20, 2016 at 04:10.
zhixin is offline   Reply With Quote

Old   March 20, 2016, 04:10
Default
  #2
Member
 
志新高(Zhixin Gao)
Join Date: Aug 2014
Location: hz.China
Posts: 30
Rep Power: 11
zhixin is on a distinguished road
I have another question:
I use ICEM to draw the hexahedral structure mesh and set the height of first layer as 0.002mm. So can I say the distance between the first layer and boundary is 0.001mm?
zhixin is offline   Reply With Quote

Old   April 15, 2016, 16:01
Default
  #3
New Member
 
Pratik Dhoot
Join Date: Mar 2016
Location: Boston, MA
Posts: 20
Rep Power: 10
pratikddhoot is on a distinguished road
Hi,

I used the same macro, but my solution fails to initialize. How did you run the solution?

did the macro C_WALL_DIST work without initialization?

Thanks,
Pratik
pratikddhoot is offline   Reply With Quote

Old   April 16, 2016, 04:09
Default
  #4
Member
 
志新高(Zhixin Gao)
Join Date: Aug 2014
Location: hz.China
Posts: 30
Rep Power: 11
zhixin is on a distinguished road
Hi Pratik,

When I used the C_WALL_DIST(c,t) macro, I based on this,
http://www.cfd-online.com/Forums/flu...-centroid.html
and yes I initialize before calculation, I think it's needed.

Can you post your error? Maybe me or others can find out the reason.

Best.
zhixin is offline   Reply With Quote

Old   April 18, 2016, 09:06
Default
  #5
New Member
 
Pratik Dhoot
Join Date: Mar 2016
Location: Boston, MA
Posts: 20
Rep Power: 10
pratikddhoot is on a distinguished road
Quote:
Originally Posted by zhixin View Post
Hi Pratik,

When I used the C_WALL_DIST(c,t) macro, I based on this,
http://www.cfd-online.com/Forums/flu...-centroid.html
and yes I initialize before calculation, I think it's needed.

Can you post your error? Maybe me or others can find out the reason.

Best.
It says, "received a fatal signal (segmentation fault)" when I hit initialize.
pratikddhoot is offline   Reply With Quote

Old   April 18, 2016, 09:17
Default
  #6
Member
 
志新高(Zhixin Gao)
Join Date: Aug 2014
Location: hz.China
Posts: 30
Rep Power: 11
zhixin is on a distinguished road
Have you defined the "user defined-memory?" if you used the memory to store message.
zhixin is offline   Reply With Quote

Old   April 18, 2016, 09:29
Default
  #7
New Member
 
Pratik Dhoot
Join Date: Mar 2016
Location: Boston, MA
Posts: 20
Rep Power: 10
pratikddhoot is on a distinguished road
Quote:
Originally Posted by zhixin View Post
Have you defined the "user defined-memory?" if you used the memory to store message.
No. I have not. I am new to UDF and I could interpret and run a few other codes.
Only when I use real "y = C_WALL_DIST(c,t);" is when the solution fails to initialize.
pratikddhoot is offline   Reply With Quote

Old   April 18, 2016, 09:38
Default
  #8
Member
 
志新高(Zhixin Gao)
Join Date: Aug 2014
Location: hz.China
Posts: 30
Rep Power: 11
zhixin is on a distinguished road
I don't know why this error happened, y=C_WALL_DIST(c,t) seems right, so would you mind post the key part about this macro.
zhixin is offline   Reply With Quote

Old   April 18, 2016, 09:41
Default
  #9
New Member
 
Pratik Dhoot
Join Date: Mar 2016
Location: Boston, MA
Posts: 20
Rep Power: 10
pratikddhoot is on a distinguished road
Quote:
Originally Posted by zhixin View Post
I don't know why this error happened, y=C_WALL_DIST(c,t) seems right, so would you mind post the key part about this macro.
#include "udf.h"


DEFINE_PROFILE(wall_d_bc,t,i)
{
Thread *t0;
face_t f;
cell_t c, c0;
double F_x,area,A[ND_ND],yplus,wshear;

begin_f_loop(f,t)
{
c0 = F_C0(f,t);
t0 = THREAD_T0(t);

yplus = C_STORAGE_R(f,t,SV_WALL_YPLUS_UTAU); /* Y+*/

F_x = F_STORAGE_R_N3V(f,t,SV_WALL_SHEAR)[0];
F_AREA(A, f, t);
area = NV_MAG(A);
wshear=-1*F_x/area;

/* wshear = C_MU_L(c0,t0)*C_U(c0,t0)/C_WALL_DIST(c0,t0); wall shear stress */
F_PROFILE(f,t,i) = 6.*wshear/(0.075*C_MU_L(c0,t0)*SQR(yplus));
}
end_f_loop(f,t)
}




Look at this function for velocity profile. Save it as .c and interpret it in FLUENT.

Tell me if you can initialize.

If you can directly reply in email, my id is dhoot.p@husky.neu.edu
pratikddhoot is offline   Reply With Quote

Old   April 18, 2016, 09:47
Default
  #10
Member
 
志新高(Zhixin Gao)
Join Date: Aug 2014
Location: hz.China
Posts: 30
Rep Power: 11
zhixin is on a distinguished road
I can initialize it.
zhixin is offline   Reply With Quote

Old   April 18, 2016, 09:50
Default
  #11
New Member
 
Pratik Dhoot
Join Date: Mar 2016
Location: Boston, MA
Posts: 20
Rep Power: 10
pratikddhoot is on a distinguished road
Quote:
Originally Posted by zhixin View Post
I can initialize it.
Had you set inlet velocity to wall_d_bc for whatever 2D case you're running in FLUENT?
pratikddhoot is offline   Reply With Quote

Old   April 18, 2016, 10:17
Default
  #12
Member
 
志新高(Zhixin Gao)
Join Date: Aug 2014
Location: hz.China
Posts: 30
Rep Power: 11
zhixin is on a distinguished road
Sorry I also can't initialize. I don't know why.
I suggest you ask others in new thread.
zhixin 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
How to use a UDF to set the volume fraction in the cells next to a wall? DF15 Fluent UDF and Scheme Programming 33 August 20, 2020 13:36
udf wall distance segmentation violation gento FLUENT 1 April 15, 2016 15:59
Wrong flow in ratating domain problem Sanyo CFX 17 August 15, 2015 06:20
Locate a cell with a specific wall Distance value be_inspired OpenFOAM Programming & Development 2 May 29, 2013 05:43
film thickness using cell wall distance RAHULME FLUENT 0 June 27, 2011 07:25


All times are GMT -4. The time now is 20:11.