CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Pollutant dispersion in the environment (https://www.cfd-online.com/Forums/openfoam-solving/58865-pollutant-dispersion-environment.html)

alberto June 11, 2005 11:33

Hello, I would like to model
 
Hello,
I would like to model the dispersion of pollutants (non-reacting) in the environment (air).

The air flow is described as a turbulent ideal gas. Species transport is described with the usual set of y equations. Species properties should be user-defined.

I'm not familiar with the species transport model in OpenFOAM.
I had a look to dieselFoam, but I have some doubt on how to manage species in OpenFOAM.
Is there some example where this is shown?

Thank you for your attention.
Alberto

OpenFOAM discussion board administrator June 11, 2005 11:59

Take a look at scalarTransport
 
Take a look at scalarTransportFoam which shows the implementation of a simple passive scalar in a fixed flow field. However probably the best example is the ft equation in the combustion codes (XiFoam, engineFoam), take a look at ftEqn.H which is a simple transport equation for a passive scalar (ft) in the turbulent flow-field.

alberto June 11, 2005 21:12

Thank you for your answer. My
 
Thank you for your answer.
My problem is not with the transport equation, but with the managment of a mixture of more than two components.

If I'm not wrong, I found something similar to what i need in the YEqn.H of dieselEngineFoam and in reactingFoam, where a set of Yi equation is solved.

What I don't understand is how species are defined and how their properties (for example, laminar diffusivity, which doesn't seem to be anywhere http://www.cfd-online.com/OpenFOAM_D...part/happy.gif) are passed to the solver.

dieselFoam reads from a CHEMKIN file, but can species be defined without using it? If so, how?

If I didn't misunderstand, in dieselEngineFoam, and similarly in XiFoam, the following lines should do the job reading from the thermophysicalProperties dictionary:

Info<< nl << "Reading thermophysicalProperties" << endl;
autoPtr<hcombustionthermo> thermo
(
hCombustionThermo::New(mesh)
);

combustionMixture& composition = thermo->composition();
ptrList<volscalarfield>& Y = composition.Y();

word inertSpecie(thermo->lookup("inertSpecie"));

But in that dictionary there are the definitions of the fuel, oxidant, ... with parameters which are not required in my case.

I just have one or more non-reacting species, and I need to set the basic transport properties (laminar diffusion included).

Is there a way to manage it, or is it something to be implemented?

Best regards,
Alberto

niklas June 12, 2005 04:33

Hi, in diesel(Engine)Foam t
 
Hi,

in diesel(Engine)Foam the Schmidt number is assumed to be 1, i.e mass-diffusion equals the momentum diffusion. Hence, its not necessary to define the diffusion for the species.

Since laminar diffusion is much smaller than the turbulent diffusion this is acceptable for these codes. So if you want to specify your own laminar diffusion you have to so yourself.
You're solving for a turbulent flow, so i would say that the Sc=1 assumption holds pretty well for you also, but if you want to have something else you could add the division of user defined Sc-number for each specie.

The chemkin file specifies the NASA polynomial coefficients for the species, have a look at for instance this page http://diesel.me.berkeley.edu/~gri_m...nasa_plnm.html
, if you want to know more about what they do.
They are only necessary for calculating the temperature from the enthalpy and if you have a non-reacting environment with a constant temperature you dont need to define this.

Then you could just skip the thermo-stuff and define the Yi's yourself as a ptrList<volscalarfield>.

N

alberto June 12, 2005 08:32

Thank you Niklas. The assum
 
Thank you Niklas.

The assumption of using only the turbulent diffusion is OK in my case in an open environment, where the wind plays the biggest role. I don't think so in a closed one.

Temperature is not necessarily constant, expecially in the case of pollutants released as a consequence of accident, so I need to solve the energy equation. Usually gases are supposed to be ideal however.

Alberto

segersson June 23, 2005 13:47

Alberto, I think you and I ar
 
Alberto,
I think you and I are trying to solve similar problems. However, I'm still trying to get the wind field right and haven't included dispersion of species (I will as soon as I'm satisfied with the wind field simulations). It would be interesting to hear of your exepriences when your ready.

Regards
David

alberto June 23, 2005 16:49

Sure David. I didn't implem
 
Sure David.

I didn't implement the wind profile. However there are two threads on inlet profiles here:

http://www.cfd-online.com/OpenFOAM_D...ages/1/42.html

http://www.cfd-online.com/OpenFOAM_D...ages/1/63.html

I will move them to the wiki (The links to the code in these threads are not active, please, can someone send the snipplet so I can add them to the wiki? Feel free to use my email alberto.passalacqua@tin.it ).

The species transport equation are quickly implemented, expecially if you neglect the laminar diffusion (It seems your case). All this is still done in dieselFoam and reactingFoam.

I had to add the laminar diffusion for a particular application, but it was easy because I was considering a single pollutant in the air.
I have some time in these days, I will work a bit on the wiki and I could clean the code. Feel free to e-mail me.

segersson July 7, 2005 17:36

Thank you Alberto! You have d
 
Thank you Alberto!
You have definitely saved me some work. I'll try to follow your example as soon as I'm redy with the wind simulations.

I'm trying to introduce vegetation in my wind simulations (as a drag term in the momentum equation). I've done it before using Fluent, so I'm quite sure it will work out fine. The trickiest part seems to the initialization of the vegetation data field..
If you are interested I'll send you the code when I'm ready.
Regards
David

alberto July 7, 2005 17:56

Yes it would be very useful to
 
Yes it would be very useful to see the code and to put it on the wiki.

For initialization, there is an example of patching utility in the manual, where the dam break is presented.

I plan to add multiple species diffusion as soon as I have some time. However, if you need the code, I can send it to you.

Regards,
Alberto

alberto August 2, 2005 21:24

Hello, I'm trying to add mult
 
Hello,
I'm trying to add multiple species to the solver but I have some doubt on the usage of the ptrList.

I defined a ptrList of volScalarField and I called it Y. How can I set the MUST_READ and the AUTO_WRITE options for the whole list of fields?

Also, I have to read a list of diffusivities from a dictionary, and store it in a vector of scalars.
I was thinking to define a prtList<dimensionedscalar> Dl and to fill it by reading from the dictionary, but I'm not sure how I can do it. Is something like

ptrList<dimensionedscalar> Dl
(
speciesProperties.lookup("Dl");
);

possibile?

Thanks in advance for your answer,
Alberto

niklas August 3, 2005 03:11

Hi, Have a look in OpenFOA
 
Hi,
Have a look in
OpenFOAM/OpenFOAM-1.2/src/thermophysicalModels/combustion/mixtureThermos/mixture s/combustionMixture/combustionMixture.C

There we define a default-field, which is used to set every specie that is not defined.
Typically we just want to set N2, O2 and use the default-setting for the rest.

N

alberto August 3, 2005 22:06

Thank you Niklas. Defining
 
Thank you Niklas.

Defining a speciesTable, I can store the names of the species (I don't actually need this, but it makes the solver more user-friendly and the results easier to be read) and use its size to set the species ptrList size and set the Yi fields and their options.

Now, the speciesTable constructor requires a wordList as argument, containing the species names. I tried to read it from the speciesProperties dictionary using:

wordList speciesNames
(
speciesProperties.lookup("speciesNames");
);

but the solver doesn't compile giving errors.

Is there any way to read a list from a dictionary in OpenFOAM?

P.S. Hehe OpenFOAM/OpenFOAM-1.2/src/... ;-)

niklas August 4, 2005 04:28

Hey, If you get a compiler
 
Hey,

If you get a compiler error it would be useful to see it, however, the semi-colon after speciesProperties should be removed if you have copy/pasted your code.

also you dont need a ptrList for the diffusivities,
a simple List<...> should work, i'm not sure if the ptrList will work.

N

alberto August 4, 2005 13:49

Sorry. It's a typo again. The
 
Sorry. It's a typo again.
The actual code is:

List<dimensionedscalar> Dl
(
speciesProperties.lookup("Dl")
); //This is line 58 in createFields.H

but the error is the same.

mattijs August 4, 2005 14:07

List of anything requires the
 
List of anything requires the anything to have a null constructor (which dimensionedScalar does not have)

Use ptrList in combination with hook(...) to create an indexable list. There should be some examples already posted.

alberto August 4, 2005 15:19

OK. But hook() just adds an el
 
OK. But hook() just adds an element at a time to the ptrList.

What I'd like to do is to let the user set the number of species, their name and then insert the diffusivities.
The speciesTable manages the names of the species, and I was thinking to store the ordered list of diffusivities in a list like

Dl
(
Dl_0
Dl_1
Dl_2
...
);

in the speciesProperties dictionary.

Now, if I use the ptrList, the problem of reading the list remains.

Regards,
Alberto

mattijs August 4, 2005 16:15

I see your problem. 1. exte
 
I see your problem.

1. extend dimensionedScalar to have a clone and INew functions so it can be used with ptrList.

2. define your own class that reads all the info and can be used in a ptrList/List and then construct List<dimensionedscalar*>

(and make sure you delete any allocated dimensionedScalars)

rbw October 5, 2005 11:03

Hello Alberto & David, I'm
 
Hello Alberto & David,

I'm also interested in pollutant dispersal in the atmosphere, and I'm re-implementing your work described above.

One thing I'd like to wonder aloud, though, is that, as far as I can see, a model using OpenFOAM would be realistic only for short(ish) distances, no?

I think (this *really* is not my area, so please correct me if I'm wrong) that the turbulence in the atmosphere is not only due to the friction with the ground, which OpenFOAM can model easily, but mostly due to the stability conditions of the atmosphere, which, even though it's all cfd in end, would need *a lot* more input and physics that we (I at least) would be willing to add.

Not so long ago, I checked the Weather Research and Forecast Model (http://www.wrf-model.org/index.php), which I thought could be a nice basis for this kind of work (fortran 90, though, I think.) I'll do this when I buy a clone of myself to get some extra free time...

alberto October 7, 2005 07:50

Hello, dispersion models toge
 
Hello,
dispersion models together with k-eps turbulence models are commonly used to predict the diffusion of pollutants in limited portions of athmosphere like a part of a city where an accident happened and so on.
They are adopted in specific codes like FLACS too.

Alberto

rbw October 7, 2005 16:23

Hi Alberto, I should certai
 
Hi Alberto,

I should certainly hope so, since I'm doing the very thing myself!

I'm just curious about the range where atmospheric turbulence starts to be more relevant. I'm not sure I'd feel too confortable with a simple k-epsilon model at distances over one kilometer (a nice round number http://www.cfd-online.com/OpenFOAM_D...part/happy.gif. Are there any guidelines for this?


All times are GMT -4. The time now is 06:56.