facNGrad.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 "facNGrad.H"
29#include "areaFields.H"
30#include "edgeFields.H"
31#include "facEdgeIntegrate.H"
32#include "faMesh.H"
33#include "faGradScheme.H"
34#include "transformField.H"
35
36// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37
38namespace Foam
39{
40
41// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42
43namespace fac
44{
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48template<class Type>
49tmp
50<
51 GeometricField
52 <
53 typename outerProduct<vector, Type>::type, faPatchField, areaMesh
54 >
55>
57(
59)
60{
61 const areaVectorField& n = ssf.mesh().faceAreaNormals();
62 typedef typename outerProduct<vector,Type>::type GradType;
63
65 fac::edgeIntegrate(ssf.mesh().Sf()*ssf);
66
68
69 gGrad = n*(n & gGrad);
71
72 return tgGrad;
73}
74
75
76template<class Type>
77tmp
78<
80 <
82 >
83>
85(
87)
88{
89 typedef typename outerProduct<vector, Type>::type GradType;
91 (
92 fac::ngrad(tssf())
93 );
94 tssf.clear();
95
96 return Grad;
97}
98
99
100template<class Type>
101tmp
102<
104 <
106 >
107>
109(
111 const word& name
112)
113{
114 const areaVectorField& n = vf.mesh().faceAreaNormals();
115 typedef typename outerProduct<vector,Type>::type GradType;
116
119 (
120 vf.mesh(),
121 vf.mesh().gradScheme(name)
122 ).ref().grad(vf);
123
125
126 gGrad = n*(n & gGrad);
128
129 return tgGrad;
130}
131
132
133template<class Type>
134tmp
135<
137 <
139 >
140>
142(
144 const word& name
145)
146{
147 tmp
148 <
150 <
152 >
153 > tGrad
154 (
155 fac::ngrad(tvf(), name)
156 );
157 tvf.clear();
158
159 return tGrad;
160}
161
162
163template<class Type>
164tmp
165<
167 <
169 >
170>
172(
174)
175{
176 return fac::ngrad(vf, "grad(" + vf.name() + ')');
177}
178
179
180template<class Type>
181tmp
182<
184 <
186 >
187>
189(
191)
192{
193 typedef typename outerProduct<vector, Type>::type GradType;
195 (
196 fac::ngrad(tvf())
197 );
198 tvf.clear();
199
200 return Grad;
201}
202
203
204// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205
206} // End namespace fac
207
208// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209
210} // End namespace Foam
211
212// ************************************************************************* //
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 normal to the surface of the given field.
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > > ngrad(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facNGrad.C:57
tmp< GeometricField< Type, faPatchField, areaMesh > > edgeIntegrate(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
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.
Spatial transformation functions for primitive fields.