CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

H2 injection temperature as IC under janaf limit (modifying janafThermoI.H)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 4, 2011, 11:25
Default H2 injection temperature as IC under janaf limit (modifying janafThermoI.H)
  #1
New Member
 
Luigi
Join Date: Apr 2011
Posts: 10
Rep Power: 15
Hìr0 is on a distinguished road
Hi everybody,
I'm newby in OpenFOAM and in C++ programming language and I try to simulate combustion air-H2 inside a scramjet combustion chamber. For my thesis I need to set a injection temperature of hydrogen around 133K but it is already out of temperature range. I have calculated coefficients for the lower temperature using Chemkin Fitdata function, but I don't know how to modify OpenFoam to read this new file (i.e therm_lowrange.dat). Looking around the code I found the file where temperature is checked, janafThermoI.H:

template<class equationOfState>
inline void Foam::janafThermo<equationOfState>::checkT(const scalar T) const
{
if (T < Tlow_ || T > Thigh_)
{
FatalErrorIn
(
"janafThermo<equationOfState>::checkT(const scalar T) const"
) << "attempt to use janafThermo<equationOfState>"
" out of temperature range "
<< Tlow_ << " -> " << Thigh_ << "; T = " << T
<< abort(FatalError);
}
}

I would like to bypass this check for example say OpenFoam to read something like that from thermophysicalProperties file:

CHEMKINThermoFile_lowrange "$FOAM_CASE/chemkin/therm_lowrange.dat"

before abort (if doesn't exist). What is the easy way to do it? Do you know if foamChemistryReader can do this?

Thanks for any suggestions!

Luigi
Hìr0 is offline   Reply With Quote

Old   April 11, 2011, 18:32
Default
  #2
New Member
 
Luigi
Join Date: Apr 2011
Posts: 10
Rep Power: 15
Hìr0 is on a distinguished road
This is my new janafThemoI:
Code:
template<class equationOfState>
inline void Foam::janafThermo<equationOfState>::checkT(scalar T) const
{
    if (T <  Tlow_)
    {
        Info<< "Warning: out of temperature range "
            << Tlow_ << " -> " << Thigh_ << ";  T = " << T << endl;
        T = Tlow_;
        Info<< "Temperature limited at T = " << T << endl;
    }
    if (T > Thigh_)
    {
        Info<< "Warning: out of temperature range "
            << Tlow_ << " -> " << Thigh_ << ";  T = " << T << endl;
        T = Thigh_;
        Info<< "Temperature limited at T = " << T << endl;
    }
    /*if (T <  Tlow_ || T > Thigh_)
    {
        FatalErrorIn
        (
            "janafThermo<equationOfState>::checkT(const scalar T) const"
        )   << "attempt to use janafThermo<equationOfState>"
               " out of temperature range "
            << Tlow_ << " -> " << Thigh_ << ";  T = " << T
            << abort(FatalError);
    }*/
}


template<class equationOfState>
inline const typename Foam::janafThermo<equationOfState>::coeffArray&
Foam::janafThermo<equationOfState>::coeffs
(
    scalar T   // const scalar T
) const
{
    checkT(T);

    if (T < Tcommon_)
    {
        return lowCpCoeffs_;
    }
    else
    {
        return highCpCoeffs_;
    }
}
I also replaced const scalar T with scalar T in line 56 and line 89...but if I run a test case (T is 1204 K in all domain except in one point where T=50K) I see that T field is not updated. Why?

Code:
Solving chemistry
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG:  Solving for Ux, Initial residual = 0.126810514, Final residual = 1.17492806e-09, No Iterations 1
DILUPBiCG:  Solving for Uy, Initial residual = 0.0715419851, Final residual = 2.01756428e-08, No Iterations 1
DILUPBiCG:  Solving for Uz, Initial residual = 0.377246649, Final residual = 5.3260308e-09, No Iterations 1
DILUPBiCG:  Solving for H2, Initial residual = 0.0323321349, Final residual = 1.97452836e-08, No Iterations 1
DILUPBiCG:  Solving for O2, Initial residual = 0.0324333194, Final residual = 1.99863629e-08, No Iterations 1
DILUPBiCG:  Solving for H2O, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG:  Solving for hs, Initial residual = 0.0703365119, Final residual = 3.26754347e-09, No Iterations 1
Warning: out of temperature range 100 -> 5000;  T = 50
Temperature limited at T = 100
Warning: out of temperature range 100 -> 5000;  T = 50
Temperature limited at T = 100
Warning: out of temperature range 100 -> 5000;  T = 50.000762
Temperature limited at T = 100
Warning: out of temperature range 100 -> 5000;  T = 50.000762
Temperature limited at T = 100
Warning: out of temperature range 100 -> 5000;  T = 50
Temperature limited at T = 100
Warning: out of temperature range 100 -> 5000;  T = 50
Temperature limited at T = 100
Warning: out of temperature range 100 -> 5000;  T = 50.0007507
Temperature limited at T = 100
Warning: out of temperature range 100 -> 5000;  T = 50.0007507
Temperature limited at T = 100
T gas min/max   = 50.0007507, 1204.00116
Where the temperature is calculated and written?
Hìr0 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculation of the Governing Equations Mihail CFX 7 September 7, 2014 07:27
How do I set lower temperature boundary limit? Arefin Anwar CFX 1 December 4, 2006 10:48
How do I set Lower temperature boundary limit? Arefin Anwar CFX 0 December 4, 2006 03:31
Low temperature limit when iterations are done. MANOJKUMAR FLUENT 4 February 28, 2006 16:30
Temperature went outside of its upper limit Atit Koonsrisuk CFX 0 January 8, 2004 12:43


All times are GMT -4. The time now is 18:03.