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"
32 #include "gaussFaGrad.H"
33 
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 namespace fa
42 {
43 
44 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
45 
46 template<class Type>
48 {}
49 
50 
51 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
52 
53 template<class Type>
56 (
58 ) const
59 {
60  const faMesh& mesh = this->mesh();
61 
63  (
65  (
66  IOobject
67  (
68  "lnGradCorr("+vf.name()+')',
69  vf.instance(),
70  vf.db()
71  ),
72  mesh,
73  vf.dimensions()*this->mesh().deltaCoeffs().dimensions()
74  )
75  );
77 
78  edgeVectorField m(mesh.Le()/mesh.magLe());
79 
80  for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; ++cmpt)
81  {
82  corr.replace
83  (
84  cmpt,
85  - (1.0/15.0)*m
87  <
88  typename
90  >(mesh).interpolate
91  (
93  .grad(vf.component(cmpt))
94  )
95  );
96  }
97 
98  corr += (1.0/15.0)*correctedLnGrad<Type>(mesh).lnGrad(vf);
99 
100 
101 // tmp<GeometricField<Type, faePatchField, edgeMesh>> tcorr
102 // (
103 // (1.0/15.0)
104 // *(
105 // correctedLnGrad<Type>(mesh).lnGrad(vf)
106 // - (
107 // linearEdgeInterpolate(gaussGrad<Type>(mesh).grad(vf))
108 // & mesh.Le()
109 // )/mesh.magLe()
110 // )
111 // );
112 
113  if (correctedLnGrad<Type>(mesh).corrected())
114  {
115  tcorr.ref() += correctedLnGrad<Type>(mesh).correction(vf);
116  }
117 
118  return tcorr;
119 }
120 
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 } // End namespace fa
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 } // End namespace Foam
129 
130 // ************************************************************************* //
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:133
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
uint8_t direction
Definition: direction.H:46
virtual tmp< GeometricField< Type, faePatchField, edgeMesh > > correction(const GeometricField< Type, faPatchField, areaMesh > &) const
Return the explicit correction to the fourthLnGrad.
Definition: fourthLnGrad.C:49
Basic second-order gradient scheme using face-interpolation and Gauss&#39; theorem.
Definition: gaussFaGrad.H:57
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:195
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
Definition: curveTools.C:75
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
Definition: tmpI.H:235
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
A traits class, which is primarily used for primitives and vector-space.
Definition: pTraits.H:75
Simple central-difference lnGrad scheme with non-orthogonal correction.
Generic GeometricField class.
::Foam::direction nComponents(const expressions::valueTypeCode) noexcept
The number of components associated with given valueTypeCode.
Definition: exprTraits.C:40
virtual ~fourthLnGrad()
Destructor.
Definition: fourthLnGrad.C:40
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:799
dynamicFvMesh & mesh
const objectRegistry & db() const noexcept
Return the local objectRegistry.
Definition: IOobject.C:450
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
tmp< GeometricField< Type, faePatchField, edgeMesh > > lnGrad(const GeometricField< Type, faPatchField, areaMesh > &vf, const word &name)
Definition: facLnGrad.C:40
const fileName & instance() const noexcept
Read access to instance path component.
Definition: IOobjectI.H:266
Central-differencing interpolation scheme class.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:180
Namespace for OpenFOAM.
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh >> grad(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facGrad.C:51
const dimensionSet & dimensions() const noexcept
Return dimensions.
void replace(const direction d, const GeometricField< cmptType, PatchField, GeoMesh > &gcf)
Replace specified field component with content from another field.