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

UDF for Heterogeneous Reaction

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By MayTheFlowBeWithYou

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 4, 2017, 00:35
Default UDF for Heterogeneous Reaction
  #1
New Member
 
Join Date: Aug 2017
Posts: 3
Rep Power: 9
Lorena is on a distinguished road
Hello Mr/Mrs.

I am making a simulation in a square (2D) of 1cm X 1cm of an Heterogeneous Reaction using the VOF option for the multiphase model. I'm working with two phases, the primary phase is gas (compound by two species) and the secondary phase is liquid (compound by two species too). I consider it a transient process. In order to make the correct initialization I used a patch where I define the zones that each species fill.

The heterogeneous reaction develops in the next manner:
a*A(L) ---> b*B(g) + c*C(L) , this means that the liquid reactive produce two products one in gas phase and the other in liquid phase.

I'm using this UDF for the reaction rate function:

/*Heterogeneous net reaction*/
# include "udf.h"
/************************************************** ********/
/*Definiendo valores constantes*/
/************************************************** ********/
# define R 8.31434 /*Constante universal de los gases J/mol-K*/
# define Pre 3.97E+12/*factor Pre-exponential, 1/s*/
# define EA 228000.0 /*Energía de activación, J/mol*/

/************************************************** ********/
/*11...*Definiendo posición de fases [fase primaria 0,fase secundaria 1,……………….] y especies [especie 0,especie 1,……………….] */
/************************************************** ********/
#define gas_index 0 /* index(índice) de la fase gaseosa */
#define gas_vola_index 0 /* index de volátiles en la fase gaseosa */
#define gas_n2_index 1 /* index de n2 en la fase gaseosa */
#define liquid_index 1 /* index de la fase liquida*/
#define liquid_coke_index 0 /* index del coke en la fase líquida */
#define liquid_pp_index 1 /* index del PP en la fase líquida */
/************************************************** ********/
/* 20...Ecuación de laminar de Arrhenius para PP */
/************************************************** ********/
DEFINE_HET_RXN_RATE(reation_rate,c,t,r,mw,yi,rr,rr _t)
{
/************************************************** ************************************************** ****/
/*25 asignación de fases: fase primaria volátiles-nitrógeno [0] y fase secundaria pp fundido y coke [1]*/
/************************************************** ************************************************** ***/
Thread **pt = THREAD_SUB_THREADS(t);
Thread *Prim_t = pt[0]; /*Thread para la fase primaria volátiles-nitrógeno*/
Thread *sec_t = pt[1]; /*Thread para la fase secundaria pp-coke*/
/************************************************** ********/
/*31..llamando valores que se necesitan*/
/************************************************** ********/
real T_sec = C_T(c,sec_t); /*Temperatura de la fase secundaria, K*/
/*34*********************************************** ***********/
/*cálculo de la concentración del pp*/
/************************************************** ********/
real PP_conc;
real AA;
real RHO,Fmpp,Pm,V_sec;
RHO=C_R(c,sec_t);
Fmpp=C_YI(c,sec_t,1);
Pm=mw[liquid_index][liquid_pp_index];
PP_conc=(RHO*Fmpp)/(mw[liquid_index][liquid_pp_index]);
V_sec=C_VOF(c,sec_t);


/************************************************** ********/
/*cálculo de la velocidad de reacción pp*/
/*49*********************************************** ***********/

*rr = Pre*exp(-EA/(R*T_sec))*PP_conc;
AA = Pre*exp(-EA/(R*T_sec))*PP_conc;

C_UDMI(c,t,0)=Pre;

C_UDMI(c,t,1)=EA;

C_UDMI(c,t,2)=R;

C_UDMI(c,t,3)=T_sec;

C_UDMI(c,t,4)=PP_conc;

C_UDMI(c,t,5)=RHO;

C_UDMI(c,t,6)=Fmpp;

C_UDMI(c,t,7)=V_sec;

C_UDMI(c,t,8)=AA;

}

I successfully load and compile the UDF but as you can see in the code I save the values in order to compare them with the the data obtained in the post-processing. The problem is that the data saved in memory doesn't match with those displayed in contours. For example, I save the mass fraction data of an species (memory 6, in red) but it doesn't match with the data shown in mass fraction species contours displayed for that species.

I don't understand why the values defined in my UDF don't respect the initial patch established. Do you think there is something wrong in my UDF?

I will appreciate your comments.

Regards,

Lorena.
Lorena is offline   Reply With Quote

Old   August 4, 2017, 06:06
Default
  #2
Member
 
MayTheFlowBeWithYou's Avatar
 
I have to remain anonymous, I'm sorry.
Join Date: Jun 2017
Location: The Netherlands, Delft University of Technology
Posts: 48
Rep Power: 9
MayTheFlowBeWithYou is on a distinguished road
I think this has to do with the way CFD post draws the contours based on your data. I think they do it by calculating gradients between all the cell center values and then drawing contours around that. For many variable something like that will give a more natural looking solution then when you would purely draw the cell values on there.

What you need to do is as follows: in your contour details click on the little "+" where in sais "advanced properties". Then click on the circle next to where it sais "Face". This will make it just draw the "raw" data.

khaledhmz likes this.
MayTheFlowBeWithYou is offline   Reply With Quote

Old   October 6, 2017, 23:36
Default
  #3
New Member
 
Hussein
Join Date: Jul 2017
Posts: 7
Rep Power: 9
H.Almrayatee is on a distinguished road
You need to multiply the reaction rate equation *rr with VOF of the phase.
H.Almrayatee is offline   Reply With Quote

Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
surface reaction UDF jeniuswx Fluent UDF and Scheme Programming 2 August 8, 2017 13:06
UDF for volumetric reaction rate Boniface Omar Fluent UDF and Scheme Programming 0 July 25, 2016 03:39
Help! reaction udf for multiphase m_amiri Fluent UDF and Scheme Programming 2 January 15, 2015 10:54
surface reaction UDF jeniuswx Fluent UDF and Scheme Programming 2 April 11, 2013 04:33
UDF : Chemical Reaction in Catalytic Converter adhimac FLUENT 1 March 27, 2001 15:04


All times are GMT -4. The time now is 15:42.