PaSR.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 -------------------------------------------------------------------------------
11 License
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 
29 #include "PaSR.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 template<class ReactionThermo>
35 (
36  const word& modelType,
37  ReactionThermo& thermo,
39  const word& combustionProperties
40 )
41 :
42  laminar<ReactionThermo>(modelType, thermo, turb, combustionProperties),
43  Cmix_(this->coeffs().getScalar("Cmix")),
44  kappa_
45  (
46  IOobject
47  (
48  thermo.phasePropertyName(typeName + ":kappa"),
49  this->mesh().time().timeName(),
50  this->mesh(),
51  IOobject::NO_READ,
52  IOobject::AUTO_WRITE
53  ),
54  this->mesh(),
56  )
57 {}
58 
59 
60 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
61 
62 template<class ReactionThermo>
64 {}
65 
66 
67 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
68 
69 template<class ReactionThermo>
71 {
72  if (this->active())
73  {
75 
76  tmp<volScalarField> tepsilon(this->turbulence().epsilon());
77  const scalarField& epsilon = tepsilon();
78 
79  tmp<volScalarField> tmuEff(this->turbulence().muEff());
80  const scalarField& muEff = tmuEff();
81 
82  tmp<volScalarField> ttc(this->tc());
83  const scalarField& tc = ttc();
84 
85  tmp<volScalarField> trho(this->rho());
86  const scalarField& rho = trho();
87 
88  forAll(epsilon, i)
89  {
90  const scalar tk =
91  Cmix_*sqrt(max(muEff[i]/rho[i]/(epsilon[i] + SMALL), 0));
92 
93  if (tk > SMALL)
94  {
95  kappa_[i] = tc[i]/(tc[i] + tk);
96  }
97  else
98  {
99  kappa_[i] = 1.0;
100  }
101  }
102  }
103 }
104 
105 
106 template<class ReactionThermo>
109 {
110  return kappa_*laminar<ReactionThermo>::R(Y);
111 }
112 
113 
114 template<class ReactionThermo>
117 {
118  return tmp<volScalarField>
119  (
120  new volScalarField
121  (
122  this->thermo().phasePropertyName(typeName + ":Qdot"),
124  )
125  );
126 }
127 
128 
129 template<class ReactionThermo>
131 {
133  {
134  this->coeffs().readEntry("Cmix", Cmix_);
135  return true;
136  }
137 
138  return false;
139 }
140 
141 
142 // ************************************************************************* //
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::combustionModels::PaSR::R
virtual tmp< fvScalarMatrix > R(volScalarField &Y) const
Fuel consumption rate matrix.
Definition: PaSR.C:108
Foam::combustionModels::PaSR::Qdot
virtual tmp< volScalarField > Qdot() const
Heat release rate [kg/m/s3].
Definition: PaSR.C:116
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
turbulence
Info<< "Reading field U\n"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);volScalarField rho(IOobject("rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), thermo.rho());volVectorField rhoU(IOobject("rhoU", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *U);volScalarField rhoE(IOobject("rhoE", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *(e+0.5 *magSqr(U)));surfaceScalarField pos(IOobject("pos", runTime.timeName(), mesh), mesh, dimensionedScalar("pos", dimless, 1.0));surfaceScalarField neg(IOobject("neg", runTime.timeName(), mesh), mesh, dimensionedScalar("neg", dimless, -1.0));surfaceScalarField phi("phi", fvc::flux(rhoU));Info<< "Creating turbulence model\n"<< endl;autoPtr< compressible::turbulenceModel > turbulence(compressible::turbulenceModel::New(rho, U, phi, thermo))
Definition: createFields.H:94
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
thermo
psiReactionThermo & thermo
Definition: createFields.H:28
thermo
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Foam::combustionModels::PaSR::~PaSR
virtual ~PaSR()
Destructor.
Definition: PaSR.C:63
rho
rho
Definition: readInitialConditions.H:88
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::combustionModels::laminar
Laminar combustion model.
Definition: laminar.H:56
trho
tmp< volScalarField > trho
Definition: setRegionSolidFields.H:4
R
#define R(A, B, C, D, E, F, K, M)
Foam::Field< scalar >
correct
fvOptions correct(rho)
PaSR.H
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::combustionModels::PaSR
Partially stirred reactor turbulent combustion model.
Definition: PaSR.H:60
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Y
PtrList< volScalarField > & Y
Definition: createFieldRefs.H:7
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:144
Foam::combustionModels::PaSR::read
virtual bool read()
Update properties from given dictionary.
Definition: PaSR.C:130
epsilon
scalar epsilon
Definition: evaluateNearWall.H:7
Foam::GeometricField< scalar, fvPatchField, volMesh >
turb
compressible::turbulenceModel & turb
Definition: setRegionFluidFields.H:10
Foam::compressibleTurbulenceModel
Abstract base class for turbulence models (RAS, LES and laminar).
Definition: compressibleTurbulenceModel.H:54
Foam::combustionModels::PaSR::correct
virtual void correct()
Correct combustion rate.
Definition: PaSR.C:70
Foam::dimless
const dimensionSet dimless
Dimensionless.
Definition: dimensionSets.C:189