Gas combustion

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Pablo
Posts: 49
Joined: Thu Sep 04, 2014 11:31 am

Gas combustion

Post by Pablo »

Hello everyone:

After years of use of code_saturne, it is the first time I would like to face a gas combustion simulation, and I have found it seems to be integrated differently from the coal combustion simulations (which can be entirely configured via GUI).
I have found some useful entries in the forum but for older CS versions, and I haven't found any tutorial so that I would like to know if there is any tutorial/exercise for natural gas combustion simulations in CS.

If not, it would also be helpful to know the structure of CS_user subroutines which shall be configured for these kind of combustion simulations.

Regards to everyone.



Pablo
Yvan Fournier
Posts: 4077
Joined: Mon Feb 20, 2012 3:25 pm

Re: Gas combustion

Post by Yvan Fournier »

Hello,

No, there is no tutorial (to my knowledge) for gas combustion.

The gas combustion model has not been used much for combustion applications to my knowledge these last few years, but it is used for fire applications, and has made good progress these last few years. But the main developers of this model do not use the GUI much if I am not mistaken....

The GUI does allow setting up at least a part of the gas combustion model. Which parts are you stuck on ?

Regards,

Yvan
Pablo
Posts: 49
Joined: Thu Sep 04, 2014 11:31 am

Re: Gas combustion

Post by Pablo »

I already has seen most of the configuration for a gas combustion simulation is not able to be configured by using the GUI so it is required to use user subroutines. By the way, most of the information I got is taken from an old forum entry:
http://code-saturne.org/forum/viewtopic ... on&start=0
...as well as the documentation from the program itself. The main concern is I don't know if the information in the forum entry will be entirely useful as the CS version in the entry is diferent from the version I am using (4.0)

According to the documentation and the forum entry (for a 3 points diffusion flame combustion model), some keypoints are relatively clear according to the required subroutines to be edited, so I will try to order them in order to establish a pattern:

According to the forum entry:
  • - usd3pc.f90 --> For the definition of the boundary conditions
    - usini1.f90 --> For the variables initialization.
    - usppmo.f90 --> For the module configuration itself.
According to what I can read in the documentation (and in the examples/references of the SRC folder):
  • - cs_user_boundary_conditions: For the definition of the boundary conditions in nature and values.
    - cs_user_parameter: In this f90 file I can find the following subroutines:
    • * usppmo --> Subroutine to define the use of a certain specific models. In this case, I guess this subroutine shall be configured so that "ippmod(icod3p)=0" to activate the 3 points diffusion flame combustion model.
      • Looking at the "data files" command line, I guess the fuel properties are taken from the "dp_C3P" database looking at the database itself, it seems to be defined for a generic combustion:
        • (C3H8) + (O2) + (N2) => (CO2) + (H2O) + (N2)
        I suppose in case of change the fuel nature for another fuel gas composition, this reaction should be changed accordingly in this file.
      * uspph --> Subroutine for definition of simulation parameters, although I think it could be taken from the GUI unless GUI independence has been nulled in the cs_user_parameter heading. (ixmlpu)
      * cs_user_combustion --> I think it is not required to make any change in the combustion parameters according to the aforementioned parameters. The 8.2.2 paragraphs seems to indicate it is required to complete the cs_user_parameters.f90 with cronological records of the chronological outputs according to the specific physics, which is a long list indeed of variables such as mixing rate "rtp(iel, isca(ifm))", oxidiser mass fraction "propce(iel, ipproc(iym(2)))" etc.
    - There is not any remark about "usini.f90" neither in the documentation nor in the SRC files.
So, I guess the simulation should be defined without GUI by means of load of these f.90 files accordingldy defined as aforementioned.

Am I wrong?


Kind regards,
Yvan Fournier
Posts: 4077
Joined: Mon Feb 20, 2012 3:25 pm

Re: Gas combustion

Post by Yvan Fournier »

Hello,

Actually, most of the configuration should be possible from the GUI. The post you found probably dates to before that functionality was available, so most of it is probably obsolete.

I recommend trying to use the GUI only, and see where the code complains (posting the detailed error messages). We can then solve each issue step by step while using minimal user subroutines.

