eReactingFoam-4.x/diffusivityModel/Ion/Ion.C

119 lines
3.5 KiB
C

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "Ion.H"
#include "dictionary.H"
#include "scalarList.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// const dataType Foam::Ion::staticData();
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Ion::Ion(const dictionary& thermoDict, const dictionary& tranDict)
:
Particle(thermoDict, tranDict),
alpha_(tranDict.lookupOrDefault("dipolePolarizability", 0.0)),
C6_(0.0),
n_(tranDict.lookupOrDefault("nStockmayer", 12)),
rctTarget_(tranDict.lookupOrDefault("rctTargets", hashedWordList())),
Arct_(tranDict.lookupOrDefault("Arct", scalarList())),
Brct_(tranDict.lookupOrDefault("Brct", scalarList())),
selfInteraction(*this, *this)
{
if (z() > 0)
{
C6_ = exp(1.8853 * log(alpha_) + 0.2682); // * sqr(e);
}
else if (z() < 0)
{
C6_ = exp(3.2246 * log(alpha_) - 3.2397); // * sqr(e);
}
else
{
FatalErrorInFunction
<< "Ion must have nonzero charge number"
<< abort(FatalError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::Ion::~Ion()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
void Foam::Ion::operator=(const Ion& rhs)
{
// Check for assignment to self
if (this == &rhs)
{
FatalErrorInFunction
<< "Attempted assignment to self"
<< abort(FatalError);
}
}
// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const Ion& st)
{
os << static_cast<const Particle&>(st) << tab
<< st.alpha_ << tab
<< st.C6_ << tab
<< st.Zrot_ << tab
<< st.n_ << tab
<< st.rctTarget_ << tab
<< st.Arct_ << tab
<< st.Brct_;
os.check("Ostream& operator<<(Ostream& os, const specie& st)");
return os;
}
// ************************************************************************* //