fourthLnGrad.C
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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "fourthLnGrad.H"
29 #include "areaFields.H"
30 #include "edgeFields.H"
31 #include "correctedLnGrad.H"
33 #include "gaussFaGrad.H"
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
37 namespace Foam
38 {
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace fa
43 {
44 
45 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
46 
47 template<class Type>
49 {}
50 
51 
52 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
53 
54 template<class Type>
57 (
59 ) const
60 {
61  const faMesh& mesh = this->mesh();
62 
64  (
66  (
67  IOobject
68  (
69  "lnGradCorr("+vf.name()+')',
70  vf.instance(),
71  vf.db()
72  ),
73  mesh,
74  vf.dimensions()*this->mesh().deltaCoeffs().dimensions()
75  )
76  );
78 
79  edgeVectorField m(mesh.Le()/mesh.magLe());
80 
81  for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; ++cmpt)
82  {
83  corr.replace
84  (
85  cmpt,
86  - (1.0/15.0)*m
88  <
89  typename
91  >(mesh).interpolate
92  (
94  .grad(vf.component(cmpt))
95  )
96  );
97  }
98 
99  corr += (1.0/15.0)*correctedLnGrad<Type>(mesh).lnGrad(vf);
100 
101 
102 // tmp<GeometricField<Type, faePatchField, edgeMesh>> tcorr
103 // (
104 // (1.0/15.0)
105 // *(
106 // correctedLnGrad<Type>(mesh).lnGrad(vf)
107 // - (
108 // linearEdgeInterpolate(gaussGrad<Type>(mesh).grad(vf))
109 // & mesh.Le()
110 // )/mesh.magLe()
111 // )
112 // );
113 
114  if (correctedLnGrad<Type>(mesh).corrected())
115  {
116  tcorr.ref() += correctedLnGrad<Type>(mesh).correction(vf);
117  }
118 
119  return tcorr;
120 }
121 
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 } // End namespace fa
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 } // End namespace Foam
130 
131 // ************************************************************************* //
Foam::fa::lnGradScheme::lnGrad
static tmp< GeometricField< Type, faePatchField, edgeMesh > > lnGrad(const GeometricField< Type, faPatchField, areaMesh > &, const tmp< edgeScalarField > &, const word &snGradName="lnGrad")
Return the lnGrad of the given cell field.
Definition: lnGradScheme.C:101
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::GeometricField::component
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
Foam::fa::gaussGrad
Basic second-order gradient scheme using face-interpolation and Gauss' theorem.
Definition: gaussFaGrad.H:60
Foam::GeometricField::replace
void replace(const direction d, const GeometricField< cmptType, PatchField, GeoMesh > &gcf)
Replace specified field component with content from another field.
gaussFaGrad.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
fourthLnGrad.H
Foam::fac::grad
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh >> grad(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facGrad.C:56
Foam::tmp::ref
T & ref() const
Definition: tmpI.H:227
Foam::interpolate
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
Definition: curveTools.C:75
edgeFields.H
areaFields.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fa::fourthLnGrad::correction
virtual tmp< GeometricField< Type, faePatchField, edgeMesh > > correction(const GeometricField< Type, faPatchField, areaMesh > &) const
Return the explicit correction to the fourthLnGrad.
Definition: fourthLnGrad.C:57
Foam::fa::fourthLnGrad::~fourthLnGrad
virtual ~fourthLnGrad()
Destructor.
Definition: fourthLnGrad.C:48
Foam::fa::correctedLnGrad
Simple central-difference lnGrad scheme with non-orthogonal correction.
Definition: correctedLnGrad.H:56
Foam::fa::correctedLnGrad::correction
virtual tmp< GeometricField< Type, faePatchField, edgeMesh > > correction(const GeometricField< Type, faPatchField, areaMesh > &) const
Return the explicit correction to the correctedLnGrad.
Definition: correctedLnGrad.C:56
linearEdgeInterpolation.H
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
correctedLnGrad.H
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
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
Foam::outerProduct
Definition: products.H:106