PaSR.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "PaSR.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class ReactionThermo>
32 (
33  const word& modelType,
34  ReactionThermo& thermo,
35  const compressibleTurbulenceModel& turb,
36  const word& combustionProperties
37 )
38 :
39  laminar<ReactionThermo>(modelType, thermo, turb, combustionProperties),
40  Cmix_(readScalar(this->coeffs().lookup("Cmix"))),
41  kappa_
42  (
43  IOobject
44  (
45  thermo.phasePropertyName(typeName + ":kappa"),
46  this->mesh().time().timeName(),
47  this->mesh(),
48  IOobject::NO_READ,
49  IOobject::AUTO_WRITE
50  ),
51  this->mesh(),
52  dimensionedScalar("kappa", dimless, 0)
53  )
54 {}
55 
56 
57 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
58 
59 template<class ReactionThermo>
61 {}
62 
63 
64 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
65 
66 template<class ReactionThermo>
68 {
69  if (this->active())
70  {
72 
73  tmp<volScalarField> tepsilon(this->turbulence().epsilon());
74  const scalarField& epsilon = tepsilon();
75 
76  tmp<volScalarField> tmuEff(this->turbulence().muEff());
77  const scalarField& muEff = tmuEff();
78 
79  tmp<volScalarField> ttc(this->tc());
80  const scalarField& tc = ttc();
81 
82  tmp<volScalarField> trho(this->rho());
83  const scalarField& rho = trho();
84 
85  forAll(epsilon, i)
86  {
87  const scalar tk =
88  Cmix_*sqrt(max(muEff[i]/rho[i]/(epsilon[i] + small), 0));
89 
90  if (tk > small)
91  {
92  kappa_[i] = tc[i]/(tc[i] + tk);
93  }
94  else
95  {
96  kappa_[i] = 1.0;
97  }
98  }
99  }
100 }
101 
102 
103 template<class ReactionThermo>
106 {
107  return kappa_*laminar<ReactionThermo>::R(Y);
108 }
109 
110 
111 template<class ReactionThermo>
114 {
115  return tmp<volScalarField>
116  (
117  new volScalarField
118  (
119  this->thermo().phasePropertyName(typeName + ":Qdot"),
121  )
122  );
123 }
124 
125 
126 template<class ReactionThermo>
128 {
130  {
131  this->coeffs().lookup("Cmix") >> Cmix_;
132  return true;
133  }
134  else
135  {
136  return false;
137  }
138 }
139 
140 
141 // ************************************************************************* //
#define readScalar
Definition: doubleScalar.C:38
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
virtual tmp< fvScalarMatrix > R(volScalarField &Y) const
Fuel consumption rate matrix.
Definition: PaSR.C:105
virtual tmp< volScalarField > Qdot() const
Heat release rate [kg/m/s3].
Definition: PaSR.C:113
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
virtual bool read()
Update properties from given dictionary.
Definition: PaSR.C:127
dimensionedScalar sqrt(const dimensionedScalar &ds)
tmp< volScalarField > trho
rhoReactionThermo & thermo
Definition: createFields.H:28
Partially stirred reactor turbulent combustion model.
Definition: PaSR.H:55
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
Laminar combustion model.
Definition: laminar.H:51
stressControl lookup("compactNormalStress") >> compactNormalStress
dynamicFvMesh & mesh
A class for handling words, derived from string.
Definition: word.H:59
Abstract base class for turbulence models (RAS, LES and laminar).
Info<< "Predicted p max-min : "<< max(p).value()<< " "<< min(p).value()<< endl;rho==max(psi *p+alphal *rhol0+((alphav *psiv+alphal *psil) - psi) *pSat, rhoMin);# 1 "/home/ubuntu/OpenFOAM-6/applications/solvers/multiphase/cavitatingFoam/alphavPsi.H" 1{ alphav=max(min((rho - rholSat)/(rhovSat - rholSat), scalar(1)), scalar(0));alphal=1.0 - alphav;Info<< "max-min alphav: "<< max(alphav).value()<< " "<< min(alphav).value()<< endl;psiModel-> correct()
Definition: pEqn.H:72
Info<< "Reading field U\"<< 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\"<< endl;autoPtr< compressible::turbulenceModel > turbulence(compressible::turbulenceModel::New(rho, U, phi, thermo))
Definition: createFields.H:94
virtual void correct()
Correct combustion rate.
Definition: PaSR.C:67
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
#define R(A, B, C, D, E, F, K, M)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
PtrList< volScalarField > & Y
scalar epsilon
virtual ~PaSR()
Destructor.
Definition: PaSR.C:60
A class for managing temporary objects.
Definition: PtrList.H:53
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92