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
timeActivatedExplicitSource
TimeActivatedExplicitSource_.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::TimeActivatedExplicitSource
26
27
Description
28
Time activated explicit source.
29
30
Sources described by:
31
32
{
33
active true; // on/off switch
34
timeStart 0.2; // start time
35
duration 2.0; // duration
36
selectionMode points; // cellSet/cellZone/all
37
volumeMode absolute; // specific
38
39
fieldData // field data - usage for multiple fields
40
(
41
(H2O 0.005)
42
);
43
44
fieldData 0.005; // field data - usage for single field
45
46
points // list of points when selectionMode = points
47
(
48
(2.75 0.5 0)
49
);
50
51
cellSet c0; // cellSet name when selectionMode=cellSet
52
cellZone c0; // cellZone name when selectionMode=cellZone
53
}
54
55
SourceFiles
56
TimeActivatedExplicitSource_.C
57
58
\*---------------------------------------------------------------------------*/
59
60
#ifndef TimeActivatedExplicitSource_H
61
#define TimeActivatedExplicitSource_H
62
63
#include <
OpenFOAM/Tuple2.H
>
64
#include <
meshTools/cellSet.H
>
65
#include <
finiteVolume/volFieldsFwd.H
>
66
#include <
OpenFOAM/DimensionedField.H
>
67
68
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69
70
namespace
Foam
71
{
72
73
// Forward declaration of classes
74
75
class
fvMesh;
76
77
template
<
class
Type>
78
class
TimeActivatedExplicitSource;
79
80
// Forward declaration of friend functions
81
82
template
<
class
Type>
83
Ostream&
operator
<<
84
(
85
Ostream&,
86
const
TimeActivatedExplicitSource<Type>&
87
);
88
89
/*---------------------------------------------------------------------------*\
90
Class TimeActivatedExplicitSource Declaration
91
\*---------------------------------------------------------------------------*/
92
93
template
<
class
Type>
94
class
TimeActivatedExplicitSource
95
{
96
public
:
97
98
// Public data
99
100
//- Enumeration for selection mode types
101
enum
selectionModeType
102
{
103
smPoints
,
104
smCellSet
,
105
smCellZone
,
106
smAll
107
};
108
109
//- Word list of selection mode type names
110
static
const
wordList
selectionModeTypeNames_
;
111
112
//- Enumeration for volume types
113
enum
volumeModeType
114
{
115
vmAbsolute
,
116
vmSpecific
117
};
118
119
//- Word list of volume mode type names
120
static
const
wordList
volumeModeTypeNames_
;
121
122
123
protected
:
124
125
// Protected data
126
127
typedef
Tuple2<word, Type>
fieldNameValuePair
;
128
129
//- Source name
130
word
name_
;
131
132
//- Reference to the mesh database
133
const
fvMesh
&
mesh_
;
134
135
//- Source active flag
136
bool
active_
;
137
138
//- Time start
139
scalar
timeStart_
;
140
141
//- Duration
142
scalar
duration_
;
143
144
//- Volume mode
145
volumeModeType
volumeMode_
;
146
147
//- Cell selection mode
148
selectionModeType
selectionMode_
;
149
150
//- List of points for "points" selectionMode
151
List<point>
points_
;
152
153
//- Name of cell set for "cellSet" and "cellZone" selectionMode
154
word
cellSetName_
;
155
156
//- Set of cells to apply source to
157
labelList
cells_
;
158
159
//- Sum of cell volumes
160
scalar
V_
;
161
162
//- List of source field name vs value pairs
163
List<fieldNameValuePair>
fieldData_
;
164
165
//- Map of fields ids from supplied fields to local field source ids
166
labelList
fieldIds_
;
167
168
169
// Protected functions
170
171
//- Helper function to convert from a word to a selectionModeType
172
selectionModeType
wordToSelectionModeType
(
const
word
& smtName)
const
;
173
174
//- Helper function to convert from a word to a volumeModeType
175
volumeModeType
wordToVolumeModeType
(
const
word
& vtName)
const
;
176
177
//- Helper function to convert from a selectionModeType to a word
178
word
selectionModeTypeToWord
(
const
selectionModeType
& smtType)
const
;
179
180
//- Helper function to convert from a volumeModeType to a word
181
word
volumeModeTypeToWord
(
const
volumeModeType
& vtType)
const
;
182
183
//- Set the cellSet or points selection
184
void
setSelection
(
const
dictionary
& dict);
185
186
//- Set the local field data
187
void
setFieldData
(
const
dictionary
& dict,
const
wordList
&
fieldNames
);
188
189
//- Set the cell set based on the user input selection mode
190
void
setCellSet
();
191
192
193
public
:
194
195
// Constructors
196
197
//- Construct from components
198
TimeActivatedExplicitSource
199
(
200
const
word
&
name
,
201
const
dictionary
& dict,
202
const
fvMesh
&
mesh
,
203
const
wordList
&
fieldNames
204
);
205
206
//- Return clone
207
autoPtr<TimeActivatedExplicitSource>
clone
()
const
208
{
209
notImplemented
210
(
211
"autoPtr<TimeActivatedExplicitSource> clone() const"
212
);
213
return
autoPtr<TimeActivatedExplicitSource>
(NULL);
214
}
215
216
//- Return pointer to new TimeActivatedExplicitSource object created
217
// on the freestore from an Istream
218
class
iNew
219
{
220
//- Reference to the mesh database
221
const
fvMesh
& mesh_;
222
223
//- List of field names
224
const
wordList
& fieldNames_;
225
226
227
public
:
228
229
iNew
230
(
231
const
fvMesh
&
mesh
,
232
const
wordList
&
fieldNames
233
)
234
:
235
mesh_(mesh),
236
fieldNames_(fieldNames)
237
{}
238
239
autoPtr<TimeActivatedExplicitSource>
operator()
(
Istream
& is)
const
240
{
241
const
word
name
(is);
242
const
dictionary
dict(is);
243
244
return
autoPtr<TimeActivatedExplicitSource>
245
(
246
new
TimeActivatedExplicitSource
247
(
248
name,
249
dict,
250
mesh_,
251
fieldNames_
252
)
253
);
254
}
255
};
256
257
258
// Member Functions
259
260
// Access
261
262
//- Return const access to the source name
263
inline
const
word
&
name
()
const
;
264
265
//- Return const access to the mesh database
266
inline
const
fvMesh
&
mesh
()
const
;
267
268
//- Return const access to the source active flag
269
inline
bool
active
()
const
;
270
271
//- Return const access to the time start
272
inline
scalar
timeStart
()
const
;
273
274
//- Return const access to the duration
275
inline
scalar
duration
()
const
;
276
277
//- Return const access to the time end
278
inline
scalar
timeEnd
()
const
;
279
280
//- Return const access to the volume mode
281
inline
const
volumeModeType
&
volumeMode
()
const
;
282
283
//- Return const access to the cell selection mode
284
inline
const
selectionModeType
&
selectionMode
()
const
;
285
286
//- Return const access to the list of points for "points"
287
// selectionMode
288
inline
const
List<point>
&
points
()
const
;
289
290
//- Return const access to the name of cell set for "cellSet"
291
// selectionMode
292
inline
const
word
&
cellSetName
()
const
;
293
294
//- Return const access to the total cell volume
295
inline
scalar
V
()
const
;
296
297
//- Return const access to the cell set
298
inline
const
labelList
&
cells
()
const
;
299
300
//- Return const access to the source field name vs value pairs
301
inline
const
List<fieldNameValuePair>
&
fieldData
()
const
;
302
303
//- Return const access to the the map of fields ids from supplied
304
// fields to local field source ids
305
inline
const
labelList
&
fieldIds
()
const
;
306
307
308
// Edit
309
310
//- Return access to the source name
311
inline
word
&
name
();
312
313
//- Return access to the source active flag
314
inline
bool
&
active
();
315
316
//- Return access to the time start
317
inline
scalar&
timeStart
();
318
319
//- Return access to the duration
320
inline
scalar&
duration
();
321
322
//- Return access to the volume mode
323
inline
volumeModeType
&
volumeMode
();
324
325
//- Return access to the cell selection mode
326
inline
selectionModeType
&
selectionMode
();
327
328
//- Return access to the list of points for "points" selectionMode
329
inline
List<point>
&
points
();
330
331
//- Return access to the name of cell set for "cellSet"
332
// selectionMode
333
inline
word
&
cellSetName
();
334
335
//- Return access to the total cell volume
336
inline
scalar&
V
();
337
338
//- Return access to the cell set
339
inline
labelList
&
cells
();
340
341
//- Return access to the source field name vs value pairs
342
inline
List<fieldNameValuePair>
&
fieldData
();
343
344
//- Return access to the the map of fields ids from supplied
345
// fields to local field source ids
346
inline
labelList
&
fieldIds
();
347
348
349
// Evaluation
350
351
//- Add the source contribution to field Su
352
void
addToField
353
(
354
DimensionedField<Type, volMesh>
&
Su
,
355
const
label fieldI
356
);
357
358
359
// I-O
360
361
//- Write the source properties
362
void
writeData
(
Ostream
&)
const
;
363
364
//- Ostream operator
365
friend
Ostream
& operator<< <Type>
366
(
367
Ostream
& os,
368
const
TimeActivatedExplicitSource
& source
369
);
370
};
371
372
373
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
374
375
}
// End namespace Foam
376
377
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
378
379
#ifdef NoRepository
380
# include "
TimeActivatedExplicitSource_.C
"
381
# include "
TimeActivatedExplicitSourceIO.C
"
382
#endif
383
384
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
385
386
#include "
TimeActivatedExplicitSourceI.H
"
387
388
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
389
390
#endif
391
392
// ************************ vim: set sw=4 sts=4 et: ************************ //