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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::pairPotential
29
30Description
31
32SourceFiles
33 pairPotential.C
34 pairPotentialNew.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef pairPotential_H
39#define pairPotential_H
40
41#include "IOdictionary.H"
42#include "typeInfo.H"
44#include "autoPtr.H"
45#include "List.H"
46#include "Pair.H"
47#include "Switch.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53
54// Forward declaration of classes
55class energyScalingFunction;
56
57/*---------------------------------------------------------------------------*\
58 Class pairPotential Declaration
59\*---------------------------------------------------------------------------*/
61class pairPotential
62{
63
64protected:
65
66 // Protected member data
71 scalar rCut_;
72 scalar rCutSqr_;
74 scalar rMin_;
75 scalar dr_;
82 bool writeTables_;
83
84
85 // Protected member functions
86
87 void scaleEnergy(scalar& e, const scalar r) const;
88
89 //- No copy construct
90 pairPotential(const pairPotential&) = delete;
91
92 //- No copy assignment
93 void operator=(const pairPotential&) = delete;
94
95
96public:
97
98 //- Runtime type information
99 TypeName("pairPotential");
100
101
102 // Declare run-time constructor selection table
105 (
106 autoPtr,
109 (
110 const word& name,
112 ),
114 );
115
116
117 // Selectors
118
119 //- Return a reference to the selected viscosity model
121 (
122 const word& name,
124 );
125
126
127 // Constructors
128
129 //- Construct from components
131 (
132 const word& name,
134 );
135
136
137 //- Destructor
138 virtual ~pairPotential() = default;
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
158
160
161 inline bool writeTables() const;
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;
174 {
176 }
177
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// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
pairPotential(const pairPotential &)=delete
No copy construct.
bool writeEnergyAndForceTables(Ostream &os) const
virtual ~pairPotential()=default
Destructor.
virtual bool read(const dictionary &pairPotentialProperties)=0
Read pairPotential dictionary.
scalar dr() const
scalar energy(const scalar r) const
const dictionary & pairPotentialProperties() const
bool writeTables() const
static autoPtr< pairPotential > New(const word &name, const dictionary &pairPotentialProperties)
Return a reference to the selected viscosity model.
energyScalingFunction * esfPtr_
Definition: pairPotential.H:79
scalar energyDerivative(const scalar r, const bool scaledEnergyDerivative=true) const
List< scalar > energyLookup_
Definition: pairPotential.H:77
scalar rMin() const
void scaleEnergy(scalar &e, const scalar r) const
Definition: pairPotential.C:42
scalar rCutSqr() const
void operator=(const pairPotential &)=delete
No copy assignment.
List< Pair< scalar > > energyTable() const
List< scalar > forceLookup_
Definition: pairPotential.H:76
scalar rCut() const
virtual scalar unscaledEnergy(const scalar r) const =0
TypeName("pairPotential")
Runtime type information.
List< Pair< scalar > > forceTable() const
scalar scaledEnergy(const scalar r) const
dictionary pairPotentialProperties_
Definition: pairPotential.H:68
scalar force(const scalar r) const
Definition: pairPotential.C:96
declareRunTimeSelectionTable(autoPtr, pairPotential, dictionary,(const word &name, const dictionary &pairPotentialProperties),(name, pairPotentialProperties))
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
volScalarField & e
Definition: createFields.H:11
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73