Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
finiteVolume
cfdTools
general
fieldSources
basicSource
explicitSource
explicitSource.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) 2010-2010 OpenCFD Ltd.
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::explicitSource
26
27
Description
28
Explicit source.
29
30
Sources described by:
31
32
explicitSourceCoeffs
33
{
34
points // list of points when selectionMode = points
35
(
36
(-0.088 0.007 -0.02)
37
(-0.028 0.007 -0.02)
38
);
39
volumeMode specific; //absolute
40
fieldData // field data - usage for multiple fields
41
{
42
k 30.7;
43
epsilon 1.5;
44
}
45
}
46
47
SourceFiles
48
explicitSource.C
49
50
\*---------------------------------------------------------------------------*/
51
52
#ifndef explicitSource_H
53
#define explicitSource_H
54
55
#include <
meshTools/cellSet.H
>
56
#include <
finiteVolume/volFieldsFwd.H
>
57
#include <
OpenFOAM/DimensionedField.H
>
58
#include <
finiteVolume/basicSource.H
>
59
60
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61
62
namespace
Foam
63
{
64
65
/*---------------------------------------------------------------------------*\
66
Class explicitSource Declaration
67
\*---------------------------------------------------------------------------*/
68
69
class
explicitSource
70
:
71
public
basicSource
72
{
73
// Private classes
74
75
template
<
class
Type>
76
class
fieldList
77
:
78
public
HashTable
<Type>
79
{
80
81
explicitSource
& OwnerPtr_;
82
83
public
:
84
85
//- null Constructor
86
fieldList()
87
:
88
HashTable<Type>
(0),
89
OwnerPtr_(*
this
)
90
{}
91
92
93
//- Constructor
94
fieldList(label size,
explicitSource
& ownerPtr)
95
:
96
HashTable<Type>
(size),
97
OwnerPtr_(ownerPtr)
98
{}
99
100
101
void
applySources()
102
{
103
typedef
GeometricField<Type, fvPatchField, volMesh>
104
geometricField;
105
106
forAll
(this->toc(), i)
107
{
108
geometricField& field =
const_cast<
geometricField&
>
109
(
110
OwnerPtr_.mesh().lookupObject<geometricField>
111
(this->toc()[i])
112
);
113
114
Type data = this->operator[](field.name());
115
OwnerPtr_.addSources<Type>(field.internalField(), data);
116
}
117
}
118
};
119
120
private
:
121
122
// Private cdata
123
124
//- List of field types
125
fieldList<scalar> scalarFields_;
126
fieldList<vector> vectorFields_;
127
128
//- Add field names and values to field table for types.
129
template
<
class
Type>
130
void
addField
131
(
132
HashTable<Type>
&
fields
,
133
const
wordList
& fieldTypes,
134
const
wordList
&
fieldNames
,
135
const
dictionary
&
dict_
136
);
137
138
139
//- Add data to field source
140
template
<
class
Type>
141
void
addSources
142
(
143
Field<Type>
& fieldSource,
144
Type& data
145
)
const
;
146
147
148
public
:
149
150
151
// Public data
152
153
//- Enumeration for volume types
154
enum
volumeModeType
155
{
156
vmAbsolute
,
157
vmSpecific
158
};
159
160
//- Word list of volume mode type names
161
static
const
wordList
volumeModeTypeNames_
;
162
163
164
protected
:
165
166
// Protected data
167
168
//- Sub dictionary for time activated explicit sources
169
const
dictionary
&
dict_
;
170
171
//- Volume mode
172
volumeModeType
volumeMode_
;
173
174
//- List of points for "points" selectionMode
175
List<point>
points_
;
176
177
//- Volume of the explicit source
178
scalarList
volSource_
;
179
180
181
// Protected functions
182
183
//- Helper function to convert from a word to a volumeModeType
184
volumeModeType
wordToVolumeModeType
(
const
word
& vtName)
const
;
185
186
//- Helper function to convert from a volumeModeType to a word
187
word
volumeModeTypeToWord
(
const
volumeModeType
& vtType)
const
;
188
189
//- Set the local field data
190
void
setFieldData
(
const
dictionary
& dict);
191
192
//- Set selected cells when smPoint is used
193
void
setSelectedCellsFromPoints
();
194
195
196
public
:
197
198
//- Runtime type information
199
TypeName
(
"explicitSource"
);
200
201
202
// Constructors
203
204
//- Construct from components
205
explicitSource
206
(
207
const
word
&
name
,
208
const
dictionary
& dict,
209
const
fvMesh
&
mesh
210
);
211
212
//- Return clone
213
autoPtr<explicitSource>
clone
()
const
214
{
215
notImplemented
216
(
217
"autoPtr<explicitSource> clone() const"
218
);
219
return
autoPtr<explicitSource>
(NULL);
220
}
221
222
223
224
// Member Functions
225
226
// Access
227
228
//- Return const access to the volume mode
229
inline
const
volumeModeType
&
volumeMode
()
const
;
230
231
232
// Edit
233
234
//- Return access to the volume mode
235
inline
volumeModeType
&
volumeMode
();
236
237
//- Return points
238
inline
const
List<point>
&
points
()
const
;
239
240
241
// Evaluation
242
243
//-Source term to fvMatrix<vector>
244
virtual
void
addSu
(
fvMatrix<vector>
&
UEqn
);
245
246
//-Source term to fvMatrix<scalar>
247
virtual
void
addSu
(
fvMatrix<scalar>
&
UEqn
);
248
249
//- Add all explicit source
250
virtual
void
addExplicitSources
();
251
252
//- Add source to scalar field
253
virtual
void
addSu
(
DimensionedField<vector, volMesh>
& field);
254
255
//- Add source to vector field
256
virtual
void
addSu
(
DimensionedField<scalar, volMesh>
& field);
257
258
259
// I-O
260
261
//- Write the source properties
262
virtual
void
writeData
(
Ostream
&)
const
;
263
264
//- Read fieldData in sub-dictionary
265
virtual
bool
read
(
const
dictionary
& dict);
266
267
//- Ostream operator
268
friend
Ostream
&
operator
<<
269
(
270
Ostream
& os,
271
const
explicitSource
& source
272
);
273
};
274
275
276
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277
278
}
// End namespace Foam
279
280
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281
282
#include "
explicitSourceIO.C
"
283
#include "
explicitSourceI.H
"
284
285
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
286
287
#ifdef NoRepository
288
# include "
explicitSourceTemplates.C
"
289
#endif
290
291
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
292
293
#endif
294
295
// ************************************************************************* //