Skip to content
Snippets Groups Projects
Commit 7e6faf04 authored by mattijs's avatar mattijs
Browse files

Squashed commit of the following:

commit 510b9353f8cb932a87f1588b17a4dea230c29d3c
Author: mattijs <mattijs>
Date:   Wed Jun 14 16:36:35 2017 +0100

    ENH: timeControl: propagate time-change logic from Time.C

commit 6dc57a8f1e0e7605ea819deb6f11dd4b7874ff30
Author: mattijs <mattijs>
Date:   Thu Jun 1 11:28:56 2017 +0100

    ENH: timeControl: cleanup; avoid division by zero

commit 5ac4bc2dd8c1f4676eef9d7a03215caba23a2e19
Author: mattijs <mattijs>
Date:   Wed May 31 12:04:52 2017 +0100

    ENH: timeControl: allow ramping down as well as up.

commit a6b2db9e791f29258f04f3a9cbd6354aa468977d
Author: mattijs <mattijs>
Date:   Wed May 17 15:29:22 2017 +0100

    ENH: timeControl: limit any timestep change if deltaTCoeff enabled.

commit 004115ee03a6637ae0d23cce303a30d1b3af046f
Author: mattijs <mattijs>
Date:   Wed May 17 11:40:26 2017 +0100

    ENH: setTimeStep: have timeStart, timeEnd controls on time step adjustment.

    Also added smoothly varying time step change (through optional deltaTCoeff)
parent 8a8e5e88
Branches
Tags
No related merge requests found
......@@ -25,6 +25,13 @@ Class
Foam::functionObjects::timeControl
Description
Wrapper around functionObjects to add time control.
Adds
- timeStart, timeEnd activation
- deltaT modification to hit writeInterval (note: if adjustableRunTime
also in controlDict this has to be an integer multiple)
- smooth deltaT variation through optional deltaTCoeff parameter
Note
Since the timeIndex is used directly from Foam::Time, it is unaffected
......@@ -85,6 +92,9 @@ class timeControl
//- De-activation time - defaults to VGREAT
scalar timeEnd_;
//- Max time step change
scalar deltaTCoeff_;
//- Number of steps before the dump-time during which deltaT
// may be changed (valid for adjustableRunTime)
label nStepsToStartTimeChange_;
......@@ -103,6 +113,16 @@ class timeControl
label executeTimeIndex_;
// For time-step change limiting (deltaTCoeff supplied) only:
//- Store the old deltaT value
scalar deltaT0_;
//- Store the series expansion coefficient value
scalar seriesDTCoeff_;
// Private Member Functions
//- Read relevant dictionary entries
......@@ -111,6 +131,26 @@ class timeControl
//- Returns true if within time bounds
bool active() const;
//- Return expansion ratio (deltaT change) that gives overall time
static scalar calcExpansion
(
const scalar startRatio,
const scalar y,
const label n
);
//- Calculate deltaT change such that the next write interval is
// obeyed. Updates requiredDeltaTCoeff
void calcDeltaTCoeff
(
scalar& requiredDeltaTCoeff,
const scalar wantedDT,
const label nSteps,
const scalar presentTime,
const scalar timeToNextWrite,
const bool rampDirectionUp
);
//- Disallow default bitwise copy construct
timeControl(const timeControl&);
......
......@@ -89,7 +89,7 @@ bool Foam::functionObjects::setTimeStepFunctionObject::adjustTimeStep()
index = time_.timeIndex();
// Set time, allow deltaT to be adjusted for writeInterval purposes
const_cast<Time&>(time_).setDeltaT(newDeltaT, true);
const_cast<Time&>(time_).setDeltaT(newDeltaT, false);
}
return true;
......
......@@ -43,6 +43,9 @@ Usage
{
type setTimeStep;
libs ("libutilityFunctionObjects.so");
deltaT table ((0 5e-4)(0.01 1e-3));
...
}
\endverbatim
......@@ -52,6 +55,10 @@ Usage
Property | Description | Required | Default value
type | Type name: setTimeStep | yes |
enabled | On/off switch | no | yes
deltaT | Time step value | yes |
timeStart | Start time | no | 0
timeEnd | End time | no | GREAT
deltaTCoeff | Time step change limit | no | GREAT
\endtable
SourceFiles
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment