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

Question about DEFINE_DPM_BC from ANSYS Fluent help

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By pakk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 9, 2017, 04:36
Default Question about DEFINE_DPM_BC from ANSYS Fluent help
  #1
sfn
New Member
 
Alexander
Join Date: Dec 2016
Posts: 24
Rep Power: 9
sfn is on a distinguished road
Here is example udf from ANSYS Fluent 17 help (2.5.1.3. Example 1):
Quote:
/* reflect boundary condition for inert particles */
#include "udf.h"
DEFINE_DPM_BC(bc_reflect,p,t,f,f_normal,dim)
{
real alpha; /* angle of particle path with face normal */
real vn=0.;
real nor_coeff = 1.;
real tan_coeff = 0.3;
real normal[3];
int i, idim = dim;
real NV_VEC(x);

#if RP_2D
/* dim is always 2 in 2D compilation. Need special treatment for 2d
axisymmetric and swirl flows */
if (rp_axi_swirl)
{
real R = sqrt(P_POS(p)[1]*P_POS(p)[1] +
P_POS(p)[2]*P_POS(p)[2]);
if (R > 1.e-20)
{
idim = 3;
normal[0] = f_normal[0];
normal[1] = (f_normal[1]*P_POS(p)[1])/R;
normal[2] = (f_normal[1]*P_POS(p)[2])/R;
}
else
{
for (i=0; i<idim; i++)
normal[i] = f_normal[i];
}
}
else
#endif
for (i=0; i<idim; i++)
normal[i] = f_normal[i];

if(p->type==DPM_TYPE_INERT)
{
alpha = M_PI/2. - acos(MAX(-1.,MIN(1.,NV_DOT(normal,P_VEL(p))/
MAX(NV_MAG(P_VEL(p)),DPM_SMALL))));
if ((NNULLP(t)) && (THREAD_TYPE(t) == THREAD_F_WALL))
F_CENTROID(x,f,t);

/* calculate the normal component, rescale its magnitude by
the coefficient of restitution and subtract the change */

/* Compute normal velocity. */
for(i=0; i<idim; i++)
vn += P_VEL(p)[i]*normal[i];

/* Subtract off normal velocity. */
for(i=0; i<idim; i++)
P_VEL(p)[i] -= vn*normal[i];

/* Apply tangential coefficient of restitution. */
for(i=0; i<idim; i++)
P_VEL(p)[i] *= tan_coeff;

/* Add reflected normal velocity. */
for(i=0; i<idim; i++)
P_VEL(p)[i] -= nor_coeff*vn*normal[i];

/* Store new velocity in P_VEL0 of particle */
for(i=0; i<idim; i++)
P_VEL0(p)[i] = P_VEL(p)[i];

return PATH_ACTIVE;
}
return PATH_ABORT;
}
This udf is work, but i have a question about "alpha" variable. Why do they use it? I mean they just calculate the value and don't use it in further calculations. Without this line
Quote:
alpha = M_PI/2. - acos(MAX(-1.,MIN(1.,NV_DOT(normal,P_VEL(p))/ MAX(NV_MAG(P_VEL(p)),DPM_SMALL))));
i will get the same results. Am I wrong or is it little error in the code?
sfn is offline   Reply With Quote

Old   February 9, 2017, 05:08
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
You are correct in saying that without this line, you will get the same results. The line has no effect on the simulation.

(I even suspect that the compiler recognizes this, and that the line is completely ignored.)

But I would not call it an error. An error is something that (potentially) causes problems. This line will not cause problems. And you have to see it in the context of a manual: this specific UDF does not use the angle alpha, but if somebody wants to change the UDf to make it angle-dependent, the angle is already there.
sfn likes this.
pakk is offline   Reply With Quote

Old   March 26, 2018, 19:31
Default
  #3
New Member
 
Matt
Join Date: Mar 2018
Posts: 11
Rep Power: 8
sthinmind is on a distinguished road
As pakk said Alpha is not used in this code. The definition of Alpha however is wrong. The way that Alpha is defined, it is the angle of particle path with the surface itself and not with the surface normal.
or "angle of particle path with face normal"=pi/2-Alpha
sthinmind 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
UDF Defining in ANSYS FLUENT 16.2 in Win 10 Sadegh.A Fluent UDF and Scheme Programming 11 February 15, 2017 15:45
Running UDF with Supercomputer roi247 FLUENT 4 October 15, 2015 14:41
gambit in Ansys FLuent 13 saharesobh FLUENT 0 August 1, 2012 16:30
[GAMBIT] 3.5 years overtake by Ansys: Where are the enhancements in grid generation Volker P. ANSYS Meshing & Geometry 22 January 17, 2012 18:27
Fluent & Ansys FSI architecture help DillonS FLUENT 1 April 7, 2010 17:00


All times are GMT -4. The time now is 19:06.