wallBoilingProperty.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 
26 #include "wallBoiling.H"
27 #include "wallBoilingProperty.H"
29 #include "fvModels.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace functionObjects
37 {
40 }
41 }
42 
43 
44 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
45 
47 Foam::functionObjects::wallBoilingProperty::model() const
48 {
50 
51  if (modelName_ != word::null)
52  {
53  return refCast<const fv::wallBoiling>(fvModels[modelName_]);
54  }
55 
56  label wallBoilingFvModeli = -1;
57 
58  forAll(fvModels, fvModeli)
59  {
60  if (!isA<fv::wallBoiling>(fvModels[fvModeli])) continue;
61 
62  if (wallBoilingFvModeli != -1)
63  {
65  << "Multiple wall boiling fvModels found for " << typeName
66  << " function " << name() << endl;
67 
68  return NullObjectRef<fv::wallBoiling>();
69  }
70 
71  wallBoilingFvModeli = fvModeli;
72  }
73 
74  if (wallBoilingFvModeli == -1)
75  {
77  << "Wall boiling fvModel not found for " << typeName
78  << " function " << name() << endl;
79 
80  return NullObjectRef<fv::wallBoiling>();
81  }
82 
83  return refCast<const fv::wallBoiling>(fvModels[wallBoilingFvModeli]);
84 }
85 
86 
87 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
88 
90 (
91  const word& name,
92  const Time& runTime,
93  const dictionary& dict
94 )
95 :
96  fvMeshFunctionObject(name, runTime, dict)
97 {
98  read(dict);
99 }
100 
101 
102 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
103 
105 {}
106 
107 
108 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
109 
111 {
113 
114  modelName_ = dict.lookupOrDefault<word>("model", word::null);
115 
116  fieldName_ = dict.lookup<word>("field");
117 
118  return true;
119 }
120 
121 
123 {
124  const fv::wallBoiling& model = this->model();
125 
126  if (isNull(model)) return false;
127 
128  tmp<volScalarField> tpropertyVf
129  (
130  new volScalarField
131  (
132  IOobject
133  (
134  model.name() + ":" + fieldName_,
135  mesh().time().name(),
136  mesh(),
139  false
140  ),
141  mesh(),
143  (
145  (
146  fieldName_
147  ),
148  0
149  )
150  )
151  );
152  volScalarField& propertyVf = tpropertyVf.ref();
153 
154  forAll(propertyVf.boundaryField(), patchi)
155  {
156  if (!model.isBoiling(patchi)) continue;
157 
159  model.mDotPf(patchi);
160 
161  propertyVf.boundaryFieldRef()[patchi] = mDot.property(fieldName_);
162  }
163 
164  store(tpropertyVf);
165 
166  return true;
167 }
168 
169 
171 {
172  const fv::wallBoiling& model = this->model();
173 
174  if (isNull(model)) return false;
175 
176  return writeObject(model.name() + ":" + fieldName_);
177 }
178 
179 
180 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:433
Macros for easy insertion into run-time selection tables.
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
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 Time/database functionObjects.
const word & name() const
Return the name of this functionObject.
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const fvMesh & mesh() const
Return a reference to the mesh.
virtual bool read(const dictionary &)
Read optional controls.
Writes run time, CPU time and clock time and optionally the CPU and clock times per time step.
This function looks up the wall boiling model and collects and writes out a field of one of the wall ...
wallBoilingProperty(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual bool execute()
Calculate the wallBoilingProperty field.
virtual bool write()
Write the wallBoilingProperty field.
virtual bool read(const dictionary &)
Read the wallBoilingProperty data.
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:57
Finite volume models.
Definition: fvModels.H:65
Model for nucleate wall boiling between two phases on the surface of a number of wall patches.
Definition: wallBoiling.H:158
bool isBoiling(const label patchi) const
Is the given patch boiling?
Definition: wallBoiling.C:799
const wallBoilingPhaseChangeRateFvPatchScalarField & mDotPf(const label patchi) const
Return the mass transfer rate for the given patch.
Definition: wallBoiling.C:908
A class for managing temporary objects.
Definition: tmp.H:55
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:197
This boundary condition is used for the phase change rate field of the wall boiling fvModel....
static const dimensionSet & propertyDimensions(const word &name)
Access one of the property fields' dimensions by name.
const scalarField & property(const word &name) const
Access one of the property fields by name.
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)
label patchi
#define WarningInFunction
Report a warning using Foam::Warning.
defineTypeNameAndDebug(adjustTimeStepToCombustion, 0)
addToRunTimeSelectionTable(functionObject, adjustTimeStepToCombustion, dictionary)
Namespace for OpenFOAM.
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
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:258
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
bool isNull(const T &t)
Return true if t is a reference to the nullObject of type T.
Definition: nullObjectI.H:58
dictionary dict