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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2013-2017 OpenFOAM Foundation
9  Copyright (C) 2019-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::functionObjects::setTimeStepFunctionObject
29 
30 Group
31  grpUtilitiesFunctionObjects
32 
33 Description
34  This function object overrides the calculation time step.
35 
36  Can only be used with solvers with adjustTimeStep control (e.g.
37  pimpleFoam). It makes no attempt to co-operate with other time step
38  'controllers', e.g. maxCo, other functionObjects. Supports 'enabled'
39  flag but none of the other options 'timeStart', 'timeEnd', 'writeControl'
40  etc.
41 
42 Usage
43  Example of function object specification to manipulate the time step:
44  \verbatim
45  setTimeStep1
46  {
47  type setTimeStep;
48  libs (utilityFunctionObjects);
49 
50  deltaT table ((0 5e-4)(0.01 1e-3));
51 
52  ...
53  }
54  \endverbatim
55 
56  Where the entries comprise:
57  \table
58  Property | Description | Required | Default value
59  type | Type name: setTimeStep | yes |
60  enabled | On/off switch | no | yes
61  deltaT | Time step value | yes |
62  timeStart | Start time | no | 0
63  timeEnd | End time | no | GREAT
64  deltaTCoeff | Time step change limit | no | GREAT
65  \endtable
66 
67 SourceFiles
68  setTimeStepFunctionObject.C
69 
70 \*---------------------------------------------------------------------------*/
71 
72 #ifndef functionObjects_setTimeStepFunctionObject_H
73 #define functionObjects_setTimeStepFunctionObject_H
74 
75 #include "timeFunctionObject.H"
76 #include "Function1.H"
77 
78 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79 
80 namespace Foam
81 {
82 namespace functionObjects
83 {
84 
85 /*---------------------------------------------------------------------------*\
86  Class setTimeStepFunctionObject Declaration
87 \*---------------------------------------------------------------------------*/
88 
89 class setTimeStepFunctionObject
90 :
91  public functionObjects::timeFunctionObject
92 {
93  // Private Member Data
94 
95  //- Time step function/table
96  autoPtr<Function1<scalar>> timeStepPtr_;
97 
98 
99  // Private Member Functions
100 
101  //- No copy construct
102  setTimeStepFunctionObject(const setTimeStepFunctionObject&) = delete;
103 
104  //- No copy assignment
105  void operator=(const setTimeStepFunctionObject&) = delete;
106 
107 
108 public:
109 
110  //- Runtime type information
111  TypeName("setTimeStep");
112 
113 
114  // Constructors
115 
116  //- Construct from components
117  setTimeStepFunctionObject
118  (
119  const word& name,
120  const Time& runTime,
121  const dictionary& dict
122  );
123 
124 
125  // Destructor
126  virtual ~setTimeStepFunctionObject() = default;
127 
128 
129  // Member Functions
130 
131  //- Called at the end of Time::adjustDeltaT() if adjustTime is true
132  virtual bool adjustTimeStep();
133 
134  //- Read and set the function object if its data have changed
135  virtual bool read(const dictionary& dict);
136 
137  //- Execute does nothing
138  virtual bool execute();
139 
140  //- Write does nothing
141  virtual bool write();
142 };
143 
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 } // End namespace functionObjects
148 } // End namespace Foam
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 #endif
153 
154 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::functionObjects::setTimeStepFunctionObject
This function object overrides the calculation time step.
Definition: setTimeStepFunctionObject.H:123
Function1.H
Foam::functionObjects::setTimeStepFunctionObject::read
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
Definition: setTimeStepFunctionObject.C:89
Foam::functionObjects::timeFunctionObject
Virtual base class for function objects with a reference to Time.
Definition: timeFunctionObject.H:56
timeFunctionObject.H
Foam::functionObjects::setTimeStepFunctionObject::TypeName
TypeName("setTimeStep")
Runtime type information.
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::functionObjects::setTimeStepFunctionObject::write
virtual bool write()
Write does nothing.
Definition: setTimeStepFunctionObject.C:116
Foam::functionObject::name
const word & name() const noexcept
Return the name of this functionObject.
Definition: functionObject.C:143
Foam::functionObjects::setTimeStepFunctionObject::~setTimeStepFunctionObject
virtual ~setTimeStepFunctionObject()=default
Foam::functionObjects::setTimeStepFunctionObject::execute
virtual bool execute()
Execute does nothing.
Definition: setTimeStepFunctionObject.C:110
Foam::functionObjects::setTimeStepFunctionObject::adjustTimeStep
virtual bool adjustTimeStep()
Called at the end of Time::adjustDeltaT() if adjustTime is true.
Definition: setTimeStepFunctionObject.C:67