1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
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/>.
33 \*---------------------------------------------------------------------------*/
35 #ifndef pairPotential_H
36 #define pairPotential_H
38 #include "IOdictionary.H"
40 #include "runTimeSelectionTables.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 // Forward declaration of classes
52 class energyScalingFunction;
54 /*---------------------------------------------------------------------------*\
55 Class pairPotential Declaration
56 \*---------------------------------------------------------------------------*/
66 dictionary pairPotentialProperties_;
74 List<scalar> forceLookup_;
75 List<scalar> energyLookup_;
77 mutable energyScalingFunction* esfPtr_;
82 // Private Member Functions
84 void scaleEnergy(scalar& e, const scalar r) const;
86 //- Disallow copy construct
87 pairPotential(const pairPotential&);
89 //- Disallow default bitwise assignment
90 void operator=(const pairPotential&);
95 //- Runtime type information
96 TypeName("pairPotential");
99 // Declare run-time constructor selection table
101 declareRunTimeSelectionTable
108 const dictionary& pairPotentialProperties
110 (name, pairPotentialProperties)
116 //- Return a reference to the selected viscosity model
117 static autoPtr<pairPotential> New
120 const dictionary& pairPotentialProperties
126 //- Construct from components
130 const dictionary& pairPotentialProperties
135 virtual ~pairPotential()
141 void setLookupTables();
143 inline scalar rMin() const;
145 inline scalar dr() const;
147 inline scalar rCut() const;
149 inline scalar rCutSqr() const;
151 scalar energy (const scalar r) const;
153 scalar force (const scalar r) const;
155 List<Pair<scalar> > energyTable() const;
157 List<Pair<scalar> > forceTable() const;
159 inline bool writeTables() const;
161 virtual scalar unscaledEnergy(const scalar r) const = 0;
163 scalar scaledEnergy(const scalar r) const;
165 scalar energyDerivative
168 const bool scaledEnergyDerivative = true
171 const dictionary& pairPotentialProperties() const
173 return pairPotentialProperties_;
176 bool writeEnergyAndForceTables(Ostream& os) const;
178 //- Read pairPotential dictionary
179 virtual bool read(const dictionary& pairPotentialProperties) = 0;
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 } // End namespace Foam
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 #include "pairPotentialI.H"
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 // ************************************************************************* //