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/)
-   -   ReactingFoam (https://www.cfd-online.com/Forums/openfoam-solving/57945-reactingfoam.html)

vassilis September 8, 2005 10:55

Hi all! I'm a new user of
 
Hi all!

I'm a new user of openFOAM with a very limited experience in the field of CFD. I am currently trying to simulate a CH4 combustion (laminar) in a cylinder with two inlet surfaces, one for the air and one for the fuel. The chemistry etc. are to be read from a CHEMKIN file.
I've read in previous threads that the best way to do this would be by using the reactingFOAM solver. Could you please give me some general directions/instructions?

My biggest problem is in locating the entities demanded from the solver in the 0/ directory, i.e. the initial conditions. How do I make clear where the fuel is entering? Is it the ft variable that defines this? Do I need to state k and epsilon when calculating with :

turbulenceModel laminar;
turbulence off;

????

My guideline so far was the aachenbomb tutorial copied from the dieselFoam case. The geometry and the mes(s)h was imported.

Waiting for an answer,
v.p.

niklas September 13, 2005 02:47

In the 0-directory there is a
 
In the 0-directory there is a Ydefault-file.
This file is used to set initial conditions and boundary conditions for every species, not defined at the beginning. If you want to use a different bc or initial condition you must create a CH4 file in the 0-directory, as have been done for the N2 and O2 species.
You can just copy the N2, or O2, file to CH4 and replace the N2's with CH4 in the new CH4-file.

In the CH4 file you set the values at 0.0 for the air inlet and 1.0 for the fuel inlet.

You dont need to use FoamX for this, you can just use a text-editor.

If you dont know what Im talking about I suggest you run the icoFoam cavity tutorial first and look at how the boundaries are set and defined in blockMeshDict and 0-directory.

N

vassilis September 13, 2005 03:52

Hi Niklas, many thanx for y
 
Hi Niklas,

many thanx for your answer. While playing around with the solver I noticed that, for the case set up at least, the files ft, fu , k and espilon are not needed in the 0-directory.

In my CHEMKIN-file I define the species: 02, N2, CH4, CO2 , CO and H20. Although I did not really understand the difference between using the Ydefault-file and creating a new one named e.g. CH4 (could you elaborate a bit on that???), I tried the second alternative but the solved does not seem to calculate. The message I recieve is:


"/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.2 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/

Exec : reactingFoam . test_reactingfoam
Date : Sep 13 2005
Time : 09:07:23
PID : 12142
Root : /home/opencfd/OpenFOAM/opencfd-1.2/run/tutorials/dieselFoam
Case : test_reactingfoam
Nprocs : 1
Create time

Create mesh for time = 0

Reading chemistry properties


Reading environmentalProperties

Reading thermophysicalProperties
Selecting thermodynamics package hMixtureThermo<reactingmixture>
Selecting chemistryReader chemkinReader
Reading field U

Reading/calculating face flux field phi

Creating turbulence model.

Selecting turbulence model laminar
Creating field DpDt

Constructing chemical mechanism
Selecting ODE solver SIBS
chemistryModel::chemistryModel: Number of species = 5 and reactions = 1
Mean and max Courant Numbers = 0 3.00477e-12

Starting time loop

End

"

Can you help me out of this???

Best regards,
v.p.

niklas September 13, 2005 04:09

Imagine that you have a chemki
 
Imagine that you have a chemkin mechanism with over 100 species.
Since you dont want to specify bc's and initial conditions for all of them, since most of them are identical, you can define a default value in the Ydefault-file. When you start the calculation and the chemkin-reader goes through the species defined in the chemkin-file to get intitial conditions and bc's it will then use the Ydefault-file if it cannot find a file in the 0-directory with the same name as the species.

As for your problem above...
All looks good to me, but I'm guessing that your endTime is 0, which probably is not what you want.

N

vassilis September 13, 2005 05:36

Hi (again), fisrtly, thank
 
Hi (again),

fisrtly, thank you very much for the detailed explanation of the Ydefault.

The problem I encounter is unfortunately not so simple... My endTime is not set to 0. When I try simulating the case without creating a CH4-file and by leaving Ydefault to 0, it seems to be calculating. However, when Ydefault is assigned another value than 0 or an extra file CH4 is added, I constantly get the message I posted before.

I do not understand where the problem is. Do you have any further suggestions?

Regards,
v.p.

niklas September 13, 2005 06:00

1. why would you define a defa
 
1. why would you define a default-value to anything else than 0... please dont. The Ydefault file is really just necessary to get the correct bc's.

2. you said that you have 6 species: 02, N2, CH4, CO2 , CO and H20, but in your construction of
the chemical mechanism it says 5 species. Are you sure you are reading the correct chemkin-files?

3. what is your initial time step.

4. what is your mesh

5. does it run if chemistry is off

N

vassilis September 13, 2005 07:14

So, 2. The chemkin file I w
 
So,

2. The chemkin file I was reading was indeed the wrong one. I tried it agian with the proper file but the result was the same.

3. initial time step was set to : 1.0e-05.
startFrom : startTime (0)
stopAt : endTime (not 0).
runTimeModifiable yes;
maxCo 0.1;

4. the mesh used is a quarter of a cylinder generated in gambit and imported. The inlet face is separated in two main faces (inner face: fuel inlet, outer face:air inlet) which are separated by a small wall (constant temp???)

5. Unfortunately not....

I have set turbulentreaction to off; (if i got it right, no need for assigning a value to Cmix in this case).

what am I doing wrong???

v.p.

niklas September 13, 2005 07:32

Hmmm, its pretty difficult to
 
Hmmm,
its pretty difficult to say really, since I dont have the case.
Your Courant number is practically zero also.
What is your inlet velocity?

Do you have an outlet, btw?

N

vassilis September 13, 2005 08:34

Hi Niklas, firstly I have
 
Hi Niklas,

firstly I have to say that I really appreciate your time and effort!!! Before going into details for the case I would like to ask you something.

In the file "reactingFoam.C" is described the set up of the solver. There, in my case, the variable :

runTime.run()

has the value false which then does not allow the programm to go through all this calculations placed under "while", but jumps directly to the :

Info << "End\n" << endl;

right??? Can this be also caused from the physical aspect of the problem?? In other words, what defines the value of the "runTime.run()" variable??

About the case now:

Velocity was REALLY LOW! i changed it up to a Re of about 400 and things got really better!!! However there should be something else wrong (maybe I should increase the time???) because I get only one file of results (named 8.34534 when endTime is 5) and it doesn't "look" the way I was hoping it would....

Thanx for the advice...

v.p.

p.s. If you have time and any patience left I could send you the whole case. It would really help me understand a lot more about OpenFoam

vassilis September 13, 2005 08:35

I forgot something... the
 
I forgot something...

the outlet is the other end of the cylinder...

niklas September 13, 2005 08:42

OK, I think I know what is goi
 
OK, I think I know what is going on.

Can you copy/paste your controlDict.
I suspect you have mixed up the meaning of
the writeControl and writeInterval values.

N

vassilis September 13, 2005 08:45

/*----------------------------
 
/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.0 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/

FoamFile
{
version 2.0;
format ascii;

root "";
case "";
instance "";
local "";

class dictionary;
object controlDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application reactingFoam;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 500;

deltaT 1.0e-05;

writeControl runTime;

writeInterval 5.0e-5;

purgeWrite 0;

writeFormat binary;

writePrecision 6;

writeCompression uncompressed;

timeFormat general;

timePrecision 6;

adjustTimeStep yes;

maxCo 0.05;

runTimeModifiable yes;

// ************************************************** *********************** //

niklas September 13, 2005 09:05

That looks fine. Should work.
 
That looks fine. Should work.
Have you tried to set

adjustTimeStep off;
runTimeModifiable off;

otherwise, you can mail me the case and I'll take a look at it (if it is smaller than 10MB).
(nordin at chalmers dot se)
If larger than 10MB, you have to place it on an ftp/http server for me to pick it up.

didomenico September 26, 2005 10:35

Hi Vasileios why are you si
 
Hi Vasileios
why are you simulating a quarter of a cylinder if, as I suppose, the geometry is axialsymmetric?
You can just create a 5-degree sector with one cell in tangential direction. NOTE: the wedge faces have to be symmetric respect to the plane z=0, otherwise strange things will happen http://www.cfd-online.com/OpenFOAM_D...ipart/uhoh.gif
Let us know
Massimiliano

vassilis September 27, 2005 07:55

Ciao Massimo, I finally ma
 
Ciao Massimo,

I finally managed to finish the new geometry in Gambit. I had never heard of the constraint with the z=0 plane, i.e. I witnessed the strange things.

I have another question though... The surface surrounding the cylinder in my case is a wall. Assuming that I assign it the "wall" boundary type, what should be the type of the pressure in the initial conditions file alongside the wall??? I also have a small wall separating the two inlet faces. What do I assign there ??? Up to now the small wall has been really torturing me, since something flows through it alhtough it is clearly stated that the velocity should be zero!!!

Do I define pressure in the inlet AND at the outlet or do I leave one as "zeroGradient" ?

I'm new in this and I don't know what's going wrong...

Regards

v.p.

didomenico September 27, 2005 09:53

Hi Vasileios I are right, t
 
Hi Vasileios
I are right, the inlet and wall pressure BCs have to be "zeroGradient" as follows (in p file)

boundaryField
{
....
inlet
{
type zeroGradient;
}

outlet
{
type fixedValue;
value uniform 1e5; // operating pressure
}

wall
{
type zeroGradient;
}
...
}


For the velocity (U file) you should have

boundaryField
{
....
inlet
{
type fixedValue;
value uniform (10 0 0);
}

wall1
{
type fixedValue;
value uniform (0 0 0);
}
...
}


where U and p files are located in your startTime directory. If everything is correct, it may be you are plotting with Paraview an interpolated U value, so try to look directly inside the solution files...
Good luck

Massimiliano

vassilis September 27, 2005 12:57

Hi Massimiliano, > NOTE: t
 
Hi Massimiliano,

> NOTE: the wedge faces have to be symmetric respect to the plane z=0.

I assume that with this you mean that the axis of symmetry of the geometry is on the x-y level ,e.g. the y-axis or x-axis, right?

Then when I assign the "wedge" type to two surfaces I get the following :

--> FOAM FATAL ERROR: wedge does not allign with a coordinate plane

So, at least one of the wedges should lie on a plane ,z ,y or x. Right?

Does it actually make a difference if I simulate a 5° "slice" or 20°, apart from the computational effort required? I got some problems with the meshing with such a thin slice.

Regards,
v.p.

roncresswell September 28, 2005 02:54

I read "the wedge faces have t
 
I read "the wedge faces have to be symmetric respect to the plane z=0" to mean that one should be xy-plabe + 2.5 degrees and the other should be xy-plane - 2.5 degrees. That way the average is exactly on the xy-plane.

Just a thought. Haven't got that far myself ;^)

Ron

didomenico September 28, 2005 03:44

Hi Vasileios, from OpenFoam
 
Hi Vasileios,
from OpenFoam user guide, page U-143: "For 2 dimensional axi-symmetric cases, e.g. a cylinder, the geometry is specified as a wedge of 5 degree angle and 1 cell thick running along the plane of symmetry, straddling one of the coordinate planes..."
I think you can generate your mesh with the blockMesh utility instead of Gambit. Three blocks should be enough. I know that Gambit has some problems in handling small sectors, and I do not know what openFoam does if you put more than one cell between two wedges. An answer from OpenFoam developers would be nice http://www.cfd-online.com/OpenFOAM_D...ipart/wink.gif
Regards
Max

niklas September 28, 2005 03:54

A common mistake when creating
 
A common mistake when creating wedge-meshes is that one creates a wedges where the different wedge have different lengths. This is what usually happens when you set one plane along the axis and then copy/paste the point and just change the y-value. You thus create a mesh like this


<pre>
/
b/
/
/
----- -> x
a
</pre>
This is clearly not a wedge since the b side is longer than a.

If you instead make the wedges symmetric around the x-axis you just have to change the signs. Like this
<pre>
/
/
/
/ -> x
\
\
\
\
</pre>
Then you have a 'real' wedge.
I dont know if this is what you're doing.

N

vassilis September 28, 2005 04:55

Hi Niklas, firstly, yes, I
 
Hi Niklas,

firstly, yes, I do have a 'real' wedge. The thing is that I could not get the geometry with a 5° slice in Gambit right (checkMesh would fail) so I was wondering if I could apply the wedge boundaries also on e.g. 20° wedges. Furthermore, openFoam complains when my geometry lies along the y axes, i.e. the plane x-y (i.e. z=0) is the symmetry axis. According to the guide this should be o.k. but apparently there is something wrong.

Regards,
v.p.

vassilis September 28, 2005 10:29

Hi all! Problem solved! Whe
 
Hi all!

Problem solved! When the wedge has only one cell in the tangential direction and the x-y, i.e. z=0, is the symmetry plane everything works fine! With more cells there are some problems.

Thanks for everything!

v.p.

niklas September 28, 2005 10:49

Have you read Table 6.1 in the
 
Have you read Table 6.1 in the documentation?

http://www.opencfd.co.uk/openfoam/do...#x30-1600006.2

mattos October 18, 2005 12:46

Hi Guys Tommaso suggested m
 
Hi Guys

Tommaso suggested me to try to use the reactingFoam application (solver) for non-premixed combustion flows. I did look for a tutorial for this application same in my previous openfoam instalations without success. Please, somebody can help me suppling a reactingFoam tutorial test case? I think that many other people will also be glade.

Many tanks in advance

Wladimyr

hannes October 19, 2005 02:37

Hello Wladimyr, I have modi
 
Hello Wladimyr,

I have modified the dieselFoam-tutorial for creating a reactingFoam-Case. I will send this case to you.

Best regards, Hannes

mattijs October 19, 2005 06:08

Hi Hannes, if you think thi
 
Hi Hannes,

if you think this case is generally useful do you want to post it on the wiki (http://openfoamwiki.net/) or here?

Does it have FoamX configuration files with it?

Regards,

Mattijs

mattos October 19, 2005 09:25

Hi Hannes and Mattijs Fir
 
Hi Hannes and Mattijs


First of all I would like to send big tanks for Hannes to make it available for me. I just received it and I will work now over

Mattijs, I just wrote for Hannes asking him to give me a green light to make it available in the OpenFoam wiki's site. It will be great pleasure for me, however I think that Hannes is the best person to do it because it is his credit.

Tanks for all.

Regards,

Wladimyr

hannes October 20, 2005 04:10

Hello all, I just put the c
 
Hello all,

I just put the case, which I sent to Wladimyr, into the Wiki plus some comments.
FoamX files are not included, since I do not use FoamX.

Regards,
Hannes

gschaider October 20, 2005 07:55

I moved your tutorial to a sep
 
I moved your tutorial to a separate page in the Wiki because

a) it deserves a page on it's own
b) it's easier to reference it (http://openfoamwiki.net/index.php/Tut_reactingFoa m_firstTutorial)
c) I'm so glad that there is a first tutorial page on the Wiki now

(It's still linked from the page with all the tutorials)

mattos October 20, 2005 09:41

Hi Bernhard For new contrib
 
Hi Bernhard

For new contributions in wiki page, what we must to do? To edit the contribution as donne by Hannes or put in special place directly and make a link to the contribution such as you did? If this last option is right, please could you guide me how do it?

Regards,

Wladimyr

mattos October 20, 2005 12:15

Hi Guys I need a help. I'm
 
Hi Guys

I need a help. I'm testing the dieselFoam solver with the aachenBomb tutorial case and I have problems trying to restart it. If I put to run with the controldict such that:

startFrom firstTime;

I have not problem and the case runs. But when I put the case to restart using, for example:

startFrom startTime;

startTime 5e-05;

The solver crashes and the following message apears in the output.

==========================================
.
.
.

Evolving Spray

--> FOAM FATAL ERROR : attempt to use janafThermo<equationofstate> out of temperature range 200 -> 5000; T = 1.46567e+161

From function janafThermo<equationofstate>::checkT(const scalar T) const
in file /home/dm2/henry/OpenFOAM/OpenFOAM-1.2/src/thermophysicalModels/specie/lnInclude/ janafThermoI.H at line 73.

FOAM aborting
======================================

I tested using either binary as ascii writeformat and both does not work. Could somebody help me?

Many tanks in advance

Wladimyr

gschaider October 20, 2005 12:39

@wladimyrs question about the
 
@wladimyrs question about the Wiki: I prefer a seperate page (just the way I moved Hannes contribution). That way it is easier for me to maintain the Wiki.

Some guidelines about what should go where and how pages should be named can be found at: http://openfoamwiki.net/index.php/Main_Policy

(Adding a page in the Wiki is quite easy: find the page where you want to link from and add a link there by simply writting the name of the page in double square brackets. If you click on that link and the page doesn't exist you will be redirected to page where xou can edit that page. Pointers to more detailed descriptions of the process can be found at http://openfoamwiki.net/index.php/Help:Editing Feel free to use the TestSide-part of the Wiki if you want to try it out)

mattos October 20, 2005 14:34

Hi Hannes, and others Neros
 
Hi Hannes,

and others Neros like me!

I have a small suggestion. In the tutorial case given by Hannes, I changed the thermophysicalProperties file in order to be the more general as possible. I left the Hannes' case in the "hannescase" directory as a child of $FOAM_RUN/tutorials/reactingFoam directory. I think that this way can be more general. Bellow, I copied the 2 lines modified in that file. This was the unique modification that I did in the Hannes' test case. It seems that it works fine. Tank again Hannes for your help.

Regards,

Wladimyr


============================================

CHEMKINFile "$FOAM_TUTORIALS/reactingFoam/hannescase/chemkin/chem.inp";
CHEMKINThermoFile "$FOAM_TUTORIALS/reactingFoam/hannescase/chemkin/therm.dat";

mattos October 20, 2005 14:41

Hi Guys Excuse me, I'm lyin
 
Hi Guys

Excuse me, I'm lying! There are the 2 right lines modified in the thermophysicalProperties files. I changed it to make a test and I did'n check. Now is correct! (I hope!)

Bye,

Wladimyr


CHEMKINFile "$FOAM_RUN/tutorials/reactingFoam/hannescase/chemkin/chem.inp";
CHEMKINThermoFile "$FOAM_RUN/tutorials/reactingFoam/hannescase/chemkin/therm.dat";

finch November 5, 2005 13:50

I downloaded this case from th
 
I downloaded this case from the Wiki, but it crashes with the following message. The only thing I changed was the paths to the files chem.imp and therm.dat. Please let me know if you have any idea what's wrong.

---------- Error Message -----------
Mean and max Courant Numbers = 0.0147348 0.0988445
deltaT = 2.43902e-05
Time = 0.0564878

Solving chemistry


--> FOAM FATAL ERROR : attempt to use janafThermo<equationofstate> out of temperature range 200 -> 5000; T = 5000.06

From function janafThermo<equationofstate>::checkT(const scalar T) const
in file /home/dm2/henry/OpenFOAM/OpenFOAM-1.2/src/thermophysicalModels/specie/lnInclude/ janafThermoI.H at line 73.

FOAM aborting

gschaider November 7, 2005 10:18

I would guess, that your react
 
I would guess, that your reactions produce too much energy and the simulation is "overheating".

Have you changed anything about chem.inp?

finch November 7, 2005 22:32

No, I did not change anything
 
No, I did not change anything in the case, except the paths to CHEMKINFile and CHEMKINThermoFile. To make sure, I unpacked the archive again and ran the case. I got exactly the same error. Did Hannes, or anyone else, run the case all the way to completion?

hannes November 8, 2005 03:14

Hello, I just tried to run
 
Hello,

I just tried to run the simulation further than I did before and I get the same error as Craig. (I did not notice this error before, because the timestep included was the last one I computed).
It seems as if the large temperatures come from the chemistry solver, because a short time before the error occures the largest temperatures are found in the reaction zone and are far above 4000K.
I do not known if such high flame temperatures for Heptan/Oxygen are reasonable. Perhaps someone else knows?

niklas November 10, 2005 06:35

I've now looked at this setup
 
I've now looked at this setup and I think it is bad.

I made some modifications and it ran fine.
but first though, you are only using 5 species and
one exothermic reaction, which constantly feeds the
high temperature region
with fuel and oxygen and no inert gas, so why shouldnt the temperature keep on increasing.
Reality is another matter...

What I did to get it running was this.
I dont know what the real conditions are so...
Initial conditions, N2 95%, C7H16 5%, temp 1500K

50% N2 in both O2 and C7H16 feed
and lowered the inlet temp to 300K
Then the O2 feed will ignite immediately and produce the pilot flame until the heptane starts to mix with the O2

niklas November 10, 2005 10:27

When you use the chemkin stuff
 
When you use the chemkin stuff all the species are created using the species section in the chem.inp file.

And in order to solve the transport equation for each
and single every one of these you need to specify
the initial/boundary conditions.
So if you have 100 species you need to define the boundary conditions for a 100 species.
I thought this was a very bad idea since usually you only want to vary fuel/O2/N2 and some EGR components.
Hence, when you start the calculation, any species that does not find a definition of its initial conditions and bc's will look for a default settings file, radically called Ydefault.
It is possible to have default setting of initial conditions, but not of boundary conditions, therefore the Ydefault file is needed.
When you start the calculation and look in the newly created time-directories you will see that every species now has its own file (as it should)

The chem.inp and therm.dat files are compatible with chemkin, I do not know if cantera is that.
However, looking at your error-message it is clear that something is wrong with '1O2' and since there only is one place in the file where that combination of characters exists I would move the '11O2' statement one step to the left.


All times are GMT -4. The time now is 00:50.