basicXiSubXiEq.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 | Copyright (C) 2011-2015 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 "basicXiSubXiEq.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace XiEqModels
35 {
36  defineTypeNameAndDebug(basicSubGrid, 0);
37  addToRunTimeSelectionTable(XiEqModel, basicSubGrid, dictionary);
38 }
39 }
40 
41 
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 
45 (
46  const dictionary& XiEqProperties,
47  const psiuReactionThermo& thermo,
49  const volScalarField& Su
50 )
51 :
52  XiEqModel(XiEqProperties, thermo, turbulence, Su),
53 
54  B_
55  (
56  IOobject
57  (
58  "B",
59  Su.mesh().facesInstance(),
60  Su.mesh(),
61  IOobject::MUST_READ,
62  IOobject::NO_WRITE
63  ),
64  Su.mesh()
65  ),
66 
67  XiEqModel_(XiEqModel::New(XiEqModelCoeffs_, thermo, turbulence, Su))
68 {}
69 
70 
71 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
72 
74 {}
75 
76 
77 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
78 
80 {
81  const fvMesh& mesh = Su_.mesh();
82  const volVectorField& U = mesh.lookupObject<volVectorField>("U");
83 
84  const volScalarField& Nv = mesh.lookupObject<volScalarField>("Nv");
85  const volSymmTensorField& nsv =
86  mesh.lookupObject<volSymmTensorField>("nsv");
87 
88  volScalarField magU(mag(U));
89  volVectorField Uhat
90  (
91  U/(mag(U) + dimensionedScalar("Usmall", U.dimensions(), 1e-4))
92  );
93 
94  const scalarField Cw = pow(mesh.V(), 2.0/3.0);
95 
96  tmp<volScalarField> tN
97  (
98  new volScalarField
99  (
100  IOobject
101  (
102  "tN",
103  mesh.time().constant(),
104  mesh,
107  ),
108  mesh,
109  dimensionedScalar("zero", Nv.dimensions(), 0.0),
110  zeroGradientFvPatchVectorField::typeName
111  )
112  );
113 
114  volScalarField& N = tN();
115 
116  N.internalField() = Nv.internalField()*Cw;
117 
118  tmp<volSymmTensorField> tns
119  (
121  (
122  IOobject
123  (
124  "tns",
125  U.mesh().time().timeName(),
126  U.mesh(),
129  ),
130  U.mesh(),
132  (
133  "zero",
134  nsv.dimensions(),
135  pTraits<symmTensor>::zero
136  ),
137  zeroGradientFvPatchSymmTensorField::typeName
138  )
139  );
140 
141  volSymmTensorField& ns = tns();
142 
143  ns.internalField() = nsv.internalField()*Cw;
144 
145  volScalarField n(max(N - (Uhat & ns & Uhat), scalar(1e-4)));
146 
147  volScalarField b((Uhat & B_ & Uhat)/sqrt(n));
148 
149  volScalarField up(sqrt((2.0/3.0)*turbulence_.k()));
150 
151  volScalarField XiSubEq
152  (
153  scalar(1)
154  + max(2.2*sqrt(b), min(0.34*magU/up*sqrt(b), scalar(1.6)))
155  * min(n, scalar(1))
156  );
157 
158  return (XiSubEq*XiEqModel_->XiEq());
159 }
160 
161 
162 bool Foam::XiEqModels::basicSubGrid::read(const dictionary& XiEqProperties)
163 {
164  XiEqModel::read(XiEqProperties);
165 
166  return XiEqModel_->read(XiEqModelCoeffs_);
167 }
168 
169 
170 // ************************************************************************* //
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:48
Foam::compressible::New
autoPtr< BasicCompressibleTurbulenceModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleTurbulenceModel::transportModel &transport, const word &propertiesName)
Definition: turbulentFluidThermoModel.C:36
Foam::dimensionedSymmTensor
dimensioned< symmTensor > dimensionedSymmTensor
Dimensioned tensor obtained from generic dimensioned type.
Definition: dimensionedSymmTensor.H:48
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
basicXiSubXiEq.H
thermo
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
Foam::XiEqModels::basicSubGrid::basicSubGrid
basicSubGrid(const basicSubGrid &)
Disallow copy construct.
Foam::XiEqModels::basicSubGrid::~basicSubGrid
virtual ~basicSubGrid()
Destructor.
Foam::IOobject::NO_WRITE
@ NO_WRITE
Definition: IOobject.H:118
U
U
Definition: pEqn.H:46
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::XiEqModel::read
virtual bool read(const dictionary &XiEqProperties)=0
Update properties from given dictionary.
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:28
Foam::fvc::Su
tmp< GeometricField< Type, fvPatchField, volMesh > > Su(const GeometricField< Type, fvPatchField, volMesh > &su, const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvcSup.C:44
Foam::volSymmTensorField
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
Definition: volFieldsFwd.H:58
turbulence
autoPtr< compressible::turbulenceModel > turbulence
Definition: createFields.H:23
Foam::IOobject::NO_READ
@ NO_READ
Definition: IOobject.H:111
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:41
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:73
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::e
const double e
Elementary charge.
Definition: doubleFloat.H:94
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::XiEqModels::basicSubGrid::XiEq
virtual tmp< volScalarField > XiEq() const
Return the flame-wrinking XiEq.
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:142
RASModel
Info<< "Reading field U\n"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);singlePhaseTransportModel laminarTransport(U, phi);autoPtr< incompressible::RASModel > RASModel(incompressible::New< incompressible::RASModel >(U, phi, laminarTransport))
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
zeroGradientFvPatchFields.H
Foam::min
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
N
label N
Definition: createFields.H:22
Foam::XiEqModels::basicSubGrid::read
virtual bool read(const dictionary &XiEqProperties)
Update properties from given dictionary.