skewCorrectedEdgeInterpolation.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) 2016-2017 Wikki Ltd
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::skewCorrectedEdgeInterpolation
29 
30 Description
31  Linear/upwind blended differencing scheme
32 
33 SourceFiles
34  skewCorrectedEdgeInterpolationMake.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef skewCorrectedEdgeInterpolation_H
39 #define skewCorrectedEdgeInterpolation_H
40 
42 #include "gaussFaGrad.H"
43 #include "areaFields.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class skewCorrectedEdgeInterpolation Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 template<class Type>
56 :
57  virtual public edgeInterpolationScheme<Type>
58 {
59  // Private Data
60 
61  //- Edge-interpolation scheme
63 
64 
65 public:
66 
67  //- Runtime type information
68  TypeName("skewCorrected");
69 
70 
71  // Generated Methods
72 
73  //- No copy construct
75  = delete;
76 
77  //- No copy assignment
78  void operator=(const skewCorrectedEdgeInterpolation&) = delete;
79 
80 
81  // Constructors
82 
83  //- Construct from Istream
85  :
87  tScheme_
88  (
90  )
91  {}
92 
93  //- Construct from mesh, faceFlux and blendingFactor
95  (
96  const faMesh& mesh,
97  const edgeScalarField& faceFlux,
98  Istream& is
99  )
100  :
102  tScheme_
103  (
104  edgeInterpolationScheme<Type>::New(mesh, faceFlux, is)
105  )
106  {}
107 
108 
109  // Member Functions
110 
111  //- Return the interpolation weighting factors
113  (
115  ) const
116  {
117  return tScheme_().weights(vf);
118  }
119 
120  //- Return true if this scheme uses an explicit correction
121  virtual bool corrected() const
122  {
123  return
124  tScheme_().corrected() || (this->mesh()).skew();
125  }
126 
129  (
131  ) const
132  {
133  const faMesh& mesh = this->mesh();
134 
136 
138  (
140  (
141  IOobject
142  (
143  "skewCorrected::skewCorrection(" + vf.name() + ')',
144  vf.instance(),
145  vf.db()
146  ),
147  mesh,
149  )
150  );
151 
153 
154  for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; ++cmpt)
155  {
156  corr.replace
157  (
158  cmpt,
160  <
161  typename outerProduct
162  <
163  vector,
164  typename pTraits<Type>::cmptType
165  >::type
166  >(mesh).interpolate
167  (
169  (mesh).grad(vf.component(cmpt))
170  )
171  );
172  }
173 
174  return tsfCorr;
175  }
176 
177 
178  //- Return the explicit correction to the face-interpolate
179  virtual tmp<GeometricField<Type, faePatchField, edgeMesh>>
180  correction
181  (
182  const GeometricField<Type, faPatchField, areaMesh>& vf
183  ) const
184  {
185  if
186  (
187  tScheme_().corrected()
188  && (this->mesh()).skew()
189  )
190  {
191  return tScheme_().correction(vf) + skewCorrection(vf);
192  }
193  else if (tScheme_().corrected())
194  {
195  return tScheme_().correction(vf);
196  }
197  else if ((this->mesh()).skew())
198  {
199  return skewCorrection(vf);
200  }
201  else
202  {
203  return
204  tmp<GeometricField<Type, faePatchField, edgeMesh>>
205  (
206  nullptr
207  );
208  }
209  }
210 };
211 
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace Foam
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #endif
220 
221 // ************************************************************************* //
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:133
const edgeVectorField & skewCorrectionVectors() const
Return reference to skew vectors array.
void operator=(const skewCorrectedEdgeInterpolation &)=delete
No copy assignment.
virtual bool corrected() const
Return true if this scheme uses an explicit correction.
uint8_t direction
Definition: direction.H:46
Basic second-order gradient scheme using face-interpolation and Gauss&#39; theorem.
Definition: gaussFaGrad.H:57
dimensionedTensor skew(const dimensionedTensor &dt)
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:195
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Abstract base class for edge interpolation schemes.
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
A traits class, which is primarily used for primitives and vector-space.
Definition: pTraits.H:75
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
Definition: exprTraits.C:40
Generic dimensioned Type class.
Linear/upwind blended differencing scheme.
static tmp< edgeInterpolationScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:799
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition: IOobject.C:450
virtual tmp< GeometricField< Type, faePatchField, edgeMesh > > correction(const GeometricField< Type, faPatchField, areaMesh > &vf) const
Return the explicit correction to the face-interpolate.
skewCorrectedEdgeInterpolation(const skewCorrectedEdgeInterpolation &)=delete
No copy construct.
tmp< GeometricField< Type, faePatchField, edgeMesh > > skewCorrection(const GeometricField< Type, faPatchField, areaMesh > &vf) const
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
const fileName & instance() const noexcept
Read access to instance path component.
Definition: IOobjectI.H:266
virtual tmp< edgeScalarField > weights(const GeometricField< Type, faPatchField, areaMesh > &vf) const
Return the interpolation weighting factors.
static tmp< GeometricField< Type, faePatchField, edgeMesh > > interpolate(const GeometricField< Type, faPatchField, areaMesh > &, const tmp< edgeScalarField > &, const tmp< edgeScalarField > &)
Return the face-interpolate of the given cell field.
Central-differencing interpolation scheme class.
const faMesh & mesh() const
Return mesh reference.
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef()
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:180
TypeName("skewCorrected")
Runtime type information.
Namespace for OpenFOAM.
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh >> grad(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facGrad.C:51
const dimensionSet & dimensions() const noexcept
Return dimensions.
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127