homogeneousNucleation.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) 2025-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::homogeneousNucleation
26 
27 Description
28  Base class for homogeneous nucleation models based on classical nucleation
29  theory
30 
31 SourceFiles
32  homogeneousNucleation.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef homogeneousNucleation_H
37 #define homogeneousNucleation_H
38 
39 #include "phaseChange.H"
40 #include "phaseSystem.H"
41 #include "nucleation.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 namespace fv
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class homogeneousNucleation Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 :
56  public phaseChange,
57  public nucleation
58 {
59 private:
60 
61  // Private Data
62 
63  //- Phase system
64  const phaseSystem& fluid_;
65 
66  //- Reference to the solution phase
67  const phaseModel& solution_;
68 
69  //- Reference to the nucleating phase
70  const phaseModel& nucleate_;
71 
72  //- Reference to the field associated with the pressure equation
73  const volScalarField& p_rgh_;
74 
75  //- Counter for the evaluations of the pressure equation sources
76  mutable label pressureEquationIndex_;
77 
78  //- Diameter of nucleated clusters
79  mutable volScalarField::Internal d_;
80 
81  //- Phase change rate, per unit volume of the solution
82  mutable volScalarField::Internal mDotByAlphaSolution_;
83 
84  //- Phase change rate
85  mutable volScalarField::Internal mDot_;
86 
87 
88  // Private Member Functions
89 
90  //- Non-virtual read
91  void readCoeffs(const dictionary& dict);
92 
93  //- Correct the stored diameter and phase change rates
94  void correctDAndMDot() const;
95 
96  //- Calculate and return the diameter of nucleates and the phase change
97  // rate per quantity of the solution phase
99  dAndMDotByAlphaSolution() const = 0;
100 
101 
102 protected:
103 
104  // Protected Member Functions
105 
106  //- Return the surface tension coefficient between the phases
108 
109 
110 public:
111 
112  //- Runtime type information
113  TypeName("homogeneousNucleation");
114 
115 
116  // Constructors
117 
118  //- Construct from explicit source name and mesh
120  (
121  const word& name,
122  const word& modelType,
123  const fvMesh& mesh,
124  const dictionary& dict
125  );
126 
127 
128  // Member Functions
129 
130  // Sources
131 
132  //- Return the diameter of nuclei
133  virtual tmp<DimensionedField<scalar, fvMesh>> d() const;
134 
135  //- Return the number rate at which nuclei are generated
137 
138  //- Return the mass transfer rate
140 
141  //- Return the nucleation time scale
142  virtual tmp<DimensionedField<scalar, fvMesh>> tau() const;
143 
144  //- Use phaseChange's source functions
145  using phaseChange::addSup;
146 
147  //- Override the compressible continuity equation to add
148  // linearisation w.r.t alpha
149  void addSup
150  (
151  const volScalarField& alpha,
152  const volScalarField& rho,
153  fvMatrix<scalar>& eqn
154  ) const;
155 
156 
157  //- Correct the fvModel
158  // e.g. solve equations, update model, for film, Lagrangian etc.
159  virtual void correct();
160 
161 
162  // IO
163 
164  //- Read source dictionary
165  virtual bool read(const dictionary& dict);
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace fv
172 } // End namespace Foam
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #endif
177 
178 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic GeometricField class.
An ordered pair of two objects of type <Type> with first() and second() elements.
Definition: Pair.H:67
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
Base class for homogeneous nucleation models based on classical nucleation theory.
virtual void correct()
Correct the fvModel.
homogeneousNucleation(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
virtual tmp< DimensionedField< scalar, fvMesh > > mDot() const
Return the mass transfer rate.
virtual bool read(const dictionary &dict)
Read source dictionary.
tmp< volScalarField::Internal > sigma() const
Return the surface tension coefficient between the phases.
void addSup(const volScalarField &alpha, const volScalarField &rho, const volScalarField &heOrYi, fvMatrix< scalar > &eqn) const
Use phaseChange's source functions.
Definition: phaseChange.C:529
virtual tmp< DimensionedField< scalar, fvMesh > > d() const
Return the diameter of nuclei.
virtual tmp< DimensionedField< scalar, fvMesh > > tau() const
Return the nucleation time scale.
TypeName("homogeneousNucleation")
Runtime type information.
virtual tmp< DimensionedField< scalar, fvMesh > > nDot() const
Return the number rate at which nuclei are generated.
tmp< volScalarField::Internal > rho(const label i) const
Return the density.
Definition: massTransfer.C:92
Mix-in interface for nucleation models. Provides access to properties of the nucleation process,...
Definition: nucleation.H:53
Base class for phase change models.
Definition: phaseChange.H:61
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
Class to represent a system of phases.
Definition: phaseSystem.H:74
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
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