buoyancyForce.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) 2015-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::buoyancyForce
26 
27 Description
28  Calculates and applies the buoyancy force rho*g to the momentum equation
29  corresponding to the specified velocity field.
30 
31 Usage
32  Example usage:
33  \verbatim
34  buoyancyForce1
35  {
36  type buoyancyForce;
37 
38  U U; // Name of the velocity field
39  }
40  \endverbatim
41 
42 SourceFiles
43  buoyancyForce.C
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef buoyancyForce_H
48 #define buoyancyForce_H
49 
50 #include "fvModel.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 namespace fv
58 {
59 
60 /*---------------------------------------------------------------------------*\
61  Class buoyancyForce Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class buoyancyForce
65 :
66  public fvModel
67 {
68  // Private Data
69 
70  //- Optional phase name
71  word phaseName_;
72 
73  //- Name of the velocity field
74  word UName_;
75 
76  //- Gravitational acceleration
78 
79 
80  // Private Member Functions
81 
82  //- Non-virtual read
83  void readCoeffs();
84 
85 
86 public:
87 
88  //- Runtime type information
89  TypeName("buoyancyForce");
90 
91 
92  // Constructors
93 
94  //- Construct from explicit source name and mesh
96  (
97  const word& name,
98  const word& modelType,
99  const fvMesh& mesh,
100  const dictionary& dict
101  );
102 
103  //- Disallow default bitwise copy construction
104  buoyancyForce(const buoyancyForce&) = delete;
105 
106 
107  // Member Functions
108 
109  // Checks
110 
111  //- Return the list of fields for which the fvModel adds source term
112  // to the transport equation
113  virtual wordList addSupFields() const;
114 
115 
116  // Evaluate
117 
118  //- Add explicit contribution to incompressible momentum equation
119  virtual void addSup
120  (
121  fvMatrix<vector>& eqn,
122  const word& fieldName
123  ) const;
124 
125  //- Add explicit contribution to compressible momentum equation
126  virtual void addSup
127  (
128  const volScalarField& rho,
129  fvMatrix<vector>& eqn,
130  const word& fieldName
131  ) const;
132 
133  //- Add explicit contribution to phase momentum equation
134  virtual void addSup
135  (
136  const volScalarField& alpha,
137  const volScalarField& rho,
138  fvMatrix<vector>& eqn,
139  const word& fieldName
140  ) const;
141 
142 
143  // Mesh changes
144 
145  //- Update for mesh motion
146  virtual bool movePoints();
147 
148  //- Update topology using the given map
149  virtual void topoChange(const polyTopoChangeMap&);
150 
151  //- Update from another mesh using the given map
152  virtual void mapMesh(const polyMeshMap&);
153 
154  //- Redistribute or update using the given distribution map
155  virtual void distribute(const polyDistributionMap&);
156 
157 
158  // IO
159 
160  //- Read source dictionary
161  virtual bool read(const dictionary& dict);
162 
163 
164  // Member Operators
165 
166  //- Disallow default bitwise assignment
167  void operator=(const buoyancyForce&) = delete;
168 };
169 
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 } // End namespace fv
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
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
Finite volume model abstract base class.
Definition: fvModel.H:59
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
Calculates and applies the buoyancy force rho*g to the momentum equation corresponding to the specifi...
Definition: buoyancyForce.H:66
virtual bool movePoints()
Update for mesh motion.
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
Definition: buoyancyForce.C:94
buoyancyForce(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
Definition: buoyancyForce.C:66
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(fvMatrix< vector > &eqn, const word &fieldName) const
Add explicit contribution to incompressible momentum equation.
TypeName("buoyancyForce")
Runtime type information.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
void operator=(const buoyancyForce &)=delete
Disallow default bitwise assignment.
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.
labelList fv(nPoints)
dictionary dict