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 (
47 ) const
48 {
49  const fvMesh& mesh = this->mesh();
50 
51  // construct GeometricField<Type, fvsPatchField, surfaceMesh>
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 (
73 ) const
74 {
75  const fvMesh& mesh = this->mesh();
76 
77  // construct GeometricField<Type, fvsPatchField, surfaceMesh>
79  (
81  (
82  "snGradCorr("+vf.name()+')',
83  mesh,
85  )
86  );
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 // ************************************************************************* //
Foam::surfaceFields.
void replace(const direction, const GeometricField< cmptType, PatchField, GeoMesh > &)
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:52
const word & name() const
Return name.
Definition: IOobject.H:315
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > fullGradCorrection(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the explicit correction to the correctedSnGrad.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
const fvSchemes & schemes() const
Return the fvSchemes.
Definition: fvMesh.C:1672
Centred interpolation interpolation scheme class.
Definition: linear.H:50
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:181
uint8_t direction
Definition: direction.H:45
static tmp< GeometricField< typename innerProduct< vector, Type >::type, fvsPatchField, surfaceMesh > > dotInterpolate(const surfaceVectorField &Sf, const GeometricField< Type, fvPatchField, volMesh > &tvf)
Interpolate field onto faces.
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
Traits class for primitives.
Definition: pTraits.H:50
Generic GeometricField class.
fvMesh & mesh
const surfaceVectorField & nonOrthCorrectionVectors() const
Return reference to non-orthogonality correction vectors.
const surfaceScalarField & nonOrthDeltaCoeffs() const
Return reference to non-orthogonal cell-centre difference.
const dimensionSet & dimensions() const
Return dimensions.
Calculate the gradient of the given field.
virtual ~correctedSnGrad()
Destructor.
Simple central-difference snGrad scheme with non-orthogonal correction.
ITstream & grad(const word &name) const
Definition: fvSchemes.C:430
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
virtual tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > correction(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the explicit correction to the correctedSnGrad.
A class for managing temporary objects.
Definition: PtrList.H:53