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

Define_Source and C_YI(c,t,i)

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   March 9, 2018, 16:11
Default Define_Source and C_YI(c,t,i)
  #1
New Member
 
Aureliano Sancho
Join Date: May 2013
Location: Salvador-Ba-Brasil
Posts: 26
Rep Power: 13
SanchoBuendia is on a distinguished road
Hi everyone, I have a mixture flow of the salt water (water, cl- and Na+) and I've a potential in the wall on the cylinder. My problem is that I want to calculate the different force for each specie, for example, to especie Cl- the force will be positive and to Na+ negative, but I don't know how to say specify the specie in udf.

For example, it's my udf define_source

DEFINE_SOURCE(EGL,cell,thread,dS,eqn)
{
double source2;
double k;

real xc[ND_ND];

C_CENTROID(xc,cell,thread);

k = (1/pow(((ee*Kb*T)/(2*NA*pow(el,2)*ninf)),0.5));

source2 = -ee*U0*pow(k,2)*Ex;

dS[eqn] = 0.0;
return source2;

}

But I want to read the kind of specie and to choose which source to use.

Can I write this way?

DEFINE_SOURCE(EGL,cell,thread,dS,eqn)
{

if (C_YI(c,t,2))
{
double source2;
double k;

real xc[ND_ND];

C_CENTROID(xc,cell,thread);

k = (1/pow(((ee*Kb*T)/(2*NA*pow(el,2)*ninf)),0.5));

source2 = ee*U0*pow(k,2)*Ex;

dS[eqn] = 0.0;
return source2;
}

if (C_YI(c,t,3))
{
double source2;
double k;

real xc[ND_ND];

C_CENTROID(xc,cell,thread);

k = (1/pow(((ee*Kb*T)/(2*NA*pow(el,2)*ninf)),0.5));

source2 = -ee*U0*pow(k,2)*Ex;

dS[eqn] = 0.0;
return source2;
}

}

Where, C_YI(c,t,3) is the specie Cl and C_YI(c,t,2) is Na.

Thanks
SanchoBuendia is offline   Reply With Quote

 

Tags
macroc_yi, source, species


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



All times are GMT -4. The time now is 14:34.