setTimeStepFunctionObject.H 4.51 KB
Newer Older
Henry's avatar
Henry committed
1
2
3
4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
5
    \\  /    A nd           | Copyright (C) 2013-2017 OpenFOAM Foundation
Henry's avatar
Henry committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

Class
25
    Foam::functionObjects::setTimeStepFunctionObject
Henry's avatar
Henry committed
26
27
28
29
30

Group
    grpUtilitiesFunctionObjects

Description
31
32
33
34
35
36
37
    This function object overrides the calculation time step.

    Can only be used with solvers with adjustTimeStep control (e.g.
    pimpleFoam).  It makes no attempt to co-operate with other time step
    'controllers', e.g. maxCo, other functionObjects. Supports 'enabled'
    flag but none of the other options 'timeStart', 'timeEnd', 'writeControl'
    etc.
Henry's avatar
Henry committed
38

Andrew Heather's avatar
Andrew Heather committed
39
Usage
40
41
42
43
44
    Example of function object specification to manipulate the time step:
    \verbatim
    setTimeStep1
    {
        type        setTimeStep;
Andrew Heather's avatar
Andrew Heather committed
45
        libs        ("libutilityFunctionObjects.so");
mattijs's avatar
mattijs committed
46
47
48

        deltaT      table ((0 5e-4)(0.01 1e-3));

49
50
51
52
        ...
    }
    \endverbatim

Andrew Heather's avatar
Andrew Heather committed
53
    Where the entries comprise:
54
55
56
57
    \table
        Property     | Description             | Required    | Default value
        type         | Type name: setTimeStep  | yes         |
        enabled      | On/off switch           | no          | yes
mattijs's avatar
mattijs committed
58
59
60
61
        deltaT       | Time step value         | yes         |
        timeStart    | Start time              | no          | 0
        timeEnd      | End time                | no          | GREAT
        deltaTCoeff  | Time step change limit  | no          | GREAT
62
63
    \endtable

Henry's avatar
Henry committed
64
65
66
67
68
SourceFiles
    setTimeStepFunctionObject.C

\*---------------------------------------------------------------------------*/

69
70
#ifndef functionObjects_setTimeStepFunctionObject_H
#define functionObjects_setTimeStepFunctionObject_H
Henry's avatar
Henry committed
71
72

#include "functionObject.H"
Henry Weller's avatar
Henry Weller committed
73
#include "Function1.H"
Henry's avatar
Henry committed
74
75
76
77
78

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
79
80
namespace functionObjects
{
Henry's avatar
Henry committed
81
82

/*---------------------------------------------------------------------------*\
83
                  Class setTimeStepFunctionObject Declaration
Henry's avatar
Henry committed
84
85
86
87
88
89
90
91
92
93
94
\*---------------------------------------------------------------------------*/

class setTimeStepFunctionObject
:
    public functionObject
{
    // Private data

        //- Reference to the time database
        const Time& time_;

95
96
        //- Time step function/table
        autoPtr<Function1<scalar>> timeStepPtr_;
Henry's avatar
Henry committed
97
98


99
    // Private member functions
Henry's avatar
Henry committed
100

101
102
        //- No copy construct
        setTimeStepFunctionObject(const setTimeStepFunctionObject&) = delete;
Henry's avatar
Henry committed
103

104
105
        //- No copy assignment
        void operator=(const setTimeStepFunctionObject&) = delete;
Henry's avatar
Henry committed
106
107
108


public:
109

Henry's avatar
Henry committed
110
111
112
    //- Runtime type information
    TypeName("setTimeStep");

113

Henry's avatar
Henry committed
114
115
116
117
118
119
120
121
122
123
124
    // Constructors

        //- Construct from components
        setTimeStepFunctionObject
        (
            const word& name,
            const Time& runTime,
            const dictionary& dict
        );


125
126
    // Destructor
    virtual ~setTimeStepFunctionObject();
Henry's avatar
Henry committed
127
128
129
130


    // Member Functions

131
132
        //- Return time database
        const Time& time() const;
Henry's avatar
Henry committed
133

134
135
        //- Called at the end of Time::adjustDeltaT() if adjustTime is true
        virtual bool adjustTimeStep();
Henry's avatar
Henry committed
136

137
        //- Read and set the function object if its data have changed
138
        virtual bool read(const dictionary& dict);
Henry's avatar
Henry committed
139

140
        //- Execute does nothing
141
        virtual bool execute();
142
143

        //- Write does nothing
144
        virtual bool write();
Henry's avatar
Henry committed
145
146
};

147

Henry's avatar
Henry committed
148
149
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

150
} // End namespace functionObjects
Henry's avatar
Henry committed
151
152
153
154
155
156
157
} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //