fvSource.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-2026 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::fvSource
26 
27 Description
28  Base class for finite volume sources
29 
30 SourceFiles
31  fvSource.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef fvSource_H
36 #define fvSource_H
37 
38 #include "fvModel.H"
39 #include "scalarField.H"
40 #include "DimensionedFieldFwd.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class fvSource Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 class fvSource
52 :
53  public fvModel
54 {
55 public:
56 
57  //- Runtime type information
58  TypeName("fvSource");
59 
60 
61  // Static Member Functions
62 
63  //- Print min/average/max information for a given field
64  static void infoField
65  (
66  const word& name,
67  const dimensionSet& dims,
68  const scalarField& field,
69  const bool print = true
70  );
71 
72  //- Print min/average/max information for a given field
73  static void infoField
74  (
75  const word& name,
77  const bool print = true
78  );
79 
80  //- Print min/average/max information for a given field
81  static void infoField
82  (
84  const bool print = true
85  );
86 
87 
88  // Constructors
89 
90  //- Construct from explicit source name and mesh
91  fvSource
92  (
93  const word& name,
94  const word& modelType,
95  const fvMesh& mesh,
96  const dictionary& dict
97  );
98 
99  //- Disallow default bitwise copy construction
100  fvSource(const fvSource&) = delete;
101 
102 
103  //- Destructor
104  virtual ~fvSource();
105 
106 
107  // Member Functions
108 
109  // Checks
110 
111  //- Return true if the fvModel adds a source term to the given
112  // field's transport equation. Must be provided by sources.
113  // Sources potentially apply to every field (or every field of a
114  // phase) and it is not known in advance what all the fields are.
115  // So, this function returns a logical test (e.g., is this the
116  // phase of which there is a source?) rather than testing whether
117  // the name is in a pre-determined set of names.
118  virtual bool addsSupToField(const word& fieldName) const = 0;
119 
120  //- Return the list of fields for which the fvModel adds source term
121  // to the transport equation. Sources return null, as all this
122  // logic is handled in addsSupToField.
123  virtual wordList addSupFields() const final;
124 
125 
126  // Member Operators
127 
128  //- Disallow default bitwise assignment
129  void operator=(const fvSource&) = delete;
130 };
131 
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 } // End namespace Foam
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 #endif
140 
141 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Dimension set for the base types.
Definition: dimensionSet.H:125
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
static const word & fieldName()
Return the name of the field associated with a source term. Special.
Definition: fvModelI.H:49
Base class for finite volume sources.
Definition: fvSource.H:53
static void infoField(const word &name, const dimensionSet &dims, const scalarField &field, const bool print=true)
Print min/average/max information for a given field.
Definition: fvSource.C:40
TypeName("fvSource")
Runtime type information.
virtual ~fvSource()
Destructor.
Definition: fvSource.C:92
virtual wordList addSupFields() const final
Return the list of fields for which the fvModel adds source term.
Definition: fvSource.C:98
fvSource(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
Definition: fvSource.C:79
virtual bool addsSupToField(const word &fieldName) const =0
Return true if the fvModel adds a source term to the given.
A class for handling words, derived from string.
Definition: word.H:63
Namespace for OpenFOAM.
dictionary dict