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  Copyright (C) 2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "facGrad.H"
30 #include "areaFields.H"
31 #include "edgeFields.H"
32 #include "facEdgeIntegrate.H"
33 #include "faMesh.H"
34 #include "faGradScheme.H"
35 #include "gaussFaGrad.H"
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 
39 namespace Foam
40 {
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace fac
45 {
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 template<class Type>
50 tmp
51 <
53  <
55  >
56 >
57 grad
58 (
60 )
61 {
62  return fa::gaussGrad<Type>::gradf(ssf, "grad(" + ssf.name() + ')');
63 }
64 
65 
66 template<class Type>
67 tmp
68 <
70  <
72  >
73 >
74 grad
75 (
77 )
78 {
79  typedef typename outerProduct<vector, Type>::type GradType;
81  (
82  fac::grad(tssf())
83  );
84  tssf.clear();
85  return Grad;
86 }
87 
88 
89 template<class Type>
90 tmp
91 <
93  <
95  >
96 >
97 grad
98 (
100  const word& name
101 )
102 {
104  (
105  vf.mesh(),
106  vf.mesh().gradScheme(name)
107  )().grad(vf, name);
108 }
109 
110 
111 template<class Type>
112 tmp
113 <
115  <
117  >
118 >
119 grad
120 (
122  const word& name
123 )
124 {
125  tmp
126  <
128  <
130  >
131  > tGrad
132  (
133  fac::grad(tvf(), name)
134  );
135  tvf.clear();
136  return tGrad;
137 }
138 
139 
140 template<class Type>
141 tmp
142 <
144  <
146  >
147 >
148 grad
149 (
151 )
152 {
153  return fac::grad(vf, "grad(" + vf.name() + ')');
154 }
155 
156 
157 template<class Type>
158 tmp
159 <
161  <
163  >
164 >
165 grad
166 (
168 )
169 {
170  typedef typename outerProduct<vector, Type>::type GradType;
172  (
173  fac::grad(tvf())
174  );
175  tvf.clear();
176  return Grad;
177 }
178 
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 } // End namespace fac
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 } // End namespace Foam
187 
188 // ************************************************************************* //
Calculate the second temporal derivative.
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:162
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Definition: products.H:118
Generic GeometricField class.
Definition: areaFieldsFwd.H:50
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:56
Calculate the gradient of the given field.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:52
A class for handling words, derived from Foam::string.
Definition: word.H:63
const Mesh & mesh() const noexcept
Return mesh.
static tmp< gradScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return a pointer to a new gradScheme created on freestore.
Definition: faGradScheme.C:41
Mesh data needed to do the Finite Area discretisation.
Definition: areaFaMesh.H:47
static tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > > gradf(const GeometricField< Type, faePatchField, edgeMesh > &, const word &name)
Return the gradient of the given field calculated using Gauss&#39; theorem on the given surface field...
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Edge integrate edgeField creating a areaField. Edge sum a edgeField creating a areaField.
Namespace for OpenFOAM.
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh >> grad(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facGrad.C:51