CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   FGM combustion model (http://www.cfd-online.com/Forums/openfoam-programming-development/73210-fgm-combustion-model.html)

Graham81 March 2, 2010 05:54

FGM combustion model
 
Dear all,

Im looking to implement a combustion model (flamelet generated manifold) into OpenFOAM. My question is whether anyone could point me in the right direction as to where I can link a subroutine to an existing solver or where I can add an extra transport equation. Any help is greatly appreciated,

Pieter

hannes March 2, 2010 11:11

Hello,

I have already implemented this. The whole code is here:

http://janus.fms.uni-rostock.de/view...ompositionPdf/

Best regards,
Hannes

Graham81 March 2, 2010 11:21

Wow, that would seriously save me a huge amount of time. Thanks so much!
If I were to use it, is there any article by your hand I can give reference to?
You just made my day,

Pieter


hannes March 2, 2010 14:43

Hello Pieter,

I have presented some details of the implementation and validation results on the OpenFOAM workshop in Milan some time ago:
http://www.openfoamworkshop.org/08/p...nesKroeger.pdf

You might also have a look at this article:
http://dx.doi.org/doi:10.1007/s10494-009-9242-y

Hope this helps so far...

Best regards,
Hannes

Graham81 March 3, 2010 10:03

Dear Hannes,

I read the articles and the main part of the code and this is in fact exactly what Im looking for! Any chance you can send me a zipfile with the code, and give a hint where to add/compile it to OpenFOAM? Ill start building you a statue here in Eindhoven, or maybe buy you a beer if ever you are closeby.

Best regards,

Pieter

hannes March 5, 2010 15:52

Hi Pieter,

the code is written and tested for OpenFOAM-1.5.
You can get the code via subversion. Just change to the $FOAM_SRC directory and checkout by executing the following commands:

> src
> svn co https://janus.fms.uni-rostock.de/svn...tockExtensions --username=gast

When asked for the password just hit the return key.
This will create a directory "LTTRostockExtensions" with the code for a library "libLTTRostockExtensions", for a number of solvers and utilities and some thirdparty programs (cantera and Cuba). The directory also contains a "bashrc" file. This file sets some environment variables that will be needed during the build process. It is intended to be sourced in your "~/.bashrc" just after the OF-bashrc file. To do so, just add the following line at the end of your ~/.bashrc:

source $FOAM_SRC/LTTRostockExtensions/bashrc

Before compiling, you need to make some changes to the LESModel-classes. The changes are in the *.diff files in the "patches" subdirectory. The "ApplyPatches"- script was intended for applying the patches, but I'm not sure if the diff-files are up-to-date and readily applicable to the current OF-1.5-dev files. Just try it.

Once this is done, recompile the OF-LESModels and then execute the Allwmake script in the "LTTRostockExtensions"-directory. This should compile the thirdparty stuff, the library and the applications. Maybe, some applications will fail to compile because of errors. You can ignore the errors, provided that your relevant applications are not affected. You need Cantera and Cuba (only the libraries), the libLTTRostockExtensions.so and the solver "pdfOodles" (eventually simplePdfOodles for large timesteps) and "generateILDM" for generating the FGM tables. Maybe you are also interested in the solver thickenedFlameOodles which models combustion using the Artificially Thickened Flame Approach.

This is the general outline of the build process. I'm not sure if everything will work out of the box, because I haven't touched the code for over a year (I'm not working in the combustion field any more, I'm now doing propellers). So if you encounter problems, just drop me a mail: hannes dot kr at gmx dot de. Furthermore, I will see if I can clean up some sample cases and add them to the repository.

Best regards, Hannes

usergk May 16, 2011 17:03

This is awesome! Are there any tutorial cases (for FGM solver) available as well ??

Thanks so much,
gk

jose_rodrig July 31, 2011 13:57

Hi

I am trying to compile the packages on OpenFOAM-1.5.x

Even though I was able to build the library libLTTRostockExtensions.so, I keep getting the same error when buiding the source for pdfOodles, for example.

The error is
Code:

/home/jrodrig/OpenFOAM-1.5.x/lib/linux64GccDPOpt/libLTTRostockExtensions.so: undefined reference to `Foam::incompressible::LESModel::Deff(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) const'
/home/jrodrig/OpenFOAM-1.5.x/lib/linux64GccDPOpt/libLTTRostockExtensions.so: undefined reference to `Foam::incompressible::LESModel::registerScalarField(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::dimensioned<double> const&)'
/home/jrodrig/OpenFOAM-1.5.x/lib/linux64GccDPOpt/libcompressibleLESModels.so: undefined reference to `Foam::LESfilter::New(Foam::fvMesh const&, Foam::dictionary const&)'
/home/jrodrig/OpenFOAM-1.5.x/lib/linux64GccDPOpt/libLTTRostockExtensions.so: undefined reference to `Foam::compressible::LESModel::registerScalarField(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&)'
/home/jrodrig/OpenFOAM-1.5.x/lib/linux64GccDPOpt/libLTTRostockExtensions.so: undefined reference to `Foam::incompressible::LESModel::sgsFlux(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) const'
/home/jrodrig/OpenFOAM-1.5.x/lib/linux64GccDPOpt/libLTTRostockExtensions.so: undefined reference to `Foam::compressible::LESModel::Deff(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) const'
/home/jrodrig/OpenFOAM-1.5.x/lib/linux64GccDPOpt/libLTTRostockExtensions.so: undefined reference to `Foam::incompressible::LESModel::divSgsFlux(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&) const'
collect2: ld returned 1 exit status
make: *** [/home/jrodrig/OpenFOAM-1.5.x/applications/bin/linux64GccDPOpt/pdfOodles] Error 1

Did anybody build this solvers successfully?

Regards
Jose

jose_rodrig August 2, 2011 05:40

Hi,

Finally, I was able to compile pdfOodles solver.

However, now I am struggling with the generateILDM and generateFGM applications.

A) First I wanna ask which of these 2 apps is suitable to use with pdfOodles to build the flamelet tables.

B) Second, when I compile the source for either app, I keep receiving errors like,

Code:

Make/linux64GccDPOpt/ChemicalSystem.o: In function `ChemicalSystem':
/home/jrodrig/OpenFOAM-1.5.x/src/LTTRostockExtensions/applications/generateILDM/ChemicalSystem.C:157: undefined reference to `Cantera::Constituents::elementIndex(std::basic_string<char, std::char_traits<char>, std::allocator<char> >) const'
/home/jrodrig/OpenFOAM-1.5.x/src/LTTRostockExtensions/applications/generateILDM/ChemicalSystem.C:158: undefined reference to `Cantera::Constituents::elementIndex(std::basic_string<char, std::char_traits<char>, std::allocator<char> >) const'
Make/linux64GccDPOpt/ChemicalSystem.o: In function `Cantera::TransportFactory::factory()':
/home/jrodrig/cantera180/include/cantera/kernel/TransportFactory.h:107: undefined reference to `Cantera::TransportFactory::TransportFactory()'
Make/linux64GccDPOpt/ChemicalSystem.o: In function `IdealGasMix':
/home/jrodrig/cantera180/include/cantera/IdealGasMix.h:23: undefined reference to `Cantera::IdealGasPhase::IdealGasPhase()'
/home/jrodrig/cantera180/include/cantera/IdealGasMix.h:23: undefined reference to `Cantera::GasKinetics::GasKinetics(Cantera::ThermoPhase*)'
/home/jrodrig/cantera180/include/cantera/IdealGasMix.h:25: undefined reference to `Cantera::get_XML_File(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)'
/home/jrodrig/cantera180/include/cantera/IdealGasMix.h:29: undefined reference to `Cantera::buildSolutionFromXML(Cantera::XML_Node&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, Cantera::ThermoPhase*, Cantera::Kinetics*)'
/home/jrodrig/cantera180/include/cantera/IdealGasMix.h:31: undefined reference to `Cantera::CanteraError::CanteraError(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/home/jrodrig/cantera180/include/cantera/IdealGasMix.h:32: undefined reference to `Cantera::GasKinetics::~GasKinetics()'
collect2: ld returned 1 exit status
make: *** [/home/jrodrig/OpenFOAM-1.5.x/applications/bin/linux64GccDPOpt/generateILDM] Error 1

I have flagged all the libraries in <canteraRoot>/lib to my Make/options file.
Also, I could not find the library -lcantera.
I am using cantera-1.8 which was compiled with the BLAS and LAPACK libraries installed on my machine (so I use -llapack and -lblas instead of -lctlapack and -lctblas).

Any thoughts on this?
Somebody that was able to compile this source could give my a hand?

I want to use this solver to test it in a case of Flameless combustion. I would really appreciate some help at this stage since I am doing this work for my thesis and time is running low.

hannes August 2, 2011 06:50

Hi Jose,

A) yes, these two apps generate the chemistry tables. generateFGM was the first approach and generateILDM contains some more methods for chemistry table generation (ILDM, REDIM and FGM). I have only used FGM in my works, the other methods are still construction sites. As far as I remember, you should only need generateILDM.
The table generation with FGM may become a bit cumbersome with varying mixture fraction when the flamelet computations cease to converge. You may need to play with setup parameters and restart generateILDM. Constant enthalpy and constant mixture fraction problems should be no problem.
The PDF integration is then done, when pdfOodles is started (and the resulting higher dimensional table is cached in a file). When you start pdfOodles in parallel, the integration is also done parallelized.

B) I have used cantera-1.7, it is in the "3rdparty" directory. I remember, there were some problems with 1.8 but I'm not sure about the differences.

Best regards, Hannes

jose_rodrig August 2, 2011 13:06

Hi, Hannes

Thanks for your great contribution to OpenFOAM and now, also to me.

I tried to workaround this compilation problem but with no success. The last error message (bellow) seams to point the error to the cantera installation, rather then to your code.
Part of the error message looks like this:

Code:

/home/jrodrig/OpenFOAM-1.5.x/src/LTTRostockExtensions/3rdparty/cantera-1.7.0-cvs/platforms/linux64GccDPOpt/lib/libtransport.a(LiquidTransport.o): In function `Cantera::LiquidTransport::init(Cantera::LiquidTransportParams&)':
LiquidTransport.cpp:(.text+0x4abc): undefined reference to `Cantera::Phase::molecularWeights() const'
LiquidTransport.cpp:(.text+0x4ac9): undefined reference to `Cantera::Phase::molecularWeights() const'
LiquidTransport.cpp:(.text+0x4b3a): undefined reference to `Cantera::DenseMatrix::operator=(Cantera::DenseMatrix const&)'
LiquidTransport.cpp:(.text+0x4b75): undefined reference to `Cantera::DenseMatrix::resize(int, int, double)'

In this excerpt of the error message, it looks like the member functions of classes 'Phase' and 'DenseMatrix', and by that the corresponding headers Phase.h and DenseMatrix.h, were not linked correctly when building LiquidTransport.cpp, used by libtransport.a.

A) Maybe I did a mistake when building cantera. Should I add something more to the preconfig file? Can you provide your preconfig file?

B) Am I supposed to have a libcantera.a (-lcantera) on my $CANTERA_INST_DIR/lib folder?

