alphatBoilingWallFunctionFvPatchScalarField.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) 2025 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 "wallBoiling.H"
30 
31 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 
34 Foam::alphatBoilingWallFunctionFvPatchScalarField::model() const
35 {
36  const Foam::fvModels& fvModels =
37  Foam::fvModels::New(internalField().mesh());
38 
39  if (modelName_ != word::null)
40  {
41  return refCast<const fv::wallBoiling>(fvModels[modelName_]);
42  }
43 
44  label wallBoilingFvModeli = -1;
45 
46  forAll(fvModels, fvModeli)
47  {
48  if (!isA<fv::wallBoiling>(fvModels[fvModeli])) continue;
49 
50  if (wallBoilingFvModeli != -1)
51  {
53  << "Multiple wall boiling fvModels found for " << typeName
54  << " boundary condition of field " << internalField().name()
55  << " on patch " << patch().name() << exit(FatalError);
56  }
57 
58  wallBoilingFvModeli = fvModeli;
59  }
60 
61  if (wallBoilingFvModeli == -1)
62  {
64  << "Wall boiling fvModel not found for " << typeName
65  << " boundary condition of field " << internalField().name()
66  << " on patch " << patch().name() << exit(FatalError);
67  }
68 
69  return refCast<const fv::wallBoiling>(fvModels[wallBoilingFvModeli]);
70 }
71 
72 
73 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * /
74 
77 (
78  const fvPatch& p,
80  const dictionary& dict
81 )
82 :
83  fixedValueFvPatchScalarField(p, iF, dict),
84  modelName_(dict.lookupOrDefault<word>("model", word::null))
85 {}
86 
87 
90 (
92  const fvPatch& p,
94  const fieldMapper& mapper
95 )
96 :
97  fixedValueFvPatchScalarField(psf, p, iF, mapper),
98  modelName_(psf.modelName_)
99 {}
100 
101 
104 (
107 )
108 :
109  fixedValueFvPatchScalarField(psf, iF),
110  modelName_(psf.modelName_)
111 {}
112 
113 
114 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
115 
117 {
118  if (updated())
119  {
120  return;
121  }
122 
123  const fv::wallBoiling& model = this->model();
124 
126  model.mDotPf(patch().index());
127 
128  if (&internalField() == &model.alphatLiquid())
129  {
130  operator==(mDotPf.alphatLiquid());
131  }
132  else if (&internalField() == &model.alphatVapour())
133  {
134  operator==(mDotPf.alphatVapour());
135  }
136  else
137  {
139  << "Model " << model.name() << " does not provide a turbulent "
140  << "thermal diffusivity for phase " << internalField().group()
141  << exit(FatalError);
142  }
143 
144  fixedValueFvPatchScalarField::updateCoeffs();
145 }
146 
147 
149 {
151 
152  writeEntryIfDifferent(os, "model", word::null, modelName_);
153 }
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 namespace Foam
159 {
161  (
164  );
165 }
166 
167 
168 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:433
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
This boundary condition provides a thermal wall function or the turbulent thermal diffusivity for wal...
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
alphatBoilingWallFunctionFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
static autoPtr< dictionary > New(Istream &)
Construct top-level dictionary on freestore from Istream.
Definition: dictionaryIO.C:103
Abstract base class for field mapping.
Definition: fieldMapper.H:48
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:57
Finite volume models.
Definition: fvModels.H:65
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:91
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
Model for nucleate wall boiling between two phases on the surface of a number of wall patches.
Definition: wallBoiling.H:158
const volScalarField & alphatVapour() const
Access the vapour turbulent thermal diffusivity.
Definition: wallBoilingI.H:48
const wallBoilingPhaseChangeRateFvPatchScalarField & mDotPf(const label patchi) const
Return the mass transfer rate for the given patch.
Definition: wallBoiling.C:908
const volScalarField & alphatLiquid() const
Access the liquid turbulent thermal diffusivity.
Definition: wallBoilingI.H:42
This boundary condition is used for the phase change rate field of the wall boiling fvModel....
const scalarField & alphatVapour() const
Access the vapour turbulent thermal diffusivity.
const scalarField & alphatLiquid() const
Access the liquid turbulent thermal diffusivity.
A class for handling words, derived from string.
Definition: word.H:62
static const word null
An empty word.
Definition: word.H:77
Foam::fvModels & fvModels(Foam::fvModels::New(mesh))
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
void writeEntryIfDifferent(Ostream &os, const word &entryName, const EntryType &value1, const EntryType &value2)
Helper function to write the keyword and entry only if the.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
error FatalError
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
dictionary dict
volScalarField & p