Loading...
Searching...
No Matches
rampHoldFall.C
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) 2012-2015 OpenFOAM Foundation
9 Copyright (C) 2018 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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\*---------------------------------------------------------------------------*/
28
29#include "rampHoldFall.H"
31
32// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33
34namespace Foam
35{
38}
39
40
41// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42
44(
45 const dictionary& relaxationDict,
46 const Time& runTime
47)
48:
49 relaxationModel(typeName, relaxationDict, runTime),
50 rampStartRelaxation_(coeffDict().get<scalar>("rampStartRelaxation")),
51 holdRelaxation_(coeffDict().get<scalar>("holdRelaxation")),
52 fallEndRelaxation_(coeffDict().get<scalar>("fallEndRelaxation")),
53 rampEndFraction_(coeffDict().get<scalar>("rampEndFraction")),
54 fallStartFraction_(coeffDict().get<scalar>("fallStartFraction")),
55 rampGradient_((holdRelaxation_ - rampStartRelaxation_)/(rampEndFraction_)),
56 fallGradient_
57 (
58 (fallEndRelaxation_ - holdRelaxation_)/(1 - fallStartFraction_)
59 )
60{}
61
62
63// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
64
66{
67 scalar t = runTime_.time().timeOutputValue();
68
69 scalar tStart = runTime_.time().startTime().value();
70 scalar tEnd = runTime_.time().endTime().value();
71 scalar tSpan = tEnd - tStart;
72
73 if (tSpan < VSMALL)
74 {
75 return rampStartRelaxation_;
76 }
77
78 if (t - tStart < rampEndFraction_*tSpan)
79 {
80 // Ramp
81
82 return rampGradient_*((t - tStart)/tSpan) + rampStartRelaxation_;
83 }
84 else if (t - tStart > fallStartFraction_*tSpan)
85 {
86 // Fall
87
88 return
89 fallGradient_*((t - tStart)/tSpan)
90 + fallEndRelaxation_ - fallGradient_;
91 }
92 else
93 {
94 //Hold
95
96 return holdRelaxation_;
97 }
98}
99
100
101// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102
103
104// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Piecewise linear function with a ramp from a start value to a plateaux value, holding at this,...
rampHoldFall(const dictionary &relaxationDict, const Time &runTime)
Construct from components.
virtual scalar relaxation()
Return the current relaxation coefficient.
Abstract base class for providing relaxation values to the cell motion controller.
const Time & runTime_
Reference to the conformalVoronoiMesh holding this cvControls object.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
engineTime & runTime
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
Namespace for OpenFOAM.