homogeneousLiquidPhaseSeparation.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) 2024-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 Class
25  Foam::fv::homogeneousLiquidPhaseSeparation
26 
27 Description
28  Model for the homogeneous nucleation of a solid or liquid phase separating
29  out of a liquid solution
30 
31 Usage
32  Example usage:
33  \verbatim
34  homogeneousLiquidPhaseSeparation
35  {
36  type homogeneousLiquidPhaseSeparation;
37  libs ("libmultiphaseEulerFvModels.so");
38 
39  // Phases between which the transfer occurs. The first phase is the
40  // solution, and the second is the precipitate.
41  phases (liquid sugar);
42 
43  // The specie that is condensing
44  specie C6H12O6;
45 
46  // Linearise the latent heat contribution into the energy equation?
47  energySemiImplicit no;
48 
49  // Solubility given in mass of solute per mass of solvent
50  solubility constant 0.9;
51 
52  // Type of the nucleate: 'solid', 'liquid' or 'gas'.
53  nucleate solid;
54  }
55  \endverbatim
56 
57 SourceFiles
58  homogeneousLiquidPhaseSeparation.C
59 
60 \*---------------------------------------------------------------------------*/
61 
62 #ifndef homogeneousLiquidPhaseSeparation_H
63 #define homogeneousLiquidPhaseSeparation_H
64 
65 #include "phaseChange.H"
66 #include "nucleation.H"
68 
69 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
70 
71 namespace Foam
72 {
73 namespace fv
74 {
75 
76 /*---------------------------------------------------------------------------*\
77  Class homogeneousLiquidPhaseSeparation Declaration
78 \*---------------------------------------------------------------------------*/
79 
81 :
82  public phaseChange,
83  public nucleation
84 {
85 public:
86 
87  // Public Type Definitions
88 
89  //- Enumeration for the nucleate types
90  enum class nucleateType { solid, liquid, gas };
91 
92  //- Names of the moment types
94 
95 
96 private:
97 
98  // Private Data
99 
100  //- Phase system
101  const phaseSystem& fluid_;
102 
103  //- Diameter of nucleated clusters
105 
106  //- Phase change rate, per unit volume of the solution
107  volScalarField::Internal mDotByAlphaSolution_;
108 
109  //- Solubility curve
110  autoPtr<Function1<scalar>> solubilityCurve_;
111 
112  //- Nucleate type
113  nucleateType nucleateType_;
114 
115 
116  // Private Member Functions
117 
118  //- Non-virtual read
119  void readCoeffs(const dictionary& dict);
120 
121  //- Evaluate the solubility curve at the given temperature to return
122  // the saturated mass fraction of solute
124  (
126  ) const;
127 
128 
129 public:
130 
131  //- Runtime type information
132  TypeName("homogeneousLiquidPhaseSeparation");
133 
134 
135  // Constructors
136 
137  //- Construct from explicit source name and mesh
139  (
140  const word& name,
141  const word& modelType,
142  const fvMesh& mesh,
143  const dictionary& dict
144  );
145 
146 
147  // Member Functions
148 
149  // Sources
150 
151  //- Return the diameter of nuclei
152  virtual tmp<DimensionedField<scalar, volMesh>> d() const;
153 
154  //- Return the number rate at which nuclei are generated
156 
157  //- Return the mass transfer rate
159 
160  //- Return the nucleation time scale
162 
163  //- Use phaseChange's source functions
164  using phaseChange::addSup;
165 
166  //- Override the compressible continuity equation to add
167  // linearisation w.r.t alpha
168  void addSup
169  (
170  const volScalarField& alpha,
171  const volScalarField& rho,
172  fvMatrix<scalar>& eqn
173  ) const;
174 
175 
176  //- Correct the fvModel
177  // e.g. solve equations, update model, for film, Lagrangian etc.
178  virtual void correct();
179 
180 
181  // IO
182 
183  //- Read source dictionary
184  virtual bool read(const dictionary& dict);
185 };
186 
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 } // End namespace fv
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #endif
196 
197 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic GeometricField class.
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:96
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
Model for the homogeneous nucleation of a solid or liquid phase separating out of a liquid solution.
static const NamedEnum< nucleateType, 3 > nucleateTypeNames_
Names of the moment types.
homogeneousLiquidPhaseSeparation(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
virtual tmp< DimensionedField< scalar, volMesh > > mDot() const
Return the mass transfer rate.
virtual bool read(const dictionary &dict)
Read source dictionary.
TypeName("homogeneousLiquidPhaseSeparation")
Runtime type information.
void addSup(const volScalarField &alpha, const volScalarField &rho, const volScalarField &heOrYi, fvMatrix< scalar > &eqn) const
Use phaseChange's source functions.
Definition: phaseChange.C:551
virtual tmp< DimensionedField< scalar, volMesh > > d() const
Return the diameter of nuclei.
virtual tmp< DimensionedField< scalar, volMesh > > tau() const
Return the nucleation time scale.
virtual tmp< DimensionedField< scalar, volMesh > > 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:551
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:62
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Namespace for OpenFOAM.
void T(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1)
labelList fv(nPoints)
dictionary dict