
[Sponsors] 
February 9, 2014, 12:55 
Hydrogen storage by metal hydride

#1 
New Member
Long Nguyen
Join Date: Sep 2013
Posts: 11
Rep Power: 5 
Dear all,
I have been conducting the project related to modeling the hydrogen storage based on metal hydride. In my case, hydrogen is injected into the reactor, then hydrogen will react with metal (porous material) to form metal hydride. The amount of absorbed hydrogen is represented by "sink term" which is covered in my UDF. Here is my UDF code: #include"udf.h" /* Input Boundary Conditions */ #define T_i 293.0 /* Inlet temp in K */ #define T_f 293.0 /* Coolant fluid temp in Kelvin [K] */ #define P_i 500000.0 /* Inlet pressure in pascals */ #define x_i 0.0 /* Initial value of H/M for reaction to START */ #define x_f 1.0 /* Final value of H/M for reaction to STOP @ saturation */ /* Properties of Metal Alloy [LaNi5] */ #define rho_m 8394.0 /* Density in kg/m^3 */ #define Cp_m 419.0 /* Sp heat in J/kgK */ #define K_m 1.6 /* Thermal conductivity in W/mK */ #define por 0.5 /* Porosity */ #define NA 6.0 /* Number of atoms in Mischmetal alloy [MmNi4.6Al0.4] */ #define M_m 434.0 /* molecular weight of mischmetal alloy [MmNi4.6Al0.4] in g/mol; [LaNi5 = 434] */ #define rho_ss 8394.0 /* Density of MH @ saturation kg/m^3 */ #define rho_s 8280.0 /* Density of MH kg/m^3 */ #define E_a 21179.6 /* Activation energy in J/mol H2 */ #define per 1.0e8 /* Permeability */ #define DELTA_S 107.2 /* Entropy of Formation J/mol H2K */ #define DELTA_H 30780.0 /* Enthalpy of Formation J/mol H2 */ #define wt 0.013 /* Hydrogen weight Storage Capacity 1.3% of Mischmetal */ #define A_vantHoff 17.738 #define B_vantHoff 3704.6 /* Properties of Hydrogen */ #define K_g 0.127 /* Thermal Conductivity in W/mK */ #define Cp_g 14283 /* Sp heat in J/kgK */ #define rho_g 0.0838 /* Density in kg/m^3 */ #define M_g 2.016 /* Molecular weight in g/mol */ /* CONSTANTS */ #define R_u 8.314 /* Universal gas Constant J/molK */ #define k_a 59.187 /* Reaction Constant for absorption in (sec)^1 */ real x_t_temporary; real rate_temporary; real heat_rate_temporary; ////////////////////////////////////////////////////////////////////////////////////////////////// DEFINE_INIT(my_init_fuc,d) { cell_t c; Thread *t; thread_loop_c(t,d) { begin_c_loop_all(c,t) { C_UDMI(c,t,0) = x_i; C_UDMI(c,t,1) = 0.0; C_UDMI(c,t,2) = 0.0; } end_c_loop_all(c,t) } } DEFINE_SOURCE(mass_source_edited1,c,t,dS,eqn) { real tp; real rate; real P_eq; real cond; int curr_N_timestep; real curr_timestep_size; real curr_rho; real x_t; real dxdt; real P_g = C_P(c,t); real vol = C_VOLUME(c,t); tp = C_T(c,t); P_eq = pow(10,5)*exp((DELTA_S/R_u)(DELTA_H/(R_u*tp))); cond = P_g/P_eq; curr_N_timestep = N_TIME; //Number of timestep curr_timestep_size = CURRENT_TIMESTEP; //current timestep size if(cond > 1.0) { x_t = 1.0  exp((1)*(rho_ssrho_s)*(1por)*k_a*exp(E_a/(R_u*tp))*((P_g/P_eq)1)*CURRENT_TIME); dxdt = (x_t  C_UDMI(c,t,0))/curr_timestep_size; if(CURRENT_TIME > 0) { rate = dxdt*(rho_ssrho_s)*(1por); } dS[eqn] = 0.0; } else { rate = 0.0; dS[eqn] = 0.0; } x_t_temporary = x_t; rate_temporary = rate; return rate; } DEFINE_SOURCE(heat_source_edited1,c,t,dS,eqn) { real heat_rate; real tp; real rate; real P_eq; real cond; int curr_N_timestep; real curr_timestep_size; real x_t; real dxdt; real P_g = C_P(c,t); real vol = C_VOLUME(c,t); tp = C_T(c,t); P_eq = pow(10,5)*exp((DELTA_S/R_u)(DELTA_H/(R_u*tp))); cond = P_g/P_eq; curr_N_timestep = N_TIME; curr_timestep_size = CURRENT_TIMESTEP; if(cond > 1.0) { x_t = 1.0  exp((1)*(rho_ssrho_s)*(1por)*k_a*exp(E_a/(R_u*tp))*((P_g/P_eq)1)*CURRENT_TIME); dxdt = (x_t  C_UDMI(c,t,0))/curr_timestep_size; if(CURRENT_TIME > 0) { rate = dxdt*(rho_ssrho_s)*(1por); heat_rate = (1000.0*DELTA_H/M_g)*(rate); } dS[eqn] = 0.0; } else { heat_rate = 0.0; dS[eqn] = 0.0; } heat_rate_temporary = heat_rate; return heat_rate; } DEFINE_EXECUTE_AT_END(ThisRunsAtEndOfTimestep) { Domain *d; Thread *t; cell_t c; d = Get_Domain(1); thread_loop_c(t,d) { if(FLUID_THREAD_P(t)) { begin_c_loop(c,t) { C_UDMI(c,t,0) = x_t_temporary; C_UDMI(c,t,1) = rate_temporary; C_UDMI(c,t,2) = heat_rate_temporary; } end_c_loop(c,t) } } } I tried to run this UDF many times but it seems not working... Anyone could help me? Regards, 

