Basic.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
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::AveragingMethods::Basic
26 
27 Description
28  Basic lagrangian averaging procedure.
29 
30  This is a cell-volume based average. Point values are summed over the
31  computational cells and the result is divided by the cell volume.
32 
33  Interpolation is done assuming a constant value over each cells. Cell
34  gradients are calculated by the default fvc::grad scheme, and are also
35  assumed constant when interpolated.
36 
37 SourceFiles
38  Basic.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef Basic_H
43 #define Basic_H
44 
45 #include "AveragingMethod.H"
46 #include "pointMesh.H"
47 #include "tetIndices.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 namespace AveragingMethods
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class Basic Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 template<class Type>
61 class Basic
62 :
63  public AveragingMethod<Type>
64 {
65 public:
66 
67  // Public Typedefs
68 
69  //- Gradient type
71 
72 
73 private:
74 
75  // Private data
76 
77  //- Cell average field
78  Field<Type>& data_;
79 
80  //- Gradient field
81  Field<TypeGrad> dataGrad_;
82 
83 
84  // Private Member Functions
85 
86  //- Re-calculate gradient
87  virtual void updateGrad();
88 
89 
90 public:
91 
92  //- Runtime type information
93  TypeName("basic");
94 
95 
96  //- Constructors
97 
98  //- Construct from components
99  Basic
100  (
101  const IOobject& io,
102  const dictionary& dict,
103  const fvMesh &mesh
104  );
105 
106  //- Construct a copy
107  Basic(const Basic<Type>& am);
108 
109  //- Construct and return a clone
110  virtual autoPtr<AveragingMethod<Type>> clone() const
111  {
113  (
114  new Basic<Type>(*this)
115  );
116  }
117 
118 
119  //- Destructor
120  virtual ~Basic();
121 
122 
123  //- Member Functions
124 
125  //- Add point value to interpolation
126  void add
127  (
128  const barycentric& coordinates,
129  const tetIndices& tetIs,
130  const Type& value
131  );
132 
133  //- Interpolate
134  Type interpolate
135  (
136  const barycentric& coordinates,
137  const tetIndices& tetIs
138  ) const;
139 
140  //- Interpolate gradient
141  TypeGrad interpolateGrad
142  (
143  const barycentric& coordinates,
144  const tetIndices& tetIs
145  ) const;
146 
147  //- Return an internal field of the average
149 
150  //- Return an internal field of the gradient
152 };
153 
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace AveragingMethods
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #ifdef NoRepository
163  #include "Basic.C"
164 #endif
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #endif
169 
170 // ************************************************************************* //
void add(const barycentric &coordinates, const tetIndices &tetIs, const Type &value)
Member Functions.
Definition: Basic.C:93
dictionary dict
AveragingMethod< Type >::TypeGrad TypeGrad
Gradient type.
Definition: Basic.H:69
Basic(const IOobject &io, const dictionary &dict, const fvMesh &mesh)
Constructors.
Definition: Basic.C:33
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
tmp< Field< Type > > primitiveField() const
Return an internal field of the average.
Definition: Basic.C:128
outerProduct< vector, Type >::type TypeGrad
Protected typedefs.
Type interpolate(const barycentric &coordinates, const tetIndices &tetIs) const
Interpolate.
Definition: Basic.C:105
TypeGrad interpolateGrad(const barycentric &coordinates, const tetIndices &tetIs) const
Interpolate gradient.
Definition: Basic.C:117
Basic lagrangian averaging procedure.
Definition: Basic.H:60
dynamicFvMesh & mesh
Pre-declare SubField and related Field type.
Definition: Field.H:56
virtual autoPtr< AveragingMethod< Type > > clone() const
Construct and return a clone.
Definition: Basic.H:109
Base class for lagrangian averaging methods.
Definition: MPPICParcel.H:55
TypeName("basic")
Runtime type information.
virtual ~Basic()
Destructor.
Definition: Basic.C:60
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
Definition: tetIndices.H:81
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
A class for managing temporary objects.
Definition: PtrList.H:53
tmp< Field< TypeGrad > > internalFieldGrad() const
Return an internal field of the gradient.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
Namespace for OpenFOAM.