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

How to model the mixing of two gases

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 23, 2019, 16:54
Default How to model the mixing of two gases
  #1
Senior Member
 
Join Date: Mar 2018
Posts: 115
Rep Power: 8
anon_q is on a distinguished road
Hello, I have two containers, the first container contains gas 1 and the second contains gas2. the two containers are separated by a thin membrane. at t = 0 this thin membrane is removed and the two gases start to mix.




Could you please give me some hints on how to model this process?
Which solver should I use?
Any similar examples or tutorials?

Thank you
anon_q is offline   Reply With Quote

Old   July 24, 2019, 01:38
Default
  #2
New Member
 
Join Date: Apr 2014
Posts: 24
Rep Power: 12
TobiF is on a distinguished road
Hey,

the easiest way would be to add a new equation for a scalar transport to model diffusion process.

Which solver you use is your choice. I would recommend to start with the pimpleFoam.

For the equation have look on:

HTML Code:
https://en.wikipedia.org/wiki/Convection–diffusion_equation
Regards Tobi
TobiF is offline   Reply With Quote

Old   July 24, 2019, 07:27
Default
  #3
Senior Member
 
Join Date: Mar 2018
Posts: 115
Rep Power: 8
anon_q is on a distinguished road
The transport equation AFAIK is for a single fluid.
My question was about the mixing of two gases as shown in the figure.
anon_q is offline   Reply With Quote

Old   July 24, 2019, 07:53
Default
  #4
New Member
 
Join Date: Apr 2014
Posts: 24
Rep Power: 12
TobiF is on a distinguished road
Understood that...

With the scalar you can imitade a second gas species.

scalar = 0 --> species 01
scalar = 1 --> species 02

0< scalar < 1 --> mixing of the gases.

You can define density, viscosity and so on depending on the scalar (species). And you can also definde diffusion depending on the diffusivity of the species.

Worked for me in a lot of cases and you don't have to set up a second set of navier-stokes-equations and doing the coupling...
TobiF is offline   Reply With Quote

Old   July 24, 2019, 10:09
Default
  #5
Senior Member
 
Join Date: Mar 2018
Posts: 115
Rep Power: 8
anon_q is on a distinguished road
Unfortunately, your post is completely not clear for me.
If you know really how to set up a case why you don't simply just give the steps. I am looking for OpenFOAM solvers that already exist to model this process not to create my own solver.

PS: I am not looking for programming a new solver. I am looking for any OF solver that could solve my problem (What about multiphase solvers).

---

Any answers?!

Last edited by wyldckat; July 27, 2019 at 08:51. Reason: merged posts a day apart
anon_q is offline   Reply With Quote

Old   July 25, 2019, 18:55
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quick answer: rhoReactingFoam if you only want different pressures or densities for each gas; rhoReactingBuoyantFoam if you want to use gravity to influence the flow/gases... in both, you can turn off the combustion modelling, so that they don't react...
anon_q likes this.
__________________
wyldckat is offline   Reply With Quote

Old   July 25, 2019, 21:45
Default
  #7
Senior Member
 
Join Date: Mar 2018
Posts: 115
Rep Power: 8
anon_q is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Quick answer: rhoReactingFoam if you only want different pressures or densities for each gas; rhoReactingBuoyantFoam if you want to use gravity to influence the flow/gases... in both, you can turn off the combustion modelling, so that they don't react...
Thank you very much for your answer
anon_q is offline   Reply With Quote

Old   July 25, 2019, 22:41
Default
  #8
Senior Member
 
Ruiyan Chen
Join Date: Jul 2016
Location: Hangzhou, China
Posts: 162
Rep Power: 9
cryabroad is on a distinguished road
Quote:
Originally Posted by Evren Linda View Post
Unfortunately, your post is completely not clear for me.
If you know really how to set up a case why you don't simply just give the steps. I am looking for OpenFOAM solvers that already exist to model this process not to create my own solver.

