flux.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) 2016-2020 OpenCFD Ltd.
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 Class
27  Foam::functionObjects::flux
28 
29 Group
30  grpFieldFunctionObjects
31 
32 Description
33  Computes the flux of an input vector field.
34 
35  Operands:
36  \table
37  Operand | Type | Location
38  input | {vol,surface}VectorField | $FOAM_CASE/<time>/<inpField>
39  output file | - | -
40  output field | surfaceScalarField | $FOAM_CASE/<time>/<outField>
41  \endtable
42 
43 Usage
44  Minimal example by using \c system/controlDict.functions:
45  \verbatim
46  flowType1
47  {
48  // Mandatory entries (unmodifiable)
49  type flux;
50  libs (fieldFunctionObjects);
51 
52  // Optional entries (runtime modifiable)
53  rho none;
54 
55  // Optional (inherited) entries
56  ...
57  }
58  \endverbatim
59 
60  where the entries mean:
61  \table
62  Property | Description | Type | Req'd | Dflt
63  type | Type name: flux | word | yes | -
64  libs | Library name: fieldFunctionObjects | word | yes | -
65  rho | Name of density field | word | no | none
66  \endtable
67 
68  The inherited entries are elaborated in:
69  - \link functionObject.H \endlink
70  - \link fieldExpression.H \endlink
71 
72  Usage by the \c postProcess utility is not available.
73 
74 See also
75  - Foam::functionObject
76  - Foam::functionObjects::fieldExpression
77  - Foam::functionObjects::fvMeshFunctionObject
78  - ExtendedCodeGuide::functionObjects::field::flux
79 
80 SourceFiles
81  flux.C
82  fluxTemplates.C
83 
84 \*---------------------------------------------------------------------------*/
85 
86 #ifndef functionObjects_flux_H
87 #define functionObjects_flux_H
88 
89 #include "fieldExpression.H"
90 
91 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
92 
93 namespace Foam
94 {
95 namespace functionObjects
96 {
97 
98 /*---------------------------------------------------------------------------*\
99  Class flux Declaration
100 \*---------------------------------------------------------------------------*/
101 
102 class flux
103 :
104  public fieldExpression
105 {
106  // Private Data
107 
108  //- Name of density field
109  word rhoName_;
110 
111 
112  // Private Member Functions
113 
114  //- Calculate the flux of a volVectorField and register the result
115  template<class FieldType, class RhoFieldType>
116  bool calcVolFlux(const RhoFieldType& rho);
117 
118  //- Calculate the flux of a surfaceVectorField and register the result
119  template<class FieldType, class RhoFieldType>
120  bool calcSurFlux(const RhoFieldType& rho);
121 
122  //- Calculate the flux field and return true if successful
123  virtual bool calc();
124 
125 
126 public:
127 
128  //- Runtime type information
129  TypeName("flux");
130 
131 
132  // Constructors
133 
134  //- Construct from Time and dictionary
135  flux
136  (
137  const word& name,
138  const Time& runTime,
139  const dictionary& dict
140  );
141 
142  //- No copy construct
143  flux(const flux&) = delete;
144 
145  //- No copy assignment
146  void operator=(const flux&) = delete;
147 
148 
149  //- Destructor
150  virtual ~flux() = default;
151 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace functionObjects
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 #ifdef NoRepository
162  #include "fluxTemplates.C"
163 #endif
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #endif
168 
169 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::fvc::flux
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::functionObjects::flux::flux
flux(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: flux.C:77
rho
rho
Definition: readInitialConditions.H:88
Foam::functionObjects::flux::TypeName
TypeName("flux")
Runtime type information.
Foam::functionObjects::flux
Computes the flux of an input vector field.
Definition: flux.H:141
Foam::functionObjects::flux::operator=
void operator=(const flux &)=delete
No copy assignment.
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fluxTemplates.C
Foam::functionObject::name
const word & name() const noexcept
Return the name of this functionObject.
Definition: functionObject.C:143
Foam::functionObjects::fieldExpression
Intermediate class for handling field expression function objects (e.g. blendingFactor etc....
Definition: fieldExpression.H:120
fieldExpression.H
Foam::functionObjects::flux::~flux
virtual ~flux()=default
Destructor.