CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   How to get the current cell and thread inform when using DEFINE_NET_REACTION_RATE (https://www.cfd-online.com/Forums/fluent-udf/149982-how-get-current-cell-thread-inform-when-using-define_net_reaction_rate.html)

malcolmcheong March 12, 2015 10:19

How to get the current cell and thread inform when using DEFINE_NET_REACTION_RATE
 
Hello everybody!:)

Recently I am trying to modified the reaction rates when using the EDC model in fluent. The UDF manual of fluent shows that I can implement that by using DEFINE_NET_REACTION_RATE. And here is the example provided in the UDF manual :

#include "udf.h"

DEFINE_NET_REACTION_RATE(user_net_reaction_rate, p, temp, yi, rr, jac)
{
int i;
for(i=0;i<n_spe;i++)
rr[i] = 1./(real)n_spe - yi[i];
}

However, in my own scheme I need to call the viscosity of the current cell and I will use the macro C_MU_L(c, t), which means I need to know the information of the current cell and thread. But this reaction rate function does not providing the information. How can I solve this problem? or how can I acquire the cell and thread information when I use DEFINE_NET_REACTION_RATE?

Any suggestions will be appreciated. Thank you.

pakk March 12, 2015 10:27

In my version of Fluent (v15), the macro is different:
Code:

DEFINE_NET_REACTION_RATE(net_rxn,c,t,particle,pressure,temp,yi,rr,jac)
So the reaction rate function does give the information. Which version are you using?

malcolmcheong March 12, 2015 11:01

Thank you for your reply. I am using Fluent 6.3 and I have tried the new function format with cell and thread information.

Actually I am trying to implement the default EDC model using my own UDF and here is the code:

#include "udf.h"

DEFINE_NET_REACTION_RATE(default_edc, c, t, particle, pressure, temp, yi, rr, jac)
{

int i = 0;

double ctau, cxi, tau, xi;

//DEFINE ctau and cxi
ctau = 0.4082;
cxi = 2.1377;

xi = cxi*pow(C_MU_L(c,t)*C_D(c,t)/(C_R(c,t)*C_K(c,t)*C_K(c,t)),0.25);
tau = ctau*sqrt(C_MU_L(c,t)/(C_D(c,t)*C_R(c,t)));

for(i=0;i<n_spe;i++)
{
rr[i] = C_R(c,t)*xi*xi/(ctau*(1. - xi*xi*xi))*(C_YI_EDC(c,t,i) - yi[i]);
}
}

Unfortunately the code did not work. When I hook it and run the simulation primitive error occurred. Then I realize that the c and t this function passes may be different from what I need in the macros such as C_D(c, t). The c and t this function passes is for the particles, right?

loop August 13, 2015 08:13

Hello malcolmcheong,

Did you manage to solve the problem with using the DEFINE_NET_REACTION_RATE. I am trying to use it as well and am facing similar problems. Would appreciate any suggestions...

Aslan_nzr December 5, 2016 04:24

Hello everybody

Did anyone succeed in rewriting the EDC default model by udf?!!


All times are GMT -4. The time now is 00:33.