Added electrostaticPotential class.

This commit is contained in:
graham
2008-11-17 18:17:39 +00:00
parent 1f7747776c
commit d833730eaa
4 changed files with 145 additions and 0 deletions

View File

@ -39,4 +39,8 @@ $(tetherPotential)/derived/harmonicSpring/harmonicSpring.C
$(tetherPotential)/derived/restrainedHarmonicSpring/restrainedHarmonicSpring.C
$(tetherPotential)/derived/pitchForkRing/pitchForkRing.C
electrostaticPotential = electrostaticPotential
$(electrostaticPotential)/electrostaticPotential.C
LIB = $(FOAM_LIBBIN)/libpotential

View File

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "electrostaticPotential.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::electrostaticPotential::electrostaticPotential()
:
prefactor(1.0/(4.0 * mathematicalConstant::pi * 8.854187817e-12))
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::scalar Foam::electrostaticPotential::energy(const scalar rSqr) const
{
return prefactor/sqrt(rSqr);
}
Foam::scalar Foam::electrostaticPotential::force(const scalar rSqr) const
{
return prefactor/(rSqr);
}
// ************************************************************************* //

View File

@ -0,0 +1,87 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::pairPotentials::electrostaticPotential
Description
SourceFiles
electrostaticPotential.C
\*---------------------------------------------------------------------------*/
#ifndef electrostaticPotential_H
#define electrostaticPotential_H
#include "scalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class electrostaticPotential Declaration
\*---------------------------------------------------------------------------*/
class electrostaticPotential
{
// Private data
scalar prefactor;
public:
// Constructors
//- Construct and set prefactor
electrostaticPotential();
// Destructor
~electrostaticPotential()
{}
// Member Functions
scalar energy(const scalar rSqr) const;
scalar force(const scalar rSqr) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -40,6 +40,7 @@ SourceFiles
#include "IOdictionary.H"
#include "Time.H"
#include "pairPotentialList.H"
#include "electrostaticPotential.H"
#include "tetherPotentialList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //