gaussFaGrad.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-------------------------------------------------------------------------------
10License
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 "gaussFaGrad.H"
29#include "facGrad.H"
30#include "areaFields.H"
31#include "edgeFields.H"
32
33// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34
35namespace Foam
36{
37
38// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39
40namespace fa
41{
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45template<class Type>
46tmp
47<
48 GeometricField
49 <
50 typename outerProduct<vector, Type>::type, faPatchField, areaMesh
51 >
52>
54(
56) const
57{
58 typedef typename outerProduct<vector, Type>::type GradType;
59
61 (
63 (
64 vsf.mesh().Le()
65 *tinterpScheme_().interpolate(vsf)
66 )
67 );
68
70
72
73 gGrad.rename("grad(" + vsf.name() + ')');
74 correctBoundaryConditions(vsf, gGrad);
75
76 return tgGrad;
77}
78
79
80template<class Type>
82(
85 <
87 >& gGrad
88)
89{
90 forAll(vsf.boundaryField(), patchI)
91 {
92 if (!vsf.boundaryField()[patchI].coupled())
93 {
94 const vectorField m
95 (
96 vsf.mesh().Le().boundaryField()[patchI]/
97 vsf.mesh().magLe().boundaryField()[patchI]
98 );
99
100 gGrad.boundaryFieldRef()[patchI] += m*
101 (
102 vsf.boundaryField()[patchI].snGrad()
103 - (m & gGrad.boundaryField()[patchI])
104 );
105 }
106 }
107}
108
109
110// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111
112} // End namespace fa
113
114// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115
116} // End namespace Foam
117
118// ************************************************************************* //
const Mesh & mesh() const
Return mesh.
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
void correctBoundaryConditions()
Correct boundary field.
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:65
Mesh data needed to do the Finite Area discretisation.
Definition: areaFaMesh.H:56
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: faPatchField.H:82
Computes the gradient of an input field.
Definition: grad.H:157
typeOfRank< typenamepTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank)>::type type
Definition: products.H:114
virtual void rename(const word &newName)
Rename.
Definition: regIOobject.C:417
A class for managing temporary objects.
Definition: tmp.H:65
T & ref() const
Definition: tmpI.H:227
type
Volume classification types.
Definition: volumeType.H:66
Calculate the gradient of the given field.
tmp< GeometricField< Type, faPatchField, areaMesh > > edgeIntegrate(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Namespace for OpenFOAM.
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
Definition: curveTools.C:75
cellMask correctBoundaryConditions()
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333