CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Tracing a gas in a gas (http://www.cfd-online.com/Forums/openfoam-solving/59147-tracing-gas-gas.html)

lasb August 7, 2007 06:02

Hi, This may be a stupid qu
 
Hi,

This may be a stupid question, but here it comes:

I want to simulate a gasrelease.

How do you control an inlet so it is gas coming in instead of air?

And how do you track the evolution/mixing of the gas with the air?

All help will be much appreciated.

Regards,
Lasse

alberto August 7, 2007 07:52

What you want to do is tracing
 
What you want to do is tracing a passive scalar inside your domain.

To do so, you have to add a transport equation for that scalar to the code you're using and solve for it too.

To manage the boundary conditions, you do as for all other variable. You need to create a file in the 0 directory named as the variable and containing the boundary conditions for the scalar.

You can find al example of this, for more complex applications, in OpenFOAM-1.4/applications/solvers/combustion/reactingFoam

Regards,
Alberto

gschaider August 7, 2007 08:06

Or even easier (if your flow f
 
Or even easier (if your flow field is stationary):
* get a stationary solution with simpleFoam
* use scalarTransportFoam on that to transport non-air
(this assumes, that the injected gas doesn't modify the flo behaviour)

or

* use twoLiquidMixingFoam (but I'm not sure about the assumptions this solver makes)

alberto August 7, 2007 08:38

Yes. Forgot the first possibil
 
Yes. Forgot the first possibility, which is a lot faster.

About twoLiquidMixingFoam, it's a multiphase solver (VOF based) which assumes a diffusivity of a phase into the other to model phase mixing.

Regards,
Alberto

lasb August 8, 2007 04:54

Thanks for the inputs, The
 
Thanks for the inputs,

The scalarTransportFoam is now working with simpleFoam :-)

TwoLiquidMixingFoam is a multiphase solver and assumes diffusivity. That's exactly what I want, but I don't have two different phases. It is a gas mixed with air. And I can't make the assumption that the injected gas does not change the flow behaviour.

Somehow I need to control the injection of the gas, so the inlet is another gas and then see how the flow evolves in time.

Do you think bouyantSimpleFoam does the job?
Anyways, I will look into twoLiquidMixingFoam and bouyantSimpleFoam.

Cheers,
Lasse

alberto August 8, 2007 08:57

Hello, if you inject a gas in
 
Hello,
if you inject a gas into a gas, you have a single phase, so using a multiphase solver is not what you need.

If you inject the gas into the main flow, it brings momentum and mass into the system. That's all. If you use an inlet BC to do the injection, this effect is already taken into account.

Are there temperature gradients in your system? If so, you need to solve the energy equation too.

Regards,
Alberto

pannala August 8, 2007 09:52

Lasse, all you need is the abi
 
Lasse, all you need is the ability to track multiple species (Air and whatever tracer gas you want to track). I am not sure about all the solvers in OF but reactingFoam without reactions will do your job. You do not need a multiphase solver as you still have only one gas phase.

Hope that helps,

Sreekanth

lasb August 8, 2007 09:53

Hi, There is no temperature
 
Hi,

There is no temperature gradient in the system. But the gas injected is 17 times lighter than air so I need to compute a new density in every timeloop.

An inlet Boundary Condition sounds like what I need. Sorry for my ignorance, but how do you customize the inlet so it is a different gas? Or how do I set the physical data for the inlet flow?

Regards,
Lasse

lasb August 8, 2007 09:55

Hi Sreekanth, Thanks for th
 
Hi Sreekanth,

Thanks for the advice. I'll have a look at reactingFoam (without reactions).

Regards,
Lasse

lasb August 16, 2007 10:03

Hi, I'm sorry, but I have t
 
Hi,

I'm sorry, but I have to take this thread up again.

I know how to trace a passive scalar, but I still need to set the thermophysical properties at the inlet so it is another gas.

Do I have to use reactingFoam (without reactions) to do that? Or can another solver do the job?

I can't see how to customise the inlet. I can set the scalarquantity to a value, but that doesn't change the flowbehaviour.

If there's an easier way to do it, I will be glad to know. (reactingFoam looks a little complicated..)

Regards,
Lasse

prashant24983 September 11, 2007 02:15

Well, the suggestion that I fo
 
Well, the suggestion that I found was to add a new scalar trasport equation to buoyantFoam solver. The basic idea is to make a solver similar to buoyantFoam which you can accomplish by copying the base buoyantFoam solver and then extract the relevant parts from scalarTransportFoam and add them to your solver, finally add the transport equation at the end of the time-loop...

As there is no reactions involved, I wouldn't advice you to use reactingFoam. I am working on the same advice, I will paste the solver once I am done!

sradl October 15, 2007 14:30

Dear Prashant, how's your p
 
Dear Prashant,

how's your progress with your buoyantFoam solver including scalar transport?

I'm also interesting in developing a similar solver (injection of a heavy gas into air)- so if we can help with programming/testing we will help.

br
Stefan

prashant24983 October 16, 2007 04:22

Hello Stefan, I have compi
 
Hello Stefan,

I have compiled a software which I believe should work for most heat tranfer problems with different gaseous species. I used buoyantFoam as the base solver and then added the species transport equation to add n number of species as implemented in reactingFoam solver.

I have complied it and it works good for a 2D case but then it stops working in between in a sample 3D case. I was using the chemkin file to add the species properties. But the temprature of janaf thermo keeps going out of range.

Now, I am thinking of using multicomponentMixture class but I still haven't figured out how I should write the thermophysicalproperties for the same case. http://www.cfd-online.com/OpenFOAM_D...tml?1192448636

If you want I can send you the solver and you can have a look at it. May be the problem is not with thermophysicalproperties...

I had adressed the issue about multicomponentmixuture in a different thread but no replies http://www.cfd-online.com/OpenFOAM_D...lipart/sad.gif

Send me your mail ID so that I can forward you the solver. Make sure the mail ID can handle large attachment...

Cheers!
Prashant

lasb October 16, 2007 16:06

Hi Prashant and Stefan, I u
 
Hi Prashant and Stefan,

I used reactingFoam as a solver because it can handle thermophysical properties and mixing of n gases. I turned the solver off by eliminating the reactions from the Chemkinfile. (Don't know if it was necessary if you just say off to reactions.)

It worked and I checked the massbalance (fractions of each gas in each cell summed up to one in all cells) which looked like it should.

I had a similar problem with bouyantFoam with the temperature going out of range.

I'm pretty sure the reactingFoam solver handles the job with heavy gas into air. It worked for me injecting hydrogen into air. (I just mixed oxygen and nitrogen and neglected the small fraction of other species when simulating air.)

If you want I can post the solver, but it's reactingFoam just with no reactions. I used it simulating a hydrogen release in a garage.

Cheers,

-- Lasse

prashant24983 October 16, 2007 23:06

Hello Lasse, ReactingFoam
 
Hello Lasse,

ReactingFoam does serve the purpose, but for the particular case that I was working the temperature range again went out of limits. I had modified my case, shut the chemistry reactions off in reactingFoam and deleted the reactions from chemkin file.

Well from what I understand of your post, I just have to switch off the chemical reactions? The source term in transport equation will become zero and the reactingFoam will be doing exactly what I intend it to do.

If you made some more changes i reactingFoam solver then I would want to give it a look.

For this particular case I manage to get only 10-15 iterations done before the run crashes... I do not understand Janaf thermo. I thought multicomponenetmixture should be good for such cases instead of reactingFoam. But I do not understand how I should implement this class.

In the meantime, I was also wondering if the crash is caused by the the size of mesh? I haven't found a comprehensive explanation of Janaf Thermo and its implementation and it seems there is lot of hacking to be done.

please do send the solver at prashantojha@gmail.com

mrangitschdowcom October 17, 2007 08:32

Hi all, Have you made very
 
Hi all,
Have you made very sure that your boundary conditions are correct? You need to be very sure the mass fractions of all the components sum up to 1.0 exactly. I had no ends of problems with the temperatures running away (for a non-reacting case) that were immediately fixed when I corrected the inlet mass fractions.

Good luck!

Mike Rangitsch

prashant24983 October 17, 2007 08:56

I am using three species, O2,
 
I am using three species, O2, N2 and CO. The mass fraction of O2 is set to 0.3 and 0.7 for N2 except at the source of CO where it is set to zero for both N2 and O2.

The internal field of CO is set to zero while at the CO inlet, the mass fraction is set at 1. Rest all patches are set to zeroGradient boundary condition.


O2

dimensions [0 0 0 0 0 0 0];

internalField uniform 0.3;

boundaryField
{
Vent_inlets
{
type zeroGradient;
}

Smokesource
{
type fixedValue;
value uniform 0;
}

Fans
{
type zeroGradient;
}
Walls
{
type zeroGradient;

}
}


N2

dimensions [0 0 0 0 0 0 0];

internalField uniform 0.7;

boundaryField
{
Vent_inlets
{
type zeroGradient;
}

Smokesource
{
type fixedValue;
value uniform 0;
}

Fans
{
type zeroGradient;
}
Walls
{
type zeroGradient;

}
}

CO

dimensions [0 0 0 0 0 0 0];

internalField uniform 0;

boundaryField
{

Vent_inlets
{
type zeroGradient;
}

Smokesource
{
type fixedValue;
value uniform 1;
}

Fans
{
type zeroGradient;
}
Walls
{
type zeroGradient;

}
}

jason February 11, 2008 08:43

Hi Lasse, I have a similar
 
Hi Lasse,

I have a similar problem to your garage with Hydrogen. I want to release a quantity of H2 into the middle of a square room that has an inlet blowing air in and an outlet where the air/hydrogen mix can escape. There could also be a heat source in the room such as a radiator. I want to to be able to see how the hydrogen mixes with the air and monitor if the mixture in the room ever reaches flammable levels.

I was wondering if you have a small example that I could look at or even a copy of the solver that you mention, any info would be much appreciated.

Many Thanks

Jason

Hyrum November 16, 2009 12:40

Example
 
I also have a similar problem. I would like to trace a methane release into the atmosphere with the ultimate goal of knowing the air/gas mixture at various elevations. I am really new to OpenFOAM but have got my geometry set up already. I would really like to see any examples that might help me or any hints. Could you please forward me anything you sent Jason?

Thanks
Hyrum

OMN June 16, 2010 06:49

Same problem
 
Hello

I have also the same problem. I model a release of methane in a mixture of O2 and N2. I have kept the reactingMixture in the thermophysicalProperties dictionary, and I turn off reactions. But I end up with Janaf errors, where the temperature gets outside the range of the table. Does someone want to help?

Cheers

Olivier


All times are GMT -4. The time now is 21:26.