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 Foam_skewCorrectedEdgeInterpolation_H
39 #define Foam_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 
137  auto tsfCorr =
139  (
141  (
142  "skewCorrected::skewCorrection(" + vf.name() + ')',
143  vf.instance(),
144  vf.db()
145  ),
146  mesh,
148  );
149  auto& corr = tsfCorr.ref();
150  corr.setOriented();
151 
152  for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; ++cmpt)
153  {
154  corr.replace
155  (
156  cmpt,
158  <
159  typename outerProduct
160  <
161  vector,
162  typename pTraits<Type>::cmptType
163  >::type
164  >(mesh).interpolate
165  (
167  (mesh).grad(vf.component(cmpt))
168  )
169  );
170  }
171 
172  return tsfCorr;
173  }
174 
175 
176  //- Return the explicit correction to the face-interpolate
177  virtual tmp<GeometricField<Type, faePatchField, edgeMesh>>
178  correction
179  (
180  const GeometricField<Type, faPatchField, areaMesh>& vf
181  ) const
182  {
183  if
184  (
185  tScheme_().corrected()
186  && (this->mesh()).skew()
187  )
188  {
189  return tScheme_().correction(vf) + skewCorrection(vf);
190  }
191  else if (tScheme_().corrected())
192  {
193  return tScheme_().correction(vf);
194  }
195  else if ((this->mesh()).skew())
196  {
197  return skewCorrection(vf);
198  }
199  else
200  {
201  return nullptr;
202  }
203  }
204 };
205 
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 } // End namespace Foam
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #endif
214 
215 // ************************************************************************* //
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:205
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:63
::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:805
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 dimensionSet & dimensions() const noexcept
Return dimensions.
const fileName & instance() const noexcept
Read access to instance path component.
Definition: IOobjectI.H:289
virtual tmp< edgeScalarField > weights(const GeometricField< Type, faPatchField, areaMesh > &vf) const
Return the interpolation weighting factors.
Central-differencing interpolation scheme class.
const faMesh & mesh() const
Return mesh reference.
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:188
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
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127