fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / lagrangian / molecularDynamics / potential / pairPotential / basic / pairPotential.H
blob7f00308f0bcabda131fcfb54ed3e07dfb0a0d9a3
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 Class
26     Foam::pairPotential
28 Description
30 SourceFiles
31     pairPotential.C
32     newPairPotential.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef pairPotential_H
37 #define pairPotential_H
39 #include "IOdictionary.H"
40 #include "typeInfo.H"
41 #include "runTimeSelectionTables.H"
42 #include "autoPtr.H"
43 #include "List.H"
44 #include "Pair.H"
45 #include "Switch.H"
46 #include "mathematicalConstants.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 namespace Foam
53 // Forward declaration of classes
54 class energyScalingFunction;
56 /*---------------------------------------------------------------------------*\
57                      Class pairPotential Declaration
58 \*---------------------------------------------------------------------------*/
60 class pairPotential
63 protected:
65     // Protected data
67         word name_;
68         dictionary pairPotentialProperties_;
70         scalar rCut_;
71         scalar rCutSqr_;
73         scalar rMin_;
74         scalar dr_;
76         List<scalar> forceLookup_;
77         List<scalar> energyLookup_;
79         mutable energyScalingFunction* esfPtr_;
81         bool writeTables_;
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&);
95 public:
97     //- Runtime type information
98         TypeName("pairPotential");
101     // Declare run-time constructor selection table
103         declareRunTimeSelectionTable
104         (
105             autoPtr,
106             pairPotential,
107             dictionary,
108             (
109                 const word& name,
110                 const dictionary& pairPotentialProperties
111             ),
112             (name, pairPotentialProperties)
113         );
116     // Selectors
118         //- Return a reference to the selected viscosity model
119         static autoPtr<pairPotential> New
120         (
121             const word& name,
122             const dictionary& pairPotentialProperties
123         );
126     // Constructors
128         //- Construct from components
129         pairPotential
130         (
131             const word& name,
132             const dictionary& pairPotentialProperties
133         );
136     // Destructor
138         virtual ~pairPotential()
139         {}
142     // Member Functions
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
169         (
170             const scalar r,
171             const bool scaledEnergyDerivative = true
172         ) const;
174         const dictionary& pairPotentialProperties() const
175         {
176             return pairPotentialProperties_;
177         }
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 #endif
198 // ************************************************************************* //