setTimeStepFunctionObject.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) 2013-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::setTimeStepFunctionObject
26 
27 Description
28  Overrides the timeStep. Can only be used with
29  solvers with adjustTimeStep control (e.g. pimpleFoam). Makes no attempt
30  to cooperate with other timeStep 'controllers' (maxCo, other
31  functionObjects). Supports 'enabled' flag but none of the other ones
32  'startTime', 'endTime', 'writeControl' etc.
33 
34 SourceFiles
35  setTimeStepFunctionObject.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef functionObjects_setTimeStepFunctionObject_H
40 #define functionObjects_setTimeStepFunctionObject_H
41 
42 #include "functionObject.H"
43 #include "Function1.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 namespace functionObjects
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class setTimeStepFunctionObject Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 :
58  public functionObject
59 {
60  // Private Data
61 
62  //- Reference to the time database
63  const Time& time_;
64 
65  //- Time step function/table
66  autoPtr<Function1<scalar>> timeStepPtr_;
67 
68 
69 public:
70 
71  //- Runtime type information
72  TypeName("setTimeStep");
73 
74 
75  // Constructors
76 
77  //- Construct from components
79  (
80  const word& name,
81  const Time& runTime,
82  const dictionary& dict
83  );
84 
85  //- Disallow default bitwise copy construction
87 
88 
89  // Destructor
91 
92 
93  // Member Functions
94 
95  //- Return time database
96  const Time& time() const;
97 
98  //- Override the time-step value
99  virtual bool setTimeStep();
100 
101  //- Read and set the function object if its data have changed
102  virtual bool read(const dictionary&);
103 
104  //- Called at each ++ or += of the time-loop.
105  // postProcess overrides the usual executeControl behaviour and
106  // forces execution (used in post-processing mode)
107  virtual bool execute();
108 
109  //- Called at each ++ or += of the time-loop.
110  // postProcess overrides the usual writeControl behaviour and
111  // forces writing always (used in post-processing mode)
112  virtual bool write();
113 
114 
115  // Member Operators
116 
117  //- Disallow default bitwise assignment
118  void operator=(const setTimeStepFunctionObject&) = delete;
119 };
120 
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 } // End namespace functionObjects
125 } // End namespace Foam
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 #endif
130 
131 // ************************************************************************* //
dictionary dict
const word & name() const
Return the name of this functionObject.
TypeName("setTimeStep")
Runtime type information.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
engineTime & runTime
virtual bool write()
Called at each ++ or += of the time-loop.
Abstract base-class for Time/database function objects.
virtual bool execute()
Called at each ++ or += of the time-loop.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Overrides the timeStep. Can only be used with solvers with adjustTimeStep control (e...
A class for handling words, derived from string.
Definition: word.H:59
virtual bool read(const dictionary &)
Read and set the function object if its data have changed.
const Time & time() const
Return time database.
void operator=(const setTimeStepFunctionObject &)=delete
Disallow default bitwise assignment.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
virtual bool setTimeStep()
Override the time-step value.
setTimeStepFunctionObject(const word &name, const Time &runTime, const dictionary &dict)
Construct from components.
Namespace for OpenFOAM.