averageCondition.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) 2022 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::runTimeControls::averageCondition
28 
29 Description
30  Average run time condition - satisfied when average does not change by
31  more than a given value.
32 
33 See also
34  - Foam::functionObjects::valueAverageBase
35 
36 SourceFiles
37  averageCondition.H
38  averageCondition.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef functionObjects_runTimeControls_averageCondition_H
43 #define functionObjects_runTimeControls_averageCondition_H
44 
45 #include "runTimeCondition.H"
46 #include "valueAverageBase.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 namespace functionObjects
53 {
54 namespace runTimeControls
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class averageCondition Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class averageCondition
62 :
63  public runTimeCondition,
64  public valueAverageBase
65 {
66 protected:
67 
68  // Protected Data
69 
70  //- Number of start-up iterations before allowing satisfied checks
71  label nIterStartUp_;
72 
73  //- Current iteration count
74  label iter_;
75 
76 
77 public:
78 
79  //- Runtime type information
80  TypeName("average");
81 
82  //- Constructor
84  (
85  const word& name,
86  const objectRegistry& obr,
87  const dictionary& dict,
88  stateFunctionObject& state
89  );
90 
91  //- Destructor
92  virtual ~averageCondition() = default;
93 
94 
95  // Public Member Functions
96 
97  //- Apply the condition
98  virtual bool apply();
99 
100  //- Write
101  virtual void write();
102 
103  //- Reset
104  virtual void reset();
105 };
106 
107 
108 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109 
110 } // End namespace runTimeControls
111 } // End namespace functionObjects
112 } // End namespace Foam
113 
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 
116 #endif
117 
118 // ************************************************************************* //
TypeName("average")
Runtime type information.
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
label nIterStartUp_
Number of start-up iterations before allowing satisfied checks.
A class for handling words, derived from Foam::string.
Definition: word.H:63
Average run time condition - satisfied when average does not change by more than a given value...
averageCondition(const word &name, const objectRegistry &obr, const dictionary &dict, stateFunctionObject &state)
Constructor.
Base class for function objects, adding functionality to read/write state information (data required ...
Registry of regIOobjects.
Base class that computes the ensemble- or time-based singular-value average values, with optional windowing, from the output of function objects that generate non-field type values, e.g. Cd of forceCoeffs or momentum_x in momentum function objects.
Namespace for OpenFOAM.
virtual const word & name() const
Return the condition name.