fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / lagrangian / molecularDynamics / potential / energyScalingFunction / derived / doubleSigmoid / doubleSigmoid.C
blob955792fcae2e4d9b300971aa0cddb90adb7ddfef
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
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 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
19     for more details.
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 namespace Foam
34 namespace energyScalingFunctions
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39 defineTypeNameAndDebug(doubleSigmoid, 0);
41 addToRunTimeSelectionTable
43     energyScalingFunction,
44     doubleSigmoid,
45     dictionary
48 // * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //
50 scalar doubleSigmoid::sigmoidScale
51     (
52         const scalar r,
53         const scalar shift,
54         const scalar scale
55     ) const
57     return 1.0 / (1.0 + exp( scale * (r - shift)));
61 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
63 doubleSigmoid::doubleSigmoid
65     const word& name,
66     const dictionary& energyScalingFunctionProperties,
67     const pairPotential& pairPot
70     energyScalingFunction(name, energyScalingFunctionProperties, pairPot),
71     doubleSigmoidCoeffs_
72     (
73         energyScalingFunctionProperties.subDict(typeName + "Coeffs")
74     ),
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_;
102     return true;
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 } // End namespace energyScalingFunctions
109 } // End namespace Foam
111 // ************************************************************************* //