
[Sponsors] 
January 1, 2014, 23:39 
Problem with UDF for Electrohydrodynamic Flow

#1 
New Member
Paul
Join Date: Oct 2013
Posts: 8
Rep Power: 5 
I've written a UDF for electrohydrodynamic flow through a electrostatic precipitator like shown in attachments. I think I've got the UDF down for the most part, but a few problems remain.
/************************************************** *********************/ /* udsfluxes.c */ /* UDF for specifying fluxes on user scalars */ /* scalar 0 (pos ions) have normal flux, scalar 1 (elec potential) has no flux */ /************************************************** *********************/ #include "udf.h" #include "surf.h" #include "dpm.h" #include "sg.h" DEFINE_UDS_FLUX(udsfluxes, f,t,i) { real a; if (i == 0) { a = F_FLUX(f,t); } else { a = 0; } return a; } /************************************************** ******************** UDF that computes diffusivity for userdefined scalars. diff = k*temp*mob*C_R(c,t)/e; ************************************************** *********************/ DEFINE_DIFFUSIVITY(uds_diffs, c, t, i) { real diff; real k=1.381e23; real temp=300; real mob=2.4e6; real e=1.6e19; if (i == 0) { diff = 0; } else { diff = 8.854e12; } return diff; } /************************************************** ****************/ /* UDF that adds source term and derivative for scalar potential equation (scalar 1)*/ /************************************************** ****************/ DEFINE_SOURCE(potential_source, cell, thread, dS, eqn) { real source; real prho; /* source term */ prho = C_UDSI(cell,thread, 0); source = prho; /* derivative of source term w.r.t. potential */ dS[eqn] = 0; return source; } DEFINE_PROFILE(rhowire_profile, thread, position) { real A[ND_ND]; real ds; real es[ND_ND]; real A_by_es; real dr0[ND_ND]; real flux; face_t f; Thread *t0; cell_t c0; real epsilon = 8.854e12; real E0 = 32.3*pow(10.0,5.0)*1.0 + 0.846*pow(10.0,5.0)*sqrt(1.0/0.0015); //for(ID=7;ID=9;ID++) //{ if (! Data_Valid_P()) return;/* Zone ID for wall3 zone from Boundary Conditions panel */ begin_f_loop(f, thread) /* loops over all faces in the thread passed in the DEFINE macro argument */ { BOUNDARY_FACE_GEOMETRY(f,thread,A,ds,es,A_by_es,dr 0); c0 = F_C0(f,thread); t0 = THREAD_T0(thread); if (NULLP(T_STORAGE_R_NV(t0,SV_UDSI_G(1)))) { F_PROFILE(f,thread,position)=0.; } else { F_PROFILE(f, thread, position) = epsilon/ds*((NV_MAG(C_UDSI_G(c0,t0,1))E0)); } } end_f_loop(f, thread) } My first doubt is whether I am implementing the boundary condition for charge at the wire correctly. The charge density at the wire must be iterated with the solution because it is only partially fixed by the electric field value at the wire. Some papers suggested underrelaxation but I didnt' know how to implement. My second question is that for the user defined scalar 0 which is the space charge density, the diffusivity for the scalar is zero. Therefore, the transport equation has only convective terms. In this case, I should only be required to specify the boundary at the wire since the equation is first order. However, Fluent is requiring me to specify boundary conditions at all boundaries. Is there a way to specify the BC at other locations to be part of the solution or avoid specifying them entirely? Any help is greatly appreciated thank you. Please let me know if I need to provide more details. 

March 10, 2014, 06:52 

#2 
Senior Member
SSL
Join Date: Oct 2012
Posts: 226
Rep Power: 7 
Hi Paul,
Why are you writing the UDF? Isn't better to use FLUENT MHD module? 

March 10, 2014, 15:36 

#3 
Senior Member
AA Azarafza
Join Date: Jan 2013
Posts: 218
Rep Power: 7 
@ PXC,
I didn't take your point regarding the first question. But for the second one, you can simply specify zero flux (zero gradient) for all the B.Cs. except the ones you know the value before. If you don't do that, Fluent do it itself for all wall B.Cs. regards
__________________
Regard yours 

March 20, 2014, 13:39 

#4 
New Member
Paul
Join Date: Oct 2013
Posts: 8
Rep Power: 5 
I was able to solve my problem, thanks for the replies. The zero flux boundary conditions for all other boundaries except the wire was correct and it turns out that a very strong underrelaxation factor is required. Also, it is important you give time for the electric potential equation residuals to settle down before updated the boundary condition for ion charge density at the wire.


March 21, 2014, 04:57 

#5 
Senior Member
SSL
Join Date: Oct 2012
Posts: 226
Rep Power: 7 
Do you know what is particle charge density in Fluent material panel? It is zero by default. Where can I find the real value for it?


March 27, 2014, 17:30 

#6 
New Member
Paul
Join Date: Oct 2013
Posts: 8
Rep Power: 5 
I obtained particle charge density values using semiempirical models. I don't know of any particle charge database in Fluent. "Evaluation of various particle charging models for simulating particle dynamics in electrostatic precipitators" by Zhengwei Long, QiangYao has many different models.


Tags 
boundary condition, electrostatic, udf and programming, uds 
Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Review: Reversed flow  CRT  FLUENT  0  July 20, 2012 13:03 
Convergence problem with target mass flow rate  ADL  FLUENT  2  May 29, 2012 21:11 
transient, impregnating flow problem  fgommer  FLUENT  0  February 29, 2012 17:10 
compatibility problem of UDF on LINUX  manu  FLUENT  4  December 19, 2007 05:58 
fluid flow fundas  ram  Main CFD Forum  5  June 17, 2000 21:31 