PS: I am not looking for programming a new solver. I am looking for any OF solver that could solve my problem (What about multiphase solvers).
Why don't you take some time and check the descriptions of the various solvers in OpenFOAM (https://cfd.direct/openfoam/user-gui...x13-960003.5)? Nobody here will or has the obligations to just give you the steps because each case is different, and I personally think it's much better that you first do some research on your part, then come back with more specific problems.

In terms of your question, have you checked the so-called Volume-of-Fluid (VOF) approach, and the corresponding solvers in OpenFOAM?
cryabroad is offline   Reply With Quote

Old   July 27, 2019, 09:01
Default
  #9
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Quote:
Originally Posted by cryabroad View Post
Why don't you take some time and check the descriptions of the various solvers in OpenFOAM (https://cfd.direct/openfoam/user-gui...x13-960003.5)?
Sorry, but did you read that page?
Quote:
  • reactingFoam
    • Solver for combustion with chemical reactions.
  • rhoReactingBuoyantFoam
    • Solver for combustion with chemical reactions using a density based thermodynamics package with enhanced buoyancy treatment.
  • rhoReactingFoam
    • Solver for combustion with chemical reactions using density based thermodynamics package.
Given that the original question was directed towards:
Quote:
the two gases start to mix
... it's somewhat difficult to connect the dots between using a combustion solver for just mixing gases. And I write this because I've been there myself years ago.

That said, searching online for:
Code:
openfoam mixing gases
should have given a similar answer to mine.


Beyond this, VoF for mixing gases isn't all that great, unless the gases are barely mixable, given that VoF solvers in OpenFOAM usually go for «using a VOF (volume of fluid) phase-fraction based interface capturing approach».
wyldckat is offline   Reply With Quote

Old   July 28, 2019, 04:01
Default
  #10
Senior Member
 
Ruiyan Chen
Join Date: Jul 2016
Location: Hangzhou, China
Posts: 162
Rep Power: 9
cryabroad is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Sorry, but did you read that page?
Given that the original question was directed towards:
... it's somewhat difficult to connect the dots between using a combustion solver for just mixing gases. And I write this because I've been there myself years ago.

That said, searching online for:
Code:
openfoam mixing gases
should have given a similar answer to mine.


Beyond this, VoF for mixing gases isn't all that great, unless the gases are barely mixable, given that VoF solvers in OpenFOAM usually go for «using a VOF (volume of fluid) phase-fraction based interface capturing approach».
I referred to that page simply because I think the descriptions there can really help a lot in clarifying the differences among OpenFOAM solvers, which helps to decide which solver to use. Given that the original question is how to model this process using existing solvers, I think the users' guide is the first thing to check.

I understand that VOF is not that great for mixing problems, and I understand that the combustion solvers (with reactions turned off) may be the better choice. All I'm trying to say is, because we don't know enough details about this mixing process (are the gases mixable? are they compressible? is this a microscale process? etc.), it is very hard to pick a corresponding solver.
cryabroad is offline   Reply With Quote

Old   July 28, 2019, 08:03
Default
  #11
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
@cryabroad: Many thanks for the clarification! Your previous post wasn't this clear, but now it's a lot more understandable. Thanks again!
wyldckat is offline   Reply With Quote

Old   July 28, 2019, 22:02
Default
  #12
Senior Member
 
