Loading...
Searching...
No Matches
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>
50<
52 <
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>
91 (
92 fac::ngrad(tssf())
93 );
94 tssf.clear();
95
96 return Grad;
97}
98
99
100template<class Type>
102<
104 <
106 >
107>
108ngrad
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>
135<
137 <
139 >
140>
141ngrad
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>
171ngrad
172(
174)
175{
176 return fac::ngrad(vf, "grad(" + vf.name() + ')');
177}
178
179
180template<class Type>
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 noexcept
Return const reference to mesh.
Generic GeometricField class.
void correctBoundaryConditions()
Correct boundary field.
const word & name() const noexcept
Return the object name.
Definition IOobjectI.H:205
Mesh data needed to do the Finite Area discretisation.
Definition areaFaMesh.H:50
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
static tmp< gradScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return a pointer to a new gradScheme created on freestore.
typeOfRank< typenamepTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank)>::type type
Definition products.H:118
A class for managing temporary objects.
Definition tmp.H:75
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
Definition tmpI.H:235
A class for handling words, derived from Foam::string.
Definition word.H:66
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:50
tmp< GeometricField< Type, faPatchField, areaMesh > > edgeIntegrate(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Namespace for OpenFOAM.
GeometricField< vector, faPatchField, areaMesh > areaVectorField
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
Spatial transformation functions for primitive fields.