FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::pairPotential
00026 
00027 Description
00028 
00029 SourceFiles
00030     pairPotential.C
00031     newPairPotential.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef pairPotential_H
00036 #define pairPotential_H
00037 
00038 #include <OpenFOAM/IOdictionary.H>
00039 #include <OpenFOAM/typeInfo.H>
00040 #include <OpenFOAM/runTimeSelectionTables.H>
00041 #include <OpenFOAM/autoPtr.H>
00042 #include <OpenFOAM/List.H>
00043 #include <OpenFOAM/Pair.H>
00044 #include <OpenFOAM/Switch.H>
00045 #include <OpenFOAM/mathematicalConstants.H>
00046 
00047 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00048 
00049 namespace Foam
00050 {
00051 
00052 // Forward declaration of classes
00053 class energyScalingFunction;
00054 
00055 /*---------------------------------------------------------------------------*\
00056                      Class pairPotential Declaration
00057 \*---------------------------------------------------------------------------*/
00058 
00059 class pairPotential
00060 {
00061 
00062 protected:
00063 
00064     // Protected data
00065 
00066         word name_;
00067         dictionary pairPotentialProperties_;
00068 
00069         scalar rCut_;
00070         scalar rCutSqr_;
00071 
00072         scalar rMin_;
00073         scalar dr_;
00074 
00075         List<scalar> forceLookup_;
00076         List<scalar> energyLookup_;
00077 
00078         mutable energyScalingFunction* esfPtr_;
00079 
00080         bool writeTables_;
00081 
00082 
00083     // Private Member Functions
00084 
00085         void scaleEnergy(scalar& e, const scalar r) const;
00086 
00087         //- Disallow copy construct
00088         pairPotential(const pairPotential&);
00089 
00090         //- Disallow default bitwise assignment
00091         void operator=(const pairPotential&);
00092 
00093 
00094 public:
00095 
00096     //- Runtime type information
00097         TypeName("pairPotential");
00098 
00099 
00100     // Declare run-time constructor selection table
00101 
00102         declareRunTimeSelectionTable
00103         (
00104             autoPtr,
00105             pairPotential,
00106             dictionary,
00107             (
00108                 const word& name,
00109                 const dictionary& pairPotentialProperties
00110             ),
00111             (name, pairPotentialProperties)
00112         );
00113 
00114 
00115     // Selectors
00116 
00117         //- Return a reference to the selected viscosity model
00118         static autoPtr<pairPotential> New
00119         (
00120             const word& name,
00121             const dictionary& pairPotentialProperties
00122         );
00123 
00124 
00125     // Constructors
00126 
00127         //- Construct from components
00128         pairPotential
00129         (
00130             const word& name,
00131             const dictionary& pairPotentialProperties
00132         );
00133 
00134 
00135     // Destructor
00136 
00137         virtual ~pairPotential()
00138         {}
00139 
00140 
00141     // Member Functions
00142 
00143         void setLookupTables();
00144 
00145         inline scalar rMin() const;
00146 
00147         inline scalar dr() const;
00148 
00149         inline scalar rCut() const;
00150 
00151         inline scalar rCutSqr() const;
00152 
00153         scalar energy (const scalar r) const;
00154 
00155         scalar force (const scalar r) const;
00156 
00157         List<Pair<scalar> > energyTable() const;
00158 
00159         List<Pair<scalar> > forceTable() const;
00160 
00161         inline bool writeTables() const;
00162 
00163         virtual scalar unscaledEnergy(const scalar r) const = 0;
00164 
00165         scalar scaledEnergy(const scalar r) const;
00166 
00167         scalar energyDerivative
00168         (
00169             const scalar r,
00170             const bool scaledEnergyDerivative = true
00171         ) const;
00172 
00173         const dictionary& pairPotentialProperties() const
00174         {
00175             return pairPotentialProperties_;
00176         }
00177 
00178         bool writeEnergyAndForceTables(Ostream& os) const;
00179 
00180         //- Read pairPotential dictionary
00181         virtual bool read(const dictionary& pairPotentialProperties) = 0;
00182 };
00183 
00184 
00185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00186 
00187 } // End namespace Foam
00188 
00189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00190 
00191 #include "pairPotentialI.H"
00192 
00193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00194 
00195 #endif
00196 
00197 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines