facGrad.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 "facGrad.H"
29#include "areaFields.H"
30#include "edgeFields.H"
31#include "facEdgeIntegrate.H"
32#include "faMesh.H"
33#include "faGradScheme.H"
34
35// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36
37namespace Foam
38{
39
40// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41
42namespace fac
43{
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47template<class Type>
48tmp
49<
50 GeometricField
51 <
52 typename outerProduct<vector, Type>::type, faPatchField, areaMesh
53 >
54>
56(
58)
59{
60 const areaVectorField &n = ssf.mesh().faceAreaNormals();
61 typedef typename outerProduct<vector,Type>::type GradType;
62
64 fac::edgeIntegrate(ssf.mesh().Sf()*ssf);
65
67
68 gGrad -= n*(n & gGrad);
70
71 return tgGrad;
72}
73
74template<class Type>
75tmp
76<
78 <
80 >
81>
83(
85)
86{
87 typedef typename outerProduct<vector, Type>::type GradType;
89 (
90 fac::grad(tssf())
91 );
92 tssf.clear();
93 return Grad;
94}
95
96
97template<class Type>
98tmp
99<
101 <
103 >
104>
106(
108 const word& name
109)
110{
111 const areaVectorField &n = vf.mesh().faceAreaNormals();
112 typedef typename outerProduct<vector,Type>::type GradType;
113
116 (
117 vf.mesh(),
118 vf.mesh().gradScheme(name)
119 ).ref().grad(vf);
120
122
123 gGrad -= n*(n & gGrad);
125
126 return tgGrad;
127}
128
129
130template<class Type>
131tmp
132<
134 <
136 >
137>
139(
141 const word& name
142)
143{
144 tmp
145 <
147 <
149 >
150 > tGrad
151 (
152 fac::grad(tvf(), name)
153 );
154 tvf.clear();
155 return tGrad;
156}
157
158
159template<class Type>
160tmp
161<
163 <
165 >
166>
168(
170)
171{
172 return fac::grad(vf, "grad(" + vf.name() + ')');
173}
174
175
176template<class Type>
177tmp
178<
180 <
182 >
183>
185(
187)
188{
189 typedef typename outerProduct<vector, Type>::type GradType;
191 (
192 fac::grad(tvf())
193 );
194 tvf.clear();
195 return Grad;
196}
197
198
199// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200
201} // End namespace fac
202
203// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204
205} // End namespace Foam
206
207// ************************************************************************* //
label n
const Mesh & mesh() const
Return mesh.
Generic GeometricField class.
void correctBoundaryConditions()
Correct boundary field.
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:65
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
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
typeOfRank< typenamepTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank)>::type type
Definition: products.H:114
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
A class for handling words, derived from Foam::string.
Definition: word.H:68
Edge integrate edgeField creating a areaField. Edge sum a edgeField creating a areaField.
Calculate the gradient of the given field.
tmp< GeometricField< Type, faPatchField, areaMesh > > edgeIntegrate(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > > grad(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facGrad.C:56
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Calculate the second temporal derivative.