Loading...
Searching...
No Matches
age.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) 2018-2021 OpenFOAM Foundation
9 Copyright (C) 2021-2025 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::age
29
30Description
31 Calculates and writes out the time taken for a particle to travel from an
32 inlet to the location. Solves the following equation when incompressible:
33
34 \f[
35 \div (\phi t) = 1
36 \f]
37
38 where
39 \vartable
40 t | Age [s]
41 \phi | Volumetric flux [m^3/s]
42 \endvartable
43
44 Boundary conditions are generated automatically as \c zeroGradient
45 on all walls and \c inletOutlet everywhere else.
46
47Usage
48 Minimal example by using \c system/controlDict.functions:
49 \verbatim
50 ageFO
51 {
52 // Mandatory entries
53 type age;
54 libs (fieldFunctionObjects);
55
56 // Optional entries
57 phi <word>;
58 rho <word>;
59 schemesField <word>;
60 tolerance <scalar>;
61 nCorr <int>;
62 diffusion <bool>;
63
64 // Inherited entries
65 ...
66 }
67 \endverbatim
68
69 where the entries mean:
70 \table
71 Property | Description | Type | Reqd | Deflt
72 type | Type name: age | word | yes | -
73 libs | Library name: fieldFunctionObjects | word | yes | -
74 phi | Name of flux field | word | no | phi
75 rho | Name of density field | word | no | rho
76 schemesField | Name of the field from which schemes are taken <!--
77 --> | word | no | age
78 tolerance | Solver residual control | scalar | no | 1e-5
79 nCorr | Maximum number of correctors | int | no | 5
80 diffusion | Flag to turn on/off the diffusion term | bool | no | false
81 \endtable
82
83 The inherited entries are elaborated in:
84 - \link functionObject.H \endlink
85
86See also
87 - Foam::functionObjects::comfort
88
89SourceFiles
90 age.C
91
92\*---------------------------------------------------------------------------*/
93
94#ifndef Foam_functionObjects_age_H
95#define Foam_functionObjects_age_H
96
98#include "volFields.H"
99
100// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101
102namespace Foam
103{
104namespace functionObjects
105{
106
107/*---------------------------------------------------------------------------*\
108 Class age Declaration
109\*---------------------------------------------------------------------------*/
110
111class age
112:
114{
115 // Private Data
116
117 //- The name of the flux field
118 word phiName_;
119
120 //- The name of the density field
121 word rhoName_;
122
123 //- Name of field from which schemes are taken
124 word schemesField_;
125
126 //- Name of the divergence scheme
127 word divScheme_;
128
129 //- Name of the Laplacian scheme
130 word laplacianScheme_;
131
132 //- Convergence tolerance
133 scalar tolerance_;
134
135 //- Number of corrections
136 int nCorr_;
137
138 //- Flag to turn on/off the diffusion term
139 bool diffusion_;
140
141 //- Flag that indicates if flux is mass-based or volume-based
142 bool isCompressible_;
143
144
145 // Private Member Functions
146
147 //- The list of patch types for the age field
148 wordList patchTypes() const;
149
150 //- Return true if convergence is reached
151 bool converged(const int nCorr, const scalar initialResidual) const;
152
153
154public:
155
156 //- Runtime type information
157 TypeName("age");
158
159
160 // Constructors
161
162 //- Construct from name, Time and dictionary
163 age
164 (
165 const word& name,
166 const Time& runTime,
167 const dictionary& dict
168 );
169
171 //- Destructor
172 virtual ~age() = default;
173
174
175 // Member Functions
176
177 //- Read the function-object dictionary
178 virtual bool read(const dictionary& dict);
179
180 //- Execute the function-object operations
181 virtual bool execute();
182
183 //- Write the function-object results
184 virtual bool write();
185};
186
187
188// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189
190} // End namespace functionObjects
191} // End namespace Foam
192
193// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194
195#endif
196
197// ************************************************************************* //
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.
Calculates and writes out the time taken for a particle to travel from an inlet to the location....
Definition age.H:173
age(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
Definition age.C:91
TypeName("age")
Runtime type information.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
Definition age.C:105
virtual bool execute()
Execute the function-object operations.
Definition age.C:144
virtual bool write()
Write the function-object results.
Definition age.C:271
virtual ~age()=default
Destructor.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
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.
List< word > wordList
List of word.
Definition fileName.H:60
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