CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT

adding hydrogen with source term

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

LinkBack Thread Tools Search this Thread Display Modes
Old   August 3, 2017, 04:24
Default adding hydrogen with source term
New Member
Etienne Lin
Join Date: Aug 2017
Location: la Chine
Posts: 4
Rep Power: 7
hongzhilin is on a distinguished road

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:
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;

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;
C_UDMI(cell,thread,0) = 0.0;
C_UDMI(cell,thread,1) = 0.0;
C_UDMI(cell,thread,2) = 0.0;
C_UDMI(cell,thread,0) = 0.0;
C_UDMI(cell,thread,1) = 0.0;
C_UDMI(cell,thread,2) = 0.0;


/*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 08:11. Reason: add my udf
hongzhilin is offline   Reply With Quote


add hydrogen, mass source term

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On

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 10:33
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 09:07
Problem adding a source term in interfoam's alphaEqn.H Quentin OpenFOAM Running, Solving & CFD 1 July 30, 2014 05:33
Problem compiling a custom Lagrangian library brbbhatti OpenFOAM Programming & Development 2 July 7, 2014 11:32
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51

All times are GMT -4. The time now is 23:04.