# Consulting for some issues of FLUENT UDF and UDS

 Register Blogs Members List Search Today's Posts Mark Forums Read April 19, 2012, 04:48 Consulting for some issues of FLUENT UDF and UDS
#1
New Member

Nick Wu
Join Date: Apr 2012
Location: Shanghai China
Posts: 1
Rep Power: 0  Hello everyone!
I am a new learner of FLUENT, my FLUENT version is 6.3.26. I am working on a numerical simulation project studying PM2.5 particle trajectory in a wire-plate electrostatic precipitator, I have created a UDF to do the simulation, here is the UDF:
#include "udf.h"
#include "dpm.h"
#include "surf.h"
#include "metric.h"
#include "math.h"
#define Pia 3.14
#define epsilon_0 8.85e-12
#define epsilon_r 4.0
#define K0 1.38e-23
#define e 1.6e-19
#define N 1.0e+15
#define number 1
#define mi 4.82E-26
#define B 0.0
enum
{
v,
rho,
N_REQUIRED_UDS
};
DEFINE_SOURCE(v_source,c,t,dS,eqn)
{
real source;
source = 0;
dS[eqn] = 0;
return source;
}
DEFINE_SOURCE(rho_source,c,t,dS,eqn)
{

con=div_v+C_UDSI(c,t,rho)/epsilon_0;
source = con * C_UDSI(c,t,rho);
dS[eqn] =div_v+2*C_UDSI(c,t,rho)/epsilon_0;
return source;
}

DEFINE_UDS_FLUX(rho_flux,f,t,i)
{
cell_t c0, c1 = -1;
real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0; /* declaring vectors psi and A */
real dens;
c0 = F_C0(f,t);
F_AREA(A, f, t);
/* If face lies at domain boundary, use face values; */
/* If face lies IN the domain, use average of adjacent cells. */
if (BOUNDARY_FACE_THREAD_P(t)) /*Most face values will be available*/
{

/* Depending on its BC, density may not be set on face thread*/
dens = F_R(f,t); /* Set dens to face value if available */
else
dens = C_R(c0,t0); /* else, set dens to cell value */

NV_DS(psi_vec, =, C_UDSI_G(c0,t0,v), C_UDSI_G(c0,t0,v), 0, *, dens);
flux = NV_DOT(psi_vec, A); /* flux through Face */
}
else
{
c1 = F_C1(f,t); /* Get cell on other side of face */
flux = NV_DOT(psi_vec, A)/2.0; /* Average flux through face */
}
/* Fluent will multiply the returned value by phi_f (the scalar's
value at the face) to get the "complete'' advective term. */
return F_FLUX(f,t) / dens;
}

DEFINE_DPM_BODY_FORCE(particle_body_force,p,i)
{
real bforce=0.,Qk,Qd,Q;
real x[ND_ND];
cell_t c=RP_CELL(&(p->cCell));
C_CENTROID(x,c,t);
if(i==1)
Qd=3*Pia*epsilon_0*(epsilon_r/(epsilon_r+2))*pow(P_DIAM(p),2.0)*C_UDSI_G(c,t,0);
Qk=2*Pia*epsilon_0*K0*P_T(p)*P_DIAM(p)/e*log(1+pow(e,2.)*N*P_DIAM(p)*P_TIME(p)*number/(2*epsilon_0*sqrt(16*mi*K0*P_T(p)/3)));
Q=fabs(Qd)+fabs(Qk);
bforce=Q*C_UDSI_G(c,t,0)+Q*B*P_VEL(p);
return (bforce/P_MASS(p));
}

DEFINE_DPM_DRAG(particle_drag_force, Re, p)
{
float w, drag_force;
printf ("Re is %6.3f\n", Re);
/* Note: when you print a "real" data, use "%g" instead of "%f" */
if (Re < 0.01)
{
drag_force=18.0;
return (drag_force);
}
else if (Re < 20.0)
{
w = log10(Re);
drag_force = 18.0 + 2.367*pow(Re,0.82-0.05*w) ;
return (drag_force);
}
else
/* Note: suggested valid range 20 < Re < 260 */
{
drag_force = 18.0 + 3.483*pow(Re,0.6305) ;
return (drag_force);
}
}
After the UDF programming, I have copied a schematic procedure to help me complete the simulation, attached below.
I don't know how to realize this process, and how to set the UDS scalar in this case, please tell me how to do? Thank you.
Attached Images Fig.4.jpg (49.1 KB, 73 views)   November 3, 2012, 07:09 #2 New Member   IVI Join Date: Oct 2012 Posts: 14 Rep Power: 12 hi Nick Wu I also studying on ESP and need help . Do you solve your problem ? can you help me ? thank you   November 12, 2012, 03:24 #3 Senior Member   SSL Join Date: Oct 2012 Posts: 226 Rep Power: 13 There is no need of creating procedure. Fluent solves equations one by one, and then it solves UDS(s). You should just hook functions in right places. Fluent will use them when needed. and in an iterative solution it will be converged.  Thread Tools Search this Thread Show Printable Version Email this Page Search this Thread: Advanced Search Display Modes Linear Mode Switch to Hybrid Mode Switch to Threaded 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 Off Pingbacks are On Refbacks are On Forum Rules Similar Threads Thread Thread Starter Forum Replies Last Post Steven Fluent UDF and Scheme Programming 7 March 23, 2018 03:22 a.maroofi Fluent UDF and Scheme Programming 1 September 19, 2010 08:46 yerem3 FLUENT 0 January 19, 2010 03:10 tas38 FLUENT 1 August 11, 2009 10:41 Bharath FLUENT 0 December 1, 2006 15:58

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