February 9, 2014, 21:06 

#2 
New Member
Long Nguyen
Join Date: Sep 2013
Posts: 11
Rep Power: 5 
Somebody help me !!


October 23, 2015, 02:02 
udf for hydrogen storage based metal hydride

#3 
New Member
krushna shekde
Join Date: Oct 2015
Posts: 9
Rep Power: 2 
Dear longbk,
I am new user of CFD online. I am working on hydrogen storage based on metal hydride for my M.Tech. Dissertation, help me in that. in your UDF you model heat_genration and hydrogen_concentration w.r.t time on porous model. my question is in fluent you model the porous zone ?why? thanking you. Regards, 

October 23, 2015, 03:25 

#4  
New Member
Long Nguyen
Join Date: Sep 2013
Posts: 11
Rep Power: 5 
Quote:
Actually, I finished this project at the end of 2014. For your inquiry, the material used for hydrogen absorption in my model is LaNi5  such a porous powder. When hydrogen is injected into the reactor filled with LaNi5 powder, the absorption occurs. In details, this process includes many steps, but we supposed that the chemical reaction step is dominant. I hope my answer could meet your desire. If you want to ask more, you can contact me through my facebook: https://www.facebook.com/long.nguyen.182940 Rgds, Long Nguyen 

October 23, 2015, 04:32 

#5 
New Member
krushna shekde
Join Date: Oct 2015
Posts: 9
Rep Power: 2 
Dear Long,
thank you for reply. i am working on miscmetal MmNi4.6Al0.4 using ANSYS Fluent so i modeled coolant zone(Fluid) and porous zone(Fluid) only and UDF apply on porous zone. is that right process. can i model porous zone as solid? regards, 

October 23, 2015, 11:14 

#6  
New Member
Long Nguyen
Join Date: Sep 2013
Posts: 11
Rep Power: 5 
Quote:
Yes, that's right. As I know, Solid zone does not have any porous option. If you set the cell zone condition as a solid zone, it means that there is only solid in your cell zone (porosity equals zero). You should take a look at this link http://imechanica.org/files/fluent_1...conditions.pdf Rgds, Long Nguyen 

October 26, 2015, 02:38 

#7 
New Member
krushna shekde
Join Date: Oct 2015
Posts: 9
Rep Power: 2 
Dear Long Nguyen,
Thanks for your reply, now i am set my problem in fluent but i don't know how to calculate Time Step and No. of Iteration my absorption time is 375s please help me for this also send me calculation methods. regards, Krushna 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Hydrogen Storage in Porous Media  er.mkumar  FLUENT  1  August 17, 2013 08:30 
UDF for Hydrogen Storage in Porous Media  er.mkumar  Fluent UDF and Scheme Programming  10  January 31, 2013 17:21 
Need Help Simulating Hydrogen Storage in Metal Hydride  jehadyam  CFD Freelancers  0  January 29, 2013 17:41 
Liquid Metal Combustion in an enclosed geometry  snh  FLUENT  0  September 11, 2012 02:50 
Hydrogen storage on Fluent  karl fisher  FLUENT  0  September 3, 2010 04:23 