laminarThermophysicalTransportModel.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 "unityLewisFourier.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  laminarDict_(this->subOrEmptyDict("laminar")),
61  printCoeffs_(laminarDict_.lookupOrDefault<Switch>("printCoeffs", false)),
62  coeffDict_(laminarDict_.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("laminar").lookup( "model"));
104 
105  Info<< "Selecting laminar 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 laminar 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  Info<< "Selecting default laminar thermophysical transport model "
130  BasicThermophysicalTransportModel>::typeName << endl;
131 
133  (
135  <
136  BasicThermophysicalTransportModel
137  >(momentumTransport, thermo)
138  );
139  }
140 }
141 
142 
143 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
144 
145 template<class BasicThermophysicalTransportModel>
147 <
148  BasicThermophysicalTransportModel
150 {
152  {
153  laminarDict_ <<= this->subDict("laminar");
154 
155  coeffDict_ <<= laminarDict_.optionalSubDict(type() + "Coeffs");
156 
157  return true;
158  }
159  else
160  {
161  return false;
162  }
163 }
164 
165 
166 template<class BasicThermophysicalTransportModel>
168 <
169  BasicThermophysicalTransportModel
171 {
173 }
174 
175 
176 // ************************************************************************* //
Templated abstract base class for laminar thermophysical transport models.
fluidReactionThermo & thermo
Definition: createFields.H:28
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:323
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
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
void read(Istream &, label &, const dictionary &)
In-place read with dictionary lookup.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:982
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
Info<< "Predicted p max-min : "<< max(p).value()<< " "<< min(p).value()<< endl;rho==max(rho0+psi *p, rhoMin);# 1 "/home/ubuntu/OpenFOAM-9/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
static const char nl
Definition: Ostream.H:260
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
unityLewisFourier&#39;s energy gradient heat flux model for laminar flow. Specie fluxes are computed assu...
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:844