adaptiveLinear.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 | Copyright (C) 2012-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "adaptiveLinear.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 defineTypeNameAndDebug(adaptiveLinear, 0);
37 addToRunTimeSelectionTable(relaxationModel, adaptiveLinear, dictionary);
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
42 (
43  const dictionary& relaxationDict,
44  const Time& runTime
45 )
46 :
47  relaxationModel(typeName, relaxationDict, runTime),
48  relaxationStart_(readScalar(coeffDict().lookup("relaxationStart"))),
49  relaxationEnd_(readScalar(coeffDict().lookup("relaxationEnd"))),
50  lastTimeValue_(runTime_.time().timeOutputValue()),
51  relaxation_(relaxationStart_)
52 {}
53 
54 
55 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
56 
58 {
60  {
61  scalar currentRelaxation = relaxation_;
62 
63  relaxation_ -=
65  /(
66  (
69  )
71  + 1
72  );
73 
75 
76  return currentRelaxation;
77  }
78 
79  return relaxation_;
80 }
81 
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 } // End namespace Foam
86 
87 // ************************************************************************* //
Foam::adaptiveLinear::relaxation
virtual scalar relaxation()
Return the current relaxation coefficient.
Foam::TimeState::timeOutputValue
scalar timeOutputValue() const
Return current time value.
Definition: TimeState.C:67
Foam::adaptiveLinear::adaptiveLinear
adaptiveLinear(const dictionary &relaxationDict, const Time &runTime)
Construct from components.
Foam::relaxationModel::runTime_
const Time & runTime_
Reference to the conformalVoronoiMesh holding this cvControls object.
Definition: relaxationModel.H:63
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
Foam::objectRegistry::time
const Time & time() const
Return time.
Definition: objectRegistry.H:117
Foam::dimensioned::value
const Type & value() const
Return const reference to value.
Definition: dimensionedType.C:261
Foam::adaptiveLinear::lastTimeValue_
scalar lastTimeValue_
Store the time when the last request was made for relaxation,.
Definition: adaptiveLinear.H:68
Foam::adaptiveLinear::relaxationEnd_
scalar relaxationEnd_
Relaxation coefficient at the end of the iteration sequence.
Definition: adaptiveLinear.H:63
Foam::adaptiveLinear::relaxation_
scalar relaxation_
Current relaxation value.
Definition: adaptiveLinear.H:71
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::readScalar
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if succesful.
Definition: doubleScalar.H:63
Foam::Time::endTime
virtual dimensionedScalar endTime() const
Return end time.
Definition: Time.C:878
adaptiveLinear.H
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
lookup
stressControl lookup("compactNormalStress") >> compactNormalStress