LESThermophysicalTransportModel.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) 2020 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 
27 #include "eddyDiffusivity.H"
28 
29 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
30 
31 template<class BasicThermophysicalTransportModel>
33 <
34  BasicThermophysicalTransportModel
35 >::printCoeffs
36 (
37  const word& type)
38 {
39  if (printCoeffs_)
40  {
41  Info<< coeffDict_.dictName() << coeffDict_ << endl;
42  }
43 }
44 
45 
46 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 
48 template<class BasicThermophysicalTransportModel>
50 <
51  BasicThermophysicalTransportModel
53 (
54  const word& type,
55  const momentumTransportModel& momentumTransport,
56  const thermoModel& thermo
57 )
58 :
59  BasicThermophysicalTransportModel(momentumTransport, thermo),
60  LESDict_(this->subOrEmptyDict("LES")),
61  printCoeffs_(LESDict_.lookupOrDefault<Switch>("printCoeffs", false)),
62  coeffDict_(LESDict_.optionalSubDict(type + "Coeffs"))
63 {}
64 
65 
66 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
67 
68 template<class BasicThermophysicalTransportModel>
70 <
72  <
73  BasicThermophysicalTransportModel
74  >
75 >
77 <
78  BasicThermophysicalTransportModel
79 >::New
80 (
81  const momentumTransportModel& momentumTransport,
82  const thermoModel& thermo
83 )
84 {
85  IOobject header
86  (
87  IOobject::groupName
88  (
89  thermophysicalTransportModel::typeName,
90  momentumTransport.alphaRhoPhi().group()
91  ),
92  momentumTransport.time().constant(),
93  momentumTransport.mesh(),
94  IOobject::MUST_READ,
95  IOobject::NO_WRITE,
96  false
97  );
98 
99  if (header.typeHeaderOk<IOdictionary>(true))
100  {
101  IOdictionary modelDict(header);
102 
103  const word modelType(modelDict.subDict("LES").lookup( "model"));
104 
105  Info<< "Selecting LES thermophysical transport model "
106  << modelType << endl;
107 
108  typename dictionaryConstructorTable::iterator cstrIter =
109  dictionaryConstructorTablePtr_->find(modelType);
110 
111  if (cstrIter == dictionaryConstructorTablePtr_->end())
112  {
114  << "Unknown LES thermophysical transport model "
115  << modelType << nl << nl
116  << "Available models:" << endl
117  << dictionaryConstructorTablePtr_->sortedToc()
118  << exit(FatalError);
119  }
120 
122  (
123  cstrIter()(momentumTransport, thermo)
124  );
125  }
126  else
127  {
128  typedef
130  <
132  <
133  BasicThermophysicalTransportModel
134  >
135  > LESeddyDiffusivity;
136 
137  Info<< "Selecting default LES thermophysical transport model "
138  << LESeddyDiffusivity::typeName << endl;
139 
141  (
142  new LESeddyDiffusivity
143  (
144  LESeddyDiffusivity::typeName,
145  momentumTransport,
146  thermo,
147  true
148  )
149  );
150  }
151 }
152 
153 
154 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
155 
156 template<class BasicThermophysicalTransportModel>
158 <
159  BasicThermophysicalTransportModel
161 {
163  {
164  LESDict_ <<= this->subDict("LES");
165 
166  coeffDict_ <<= LESDict_.optionalSubDict(type() + "Coeffs");
167 
168  return true;
169  }
170  else
171  {
172  return false;
173  }
174 }
175 
176 
177 template<class BasicThermophysicalTransportModel>
180 {
182 }
183 
184 
185 // ************************************************************************* //
Templated abstract base class for LES thermophysical transport models.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
BasicThermophysicalTransportModel::momentumTransportModel momentumTransportModel
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Definition: Switch.H:60
Eddy-diffusivity based gradient heat flux model for RAS or LES of turbulent flow. Specie fluxes are c...
void read(Istream &, label &, const dictionary &)
In-place read with dictionary lookup.
rhoReactionThermo & thermo
Definition: createFields.H:28
BasicThermophysicalTransportModel::thermoModel thermoModel
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:52
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:934
virtual void correct()
Correct the LES transport.
autoPtr< BasicCompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleMomentumTransportModel::transportModel &transport)
A class for handling words, derived from string.
Definition: word.H:59
static const char nl
Definition: Ostream.H:260
Info<< "Predicted p max-min : "<< max(p).value()<< " "<< min(p).value()<< endl;rho==max(rho0+psi *p, rhoMin);# 1 "/home/ubuntu/OpenFOAM-8/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:68
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
messageStream Info
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:812