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-2021 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  Updates the time step as a Function1 of time.
29 
30  Makes no attempt to cooperate with other timeStep controllers (i.e., solver
31  courant number control or other functionObjects). In general any value set
32  here will be overwritten by solver time-step adjustment if enabled, so for
33  this to work 'adjustTime' should be switched off. This is compatible with
34  'adjustableWriteTime', in which case the time-step values set will not be
35  exactly as specified, but write intervals will be matched exactly.
36 
37  This function supports the 'enabled' flag but none of the other run
38  controls; 'startTime', 'endTime', 'writeControl', etc...
39 
40 SourceFiles
41  setTimeStepFunctionObject.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef functionObjects_setTimeStepFunctionObject_H
46 #define functionObjects_setTimeStepFunctionObject_H
47 
48 #include "functionObject.H"
49 #include "Function1.H"
50 #include "Time.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 namespace functionObjects
57 {
58 
59 /*---------------------------------------------------------------------------*\
60  Class setTimeStepFunctionObject Declaration
61 \*---------------------------------------------------------------------------*/
62 
64 :
65  public functionObject
66 {
67  // Private Data
68 
69  //- Reference to the time database
70  const Time& time_;
71 
72  //- Time step function/table
73  autoPtr<Function1<scalar>> timeStepPtr_;
74 
75 
76 public:
77 
78  //- Runtime type information
79  TypeName("setTimeStep");
80 
81 
82  // Constructors
83 
84  //- Construct from components
86  (
87  const word& name,
88  const Time& runTime,
89  const dictionary& dict
90  );
91 
92  //- Disallow default bitwise copy construction
94 
95 
96  // Destructor
98 
99 
100  // Member Functions
101 
102  //- Read and reset the timeStep Function1
103  virtual bool read(const dictionary&);
104 
105  //- Return the list of fields required
106  virtual wordList fields() const
107  {
108  return wordList::null();
109  }
110 
111  //- Reset the timeStep from the Function1 of time
112  virtual bool execute();
113 
114  //- Do nothing
115  virtual bool write();
116 
117 
118  // Member Operators
119 
120  //- Disallow default bitwise assignment
121  void operator=(const setTimeStepFunctionObject&) = delete;
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:156
static const List< T > & null()
Return a null List.
Definition: ListI.H:118
Abstract base-class for Time/database functionObjects.
virtual bool execute()
Reset the timeStep from the Function1 of time.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
Updates the time step as a Function1 of time.
A class for handling words, derived from string.
Definition: word.H:59
virtual bool read(const dictionary &)
Read and reset the timeStep Function1.
void operator=(const setTimeStepFunctionObject &)=delete
Disallow default bitwise assignment.
virtual wordList fields() const
Return the list of fields required.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
setTimeStepFunctionObject(const word &name, const Time &runTime, const dictionary &dict)
Construct from components.
Namespace for OpenFOAM.