UDS source term

 Register Blogs Members List Search Today's Posts Mark Forums Read

 November 30, 2012, 00:55 UDS source term #1 New Member   Mukesh Join Date: Sep 2012 Posts: 28 Rep Power: 7 Dear all, I need little help to write my UDS source term. My equation represents reaction rate and is represented as: (dX/dt) = k_a*e^(-Ea/(R_u*T))*((P_i - P_eq)/P_eq)*(1-X) where, X is concentration at any time instant 't' [0< X <1] k_a is reaction constant E_a is activation energy (Constant) R_u is universal gas constant T is temperature of cell P_i is initial supply pressure (constant) P_eq is equilibrium pressure (dependent on 'T') defined as ln(P_eq) = (DELTA_S/R_u)-(DELTA_H/(R_u*T)) Here, DELTA_S & DELTA_H are again constants R_u & T are as defined above. I wrote this, But it doesn't seem to work properly as the temperature of my domain vary radially (an annular cylinder) and hence reaction rate is different at different radii, Ideally as 'x' reaches '1' reaction should stop but when I plot 'X' contours it shows values > 1 in colder regions (suggesting reaction continues even after reaching a value >1) as this should't be. Code: ```DEFINE_UDS_UNSTEADY(uds_time,c,t,i,apu,su) { real physical_dt; real vol; real rho; real phi_old; physical_dt = RP_Get_Real("physical-time-step"); vol = C_VOLUME(c,t); rho = 1; *apu = -rho*vol/physical_dt; phi_old = C_STORAGE_R(c,t,SV_UDSI_M1(0)); *su = rho*vol*phi_old/physical_dt; } /* Kinetic Equation SOURCE term */ /* Convection & Diffusion part are zero */ DEFINE_SOURCE(uds_source,c,t,ds,eqn) { real tp; real rate; real P_eq; real cond; tp = C_T(c,t); P_eq = pow(10,5)*pow(2.72,((DELTA_S/R_u)-(DELTA_H/(R_u*tp)))); C_UDMI(c,t,0)= P_eq; cond = P_i/P_eq; if(cond>1) { rate = k_a*pow(2.72,(-E_a/(R_u*tp)))*((P_i/P_eq)-1)*((C_UDSI_M1(c,t,0) - x_f)/(x_i - x_f)); ds[eqn] = k_a*pow(2.72,(-E_a/(R_u*tp)))*((P_i/P_eq)-1)*(1/(x_i - x_f)); /* Derivative of SOURCE w.r.t. DEPENDENT variable */ } else { rate = 0; ds[eqn] = 0; } C_UDMI(c,t,1) = rate; return rate; }```

 December 6, 2012, 06:59 UDS source is not returning value to Energy source term #2 New Member   Mukesh Join Date: Sep 2012 Posts: 28 Rep Power: 7 Someone please help! What I figured out was my UDS source is calculating values for various cells but I guess it is not returning the values to energy source term. What could be the reason. Monitoring 'rate' (UDS source) shows variations spatially (as temperature is varying spatially) But this variation is not taken up by the Energy source term although it is directly dependent on the 'rate' (UDS source). Please, please ......someone help me out.

January 29, 2013, 12:51
#3
New Member

Jeremiah Lin
Join Date: Jan 2013
Posts: 2
Rep Power: 0
Quote:
 Originally Posted by er.mkumar Someone please help! What I figured out was my UDS source is calculating values for various cells but I guess it is not returning the values to energy source term. What could be the reason. Monitoring 'rate' (UDS source) shows variations spatially (as temperature is varying spatially) But this variation is not taken up by the Energy source term although it is directly dependent on the 'rate' (UDS source). Please, please ......someone help me out.
Maybe you could try using UDM to store "rate" and to obtain "rate" by reading UDM.

 January 31, 2013, 17:26 #4 New Member   Mukesh Join Date: Sep 2012 Posts: 28 Rep Power: 7 Hello Lin, Sorry I didn't updated the status on my work. And yes you are correct to suggest using UDM. I solved the problem using UDM. Thanks. Regards, Mukesh

January 14, 2014, 05:06
#5
New Member

Long Nguyen
Join Date: Sep 2013
Posts: 11
Rep Power: 6
Quote:
 Originally Posted by er.mkumar Hello Lin, Sorry I didn't updated the status on my work. And yes you are correct to suggest using UDM. I solved the problem using UDM. Thanks. Regards, Mukesh
Dear Mukesh,

I'm working on the model of hydrogen storage by metal hydride. So, I'm very confused about the UDF code for source term. Could you share with me your UDF code just for reference?

Thank you very much

Regards,
Long Nguyen

 Tags source term, uds source

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Ale FLUENT 3 March 29, 2017 07:08 ofslcm OpenFOAM 3 April 7, 2012 10:57 Don456 Main CFD Forum 1 January 19, 2012 16:00 MACFD FLUENT 4 January 4, 2011 15:16 Greg Perkins FLUENT 0 October 11, 2000 03:43

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