OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

pairPotential.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 2008-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::pairPotential
00027 
00028 Description
00029 
00030 SourceFiles
00031     pairPotential.C
00032     newPairPotential.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef pairPotential_H
00037 #define pairPotential_H
00038 
00039 #include "IOdictionary.H"
00040 #include "typeInfo.H"
00041 #include "runTimeSelectionTables.H"
00042 #include "autoPtr.H"
00043 #include "List.H"
00044 #include "Pair.H"
00045 #include "Switch.H"
00046 #include "mathematicalConstants.H"
00047 
00048 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00049 
00050 namespace Foam
00051 {
00052 
00053 // Forward declaration of classes
00054 class energyScalingFunction;
00055 
00056 /*---------------------------------------------------------------------------*\
00057                      Class pairPotential Declaration
00058 \*---------------------------------------------------------------------------*/
00059 
00060 class pairPotential
00061 {
00062 
00063 protected:
00064 
00065     // Protected data
00066 
00067         word name_;
00068         dictionary pairPotentialProperties_;
00069 
00070         scalar rCut_;
00071         scalar rCutSqr_;
00072 
00073         scalar rMin_;
00074         scalar dr_;
00075 
00076         List<scalar> forceLookup_;
00077         List<scalar> energyLookup_;
00078 
00079         mutable energyScalingFunction* esfPtr_;
00080 
00081         bool writeTables_;
00082 
00083 
00084     // Private Member Functions
00085 
00086         void scaleEnergy(scalar& e, const scalar r) const;
00087 
00088         //- Disallow copy construct
00089         pairPotential(const pairPotential&);
00090 
00091         //- Disallow default bitwise assignment
00092         void operator=(const pairPotential&);
00093 
00094 
00095 public:
00096 
00097     //- Runtime type information
00098         TypeName("pairPotential");
00099 
00100 
00101     // Declare run-time constructor selection table
00102 
00103         declareRunTimeSelectionTable
00104         (
00105             autoPtr,
00106             pairPotential,
00107             dictionary,
00108             (
00109                 const word& name,
00110                 const dictionary& pairPotentialProperties
00111             ),
00112             (name, pairPotentialProperties)
00113         );
00114 
00115 
00116     // Selectors
00117 
00118         //- Return a reference to the selected viscosity model
00119         static autoPtr<pairPotential> New
00120         (
00121             const word& name,
00122             const dictionary& pairPotentialProperties
00123         );
00124 
00125 
00126     // Constructors
00127 
00128         //- Construct from components
00129         pairPotential
00130         (
00131             const word& name,
00132             const dictionary& pairPotentialProperties
00133         );
00134 
00135 
00136     // Destructor
00137 
00138         virtual ~pairPotential()
00139         {}
00140 
00141 
00142     // Member Functions
00143 
00144         void setLookupTables();
00145 
00146         inline scalar rMin() const;
00147 
00148         inline scalar dr() const;
00149 
00150         inline scalar rCut() const;
00151 
00152         inline scalar rCutSqr() const;
00153 
00154         scalar energy (const scalar r) const;
00155 
00156         scalar force (const scalar r) const;
00157 
00158         List<Pair<scalar> > energyTable() const;
00159 
00160         List<Pair<scalar> > forceTable() const;
00161 
00162         inline bool writeTables() const;
00163 
00164         virtual scalar unscaledEnergy(const scalar r) const = 0;
00165 
00166         scalar scaledEnergy(const scalar r) const;
00167 
00168         scalar energyDerivative
00169         (
00170             const scalar r,
00171             const bool scaledEnergyDerivative = true
00172         ) const;
00173 
00174         const dictionary& pairPotentialProperties() const
00175         {
00176             return pairPotentialProperties_;
00177         }
00178 
00179         bool writeEnergyAndForceTables(Ostream& os) const;
00180 
00181         //- Read pairPotential dictionary
00182         virtual bool read(const dictionary& pairPotentialProperties) = 0;
00183 };
00184 
00185 
00186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00187 
00188 } // End namespace Foam
00189 
00190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00191 
00192 #include "pairPotentialI.H"
00193 
00194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00195 
00196 #endif
00197 
00198 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd