Loading...
Searching...
No Matches
div.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) 2020-2021 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::div
29
30Group
31 grpFieldFunctionObjects
32
33Description
34 Computes the divergence of an input field.
35
36 Operands:
37 \table
38 Operand | Type | Location
39 input | {surfaceScalar,volVector}Field | <time>/inputField
40 output file | - | -
41 output field | volScalarField | <time>/outputField
42 \endtable
43
44Usage
45 Minimal example by using \c system/controlDict.functions:
46 \verbatim
47 divFO
48 {
49 // Mandatory entries
50 type div;
51 libs (fieldFunctionObjects);
52
53 // Inherited entries
54 field <word>;
55 ...
56 }
57 \endverbatim
58
59 where the entries mean:
60 \table
61 Property | Description | Type | Reqd | Deflt
62 type | Type name: div | word | yes | -
63 libs | Library name: fieldFunctionObjects | word | yes | -
64 field | Name of the operand field | word | yes | -
65 \endtable
66
67 The inherited entries are elaborated in:
68 - \link fieldExpression.H \endlink
69 - \link zoneSubSet.H \endlink
70
71Note
72 - To execute \c div function object on an input <field>, a numerical scheme
73 should be defined for \c div(<field>) in \c system/fvSchemes.divSchemes.
74 - Optionally the user can specify \c cellZones to create a sub-mesh for the
75 \c div calculation.
76
77SourceFiles
78 div.C
79 divTemplates.C
80
81\*---------------------------------------------------------------------------*/
82
83#ifndef Foam_functionObjects_div_H
84#define Foam_functionObjects_div_H
85
86#include "fieldExpression.H"
87
88// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
89
90namespace Foam
91{
92namespace functionObjects
93{
94
95/*---------------------------------------------------------------------------*\
96 Class div Declaration
97\*---------------------------------------------------------------------------*/
98
99class div
100:
101 public fieldExpression
102{
103 // Private Member Functions
104
105 //- Calculate the divergence of either a
106 //- volScalarField or a surfaceScalarField and register the result
107 template<class FieldType>
108 bool calcDiv();
109
110 //- Calculate the divergence field and return true if successful
111 virtual bool calc();
112
113 //- Helper function for writing submesh fields
114 template<class Type>
115 bool writeField();
116
117
118public:
119
120 //- Runtime type information
121 TypeName("div");
122
123
124 // Constructors
125
126 //- Construct from name, Time and dictionary
127 div
128 (
129 const word& name,
130 const Time& runTime,
131 const dictionary& dict
132 );
133
134 //- No copy construct
135 div(const div&) = delete;
136
137 //- No copy assignment
138 void operator=(const div&) = delete;
139
140
141 //- Destructor
142 virtual ~div() = default;
143
144
145 // Member Functions
146
147 //- Write the function-object results
148 virtual bool write();
149};
150
151
152// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153
154} // End namespace functionObjects
155} // End namespace Foam
156
157// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158
159#ifdef NoRepository
160 #include "divTemplates.C"
161#endif
162
163// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165#endif
166
167// ************************************************************************* //
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.
Computes the divergence of an input field.
Definition div.H:137
void operator=(const div &)=delete
No copy assignment.
TypeName("div")
Runtime type information.
virtual ~div()=default
Destructor.
div(const div &)=delete
No copy construct.
div(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
Definition div.C:69
virtual bool write()
Write the function-object results.
Definition div.C:51
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.
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