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