fvSpecificSource.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-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::fvSpecificSource
26 
27 Description
28  Base class for sources which are specified as a specific value (e.g., mass
29  flow rate per unit volume), and which apply over the entire mesh.
30 
31 SourceFiles
32  fvSpecificSource.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef fvSpecificSource_H
37 #define fvSpecificSource_H
38 
39 #include "fvSource.H"
40 #include "DimensionedField.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class fvSpecificSource Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 class fvSpecificSource
52 :
53  public fvSource
54 {
55 protected:
56 
57  // Protected Member Functions
58 
59  // Sources
60 
61  //- Add a source term to an equation
62  template<class Type>
63  void addSupType
64  (
65  const VolField<Type>& field,
66  fvMatrix<Type>& eqn
67  ) const;
68 
69  //- Add a source term to a compressible equation
70  template<class Type>
71  void addSupType
72  (
73  const volScalarField& rho,
74  const VolField<Type>& field,
75  fvMatrix<Type>& eqn
76  ) const;
77 
78  //- Add a source term to a phase equation
79  template<class Type>
80  void addSupType
81  (
82  const volScalarField& alpha,
83  const volScalarField& rho,
84  const VolField<Type>& field,
85  fvMatrix<Type>& eqn
86  ) const;
87 
88 
89 public:
90 
91  //- Runtime type information
92  TypeName("fvSpecificSource");
93 
94 
95  // Constructors
96 
97  //- Construct from explicit source name and mesh
99  (
100  const word& name,
101  const word& modelType,
102  const fvMesh& mesh,
103  const dictionary& dict
104  );
105 
106 
107  //- Destructor
108  virtual ~fvSpecificSource();
109 
110 
111  // Member Functions
112 
113  // Access
114 
115  //- Return the cells that the source applies to
116  virtual labelUList cells() const;
117 
118  //- Return the number of cells that the source applies to
119  virtual label nCells() const;
120 
121 
122  // Sources
123 
124  //- Return the source value
126  (
127  const word& fieldName
128  ) const = 0;
129 
130  //- Return the source value
131  virtual tmp<scalarField> source(const word& fieldName) const;
132 
133 
134  // Mesh changes
135 
136  //- Update for mesh motion
137  virtual bool movePoints();
138 
139  //- Update topology using the given map
140  virtual void topoChange(const polyTopoChangeMap&);
141 
142  //- Update from another mesh using the given map
143  virtual void mapMesh(const polyMeshMap&);
144 
145  //- Redistribute or update using the given distribution map
146  virtual void distribute(const polyDistributionMap&);
147 };
148 
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 } // End namespace Foam
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 #ifdef NoRepository
157  #include "fvSpecificSourceTemplates.C"
158 #endif
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #endif
163 
164 // ************************************************************************* //
Generic GeometricField class.
A list of keyword definitions, which are a keyword followed by any number of values (e....
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: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
static const word & fieldName()
Return the name of the field associated with a source term. Special.
Definition: fvModelI.H:39
Base class for finite volume sources.
Definition: fvSource.H:52
Base class for sources which are specified as a specific value (e.g., mass flow rate per unit volume)...
virtual bool movePoints()
Update for mesh motion.
void addSupType(const VolField< Type > &field, fvMatrix< Type > &eqn) const
Add a source term to an equation.
virtual ~fvSpecificSource()
Destructor.
virtual tmp< DimensionedField< scalar, volMesh > > S(const word &fieldName) const =0
Return the source value.
TypeName("fvSpecificSource")
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 tmp< scalarField > source(const word &fieldName) const
Return the source value.
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.
fvSpecificSource(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
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
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
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
dictionary dict