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/)
-   -   udf for exothermic reaction:source term (https://www.cfd-online.com/Forums/fluent-udf/189380-udf-exothermic-reaction-source-term.html)

mataus June 19, 2017 00:09

udf for exothermic reaction:source term
 
hai
I am trying to write an energy source term UDF for an exothermic chemical reaction.the source term equation is q=contstant *(dx/dt),where dx/dt is the reaction rate of the equation
Initially the value of x=0 and at the end the value of x=1
I wrote the UDF as follows(this I got from this site)

DEFINE_INIT(my_init_fuc,d)
{
cell_t c;
Thread*t;
thread_loop_c(t,d)
{
begin_c_loop_all(c,t)
{
C_UDSI(c,t,0)= 0;
}
end_c_loop_all(c,t)
}
}

/*UDF for solving Energy Equation HEAT SOURCE term */
DEFINE_SOURCE(heat_generation,c,t,ds,eqn)
{
real q_a;
real physical_dt;
physical_dt = RP_Get_Real("physical-time-step");
q_a=1000*(C_UDSI(c,t,0)-C_UDSI_M1(c,t,0))/physical_dt;
ds[eqn]=0;
C_UDMI(c,t,0)=q_a; /* Memory allocation for storing 'heat generation' */
return q_a;
}

Is this UDF right?? Can anyone please explain how this udf works exactly in fluent solver or
how this calculation works in fluent especially these two lines
C_UDSI(c,t,0)= 0;
q_a=1000*(C_UDSI(c,t,0)-C_UDSI_M1(c,t,0))/physical_dt;
??

Vicky3141 October 31, 2017 06:12

Hi mataus,

Did you get clear with the UDF?
Because I am also facing the same problem and need help pls.

Regards

fzmd55 March 31, 2020 06:02

There is no source term for your heat. Hence there will no heat generation. While the source term you have given is just the transient term, which is the change in heat with respect to time. So, you first need to define the source for heat generation.


All times are GMT -4. The time now is 19:44.