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 #include "Time.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 namespace functionObjects
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class setTimeStepFunctionObject Declaration
55 \*---------------------------------------------------------------------------*/
56 
58 :
59  public functionObject
60 {
61  // Private Data
62 
63  //- Reference to the time database
64  const Time& time_;
65 
66  //- Time step function/table
67  autoPtr<Function1<scalar>> timeStepPtr_;
68 
69 
70 public:
71 
72  //- Runtime type information
73  TypeName("setTimeStep");
74 
75 
76  // Constructors
77 
78  //- Construct from components
80  (
81  const word& name,
82  const Time& runTime,
83  const dictionary& dict
84  );
85 
86  //- Disallow default bitwise copy construction
88 
89 
90  // Destructor
92 
93 
94  // Member Functions
95 
96  //- Return time database
97  const Time& time() const;
98 
99  //- Override the time-step value
100  virtual bool setTimeStep();
101 
102  //- Read and set the function object if its data have changed
103  virtual bool read(const dictionary&);
104 
105  //- Called at each ++ or += of the time-loop.
106  // postProcess overrides the usual executeControl behaviour and
107  // forces execution (used in post-processing mode)
108  virtual bool execute();
109 
110  //- Called at each ++ or += of the time-loop.
111  // postProcess overrides the usual writeControl behaviour and
112  // forces writing always (used in post-processing mode)
113  virtual bool write();
114 
115 
116  // Member Operators
117 
118  //- Disallow default bitwise assignment
119  void operator=(const setTimeStepFunctionObject&) = delete;
120 };
121 
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 } // End namespace functionObjects
126 } // End namespace Foam
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 #endif
131 
132 // ************************************************************************* //
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 functionObjects.
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.