OpenFOAM
v2312
The open source CFD toolbox
Dual.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) 2013-2017 OpenFOAM Foundation
9
-------------------------------------------------------------------------------
10
License
11
This file is part of OpenFOAM.
12
13
OpenFOAM is free software: you can redistribute it and/or modify it
14
under the terms of the GNU General Public License as published by
15
the Free Software Foundation, either version 3 of the License, or
16
(at your option) any later version.
17
18
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21
for more details.
22
23
You should have received a copy of the GNU General Public License
24
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26
Class
27
Foam::AveragingMethods::Dual
28
29
Group
30
grpLagrangianIntermediateMPPICAveragingMethods
31
32
Description
33
Dual-mesh lagrangian averaging procedure.
34
35
Point values are summed using the tetrahedral decomposition of the
36
computational cells. Summation is done in the cells, and also in the
37
terahedrons surrounding each point. The latter forms a type of dual mesh.
38
The interpolation is weighted by proximity to the cell centre or point, as
39
calculated by the barycentric coordinate within the tethrahedron.
40
41
Values are interpolated linearly across the tethrahedron. Gradients are
42
calculated directly from the point values using a first order finite
43
element basis. The computed gradient is assumed constant over the
44
tethrahedron.
45
46
SourceFiles
47
Dual.C
48
49
\*---------------------------------------------------------------------------*/
50
51
#ifndef Dual_H
52
#define Dual_H
53
54
#include "
AveragingMethod.H
"
55
#include "
pointMesh.H
"
56
#include "
tetIndices.H
"
57
58
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59
60
namespace
Foam
61
{
62
namespace
AveragingMethods
63
{
64
65
/*---------------------------------------------------------------------------*\
66
Class Dual Declaration
67
\*---------------------------------------------------------------------------*/
68
69
template
<
class
Type>
70
class
Dual
71
:
72
public
AveragingMethod
<Type>
73
{
74
public
:
75
76
//- Public typedefs
77
78
//- Gradient type
79
typedef
typename
AveragingMethod<Type>::TypeGrad
TypeGrad
;
80
81
82
private
:
83
84
//- Private data
85
86
//- Volume of the cell-centered regions
87
const
Field<scalar>
& volumeCell_;
88
89
//- Volume of the point-centered regions
90
Field<scalar>
volumeDual_;
91
92
//- Data on the cells
93
Field<Type>
& dataCell_;
94
95
//- Data on the points
96
Field<Type>
& dataDual_;
97
98
99
//- Private Member Functions
100
101
//- The sizing for the FieldField parts
102
static
labelList
sizing(
const
fvMesh
&
mesh
);
103
104
105
//- Sync point data over processor boundaries
106
void
syncDualData();
107
108
109
public
:
110
111
//- Runtime type information
112
TypeName
(
"dual"
);
113
114
115
//- Constructors
116
117
//- Construct from components
118
Dual
119
(
120
const
IOobject
&
io
,
121
const
dictionary
&
dict
,
122
const
fvMesh
&
mesh
123
);
124
125
//- Construct a copy
126
Dual
(
const
Dual<Type>
& am);
127
128
//- Construct and return a clone
129
virtual
autoPtr<AveragingMethod<Type>
>
clone
()
const
130
{
131
return
autoPtr<AveragingMethod<Type>
>
132
(
133
new
Dual<Type>
(*this)
134
);
135
}
136
137
138
//- Destructor
139
virtual
~Dual
() =
default
;
140
141
142
//- Member Functions
143
144
//- Add point value to interpolation
145
void
add
146
(
147
const
barycentric
&
coordinates
,
148
const
tetIndices
& tetIs,
149
const
Type& value
150
);
151
152
//- Interpolate
153
Type
interpolate
154
(
155
const
barycentric
&
coordinates
,
156
const
tetIndices
& tetIs
157
)
const
;
158
159
//- Interpolate gradient
160
TypeGrad
interpolateGrad
161
(
162
const
barycentric
&
coordinates
,
163
const
tetIndices
& tetIs
164
)
const
;
165
166
//- Calculate the average
167
void
average
();
168
void
average
(
const
AveragingMethod<scalar>
& weight);
169
170
//- Return an internal field of the average
171
tmp<Field<Type>
>
primitiveField
()
const
;
172
173
//- Return an internal field of the gradient
174
tmp<Field<TypeGrad>
>
internalFieldGrad
()
const
;
175
};
176
177
178
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179
180
}
// End namespace AveragingMethods
181
}
// End namespace Foam
182
183
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184
185
#ifdef NoRepository
186
#include "
Dual.C
"
187
#endif
188
189
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190
191
#endif
192
193
// ************************************************************************* //
Foam::AveragingMethods::Dual::TypeName
TypeName("dual")
Runtime type information.
Foam::AveragingMethods::Dual::primitiveField
tmp< Field< Type > > primitiveField() const
Return an internal field of the average.
Definition:
Dual.C:209
dict
dictionary dict
Definition:
searchingEngine.H:11
Foam::AveragingMethods::Dual::interpolate
Type interpolate(const barycentric &coordinates, const tetIndices &tetIs) const
Interpolate.
Definition:
Dual.C:131
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition:
dictionary.H:129
Foam::List< label >
Foam::AveragingMethod::TypeGrad
outerProduct< vector, Type >::type TypeGrad
Protected typedefs.
Definition:
AveragingMethod.H:68
Foam::AveragingMethods::Dual::Dual
Dual(const IOobject &io, const dictionary &dict, const fvMesh &mesh)
Constructors.
Definition:
Dual.C:40
Foam::AveragingMethods::Dual::clone
virtual autoPtr< AveragingMethod< Type > > clone() const
Construct and return a clone.
Definition:
Dual.H:154
Foam::AveragingMethods::Dual::~Dual
virtual ~Dual()=default
Destructor.
Dual.C
Foam::AveragingMethods::Dual::interpolateGrad
TypeGrad interpolateGrad(const barycentric &coordinates, const tetIndices &tetIs) const
Interpolate gradient.
Definition:
Dual.C:149
pointMesh.H
mesh
dynamicFvMesh & mesh
Definition:
createDynamicFvMesh.H:6
Foam::Field< scalar >
Foam::AveragingMethod
Base class for lagrangian averaging methods.
Definition:
KinematicParcel.H:65
Foam::tetIndices
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
Definition:
tetIndices.H:78
Foam::AveragingMethods::Dual
Dual-mesh lagrangian averaging procedure.
Definition:
Dual.H:65
Foam::AveragingMethods::Dual::TypeGrad
AveragingMethod< Type >::TypeGrad TypeGrad
Public typedefs.
Definition:
Dual.H:78
Foam::Barycentric< scalar >
coordinates
PtrList< coordinateSystem > coordinates(solidRegions.size())
AveragingMethod.H
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition:
fvMesh.H:78
tetIndices.H
Foam::AveragingMethods::Dual::average
void average()
Calculate the average.
Definition:
Dual.C:187
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition:
HashPtrTable.H:48
io
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
Foam::tmp
A class for managing temporary objects.
Definition:
HashPtrTable.H:50
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition:
IOobject.H:172
Foam::AveragingMethods::Dual::internalFieldGrad
tmp< Field< TypeGrad > > internalFieldGrad() const
Return an internal field of the gradient.
Foam
Namespace for OpenFOAM.
Definition:
atmBoundaryLayer.C:26
Foam::AveragingMethods::Dual::add
void add(const barycentric &coordinates, const tetIndices &tetIs, const Type &value)
Member Functions.
Definition:
Dual.C:108
src
lagrangian
intermediate
submodels
MPPIC
AveragingMethods
Dual
Dual.H
Generated by
1.8.14