All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
constantFilmThermo.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) 2013-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 "constantFilmThermo.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace regionModels
35 {
36 namespace surfaceFilmModels
37 {
38 
39 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 
41 defineTypeNameAndDebug(constantFilmThermo, 0);
42 
44 (
45  filmThermoModel,
46  constantFilmThermo,
47  dictionary
48 );
49 
50 
51 void constantFilmThermo::init(thermoData& td)
52 {
53  if (coeffDict_.readIfPresent(td.name_, td.value_))
54  {
55  td.set_ = true;
56  }
57 }
58 
59 
60 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
61 
63 (
65  const dictionary& dict
66 )
67 :
68  filmThermoModel(typeName, film, dict),
69  name_(coeffDict_.lookup("specie")),
70  rho0_("rho0"),
71  mu0_("mu0"),
72  sigma0_("sigma0"),
73  Cp0_("Cp0"),
74  kappa0_("kappa0"),
75  D0_("D0"),
76  hl0_("hl0"),
77  pv0_("pv0"),
78  W0_("W0"),
79  Tb0_("Tb0")
80 {
81  init(rho0_);
82  init(mu0_);
83  init(sigma0_);
84  init(Cp0_);
85  init(kappa0_);
86  init(D0_);
87  init(hl0_);
88  init(pv0_);
89  init(W0_);
90  init(Tb0_);
91 }
92 
93 
94 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
95 
97 {}
98 
99 
100 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
101 
103 {
104  return name_;
105 }
106 
107 
109 (
110  const scalar p,
111  const scalar T
112 ) const
113 {
114  if (!rho0_.set_)
115  {
116  coeffDict_.lookup(rho0_.name_) >> rho0_.value_;
117  rho0_.set_ = true;
118  }
119 
120  return rho0_.value_;
121 }
122 
123 
125 (
126  const scalar p,
127  const scalar T
128 ) const
129 {
130  if (!mu0_.set_)
131  {
132  coeffDict_.lookup(mu0_.name_) >> mu0_.value_;
133  mu0_.set_ = true;
134  }
135 
136  return mu0_.value_;
137 }
138 
139 
141 (
142  const scalar p,
143  const scalar T
144 ) const
145 {
146  if (!sigma0_.set_)
147  {
148  coeffDict_.lookup(sigma0_.name_) >> sigma0_.value_;
149  sigma0_.set_ = true;
150  }
151 
152  return sigma0_.value_;
153 }
154 
155 
157 (
158  const scalar p,
159  const scalar T
160 ) const
161 {
162  if (!Cp0_.set_)
163  {
164  coeffDict_.lookup(Cp0_.name_) >> Cp0_.value_;
165  Cp0_.set_ = true;
166  }
167 
168  return Cp0_.value_;
169 }
170 
171 
173 (
174  const scalar p,
175  const scalar T
176 ) const
177 {
178  if (!kappa0_.set_)
179  {
180  coeffDict_.lookup(kappa0_.name_) >> kappa0_.value_;
181  kappa0_.set_ = true;
182  }
183 
184  return kappa0_.value_;
185 }
186 
187 
189 (
190  const scalar p,
191  const scalar T
192 ) const
193 {
194  if (!D0_.set_)
195  {
196  coeffDict_.lookup(D0_.name_) >> D0_.value_;
197  D0_.set_ = true;
198  }
199 
200  return D0_.value_;
201 }
202 
203 
205 (
206  const scalar p,
207  const scalar T
208 ) const
209 {
210  if (!hl0_.set_)
211  {
212  coeffDict_.lookup(hl0_.name_) >> hl0_.value_;
213  hl0_.set_ = true;
214  }
215 
216  return hl0_.value_;
217 }
218 
219 
221 (
222  const scalar p,
223  const scalar T
224 ) const
225 {
226  if (!pv0_.set_)
227  {
228  coeffDict_.lookup(pv0_.name_) >> pv0_.value_;
229  pv0_.set_ = true;
230  }
231 
232  return pv0_.value_;
233 }
234 
235 
236 scalar constantFilmThermo::W() const
237 {
238  if (!W0_.set_)
239  {
240  coeffDict_.lookup(W0_.name_) >> W0_.value_;
241  W0_.set_ = true;
242  }
243 
244  return W0_.value_;
245 }
246 
247 
248 scalar constantFilmThermo::Tb(const scalar p) const
249 {
250  if (!Tb0_.set_)
251  {
252  coeffDict_.lookup(Tb0_.name_) >> Tb0_.value_;
253  Tb0_.set_ = true;
254  }
255 
256  return Tb0_.value_;
257 }
258 
259 
261 {
263  (
265  (
266  type() + ':' + rho0_.name_,
267  film().regionMesh(),
269  extrapolatedCalculatedFvPatchScalarField::typeName
270  )
271  );
272 
273  trho.ref().primitiveFieldRef() = this->rho(0, 0);
274  trho.ref().correctBoundaryConditions();
275 
276  return trho;
277 }
278 
279 
281 {
283  (
285  (
286  type() + ':' + mu0_.name_,
287  film().regionMesh(),
289  extrapolatedCalculatedFvPatchScalarField::typeName
290  )
291  );
292 
293  tmu.ref().primitiveFieldRef() = this->mu(0, 0);
294  tmu.ref().correctBoundaryConditions();
295 
296  return tmu;
297 }
298 
299 
301 {
302  tmp<volScalarField> tsigma
303  (
305  (
306  type() + ':' + sigma0_.name_,
307  film().regionMesh(),
309  extrapolatedCalculatedFvPatchScalarField::typeName
310  )
311  );
312 
313  tsigma.ref().primitiveFieldRef() = this->sigma(0, 0);
314  tsigma.ref().correctBoundaryConditions();
315 
316  return tsigma;
317 }
318 
319 
321 {
323  (
325  (
326  type() + ':' + Cp0_.name_,
327  film().regionMesh(),
329  extrapolatedCalculatedFvPatchScalarField::typeName
330  )
331  );
332 
333  tCp.ref().primitiveFieldRef() = this->Cp(0, 0);
334  tCp.ref().correctBoundaryConditions();
335 
336  return tCp;
337 }
338 
339 
341 {
342  tmp<volScalarField> tkappa
343  (
345  (
346  type() + ':' + kappa0_.name_,
347  film().regionMesh(),
349  extrapolatedCalculatedFvPatchScalarField::typeName
350  )
351  );
352 
353  tkappa.ref().primitiveFieldRef() = this->kappa(0, 0);
354  tkappa.ref().correctBoundaryConditions();
355 
356  return tkappa;
357 }
358 
359 
360 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
361 
362 } // End namespace surfaceFilmModels
363 } // End namespace regionModels
364 } // End namespace Foam
365 
366 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:174
dimensionedSymmTensor sqr(const dimensionedVector &dv)
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, const Internal &, const PtrList< fvPatchField< scalar >> &)
Return a temporary field constructed from name,.
tmp< volScalarField > trho
virtual const word & name() const
Return the specie name.
virtual scalar Tb(const scalar p) const
Return boiling temperature [K].
const dictionary coeffDict_
Coefficients dictionary.
Definition: subModelBase.H:74
addToRunTimeSelectionTable(surfaceFilmRegionModel, kinematicSingleLayer, mesh)
Macros for easy insertion into run-time selection tables.
virtual scalar D(const scalar p, const scalar T) const
Return diffusivity [m^2/s].
virtual tmp< volScalarField > Cp() const
Return specific heat capacity [J/kg/K].
A class for handling words, derived from string.
Definition: word.H:59
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:52
virtual scalar W() const
Return molecular weight [kg/kmol].
constantFilmThermo(surfaceFilmRegionModel &film, const dictionary &dict)
Construct from surface film model and dictionary.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
filmThermoModel(surfaceFilmRegionModel &film)
Construct null.
const dimensionSet dimPressure
const dimensionSet dimPower
virtual tmp< volScalarField > sigma() const
Return surface tension [kg/s^2].
virtual tmp< volScalarField > mu() const
Return dynamic viscosity [Pa.s].
const dimensionSet dimEnergy
virtual tmp< volScalarField > rho() const
Return density [kg/m^3].
const dimensionSet dimDensity
virtual scalar hl(const scalar p, const scalar T) const
Return latent heat [J/kg].
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
virtual tmp< volScalarField > kappa() const
Return thermal conductivity [W/m/K].
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
A class for managing temporary objects.
Definition: PtrList.H:53
defineTypeNameAndDebug(kinematicSingleLayer, 0)
Namespace for OpenFOAM.
virtual scalar pv(const scalar p, const scalar T) const
Return vapour pressure [Pa].
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:812