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 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::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 othe other ones
35  'timeStart', 'timeEnd', 'outputControl' etc.
36 
37 SourceFiles
38  setTimeStepFunctionObject.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef setTimeStepFunctionObject_H
43 #define setTimeStepFunctionObject_H
44 
45 #include "functionObject.H"
46 #include "dictionary.H"
47 #include "DataEntry.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class setTimeStepFunctionObject Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 :
60  public functionObject
61 {
62  // Private data
63 
64  //- Reference to the time database
65  const Time& time_;
66 
67 
68  // Optional user inputs
69 
70  //- Switch for the execution - defaults to 'yes/on'
71  bool enabled_;
72 
73  //- Time step
74  autoPtr<DataEntry<scalar> > timeStepPtr_;
75 
76 
77  //- Disallow default bitwise copy construct
79 
80  //- Disallow default bitwise assignment
81  void operator=(const setTimeStepFunctionObject&);
82 
83 
84 public:
85  //- Runtime type information
86  TypeName("setTimeStep");
87 
88  // Constructors
89 
90  //- Construct from components
92  (
93  const word& name,
94  const Time& runTime,
95  const dictionary& dict
96  );
97 
98 
99  // Member Functions
100 
101  // Access
102 
103  //- Return time database
104  virtual const Time& time() const
105  {
106  return time_;
107  }
108 
109  //- Return the enabled flag
110  virtual bool enabled() const
111  {
112  return enabled_;
113  }
114 
115 
116  // Function object control
117 
118  //- Switch the function object on
119  virtual void on();
120 
121  //- Switch the function object off
122  virtual void off();
123 
124 
125  //- Called at the start of the time-loop
126  virtual bool start();
127 
128  //- Called at each ++ or += of the time-loop
129  virtual bool execute(const bool forceWrite);
130 
131  //- Called when Time::run() determines that the time-loop exits
132  virtual bool end();
133 
134  //- Called when time was set at the end of the Time::operator++
135  virtual bool timeSet();
136 
137  //- Called at the end of Time::adjustDeltaT() if adjustTime is true
138  virtual bool adjustTimeStep();
139 
140  //- Read and set the function object if its data have changed
141  virtual bool read(const dictionary&);
142 
143  //- Update for changes of mesh
144  virtual void updateMesh(const mapPolyMesh& mpm);
145 
146  //- Update for changes of mesh
147  virtual void movePoints(const polyMesh& mesh);
148 
149 };
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 } // End namespace Foam
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 #endif
158 
159 // ************************************************************************* //
TypeName("setTimeStep")
Runtime type information.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Abstract base-class for Time/database function objects.
virtual bool read(const dictionary &)
Read and set the function object if its data have changed.
A class for handling words, derived from string.
Definition: word.H:59
virtual const Time & time() const
Return time database.
dynamicFvMesh & mesh
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual void movePoints(const polyMesh &mesh)
Update for changes of mesh.
Namespace for OpenFOAM.
virtual bool enabled() const
Return the enabled flag.
dictionary dict
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
virtual bool execute(const bool forceWrite)
Called at each ++ or += of the time-loop.
virtual bool end()
Called when Time::run() determines that the time-loop exits.
virtual void updateMesh(const mapPolyMesh &mpm)
Update for changes of mesh.
virtual bool timeSet()
Called when time was set at the end of the Time::operator++.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
virtual void on()
Switch the function object on.
virtual void off()
Switch the function object off.
Overrides the timeStep. Can only be used with solvers with adjustTimeStep control (e...
virtual const word & name() const
Name.
virtual bool adjustTimeStep()
Called at the end of Time::adjustDeltaT() if adjustTime is true.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
virtual bool start()
Called at the start of the time-loop.