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-2019 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 
87 public:
88 
89  //- Runtime type information
90  TypeName("pairPotential");
91 
92 
93  // Declare run-time constructor selection table
94 
96  (
97  autoPtr,
99  dictionary,
100  (
101  const word& name,
103  ),
104  (name, pairPotentialProperties)
105  );
106 
107 
108  // Selectors
109 
110  //- Return a reference to the selected viscosity model
112  (
113  const word& name,
114  const dictionary& pairPotentialProperties
115  );
116 
117 
118  // Constructors
119 
120  //- Construct from components
122  (
123  const word& name,
124  const dictionary& pairPotentialProperties
125  );
126 
127  //- Disallow default bitwise copy construction
129 
130 
131  //- Destructor
132  virtual ~pairPotential()
133  {}
134 
135 
136  // Member Functions
137 
138  void setLookupTables();
139 
140  inline scalar rMin() const;
141 
142  inline scalar dr() const;
143 
144  inline scalar rCut() const;
145 
146  inline scalar rCutSqr() const;
147 
148  scalar energy (const scalar r) const;
149 
150  scalar force (const scalar r) const;
151 
153 
154  List<Pair<scalar>> forceTable() const;
155 
156  inline bool writeTables() const;
157 
158  virtual scalar unscaledEnergy(const scalar r) const = 0;
159 
160  scalar scaledEnergy(const scalar r) const;
161 
162  scalar energyDerivative
163  (
164  const scalar r,
165  const bool scaledEnergyDerivative = true
166  ) const;
168  const dictionary& pairPotentialProperties() const
169  {
171  }
172 
173  bool writeEnergyAndForceTables(Ostream& os) const;
174 
175  //- Read pairPotential dictionary
176  virtual bool read(const dictionary& pairPotentialProperties) = 0;
177 
178 
179  // Member Operators
180 
181  //- Disallow default bitwise assignment
182  void operator=(const pairPotential&) = delete;
183 };
184 
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 } // End namespace Foam
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #include "pairPotentialI.H"
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 #endif
197 
198 // ************************************************************************* //
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:158
virtual bool read(const dictionary &pairPotentialProperties)=0
Read pairPotential dictionary.
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
pairPotential(const word &name, const dictionary &pairPotentialProperties)
Construct from components.
Definition: pairPotential.C:57
List< scalar > forceLookup_
Definition: pairPotential.H:73
scalar rCutSqr() const
A class for handling words, derived from string.
Definition: word.H:59
void operator=(const pairPotential &)=delete
Disallow default bitwise assignment.
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:54
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:105
Macros to ease declaration of run-time selection tables.
scalar rCut() const
scalar scaledEnergy(const scalar r) const
Namespace for OpenFOAM.