VoFSolidificationMelting.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) 2017-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::VoFSolidificationMelting
26 
27 Description
28  Solidification and melting model for VoF simulations.
29 
30  The presence of the solid phase in the flow field is incorporated into the
31  model as a momentum porosity contribution; the energy associated with the
32  phase change is added as an enthalpy contribution. The solid fraction as a
33  function of temperature \c alphaSolidT is specified as a Foam::Function1.
34 
35  The model writes the field \c alpha[01].solid which can be visualised to to
36  show the solid distribution.
37 
38 Usage
39  Example usage:
40  \verbatim
41  VoFSolidificationMelting1
42  {
43  type VoFSolidificationMelting;
44 
45  cellZone solidZone;
46 
47  alphaSolidT table
48  (
49  (330 1)
50  (335 0)
51  );
52 
53  L 334000;
54  }
55  \endverbatim
56 
57  Where:
58  \table
59  Property | Description | Required | Default value
60  alphaSolidT | Solid fraction as function of temperature | yes |
61  L | Latent heat of fusion [J/kg] | yes |
62  relax | Relaxation coefficient [0-1] | no | 0.9
63  Cu | Model coefficient | no | 100000
64  q | Model coefficient | no | 0.001
65  \endtable
66 
67 See also
68  Foam::fv::solidificationMeltingSource
69  Foam::Function1
70 
71 SourceFiles
72  VoFSolidificationMelting.C
73  VoFSolidificationMeltingIO.C
74 
75 \*---------------------------------------------------------------------------*/
76 
77 #ifndef VoFSolidificationMelting_H
78 #define VoFSolidificationMelting_H
79 
80 #include "fvModel.H"
81 #include "fvCellZone.H"
82 #include "fvMesh.H"
83 #include "volFields.H"
84 #include "Function1.H"
85 
86 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87 
88 namespace Foam
89 {
90 
91 class compressibleTwoPhaseVoFMixture;
92 
93 namespace fv
94 {
95 
96 /*---------------------------------------------------------------------------*\
97  Class VoFSolidificationMelting Declaration
98 \*---------------------------------------------------------------------------*/
99 
100 class VoFSolidificationMelting
101 :
102  public fvModel
103 {
104  // Private Data
105 
106  //- The cellZone the fvConstraint applies to
107  fvCellZone zone_;
108 
109  //- Solid fraction as a function of temperature
110  autoPtr<Function1<scalar>> alphaSolidT_;
111 
112  //- Latent heat of fusion [J/kg]
114 
115  //- Phase fraction under-relaxation coefficient
116  scalar relax_;
117 
118  //- Mushy region momentum sink coefficient [1/s]; default = 10^5
119  scalar Cu_;
120 
121  //- Coefficient used in porosity calc - default = 0.001
122  scalar q_;
123 
124  //- VoF thermo
125  const compressibleTwoPhaseVoFMixture& thermo_;
126 
127  //- Solid phase fraction
128  mutable volScalarField alphaSolid_;
129 
130 
131  // Private Member Functions
132 
133  //- Non-virtual read
134  void readCoeffs(const dictionary& dict);
135 
136  //- Return the name of the solid phase fraction
137  word alphaSolidName() const;
138 
139  //- Helper function to apply to the energy equation
140  template<class RhoFieldType>
141  void apply(const RhoFieldType& rho, fvMatrix<scalar>& eqn) const;
142 
143 
144 public:
145 
146  //- Runtime type information
147  TypeName("VoFSolidificationMelting");
148 
149 
150  // Constructors
151 
152  //- Construct from explicit source name and mesh
154  (
155  const word& name,
156  const word& modelType,
157  const fvMesh& mesh,
158  const dictionary& dict
159  );
160 
161  //- Disallow default bitwise copy construction
163  (
165  ) = delete;
166 
167 
168  // Member Functions
169 
170  // Checks
171 
172  //- Return the list of fields for which the option adds source term
173  // to the transport equation
174  virtual wordList addSupFields() const;
175 
176 
177  // Add explicit and implicit contributions to compressible equation
178 
179  //- Add explicit contribution to phase energy equation
180  virtual void addSup
181  (
182  const volScalarField& alpha,
183  const volScalarField& rho,
184  const volScalarField& he,
185  fvMatrix<scalar>& eqn
186  ) const;
187 
188  //- Add implicit contribution to mixture momentum equation
189  virtual void addSup
190  (
192  const volVectorField& U,
193  fvMatrix<vector>& eqn
194  ) const;
195 
196 
197  // Mesh motion
198 
199  //- Update topology using the given map
200  virtual void topoChange(const polyTopoChangeMap&);
201 
202  //- Update from another mesh using the given map
203  virtual void mapMesh(const polyMeshMap&);
204 
205  //- Redistribute or update using the given distribution map
206  virtual void distribute(const polyDistributionMap&);
207 
208  //- Update for mesh motion
209  virtual bool movePoints();
210 
211 
212  //- Correct the model
213  virtual void correct();
214 
215 
216  // IO
217 
218  //- Read source dictionary
219  virtual bool read(const dictionary& dict);
220 
221 
222  // Member Operators
223 
224  //- Disallow default bitwise assignment
225  void operator=(const VoFSolidificationMelting&) = delete;
226 };
227 
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 } // End namespace fv
232 } // End namespace Foam
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 #endif
237 
238 // ************************************************************************* //
Generic GeometricField class.
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
Solidification and melting model for VoF simulations.
virtual bool movePoints()
Update for mesh motion.
virtual wordList addSupFields() const
Return the list of fields for which the option adds source term.
virtual void addSup(const volScalarField &alpha, const volScalarField &rho, const volScalarField &he, fvMatrix< scalar > &eqn) const
Add explicit contribution to phase energy equation.
virtual void correct()
Correct the model.
VoFSolidificationMelting(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual bool read(const dictionary &dict)
Read source dictionary.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
TypeName("VoFSolidificationMelting")
Runtime type information.
void operator=(const VoFSolidificationMelting &)=delete
Disallow default bitwise assignment.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
Definition: word.H:62
U
Definition: pEqn.H:72
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Namespace for OpenFOAM.
VolField< scalar > volScalarField
Definition: volFieldsFwd.H:62
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
thermo he()
labelList fv(nPoints)
dictionary dict