Volumetric Reaction Rate UDF. Inactivation of Clostridium Botulinum
Hello everyone. I need to create an UDF for a volumetric reaction (inactivation of clostridium botulinum) alive Botulinum > dead Botulinum
I'd like to model the reaction as function of D, decimal death time: lnC2/C1=k(t2t1) where k= 2.303/D. This is the udf I created, is it correct? #include "udf.h" #define D 12.6 DEFINE_VR_RATE(user_rate, c, t, r, mole_weight, species_mf, rate, rr, D) { real s1 = species_mf[0]; real mw1 = mole_weight[0]; *rate=(2.303/D)*s1*mw1; *rr = rate; } 
Hi!
1) Macro DEFINE_VR_RATE should have 8 arguments but you've got 9 (D is extra). 2) Be sure that rate/rr variable is in units kmol/(m3*s). 
thanks
Thank you very much.
It seems to work like this: #include "udf.h" DEFINE_VR_RATE(user_rate, c, t, r, mole_weight, species_mf, rr) { real s1 = species_mf[0]; real mw1 = mole_weight[0]; *rr=(2.303/12.6)*s1*mw1; } Another question: Now I need to insert a temperature dependent value of D (which is constant in this udf and is 12.6 ). The dependence is D=12.6/ 10^((T121)/10) How can I insert it? 
You have to use C_T macro to obtain temperature in each cell. Check out the first example, which is exactly what you need.

Assuming your equation requires units of Kelvin, try:
Code:
#include "udf.h" Quote:

Ok, thanks!
Now I should define, together with this udf, a variation of temperature wich is Temperature = (75*(1exp(0.06*t))+298); is it like this: #include "udf.h" DEFINE_PROFILE(transient_temperature, thread, position) { float t; float Temperature; face_t f; t = RP_Get_Real("flowtime"); Temperature = (75*(1exp(0.06*t))+298); begin_f_loop(f, thread) { F_PROFILE(f, thread, position) = Temperature; } end_f_loop(f, thread) } DEFINE_VR_RATE(user_rate, c, t, r, mole_weight, species_mf, rr) { real temperature=C_T(c,t); real D=12.6/pow(10.0,((temperature294.0)/10.0)); real s1 = species_mf[0]; real mw1 = mole_weight[0]; *rr=(2.303/D)*s1*mw1; } 
I am assuming that you want to set variable temperature (depending on time) on a boundary. In that case your UFD looks correct, but I would use "real" data type instead of "float" to preserve calculation precision portability. In addition, I would use macro CURRENT_TIME instead of RP_Get_Real("flowtime"), but this is just a matter of personal taste.

Yes I want to set variable temperature (depending on time) on a boundary.
Now it's almost working.. :P but interpreting the udf, fluent says "Temperature definition shadows previous definition" this is the one I'm using now: #include "udf.h" DEFINE_PROFILE(transient_temperature, thread, position) { real t; real Temperature; face_t f; t=RP_Get_Real("flowtime"); Temperature=(75*(1exp(0.06*t))+298); begin_f_loop(f, thread) { F_PROFILE(f, thread, position) = Temperature; } end_f_loop(f, thread) } DEFINE_VR_RATE(user_rate, c, t, r, mole_weight, species_mf, rr) { real Temp=C_T(c,t); real D=12.6/pow(10.0,((Temp294.0)/10.0)); real s1 = species_mf[0]; real mw1 = mole_weight[0]; *rr=(2.303/D)*s1*mw1; } 
Try changing "Temperature" to "Temp2" or some other name and let us know if that works. See below.
ComputerGuy Code:
#include "udf.h" Quote:

I'm using this one but it doesn't seem to work:
#include "udf.h" DEFINE_PROFILE(transient_temperature, thread, position) { real t; real temp2; face_t f; t=RP_Get_Real("flowtime"); temp2=(100*(1exp(0.06*t))+298); begin_f_loop(f, thread) { F_PROFILE(f, thread, position) = temp2; } end_f_loop(f, thread) } DEFINE_VR_RATE(user_rate, c, t, r, mole_weight, species_mf, rr) { real Temp=C_T(c,t); real D=12.6/pow(10,((Temp294)/10)); real s1 = species_mf[0]; real mw1 = mole_weight[0]; *rr=(2.303/D)*s1*mw1; } 
it's working!
I guess it was a problem of units. It works like this:
#include "udf.h" DEFINE_PROFILE(transient_temperature, thread, position) { real t; real Temperature; face_t f; t=RP_Get_Real("flowtime"); Temperature=(75*(1exp(0.06*t))+298); begin_f_loop(f, thread) { F_PROFILE(f, thread, position) = Temperature; } end_f_loop(f, thread) } DEFINE_VR_RATE(user_rate7,c,t,r,mw,yi,rr,rr_t) { real temperatura, s1, mw1; temperatura=394.0; temperatura=C_T(c,t); s1 = yi[0]; mw1 = mw[0]; *rr=(2.303/(12.6/pow(10,((temperatura394.0)/10.0))))*(s1/mw1)*922; } thanks everyone! 
Hi Robbb and everyone here,
My simulation requirement leads me to this post. The reaction kinetics I want to simulate is similar to the very first one in this thread. Can any kind soul tell me how to incorporate the interpreted UDF into calculation? I interpreted my UDF and included it in function hook, then....? because... nothing happens. Thanks a lot in advance! 
All times are GMT 4. The time now is 16:17. 