Best regards,

Yvan
Pablo
Posts: 49
Joined: Thu Sep 04, 2014 11:31 am

Re: Gas combustion

Post by Pablo »

Well, once again, this program makes me feel embarrassed and I have to admit the main source of mistakes is my own clumsiness.
Configuring a gas combustion simulation with the GUI is terribly simple, I have successfully performed several simulations this evening and the only doubt I have comes from the combustion reaction file which need to be configured out from the GUI.

As there is not any tutorial, I think this post may be useful for somebody, so I will write my home-made exercise based on the mesh I attach to this post:

----------------------------------|GAS BURNER TUTORIAL|----------------------------------

First, create the Study/case directory tree with the known "code_saturne create -s" command.
Second, a thermochemistry file is required for the combustion process configuration, which luckily is in the DATA/REFERENCE folder of our previously created case. It is required to be copied this file (dp_C3P) into the DATA folder, where at the end, the .xml configuration file will be placed.
Then, run the Saturne_gui file and edit the simulation as it follows:

NOTE: All what is not literally following defined is kept at its default values.
  • Step 1: Calculation environment
    • Step 1.1: Meshes selection: Load the "Mesh_dense.unv" file into the list of meshes
      Step 1.2: Mesh quality criteria: Press "check mesh" button
    Step 2: Thermophysical models
    • Step 2.1: Calculation features: Select "steady flow" for the Steady/unsteady algorythm and "inifinitely fast chemistry diffusion flame" for the Gas combustion
      Step 2.2: Gas combustion: Select "non adiabatic model" for the Gas combustion option and load the thermochemistry data file (dp_C3P) previously copied into the DATA folder of our study.
      Step 2.3: Radiative model: Select "Discrete ordinates method" and assign an absorption coefficient of 0.8
    Step 3: Physical properties
    • Step 3.1:Gravity: Fill the gz box with a value of "-9.81"
    Step 4: Boundary conditions
    • Step 4.1: Definition of boundary regions: Load the "check_mesh" file create after the mesh checking in step 1.2. Retain only the "CC_IN_GAS", "CC_IN_PRIM" and "CC_OUT" boundary regions and erase all the rest of the loaded regions. Create an additional region with the "Add" button. Assign nature "inlet" to "CC_IN_GAS" and "CC_IN_PRIM" regions, nature "outlet" to "CC_OUT" region and nature "wall" to the newly created region (which shall be named "not(CC_IN_GAS or CC_IN_PRIM or CC_OUT)".
      Step 4.2: Configure every boundary region as it follows
      • CC_IN_GAS
        • mass flow rate = 0.0033
          Gas combustion = Fuel
          Turbulence by hydraulic diameter = 0.07
        CC_IN_PRIM
        • mass flow rate = 0.0632
          direction = user profile. Press the notebook icon and copy the following script:
          • dir_x = 1;
            dir_y = z/sqrt((y^2)+(z^2));
            dir_z = -y/sqrt((y^2)+(z^2));
          Gas combustion = Oxydant
          Turbulence by hydraulic diameter = 0.021
        not(CC_IN_GAS or CC_IN_PRIM or CC_OUT)
        • Thermal radiative transfer = Gray or black wall and profile of fixed internal temperature, Emissivite= 0,8 and Initial temperature=700K
          Turbulence by hydraulic diameter = 0.07
    Step 5: Numerical parameters
    • Step 5.1: Global parameters; set the gradient calculation method to "Least squares method over partial extended cell neighborhood"
      Step 5.2: Equations parameters; set all the variables for the solver precision to 1e-6
      Step 5.3: Pseudo-time step; set the reference time step to 0.01, the number of iterations to 500 and the minimal time step factor to 0.01
    Step 6: Calculation control
    • Step 6.1: Output control; set the log frequency option in the "output control" slider to "output every 'n' time steps" and impose a value of 10. Change to the "writer" slider, select "results" file and change the frequency option to "output every 'n' time steps" and impose a value of 10.
    Step 7: Calculation management
    • Step 7.1: Prepare batch calculation; establish a number of processor as you wish. Save the XML file and press the "Start calculation" button.
----------------------------------| END |----------------------------------

If I have not committed any mistake in transferring the data to this post, the simulation should work.

Now my questions concerns the thermochemistry file, which contains this information:


5 Nb especes courantes
10 Nb de points de tabulation ENTH-TEMP
300. TMIN
3000. TMAX
Especes Gazeuses
C3H8 O2 CO2 H2O N2
.35 .35 .35 .35 .35 coeff absorption (ray)
4 Nb especes elementaires / Composition CHON
.012 3 0 1 0 0
.001 8 0 0 2 0
.016 0 2 2 1 0
.014 0 0 0 0 2
3 Nb d'especes globales (ici : / Fuel / Oxydant / Produits)/ composition en especes elementaires
1. 0. 0. 0. 0.
0. 1. 0. 0. 3.76
0. 0. 3. 4. 18.80
1 Nb de reactions mises en jeu pour les especes globales/stoechiometrie en nb de mole especes globales
1 2 -1. -23.80 25.80


I understand most of the information as it indicates molecular weights and stoichometric relations, but, what is the meaning of the last two lines? ("Nb de reactions mises en jeu pour les especes globales/stoechiometrie en nb de mole especes globales" and the values below)


Kind regards,
Attachments
Comb_gas.xml
(11.49 KiB) Downloaded 265 times
Mesh_dense.tar.gz
Mesh for the gas combustion simulation.
(1.26 MiB) Downloaded 271 times
Yvan Fournier
Posts: 4077
Joined: Mon Feb 20, 2012 3:25 pm

Re: Gas combustion

Post by Yvan Fournier »

Hello,

The next to last line translates to:
"Number of reactions intervening for global species/stoichiometry in number of moles global species"
(sorry, this is not a correct sentence, but the one in French is not clearer)...

I'll ask a colleague who works in fire modelling if he can provide a clearer explaination...

Regards,

Yvan
Pablo
Posts: 49
Joined: Thu Sep 04, 2014 11:31 am

Re: Gas combustion

Post by Pablo »

Hello everyone:

I found the answer by myself in the following old forum entry:

http://code-saturne.org/forum/viewtopic.php?f=2&t=50

...so, now it is easily understandable how to change the thermochemistry data file for a single compound gas combustion simulation.
In summary, the main keypoints are:
  • - Be careful to choose a fuel gathered in the JANAF database that CS uses (code_saturne-4.0.0-rc2/data/thch/JANAF)
    - Define the composition of the flue gases compound based on the stoichiometric relation of the combustion process. ("Nb d'especes globales")
    - Define the total mole amount of consumed fuel (-1), oxidizer (negative moles sum [O2+N2] per 1 mole of fuel) and amount of product (positive moles sum [CO2+H2O+N2] per 1 mole of fuel)
So, as examples:

For propane (C3H8) the file would be:
5 Nb especes courantes
10 Nb de points de tabulation ENTH-TEMP
300. TMIN
3000. TMAX
Especes Gazeuses
C3H8 O2 CO2 H2O N2
.35 .35 .35 .35 .35 coeff absorption (ray)
4 Nb especes elementaires / Composition CHON
.012 3 0 1 0 0
.001 8 0 0 2 0
.016 0 2 2 1 0
.014 0 0 0 0 2
3 Nb d'especes globales (ici : / Fuel / Oxydant / Produits)/ composition en especes elementaires
1. 0. 0. 0. 0.
0. 1. 0. 0. 3.76
0. 0. 3. 4. 18.80
1 Nb de reactions mises en jeu pour les especes globales/stoechiometrie en nb de mole especes globales
1 2 -1. -23.80 25.80


For methane (CH4) the file would be:
5 Nb especes courantes
10 Nb de points de tabulation ENTH-TEMP
300. TMIN
3000. TMAX
Especes Gazeuses
CH4 O2 CO2 H2O N2
.35 .35 .35 .35 .35 coeff absorption (ray)
4 Nb especes elementaires / Composition CHON
.012 1 0 1 0 0
.001 4 0 0 2 0
.016 0 2 2 1 0
.014 0 0 0 0 2
3 Nb d'especes globales (ici : / Fuel / Oxydant / Produits)/ composition en especes elementaires
1. 0. 0. 0. 0.
0. 1. 0. 0. 3.76
0. 0. 1. 2. 7.52
1 Nb de reactions mises en jeu pour les especes globales/stoechiometrie en nb de mole especes globales
1 2 -1. -9.52 10.52


For hydrogen (H2) the file would be:
5 Nb especes courantes
10 Nb de points de tabulation ENTH-TEMP
300. TMIN
3000. TMAX
Especes Gazeuses
H2 O2 CO2 H2O N2
.35 .35 .35 .35 .35 coeff absorption (ray)
4 Nb especes elementaires / Composition CHON
.012 0 0 1 0 0
.001 2 0 0 2 0
.016 0 2 2 1 0
.014 0 0 0 0 2
3 Nb d'especes globales (ici : / Fuel / Oxydant / Produits)/ composition en especes elementaires
1. 0. 0. 0. 0.
0. 1. 0. 0. 3.76
0. 0. 0. 1. 1.88
1 Nb de reactions mises en jeu pour les especes globales/stoechiometrie en nb de mole especes globales
1 2 -1. -2.38 2.88


I hope it helps.


Regards to everyone.
Pablo
Posts: 49
Joined: Thu Sep 04, 2014 11:31 am

Re: Gas combustion

Post by Pablo »

In the other hand, I've tried to perform complexer gas combustion simulations by using the reference file "dp_C4P" file, which contains:

7 Nb especes courantes
8 Nb de points de tabulation ENTH-TEMP
300. TMIN
3000. TMAX
Especes Gazeuses
CH4 C2H4 CO O2 CO2 H2O N2
.35 .35 .35 .35 .35 .35 .35 coeff absorption (ray)
4 Nb especes elementaires / Composition CHON
.012 1 2 1 0 1 0 0
.001 4 4 0 0 0 2 0
.016 0 0 1 2 2 1 0
.014 0 0 0 0 0 0 2
4 Nb d'especes globales (ici : / Fuel / Oxydant / Produits1 / Produits2)/ composition en especes elementaires
1. 0. 0. 0. 0. 0. 0. CH4
0. 0. 0. 1. 0. 0. 3.76 Air
0. 0. 1. 0. 0. 2. 1.88 CH4+.5*Air=CO +2H2O+qspN2
0. 0. 0. 0. 1. 2. 7.52 CH4+ 2*Air=CO2+2H2O+qspN2
2 Nb de reactions mises en jeu pour les especes globales/stoechiometrie en nb de mole especes globales
1 2 -1. -2.38 4.88 0.
3 2 0. -7.14 -4.88 10.52


...as far as I've learn from the previous "dp_C3P" thermochemistry file, this file indicates two different reactions for one fuel gas depending on its stoichiometry relations:
CH4+.5*Air=CO +2H2O+qspN2
CH4+ 2*Air=CO2+2H2O+qspN2

Although I don't really understand the two sequential numbers (1 2 and 3 2) at the beginning of the last two lines and which defines the reactions but anyway the point is when I launch the simulation the following error is given:
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@
@ @@ ATTENTION : ARRET A L'ENTREE DES DONNEES (COLECD)
@ =========
@ PHYSIQUE PARTICULIERE (COMBUSTION GAZ)
@
@ Le nombre d'especes globales doit etre 3
@ Il vaut 4 dans le fichier parametrique
@
@ Le calcul ne sera pas execute.
@
@ Verifier le fichier parametrique.
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@


...in fact, there are 4 global species (1 fuel, 1 oxidant and 2 products).
According to the documentation, this value is related with variables ngazg (read from the thermochemistry file, value 4 for the simulation) and ngazm (maximum of global species, value 3 as seen in the error log) which comparison seems to lead to the aforementioned error.

I have been looking for a way to modify this maximum, but I haven't found any, either in the XML or via user functions, and the only place seems to be the "colecd.f90" file, where it can be seen:

ncgm = 3
if ( ngazg.ne.ncgm ) then
write(nfecra,9995) ncgm,ngazg
call csexit (1)
!==========
endif

...being the 9995 error the previously shown one.

I have tried to modify the "colecd.f90" file as follows in line :
ncgm = 5
if ( ngazg.gt.ncgm ) then
write(nfecra,9995) ncgm,ngazg
call csexit (1)
!==========
endif


...as well as in:
! On ne considere qu'UNE SEULE REACTION GLOBALE
! NGAZG = NCGM = 3 par consequent (F, O, P)
ngazg = 5


...so that the maximum number of global species is not limited to 3 but to 5. This modification requires a re-compilation after headings clear (removing the ".lo" files ).

Now, when I launch the simulation, the following error is obtained:
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@
@ @@ ATTENTION : ARRET A L'ENTREE DES DONNEES (COLECD)
@ =========
@ PHYSIQUE PARTICULIERE (COMBUSTION GAZ)
@
@ Le nombre de reactions globales doit etre 1
@ Il vaut 2 dans le fichier parametrique
@
@ Le calcul ne sera pas execute.
@
@ Verifier le fichier parametrique.
@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@


...in fact, there are 2 global reactions (1 per product).

Once again, I've looking in the documentation, and this error is related with variables nrgaz (read from the thermochemistry file, value 2 for the simulation) and nrgm (maximum of global reactions, value 1 as seen in the error log) which comparison seems to lead to the aforementioned new error.

I have been looking for a way to modify this maximum, but once again I haven't found any and again the only place seems to be the "colecd.f90" file, where it can be seen a limitation to 1 global reaction:

nrgm = 1
if ( nrgaz.ne.nrgm ) then
write(nfecra,9996) nrgm,nrgaz
call csexit (1)
!==========
endif


So, I have tried to modify the "colecd.f90" file as follows:
nrgm = 2
if ( nrgaz.gt.nrgm ) then
write(nfecra,9996) nrgm,nrgaz
call csexit (1)
!==========
endif


...as well as in:
! On ne considere qu'UNE SEULE REACTION GLOBALE
nrgaz = 2


...so that the maximum number of global reactions is not limited to 1 but to 2. This modification requires once again a re-compilation after headings clear (removing the ".lo" files ).

Now, when I launch the simulation, the following error is obtained:
SIGFPE signal (floating point exception) intercepted!

Call stack:
1: 0x7f8501178de1 <colecd_+0x14d4> (libsaturne.so.0)
2: 0x7f8500fa145d <pplecd_+0x2a> (libsaturne.so.0)
3: 0x7f8500e8e0ea <fldvar_+0x829> (libsaturne.so.0)
4: 0x7f8500e9a3e7 <iniusi_+0x2c7> (libsaturne.so.0)
5: 0x7f8500e99b97 <initi1_+0x57> (libsaturne.so.0)
6: 0x7f8500da7ee9 <cs_run+0x2c9> (libsaturne.so.0)
7: 0x7f8500da7b12 <main+0x112> (libsaturne.so.0)
8: 0x7f85009a1f45 <__libc_start_main+0xf5> (libc.so.6)
9: 0x4006e9 <> (cs_solver)
End of stack



...so, my questions are:
  • - Is there a way to allow using more global species which it does not involve a modification in the kernel (plus re-compiling)? (i.e.with a user_subroutine)
    - Is the code able to manage more than 2 global combustion reactions?
    - Am I making the correct and enough modifications in the "colecd.f90" subroutine?

Thanks in advance.
Yvan Fournier
Posts: 4077
Joined: Mon Feb 20, 2012 3:25 pm

Re: Gas combustion

Post by Yvan Fournier »

Hello,

I don'k know that part of the code well enough to answer all your questions, but I'll check with a colleague working with gas combustion/fire.

In any case, if fixes/improvements need to be made, you may need to wait for version 4.3 (in July) if 4.2 is not enough (and though 4.2 is less validated than 4.0, it might be better for gas combustion, as this is actively developed in the context of fire safety simulations.

Regards,

Yvan
Pablo
Posts: 49
Joined: Thu Sep 04, 2014 11:31 am

Re: Gas combustion

Post by Pablo »

Hello Yvan:

Thanks for your answer, I'll wait updates.


Thanks in advance ;)
Post Reply