Ruiyan Chen
Join Date: Jul 2016
Location: Hangzhou, China
Posts: 162
Rep Power: 9
cryabroad is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
@cryabroad: Many thanks for the clarification! Your previous post wasn't this clear, but now it's a lot more understandable. Thanks again!
Maybe I didn't express myself in a better way and that causes confusion. Bottom line is, I'm really interested in this problem (mainly because I'm just very into multiphase problems) and want to see how it goes. I'm not an expert in this particular problem, but I want to throw some ideas out there and see how real experts would like to deal with it.
cryabroad is offline   Reply With Quote

Old   July 29, 2019, 02:40
Default
  #13
New Member
 
Join Date: Apr 2014
Posts: 24
Rep Power: 12
TobiF is on a distinguished road
Have to ask again... u want to model something like in the picture?
Attached Images
File Type: png mixingOfTwoGasspecies.png (108.5 KB, 113 views)
TobiF is offline   Reply With Quote

Old   July 29, 2019, 10:04
Default
  #14
Senior Member
 
Join Date: Mar 2018
Posts: 115
Rep Power: 8
anon_q is on a distinguished road
Quote:
Originally Posted by TobiF View Post
Have to ask again... u want to model something like in the picture?
What you have shown can be easily simulated using for example laplacianFoam. It will be treated like a diffusion problem where the initial distribution of concentration will be a step function.

My question is I want to see some mixing like in real life examples.
anon_q is offline   Reply With Quote

Old   July 30, 2019, 00:04
Default
  #15
Senior Member
 
TWB
Join Date: Mar 2009
Posts: 402
Rep Power: 19
quarkz is on a distinguished road
Hi,

I just saw this question and it seems to be similar in some ways to my question too:

shock tube modelling with 2 gases

As mentioned, I'm trying to model a shock tube which consists of the driver and driven area. The driver and driven area contains helium at high pressure and nitrogen at low pressure respectively. They are separated by a diaphragm, which will rupture at t=0. This is a high speed flow problem with speed reaching 4-5 mach no.

So which solver should I use? I was previously using rhoCentralFoam but can I make it work with 2 gases, assuming no reaction?

I read thru the forum and some suggested rhoReactingFoam or rhoPimpleFoam.

cfdvenkatesh suggested :

"You could use Species Transport model to simulate mixing of 2 different gases. If your application is not IC engine related, I would suggest to use General Species Transport.
In the inlets you can specify the mass fractions for the gases you like."

So which is the more appropriate solver to use?

I am now setting up the case for rhoReactingFoam..

Thanks!
quarkz is offline   Reply With Quote

Old   November 9, 2020, 23:44
Default rhoReactingBuoyantFoam - buoyantReactingFoam
  #16
New Member
 
Join Date: Mar 2019
Posts: 3
Rep Power: 7
chopboy is on a distinguished road
Hi,
I understand this is an old thread, but my problem is similar and I thought I'd ask my question here before starting an entirely new one.

I'm trying to tackle a similar problem of two gases mixing with thermally driven buoyancy, without a lot of success.



rhoReactingBuoyantFoam, which has been superceeded by buoyantReactingFoam in the OpenFOAM dev version, does not appear to handle simulations with combustion turned off well. I am encountering temperature fluctuations in the flow field that are causing my Courant number to spike and the simulation to crash, despite adaptive timesteps, fvOption file limited velocity and temperature.
There is no physical reason for temperatures to rise in my simulation given inlet velocities < 1.2m/s and temperatures <375K. ie, subsonic and low temp with no reactions.
This has been observed before, here:

Temperature increase for gaseous diffusion with rhoReactingBuoyantFoam?
and here: having trouble using reactingFoam with reactions turned off


With a solution presented to re-write the rhoReactingBuoyantFoam solver to "... enforcing the alphaEff -> muEff, ..." - Swagga5aur
Unfortunately I lack the skill set required to compile the file kindly provided by Swagga5aur. I am also reluctant to modify a solver without understanding what impact the changes made to gain stability have on the solution, which I do not at this time.



Is there an alternative solver that will model 2 gasses mixing with buoyancy effects robustly?
As a more permanent solution, is it viable to "fix" the buoyantReactingFoam solver at the source to address the 'instability'*.
chopboy is offline   Reply With Quote

Old   June 15, 2022, 06:58
Default Follow Up
  #17
New Member
 
Join Date: Mar 2019
Posts: 3
Rep Power: 7
chopboy is on a distinguished road
Apologies for once again resurrecting an old thread, but I was asked by a user if I found a solution to this problem and thought I'd post here so hopefully it's useful for others.

Using buoyantReactingFoam is viable for non-reacting fluid mixing with thermally driven buoyancy effects. Turning combustion 'off' in file combustionProperties allows the solver to model the flow without considering chemical reactions, see below.


It's been a while, but I believe my stability issue was caused by inappropriate fvSchemes. If your encountering similar issues I recommend setting Co << 1 in a bid to improve stability initially. If this does not resolve the solution stability, adjust the fvSchemes. My file is below.



Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
combustionModel  none;
// ************************************************************************* //

Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  dev
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

ddtSchemes
{
    default         Euler;
}

gradSchemes
{
    default         leastSquares; //Gauss linear;
}

divSchemes
{
    default         Gauss limitedLinear 1; //none;

    div(phi,U)      Gauss limitedLinearV 1;
    div(phi,Yi_h)   Gauss limitedLinear 1;
    //div(phi,Yi)     Gauss limitedLinear01 1;
    div(phi,K)      Gauss limitedLinear 1;
    div(phid,p)     Gauss limitedLinear 0.8;
    div(phi,epsilon) Gauss linear upwind; //Gauss limitedLinear 1;
    div(phi,k)      Gauss limitedLinear 1;
    div(((rho*nuEff)*dev2(T(grad(U)))))     Gauss linear upwind; //Gauss linear;
}

laplacianSchemes
{
    default         Gauss linear corrected;
}

interpolationSchemes
{
    default         linear;
}

snGradSchemes
{
    default         corrected;
}

fluxRequired
{
p_rgh;
}

wallDist
{
    method meshWave;
}


// ************************************************************************* //
chopboy is offline   Reply With Quote

Old   December 14, 2023, 15:11
Unhappy
  #18
New Member
 
Bruno B W
Join Date: Aug 2023
Posts: 5
Rep Power: 2
brunobw is on a distinguished road
Dear Fomers,
i wonder which solver i should use to model an ethanol pool evaporation and mixing with air in a close enclosure, with a hot celing.
Any directions would be very helpful.
Thanks.
brunobw is offline   Reply With Quote

Old   January 12, 2024, 05:51
Default
  #19
New Member
 
Carmelo Baronetto
Join Date: Dec 2023
Posts: 27
Rep Power: 2
Carmelo98 is on a distinguished road
Quote:
Originally Posted by anon_q View Post
Hello, I have two containers, the first container contains gas 1 and the second contains gas2. the two containers are separated by a thin membrane. at t = 0 this thin membrane is removed and the two gases start to mix.




Could you please give me some hints on how to model this process?
Which solver should I use?
Any similar examples or tutorials?

Thank you
Good morining everyone,
I write in this old thread because I would like to simulate excatly this case.
I used reactingFoam, following these steps:
1) I tested a "real" shocktube problem, with N2 and O2 at different pressure and the the simulation was fine
2) I modified the initial conditions, setting uniform pressure (temperature uniform as in the previous case). However in this simulation, I see no mixing and the N2 and O2 remain unmixed.
I set the turbulance model "laminar", because the velocity field is zero everywhere, but I think the two gases must still mixing.

