wallCondensation.H
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 Class
25  Foam::fv::wallCondensation
26 
27 Description
28  Model for mass diffusion limited wall condensation between two phases on
29  the surface of a number of wall patches. This model is based on an
30  implementation described in Syrjanen, J., Hovi, V. (2023). The current
31  implementation supports a single condensing specie.
32 
33  References:
34  \verbatim
35  Syrjanen, J., Hovi, V. (2023).
36  Validation of a surface condensation model for PWR containment analysis.
37  Research Report VTT-R-00884-23,
38  VTT Technical Research Centre of Finland Ltd.
39  \endverbatim
40 
41 Usage
42  Example usage:
43  \verbatim
44  wallCondensation
45  {
46  type wallCondensation;
47  libs ("libmultiphaseEulerFvModels.so");
48 
49  // Note: Order is important. This model is one-way. It turns vapour
50  // into liquid. The phases should be specified in this order.
51  phases (steam water);
52 
53  // The specie that is condensing
54  specie H2O;
55 
56  energySemiImplicit yes;
57  specieSemiImplicit no;
58 
59  saturationPressure
60  {
61  type ArdenBuck;
62  }
63  }
64  \endverbatim
65 
66  In addition to the above fvModel specification, wall patches on which
67  condensation is to be calculated should have an
68  alphatPhaseChangeWallFunction boundary condition applied to the turbulent
69  thermal diffusivity field.
70 
71 See also
72  Foam::alphatPhaseChangeWallFunctionFvPatchScalarField
73 
74 SourceFiles
75  wallCondensation.C
76 
77 \*---------------------------------------------------------------------------*/
78 
79 #ifndef wallCondensation_H
80 #define wallCondensation_H
81 
82 #include "wallPhaseChange.H"
83 #include "phaseSystem.H"
84 
85 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
86 
87 namespace Foam
88 {
89 
90 // Forward declaration of classes
91 class saturationPressureModel;
92 
93 class wallCondensationPhaseChangeRateFvPatchScalarField;
94 
95 namespace fv
96 {
97 
98 /*---------------------------------------------------------------------------*\
99  Class wallCondensation Declaration
100 \*---------------------------------------------------------------------------*/
101 
102 class wallCondensation
103 :
104  public wallPhaseChange
105 {
106 private:
107 
108  // Private classes
109 
110  //- Struct to hold various properties
111  struct properties;
112 
113 
114  // Private Data
115 
116  //- Reference to the liquid phase
117  const phaseModel& liquid_;
118 
119  //- Reference to the vapour phase
120  const phaseModel& vapour_;
121 
122  //- Reference to the liquid turbulent thermal diffusivity
123  const volScalarField& alphatLiquid_;
124 
125  //- Reference to the vapour turbulent thermal diffusivity
126  const volScalarField& alphatVapour_;
127 
128  //- Reference to the field associated with the pressure equation
129  const volScalarField& p_rgh_;
130 
131  //- Turbulent Prandtl number
132  scalar Prt_;
133 
134  //- Turbulent Schmidt number
135  scalar Sct_;
136 
137  //- The saturation curve
138  autoPtr<saturationPressureModel> saturationModelPtr_;
139 
140  //- Counter for the evaluations of the pressure equation sources
141  mutable label pressureEquationIndex_;
142 
143  //- Whether or not to linearise the specie source
144  bool specieSemiImplicit_;
145 
146  //- The phase change rate
147  mutable volScalarField mDot_;
148 
149  //- The derivative of phase change rate
150  mutable volScalarField mDotDy_;
151 
152 
153  // Private Member Functions
154 
155  //- Non-virtual read
156  void readCoeffs(const dictionary& dict);
157 
158  //- Correct the phase change rate
159  void correctMDot() const;
160 
161 
162 public:
163 
164  //- Runtime type information
165  TypeName("wallCondensation");
166 
167 
168  // Constructors
169 
170  //- Construct from explicit source name and mesh
172  (
173  const word& name,
174  const word& modelType,
175  const fvMesh& mesh,
176  const dictionary& dict
177  );
178 
179 
180  // Member Functions
181 
182  // Access
183 
184  //- Return a mask indicating whether phase change is occurring
185  virtual const scalarField& active(const label) const;
186 
187  //- Access the turbulent thermal diffusivities for a patch
188  virtual Pair<const scalarField&> alphats(const label) const;
189 
190 
191  // Evaluation
192 
193  //- Return the fraction of the latent heat that is transferred into
194  // the second phase
196 
197 
198  // Sources
199 
200  //- Return the mass transfer rate
202 
203  //- Return the derivative of mass transfer rate
205 
206  //- Return the mass transfer rate for the given patch
208  (
209  const label patchi
210  ) const;
211 
212  //- Return the mass transfer rate for the given patch
214  (
215  const label patchi
216  ) const;
217 
218  //- Use phaseChange's source functions
219  using phaseChange::addSup;
220 
221  //- Override the pressure equation to update the mass transfer rate
222  void addSup
223  (
224  const volScalarField& alpha,
225  const volScalarField& rho,
226  fvMatrix<scalar>& eqn
227  ) const;
228 
229  //- Override the species equations to linearise in the mass fraction
230  void addSup
231  (
232  const volScalarField& alpha,
233  const volScalarField& rho,
234  const volScalarField& heOrYi,
235  fvMatrix<scalar>& eqn
236  ) const;
237 
238 
239  //- Correct the fvModel
240  virtual void correct();
241 
242 
243  // IO
244 
245  //- Read source dictionary
246  virtual bool read(const dictionary& dict);
247 };
248 
249 
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 
252 } // End namespace fv
253 } // End namespace Foam
254 
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 
257 #endif
258 
259 // ************************************************************************* //
Generic GeometricField class.
An ordered pair of two objects of type <Type> with first() and second() elements.
Definition: Pair.H:67
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
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
tmp< volScalarField::Internal > rho(const label i) const
Return the density.
Definition: massTransfer.C:92
void addSup(const volScalarField &alpha, const volScalarField &rho, const volScalarField &heOrYi, fvMatrix< scalar > &eqn) const
Override the energy equation to add the phase change heat, or.
Definition: phaseChange.C:529
Model for mass diffusion limited wall condensation between two phases on the surface of a number of w...
wallCondensation(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
const wallCondensationPhaseChangeRateFvPatchScalarField & mDotPf(const label patchi) const
Return the mass transfer rate for the given patch.
virtual tmp< DimensionedField< scalar, fvMesh > > Lfraction() const
Return the fraction of the latent heat that is transferred into.
virtual void correct()
Correct the fvModel.
virtual tmp< DimensionedField< scalar, fvMesh > > mDotDy() const
Return the derivative of mass transfer rate.
virtual tmp< DimensionedField< scalar, fvMesh > > mDot() const
Return the mass transfer rate.
virtual const scalarField & active(const label) const
Return a mask indicating whether phase change is occurring.
virtual bool read(const dictionary &dict)
Read source dictionary.
void addSup(const volScalarField &alpha, const volScalarField &rho, const volScalarField &heOrYi, fvMatrix< scalar > &eqn) const
Use phaseChange's source functions.
Definition: phaseChange.C:529
TypeName("wallCondensation")
Runtime type information.
wallCondensationPhaseChangeRateFvPatchScalarField & mDotPfRef(const label patchi) const
Return the mass transfer rate for the given patch.
Base class for fvModels that represent phase change at a wall.
const Pair< const volScalarField & > & alphats() const
Access the turbulent thermal diffusivities.
A class for managing temporary objects.
Definition: tmp.H:55
This boundary condition is used for the phase change rate field of the wall condensation fvModel....
A class for handling words, derived from string.
Definition: word.H:63
label patchi
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
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
labelList fv(nPoints)
dictionary dict