pairPotential.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
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  pairPotentialNew.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef pairPotential_H
36 #define pairPotential_H
37 
38 #include "IOdictionary.H"
39 #include "typeInfo.H"
40 #include "runTimeSelectionTables.H"
41 #include "autoPtr.H"
42 #include "List.H"
43 #include "Pair.H"
44 #include "Switch.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward declaration of classes
52 class energyScalingFunction;
53 
54 /*---------------------------------------------------------------------------*\
55  Class pairPotential Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class pairPotential
59 {
60 
61 protected:
62 
63  // Protected member data
64 
67 
68  scalar rCut_;
69  scalar rCutSqr_;
70 
71  scalar rMin_;
72  scalar dr_;
73 
76 
78 
79  bool writeTables_;
80 
81 
82  // Protected member functions
83 
84  void scaleEnergy(scalar& e, const scalar r) const;
85 
86  //- Disallow copy construct
88 
89  //- Disallow default bitwise assignment
90  void operator=(const pairPotential&);
91 
92 
93 public:
94 
95  //- Runtime type information
96  TypeName("pairPotential");
97 
98 
99  // Declare run-time constructor selection table
100 
102  (
103  autoPtr,
105  dictionary,
106  (
107  const word& name,
109  ),
110  (name, pairPotentialProperties)
111  );
112 
113 
114  // Selectors
115 
116  //- Return a reference to the selected viscosity model
118  (
119  const word& name,
120  const dictionary& pairPotentialProperties
121  );
122 
123 
124  // Constructors
125 
126  //- Construct from components
128  (
129  const word& name,
130  const dictionary& pairPotentialProperties
131  );
132 
133 
134  //- Destructor
135  virtual ~pairPotential()
136  {}
137 
138 
139  // Member Functions
140 
141  void setLookupTables();
142 
143  inline scalar rMin() const;
144 
145  inline scalar dr() const;
146 
147  inline scalar rCut() const;
148 
149  inline scalar rCutSqr() const;
150 
151  scalar energy (const scalar r) const;
152 
153  scalar force (const scalar r) const;
154 
156 
157  List<Pair<scalar>> forceTable() const;
158 
159  inline bool writeTables() const;
160 
161  virtual scalar unscaledEnergy(const scalar r) const = 0;
162 
163  scalar scaledEnergy(const scalar r) const;
164 
165  scalar energyDerivative
166  (
167  const scalar r,
168  const bool scaledEnergyDerivative = true
169  ) const;
171  const dictionary& pairPotentialProperties() const
172  {
174  }
175 
176  bool writeEnergyAndForceTables(Ostream& os) const;
177 
178  //- Read pairPotential dictionary
179  virtual bool read(const dictionary& pairPotentialProperties) = 0;
180 };
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace Foam
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #include "pairPotentialI.H"
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 #endif
194 
195 // ************************************************************************* //
scalar rMin() const
TypeName("pairPotential")
Runtime type information.
static autoPtr< pairPotential > New(const word &name, const dictionary &pairPotentialProperties)
Return a reference to the selected viscosity model.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual bool read(const dictionary &pairPotentialProperties)=0
Read pairPotential dictionary.
pairPotential(const pairPotential &)
Disallow copy construct.
scalar energyDerivative(const scalar r, const bool scaledEnergyDerivative=true) const
bool writeEnergyAndForceTables(Ostream &os) const
List< Pair< scalar > > forceTable() const
scalar energy(const scalar r) const
energyScalingFunction * esfPtr_
Definition: pairPotential.H:76
List< scalar > energyLookup_
Definition: pairPotential.H:74
List< scalar > forceLookup_
Definition: pairPotential.H:73
scalar rCutSqr() const
A class for handling words, derived from string.
Definition: word.H:59
scalar force(const scalar r) const
Definition: pairPotential.C:94
const dictionary & pairPotentialProperties() const
bool writeTables() const
declareRunTimeSelectionTable(autoPtr, pairPotential, dictionary,(const word &name, const dictionary &pairPotentialProperties),(name, pairPotentialProperties))
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
void operator=(const pairPotential &)
Disallow default bitwise assignment.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
virtual ~pairPotential()
Destructor.
List< Pair< scalar > > energyTable() const
dictionary pairPotentialProperties_
Definition: pairPotential.H:65
void scaleEnergy(scalar &e, const scalar r) const
Definition: pairPotential.C:40
virtual scalar unscaledEnergy(const scalar r) const =0
scalar dr() const
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
const doubleScalar e
Elementary charge.
Definition: doubleScalar.H:98
Macros to ease declaration of run-time selection tables.
scalar rCut() const
scalar scaledEnergy(const scalar r) const
Namespace for OpenFOAM.