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) 2011 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 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  // Private 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  ),
111  );
112 
113 
114  // Selectors
115 
116  //- Return a reference to the selected viscosity model
118  (
119  const word& name,
121  );
122 
123 
124  // Constructors
125 
126  //- Construct from components
128  (
129  const word& name,
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 
155  List<Pair<scalar> > energyTable() const;
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;
170 
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 // ************************************************************************* //
Foam::pairPotential::New
static autoPtr< pairPotential > New(const word &name, const dictionary &pairPotentialProperties)
Return a reference to the selected viscosity model.
Definition: pairPotentialNew.C:32
Foam::pairPotential::dr_
scalar dr_
Definition: pairPotential.H:71
Foam::pairPotential::writeTables_
bool writeTables_
Definition: pairPotential.H:78
Foam::pairPotential::scaleEnergy
void scaleEnergy(scalar &e, const scalar r) const
Definition: pairPotential.C:41
Foam::pairPotential::esfPtr_
energyScalingFunction * esfPtr_
Definition: pairPotential.H:76
Foam::pairPotential::name_
word name_
Definition: pairPotential.H:64
List.H
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
typeInfo.H
Foam::pairPotential::rCutSqr
scalar rCutSqr() const
Definition: pairPotentialI.H:46
Foam::pairPotential::TypeName
TypeName("pairPotential")
Runtime type information.
Foam::pairPotential::energyTable
List< Pair< scalar > > energyTable() const
Definition: pairPotential.C:154
pairPotentialI.H
Foam::pairPotential::force
scalar force(const scalar r) const
Definition: pairPotential.C:95
Pair.H
Foam::pairPotential::energy
scalar energy(const scalar r) const
Definition: pairPotential.C:132
Foam::pairPotential::forceTable
List< Pair< scalar > > forceTable() const
Definition: pairPotential.C:117
Foam::pairPotential::rCut
scalar rCut() const
Definition: pairPotentialI.H:40
Foam::pairPotential::rMin
scalar rMin() const
Definition: pairPotentialI.H:28
Foam::pairPotential::setLookupTables
void setLookupTables()
Definition: pairPotential.C:78
Foam::pairPotential::rCut_
scalar rCut_
Definition: pairPotential.H:67
Switch.H
Foam::pairPotential::pairPotentialProperties_
dictionary pairPotentialProperties_
Definition: pairPotential.H:65
Foam::pairPotential::energyDerivative
scalar energyDerivative(const scalar r, const bool scaledEnergyDerivative=true) const
Definition: pairPotential.C:180
Foam::pairPotential::forceLookup_
List< scalar > forceLookup_
Definition: pairPotential.H:73
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::pairPotential::~pairPotential
virtual ~pairPotential()
Destructor.
Definition: pairPotential.H:134
Foam::pairPotential
Definition: pairPotential.H:57
Foam::pairPotential::pairPotentialProperties
const dictionary & pairPotentialProperties() const
Definition: pairPotential.H:170
Foam::pairPotential::rCutSqr_
scalar rCutSqr_
Definition: pairPotential.H:68
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::e
const double e
Elementary charge.
Definition: doubleFloat.H:94
IOdictionary.H
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::pairPotential::unscaledEnergy
virtual scalar unscaledEnergy(const scalar r) const =0
Foam::pairPotential::dr
scalar dr() const
Definition: pairPotentialI.H:34
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::pairPotential::operator=
void operator=(const pairPotential &)
Disallow default bitwise assignment.
Foam::List< scalar >
Foam::pairPotential::read
virtual bool read(const dictionary &pairPotentialProperties)=0
Read pairPotential dictionary.
Definition: pairPotential.C:223
Foam::pairPotential::rMin_
scalar rMin_
Definition: pairPotential.H:70
Foam::pairPotential::scaledEnergy
scalar scaledEnergy(const scalar r) const
Definition: pairPotential.C:169
Foam::pairPotential::pairPotential
pairPotential(const pairPotential &)
Disallow copy construct.
Foam::energyScalingFunction
Definition: energyScalingFunction.H:52
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::pairPotential::energyLookup_
List< scalar > energyLookup_
Definition: pairPotential.H:74
Foam::pairPotential::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, pairPotential, dictionary,(const word &name, const dictionary &pairPotentialProperties),(name, pairPotentialProperties))
Foam::pairPotential::writeTables
bool writeTables() const
Definition: pairPotentialI.H:52
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Foam::pairPotential::writeEnergyAndForceTables
bool writeEnergyAndForceTables(Ostream &os) const
Definition: pairPotentialIO.C:29
autoPtr.H