correctedSnGrad.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 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 \*---------------------------------------------------------------------------*/
25 
26 #include "correctedSnGrad.H"
27 #include "volFields.H"
28 #include "surfaceFields.H"
29 #include "linear.H"
30 #include "fvcGrad.H"
31 #include "gaussGrad.H"
32 
33 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
34 
35 template<class Type>
37 {}
38 
39 
40 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
41 
42 template<class Type>
45 (
46  const VolField<Type>& vf
47 ) const
48 {
49  const fvMesh& mesh = this->mesh();
50 
51  // construct SurfaceField<Type>
54  (
57  (
58  mesh,
59  mesh.schemes().grad("grad(" + vf.name() + ')')
60  )().grad(vf, "grad(" + vf.name() + ')')
61  );
62  tssf.ref().rename("snGradCorr(" + vf.name() + ')');
63 
64  return tssf;
65 }
66 
67 
68 template<class Type>
71 (
72  const VolField<Type>& vf
73 ) const
74 {
75  const fvMesh& mesh = this->mesh();
76 
77  // construct SurfaceField<Type>
79  (
81  (
82  "snGradCorr("+vf.name()+')',
83  mesh,
85  )
86  );
87  SurfaceField<Type>& ssf = tssf.ref();
88 
89  for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
90  {
91  ssf.replace
92  (
93  cmpt,
95  .fullGradCorrection(vf.component(cmpt))
96  );
97  }
98 
99  return tssf;
100 }
101 
102 
103 // ************************************************************************* //
const dimensionSet & dimensions() const
Return dimensions.
Generic GeometricField class.
void replace(const direction, const GeometricField< cmptType, PatchField, GeoMesh > &)
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
const word & name() const
Return name.
Definition: IOobject.H:310
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
const fvSchemes & schemes() const
Return the fvSchemes.
Definition: fvMesh.C:1751
ITstream & grad(const word &name) const
Definition: fvSchemes.C:485
Simple central-difference snGrad scheme with non-orthogonal correction.
tmp< SurfaceField< Type > > fullGradCorrection(const VolField< Type > &) const
Return the explicit correction to the correctedSnGrad.
virtual ~correctedSnGrad()
Destructor.
virtual tmp< SurfaceField< Type > > correction(const VolField< Type > &) const
Return the explicit correction to the correctedSnGrad.
Centred interpolation interpolation scheme class.
Definition: linear.H:53
Traits class for primitives.
Definition: pTraits.H:53
const surfaceVectorField & nonOrthCorrectionVectors() const
Return reference to non-orthogonality correction vectors.
const surfaceScalarField & nonOrthDeltaCoeffs() const
Return reference to non-orthogonal cell-centre difference.
A class for managing temporary objects.
Definition: tmp.H:55
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:181
Calculate the gradient of the given field.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
static tmp< SurfaceField< typename innerProduct< vector, Type >::type > > dotInterpolate(const surfaceVectorField &Sf, const VolField< Type > &tvf)
Interpolate field onto faces.
tmp< VolField< typename outerProduct< vector, Type >::type > > grad(const SurfaceField< Type > &ssf)
Definition: fvcGrad.C:46
uint8_t direction
Definition: direction.H:45
Foam::surfaceFields.