phaseLimitStabilisation.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::phaseLimitStabilisation
26 
27 Description
28  Stabilisation source for phase transport equations
29 
30  Applies an implicit source to the phase transport equation for the
31  specified \c field when the phase volume fraction is below \c
32  residualAlpha. The stabilisation rate is provided by the registered \c rate
33  which can either be a uniformDimensionedScalarField, a volScalarField or a
34  volScalarField::Internal. The \c field is currently stabilised towards zero
35  in the limit of the phase volume fraction approaching zero but this could
36  be extended to support a specified value or a value or field looked-up from
37  the database.
38 
39 Usage
40  Example usage:
41  \verbatim
42  stabilisation
43  {
44  type phaseLimitStabilisation;
45 
46  field sigma.liquid;
47 
48  rate rLambda.liquid;
49 
50  residualAlpha 1e-3;
51  }
52  \endverbatim
53 
54 SourceFiles
55  phaseLimitStabilisation.C
56 
57 \*---------------------------------------------------------------------------*/
58 
59 #ifndef phaseLimitStabilisation_H
60 #define phaseLimitStabilisation_H
61 
62 #include "fvModel.H"
63 
64 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65 
66 namespace Foam
67 {
68 namespace fv
69 {
70 
71 /*---------------------------------------------------------------------------*\
72  Class phaseLimitStabilisation Declaration
73 \*---------------------------------------------------------------------------*/
74 
76 :
77  public fvModel
78 {
79  // Private Data
80 
81  //- Field name
82  word fieldName_;
83 
84  //- Rate field name
85  word rateName_;
86 
87  //- Residual alpha value below which stabilisation is applied
88  scalar residualAlpha_;
89 
90 
91  // Private Member Functions
92 
93  //- Non-virtual read
94  void readCoeffs(const dictionary& dict);
95 
96  //- Add stabilisation source terms
97  template<class Type, class RhoRateFieldType>
98  void addStabilisation
99  (
100  const volScalarField& alpha,
101  const RhoRateFieldType& rhoRate,
102  fvMatrix<Type>& eqn
103  ) const;
104 
105  //- Add source terms to an incompressible phase equation
106  template<class Type>
107  void addSupType
108  (
109  const volScalarField& alpha,
110  const VolField<Type>& field,
111  fvMatrix<Type>& eqn
112  ) const;
113 
114  //- Add source terms to a phase equation
115  template<class Type, class RhoFieldType>
116  void addSupType
117  (
118  const volScalarField& alpha,
119  const RhoFieldType& rho,
120  const VolField<Type>& field,
121  fvMatrix<Type>& eqn
122  ) const;
123 
124 
125 public:
126 
127  //- Runtime type information
128  TypeName("phaseLimitStabilisation");
129 
130 
131  // Constructors
132 
133  //- Construct from components
135  (
136  const word& name,
137  const word& modelType,
138  const fvMesh& mesh,
139  const dictionary& dict
140  );
141 
142  //- Disallow default bitwise copy construction
144 
145 
146  //- Destructor
147  virtual ~phaseLimitStabilisation()
148  {}
149 
150 
151  // Member Functions
152 
153  // Checks
154 
155  //- Return the list of fields for which the fvModel adds source term
156  // to the transport equation
157  virtual wordList addSupFields() const;
158 
159 
160  // Sources
161 
162  //- Add a source term to an incompressible phase equation
164 
165  //- Add a source term to a phase equation
167 
168 
169  // Mesh changes
170 
171  //- Update for mesh motion
172  virtual bool movePoints();
173 
174  //- Update topology using the given map
175  virtual void topoChange(const polyTopoChangeMap&);
176 
177  //- Update from another mesh using the given map
178  virtual void mapMesh(const polyMeshMap&);
179 
180  //- Redistribute or update using the given distribution map
181  virtual void distribute(const polyDistributionMap&);
182 
183 
184  //- Read dictionary
185  virtual bool read(const dictionary& dict);
186 
187 
188  // Member Operators
189 
190  //- Disallow default bitwise assignment
191  void operator=(const phaseLimitStabilisation&) = delete;
192 };
193 
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 } // End namespace fv
198 } // End namespace Foam
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 #endif
203 
204 // ************************************************************************* //
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:98
Finite volume model abstract base class.
Definition: fvModel.H:60
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
Stabilisation source for phase transport equations.
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
TypeName("phaseLimitStabilisation")
Runtime type information.
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 movePoints()
Add a source term to an incompressible phase equation.
virtual bool read(const dictionary &dict)
Read dictionary.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
phaseLimitStabilisation(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
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:63
#define DEFINE_FV_MODEL_ADD_ALPHA_RHO_FIELD_SUP(Type, nullArg)
Definition: fvModelM.H:62
#define DEFINE_FV_MODEL_ADD_RHO_FIELD_SUP(Type, nullArg)
Definition: fvModelM.H:43
rho
Definition: pEqn.H:1
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Namespace for OpenFOAM.
FOR_ALL_FIELD_TYPES(makeDimensionedPointFieldFunctions)
labelList fv(nPoints)
dictionary dict