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-2018 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.gradScheme("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  IOobject
83  (
84  "snGradCorr("+vf.name()+')',
85  vf.instance(),
86  mesh,
87  IOobject::NO_READ,
88  IOobject::NO_WRITE
89  ),
90  mesh,
92  )
93  );
95 
96  for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
97  {
98  ssf.replace
99  (
100  cmpt,
102  .fullGradCorrection(vf.component(cmpt))
103  );
104  }
105 
106  return tssf;
107 }
108 
109 
110 // ************************************************************************* //
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:297
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > fullGradCorrection(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the explicit correction to the correctedSnGrad.
Central-differencing interpolation scheme class.
Definition: linear.H:50
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:174
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.
const surfaceVectorField & nonOrthCorrectionVectors() const
Return reference to non-orthogonality correction vectors.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
const surfaceScalarField & nonOrthDeltaCoeffs() const
Return reference to non-orthogonal cell-centre difference.
const dimensionSet & dimensions() const
Return dimensions.
dynamicFvMesh & mesh
Calculate the gradient of the given field.
virtual ~correctedSnGrad()
Destructor.
Simple central-difference snGrad scheme with non-orthogonal correction.
ITstream & gradScheme(const word &name) const
Definition: fvSchemes.C:440
const fileName & instance() const
Definition: IOobject.H:392
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
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
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92