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-2018 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  'timeStart', 'timeEnd', '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  // Private member functions
70 
71  //- Disallow default bitwise copy construct
73 
74  //- Disallow default bitwise assignment
75  void operator=(const setTimeStepFunctionObject&);
76 
77 
78 public:
79 
80  //- Runtime type information
81  TypeName("setTimeStep");
82 
83 
84  // Constructors
85 
86  //- Construct from components
88  (
89  const word& name,
90  const Time& runTime,
91  const dictionary& dict
92  );
93 
94 
95  // Destructor
97 
98 
99  // Member Functions
100 
101  //- Return time database
102  const Time& time() const;
103 
104  //- Override the time-step value
105  virtual bool setTimeStep();
106 
107  //- Read and set the function object if its data have changed
108  virtual bool read(const dictionary&);
109 
110  //- Called at each ++ or += of the time-loop.
111  // postProcess overrides the usual executeControl behaviour and
112  // forces execution (used in post-processing mode)
113  virtual bool execute();
114 
115  //- Called at each ++ or += of the time-loop.
116  // postProcess overrides the usual writeControl behaviour and
117  // forces writing always (used in post-processing mode)
118  virtual bool write();
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:137
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.
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.
Namespace for OpenFOAM.