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

152 lines
4.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 "Particle.H"
#include "dictionary.H"
#include "scalarList.H"
#include "constants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// const dataType Foam::Particle::staticData();
//- Universal gas constant (default in [J/(mol K)])
const Foam::scalar Foam::Particle::RR = constant::physicoChemical::R.value()*1000;
//- Elementary charge (default in [C])
const Foam::scalar Foam::Particle::e = constant::electromagnetic::e.value();
//- Avogadro number (default in [1/mol])
const Foam::scalar Foam::Particle::NA = constant::physicoChemical::NA.value()*1000;
//- Boltzmann constant (default in [J/K])
const Foam::scalar Foam::Particle::k = constant::physicoChemical::k.value();
//- 1 Angstom in meter
const Foam::scalar Foam::Particle::Angstrom = 1e-10;
//- 1 Debye in [ sqrt( J x meter ^ 3 ) ]
const Foam::scalar Foam::Particle::Debye = 1e-18 * Foam::pow(1./100., 5./2) * Foam::pow(1./1000., 1./2.);
//- Circumference / Diameter
const Foam::scalar Foam::Particle::pi = constant::mathematical::pi;
//- Electric constant (Vacuum permittivity) [F/m]
const Foam::scalar Foam::Particle::eps0 = constant::electromagnetic::epsilon0.value();
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Particle::Particle(const dictionary& thermoDict, const dictionary& tranDict)
:
name_(tranDict["name"]),
W_(readScalar(tranDict["W"])),
z_(readScalar(tranDict["z"])),
thermo_(thermoDict)
{
label geometry = 0;
const entry* entryPtr = tranDict.lookupEntryPtr("tranlib", false, true);
if (entryPtr)
{
scalarList tranlib(entryPtr->stream());
geometry = tranlib[0];
}
else
{
geometry = readLabel(tranDict.lookup("geometry"));
}
switch(geometry)
{
case 0:
geometry_ = Geometry::ATOM;
break;
case 1:
geometry_ = Geometry::LINEAR;
break;
case 2:
geometry_ = Geometry::NONLINEAR;
break;
default:
FatalErrorInFunction
<< "Illegal molecule geometry type. 0, 1 and 2 are allowed."
<< abort(FatalError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::Particle::~Particle()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
void Foam::Particle::operator=(const Particle& 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 Particle& st)
{
os << st.name_ << tab
<< st.W_ << tab
<< st.z_ << tab
<< st.geometry_;
os.check("Ostream& operator<<(Ostream& os, const specie& st)");
return os;
}
// ************************************************************************* //