1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "doubleSigmoid.H"
28 #include "addToRunTimeSelectionTable.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 namespace energyScalingFunctions
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 defineTypeNameAndDebug(doubleSigmoid, 0);
41 addToRunTimeSelectionTable
43 energyScalingFunction,
48 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
50 scalar doubleSigmoid::sigmoidScale
57 return 1.0 / (1.0 + exp( scale * (r - shift)));
61 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
63 doubleSigmoid::doubleSigmoid
66 const dictionary& energyScalingFunctionProperties,
67 const pairPotential& pairPot
70 energyScalingFunction(name, energyScalingFunctionProperties, pairPot),
73 energyScalingFunctionProperties.subDict(typeName + "Coeffs")
75 shift1_(readScalar(doubleSigmoidCoeffs_.lookup("shift1"))),
76 scale1_(readScalar(doubleSigmoidCoeffs_.lookup("scale1"))),
77 shift2_(readScalar(doubleSigmoidCoeffs_.lookup("shift2"))),
78 scale2_(readScalar(doubleSigmoidCoeffs_.lookup("scale2")))
82 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
84 void doubleSigmoid::scaleEnergy(scalar& e, const scalar r) const
86 e *= sigmoidScale(r, shift1_, scale1_) * sigmoidScale(r, shift2_, scale2_);
90 bool doubleSigmoid::read(const dictionary& energyScalingFunctionProperties)
92 energyScalingFunction::read(energyScalingFunctionProperties);
94 doubleSigmoidCoeffs_ =
95 energyScalingFunctionProperties.subDict(typeName + "Coeffs");
97 doubleSigmoidCoeffs_.lookup("shift1") >> shift1_;
98 doubleSigmoidCoeffs_.lookup("scale1") >> scale1_;
99 doubleSigmoidCoeffs_.lookup("shift2") >> shift2_;
100 doubleSigmoidCoeffs_.lookup("scale2") >> scale2_;
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 } // End namespace energyScalingFunctions
109 } // End namespace Foam
111 // ************************************************************************* //