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 | Copyright (C) 2011-2015 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::SemiImplicitSource
26 
27 Description
28  Semi-implicit source, described using an input dictionary. The injection
29  rate coefficients are specified as pairs of Su-Sp coefficients, i.e.
30 
31  \f[
32  S(x) = S_u + S_p x
33  \f]
34 
35  where
36  \vartable
37  S(x) | net source for field 'x'
38  S_u | explicit source contribution
39  S_p | linearised implicit contribution
40  \endvartable
41 
42  Example of the source specification:
43 
44  \verbatim
45  <Type>SemiImplicitSourceCoeffs
46  {
47  volumeMode absolute; // specific
48  injectionRateSuSp
49  {
50  k (30.7 0);
51  epsilon (1.5 0);
52  }
53  }
54  \endverbatim
55 
56  Valid options for the \c volumeMode entry include:
57  - absolute: values are given as <quantity>
58  - specific: values are given as <quantity>/m3
59 
60 SeeAlso
61  Foam::fvOption
62 
63 SourceFiles
64  SemiImplicitSource.C
65 
66 \*---------------------------------------------------------------------------*/
67 
68 #ifndef SemiImplicitSource_H
69 #define SemiImplicitSource_H
70 
71 #include "Tuple2.H"
72 #include "cellSetOption.H"
73 
74 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
75 
76 namespace Foam
77 {
78 namespace fv
79 {
80 
81 // Forward declaration of classes
82 
83 template<class Type>
84 class SemiImplicitSource;
85 
86 
87 // Forward declaration of friend functions
88 
89 template<class Type>
90 Ostream& operator<<
91 (
92  Ostream&,
93  const SemiImplicitSource<Type>&
94 );
95 
96 
97 /*---------------------------------------------------------------------------*\
98  Class SemiImplicitSource Declaration
99 \*---------------------------------------------------------------------------*/
100 
101 template<class Type>
102 class SemiImplicitSource
103 :
104  public cellSetOption
105 {
106 public:
107 
108  // Public data
109 
110  //- Enumeration for volume types
111  enum volumeModeType
112  {
113  vmAbsolute,
114  vmSpecific
115  };
116 
117  //- Word list of volume mode type names
118  static const wordList volumeModeTypeNames_;
119 
120 
121 protected:
123  // Protected data
125  //- Volume mode
127 
128  //- Volume normalisation
129  scalar VDash_;
130 
131  //- Source field values
133 
134 
135  // Protected functions
136 
137  //- Helper function to convert from a word to a volumeModeType
138  volumeModeType wordToVolumeModeType(const word& vtName) const;
139 
140  //- Helper function to convert from a volumeModeType to a word
141  word volumeModeTypeToWord(const volumeModeType& vtType) const;
142 
143  //- Set the local field data
144  void setFieldData(const dictionary& dict);
145 
146 
147 public:
148 
149  //- Runtime type information
150  TypeName("SemiImplicitSource");
151 
152 
153  // Constructors
154 
155  //- Construct from components
157  (
158  const word& name,
159  const word& modelType,
160  const dictionary& dict,
161  const fvMesh& mesh
162  );
163 
164 
165  // Member Functions
166 
167  // Access
168 
169  //- Return const access to the volume mode
170  inline const volumeModeType& volumeMode() const;
171 
172  //- Return const access to the source field values
173  inline const List<Tuple2<Type, scalar> >& injectionRate() const;
174 
175 
176  // Edit
177 
178  //- Return access to the volume mode
179  inline volumeModeType& volumeMode();
180 
181  //- Return access to the source field values
183 
184 
185  // Evaluation
186 
187  //- Add explicit contribution to equation
188  virtual void addSup
189  (
190  fvMatrix<Type>& eqn,
191  const label fieldI
192  );
193 
194  //- Add explicit contribution to compressible equation
195  virtual void addSup
196  (
197  const volScalarField& rho,
198  fvMatrix<Type>& eqn,
199  const label fieldI
200  );
201 
202 
203  // IO
204 
205  //- Read source dictionary
206  virtual bool read(const dictionary& dict);
207 };
208 
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 } // End namespace fv
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #ifdef NoRepository
218 # include "SemiImplicitSource.C"
219 # include "SemiImplicitSourceIO.C"
220 #endif
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #include "SemiImplicitSourceI.H"
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 #endif
229 
230 // ************************************************************************* //
Cell-set options abtract base class. Provides a base set of controls, e.g.
Definition: cellSetOption.H:71
volumeModeType volumeMode_
Volume mode.
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvOptionI.H:34
word volumeModeTypeToWord(const volumeModeType &vtType) const
Helper function to convert from a volumeModeType to a word.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
TypeName("SemiImplicitSource")
Runtime type information.
List< Tuple2< Type, scalar > > injectionRate_
Source field values.
const word & name() const
Return const access to the source name.
Definition: fvOptionI.H:28
A class for handling words, derived from string.
Definition: word.H:59
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
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:68
Semi-implicit source, described using an input dictionary. The injection rate coefficients are specif...
SemiImplicitSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Namespace for OpenFOAM.
static const wordList volumeModeTypeNames_
Word list of volume mode type names.
dictionary dict
volumeModeType wordToVolumeModeType(const word &vtName) const
Helper function to convert from a word to a volumeModeType.
virtual bool read(const dictionary &dict)
Read source dictionary.
volumeModeType
Enumeration for volume types.
const volumeModeType & volumeMode() const
Return const access to the volume mode.
virtual void addSup(fvMatrix< Type > &eqn, const label fieldI)
Add explicit contribution to equation.
labelList fv(nPoints)
void setFieldData(const dictionary &dict)
Set the local field data.
scalar VDash_
Volume normalisation.
const List< Tuple2< Type, scalar > > & injectionRate() const
Return const access to the source field values.