age.H
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) 2018-2019 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 Class
25  Foam::functionObjects::age
26 
27 Description
28  Calculates and writes out the time taken for a particle to travel from an
29  inlet to the location. Solves the following equation when incompressible:
30  \f[
31  \div (\phi t) = 1
32  \f]
33  where:
34  \vartable
35  t | Age [s]
36  \phi | Volumetric flux [m^3/s]
37  \endvartable
38  Boundary conditions are generated automatically as zeroGradient on all
39  walls and inletOutlet everywhere else.
40 
41 Usage
42  \table
43  Property | Description | Required | Default value
44  phi | The name of the flux field | no | phi
45  rho | The name of the density field | no | rho
46  nCorr | The number of correctors | no | 0
47  schemesField | The name of the field from which schemes are taken | \\
48  no | age
49  \endtable
50 
51  \verbatim
52  age1
53  {
54  type age;
55  libs ("libsolverFunctionObjects.so");
56 
57  writeControl writeTime;
58  writeInterval 1;
59 
60  phi phi;
61  rho rho;
62  nCorr 10;
63  schemesField k;
64  }
65  \endverbatim
66 
67 SourceFiles
68  age.C
69 
70 \*---------------------------------------------------------------------------*/
71 
72 #ifndef age_H
73 #define age_H
74 
75 #include "fvMeshFunctionObject.H"
76 #include "volFields.H"
77 
78 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79 
80 namespace Foam
81 {
82 namespace functionObjects
83 {
84 
85 /*---------------------------------------------------------------------------*\
86  Class age Declaration
87 \*---------------------------------------------------------------------------*/
88 
89 class age
90 :
91  public fvMeshFunctionObject
92 {
93  // Private Data
94 
95  //- The name of the flux field
96  word phiName_;
97 
98  //- The name of the density field
99  word rhoName_;
100 
101  //- Number of corrections
102  label nCorr_;
103 
104  //- Name of field from which schemes are taken
105  word schemesField_;
106 
107 
108  // Private Member Functions
109 
110  //- The list of patch types for the age field
111  wordList patchTypes() const;
112 
113 
114 public:
115 
116  //- Runtime type information
117  TypeName("age");
118 
119 
120  // Constructors
121 
122  //- Construct from Time and dictionary
123  age
124  (
125  const word& name,
126  const Time& runTime,
127  const dictionary& dict
128  );
129 
130 
131  //- Destructor
132  virtual ~age();
133 
134 
135  // Member Functions
136 
137  //- Read the data
138  virtual bool read(const dictionary&);
139 
140  //- Execute
141  virtual bool execute();
142 
143  //- Write
144  virtual bool write();
145 };
146 
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 } // End namespace functionObjects
151 } // End namespace Foam
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #endif
156 
157 // ************************************************************************* //
virtual bool execute()
Execute.
Definition: age.C:109
virtual bool read(const dictionary &)
Read the data.
Definition: age.C:96
dictionary dict
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
const word & name() const
Return the name of this functionObject.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
age(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: age.C:71
TypeName("age")
Runtime type information.
engineTime & runTime
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
A class for handling words, derived from string.
Definition: word.H:59
List< word > wordList
A List of words.
Definition: fileName.H:54
virtual ~age()
Destructor.
Definition: age.C:90
virtual bool write()
Write.
Definition: age.C:115
Namespace for OpenFOAM.