FreeFOAM The Cross-Platform CFD Toolkit
pairPotential.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::pairPotential
26 
27 Description
28 
29 SourceFiles
30  pairPotential.C
31  newPairPotential.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef pairPotential_H
36 #define pairPotential_H
37 
38 #include <OpenFOAM/IOdictionary.H>
39 #include <OpenFOAM/typeInfo.H>
41 #include <OpenFOAM/autoPtr.H>
42 #include <OpenFOAM/List.H>
43 #include <OpenFOAM/Pair.H>
44 #include <OpenFOAM/Switch.H>
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward declaration of classes
53 class energyScalingFunction;
54 
55 /*---------------------------------------------------------------------------*\
56  Class pairPotential Declaration
57 \*---------------------------------------------------------------------------*/
58 
60 {
61 
62 protected:
63 
64  // Protected data
65 
68 
69  scalar rCut_;
70  scalar rCutSqr_;
71 
72  scalar rMin_;
73  scalar dr_;
74 
77 
79 
81 
82 
83  // Private Member Functions
84 
85  void scaleEnergy(scalar& e, const scalar r) const;
86 
87  //- Disallow copy construct
89 
90  //- Disallow default bitwise assignment
91  void operator=(const pairPotential&);
92 
93 
94 public:
95 
96  //- Runtime type information
97  TypeName("pairPotential");
98 
99 
100  // Declare run-time constructor selection table
101 
103  (
104  autoPtr,
106  dictionary,
107  (
108  const word& name,
110  ),
111  (name, pairPotentialProperties)
112  );
113 
114 
115  // Selectors
116 
117  //- Return a reference to the selected viscosity model
119  (
120  const word& name,
121  const dictionary& pairPotentialProperties
122  );
123 
124 
125  // Constructors
126 
127  //- Construct from components
129  (
130  const word& name,
131  const dictionary& pairPotentialProperties
132  );
133 
134 
135  // Destructor
136 
137  virtual ~pairPotential()
138  {}
139 
140 
141  // Member Functions
142 
143  void setLookupTables();
144 
145  inline scalar rMin() const;
146 
147  inline scalar dr() const;
148 
149  inline scalar rCut() const;
150 
151  inline scalar rCutSqr() const;
152 
153  scalar energy (const scalar r) const;
154 
155  scalar force (const scalar r) const;
156 
157  List<Pair<scalar> > energyTable() const;
158 
159  List<Pair<scalar> > forceTable() const;
160 
161  inline bool writeTables() const;
162 
163  virtual scalar unscaledEnergy(const scalar r) const = 0;
164 
165  scalar scaledEnergy(const scalar r) const;
166 
167  scalar energyDerivative
168  (
169  const scalar r,
170  const bool scaledEnergyDerivative = true
171  ) const;
172 
174  {
176  }
177 
178  bool writeEnergyAndForceTables(Ostream& os) const;
179 
180  //- Read pairPotential dictionary
181  virtual bool read(const dictionary& pairPotentialProperties) = 0;
182 };
183 
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace Foam
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #include "pairPotentialI.H"
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #endif
196 
197 // ************************ vim: set sw=4 sts=4 et: ************************ //