View Issue Details

IDProjectCategoryView StatusLast Update
0000978OpenFOAMBugpublic2016-02-02 19:04
Reporterdkxls Assigned Tohenry  
PrioritynormalSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
PlatformLinux x86_64OSopenSUSEOS Version12.2
Summary0000978: [thermo]: Add log(T) transport model (source code attached)
DescriptionThe transport properties (viscosity/conductivity) for reaction simulation are often supplied as coefficients to a polynomial functions of ln(T):
 ln(mu) = sum_i=1^N( a[i] * ln(T)^(i-1) )
 ln(kappa) = sum_i=1^N( b[i] * ln(T)^(i-1) )

The provided source code adds the functionality to use this polynomial expression, given the coefficients are provided in the thermophysicalProperties dictionary.
Tagscontribution, thermo, transport

Activities

dkxls

2013-08-26 16:43

reporter  

thermophysicalProperties (6,686 bytes)   
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.2.x                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      thermophysicalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

species
(
    O2
    OH
    H2O
    N2
    CO
    CO2
    HO2
);

O2
{
    specie
    {
        nMoles          1;
        molWeight       31.9988;
    }
    thermodynamics
    {
        Tlow            300;
        Thigh           5000;
        Tcommon         1000;
        lowCpCoeffs     ( 3.212936 0.001127486 -5.75615e-07 1.313877e-09 -8.768554e-13 -1005.249 6.034738 );
        highCpCoeffs    ( 3.69757672 0.0006135197 -1.258842e-07 1.775281e-11 -1.136435e-15 -1233.92958 3.18917106 );
    }
    transport
    {
        // Sutherland coefficients for T = [200...2000]
        As              1.7965916567073e-06;
        Ts              170.54164749295;
        // Polynomial coefficients (logarithmic T)
        muLogCoeffs<4>    ( -21.091577299 3.3800987342 -0.37197264005 0.016832763823 );
        kappaLogCoeffs<4> ( -10.549274188 1.5845572282 -0.075372244893 0.0017861829273 );
    }
}

OH
{
    specie
    {
        nMoles          1;
        molWeight       17.00737;
    }
    thermodynamics
    {
        Tlow            300;
        Thigh           5000;
        Tcommon         1000;
        lowCpCoeffs     ( 3.637266 0.000185091 -1.676165e-06 2.387203e-09 -8.431442e-13 3606.782 1.35886 );
        highCpCoeffs    ( 2.88273028 0.001013974 -2.276877e-07 2.174684e-11 -5.126305e-16 3886.88818 5.59571392 );
    }
    transport
    {
        // Sutherland coefficients for T = [200...2000]
        As              2.137387008678e-06;
        Ts              153.96777733863;
        // Polynomial coefficients (logarithmic T)
        muLogCoeffs<4>    ( -19.453971433 2.848100393 -0.30795569747 0.014308775644 );
        kappaLogCoeffs<4> ( -6.9668340052 0.99872892798 -0.086774511718 0.0067838105465 );
    }
}

H2O
{
    specie
    {
        nMoles          1;
        molWeight       18.01534;
    }
    thermodynamics
    {
        Tlow            300;
        Thigh           5000;
        Tcommon         1000;
        lowCpCoeffs     ( 3.386842 0.003474982 -6.354696e-06 6.968581e-09 -2.506588e-12 -30208.11 2.590233 );
        highCpCoeffs    ( 2.672146 0.003056293 -8.73026e-07 1.200996e-10 -6.391618e-15 -29899.2118 6.86281009 );
    }
    transport
    {
        // Sutherland coefficients for T = [200...2000]
        As              2.1788547507077e-06;
        Ts              831.9750182067;
        // Polynomial coefficients (logarithmic T)
        muLogCoeffs<4>    ( -15.174746208 -0.48858922788 0.31538028251 -0.020301778485 );
        kappaLogCoeffs<4> ( 0.79425087148 -4.2231737347 0.86018587171 -0.044866934283 );
    }
}

