fvcGrad.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) 2011-2016 OpenFOAM Foundation
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 "fvcGrad.H"
29 #include "fvcSurfaceIntegrate.H"
30 #include "fvMesh.H"
31 #include "gaussGrad.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace fvc
41 {
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 template<class Type>
46 tmp
47 <
48  GeometricField
49  <
50  typename outerProduct<vector, Type>::type, fvPatchField, volMesh
51  >
52 >
53 grad
54 (
56 )
57 {
58  return fv::gaussGrad<Type>::gradf(ssf, "grad(" + ssf.name() + ')');
59 }
60 
61 
62 template<class Type>
63 tmp
64 <
66  <
68  >
69 >
70 grad
71 (
73 )
74 {
75  typedef typename outerProduct<vector, Type>::type GradType;
77  (
78  fvc::grad(tssf())
79  );
80  tssf.clear();
81  return Grad;
82 }
83 
84 
85 template<class Type>
86 tmp
87 <
89  <
91  >
92 >
93 grad
94 (
96  const word& name
97 )
98 {
100  (
101  vf.mesh(),
102  vf.mesh().gradScheme(name)
103  )().grad(vf, name);
104 }
105 
106 
107 template<class Type>
108 tmp
109 <
111  <
113  >
114 >
115 grad
116 (
118  const word& name
119 )
120 {
121  tmp
122  <
124  <
126  >
127  > tGrad
128  (
129  fvc::grad(tvf(), name)
130  );
131  tvf.clear();
132  return tGrad;
133 }
134 
135 
136 template<class Type>
137 tmp
138 <
140  <
142  >
143 >
144 grad
145 (
147 )
148 {
149  return fvc::grad(vf, "grad(" + vf.name() + ')');
150 }
151 
152 
153 template<class Type>
154 tmp
155 <
157  <
159  >
160 >
161 grad
162 (
164 )
165 {
166  typedef typename outerProduct<vector, Type>::type GradType;
168  (
169  fvc::grad(tvf())
170  );
171  tvf.clear();
172  return Grad;
173 }
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace fvc
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 } // End namespace Foam
183 
184 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:51
Foam::fvc::grad
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:54
Foam::fv::gaussGrad::gradf
static tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > gradf(const GeometricField< Type, fvsPatchField, surfaceMesh > &, const word &name)
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::volMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: volMesh.H:51
Foam::outerProduct::type
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Definition: products.H:114
Foam::fv::gradScheme::New
static tmp< gradScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return a pointer to a new gradScheme created on freestore.
Definition: gradScheme.C:37
gaussGrad.H
fvcSurfaceIntegrate.H
Surface integrate surfaceField creating a volField. Surface sum a surfaceField creating a volField.
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fvcGrad.H
Calculate the gradient of the given field.
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53