CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Verification & Validation

Validation: Hydrogen Mass Comparison

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

Like Tree3Likes
  • 1 Post By Tobermory
  • 1 Post By Tobermory
  • 1 Post By Tobermory

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 30, 2025, 17:33
Default Validation: Hydrogen Mass Comparison
  #1
New Member
 
Join Date: Aug 2025
Posts: 7
Rep Power: 2
HailTheChicken is on a distinguished road
Hello everyone,

I am currently working on a simulation for my Bachelor thesis and therefore i need to do several validation tests. One of them is this one.

The project is going to simulate a lineartribometer with hydrogen injection. So i need to simulate the airflow and the hydrogen injection, since i want to know how much hydrogen gets to the probe.

Ok, now for the validation i simplified the BCs and disabled the airflow, since i only wanted to measure the hydrogen mass in the system over time and see how it compares to a simple analytical solution.

The analytical approach is straightforward:

𝑚(&#119905=𝑉dot⋅𝑡⋅𝜌

with

𝑉dot=10^−5m3/s
𝜌=0.0899kg/m3
Temperature fixed at 20 °C

For the measurement in the simulation i used this:

make_rhoH2
{
type multiply;
functionObjectLibs ("libutilityFunctionObjects.so");
enabled true;

outputControl timeStep;
outputInterval 1;

fields (rho hydrogen);
result rhoH2;

storeInObjectRegistry false;
writeFields false;
writeToFile false;
}

H2mass
{
type volFieldValue;
functionObjectLibs ("libfieldFunctionObjects.so");
enabled true;

outputControl timeStep;
outputInterval 1;

log true;
writeFields false;
writeToFile true;
select all;

fields
(
rhoH2
);

operation volIntegrate;
}


However, the results show a clear divergence between the analytical and the simulation data (see attached figure).

Question: What is it i could have done wrong?

Thank you very much for your support!
Attached Images
File Type: jpg Massevergleich.jpg (58.9 KB, 9 views)
HailTheChicken is offline   Reply With Quote

Old   December 14, 2025, 06:03
Default
  #2
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 894
Rep Power: 19
Tobermory will become famous soon enough
Well, the devil is in the detail. The bit that you are missing, perhaps, is that the pressure in the domain (which I am assuming is closed, i.e. has an inlet but no outlet) rises as you inject the hydrogen ... which changes the density in the domain.

Now, from your charts, it is clear that the rate of mass injection is not constant in your simulation ... in fact it seems to be rising slowly with time. That would make sense if you used a constant volume injection boundary conditions (eg flowRateInletVelocity and setting "volumetricFlowRate") - with that BC, you can specify a density in the BC, but the code just treats the BC as a fixed velocity injection, and uses the patch density to calculate the patch mass flow rate (check the code). The patch density is extrapolated from the field density. So with a constant volume injection, one would expect a rising mass injection as the domain density rises.

Your analytical model assumes a constant mass injection, which is why you have a perfectly straight line, i.e. you are comparing apples and pears.
HailTheChicken likes this.
Tobermory is offline   Reply With Quote

Old   January 6, 2026, 07:43
Default
  #3
New Member
 
Join Date: Aug 2025
Posts: 7
Rep Power: 2
HailTheChicken is on a distinguished road
Hi Tobermory, thank you for your reply.

I attached a picture with the bcs of the domain. Its mostly open, with walls on top and on the bottom.
And i attached a graph of the velocity next to one hydrogen inlet measured with the probe function. Not exactly at the hydrogen bc.

I dont know why the inlet velocity seems to fluctuate this much.
Since i want to know the hydrogen content next to a certain line in the simulation, i wanted to show that the hydrogen mass correlates with a simple analytic calculation.
The airflow coming from the airInlets is folowing a sine function to simulate a moving piston. They work as outlets at negative values.

But why does it flucuate? Its a fixedValue with a 1,623m/s hydrogen stream.
Attached Images
File Type: png Screenshot 2026-01-06 121719.png (107.0 KB, 5 views)
File Type: jpg Screenshot 2026-01-06 122156.jpg (47.3 KB, 2 views)
HailTheChicken is offline   Reply With Quote

Old   January 6, 2026, 14:34
Default
  #4
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 894
Rep Power: 19
Tobermory will become famous soon enough
Well, solutions can fluctuate - either due to a physical transient oscillation (jets often waggle; vortex shedding; etc etc.), or due to instability in the CFD solution (i.e. unphysical effect). Impossible to tell here without digging into the simulation details, but here are some things to think about:

1. Do you expect any flow unsetadiness for your scenario? Do you have expt data for a similar scenario to confirm?

2. If you are sure that the flow is steady, then you need to look at your solver setup ... if running as steady state, then typical remedies might be to increase the under-relaxation; run 1st order divSchemes and then change to 2nd order; improve the mesh; apply increased turbulence levels at the inlets, and then maybe relax back to "Normal" values once the solution is well converged and see if the convergence remains. If running as transient, then adjust your time step, and try some of the other remedies listed above.

Hope that helps - good luck.
HailTheChicken likes this.
Tobermory is offline   Reply With Quote

Old   January 6, 2026, 18:40
Default
  #5
New Member
 
Join Date: Aug 2025
Posts: 7
Rep Power: 2
HailTheChicken is on a distinguished road
Hi,

thanks for your input!

Its an transient simulation.

Sadly i have no experimental data for this simulation. But i dont think at first glance i would expect such a behavior. But from what i seeing the slowest velocity occurs everytime the airflow reaches its maximum. So it seems like the air is impeding the hydrogen. Something i didnt think would happen considering the fixedValue Bc.
Outside of a simulation i think its realistic to assume this velocity is influenced by the speed of the airflow its hitting.

I mean this behavior is fine as long as a can explain why its happening. This i cannot as of right now.
HailTheChicken is offline   Reply With Quote

Old   January 7, 2026, 07:15
Default
  #6
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 894
Rep Power: 19
Tobermory will become famous soon enough
How close to the inlet is your probe? If it is far downstream, or if the inlet jet is deflected then your probe may not be in the centre of the jet? I guess you've alreadfy checked that. Incidentally, you can get OF to output the actual flow rate through each inlet using a function object (flowRatePatch in OF13 ... not sure what version you are using, but there will be a similar function). This might be worth checking.

If the inlet flow rate is really fluctuating, then agreed - this sounds odd for a fixedValue BC. Can you post your 0/U 0/p 0/prgh and 0/T files? There might be something in there that I or someone else can spot that's funny.
Tobermory is offline   Reply With Quote

Old   January 11, 2026, 18:23
Default
  #7
New Member
 
Join Date: Aug 2025
Posts: 7
Rep Power: 2
HailTheChicken is on a distinguished road
Hi,

The first probe in the Uprobes.txt is located next to the air inlet.

The domain is 0,0027m high with the second probe 0.000001m below the hydrogen inlet. Here you can see the fluctuating Uy.

The third probe sits directly at the hydrogen inlet. Which shows the Uy= -1.623m/s from the U file.

In the Uprobes u can see the velocity difference that happens within this pretty small distance.

I try to attach the other files too.
Attached Files
File Type: txt Uprobes.txt (13.6 KB, 1 views)
HailTheChicken is offline   Reply With Quote

Old   January 13, 2026, 12:42
Default
  #8
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 894
Rep Power: 19
Tobermory will become famous soon enough
Okay, so the probe in the H2 inlet shows a steady velocity, but as you move away from the inlet plane the jet velocity becomes more erratic - see my chart of your data below.

That's as expected, I think, given that H2 is so much lighter than the air that it is trying to penetrate. Check your Courant number, turbulence model, mesh resolution, but otherwise I think the code is behaving asa expected?
Attached Images
File Type: jpg Picture1.jpg (72.0 KB, 4 views)
HailTheChicken likes this.
Tobermory is offline   Reply With Quote

Old   January 15, 2026, 18:43
Default
  #9
New Member
 
Join Date: Aug 2025
Posts: 7
Rep Power: 2
HailTheChicken is on a distinguished road
I expected a maxing out of the inlet velovity at highest airspeeds due to static pressure probably being lower at higher velocity. But another proberun with pressure shows lowest h inlet velocity at times of highest pressure. Thats to be expected i think.

But the hydrogen bc doesnt fluctuate (that means it enters the domain nevertheless), so why is my analytical solution diverging so hard from my simulation? Is my analytical approach trash?

My missing explanation for this is my final obstacle.

Courant number is at 0.3. The mesh was choosen with a mesh convergence study.
Attached Files
File Type: txt pProbes.txt (6.6 KB, 1 views)
HailTheChicken is offline   Reply With Quote

Old   January 16, 2026, 04:30
Default
  #10
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 894
Rep Power: 19
Tobermory will become famous soon enough
What is your boundary condition (U, T, p) for the hydrogen inlet(s)? I am guessing that you have a fixedValue for velocity, right? If yes, then all that means is that the volume flow rate of hydrogen into the domain is constant.

Can you please run postProcess to calculate the mass flow rate through the inlets for your latest run (the name of the function object varies I think between OF versions, but should be something like flowRatePatch). This is the key variable. I am guessing that this is fluctuating strongly (because the inlet pressure and therefore density is fluctuating). If that is the case, then it's simply solved by changing the H2 inlet BC to a fixed mass flow condition (eg flowRateInletVelocity).
Tobermory is offline   Reply With Quote

Old   January 16, 2026, 20:05
Default
  #11
New Member
 
Join Date: Aug 2025
Posts: 7
Rep Power: 2
HailTheChicken is on a distinguished road
Here are the the definitions for the hydrogen Inlet:

U: hydrogenInlet
{
type fixedValue;
value uniform (0 -1.623 0);
}

p: hydrogenInlet
{
type fixedValue;
value uniform 1e5;
}

T: hydrogenInlet
{
type fixedValue;
value uniform 293.15;
}

very standard bcs id say

I use velocity for the bc now because it didnt matter to the results.
Ive tried velocity, volumeflow and massflow for the hydrogen inlet. The velocity diagrams all look the same. (Example for mflow in the attatchments)

Ill calculate the mass flow rate of the inlets later this day.
Attached Images
File Type: jpg Bild1.jpg (59.3 KB, 1 views)
HailTheChicken is offline   Reply With Quote

Reply

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
Turbomachinery Mass imbalance sheaker CFX 12 September 5, 2019 09:09
Mass Source application and strange phenomena JPBLourenco FLUENT 0 June 27, 2019 09:36
Multiphase flow - incorrect velocity on inlet Mike_Tom CFX 6 September 29, 2016 02:27
Exit Corrected Mass Flow Rate Mesh Sensitivity Study s__s__s CFX 4 July 20, 2016 12:46
Water subcooled boiling Attesz CFX 7 January 5, 2013 04:32


All times are GMT -4. The time now is 05:38.