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-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::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  // Sources
114 
115  //- Return the source value
117  (
118  const word& fieldName
119  ) const = 0;
120 
121 
122  // Mesh changes
123 
124  //- Update for mesh motion
125  virtual bool movePoints();
126 
127  //- Update topology using the given map
128  virtual void topoChange(const polyTopoChangeMap&);
129 
130  //- Update from another mesh using the given map
131  virtual void mapMesh(const polyMeshMap&);
132 
133  //- Redistribute or update using the given distribution map
134  virtual void distribute(const polyDistributionMap&);
135 };
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace Foam
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 #ifdef NoRepository
145  #include "fvSpecificSourceTemplates.C"
146 #endif
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 #endif
151 
152 // ************************************************************************* //
Generic GeometricField class.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
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:96
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
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 void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
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.
dictionary dict