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-2025 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 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class fvSource Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class fvSource
51 :
52  public fvModel
53 {
54 public:
55 
56  //- Runtime type information
57  TypeName("fvSource");
58 
59 
60  // Constructors
61 
62  //- Construct from explicit source name and mesh
63  fvSource
64  (
65  const word& name,
66  const word& modelType,
67  const fvMesh& mesh,
68  const dictionary& dict
69  );
70 
71  //- Disallow default bitwise copy construction
72  fvSource(const fvSource&) = delete;
73 
74 
75  //- Destructor
76  virtual ~fvSource();
77 
78 
79  // Member Functions
80 
81  // Checks
82 
83  //- Return true if the fvModel adds a source term to the given
84  // field's transport equation. Must be provided by sources.
85  // Sources potentially apply to every field (or every field of a
86  // phase) and it is not known in advance what all the fields are.
87  // So, this function returns a logical test (e.g., is this the
88  // phase of which there is a source?) rather than testing whether
89  // the name is in a pre-determined set of names.
90  virtual bool addsSupToField(const word& fieldName) const = 0;
91 
92  //- Return the list of fields for which the fvModel adds source term
93  // to the transport equation. Sources return null, as all this
94  // logic is handled in addsSupToField.
95  virtual wordList addSupFields() const final;
96 
97 
98  // Member Operators
99 
100  //- Disallow default bitwise assignment
101  void operator=(const fvSource&) = delete;
102 };
103 
104 
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106 
107 } // End namespace Foam
108 
109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110 
111 #endif
112 
113 // ************************************************************************* //
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:96
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:52
TypeName("fvSource")
Runtime type information.
virtual ~fvSource()
Destructor.
Definition: fvSource.C:52
virtual wordList addSupFields() const final
Return the list of fields for which the fvModel adds source term.
Definition: fvSource.C:58
fvSource(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
Definition: fvSource.C:39
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:62
Namespace for OpenFOAM.
dictionary dict