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

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

March 20, 2016, 01:39
cell wall distance using C_WALL_DIST(c,t) or other udf
#1
New Member

Join Date: Aug 2014
Location: hz.China
Posts: 22
Rep Power: 4
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 05:10.

 March 20, 2016, 05:10 #2 New Member   志新高(Zhixin Gao) Join Date: Aug 2014 Location: hz.China Posts: 22 Rep Power: 4 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?

 April 15, 2016, 16:01 #3 New Member   Pratik Dhoot Join Date: Mar 2016 Location: Boston, MA Posts: 20 Rep Power: 3 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

 April 16, 2016, 04:09 #4 New Member   志新高(Zhixin Gao) Join Date: Aug 2014 Location: hz.China Posts: 22 Rep Power: 4 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.

April 18, 2016, 09:06
#5
New Member

Pratik Dhoot
Join Date: Mar 2016
Location: Boston, MA
Posts: 20
Rep Power: 3
Quote:
 Originally Posted by zhixin 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.

 April 18, 2016, 09:17 #6 New Member   志新高(Zhixin Gao) Join Date: Aug 2014 Location: hz.China Posts: 22 Rep Power: 4 Have you defined the "user defined-memory?" if you used the memory to store message.

April 18, 2016, 09:29
#7
New Member

Pratik Dhoot
Join Date: Mar 2016
Location: Boston, MA
Posts: 20
Rep Power: 3
Quote:
 Originally Posted by zhixin 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.

 April 18, 2016, 09:38 #8 New Member   志新高(Zhixin Gao) Join Date: Aug 2014 Location: hz.China Posts: 22 Rep Power: 4 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.

April 18, 2016, 09:41
#9
New Member

Pratik Dhoot
Join Date: Mar 2016
Location: Boston, MA
Posts: 20
Rep Power: 3
Quote:
 Originally Posted by zhixin 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)
{
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);

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

 April 18, 2016, 09:47 #10 New Member   志新高(Zhixin Gao) Join Date: Aug 2014 Location: hz.China Posts: 22 Rep Power: 4 I can initialize it.

April 18, 2016, 09:50
#11
New Member

Pratik Dhoot
Join Date: Mar 2016
Location: Boston, MA
Posts: 20
Rep Power: 3
Quote:
 Originally Posted by zhixin I can initialize it.
Had you set inlet velocity to wall_d_bc for whatever 2D case you're running in FLUENT?

 April 18, 2016, 10:17 #12 New Member   志新高(Zhixin Gao) Join Date: Aug 2014 Location: hz.China Posts: 22 Rep Power: 4 Sorry I also can't initialize. I don't know why. I suggest you ask others in new thread.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post DF15 Fluent UDF and Scheme Programming 15 March 14, 2017 11:12 gento FLUENT 1 April 15, 2016 15:59 Sanyo CFX 17 August 15, 2015 06:20 be_inspired OpenFOAM Programming & Development 2 May 29, 2013 05:43 RAHULME FLUENT 0 June 27, 2011 07:25

All times are GMT -4. The time now is 01:54.

 Contact Us - CFD Online - Top