Loading...
Searching...
No Matches
grad.H
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) 2012-2016 OpenFOAM Foundation
9 Copyright (C) 2019-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::functionObjects::grad
29
30Group
31 grpFieldFunctionObjects
32
33Description
34 Computes the gradient of an input field.
35
36 The operation is limited to scalar and vector volume or surface fields, and
37 the output is a volume vector or tensor field.
38
39 Operands:
40 \table
41 Operand | Type | Location
42 input | {vol,surface}{Scalar,Vector}Field | <time>/inputFields
43 output file | - | -
44 output field | vol{Vector,Tensor}Field | <time>/outputField
45 \endtable
46
47Usage
48 Minimal example by using \c system/controlDict.functions:
49 \verbatim
50 gradFO
51 {
52 // Mandatory entries
53 type grad;
54 libs (fieldFunctionObjects);
55 field <word>;
56
57 // Inherited entries
58 ...
59 }
60 \endverbatim
61
62 where the entries mean:
63 \table
64 Property | Description | Type | Reqd | Deflt
65 type | Type name: grad | word | yes | -
66 libs | Library name: fieldFunctionObjects | word | yes | -
67 field | Name of the operand field | word | yes | -
68 \endtable
69
70 The inherited entries are elaborated in:
71 - \link fieldExpression.H \endlink
72
73SourceFiles
74 grad.C
75 gradTemplates.C
76
77\*---------------------------------------------------------------------------*/
78
79#ifndef Foam_functionObjects_grad_H
80#define Foam_functionObjects_grad_H
81
82#include "fieldExpression.H"
83
84// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
85
86namespace Foam
87{
88namespace functionObjects
89{
90
91/*---------------------------------------------------------------------------*\
92 Class grad Declaration
93\*---------------------------------------------------------------------------*/
94
95class grad
96:
97 public fieldExpression
98{
99 // Private Member Functions
100
101 //- Calculate the magnitude of the field and register the result
102 template<class Type>
103 bool calcGrad();
104
105 //- Calculate the gradient field and return true if successful
106 virtual bool calc();
107
108
109public:
110
111 //- Runtime type information
112 TypeName("grad");
113
114
115 // Constructors
116
117 //- Construct from name, Time and dictionary
118 grad
119 (
120 const word& name,
121 const Time& runTime,
122 const dictionary& dict
123 );
124
125 //- No copy construct
126 grad(const grad&) = delete;
127
128 //- No copy assignment
129 void operator=(const grad&) = delete;
131
132 //- Destructor
133 virtual ~grad() = default;
134};
135
136
137// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138
139} // End namespace functionObjects
140} // End namespace Foam
141
142// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143
144#ifdef NoRepository
145 #include "gradTemplates.C"
146#endif
147
148// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149
150#endif
151
152// ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const word & name() const noexcept
Return the name of this functionObject.
Intermediate class for handling field expression function objects (e.g. blendingFactor etc....
fieldExpression(const word &name, const Time &runTime, const dictionary &dict, const word &fieldName=word::null, const word &resultName=word::null)
Construct from name, Time and dictionary.
virtual bool calc()=0
Calculate the components of the field and return true if successful.
Computes the gradient of an input field.
Definition grad.H:133
grad(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
Definition grad.C:53
TypeName("grad")
Runtime type information.
void operator=(const grad &)=delete
No copy assignment.
grad(const grad &)=delete
No copy construct.
virtual ~grad()=default
Destructor.
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68