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-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::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;
96 
97 
98  // Access
99 
100  //- Return the cells that the source applies to
101  virtual labelUList cells() const = 0;
102 
103  //- Return the number of cells that the source applies to
104  virtual label nCells() const;
105 
106 
107  // Sources
108 
109  //- Return the source value
110  virtual tmp<scalarField> source(const word& fieldName) const = 0;
111 
112 
113  // Member Operators
114 
115  //- Disallow default bitwise assignment
116  void operator=(const fvSource&) = delete;
117 };
118 
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 } // End namespace Foam
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 #endif
127 
128 // ************************************************************************* //
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
Finite volume model abstract base class.
Definition: fvModel.H:59
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
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
Definition: fvSource.C:60
virtual labelUList cells() const =0
Return the cells that the source applies to.
virtual tmp< scalarField > source(const word &fieldName) const =0
Return the source value.
TypeName("fvSource")
Runtime type information.
virtual label nCells() const
Return the number of cells that the source applies to.
Definition: fvSource.C:66
virtual ~fvSource()
Destructor.
Definition: fvSource.C:54
fvSource(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
Definition: fvSource.C:41
void operator=(const fvSource &)=delete
Disallow default bitwise assignment.
virtual bool addsSupToField(const word &fieldName) const =0
Return true if the fvModel adds a source term to the given.
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
dictionary dict