CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Error in the enthalpy equation (http://www.cfd-online.com/Forums/openfoam-solving/59727-error-enthalpy-equation.html)

danilo April 19, 2007 16:35

Hello everybody, I am using
 
Hello everybody,

I am using the reactingFoam solver for a very simple case: the geometry is 2D axisymmetric geometry, the fuel is methane in a coflow of air and the chemistry is simply a 1 step reaction. Unfortunately I have some problems in the enthalpy equation. During the calculations in some cells the temperature reaches a value higher than 5000K which is the maximum value available for the estimation of transport properties in the gaseous mixture; then the following error message appears:

---------------------------------------------------

-> FOAM FATAL ERROR : attempt to use janafThermo<equationofstate> out of temperature range 200 -> 5000; T = 5081.35#0 Foam::error::printStack(Foam::-Ostream&)
#1 Foam::error::abort()
#2 Foam::specieThermo<foam::janafthermo<foam::perfect gas> >::H(double) const
#3 Foam::hMixtureThermo<foam::reactingmixture>::calcu late()
#4 Foam::hMixtureThermo<foam::reactingmixture>::corre ct()
#5 main
#6 __libc_start_main
#7 __gxx_personality_v0


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

FOAM aborting

Aborted

-------------------------------------------------

I tried different initial conditions and different meshes and I also changed the chemistry of my case but the problem remains.

I saw that many people experienced the same problem but nobody explained the reason and proposed a solution. I am wondering if it is possible to force a maximum value in the temperature field (for example 3500K); this is the solution I usually use in FLUENT, but I don't know how to implement it in OpenFoam

Do you have any suggestions? Is there anybody who fixed this problem?

Thank you,
Danilo

hartinger April 20, 2007 12:51

Hi Danilo, i can tell you h
 
Hi Danilo,

i can tell you how to fudge it and limit the enthalpy.
Create 'hEqn.H' in the folder '$FOAM_APP/solvers/combustion/reactingFoam'. If no 'hEqn.H' exists locally, the one from 'XiFoam' is taken.

hEqn.H:
---------------------------------------
{
solve
(
fvm::ddt(rho, h)
+ mvConvection->fvmDiv(phi, h)
- fvm::laplacian(turbulence->alphaEff(), h)
==
DpDt
);

const scalar maxH = ....;

forAll(h.internalField(), cellI)
{
h.internalField()[cellI] = maxH;
}

forAll(h.boundaryField(), patchI)
{
forAll(h.boundaryField()[patchI], faceI)
{

h.boundaryField()[patchI][faceI] = maxH;
}
}

thermo->correct();
}

danilo April 20, 2007 14:07

Hi Markus, thank you for yo
 
Hi Markus,

thank you for your reply! Unfortunately I didn't understand the solution you proposed. In particular:

1. It seems to me that using your solution a uniform value of enthalpy is fixed in every cell; on the contrary I would to correct the value only for the cells where the temperature is higher than Tmax

2. Even if I can choose the cells where the temperature is higher than Tmax it should be simpler to correct the temperature field, not the enthalpy field... in fact the value of enthalpy is not only related to the temperature but also to the composition and therefore the maxH reported in your code is not a uniform and constant value but should be calculated for every cell

I met this problem also using the reactingFoam tutorial reported in the wiki page without making any changes... I don't know if the other combustion solvers are affected by the same problem, but for reactingFoam I never reached a steady solution: I tried different geometries, different meshes, kinetic schemes and fuels but I always had the same error...
The strange thing is that in the iteration preceding the message error the thermal field seems to be correct and the maximum value of temperature seems to be correct (around 2500K for methane, for example)... suddenly in the next iteration the temperature is some cells reaches a value higher of 5000K or in some case is negative!!!

Danilo

hartinger April 20, 2007 14:49

1.) yes, you're right, i forgo
 
1.) yes, you're right, i forgot to insert an if-statement:
if ( h.internalField()[cellI] > maxH)
{
...
}
and so on

2.) since you're solving for the enthalpy which feeds into 'hCombustionThermo' with 'thermo->correct()' you have to limit the enthalpy, unless you want to change the 'hCombustionThermo', which i wouldn't recommend for a start. As you say the maximum enthalpy needs to be caluclated for each cell, which should be possible.

regarding your instability:
havent' used it, no clue, but general things:
- try upwind for the convection terms
- try different boundary conditions
- increase the solution tolerances
- decrease timesteps
- under-relax the enthalpy, for steady-state only

good luck
markus

hartinger April 20, 2007 15:15

i meant: decrease solution tol
 
i meant: decrease solution tolerances

danilo April 20, 2007 16:10

Hi Markus, thank you very m
 
Hi Markus,

thank you very much for your suggestions... I'll try in the next days...

Danilo

Sim November 26, 2009 08:29

Hello everyone,

I tried to limit the enthalpy in the XiFoam-solver as described above but it doesn`t work...
Maybe here is anyone who can help me.

Sim

Sim November 26, 2009 08:42

Its all new for me so i dont know if its right...
here is what Ive written in the hEqn.H:

{

solve
(
fvm::ddt(rho, h)
+ mvConvection->fvmDiv(phi, h)
- fvm::laplacian(turbulence->alphaEff(), h)
==
DpDt



);
if ( h.internalField()[cellI] > maxH)
{
const scalar maxH = 1000;



forAll(h.internalField(), cellI)
{
h.internalField()[cellI] = maxH;
}


forAll(h.boundaryField(), patchI)
{
forAll(h.boundaryField()[patchI], faceI)
{

h.boundaryField()[patchI][faceI] = maxH;
}
}
}

thermo->correct();
}


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