fvcGrad.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "fvcGrad.H"
27 #include "fvcSurfaceIntegrate.H"
28 #include "fvMesh.H"
29 #include "gaussGrad.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 
38 namespace fvc
39 {
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 template<class Type>
44 tmp<VolField<typename outerProduct<vector, Type>::type>>
46 (
47  const SurfaceField<Type>& ssf
48 )
49 {
50  return fv::gaussGrad<Type>::gradf(ssf, "grad(" + ssf.name() + ')');
51 }
52 
53 
54 template<class Type>
57 (
58  const tmp<SurfaceField<Type>>& tssf
59 )
60 {
62  (
63  fvc::grad(tssf())
64  );
65  tssf.clear();
66  return Grad;
67 }
68 
69 
70 template<class Type>
73 (
74  const VolField<Type>& vf,
75  const word& name
76 )
77 {
79  (
80  vf.mesh(),
81  vf.mesh().schemes().grad(name)
82  )().grad(vf, name);
83 }
84 
85 
86 template<class Type>
89 (
90  const tmp<VolField<Type>>& tvf,
91  const word& name
92 )
93 {
94 
96  (
97  fvc::grad(tvf(), name)
98  );
99  tvf.clear();
100  return tGrad;
101 }
102 
103 
104 template<class Type>
107 (
108  const VolField<Type>& vf
109 )
110 {
111  return fvc::grad(vf, "grad(" + vf.name() + ')');
112 }
113 
114 
115 template<class Type>
118 (
119  const tmp<VolField<Type>>& tvf
120 )
121 {
123  (
124  fvc::grad(tvf())
125  );
126  tvf.clear();
127  return Grad;
128 }
129 
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 } // End namespace fvc
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace Foam
138 
139 // ************************************************************************* //
const Mesh & mesh() const
Return mesh.
Generic GeometricField class.
const word & name() const
Return name.
Definition: IOobject.H:310
static tmp< VolField< typename outerProduct< vector, Type >::type > > gradf(const SurfaceField< Type > &, const word &name)
Return the gradient of the given field.
static tmp< gradScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return a pointer to a new gradScheme created on freestore.
Definition: gradScheme.C:34
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
Calculate the gradient of the given field.
Surface integrate surfaceField creating a volField. Surface sum a surfaceField creating a volField.
tmp< VolField< typename outerProduct< vector, Type >::type > > grad(const SurfaceField< Type > &ssf)
Definition: fvcGrad.C:46
Namespace for OpenFOAM.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47