Basic.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) 2013-2015 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
79 
80  //- Gradient field
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 point position,
129  const tetIndices& tetIs,
130  const Type& value
131  );
132 
133  //- Interpolate
134  Type interpolate
135  (
136  const point position,
137  const tetIndices& tetIs
138  ) const;
139 
140  //- Interpolate gradient
142  (
143  const point position,
144  const tetIndices& tetIs
145  ) const;
146 
147  //- Return an internal field of the average
148  tmp<Field<Type> > internalField() const;
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 // ************************************************************************* //
Foam::AveragingMethods::Basic::interpolate
Type interpolate(const point position, const tetIndices &tetIs) const
Interpolate.
Definition: Basic.C:104
Foam::AveragingMethod
Base class for lagrangian averaging methods.
Definition: MPPICParcel.H:55
Foam::AveragingMethods::Basic::internalFieldGrad
tmp< Field< TypeGrad > > internalFieldGrad() const
Return an internal field of the gradient.
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::AveragingMethods::Basic::Basic
Basic(const IOobject &io, const dictionary &dict, const fvMesh &mesh)
Constructors.
Definition: Basic.C:32
AveragingMethod.H
Foam::Field< Type >
Foam::AveragingMethods::Basic::add
void add(const point position, const tetIndices &tetIs, const Type &value)
Member Functions.
Definition: Basic.C:92
Foam::AveragingMethods::Basic::dataGrad_
Field< TypeGrad > dataGrad_
Gradient field.
Definition: Basic.H:80
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::AveragingMethods::Basic::internalField
tmp< Field< Type > > internalField() const
Return an internal field of the average.
Definition: Basic.C:127
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::AveragingMethods::Basic::~Basic
virtual ~Basic()
Destructor.
Definition: Basic.C:59
Foam::tetIndices
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
Definition: tetIndices.H:73
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::AveragingMethods::Basic::data_
Field< Type > & data_
Private data.
Definition: Basic.H:77
Basic.C
Foam::Vector< scalar >
Foam::AveragingMethods::Basic
Basic lagrangian averaging procedure.
Definition: Basic.H:60
Foam::AveragingMethods::Basic::TypeName
TypeName("basic")
Runtime type information.
Foam::AveragingMethods::Basic::updateGrad
virtual void updateGrad()
Private member functions.
Definition: Basic.C:66
Foam::AveragingMethods::Basic::interpolateGrad
TypeGrad interpolateGrad(const point position, const tetIndices &tetIs) const
Interpolate gradient.
Definition: Basic.C:116
Foam::AveragingMethods::Basic::clone
virtual autoPtr< AveragingMethod< Type > > clone() const
Construct and return a clone.
Definition: Basic.H:109
Foam::AveragingMethods::Basic::TypeGrad
AveragingMethod< Type >::TypeGrad TypeGrad
Public typedefs.
Definition: Basic.H:69
tetIndices.H
pointMesh.H