massSourceBase.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::fv::massSourceBase
26 
27 Description
28  Base class for mass source models
29 
30 SourceFiles
31  massSourceBase.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef massSourceBase_H
36 #define massSourceBase_H
37 
38 #include "fvTotalSource.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 namespace fv
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class massSourceBase Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 class massSourceBase
52 :
53  public fvTotalSource
54 {
55 private:
56 
57  // Private Data
58 
59  //- Name of the density field
60  word rhoName_;
61 
62 
63  // Private Member Functions
64 
65  //- Non-virtual read
66  void readCoeffs();
67 
68 
69  // Sources
70 
71  //- Add a source term to an equation
72  template<class Type>
73  void addSupType
74  (
75  const VolField<Type>& field,
76  fvMatrix<Type>& eqn
77  ) const;
78 
79  //- Add a source term to a scalar equation
80  void addSupType
81  (
82  const volScalarField& rhoOrField,
83  fvMatrix<scalar>& eqn
84  ) const;
85 
86  //- Add a source term to a compressible equation
87  template<class Type>
88  void addSupType
89  (
90  const volScalarField& rho,
91  const VolField<Type>& field,
92  fvMatrix<Type>& eqn
93  ) const;
94 
95  //- Add a source term to a compressible scalar equation
96  void addSupType
97  (
98  const volScalarField& alphaOrRho,
99  const volScalarField& rhoOrField,
100  fvMatrix<scalar>& eqn
101  ) const;
102 
103  //- Add a source term to a phase equation
104  template<class Type>
105  void addSupType
106  (
107  const volScalarField& alpha,
108  const volScalarField& rho,
109  const VolField<Type>& field,
110  fvMatrix<Type>& eqn
111  ) const;
112 
113 
114 public:
115 
116  //- Runtime type information
117  TypeName("massSourceBase");
118 
119 
120  // Constructors
121 
122  //- Construct from explicit source name and mesh
124  (
125  const word& name,
126  const word& modelType,
127  const fvMesh& mesh,
128  const dictionary& dict
129  );
130 
131 
132  // Member Functions
133 
134  // Sources
135 
136  //- Add a source term to a field-less proxy equation
137  virtual void addSup(fvMatrix<scalar>& eqn) const;
138 
139  //- Add a source term to an equation
141 
142  //- Add a source term to a compressible equation
144 
145  //- Add a source term to a phase equation
147 
148 
149  //- Read source dictionary
150  virtual bool read(const dictionary& dict);
151 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace fv
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 #endif
162 
163 // ************************************************************************* //
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
Base class for sources which are specified as a total value (e.g., volume or mass flow rate),...
Definition: fvTotalSource.H:55
Base class for mass source models.
TypeName("massSourceBase")
Runtime type information.
FOR_ALL_FIELD_TYPES(DEFINE_FV_MODEL_ADD_FIELD_SUP)
Add a source term to an equation.
virtual bool read(const dictionary &dict)
Read source dictionary.
massSourceBase(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from explicit source name and mesh.
virtual void addSup(fvMatrix< scalar > &eqn) const
Add a source term to a field-less proxy equation.
A class for handling words, derived from string.
Definition: word.H:62
#define DEFINE_FV_MODEL_ADD_ALPHA_RHO_FIELD_SUP(Type, nullArg)
Definition: fvModelM.H:62
#define DEFINE_FV_MODEL_ADD_RHO_FIELD_SUP(Type, nullArg)
Definition: fvModelM.H:43
#define DEFINE_FV_MODEL_ADD_FIELD_SUP(Type, nullArg)
Definition: fvModelM.H:26
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
Namespace for OpenFOAM.
labelList fv(nPoints)
dictionary dict