wallPhaseChange.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) 2026 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 "wallPhaseChange.H"
29 
30 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace fv
35 {
37 }
38 }
39 
40 
41 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
42 
44 (
45  const word& activeType
46 ) const
47 {
48  wordList boundaryTypes
49  (
50  mesh().boundary().size(),
52  );
53 
54  forAll(fluid_.mesh().boundary(), patchi)
55  {
56  const bool is1Active =
57  isA<alphatPhaseChangeWallFunctionFvPatchScalarField>
58  (
59  alphats_.first().boundaryField()[patchi]
60  );
61  const bool is2Active =
62  isA<alphatPhaseChangeWallFunctionFvPatchScalarField>
63  (
64  alphats_.second().boundaryField()[patchi]
65  );
66 
67  if (is1Active != is2Active)
68  {
70  << "The field "
71  << (is1Active ? alphats_.first() : alphats_.second()).name()
72  << " has a phase change wall function on patch "
73  << mesh().boundary()[patchi].name() << " but "
74  << (is2Active ? alphats_.first() : alphats_.second()).name()
75  << " does not" << exit(FatalError);
76  }
77 
78  if (is1Active)
79  {
80  boundaryTypes[patchi] = activeType;
81  }
82  }
83 
84  return boundaryTypes;
85 }
86 
87 
88 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
89 
91 (
92  const word& name,
93  const word& modelType,
94  const fvMesh& mesh,
95  const dictionary& dict,
96  const wordList& species
97 )
98 :
99  phaseChange(name, modelType, mesh, dict, species),
100  fluid_(mesh().lookupObject<phaseSystem>(phaseSystem::propertiesName)),
101  phases_
102  (
103  fluid_.phases()[phaseNames().first()],
104  fluid_.phases()[phaseNames().second()]
105  ),
106  alphats_
107  (
108  mesh().lookupObject<volScalarField>
109  (
110  IOobject::groupName("alphat", phases_.first().name())
111  ),
112  mesh().lookupObject<volScalarField>
113  (
114  IOobject::groupName("alphat", phases_.second().name())
115  )
116  )
117 {}
118 
119 
120 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
121 
123 {
124  return
125  isA<alphatPhaseChangeWallFunctionFvPatchScalarField>
126  (
127  alphats_.first().boundaryField()[patchi]
128  )
129  || isA<alphatPhaseChangeWallFunctionFvPatchScalarField>
130  (
131  alphats_.second().boundaryField()[patchi]
132  );
133 }
134 
135 
136 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
Generic GeometricField class.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:932
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:69
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:57
Base class for phase change models.
Definition: phaseChange.H:61
Base class for fvModels that represent phase change at a wall.
bool isPatchActive(const label patchi) const
Return whether phase change can occur on the given patch.
wordList mDotBoundaryTypes(const word &activeType) const
Return boundary conditions for the phase change rate field. Use the.
wallPhaseChange(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict, const wordList &species)
Construct from explicit source name and mesh.
Class to represent a system of phases.
Definition: phaseSystem.H:74
const fvMesh & mesh() const
Return the mesh.
Definition: phaseSystemI.H:91
A class for handling words, derived from string.
Definition: word.H:63
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
label patchi
defineTypeNameAndDebug(bound, 0)
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
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
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
labelList second(const UList< labelPair > &p)
Definition: patchToPatch.C:49
labelList first(const UList< labelPair > &p)
Definition: patchToPatch.C:39
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
error FatalError
faceListList boundary(nPatches)
labelList fv(nPoints)
dictionary dict