zeroDimensionalMassSourceBase.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::zeroDimensionalMassSourceBase
26 
27 Description
28  Base class for zero-dimensional mass source models
29 
30 SourceFiles
31  zeroDimensionalMassSource.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef zeroDimensionalMassSourceBase_H
36 #define zeroDimensionalMassSourceBase_H
37 
38 #include "massSourceBase.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 namespace fv
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class zeroDimensionalMassSourceBase Declaration
49 \*---------------------------------------------------------------------------*/
50 
52 :
53  public massSourceBase
54 {
55 private:
56 
57  // Private Data
58 
59  //- Reference to the zero-dimensional mass
60  volScalarField& m0D_;
61 
62 
63  // Private Member Functions
64 
65  //- Calculate and return the zero-dimensional mass
66  tmp<volScalarField> calcM0D() const;
67 
68  //- Initialise and return a reference to the zero-dimensional mass
69  volScalarField& initM0D() const;
70 
71  //- Get a reference to the mass
72  const volScalarField& m() const;
73 
74  //- Return the mass flow rate
75  virtual scalar massFlowRate() const = 0;
76 
77 
78 public:
79 
80  //- Runtime type information
81  TypeName("zeroDimensionalMassSourceBase");
82 
83 
84  // Constructors
85 
86  //- Construct from explicit source name and mesh
88  (
89  const word& name,
90  const word& modelType,
91  const fvMesh& mesh,
92  const dictionary& dict
93  );
94 
95 
96  // Member Functions
97 
98  // Access
99 
100  //- Return the cells that the source applies to
101  virtual labelUList cells() const;
102 
103  //- Return the number of cells that the source applies to
104  virtual label nCells() const;
105 
106  //- Return the volume of cells that the source applies to
107  virtual scalar V() const;
108 
109 
110  // Sources
111 
112  //- Return the source value
113  virtual dimensionedScalar S() const;
114 
115 
116  // Mesh changes
117 
118  //- Update for mesh motion
119  virtual bool movePoints();
120 
121  //- Update topology using the given map
122  virtual void topoChange(const polyTopoChangeMap&);
123 
124  //- Update from another mesh using the given map
125  virtual void mapMesh(const polyMeshMap&);
126 
127  //- Redistribute or update using the given distribution map
128  virtual void distribute(const polyDistributionMap&);
129 
130 
131  //- Update the model
132  virtual void correct();
133 };
134 
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 } // End namespace fv
139 } // End namespace Foam
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 #endif
144 
145 // ************************************************************************* //
Generic GeometricField class.
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 mass source models.
Base class for zero-dimensional mass source models.
virtual bool movePoints()
Update for mesh motion.
virtual scalar V() const
Return the volume of cells that the source applies to.
zeroDimensionalMassSourceBase(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
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 labelUList cells() const
Return the cells that the source applies to.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual label nCells() const
Return the number of cells that the source applies to.
TypeName("zeroDimensionalMassSourceBase")
Runtime type information.
virtual dimensionedScalar S() const
Return the source value.
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 managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
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
labelList fv(nPoints)
dictionary dict