1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "doubleSigmoid.H"
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 namespace energyScalingFunctions
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 defineTypeNameAndDebug(doubleSigmoid, 0);
40 addToRunTimeSelectionTable
42 energyScalingFunction,
47 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
49 scalar doubleSigmoid::sigmoidScale
56 return 1.0 / (1.0 + exp( scale * (r - shift)));
60 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
62 doubleSigmoid::doubleSigmoid
65 const dictionary& energyScalingFunctionProperties,
66 const pairPotential& pairPot
69 energyScalingFunction(name, energyScalingFunctionProperties, pairPot),
72 energyScalingFunctionProperties.subDict(typeName + "Coeffs")
74 shift1_(readScalar(doubleSigmoidCoeffs_.lookup("shift1"))),
75 scale1_(readScalar(doubleSigmoidCoeffs_.lookup("scale1"))),
76 shift2_(readScalar(doubleSigmoidCoeffs_.lookup("shift2"))),
77 scale2_(readScalar(doubleSigmoidCoeffs_.lookup("scale2")))
81 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
83 void doubleSigmoid::scaleEnergy(scalar& e, const scalar r) const
85 e *= sigmoidScale(r, shift1_, scale1_) * sigmoidScale(r, shift2_, scale2_);
89 bool doubleSigmoid::read(const dictionary& energyScalingFunctionProperties)
91 energyScalingFunction::read(energyScalingFunctionProperties);
93 doubleSigmoidCoeffs_ =
94 energyScalingFunctionProperties.subDict(typeName + "Coeffs");
96 doubleSigmoidCoeffs_.lookup("shift1") >> shift1_;
97 doubleSigmoidCoeffs_.lookup("scale1") >> scale1_;
98 doubleSigmoidCoeffs_.lookup("shift2") >> shift2_;
99 doubleSigmoidCoeffs_.lookup("scale2") >> scale2_;
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107 } // End namespace energyScalingFunctions
108 } // End namespace Foam
110 // ************************************************************************* //