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-2022 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  selectionMode 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 namespace fv
92 {
93 
94 /*---------------------------------------------------------------------------*\
95  Class VoFSolidificationMeltingSource Declaration
96 \*---------------------------------------------------------------------------*/
97 
98 class VoFSolidificationMeltingSource
99 :
100  public fvModel
101 {
102  // Private Data
103 
104  //- The set of cells the fvConstraint applies to
105  fvCellSet set_;
106 
107  //- Solid fraction as a function of temperature
108  autoPtr<Function1<scalar>> alphaSolidT_;
109 
110  //- Latent heat of fusion [J/kg]
112 
113  //- Phase fraction under-relaxation coefficient
114  scalar relax_;
115 
116  //- Mushy region momentum sink coefficient [1/s]; default = 10^5
117  scalar Cu_;
118 
119  //- Coefficient used in porosity calc - default = 0.001
120  scalar q_;
121 
122  //- Solid phase fraction
123  mutable volScalarField alphaSolid_;
124 
125 
126  // Private Member Functions
128  //- Non-virtual read
129  void readCoeffs();
130 
131  //- Return the name of the solid phase fraction
132  word alphaSolidName() const;
133 
134  //- Helper function to apply to the energy equation
135  template<class RhoFieldType>
136  void apply(const RhoFieldType& rho, fvMatrix<scalar>& eqn) const;
137 
138 
139 public:
140 
141  //- Runtime type information
142  TypeName("VoFSolidificationMeltingSource");
143 
144 
145  // Constructors
146 
147  //- Construct from explicit source name and mesh
149  (
150  const word& name,
151  const word& modelType,
152  const dictionary& dict,
153  const fvMesh& mesh
154  );
155 
156  //- Disallow default bitwise copy construction
158  (
160  ) = delete;
161 
162 
163  // Member Functions
164 
165  // Checks
166 
167  //- Return the list of fields for which the option adds source term
168  // to the transport equation
169  virtual wordList addSupFields() const;
170 
171 
172  // Add explicit and implicit contributions to compressible equation
173 
174  //- Add explicit contribution to compressible enthalpy equation
175  virtual void addSup
176  (
177  const volScalarField& rho,
178  fvMatrix<scalar>& eqn,
179  const word& fieldName
180  ) const;
181 
182  //- Add implicit contribution to compressible momentum equation
183  virtual void addSup
184  (
185  const volScalarField& rho,
186  fvMatrix<vector>& eqn,
187  const word& fieldName
188  ) const;
189 
190 
191  // Mesh motion
192 
193  //- Update topology using the given map
194  virtual void topoChange(const polyTopoChangeMap&);
195 
196  //- Update from another mesh using the given map
197  virtual void mapMesh(const polyMeshMap&);
198 
199  //- Redistribute or update using the given distribution map
200  virtual void distribute(const polyDistributionMap&);
201 
202  //- Update for mesh motion
203  virtual bool movePoints();
204 
205 
206  //- Correct the model
207  virtual void correct();
208 
209 
210  // IO
211 
212  //- Read source dictionary
213  virtual bool read(const dictionary& dict);
214 
215 
216  // Member Operators
217 
218  //- Disallow default bitwise assignment
219  void operator=(const VoFSolidificationMeltingSource&) = delete;
220 };
221 
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 } // End namespace fv
226 } // End namespace Foam
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 #endif
231 
232 // ************************************************************************* //
dictionary dict
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:28
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual bool movePoints()
Update for mesh motion.
virtual void correct()
Correct the model.
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:34
VoFSolidificationMeltingSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from explicit source name and mesh.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:58
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Solidification and melting model for VoF simulations.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:72
TypeName("VoFSolidificationMeltingSource")
Runtime type information.
virtual bool read(const dictionary &dict)
Read source dictionary.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
void operator=(const VoFSolidificationMeltingSource &)=delete
Disallow default bitwise assignment.
virtual void addSup(const volScalarField &rho, fvMatrix< scalar > &eqn, const word &fieldName) const
Add explicit contribution to compressible enthalpy equation.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual wordList addSupFields() const
Return the list of fields for which the option adds source term.
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:50
Namespace for OpenFOAM.