C) Is there any chance that you had used a slight different version of cantera?

I am using OpenFOAM-1.5.x and cantera-1.7.0-cvs (the one provided in your repository)

Regards
Jose

jose_rodrig August 3, 2011 06:47

Hi

Ok, I was able to compile finally both generateFGM and generateILDM.

However, when I run either I get the message:

Code:

jrodrig@pup:~/OpenFOAM-1.5.x/src/LTTRostockExtensions/applications/generateILDM/GRI1.2$ generateILDM
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct NULL not valid
Aborted

Is this a normal behavior of the program??

How do I use generateILDM??

Regards
Jose

jose_rodrig August 3, 2011 08:28

Ok,

Last problem also solved. I just corrected the input arguments code in main.C.

Now I Get this:

Code:

jrodrig@pup:~/OpenFOAM-1.5.x/src/LTTRostockExtensions/applications/generateILDM/GRI1.2$ generateILDM /*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  1.5.x                                |
|  \\  /    A nd          | Web:      http://www.OpenFOAM.org              |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Exec  : generateILDM
Date  : Aug 03 2011
Time  : 13:25:44
Host  : pup
PID    : 11938
Case  : /home/jrodrig/OpenFOAM-1.5.x/src/LTTRostockExtensions/applications/generateILDM/GRI1.2
nProcs : 1

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time



************************************************
                  Cantera Error!                 
************************************************


Procedure: IdealGasMix
Error:    Cantera::buildSolutionFromXML returned false

Any idea??

Jose

usergk August 3, 2011 20:11

Hi Jose,

I've just started looking into this code, and got a similar error: "undefined reference to `Cantera::Phase:: etc"

How did you get rid of this?

Thanks,
gk

markusrehm August 4, 2011 04:10

Hi Rodrigo,

if I remember correctly this error is due to the missing input file. Cantera usually stores all relevant data (reaction mech, thermo data, transport data) in a cti file. But during execution it expects an xml file which sometimes is created automatically. Create your (xml)-input data manually I think the command should be "ct2ctml *.cti" it is situated in the bin directory of your installation. Next the xml needs to be found by the solver usually this works if you put it into the root dir of your case. Please keep us posted how it worked and maybe you can put a small docu here.

Markus




jose_rodrig August 4, 2011 06:24

Hi gk,

This problem is happening because there are some libraries missing. The "ultimate" way to do this (for me at least) was to add the same compiler options used to build Cantera to the Make/options file, in the generateILDM folder.

Depending on your configuration, the Make/options would look something like this:

Code:

EXE_INC = \
 -g \
 -I$(CANTERA_ARCH_PATH)/include/cantera \
 -I$(CANTERA_ARCH_PATH)/include \
 -I$(CANTERA_ARCH_PATH)/include/cantera/kernel \
 -I$(CANTERA_SRC)/equil \
 -I$(OCTAVE_INC_PATH) \
 -I$(OCTAVE_INC_PATH)/octave \
 -I$(LTTEXT)/libLTTRostockExtensions/lnInclude \
 -I$(FOAM_SRC)/finiteVolume/lnInclude \
 -I$(GSL_DIR)/include \

EXE_LIBS = \
 -L$(GSL_DIR)/lib \
 -L$(CANTERA_ARCH_PATH)/lib \
 -L/home/jrodrig/OpenFOAM-1.5.x/src/LTTRostockExtensions/3rdparty/cantera-1.7.0-cvs/build/lib/x86_64-unknown-linux-gnu \
 -lLTTRostockExtensions -lfiniteVolume \
 limex/LIMEX4_2_Dense.o \
 limex/LIMEX4_2A1.o \
 nleq1/nleq1.o \
 nleq1/zibmon.o \
 nleq1/zibsec.o \
 nleq1/zibconst.o \
 nleq1/wnorm.o \
 nleq1/linalg_nleq1.o \
 eulex/eulex.o \
 -L/usr/lib \
 -Lusr/include/sundials/lib \
 -L$(OCTAVE_LIB_PATH) \
 -loctave -lcruft \
 -L$(CANTERA_ARCH_PATH)/lib \
 -lclib -luser -loneD -lzeroD -lequil -lkinetics \
 -ltransport -lthermo -lctnumerics -lctmath -ltpx \
 -lctspectra -lconverters -lctbase -lsundials_cvodes \
 -lsundials_nvecserial -llapack -lblas -lctf2c \

There is probably more than what the compiler need. But better more than nothing.

Regards
Jose

jose_rodrig August 6, 2011 22:09

Hey Markus,

Thx for your help! I only had the time to rerun it now. Turns out the problem was that the gasId was mismatched with the .cti file and the generateILDMdict.

Now it runs....

....till it crashes again. Again, I might be setting up something badly correctly or somethings are missing.

So, I run generateILDM in a case directory and after it calculates the tables, it gives the following error message:

Code:

Take 40 timesteps    0.0001629      5.132
..............................................................................

Attempt Newton solution of steady-state problem...    failure.

..............................................................................
Take 40 timesteps      0.01374      3.385
..............................................................................

Attempt Newton solution of steady-state problem...    success.

Problem solved on [12] point grid(s).

#0  Foam::error::printStack(Foam::Ostream&) in "/home/jrodrig/OpenFOAM-1.5.x/lib/linux64GccDPOpt/libOpenFOAM.so"
#1  Foam::sigFpe::sigFpeHandler(int) in "/home/jrodrig/OpenFOAM-1.5.x/lib/linux64GccDPOpt/libOpenFOAM.so"
#2  in "/lib/libc.so.6"
#3  in "/home/jrodrig/OpenFOAM-1.5.x/applications/bin/linux64GccDPOpt/generateILDM"
#4  in "/home/jrodrig/OpenFOAM-1.5.x/applications/bin/linux64GccDPOpt/generateILDM"
#5  in "/home/jrodrig/OpenFOAM-1.5.x/applications/bin/linux64GccDPOpt/generateILDM"
#6  at ~/cantera-1.8/installCantera/include/cantera/kernel/Domain1D.h:167
#7  at ~/OpenFOAM-1.5.x/src/OpenFOAM/lnInclude/autoPtrI.H:110
#8  at ~/OpenFOAM-1.5.x/src/OpenFOAM/lnInclude/autoPtrI.H:89
#9  at ~/OpenFOAM-1.5.x/src/LTTRostockExtensions/applications/generateILDM/generationLoop.C:253
#10  at ~/OpenFOAM-1.5.x/src/LTTRostockExtensions/applications/generateILDM/generationLoop.C:266
#11  at ~/OpenFOAM-1.5.x/src/LTTRostockExtensions/applications/generateILDM/main.C:141
#12  __libc_start_main in "/lib/libc.so.6"
#13  in "/home/jrodrig/OpenFOAM-1.5.x/applications/bin/linux64GccDPOpt/generateILDM"
Floating point exception

I ve checked on the file Domain1D.h, mentioned in the error message, and at line 147 it calls the member function
Code:

/// Number of grid points in this domain.
        int nPoints() const { return m_points; }

Do you have any thoughts on the cause of this error??

The generateILDMdict is the following:
Code:

inputFile "smooke46.cti";
gasID "smooke46";

constituentsGivenAs moleNumbers;

fuel 1 (CH4 1.0);

oxidant 2 (O2 1.0 N2 3.76);

majorProducts 2 (CO2 1.0 H2O 2.0);

mixtureFractionBasedOn C;
stoichiometricOxidantFuelMassRatio 17.13;

defaultConservedVariables 3 (p 100000 T 300 phi 1.0);

conservedVariableLoops
(
    {
        variable h;
        start -88000;
        end -84874.1;
        resolution 10;
    }

    {
        variable z;
        start 0.0;
        end 0.05997;
        resolution 10;
    }
);
ILDMgeneratorType FGM;
resolution 50;
progressVariableName CO2;
laminarFlameDomainLength 0.3;
laminarFlameInitialDomainResolution 10;
flsameShift 0.0;

Regards
Jose

simonkrueger November 29, 2011 04:28

Hello Hannes,

unfortunately the svn link isn't working anymore. Is there another way, I can get the files?

Thanks,
Simon

MPJ December 16, 2011 09:30

Quote:

Originally Posted by simonkrueger (Post 333906)
Hello Hannes,

unfortunately the svn link isn't working anymore. Is there another way, I can get the files?

Thanks,
Simon

Hi simon,
the link is not avaible now, have you got these files?
It will be highly apprieciated if somebody give me hint...
thanks.
Oliver

Aklaessen December 20, 2011 07:12

Quote:

Originally Posted by MPJ (Post 336084)
Hi simon,
the link is not avaible now, have you got these files?
It will be highly apprieciated if somebody give me hint...
thanks.
Oliver

If somebody does have these files, could you send it to me as well.
thanks


All times are GMT -4. The time now is 23:35.