SemiImplicitSource.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::fv::SemiImplicitSource
29 
30 Group
31  grpFvOptionsSources
32 
33 Description
34  Semi-implicit source, described using an input dictionary. The injection
35  rate coefficients are specified as pairs of Su-Sp coefficients, i.e.
36 
37  \f[
38  S(x) = S_u + S_p x
39  \f]
40 
41  where
42  \vartable
43  S(x) | net source for field 'x'
44  S_u | explicit source contribution
45  S_p | linearised implicit contribution
46  \endvartable
47 
48  Example of the source specification:
49 
50  \verbatim
51  volumeMode absolute; // specific
52  injectionRateSuSp
53  {
54  k (30.7 0);
55  epsilon (1.5 0);
56  }
57  \endverbatim
58 
59  Valid options for the \c volumeMode entry include:
60  - absolute: values are given as <quantity>
61  - specific: values are given as <quantity>/m3
62 
63  The injectionRate can also be specified as a Function1 by having
64  dictionaries for the field entries instead:
65 
66  \verbatim
67  injectionRateSuSp
68  {
69  k
70  {
71  // Time-ramp from 0 to 30.7 at time 5
72  Su table
73  (
74  (0 0.0)
75  (5 30.7)
76  );
77  Sp 0.0;
78  }
79  epsilon
80  {
81  Su 1.5;
82  Sp 0.0;
83  }
84  }
85  \endverbatim
86 
87 
88 See also
89  Foam::fvOption
90 
91 SourceFiles
92  SemiImplicitSource.C
93 
94 \*---------------------------------------------------------------------------*/
95 
96 #ifndef SemiImplicitSource_H
97 #define SemiImplicitSource_H
98 
99 #include "Tuple2.H"
100 #include "cellSetOption.H"
101 #include "Enum.H"
102 #include "Function1.H"
103 
104 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105 
106 namespace Foam
107 {
108 namespace fv
109 {
110 
111 // Forward declarations
112 template<class Type> class SemiImplicitSource;
113 
114 template<class Type>
115 Ostream& operator<<
116 (
117  Ostream&,
118  const SemiImplicitSource<Type>&
119 );
120 
121 
122 /*---------------------------------------------------------------------------*\
123  Class SemiImplicitSource Declaration
124 \*---------------------------------------------------------------------------*/
125 
126 template<class Type>
127 class SemiImplicitSource
128 :
129  public cellSetOption
130 {
131 public:
132 
133  // Public data
134 
135  //- Enumeration for volume types
136  enum volumeModeType
137  {
138  vmAbsolute,
139  vmSpecific
140  };
141 
142  //- Word list of volume mode type names
144 
145 
146 protected:
147 
148  // Protected data
149 
150  //- Volume mode
152 
153  //- Volume normalisation
154  scalar VDash_;
155 
156  //- Source field values
159 
160 
161  // Protected functions
162 
163  //- Set the local field data
164  void setFieldData(const dictionary& dict);
165 
166 
167 public:
168 
169  //- Runtime type information
170  TypeName("SemiImplicitSource");
171 
172 
173  // Constructors
174 
175  //- Construct from components
177  (
178  const word& name,
179  const word& modelType,
180  const dictionary& dict,
181  const fvMesh& mesh
182  );
183 
184 
185  // Member Functions
186 
187  // Access
188 
189  //- Return const access to the volume mode
190  inline const volumeModeType& volumeMode() const;
191 
192 
193  // Edit
194 
195  //- Return access to the volume mode
196  inline volumeModeType& volumeMode();
197 
198 
199  // Evaluation
200 
201  //- Add explicit contribution to equation
202  virtual void addSup
203  (
204  fvMatrix<Type>& eqn,
205  const label fieldi
206  );
207 
208  //- Add explicit contribution to compressible equation
209  virtual void addSup
210  (
211  const volScalarField& rho,
212  fvMatrix<Type>& eqn,
213  const label fieldi
214  );
215 
216 
217  // IO
218 
219  //- Read source dictionary
220  virtual bool read(const dictionary& dict);
221 };
222 
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 } // End namespace fv
227 } // End namespace Foam
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #ifdef NoRepository
232  #include "SemiImplicitSource.C"
233 #endif
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 #include "SemiImplicitSourceI.H"
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 #endif
242 
243 // ************************************************************************* //
Foam::fv::SemiImplicitSource::Su_
PtrList< Function1< Type > > Su_
Source field values.
Definition: SemiImplicitSource.H:168
Foam::Enum< volumeModeType >
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fv::cellSetOption
Cell-set options abstract base class. Provides a base set of controls, e.g.:
Definition: cellSetOption.H:72
Tuple2.H
Function1.H
Foam::fv::SemiImplicitSource::read
virtual bool read(const dictionary &dict)
Read source dictionary.
Definition: SemiImplicitSource.C:204
Foam::fv::SemiImplicitSource::TypeName
TypeName("SemiImplicitSource")
Runtime type information.
rho
rho
Definition: readInitialConditions.H:88
cellSetOption.H
Foam::fv::SemiImplicitSource::volumeMode_
volumeModeType volumeMode_
Volume mode.
Definition: SemiImplicitSource.H:162
Foam::fv::SemiImplicitSource
Semi-implicit source, described using an input dictionary. The injection rate coefficients are specif...
Definition: SemiImplicitSource.H:123
Foam::fv::SemiImplicitSource::volumeMode
const volumeModeType & volumeMode() const
Return const access to the volume mode.
Definition: SemiImplicitSourceI.H:34
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::fv::SemiImplicitSource::Sp_
PtrList< Function1< scalar > > Sp_
Definition: SemiImplicitSource.H:169
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:62
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fv::SemiImplicitSource::volumeModeTypeNames_
static const Enum< volumeModeType > volumeModeTypeNames_
Word list of volume mode type names.
Definition: SemiImplicitSource.H:154
fv
labelList fv(nPoints)
Foam::fv::SemiImplicitSource::VDash_
scalar VDash_
Volume normalisation.
Definition: SemiImplicitSource.H:165
Foam::fv::SemiImplicitSource::setFieldData
void setFieldData(const dictionary &dict)
Set the local field data.
Definition: SemiImplicitSource.C:52
Foam::fv::SemiImplicitSource::addSup
virtual void addSup(fvMatrix< Type > &eqn, const label fieldi)
Add explicit contribution to equation.
Definition: SemiImplicitSource.C:132
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:76
Foam::fv::SemiImplicitSource::SemiImplicitSource
SemiImplicitSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
Definition: SemiImplicitSource.C:113
Foam::fv::SemiImplicitSource::vmSpecific
Definition: SemiImplicitSource.H:150
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::fv::SemiImplicitSource::vmAbsolute
Definition: SemiImplicitSource.H:149
SemiImplicitSource.C
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::fv::SemiImplicitSource::volumeModeType
volumeModeType
Enumeration for volume types.
Definition: SemiImplicitSource.H:147
SemiImplicitSourceI.H
Enum.H