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 
43 #include "gaussFaGrad.H"
44 #include "areaFields.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class skewCorrectedEdgeInterpolation Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 template<class Type>
58 :
59  virtual public edgeInterpolationScheme<Type>
60 {
61  // Private Data
62 
64 
65 
66 public:
67 
68  //- Runtime type information
69  TypeName("skewCorrected");
70 
71 
72  // Constructors
73 
74  //- Construct from Istream
76  :
78  tScheme_
79  (
80  edgeInterpolationScheme<Type>::New(mesh, is)
81  )
82  {}
83 
84  //- Construct from mesh, faceFlux and blendingFactor
86  (
87  const faMesh& mesh,
88  const edgeScalarField& faceFlux,
89  Istream& is
90  )
91  :
93  tScheme_
94  (
95  edgeInterpolationScheme<Type>::New(mesh, faceFlux, is)
96  )
97  {}
98 
99  //- No copy construct
101  delete;
102 
103  //- No copy assignment
104  void operator=(const skewCorrectedEdgeInterpolation&) = delete;
105 
106 
107  // Member Functions
108 
109  //- Return the interpolation weighting factors
111  (
113  ) const
114  {
115  return tScheme_().weights(vf);
116  }
117 
118  //- Return true if this scheme uses an explicit correction
119  virtual bool corrected() const
120  {
121  return
122  tScheme_().corrected() || (this->mesh()).skew();
123  }
124 
127  (
129  ) const
130  {
131  const faMesh& mesh = this->mesh();
132 
134 
136  (
138  (
139  IOobject
140  (
141  "skewCorrected::skewCorrection(" + vf.name() + ')',
142  vf.instance(),
143  vf.db()
144  ),
145  mesh,
146  dimensioned<Type>(vf.dimensions(), Zero)
147  )
148  );
149 
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
179  (
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
203  (
204  nullptr
205  );
206  }
207  }
208 };
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #endif
218 
219 // ************************************************************************* //
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::skewCorrectedEdgeInterpolation::correction
virtual tmp< GeometricField< Type, faePatchField, edgeMesh > > correction(const GeometricField< Type, faPatchField, areaMesh > &vf) const
Return the explicit correction to the face-interpolate.
Definition: skewCorrectedEdgeInterpolation.H:178
Foam::GeometricField::component
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
edgeInterpolationScheme.H
Foam::edgeInterpolationScheme
Abstract base class for edge interpolation schemes.
Definition: edgeInterpolationScheme.H:57
Foam::fa::gaussGrad
Basic second-order gradient scheme using face-interpolation and Gauss' theorem.
Definition: gaussFaGrad.H:60
gaussFaGrad.H
Foam::skew
dimensionedTensor skew(const dimensionedTensor &dt)
Definition: dimensionedTensor.C:138
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::edgeInterpolationScheme::mesh
const faMesh & mesh() const
Return mesh reference.
Definition: edgeInterpolationScheme.H:138
Foam::fac::grad
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh >> grad(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facGrad.C:56
Foam::edgeInterpolation::skewCorrectionVectors
const edgeVectorField & skewCorrectionVectors() const
Return reference to skew vectors array.
Definition: edgeInterpolation.C:148
Foam::skewCorrectedEdgeInterpolation::weights
virtual tmp< edgeScalarField > weights(const GeometricField< Type, faPatchField, areaMesh > &vf) const
Return the interpolation weighting factors.
Definition: skewCorrectedEdgeInterpolation.H:110
Foam::skewCorrectedEdgeInterpolation
Linear/upwind blended differencing scheme.
Definition: skewCorrectedEdgeInterpolation.H:56
Foam::skewCorrectedEdgeInterpolation::TypeName
TypeName("skewCorrected")
Runtime type information.
Foam::skewCorrectedEdgeInterpolation::corrected
virtual bool corrected() const
Return true if this scheme uses an explicit correction.
Definition: skewCorrectedEdgeInterpolation.H:118
Foam::skewCorrectedEdgeInterpolation::skewCorrection
tmp< GeometricField< Type, faePatchField, edgeMesh > > skewCorrection(const GeometricField< Type, faPatchField, areaMesh > &vf) const
Definition: skewCorrectedEdgeInterpolation.H:126
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
areaFields.H
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:42
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
zeroGradientFaPatchFields.H
Foam::edgeInterpolationScheme::interpolate
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.
Definition: edgeInterpolationScheme.C:138
linearEdgeInterpolation.H
Foam::GeometricField::ref
Internal & ref(const bool updateAccessTime=true)
Return a reference to the dimensioned internal field.
Definition: GeometricField.C:749
Foam::Vector< scalar >
Foam::pTraits
A traits class, which is primarily used for primitives.
Definition: pTraits.H:56
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::linearEdgeInterpolation
Central-differencing interpolation scheme class.
Definition: linearEdgeInterpolation.H:52
Foam::direction
uint8_t direction
Definition: direction.H:52
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:82
Foam::GeometricField< scalar, faePatchField, edgeMesh >
Foam::skewCorrectedEdgeInterpolation::skewCorrectedEdgeInterpolation
skewCorrectedEdgeInterpolation(const faMesh &mesh, Istream &is)
Construct from Istream.
Definition: skewCorrectedEdgeInterpolation.H:74
Foam::edgeInterpolationScheme::New
static tmp< edgeInterpolationScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
Definition: edgeInterpolationScheme.C:41
Foam::outerProduct
Definition: products.H:106
Foam::skewCorrectedEdgeInterpolation::operator=
void operator=(const skewCorrectedEdgeInterpolation &)=delete
No copy assignment.