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


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