N2
{
    specie
    {
        nMoles          1;
        molWeight       28.0134;
    }
    thermodynamics
    {
        Tlow            300;
        Thigh           5000;
        Tcommon         1000;
        lowCpCoeffs     ( 3.298677 0.00140824 -3.963222e-06 5.641515e-09 -2.444855e-12 -1020.9 3.950372 );
        highCpCoeffs    ( 2.92663704 0.001487977 -5.684761e-07 1.009704e-10 -6.753351e-15 -922.794691 5.9805458 );
    }
    transport
    {
        // Sutherland coefficients for T = [200...2000]
        As              1.5480038588324e-06;
        Ts              164.02605265011;
        // Polynomial coefficients (logarithmic T)
        muLogCoeffs<4>    ( -20.775458014 3.2163178363 -0.35295132597 0.016115045522 );
        kappaLogCoeffs<4> ( -3.2756703702 -1.4998231724 0.35516180364 -0.018167744151 );
    }
}

CO
{
    specie
    {
        nMoles          1;
        molWeight       28.0106;
    }
    thermodynamics
    {
        Tlow            300;
        Thigh           5000;
        Tcommon         1000;
        lowCpCoeffs     ( 3.262452 0.001511941 -3.881755e-06 5.581944e-09 -2.474951e-12 -14310.54 4.848897 );
        highCpCoeffs    ( 3.02507765 0.001442689 -5.630828e-07 1.018581e-10 -6.910952e-15 -14268.3502 6.10822213 );
    }
    transport
    {
        // Sutherland coefficients for T = [200...2000]
        As              1.5225075695468e-06;
        Ts              164.38782317961;
        // Polynomial coefficients (logarithmic T)
        muLogCoeffs<4>    ( -20.820638135 3.2265349754 -0.35415869509 0.01616160399 );
        kappaLogCoeffs<4> ( -3.1190751069 -1.6598094216 0.3897463843 -0.020346909891 );
    }
}

CO2
{
    specie
    {
        nMoles          1;
        molWeight       44.01;
    }
    thermodynamics
    {
        Tlow            300;
        Thigh           5000;
        Tcommon         1000;
        lowCpCoeffs     ( 2.275725 0.009922072 -1.040911e-05 6.866687e-09 -2.11728e-12 -48373.14 10.18849 );
        highCpCoeffs    ( 4.45362662 0.003140169 -1.278411e-06 2.393997e-10 -1.669033e-14 -48966.9526 -0.955419547 );
    }
    transport
    {
        // Sutherland coefficients for T = [200...2000]
        As              1.676589588132e-06;
        Ts              286.90120742318;
        // Polynomial coefficients (logarithmic T)
        muLogCoeffs<4>    ( -23.716630908 4.0102355975 -0.40981343613 0.016589390864 );
        kappaLogCoeffs<4> ( -17.727987239 3.6213340788 -0.23957627818 0.0044673691475 );
    }
}

HO2
{
    specie
    {
        nMoles          1;
        molWeight       33.00677;
    }
    thermodynamics
    {
        Tlow            300;
        Thigh           5000;
        Tcommon         1000;
        lowCpCoeffs     ( 2.979963 0.004996697 -3.790997e-06 2.354192e-09 -8.089024e-13 176.2274 9.222724 );
        highCpCoeffs    ( 4.07218956 0.002131296 -5.308145e-07 6.112269e-11 -2.841165e-15 -157.971082 3.47604107 );
    }
    transport
    {
        // Sutherland coefficients for T = [200...2000]
        As              1.8246688007442e-06;
        Ts              170.54164751128;
        // Polynomial coefficients (logarithmic T)
        muLogCoeffs<4>    ( -21.076070181 3.3800987467 -0.37197264193 0.016832763917 );
        kappaLogCoeffs<4> ( -11.602015825 1.8441886933 -0.083997758971 0.0015731439265 );
    }
}
thermophysicalProperties (6,686 bytes)   

dkxls

2013-08-26 16:43

reporter  

logPolynomialTransport.C (3,570 bytes)   
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

\*---------------------------------------------------------------------------*/

#include "logPolynomialTransport.H"
#include "IOstreams.H"

// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

