diff --git a/src/lagrangian/molecularDynamics/potential/Make/files b/src/lagrangian/molecularDynamics/potential/Make/files index 1c13e838dd..7b16b6e2b6 100644 --- a/src/lagrangian/molecularDynamics/potential/Make/files +++ b/src/lagrangian/molecularDynamics/potential/Make/files @@ -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 diff --git a/src/lagrangian/molecularDynamics/potential/electrostaticPotential/electrostaticPotential.C b/src/lagrangian/molecularDynamics/potential/electrostaticPotential/electrostaticPotential.C new file mode 100644 index 0000000000..83b0694849 --- /dev/null +++ b/src/lagrangian/molecularDynamics/potential/electrostaticPotential/electrostaticPotential.C @@ -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); +} + + +// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/potential/electrostaticPotential/electrostaticPotential.H b/src/lagrangian/molecularDynamics/potential/electrostaticPotential/electrostaticPotential.H new file mode 100644 index 0000000000..03071f6657 --- /dev/null +++ b/src/lagrangian/molecularDynamics/potential/electrostaticPotential/electrostaticPotential.H @@ -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 + +// ************************************************************************* // diff --git a/src/lagrangian/molecularDynamics/potential/potential/potential.H b/src/lagrangian/molecularDynamics/potential/potential/potential.H index 6941961f12..fc7430bf0c 100644 --- a/src/lagrangian/molecularDynamics/potential/potential/potential.H +++ b/src/lagrangian/molecularDynamics/potential/potential/potential.H @@ -40,6 +40,7 @@ SourceFiles #include "IOdictionary.H" #include "Time.H" #include "pairPotentialList.H" +#include "electrostaticPotential.H" #include "tetherPotentialList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //