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
34 \*---------------------------------------------------------------------------*/
36 #ifndef pairPotential_H
37 #define pairPotential_H
39 #include "IOdictionary.H"
41 #include "runTimeSelectionTables.H"
46 #include "mathematicalConstants.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 // Forward declaration of classes
54 class energyScalingFunction;
56 /*---------------------------------------------------------------------------*\
57 Class pairPotential Declaration
58 \*---------------------------------------------------------------------------*/
68 dictionary pairPotentialProperties_;
76 List<scalar> forceLookup_;
77 List<scalar> energyLookup_;
79 mutable energyScalingFunction* esfPtr_;
84 // Private Member Functions
86 void scaleEnergy(scalar& e, const scalar r) const;
88 //- Disallow copy construct
89 pairPotential(const pairPotential&);
91 //- Disallow default bitwise assignment
92 void operator=(const pairPotential&);
97 //- Runtime type information
98 TypeName("pairPotential");
101 // Declare run-time constructor selection table
103 declareRunTimeSelectionTable
110 const dictionary& pairPotentialProperties
112 (name, pairPotentialProperties)
118 //- Return a reference to the selected viscosity model
119 static autoPtr<pairPotential> New
122 const dictionary& pairPotentialProperties
128 //- Construct from components
132 const dictionary& pairPotentialProperties
138 virtual ~pairPotential()
144 void setLookupTables();
146 inline scalar rMin() const;
148 inline scalar dr() const;
150 inline scalar rCut() const;
152 inline scalar rCutSqr() const;
154 scalar energy (const scalar r) const;
156 scalar force (const scalar r) const;
158 List<Pair<scalar> > energyTable() const;
160 List<Pair<scalar> > forceTable() const;
162 inline bool writeTables() const;
164 virtual scalar unscaledEnergy(const scalar r) const = 0;
166 scalar scaledEnergy(const scalar r) const;
168 scalar energyDerivative
171 const bool scaledEnergyDerivative = true
174 const dictionary& pairPotentialProperties() const
176 return pairPotentialProperties_;
179 bool writeEnergyAndForceTables(Ostream& os) const;
181 //- Read pairPotential dictionary
182 virtual bool read(const dictionary& pairPotentialProperties) = 0;
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 } // End namespace Foam
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 #include "pairPotentialI.H"
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 // ************************************************************************* //