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-2019 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  active yes;
45 
46  selectionMode cellZone;
47  cellZone solidZone;
48 
49  alphaSolidT table
50  (
51  (330 1)
52  (335 0)
53  );
54 
55  L 334000;
56  }
57  \endverbatim
58 
59  Where:
60  \table
61  Property | Description | Required | Default value
62  alphaSolidT | Solid fraction as function of temperature | yes |
63  L | Latent heat of fusion [J/kg] | yes |
64  relax | Relaxation coefficient [0-1] | no | 0.9
65  Cu | Model coefficient | no | 100000
66  q | Model coefficient | no | 0.001
67  \endtable
68 
69 See also
70  Foam::fv::solidificationMeltingSource
71  Foam::Function1
72 
73 SourceFiles
74  VoFSolidificationMeltingSource.C
75  VoFSolidificationMeltingSourceIO.C
76 
77 \*---------------------------------------------------------------------------*/
78 
79 #ifndef VoFSolidificationMeltingSource_H
80 #define VoFSolidificationMeltingSource_H
81 
82 #include "fvMesh.H"
83 #include "volFields.H"
84 #include "cellSetOption.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 cellSetOption
101 {
102  // Private Data
103 
104  //- Solid fraction as a function of temperature
105  autoPtr<Function1<scalar>> alphaSolidT_;
106 
107  //- Latent heat of fusion [J/kg]
109 
110  //- Phase fraction under-relaxation coefficient
111  scalar relax_;
112 
113  //- Mushy region momentum sink coefficient [1/s]; default = 10^5
114  scalar Cu_;
115 
116  //- Coefficient used in porosity calc - default = 0.001
117  scalar q_;
118 
119  //- Solid phase fraction
120  volScalarField alphaSolid_;
121 
122  //- Current time index (used for updating)
123  label curTimeIndex_;
124 
125 
126  // Private Member Functions
128  //- Return the name of the solid phase fraction
129  word alphaSolidName() const;
130 
131  //- Update the model
132  void update();
133 
134  //- Helper function to apply to the energy equation
135  template<class RhoFieldType>
136  void apply(const RhoFieldType& rho, fvMatrix<scalar>& eqn);
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& sourceName,
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  // Add explicit and implicit contributions
166 
167  //- Add explicit contribution to enthalpy equation
168  virtual void addSup(fvMatrix<scalar>& eqn, const label fieldi);
169 
170  //- Add implicit contribution to momentum equation
171  virtual void addSup(fvMatrix<vector>& eqn, const label fieldi);
172 
173 
174  // Add explicit and implicit contributions to compressible equation
175 
176  //- Add explicit contribution to compressible enthalpy equation
177  virtual void addSup
178  (
179  const volScalarField& rho,
180  fvMatrix<scalar>& eqn,
181  const label fieldi
182  );
183 
184  //- Add implicit contribution to compressible momentum equation
185  virtual void addSup
186  (
187  const volScalarField& rho,
188  fvMatrix<vector>& eqn,
189  const label fieldi
190  );
191 
192 
193  // IO
194 
195  //- Read source dictionary
196  virtual bool read(const dictionary& dict);
197 
198 
199  // Member Operators
200 
201  //- Disallow default bitwise assignment
202  void operator=(const VoFSolidificationMeltingSource&) = delete;
203 };
204 
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 } // End namespace fv
209 } // End namespace Foam
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #ifdef NoRepository
215 #endif
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #endif
220 
221 // ************************************************************************* //
dictionary dict
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
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:34
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
Solidification and melting model for VoF simulations.
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 void addSup(fvMatrix< scalar > &eqn, const label fieldi)
Add explicit contribution to enthalpy equation.
virtual bool read(const dictionary &dict)
Read source dictionary.
VoFSolidificationMeltingSource(const word &sourceName, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from explicit source name and mesh.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
void operator=(const VoFSolidificationMeltingSource &)=delete
Disallow default bitwise assignment.
Namespace for OpenFOAM.