BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / lagrangian / molecularDynamics / potential / energyScalingFunction / derived / doubleSigmoid / doubleSigmoid.C
blobaed42de82595232ff5f98476882822aa819f3366
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 namespace Foam
33 namespace energyScalingFunctions
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 defineTypeNameAndDebug(doubleSigmoid, 0);
40 addToRunTimeSelectionTable
42     energyScalingFunction,
43     doubleSigmoid,
44     dictionary
47 // * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //
49 scalar doubleSigmoid::sigmoidScale
50     (
51         const scalar r,
52         const scalar shift,
53         const scalar scale
54     ) const
56     return 1.0 / (1.0 + exp( scale * (r - shift)));
60 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
62 doubleSigmoid::doubleSigmoid
64     const word& name,
65     const dictionary& energyScalingFunctionProperties,
66     const pairPotential& pairPot
69     energyScalingFunction(name, energyScalingFunctionProperties, pairPot),
70     doubleSigmoidCoeffs_
71     (
72         energyScalingFunctionProperties.subDict(typeName + "Coeffs")
73     ),
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_;
101     return true;
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107 } // End namespace energyScalingFunctions
108 } // End namespace Foam
110 // ************************************************************************* //