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  Applies semi-implicit source within a specified region for \c Type,
35  where \c <Type>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
36  The injection rate coefficients are specified
37  as pairs of Su-Sp coefficients, i.e.:
38 
39  \f[
40  S(x) = S_u + S_p x
41  \f]
42 
43  where
44  \vartable
45  S(x) | net source for field 'x'
46  S_u | explicit source contribution
47  S_p | linearised implicit contribution
48  \endvartable
49 
50 Usage
51  Minimal example by using \c constant/fvOptions:
52  \verbatim
53  <Type>SemiImplicitSource1
54  {
55  // Mandatory entries (unmodifiable)
56  type <Type>SemiImplicitSource;
57 
58  // Mandatory entries (runtime modifiable)
59  volumeMode <volumeModeType>;
60  injectionRateSuSp
61  {
62  k (30.7 0);
63  epsilon (1.5 0);
64 
65  // The injectionRate can also be specified as a Function1
66  // by having dictionaries for the field entries instead
67  k
68  {
69  // Time-ramp from 0 to 30.7 at time 5
70  Su table
71  (
72  (0 0.0)
73  (5 30.7)
74  );
75  Sp 0.0;
76  }
77  epsilon
78  {
79  Su 1.5;
80  Sp 0.0;
81  }
82  }
83 
84  // Mandatory/Optional (inherited) entries
85  ...
86  }
87  \endverbatim
88 
89  where the entries mean:
90  \table
91  Property | Description | Type | Reqd | Dflt
92  type | Type name: <Type>SemiImplicitSource <!--
93  --> | word | yes | -
94  volumeMode | Volume mode type | word | yes | -
95  injectionRateSuSp | Injection rate settings | dictionary | yes | -
96  \endtable
97 
98  The inherited entries are elaborated in:
99  - \link fvOption.H \endlink
100  - \link cellSetOption.H \endlink
101 
102  Options for the \c volumeMode entry:
103  \verbatim
104  absolute | Values are given as <quantity>
105  specific | Values are given as <quantity>/m3
106  \endverbatim
107 
108 See also
109  - Foam::fvOption
110 
111 SourceFiles
112  SemiImplicitSource.C
113 
114 \*---------------------------------------------------------------------------*/
115 
116 #ifndef SemiImplicitSource_H
117 #define SemiImplicitSource_H
118 
119 #include "Tuple2.H"
120 #include "cellSetOption.H"
121 #include "Enum.H"
122 #include "Function1.H"
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 namespace Foam
127 {
128 namespace fv
129 {
130 
131 // Forward declarations
132 template<class Type> class SemiImplicitSource;
133 
134 template<class Type>
135 Ostream& operator<<
136 (
137  Ostream&,
138  const SemiImplicitSource<Type>&
139 );
140 
141 
142 /*---------------------------------------------------------------------------*\
143  Class SemiImplicitSource Declaration
144 \*---------------------------------------------------------------------------*/
145 
146 template<class Type>
147 class SemiImplicitSource
148 :
149  public fv::cellSetOption
150 {
151 public:
152 
153  // Public Enumerations
154 
155  //- Options for the volume mode type
156  enum volumeModeType
157  {
158  vmAbsolute,
159  vmSpecific
160  };
161 
162  //- Names for volumeModeType
163  static const Enum<volumeModeType> volumeModeTypeNames_;
164 
165 
166 protected:
167 
168  // Protected Data
169 
170  //- Volume mode
172 
173  //- Volume normalisation
174  scalar VDash_;
175 
176  //- Source field values
179 
180 
181  // Protected Functions
182 
183  //- Set the local field data
184  void setFieldData(const dictionary& dict);
185 
186 
187 public:
188 
189  //- Runtime type information
190  TypeName("SemiImplicitSource");
191 
192 
193  // Constructors
194 
195  //- Construct from components
197  (
198  const word& name,
199  const word& modelType,
200  const dictionary& dict,
201  const fvMesh& mesh
202  );
203 
204 
205  // Member Functions
206 
207  // Access
208 
209  //- Return const access to the volume mode
210  inline const volumeModeType& volumeMode() const;
211 
212 
213  // Edit
214 
215  //- Return access to the volume mode
216  inline volumeModeType& volumeMode();
217 
218 
219  // Evaluation
220 
221  //- Add explicit contribution to equation
222  virtual void addSup
223  (
224  fvMatrix<Type>& eqn,
225  const label fieldi
226  );
227 
228  //- Add explicit contribution to compressible equation
229  virtual void addSup
230  (
231  const volScalarField& rho,
232  fvMatrix<Type>& eqn,
233  const label fieldi
234  );
235 
236 
237  // IO
238 
239  //- Read source dictionary
240  virtual bool read(const dictionary& dict);
241 };
242 
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 } // End namespace fv
247 } // End namespace Foam
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 #ifdef NoRepository
252  #include "SemiImplicitSource.C"
253 #endif
254 
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 
257 #include "SemiImplicitSourceI.H"
258 
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 
261 #endif
262 
263 // ************************************************************************* //
Foam::fv::SemiImplicitSource::Su_
PtrList< Function1< Type > > Su_
Source field values.
Definition: SemiImplicitSource.H:214
Foam::Enum< volumeModeType >
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fv::cellSetOption
Intermediate abstract class for handling cell-set options for the derived fvOptions.
Definition: cellSetOption.H:163
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:208
Foam::fv::SemiImplicitSource
Applies semi-implicit source within a specified region for Type, where <Type>=Scalar/Vector/Spherical...
Definition: SemiImplicitSource.H:169
Foam::fv::SemiImplicitSource::volumeMode
const volumeModeType & volumeMode() const
Return const access to the volume mode.
Definition: SemiImplicitSourceI.H:34
Foam::fv::SemiImplicitSource::Sp_
PtrList< Function1< scalar > > Sp_
Definition: SemiImplicitSource.H:215
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
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:123
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fv::SemiImplicitSource::volumeModeTypeNames_
static const Enum< volumeModeType > volumeModeTypeNames_
Names for volumeModeType.
Definition: SemiImplicitSource.H:200
fv
labelList fv(nPoints)
Foam::fv::SemiImplicitSource::VDash_
scalar VDash_
Volume normalisation.
Definition: SemiImplicitSource.H:211
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:68
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
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:196
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:195
SemiImplicitSource.C
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::fv::SemiImplicitSource::volumeModeType
volumeModeType
Options for the volume mode type.
Definition: SemiImplicitSource.H:193
SemiImplicitSourceI.H
Enum.H