template<class Thermo, int PolySize>
Foam::logPolynomialTransport<Thermo, PolySize>::logPolynomialTransport(Istream& is)
:
    Thermo(is),
    muCoeffs_("muLogCoeffs<" + Foam::name(PolySize) + '>', is),
    kappaCoeffs_("kappaLogCoeffs<" + Foam::name(PolySize) + '>', is)
{
    muCoeffs_ *= this->W();
    kappaCoeffs_ *= this->W();
}


template<class Thermo, int PolySize>
Foam::logPolynomialTransport<Thermo, PolySize>::logPolynomialTransport
(
    const dictionary& dict
)
:
    Thermo(dict),
    muCoeffs_
    (
        dict.subDict("transport").lookup
        (
            "muLogCoeffs<" + Foam::name(PolySize) + '>'
        )
    ),
    kappaCoeffs_
    (
        dict.subDict("transport").lookup
        (
            "kappaLogCoeffs<" + Foam::name(PolySize) + '>'
        )
    )
{
    muCoeffs_ *= this->W();
    kappaCoeffs_ *= this->W();
}


// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //

template<class Thermo, int PolySize>
void Foam::logPolynomialTransport<Thermo, PolySize>::write(Ostream& os) const
{
    os  << this->name() << endl;
    os  << token::BEGIN_BLOCK << incrIndent << nl;

    Thermo::write(os);

    dictionary dict("transport");
    dict.add
    (
        word("muLogCoeffs<" + Foam::name(PolySize) + '>'),
        muCoeffs_/this->W()
    );
    dict.add
    (
        word("kappaLogCoeffs<" + Foam::name(PolySize) + '>'),
        kappaCoeffs_/this->W()
    );
    os  << indent << dict.dictName() << dict;

    os  << decrIndent << token::END_BLOCK << nl;
}


// * * * * * * * * * * * * * * * IOstream Operators  * * * * * * * * * * * * //

template<class Thermo, int PolySize>
Foam::Ostream& Foam::operator<<
(
    Ostream& os,
    const logPolynomialTransport<Thermo, PolySize>& pt
)
{
    os  << static_cast<const Thermo&>(pt) << tab
        << "muLogCoeffs<" << Foam::name(PolySize) << '>' << tab
        << pt.muCoeffs_/pt.W() << tab
        << "kappaLogCoeffs<" << Foam::name(PolySize) << '>' << tab
        << pt.kappaCoeffs_/pt.W();

    os.check
    (
        "Ostream& operator<<"
        "("
            "Ostream&, "
            "const logPolynomialTransport<Thermo, PolySize>&"
        ")"
    );

    return os;
}


// ************************************************************************* //
logPolynomialTransport.C (3,570 bytes)   

dkxls

2013-08-26 16:44

reporter  

logPolynomialTransport.H (6,683 bytes)   
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

Class
    Foam::logPolynomialTransport

Description
    Transport package using polynomial functions of ln(T) for mu and kappa:
        ln(mu)    = sum_i=1^N( a[i] * ln(T)^(i-1) )
        ln(kappa) = sum_i=1^N( b[i] * ln(T)^(i-1) )

SourceFiles
    logPolynomialTransportI.H
    logPolynomialTransport.C

\*---------------------------------------------------------------------------*/

#ifndef logPolynomialTransport_H
#define logPolynomialTransport_H

#include "Polynomial.H"

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

namespace Foam
{

// Forward declaration of friend functions and operators

template<class Thermo, int PolySize> class logPolynomialTransport;

template<class Thermo, int PolySize>
inline logPolynomialTransport<Thermo, PolySize> operator+
(
    const logPolynomialTransport<Thermo, PolySize>&,
    const logPolynomialTransport<Thermo, PolySize>&
);

template<class Thermo, int PolySize>
inline logPolynomialTransport<Thermo, PolySize> operator-
(
    const logPolynomialTransport<Thermo, PolySize>&,
    const logPolynomialTransport<Thermo, PolySize>&
);

template<class Thermo, int PolySize>
inline logPolynomialTransport<Thermo, PolySize> operator*
(
    const scalar,
    const logPolynomialTransport<Thermo, PolySize>&
);

template<class Thermo, int PolySize>
inline logPolynomialTransport<Thermo, PolySize> operator==
(
    const logPolynomialTransport<Thermo, PolySize>&,
    const logPolynomialTransport<Thermo, PolySize>&
);

template<class Thermo, int PolySize>
Ostream& operator<<
(
    Ostream&,
    const logPolynomialTransport<Thermo, PolySize>&
);


/*---------------------------------------------------------------------------*\
                     Class logPolynomialTransport Declaration
\*---------------------------------------------------------------------------*/

template<class Thermo, int PolySize=8>
class logPolynomialTransport
:
    public Thermo
{
    // Private data

        //- Dynamic viscosity polynomial coefficients
        //  Note: input in [Pa.s], but internally uses [Pa.s/kmol]
        Polynomial<PolySize> muCoeffs_;

        //- Thermal conductivity polynomial coefficients
        //  Note: input in [W/m/K], but internally uses [W/m/K/kmol]
        Polynomial<PolySize> kappaCoeffs_;


    // Private Member Functions

        //- Construct from components
        inline logPolynomialTransport
        (
            const Thermo& t,
            const Polynomial<PolySize>& muPoly,
            const Polynomial<PolySize>& kappaPoly
        );


public:

    // Constructors

        //- Construct copy
        inline logPolynomialTransport(const logPolynomialTransport&);

        //- Construct as named copy
        inline logPolynomialTransport(const word&, const logPolynomialTransport&);

        //- Construct from Istream
        logPolynomialTransport(Istream& is);

        //- Construct from dictionary
        logPolynomialTransport(const dictionary& dict);

        //- Construct and return a clone
        inline autoPtr<logPolynomialTransport> clone() const;

        // Selector from Istream
        inline static autoPtr<logPolynomialTransport> New(Istream& is);

        // Selector from dictionary
        inline static autoPtr<logPolynomialTransport> New(const dictionary& dict);


    // Member functions

        //- Return the instantiated type name
        static word typeName()
        {
            return "logPolynomial<" + Thermo::typeName() + '>';
        }

        //- Dynamic viscosity [kg/ms]
        inline scalar mu(const scalar p, const scalar T) const;

        //- Thermal conductivity [W/mK]
        inline scalar kappa(const scalar p, const scalar T) const;

        //- Thermal diffusivity of enthalpy [kg/ms]
        inline scalar alphah(const scalar p, const scalar T) const;

        // Species diffusivity
        //inline scalar D(const scalar p, const scalar T) const;

        //- Write to Ostream
        void write(Ostream& os) const;


    // Member operators

        inline logPolynomialTransport& operator=(const logPolynomialTransport&);
        inline void operator+=(const logPolynomialTransport&);
        inline void operator-=(const logPolynomialTransport&);
        inline void operator*=(const scalar);


    // Friend operators

        friend logPolynomialTransport operator+ <Thermo, PolySize>
        (
            const logPolynomialTransport&,
            const logPolynomialTransport&
        );

        friend logPolynomialTransport operator- <Thermo, PolySize>
        (
            const logPolynomialTransport&,
            const logPolynomialTransport&
        );

        friend logPolynomialTransport operator* <Thermo, PolySize>
        (
            const scalar,
            const logPolynomialTransport&
        );

        friend logPolynomialTransport operator== <Thermo, PolySize>
        (
            const logPolynomialTransport&,
            const logPolynomialTransport&
        );


    // Ostream Operator

        friend Ostream& operator<< <Thermo, PolySize>
        (
            Ostream&,
            const logPolynomialTransport&
        );
};


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

} // End namespace Foam

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

#include "logPolynomialTransportI.H"

#ifdef NoRepository
#   include "logPolynomialTransport.C"
#endif

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

#endif

// ************************************************************************* //
logPolynomialTransport.H (6,683 bytes)   

dkxls

2013-08-26 16:44

reporter  

logPolynomialTransportI.H (7,138 bytes)   
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

\*---------------------------------------------------------------------------*/

#include "specie.H"

// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

template<class Thermo, int PolySize>
inline Foam::logPolynomialTransport<Thermo, PolySize>::logPolynomialTransport
(
    const logPolynomialTransport& pt
)
:
    Thermo(pt),
    muCoeffs_(pt.muCoeffs_),
    kappaCoeffs_(pt.kappaCoeffs_)
{}


template<class Thermo, int PolySize>
inline Foam::logPolynomialTransport<Thermo, PolySize>::logPolynomialTransport
(
    const Thermo& t,
    const Polynomial<PolySize>& muCoeffs,
    const Polynomial<PolySize>& kappaCoeffs
)
:
    Thermo(t),
    muCoeffs_(muCoeffs),
    kappaCoeffs_(kappaCoeffs)
{}


template<class Thermo, int PolySize>
inline Foam::logPolynomialTransport<Thermo, PolySize>::logPolynomialTransport
(
    const word& name,
    const logPolynomialTransport& pt
)
:
    Thermo(name, pt),
    muCoeffs_(pt.muCoeffs_),
    kappaCoeffs_(pt.kappaCoeffs_)
{}


template<class Thermo, int PolySize>
inline Foam::autoPtr<Foam::logPolynomialTransport<Thermo, PolySize> >
Foam::logPolynomialTransport<Thermo, PolySize>::clone() const
{
    return autoPtr<logPolynomialTransport<Thermo, PolySize> >
    (
        new logPolynomialTransport<Thermo, PolySize>(*this)
    );
}


template<class Thermo, int PolySize>
inline Foam::autoPtr<Foam::logPolynomialTransport<Thermo, PolySize> >
Foam::logPolynomialTransport<Thermo, PolySize>::New(Istream& is)
{
    return autoPtr<logPolynomialTransport<Thermo, PolySize> >
    (
        new logPolynomialTransport<Thermo, PolySize>(is)
    );
}


template<class Thermo, int PolySize>
inline Foam::autoPtr<Foam::logPolynomialTransport<Thermo, PolySize> >
Foam::logPolynomialTransport<Thermo, PolySize>::New(const dictionary& dict)
{
    return autoPtr<logPolynomialTransport<Thermo, PolySize> >
    (
        new logPolynomialTransport<Thermo, PolySize>(dict)
    );
}


// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //

template<class Thermo, int PolySize>
inline Foam::scalar Foam::logPolynomialTransport<Thermo, PolySize>::mu
(
    const scalar p,
    const scalar T
) const
{
    return exp(muCoeffs_.value(log(T))/this->W());
}


template<class Thermo, int PolySize>
inline Foam::scalar Foam::logPolynomialTransport<Thermo, PolySize>::kappa
(
    const scalar p,
    const scalar T
) const
{
    return exp(kappaCoeffs_.value(log(T))/this->W());
}


template<class Thermo, int PolySize>
inline Foam::scalar Foam::logPolynomialTransport<Thermo, PolySize>::alphah
(
    const scalar p, const scalar T
) const
{
    return kappa(p, T)/this->Cpv(p, T);
}


// * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //

template<class Thermo, int PolySize>
inline Foam::logPolynomialTransport<Thermo, PolySize>&
Foam::logPolynomialTransport<Thermo, PolySize>::operator=
(
    const logPolynomialTransport<Thermo, PolySize>& pt
)
{
    Thermo::operator=(pt);

    muCoeffs_ = pt.muCoeffs_;
    kappaCoeffs_ = pt.kappaCoeffs_;

    return *this;
}


template<class Thermo, int PolySize>
inline void Foam::logPolynomialTransport<Thermo, PolySize>::operator+=
(
    const logPolynomialTransport<Thermo, PolySize>& pt
)
{
    scalar molr1 = this->nMoles();

    Thermo::operator+=(pt);

    molr1 /= this->nMoles();
    scalar molr2 = pt.nMoles()/this->nMoles();

    muCoeffs_ = molr1*muCoeffs_ + molr2*pt.muCoeffs_;
    kappaCoeffs_ = molr1*kappaCoeffs_ + molr2*pt.kappaCoeffs_;
}


template<class Thermo, int PolySize>
inline void Foam::logPolynomialTransport<Thermo, PolySize>::operator-=
(
    const logPolynomialTransport<Thermo, PolySize>& pt
)
{
    scalar molr1 = this->nMoles();

    Thermo::operator-=(pt);

    molr1 /= this->nMoles();
    scalar molr2 = pt.nMoles()/this->nMoles();

    muCoeffs_ = molr1*muCoeffs_ - molr2*pt.muCoeffs_;
    kappaCoeffs_ = molr1*kappaCoeffs_ - molr2*pt.kappaCoeffs_;
}


template<class Thermo, int PolySize>
inline void Foam::logPolynomialTransport<Thermo, PolySize>::operator*=
(
    const scalar s
)
{
    Thermo::operator*=(s);
}


// * * * * * * * * * * * * * * * Friend Operators  * * * * * * * * * * * * * //

template<class Thermo, int PolySize>
inline Foam::logPolynomialTransport<Thermo, PolySize> Foam::operator+
(
    const logPolynomialTransport<Thermo, PolySize>& pt1,
    const logPolynomialTransport<Thermo, PolySize>& pt2
)
{
    Thermo t
    (
        static_cast<const Thermo&>(pt1) + static_cast<const Thermo&>(pt2)
    );

    scalar molr1 = pt1.nMoles()/t.nMoles();
    scalar molr2 = pt2.nMoles()/t.nMoles();

    return logPolynomialTransport<Thermo, PolySize>
    (
        t,
        molr1*pt1.muCoeffs_ + molr2*pt2.muCoeffs_,
        molr1*pt1.kappaCoeffs_ + molr2*pt2.kappaCoeffs_
    );
}


template<class Thermo, int PolySize>
inline Foam::logPolynomialTransport<Thermo, PolySize> Foam::operator-
(
    const logPolynomialTransport<Thermo, PolySize>& pt1,
    const logPolynomialTransport<Thermo, PolySize>& pt2
)
{
    Thermo t
    (
        static_cast<const Thermo&>(pt1) - static_cast<const Thermo&>(pt2)
    );

    scalar molr1 = pt1.nMoles()/t.nMoles();
    scalar molr2 = pt2.nMoles()/t.nMoles();

    return logPolynomialTransport<Thermo, PolySize>
    (
        t,
        molr1*pt1.muCoeffs_ - molr2*pt2.muCoeffs_,
        molr1*pt1.kappaCoeffs_ - molr2*pt2.kappaCoeffs_
    );
}


template<class Thermo, int PolySize>
inline Foam::logPolynomialTransport<Thermo, PolySize> Foam::operator*
(
    const scalar s,
    const logPolynomialTransport<Thermo, PolySize>& pt
)
{
    return logPolynomialTransport<Thermo, PolySize>
    (
        s*static_cast<const Thermo&>(pt),
        pt.muCoeffs_,
        pt.kappaCoeffs_
    );
}


template<class Thermo, int PolySize>
inline Foam::logPolynomialTransport<Thermo, PolySize> Foam::operator==
(
    const logPolynomialTransport<Thermo, PolySize>& pt1,
    const logPolynomialTransport<Thermo, PolySize>& pt2
)
{
    return pt2 - pt1;
}


// ************************************************************************* //
logPolynomialTransportI.H (7,138 bytes)   

dkxls

2013-08-26 17:02

reporter   ~0002442

Forgot to mention that the provided source code is a straight forward implementation based on the polynomialTransport class.

The code is tested with a modified reactingFoam solver.

henry

2016-02-02 19:04

manager   ~0005881

Resolved in OpenFOAM-dev by commit 38b494fbc0d81aaf57d9ee18bb1ec9af6f399210

Issue History

Date Modified Username Field Change
2013-08-26 16:42 dkxls New Issue
2013-08-26 16:43 dkxls File Added: thermophysicalProperties
2013-08-26 16:43 dkxls File Added: logPolynomialTransport.C
2013-08-26 16:44 dkxls File Added: logPolynomialTransport.H
2013-08-26 16:44 dkxls File Added: logPolynomialTransportI.H
2013-08-26 16:45 dkxls Tag Attached: thermo
2013-08-26 16:45 dkxls Tag Attached: transport
2013-08-26 17:02 dkxls Note Added: 0002442
2015-02-15 17:24 wyldckat Tag Attached: contribution
2016-02-02 19:04 henry Note Added: 0005881
2016-02-02 19:04 henry Status new => resolved
2016-02-02 19:04 henry Resolution open => fixed
2016-02-02 19:04 henry Assigned To => henry