zeroDimensionalMassSource.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) 2021-2024 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::zeroDimensionalMassSource
26 
27 Description
28  This fvModel applies a mass source to the continuity equation and to all
29  field equations, in a zero-dimensional case. Correction is made to account
30  for the mass that exits the domain due to expansion in space, so that the
31  model correctly applies a total mass flow rate.
32 
33  This model requires a corresponding field source to be specified for all
34  solved-for fields.
35 
36  This model will write out additional fields, zeroDimensionalMassSource:m
37  and zeroDimensionalMassSource:factor. The zeroDimensionalMassSource:m field
38  is the total accumulated mass; the sum of the starting mass, plus all mass
39  added by models of this type. This may differ from the actual current mass
40  (= rho*V) within the zero-dimensional cell if pressure or density
41  constraints are being used. The zeroDimensionalMassSource:factor field is
42  the ratio between the current mass or volume and the total accumulated mass
43  or volume.
44 
45 Usage
46  Example usage:
47  \verbatim
48  zeroDimensionalMassSource
49  {
50  type zeroDimensionalMassSource;
51 
52  massFlowRate 1e-4;
53  }
54  \endverbatim
55 
56 SourceFiles
57  zeroDimensionalMassSource.C
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef zeroDimensionalMassSource_H
62 #define zeroDimensionalMassSource_H
63 
65 #include "Function1.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 namespace fv
72 {
73 
74 /*---------------------------------------------------------------------------*\
75  Class zeroDimensionalMassSource Declaration
76 \*---------------------------------------------------------------------------*/
77 
79 :
81 {
82 private:
83 
84  // Private Data
85 
86  //- Zero-dimensional mass flow rate
87  autoPtr<Function1<scalar>> zeroDimensionalMassFlowRate_;
88 
89 
90  // Private Member Functions
91 
92  //- Non-virtual read
93  void readCoeffs();
94 
95  //- Return the mass flow rate
96  virtual scalar massFlowRate() const;
97 
98 
99 public:
100 
101  //- Runtime type information
102  TypeName("zeroDimensionalMassSource");
103 
104 
105  // Constructors
106 
107  //- Construct from explicit source name and mesh
109  (
110  const word& name,
111  const word& modelType,
112  const fvMesh& mesh,
113  const dictionary& dict
114  );
115 
116 
117  // Member Functions
118 
119  //- Read source dictionary
120  virtual bool read(const dictionary& dict);
121 };
122 
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 } // End namespace fv
127 } // End namespace Foam
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 #endif
132 
133 // ************************************************************************* //
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:53
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:47
Base class for zero-dimensional mass source models.
This fvModel applies a mass source to the continuity equation and to all field equations,...
virtual bool read(const dictionary &dict)
Read source dictionary.
zeroDimensionalMassSource(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
TypeName("zeroDimensionalMassSource")
Runtime type information.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
labelList fv(nPoints)
dictionary dict