|
[Sponsors] |
August 3, 2017, 05:24 |
adding hydrogen with source term
|
#1 |
New Member
Etienne Lin
Join Date: Aug 2017
Location: la Chine
Posts: 4
Rep Power: 9 |
Hi,everyone,
I use source term to add hydrogen in a closed room, it's weird that the total gas mass gets lower. It seems that the the hydrogen amount adding to cell replaces the air with the same mole and the air disappears. This question confused me a lot, please give me some advises. Here is my setting: pressure_based solver, transient,with gravity; energy on, standard k-epsilon, realizable wall Fn, species transport without reaction; material is air and hydrogen, ideal gas; operating pressure is 1atm; all boundaries are adiabatiques walls; initial temperature is 300k; here is my udf: DEFINE_ADJUST(set,d) { cell_t cell; Thread *thread; real total mass = 1.0; real total_volume = 0.102526; real inlet_time = 10.0; real velocity = 0.1; real temp; thread_loop_c(thread,d) { begin_c_loop_all(cell,thread) { if (CURRENT_TIME>=0.0 && CURRENT_TIME<=inlet_time) { if (cell<=100 && cell>=90) { temp = C_T(cell,thread); C_UDMI(cell,thread,0) = total_mass/total_volume/inlet_time; C_UDMI(cell,thread,1) = (total_mass/total_volume/inlet_time)*14283.0*(temp-298); /*the enthalpy of hydrogen*/ C_UDMI(cell,thread,2) = (total_mass/total_volume/inlet_time)*velocity; } else { C_UDMI(cell,thread,0) = 0.0; C_UDMI(cell,thread,1) = 0.0; C_UDMI(cell,thread,2) = 0.0; } } else { C_UDMI(cell,thread,0) = 0.0; C_UDMI(cell,thread,1) = 0.0; C_UDMI(cell,thread,2) = 0.0; } }end_c_loop_all(cell,thread) } } DEFINE_INIT() { /*to make every udmi equal to 0.0*/ } 3*DEFINE_SOURCE{ /*return source = C_UDMI(cell,thread,i)*/; dS[eqn] = 0.0} Last edited by hongzhilin; August 3, 2017 at 09:11. Reason: add my udf |
|
Tags |
add hydrogen, mass source term |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Adding line source term for scalar transport by fvOptions | wayne14 | OpenFOAM Running, Solving & CFD | 8 | June 25, 2019 11:33 |
polynomial BC | srv537 | OpenFOAM Pre-Processing | 4 | December 3, 2016 10:07 |
Problem adding a source term in interfoam's alphaEqn.H | Quentin | OpenFOAM Running, Solving & CFD | 1 | July 30, 2014 06:33 |
Problem compiling a custom Lagrangian library | brbbhatti | OpenFOAM Programming & Development | 2 | July 7, 2014 12:32 |
DecomposePar links against liblamso0 with OpenMPI | jens_klostermann | OpenFOAM Bugs | 11 | June 28, 2007 18:51 |