CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [Other] Multi species mass transport library [update] (https://www.cfd-online.com/Forums/openfoam-community-contributions/103227-multi-species-mass-transport-library-update.html)

novyno June 14, 2012 05:34

Multi species mass transport library [update]
 
2 Attachment(s)
Dear all,

I'm happy to release an updated version of multi species mass transport library based on "Novaresio V., Garcìa-Camprubì M., Izquierdo S., Asinari P., Fueyo N., An Open-Source Library for the Numerical Modeling of Mass-Transfer in Solid-Oxide Fuel Cells, Computer Physics Communications, Elsevier B.V., pp. 22, 2011, Vol. 183, pag. 125-146, ISSN: 0010-4655, DOI: 10.1016/j.cpc.2011.08.003". I'd like to underline that the contribution of all the authors was fundamental (let me say indispensable...) for the theoretical background of this library.

The library is fully integrated with OpenFOAM-1.6-ext (succesfully tested with "clean" version obtained using git clone git://openfoam-extend.git.sourceforge.net/gitroot/openfoam-extend/OpenFOAM-1.6-ext). The diffusivityModels library contains a series of classes to compute binary diffusion coefficients (ChapmanEnskog, Wilke, Fuller, Constant) and Knudsen diffusion coefficien for porous media. The multiSpeciesTransportModels library contains a series of models to compute diffusive fluxes (SchmidtNumber, LewisNumber, FickDilutedMixture, Fick, MaxwellStefan).

There are few differences between this library and the paper. In attached one can find a short documentation that also describes this differences. The library comes with a solver (a modified version of reactingFoam that can use the multi species mass library) and with a simple test case for methane laminar combustion (special thanks to Silvano Pautasso). The ./install script copies and compiles all files respectively in $FOAM_USER/lib, $FOAM_USER/applications and $FOAM_USER/run.

Probably the code still has some bugs. Any suggestion, feedback. correction or further improvement will be appreciated.

Best regards

Valerio

akidess June 14, 2012 06:56

I suggest also putting a link on the wiki: http://openfoamwiki.net/index.php/Main_ContribOther

novyno June 14, 2012 08:24

Dear Anton,

I will follow your suggestion soon.

Many thanks

Valerio

AhmedSamy June 14, 2012 14:11

Library conversion to be compatible with OF-12.1.1
 
Hi All,
that are really good news, but that will be also nice getting able to run the library under OF-2.1.1.

Many will be happy to read the programmer's suggestions regarding this.

BR

niklas June 15, 2012 08:08

Im in the process of updating your library to 2.1.x and I have a small question.

For instance, the correct routine in Fick.C show that there is a slight chance of
making an easy mistake, (without knowing probably)

the inert species mass fraction is grabbed from thermo like this.
// Calculate inert species
volScalarField& yInert = thermo_.composition().Y()[inertIndex_];

which is set to 1 - sum of the first N-1 species, like this
yInert = 1 - yt;

since yt is just calculated in the loop
forAll(this->D_, i)

where D is
D_.setSize(species().size()-1);

and it gets the name
"D_" + species()[i],

so D is 1 less than the number of species

Now...if the inert specie is not placed in the last position in the species list,
the inertIndex will point to the wrong specie and it will use the inertspecie to calculate yt...
so basically everything will be a mess.

why dont you do it like in the YEqn.H where you check the name of the species to see if its the same as
the inert specie name
if (Y[i].name() != inertSpecie)
or
if (i != inertIndex_)

to prevent people from making this mistake and allow the inert specie to be placed anywhere in the species list.

just a thought,
N

novyno June 15, 2012 09:51

Dear Niklas,

you are completely right! Actually the library works only if the inert species occupies the last position. But (and I'm sorry for this) I forgot to mention it.

This implementation is a kind of "misprint" of the firsts code versions . This bug fix was on to my to-do list, but I completely forgot it. I will add it again in my new to-do list!

Many thanks to have discovered (and shared) this problem. Surely it will be useful for all people that want to experiment the library.

Thanks again

Valerio

chenxizh June 19, 2012 22:55

Dear Niklas, I canot open the pdf file after downloaded , can you check the file or send me a copy, many thanks!
my email is suningchen@gmail.com

Quote:

Originally Posted by novyno (Post 366425)
Dear all,

I'm happy to release an updated version of multi species mass transport library based on "Novaresio V., Garcìa-Camprubì M., Izquierdo S., Asinari P., Fueyo N., An Open-Source Library for the Numerical Modeling of Mass-Transfer in Solid-Oxide Fuel Cells, Computer Physics Communications, Elsevier B.V., pp. 22, 2011, Vol. 183, pag. 125-146, ISSN: 0010-4655, DOI: 10.1016/j.cpc.2011.08.003". I'd like to underline that the contribution of all the authors was fundamental (let me say indispensable...) for the theoretical background of this library.

The library is fully integrated with OpenFOAM-1.6-ext (succesfully tested with "clean" version obtained using git clone git://openfoam-extend.git.sourceforge.net/gitroot/openfoam-extend/OpenFOAM-1.6-ext). The diffusivityModels library contains a series of classes to compute binary diffusion coefficients (ChapmanEnskog, Wilke, Fuller, Constant) and Knudsen diffusion coefficien for porous media. The multiSpeciesTransportModels library contains a series of models to compute diffusive fluxes (SchmidtNumber, LewisNumber, FickDilutedMixture, Fick, MaxwellStefan).

There are few differences between this library and the paper. In attached one can find a short documentation that also describes this differences. The library comes with a solver (a modified version of reactingFoam that can use the multi species mass library) and with a simple test case for methane laminar combustion (special thanks to Silvano Pautasso). The ./install script copies and compiles all files respectively in $FOAM_USER/lib, $FOAM_USER/applications and $FOAM_USER/run.

Probably the code still has some bugs. Any suggestion, feedback. correction or further improvement will be appreciated.

Best regards

Valerio


niklas June 20, 2012 08:27

Sorry, but I cannot read the pdf either. It says its damaged.

jose_rodrig July 17, 2012 06:18

Dear Niklas,
Did you manage to update Novaresio's library into OF 2.1.x? I'd be really interested on it. Does it use cantera for the transport properties?
Regards
Jose

jose_rodrig July 17, 2012 06:21

Quote:

Originally Posted by novyno (Post 366425)
Dear all,

I'm happy to release an updated version of multi species mass transport library based on "Novaresio V., Garcìa-Camprubì M., Izquierdo S., Asinari P., Fueyo N., An Open-Source Library for the Numerical Modeling of Mass-Transfer in Solid-Oxide Fuel Cells, Computer Physics Communications, Elsevier B.V., pp. 22, 2011, Vol. 183, pag. 125-146, ISSN: 0010-4655, DOI: 10.1016/j.cpc.2011.08.003". I'd like to underline that the contribution of all the authors was fundamental (let me say indispensable...) for the theoretical background of this library.

The library is fully integrated with OpenFOAM-1.6-ext (succesfully tested with "clean" version obtained using git clone git://openfoam-extend.git.sourceforge.net/gitroot/openfoam-extend/OpenFOAM-1.6-ext). The diffusivityModels library contains a series of classes to compute binary diffusion coefficients (ChapmanEnskog, Wilke, Fuller, Constant) and Knudsen diffusion coefficien for porous media. The multiSpeciesTransportModels library contains a series of models to compute diffusive fluxes (SchmidtNumber, LewisNumber, FickDilutedMixture, Fick, MaxwellStefan).

There are few differences between this library and the paper. In attached one can find a short documentation that also describes this differences. The library comes with a solver (a modified version of reactingFoam that can use the multi species mass library) and with a simple test case for methane laminar combustion (special thanks to Silvano Pautasso). The ./install script copies and compiles all files respectively in $FOAM_USER/lib, $FOAM_USER/applications and $FOAM_USER/run.

Probably the code still has some bugs. Any suggestion, feedback. correction or further improvement will be appreciated.

Best regards

Valerio

Dear Valerio,
Could you kindly re-upload the pdf file you posted on the 1st post to this thread? The original seems to be corrupt.
Thank you!
Regards
Jose

wyldckat July 17, 2012 16:18

1 Attachment(s)
Greetings to all!

Well, this was funny... guess what: the 1st PDF file is in fact a DVI file!!!

I opened it easily with Ubuntu's default "Document Viewer" from the Evince authors and was finding it strange that everyone wasn't able to open it. So I then tried with Gimp and it did complain about the bad PDF file.
Tried with pdfedit to open it, same problem. pdf2ps, same deal.

So I then did what I usually do: open the file with a text editor (or hex editor, if necessary) and saw several bytes then something about "TeX" and more bytes... so I then tried dvipdf et voilà, there you have it, the real PDF :D :cool:

Have fun!
Bruno

jose_rodrig July 17, 2012 16:52

LOL... funny

Thanks Bruno! Looks much better now!

jose_rodrig July 19, 2012 07:20

Hi Again everyone!
I managed to compile Novaresio's library and the modifiedReactingFoam solver.
Now I want to set up a new simulation with Smooke's chemistry scheme but the library needs addtional info in the transportDictionary, namely the collision diameter and the characteristic Lennard-Jones energy of each involving species, to compute the binary diffusion coefficient.

I found in Novaresio's paper the some of these data is tabulated in "Hirshfelder et al., Molecular Theory of Gases and Liquids". However, neither the values he has in example case (supplied with the library) correspond to the ones in the former reference (despeite units), nor I am able to find data for all the species, namely, OH, H2O2, H, O, HCO, etc.

Does anybody have any idea where can I find this data?
Novaresio, could you enlighten me on this? Where did you get your data?

Regards everyone!

mturcios777 July 19, 2012 11:55

I've been monitoring this thread and am quite interested in experimenting with it. Jose, other than Niklas' comment about the inert species, were there any other fixes required to get it running in 2.1.x? From your earlier comments it appears you were gunning for that.

Thanks!

jose_rodrig July 19, 2012 12:02

Quote:

Originally Posted by mturcios777 (Post 372425)
I've been monitoring this thread and am quite interested in experimenting with it. Jose, other than Niklas' comment about the inert species, were there any other fixes required to get it running in 2.1.x? From your earlier comments it appears you were gunning for that.

Thanks!

Well, I actually managed to compile it under OF-1.6-ext and not OF-2.1.x. My bad!

If you have any news on this please report them. I am very much interested on it. Anyways, if I have the time and patience, I will try to do it myself.

Regards

mturcios777 July 19, 2012 12:08

No worries. I'm sure Niklas would have mentioned something else had he come across it. I've done work with both versions and have some experience adapting between the two, so maybe I'll also tackle it if I find the time (been working on polyTopoChangers in 21x and that's been taking a LOT of time).

Cheers

jose_rodrig July 19, 2012 12:36

Hi Again

I am getting a strange error with modifiedReactingFoam solver:

If I try to use a Chemkin file as input for chemical scheme I get this error:

Quote:

Create time

Create mesh for time = 0

Reading chemistry properties


Reading g

Reading thermophysicalProperties
Selecting psiChemistryModel ODEChemistryModel<gasThermoPhysics>
Selecting thermodynamics package hsPsiMixtureThermo<reactingMixture<gasThermoPhysic s>>
Selecting chemistryReader chemkinReader
Selecting chemistrySolver ode
ODEChemistryModel: Number of species = 5 and reactions = 1
Reading field U

Reading/calculating face flux field phi

Creating turbulence model.

Selecting turbulence model type laminar
Creating field DpDt



--> FOAM FATAL ERROR:
C7H16 not found in table. Valid entries:
12
(
OH
N2
CO2
H2O2
O2
H2
CH4
HO2
O
H2O

H
)


From function HashTable<T, Key, Hash>::operator[](const Key&)
in file /data/CFD/OpenFOAM/OpenFOAM-1.6-ext/src/OpenFOAM/lnInclude/HashTableI.H at line 111.

FOAM exiting
I wonder what this is...
You can replicate this (i guess) by simply replacing the chemkin file (chem.inp) used in the dieselFoam tutorial distributed with OF by the chemistry used in the modifiedReactingFoam test case. Everything else is untouched.

Cheers

mturcios777 July 19, 2012 12:38

I think you also need the therm.dat file to get the thermophysical data for C7H16. chem.inp and therm.dat are tied closely together. Check to see if C7H16 is missing from your therm.dat.

jose_rodrig July 19, 2012 13:48

Nop, C7H16 is there.
That's why it's really strange. I have no idea why that table has those species loaded. H2, CH4, OH, H2O2 are not even in the reaction file. So it makes no sense that they are in the table. Did you try to replicate the set up?

jose_rodrig July 20, 2012 03:44

Quote:

Originally Posted by jose_rodrig (Post 372451)
Nop, C7H16 is there.
That's why it's really strange. I have no idea why that table has those species loaded. H2, CH4, OH, H2O2 are not even in the reaction file. So it makes no sense that they are in the table. Did you try to replicate the set up?

I tried to use reactingFoam instead of modifiedReactingFoam and I didnt got the error. So I guess the problem is with the multispecies mass diffusion library. Maybe this table is hardcoded with this species. I will try to investigate the code.

cheers


All times are GMT -4. The time now is 16:58.