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 | <time>/inputField
39  output file | - | -
40  output field | surfaceScalarField | <time>/outputField
41  \endtable
42 
43 Usage
44  Minimal example by using \c system/controlDict.functions:
45  \verbatim
46  flowTypeFO
47  {
48  // Mandatory entries
49  type flux;
50  libs (fieldFunctionObjects);
51 
52  // Optional entries
53  rho <word>;
54 
55  // Inherited entries
56  ...
57  }
58  \endverbatim
59 
60  where the entries mean:
61  \table
62  Property | Description | Type | Reqd | Deflt
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 fieldExpression.H \endlink
70 
71 SourceFiles
72  flux.C
73  fluxTemplates.C
74 
75 \*---------------------------------------------------------------------------*/
76 
77 #ifndef Foam_functionObjects_flux_H
78 #define Foam_functionObjects_flux_H
79 
80 #include "fieldExpression.H"
81 
82 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
83 
84 namespace Foam
85 {
86 namespace functionObjects
87 {
88 
89 /*---------------------------------------------------------------------------*\
90  Class flux Declaration
91 \*---------------------------------------------------------------------------*/
92 
93 class flux
94 :
95  public fieldExpression
96 {
97  // Private Data
98 
99  //- Name of density field
100  word rhoName_;
101 
102 
103  // Private Member Functions
104 
105  //- Calculate the flux of a volVectorField and register the result
106  template<class FieldType, class RhoFieldType>
107  bool calcVolFlux(const RhoFieldType& rho);
108 
109  //- Calculate the flux of a surfaceVectorField and register the result
110  template<class FieldType, class RhoFieldType>
111  bool calcSurFlux(const RhoFieldType& rho);
112 
113  //- Calculate the flux field and return true if successful
114  virtual bool calc();
115 
116 
117 public:
118 
119  //- Runtime type information
120  TypeName("flux");
121 
122 
123  // Constructors
124 
125  //- Construct from name, Time and dictionary
126  flux
127  (
128  const word& name,
129  const Time& runTime,
130  const dictionary& dict
131  );
132 
133  //- No copy construct
134  flux(const flux&) = delete;
135 
136  //- No copy assignment
137  void operator=(const flux&) = delete;
138 
139 
140  //- Destructor
141  virtual ~flux() = default;
142 };
143 
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 } // End namespace functionObjects
148 } // End namespace Foam
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 #ifdef NoRepository
153  #include "fluxTemplates.C"
154 #endif
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #endif
159 
160 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:130
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
engineTime & runTime
void operator=(const flux &)=delete
No copy assignment.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
const word & name() const noexcept
Return the name of this functionObject.
A class for handling words, derived from Foam::string.
Definition: word.H:63
Computes the flux of an input vector field.
Definition: flux.H:128
TypeName("flux")
Runtime type information.
flux(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
Definition: flux.C:70
Namespace for OpenFOAM.
virtual ~flux()=default
Destructor.