Moment.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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::AveragingMethods::Moment
28
29Group
30 grpLagrangianIntermediateMPPICAveragingMethods
31
32Description
33 Moment lagrangian averaging procedure.
34
35 Point values and moments from the cell centroid are summed over
36 computational cells. A linear function is generated which has the same
37 integrated moment as that of the point data.
38
39 The computed linear function is used to interpolate values within a cell.
40 The gradient is calculated from the coefficients of the function, and is
41 assumed constant over the cell.
42
43SourceFiles
44 Moment.C
45
46\*---------------------------------------------------------------------------*/
47
48#ifndef Moment_H
49#define Moment_H
50
51#include "AveragingMethod.H"
52#include "pointMesh.H"
53#include "tetIndices.H"
54
55// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56
57namespace Foam
58{
59namespace AveragingMethods
60{
61
62/*---------------------------------------------------------------------------*\
63 Class Moment Declaration
64\*---------------------------------------------------------------------------*/
65
66template<class Type>
67class Moment
68:
69 public AveragingMethod<Type>
70{
71public:
72
73 //- Public typedefs
74
75 //- Gradient type
77
78
79private:
80
81 //- Private data
82
83 //- Data mean
84 Field<Type>& data_;
85
86 //- X-data moment
87 Field<Type>& dataX_;
88
89 //- Y-data moment
90 Field<Type>& dataY_;
91
92 //- Z-data moment
93 Field<Type>& dataZ_;
94
95 //- Transform tensor from moment to gradient
96 Field<symmTensor> transform_;
97
98 //- Length scale for moment values
99 Field<scalar> scale_;
100
101
102 //- Private member functions
103
104 //- Re-calculate gradient
105 virtual void updateGrad();
106
107
108public:
109
110 //- Runtime type information
111 TypeName("moment");
112
113
114 //- Constructors
115
116 //- Construct from components
117 Moment
118 (
119 const IOobject& io,
120 const dictionary& dict,
121 const fvMesh &mesh
122 );
123
124 //- Construct a copy
125 Moment(const Moment<Type>& am);
126
127 //- Construct and return a clone
128 virtual autoPtr<AveragingMethod<Type>> clone() const
129 {
131 (
132 new Moment<Type>(*this)
133 );
134 }
135
136
137 //- Destructor
138 virtual ~Moment();
139
140
141 //- Member Functions
142
143 //- Add point value to interpolation
144 void add
145 (
147 const tetIndices& tetIs,
148 const Type& value
149 );
150
151 //- Interpolate
152 Type interpolate
153 (
155 const tetIndices& tetIs
156 ) const;
157
158 //- Interpolate gradient
160 (
162 const tetIndices& tetIs
163 ) const;
164
165 //- Return an internal field of the average
167
168 //- Return an internal field of the gradient
170};
171
172
173// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174
175} // End namespace AveragingMethods
176} // End namespace Foam
177
178// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179
180#ifdef NoRepository
181 #include "Moment.C"
182#endif
183
184// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185
186#endif
187
188// ************************************************************************* //
Base class for lagrangian averaging methods.
Moment lagrangian averaging procedure.
Definition: Moment.H:69
AveragingMethod< Type >::TypeGrad TypeGrad
Public typedefs.
Definition: Moment.H:75
tmp< Field< TypeGrad > > internalFieldGrad() const
Return an internal field of the gradient.
virtual autoPtr< AveragingMethod< Type > > clone() const
Construct and return a clone.
Definition: Moment.H:127
tmp< Field< Type > > primitiveField() const
Return an internal field of the average.
Definition: Moment.C:209
virtual ~Moment()
Destructor.
Definition: Moment.C:117
Type interpolate(const barycentric &coordinates, const tetIndices &tetIs) const
Interpolate.
Definition: Moment.C:159
TypeGrad interpolateGrad(const barycentric &coordinates, const tetIndices &tetIs) const
Interpolate gradient.
Definition: Moment.C:190
void add(const barycentric &coordinates, const tetIndices &tetIs, const Type &value)
Member Functions.
Definition: Moment.C:132
TypeName("moment")
Runtime type information.
Generic templated field type.
Definition: Field.H:82
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
Definition: tetIndices.H:84
A class for managing temporary objects.
Definition: tmp.H:65
type
Volume classification types.
Definition: volumeType.H:66
dynamicFvMesh & mesh
PtrList< coordinateSystem > coordinates(solidRegions.size())
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73