Basic.C
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 \*---------------------------------------------------------------------------*/
27 
28 #include "Basic.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 template<class Type>
35 (
36  const IOobject& io,
37  const dictionary& dict,
38  const fvMesh& mesh
39 )
40 :
41  AveragingMethod<Type>(io, dict, mesh, labelList(1, mesh.nCells())),
43  dataGrad_(mesh.nCells())
44 {}
45 
46 
47 template<class Type>
49 (
50  const Basic<Type>& am
51 )
52 :
55  dataGrad_(am.dataGrad_)
56 {}
57 
58 
59 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
60 
61 template<class Type>
63 {}
64 
65 
66 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
67 
68 template<class Type>
70 {
72  (
73  IOobject
74  (
75  "BasicAverage::Data",
76  this->mesh_,
77  IOobject::NO_READ,
78  IOobject::NO_WRITE,
79  false
80  ),
81  this->mesh_,
84  );
85  tempData.primitiveFieldRef() = data_;
86  tempData.correctBoundaryConditions();
87  dataGrad_ = fvc::grad(tempData)->primitiveField();
88 }
89 
90 
91 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
92 
93 template<class Type>
95 (
96  const barycentric& coordinates,
97  const tetIndices& tetIs,
98  const Type& value
99 )
100 {
101  data_[tetIs.cell()] += value/this->mesh_.V()[tetIs.cell()];
102 }
103 
104 
105 template<class Type>
107 (
108  const barycentric& coordinates,
109  const tetIndices& tetIs
110 ) const
111 {
112  return data_[tetIs.cell()];
113 }
114 
115 
116 template<class Type>
119 (
120  const barycentric& coordinates,
121  const tetIndices& tetIs
122 ) const
123 {
124  return dataGrad_[tetIs.cell()];
125 }
126 
127 
128 template<class Type>
131 {
132  return tmp<Field<Type>>(data_);
133 }
134 
135 
136 // ************************************************************************* //
Foam::AveragingMethod
Base class for lagrangian averaging methods.
Definition: KinematicParcel.H:69
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::FieldField
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:53
Foam::tetIndices::cell
label cell() const
Return the cell.
Definition: tetIndicesI.H:31
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::AveragingMethods::Basic::Basic
Basic(const IOobject &io, const dictionary &dict, const fvMesh &mesh)
Constructors.
Definition: Basic.C:35
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::fac::grad
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh >> grad(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facGrad.C:56
zeroGradientFvPatchField.H
Foam::zeroGradientFvPatchField
This boundary condition applies a zero-gradient condition from the patch internal field onto the patc...
Definition: zeroGradientFvPatchField.H:64
Foam::AveragingMethods::Basic::add
void add(const barycentric &coordinates, const tetIndices &tetIs, const Type &value)
Member Functions.
Definition: Basic.C:95
coordinates
PtrList< coordinateSystem > coordinates(solidRegions.size())
Foam::AveragingMethods::Basic::primitiveField
tmp< Field< Type > > primitiveField() const
Return an internal field of the average.
Definition: Basic.C:130
Foam::Barycentric< scalar >
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::AveragingMethods::Basic::interpolateGrad
TypeGrad interpolateGrad(const barycentric &coordinates, const tetIndices &tetIs) const
Interpolate gradient.
Definition: Basic.C:119
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:42
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Basic.H
Foam::AveragingMethods::Basic::~Basic
virtual ~Basic()
Destructor.
Definition: Basic.C:62
Foam::tetIndices
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
Definition: tetIndices.H:83
Foam::AveragingMethods::Basic::interpolate
Type interpolate(const barycentric &coordinates, const tetIndices &tetIs) const
Interpolate.
Definition: Basic.C:107
Foam::AveragingMethods::Basic
Basic lagrangian averaging procedure.
Definition: Basic.H:65
Foam::AveragingMethods::Basic::TypeGrad
AveragingMethod< Type >::TypeGrad TypeGrad
Public typedefs.
Definition: Basic.H:74
Foam::GeometricField< Type, fvPatchField, volMesh >
Foam::dimless
const dimensionSet dimless
Dimensionless.
Definition: dimensionSets.C:189