Does anyone have an idea why I got these results?
Thank you
Carmelo98 is offline   Reply With Quote

Old   January 12, 2024, 09:03
Default
  #20
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 672
Rep Power: 14
Tobermory will become famous soon enough
Yes, there should still be molecular diffusion, even if there is no turbulence. Questions:
1. Have you run it for long enough? Molecular diffusion is slowwww compared to turbulent diffusion. Try calculating a diffusion time scale and compare your run time to that.
2. Are you sure there was absolutely "no" diffusion - if you adjust the scale, are there perhaps some very low concentrations of gas seeping across the line? If so, then this supports the previous question - run for longer and perhaps also refine the mesh at the boundary between the 2 gases.
Tobermory is offline   Reply With Quote

Reply


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
mixing plane model: too much backflow and does not converge sbhi FLUENT 1 December 4, 2014 00:31
Water subcooled boiling Attesz CFX 7 January 5, 2013 03:32
fluid zone in mixing & transport reaction model rahulangal FLUENT 0 June 6, 2010 11:40
multiphase mixing Problem with MRF model in MixSim Srinivas FLUENT 0 October 17, 2005 06:35
Floworks: Mixing and thermal analysis of two gases Jay Nelson Main CFD Forum 0 June 14, 2005 18:29


All times are GMT -4. The time now is 19:28.