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

pitchForkRing.C

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 \*---------------------------------------------------------------------------*/
00025 
00026 #include "pitchForkRing.H"
00027 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00028 
00029 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033 namespace tetherPotentials
00034 {
00035 
00036 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00037 
00038 defineTypeNameAndDebug(pitchForkRing, 0);
00039 
00040 addToRunTimeSelectionTable
00041 (
00042     tetherPotential,
00043     pitchForkRing,
00044     dictionary
00045 );
00046 
00047 
00048 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00049 
00050 pitchForkRing::pitchForkRing
00051 (
00052     const word& name,
00053     const dictionary& tetherPotentialProperties
00054 )
00055 :
00056     tetherPotential(name, tetherPotentialProperties),
00057     pitchForkRingCoeffs_
00058     (
00059         tetherPotentialProperties.subDict(typeName + "Coeffs")
00060     ),
00061     mu_(readScalar(pitchForkRingCoeffs_.lookup("mu"))),
00062     alpha_(readScalar(pitchForkRingCoeffs_.lookup("alpha"))),
00063     rOrbit_(readScalar(pitchForkRingCoeffs_.lookup("rOrbit")))
00064 {}
00065 
00066 
00067 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
00068 
00069 scalar pitchForkRing::energy(const vector r) const
00070 {
00071     scalar p = sqrt(r.x()*r.x() + r.y()*r.y());
00072 
00073     scalar pMinusRSqr = (p - rOrbit_)*(p - rOrbit_);
00074 
00075     return -0.5 * mu_ * pMinusRSqr
00076       + 0.25 * pMinusRSqr * pMinusRSqr
00077       + 0.5 * alpha_ * r.z() * r.z();
00078 }
00079 
00080 
00081 vector pitchForkRing::force(const vector r) const
00082 {
00083     scalar p = sqrt(r.x()*r.x() + r.y()*r.y());
00084 
00085     scalar pMinusR = (p - rOrbit_);
00086 
00087     return vector
00088     (
00089         (mu_ - pMinusR * pMinusR) * pMinusR * r.x()/p,
00090         (mu_ - pMinusR * pMinusR) * pMinusR * r.y()/p,
00091         -alpha_ * r.z()
00092     );
00093 }
00094 
00095 
00096 bool pitchForkRing::read(const dictionary& tetherPotentialProperties)
00097 {
00098     tetherPotential::read(tetherPotentialProperties);
00099 
00100     pitchForkRingCoeffs_ =
00101         tetherPotentialProperties.subDict(typeName + "Coeffs");
00102 
00103     pitchForkRingCoeffs_.lookup("mu") >> mu_;
00104     pitchForkRingCoeffs_.lookup("alpha") >> alpha_;
00105     pitchForkRingCoeffs_.lookup("rOrbit") >> rOrbit_;
00106 
00107     return true;
00108 }
00109 
00110 
00111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00112 
00113 } // End namespace tetherPotentials
00114 } // End namespace Foam
00115 
00116 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines