infinitelyFastChemistry.C 4.23 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 2009-2011 OpenCFD Ltd.
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License

    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 "infinitelyFastChemistry.H"
#include "addToRunTimeSelectionTable.H"
#include "fvmSup.H"

// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

namespace Foam
{
namespace combustionModels
{
    defineTypeNameAndDebug(infinitelyFastChemistry, 0);
    addToRunTimeSelectionTable
    (
        combustionModel,
        infinitelyFastChemistry,
        dictionary
    );
};
};


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

Foam::combustionModels::infinitelyFastChemistry::infinitelyFastChemistry
(
    const dictionary& combustionProps,
    hsCombustionThermo& thermo,
    const compressible::turbulenceModel& turbulence,
    const surfaceScalarField& phi,
    const volScalarField& rho
)
:
    combustionModel(typeName, combustionProps, thermo, turbulence, phi, rho),
    C_(readScalar(coeffs_.lookup("C"))),
    singleMixture_
    (
        dynamic_cast<singleStepReactingMixture<gasThermoPhysics>&>(thermo)
    ),
    wFuelNorm_
    (
        IOobject
        (
            "wFuelNorm",
            mesh_.time().timeName(),
            mesh_,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        mesh_,
        dimensionedScalar("zero", dimMass/pow3(dimLength)/dimTime, 0.0)
    )
{}


// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //

Foam::combustionModels::infinitelyFastChemistry::~infinitelyFastChemistry()
{}


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

void Foam::combustionModels::infinitelyFastChemistry::correct()
{
    singleMixture_.fresCorrect();

    const label fuelI = singleMixture_.fuelIndex();

    const volScalarField& YFuel = thermo_.composition().Y()[fuelI];

    const dimensionedScalar s = singleMixture_.s();

    if (thermo_.composition().contains("O2"))
    {
        const volScalarField& YO2 = thermo_.composition().Y("O2");
        wFuelNorm_ == rho_/(mesh_.time().deltaT()*C_)*min(YFuel, YO2/s.value());
    }
}


Foam::tmp<Foam::fvScalarMatrix>
Foam::combustionModels::infinitelyFastChemistry::R(volScalarField& Y) const
{
    const label specieI = thermo_.composition().species()[Y.name()];

    const label fNorm = singleMixture_.specieProd()[specieI];

112
    const volScalarField fres(singleMixture_.fres(specieI));
113

114 115
    const volScalarField wSpecie
    (
116
        wFuelNorm_*singleMixture_.specieStoichCoeffs()[specieI]
117 118
      / max(fNorm*(Y - fres), scalar(0.001))
    );
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153

    return -fNorm*wSpecie*fres + fNorm*fvm::Sp(wSpecie, Y);
}


Foam::tmp<Foam::volScalarField>
Foam::combustionModels::infinitelyFastChemistry::dQ() const
{
    const label fuelI = singleMixture_.fuelIndex();
    volScalarField& YFuel = thermo_.composition().Y(fuelI);

    return -singleMixture_.qFuel()*(R(YFuel) & YFuel);
}


Foam::tmp<Foam::volScalarField>
Foam::combustionModels::infinitelyFastChemistry::wFuelNorm() const
{
    return wFuelNorm_;
}


bool Foam::combustionModels::infinitelyFastChemistry::read
(
    const dictionary& combustionProps
)
{
    combustionModel::read(combustionProps);
    coeffs_.lookup("C") >> C_ ;

    return true;
}


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