Loading...
Searching...
No Matches
singleStepCombustion.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2017 OpenFOAM Foundation
9 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
30#include "fvmSup.H"
31
32namespace Foam
34namespace combustionModels
35{
36
37// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38
39template<class ReactionThermo, class ThermoType>
40singleStepCombustion<ReactionThermo, ThermoType>::singleStepCombustion
41(
42 const word& modelType,
43 ReactionThermo& thermo,
45 const word& combustionProperties
46)
47:
48 ThermoCombustion<ReactionThermo>(modelType, thermo, turb),
49 singleMixturePtr_(nullptr),
50 wFuel_
51 (
53 (
54 this->thermo().phasePropertyName("wFuel"),
55 this->mesh().time().timeName(),
56 this->mesh(),
59 ),
60 this->mesh(),
62 ),
63 semiImplicit_(this->coeffs_.getBool("semiImplicit"))
64{
66 {
69 (
70 this->thermo()
71 );
72 }
73 else
74 {
76 << "Inconsistent thermo package for " << this->type() << " model:\n"
77 << " " << this->thermo().type() << nl << nl
78 << "Please select a thermo package based on "
79 << "singleStepReactingMixture" << exit(FatalError);
80 }
81
82 if (semiImplicit_)
83 {
84 Info<< "Combustion mode: semi-implicit" << endl;
85 }
86 else
87 {
88 Info<< "Combustion mode: explicit" << endl;
89 }
90}
91
92
93// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
94
95template<class ReactionThermo, class ThermoType>
97{}
98
99
100// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
101
102template<class ReactionThermo, class ThermoType>
104(
106) const
107{
108 const label specieI =
109 this->thermo().composition().species().find(Y.member());
110
111 volScalarField wSpecie
112 (
113 wFuel_*singleMixturePtr_->specieStoichCoeffs()[specieI]
114 );
115
116 if (semiImplicit_)
117 {
118 const label fNorm = singleMixturePtr_->specieProd()[specieI];
119 const volScalarField fres(singleMixturePtr_->fres(specieI));
120 wSpecie /= max(fNorm*(Y - fres), scalar(1e-2));
121
122 return -fNorm*wSpecie*fres + scalar(fNorm)*fvm::Sp(wSpecie, Y);
123 }
125 return wSpecie + fvm::Sp(0.0*wSpecie, Y);
126}
127
128
129template<class ReactionThermo, class ThermoType>
132{
133 const label fuelI = singleMixturePtr_->fuelIndex();
134 volScalarField& YFuel = this->thermo().composition().Y(fuelI).constCast();
135
136 return -singleMixturePtr_->qFuel()*(R(YFuel) & YFuel);
137}
138
139
140template<class ReactionThermo, class ThermoType>
142{
144 {
145 return true;
146 }
147
148 return false;
149}
150
151
152// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153
154} // End namespace combustionModels
155} // End namespace Foam
156
157// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define R(A, B, C, D, E, F, K, M)
compressible::turbulenceModel & turb
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
const Time & time() const noexcept
Return Time associated with the objectRegistry.
Definition IOobject.C:456
static word member(const word &name)
Return member (name without the extension).
Definition IOobject.C:313
virtual ReactionThermo & thermo()
Return access to the thermo package.
dictionary coeffs_
Dictionary of the model.
const fvMesh & mesh() const
Return const access to the mesh database.
virtual bool read()
Update properties from given dictionary.
virtual tmp< fvScalarMatrix > R(volScalarField &Y) const
Fuel consumption rate matrix.
singleStepReactingMixture< ThermoType > * singleMixturePtr_
Pointer to singleStepReactingMixture mixture.
volScalarField wFuel_
Fuel consumption rate.
virtual tmp< volScalarField > Qdot() const
Heat release rate [kg/m/s3].
bool semiImplicit_
Semi-implicit (true) or explicit (false) treatment.
virtual bool read()
Update properties from given dictionary.
Abstract base class for turbulence models (RAS, LES and laminar).
bool getBool(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Same as get<bool>(const word&, keyType::option).
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
PtrList< volScalarField > & Y
dynamicFvMesh & mesh
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
Calculate the finiteVolume matrix for implicit and explicit sources.
word timeName
Definition getTimeIndex.H:3
zeroField Sp(const Foam::zero, const GeometricField< Type, fvPatchField, volMesh > &)
A no-op source.
Namespace for OpenFOAM.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition hashSets.C:40
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
messageStream Info
Information stream (stdout output on master, null elsewhere).
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition POSIX.C:801
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
Definition typeInfo.H:87
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
const dimensionSet dimVolume(pow3(dimLength))
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
psiReactionThermo & thermo
volScalarField & e