CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Problem with UDF for Electrohydrodynamic Flow (https://www.cfd-online.com/Forums/fluent/128062-problem-udf-electrohydrodynamic-flow.html)

pxc3536 January 1, 2014 22:39

Problem with UDF for Electrohydrodynamic Flow
 
1 Attachment(s)
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 user-defined
scalars. diff = k*temp*mob*C_R(c,t)/e;
************************************************** *********************/



DEFINE_DIFFUSIVITY(uds_diffs, c, t, i)
{
real diff;
real k=1.381e-23;
real temp=300;
real mob=2.4e-6;
real e=1.6e-19;

if (i == 0)
{
diff = 0;
}
else
{
diff = 8.854e-12;
}
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.854e-12;
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 wall-3 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.

msaeedsadeghi March 10, 2014 05:52

Hi Paul,
Why are you writing the UDF? Isn't better to use FLUENT MHD module?

A CFD free user March 10, 2014 14:36

@ 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

pxc3536 March 20, 2014 12:39

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.

msaeedsadeghi March 21, 2014 03:57

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?

pxc3536 March 27, 2014 16:30

I obtained particle charge density values using semi-empirical 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.


All times are GMT -4. The time now is 18:32.