Loading...
Searching...
No Matches
betaMaxStepRamp.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) 2020-2023 PCOpt/NTUA
9 Copyright (C) 2020-2023 FOSS GP
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
31
32// * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * * * //
33
34namespace Foam
35{
38 (
39 betaMax,
40 betaMaxStepRamp,
42 );
43}
44
45// * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * //
46
47Foam::betaMaxStepRamp::betaMaxStepRamp
48(
49 const fvMesh& mesh,
50 const dictionary& dict
51)
52:
54 betaMin_(dict.getOrDefault<scalar>("betaMin", Zero)),
55 funcPtr_(nullptr)
56{
57 funcPtr_.reset
58 (Function1<scalar>::New("betaMaxStepRamp", dict, "stepRamp"));
59
61 << "betaMaxStepRamp:: creating interpolation function of type "
62 << funcPtr_().type() << endl;
63}
64
65
66// * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * * //
67
68Foam::scalar Foam::betaMaxStepRamp::value() const
69{
70 const scalar t = mesh_.time().timeOutputValue();
71 const scalar value = betaMin_ + (value_ - betaMin_)*funcPtr_().value(t);
73 << "stepRamp betaMax:: t, betaMax value "
74 << t << ", " << value << endl;
75
76 return value;
77}
78
79// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Computes the betaMax using a stepRamp function which updates itself based on the current time.
virtual scalar value() const
Get value.
autoPtr< Function1< scalar > > funcPtr_
The step ramp function.
scalar betaMin_
Minimum betaMax value (to be used at the first opt cycles).
Base class for selecting the betaMax value, i.e. the value multiplying the Brinkman penalisation term...
Definition betaMax.H:50
const fvMesh & mesh_
Reference to mesh.
Definition betaMax.H:73
scalar value_
betaMax value
Definition betaMax.H:78
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
dynamicFvMesh & mesh
#define DebugInfo
Report an information message using Foam::Info.
Namespace for OpenFOAM.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
dictionary dict