PhaseLimitStabilization.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2017 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::fv::PhaseLimitStabilization
29 
30 Description
31  Stabilization source for phase transport equations of \c Type,
32  where \c <Type>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
33 
34  Applies an implicit source to the phase transport equation for the specified
35  \c field when the phase volume fraction is below \c residualAlpha. The
36  stabilization rate is provided by the registered
37  uniformDimensionedScalarField \c rate, which could be extended to also
38  support volScalarField and volScalarField::Internal field types. The \c
39  field is currently stabilized towards zero in the limit of the phase volume
40  fraction approaching zero but this could be extended to support a
41  specified value or a value or field looked-up from the database.
42 
43 Usage
44  Minimal example by using \c constant/fvOptions:
45  \verbatim
46  <Type>PhaseLimitStabilization1
47  {
48  // Mandatory entries (unmodifiable)
49  type <Type>PhaseLimitStabilization;
50  field <fieldName>;
51  rate <rateName>;
52 
53  // Mandatory entries (runtime modifiable)
54  residualAlpha 1.0;
55 
56  // Mandatory/Optional (inherited) entries
57  ...
58  }
59  \endverbatim
60 
61  where the entries mean:
62  \table
63  Property | Description | Type | Reqd | Dflt
64  type | Type name: <Type>PhaseLimitStabilization <!--
65  --> | word | yes | -
66  field | Name of operand field | word | yes | -
67  rate | Name of rate field | word | yes | -
68  residualAlpha | Residual alpha value below which <!--
69  --> stabilization is applied | scalar | yes | -
70  \endtable
71 
72  The inherited entries are elaborated in:
73  - \link fvOption.H \endlink
74 
75  Example usage:
76  \verbatim
77  stabilization
78  {
79  type symmTensorPhaseLimitStabilization;
80 
81  field sigma.liquid;
82  rate rLambda.liquid;
83  residualAlpha 1e-3;
84  }
85  \endverbatim
86 
87 SourceFiles
88  PhaseLimitStabilization.C
89 
90 \*---------------------------------------------------------------------------*/
91 
92 #ifndef PhaseLimitStabilization_H
93 #define PhaseLimitStabilization_H
94 
95 #include "fvOption.H"
96 
97 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98 
99 namespace Foam
100 {
101 namespace fv
102 {
103 
104 /*---------------------------------------------------------------------------*\
105  Class PhaseLimitStabilization Declaration
106 \*---------------------------------------------------------------------------*/
107 
108 template<class Type>
109 class PhaseLimitStabilization
110 :
111  public fv::option
112 {
113  // Private Data
114 
115  //- Name of operand field
116  word fieldName_;
117 
118  //- Name of rate field
119  word rateName_;
120 
121  //- Residual alpha value below which stabilization is applied
122  scalar residualAlpha_;
123 
124 
125 public:
126 
127  //- Runtime type information
128  TypeName("PhaseLimitStabilization");
129 
130 
131  // Constructors
132 
133  //- Construct from components
135  (
136  const word& name,
137  const word& modelType,
138  const dictionary& dict,
139  const fvMesh& mesh
140  );
141 
142  //- No copy construct
144 
145  //- No copy assignment
146  void operator=(const PhaseLimitStabilization&) = delete;
147 
148 
149  //- Destructor
150  virtual ~PhaseLimitStabilization() = default;
151 
152 
153  // Member Functions
154 
155  //- Source term to compressible phase equation
156  virtual void addSup
157  (
158  const volScalarField& alpha,
159  const volScalarField& rho,
160  fvMatrix<Type>& eqn,
161  const label fieldi
162  );
163 
164  //- Read dictionary
165  virtual bool read(const dictionary& dict);
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace fv
172 } // End namespace Foam
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #ifdef NoRepository
177  #include "PhaseLimitStabilization.C"
178 #endif
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #endif
183 
184 // ************************************************************************* //
Foam::fv::PhaseLimitStabilization::PhaseLimitStabilization
PhaseLimitStabilization(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
Definition: PhaseLimitStabilization.C:38
Foam::fv::option::name
const word & name() const noexcept
Return const access to the source name.
Definition: fvOptionI.H:31
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fv::PhaseLimitStabilization::operator=
void operator=(const PhaseLimitStabilization &)=delete
No copy assignment.
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::fv::PhaseLimitStabilization::~PhaseLimitStabilization
virtual ~PhaseLimitStabilization()=default
Destructor.
rho
rho
Definition: readInitialConditions.H:88
Foam::fv::PhaseLimitStabilization
Stabilization source for phase transport equations of Type, where <Type>=Scalar/Vector/SphericalTenso...
Definition: PhaseLimitStabilization.H:142
Foam::fv::option
Base abstract class for handling finite volume options (i.e. fvOption).
Definition: fvOption.H:126
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fv
labelList fv(nPoints)
Foam::fv::PhaseLimitStabilization::addSup
virtual void addSup(const volScalarField &alpha, const volScalarField &rho, fvMatrix< Type > &eqn, const label fieldi)
Source term to compressible phase equation.
Definition: PhaseLimitStabilization.C:59
Foam::fv::option::mesh
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
Foam::fv::PhaseLimitStabilization::TypeName
TypeName("PhaseLimitStabilization")
Runtime type information.
fvOption.H
Foam::fv::PhaseLimitStabilization::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: PhaseLimitStabilization.C:76
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::GeometricField< scalar, fvPatchField, volMesh >
PhaseLimitStabilization.C