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