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-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::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 Data
56 
57  //- Name of the density field
58  word rhoName_;
59 
60 
61  // Private Member Functions
62 
63  //- Non-virtual read
64  void readCoeffs(const dictionary& dict);
65 
66 
67  // Sources
68 
69  //- Add a source term to an equation
70  template<class Type>
71  void addSupType
72  (
73  const VolField<Type>& field,
74  fvMatrix<Type>& eqn
75  ) const;
76 
77  //- Add a source term to a scalar equation
78  void addSupType
79  (
80  const volScalarField& rhoOrField,
81  fvMatrix<scalar>& eqn
82  ) const;
83 
84  //- Add a source term to a compressible equation
85  template<class Type>
86  void addSupType
87  (
88  const volScalarField& rho,
89  const VolField<Type>& field,
90  fvMatrix<Type>& eqn
91  ) const;
92 
93  //- Add a source term to a compressible scalar equation
94  void addSupType
95  (
96  const volScalarField& alphaOrRho,
97  const volScalarField& rhoOrField,
98  fvMatrix<scalar>& eqn
99  ) const;
100 
101  //- Add a source term to a phase equation
102  template<class Type>
103  void addSupType
104  (
105  const volScalarField& alpha,
106  const volScalarField& rho,
107  const VolField<Type>& field,
108  fvMatrix<Type>& eqn
109  ) const;
110 
111 
112 public:
113 
114  //- Runtime type information
115  TypeName("massSourceBase");
116 
117 
118  // Constructors
119 
120  //- Construct from explicit source name and mesh
122  (
123  const word& name,
124  const word& modelType,
125  const fvMesh& mesh,
126  const dictionary& dict
127  );
128 
129 
130  // Member Functions
131 
132  // Sources
133 
134  //- Add a source term to a field-less proxy equation
135  virtual void addSup(fvMatrix<scalar>& eqn) const;
136 
137  //- Add a source term to an equation
139 
140  //- Add a source term to a compressible equation
142 
143  //- Add a source term to a phase equation
145 
146 
147  //- Read source dictionary
148  virtual bool read(const dictionary& dict);
149 };
150 
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 } // End namespace fv
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #endif
160 
161 // ************************************************************************* //
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:98
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
Base class for sources which are specified as a total value (e.g., volume or mass flow rate),...
Definition: fvTotalSource.H:54
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:63
#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
rho
Definition: pEqn.H:1
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