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

144 lines
4.2 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/(kmol 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 [ Coulomb x meter ]
const Foam::scalar Foam::Particle::Debye = 1.0 / 2.99792458e29;
//- Boltzmann constant (default in [J/K])
const Foam::scalar Foam::Particle::pi = constant::mathematical::pi;
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::Particle::Particle(const dictionary& dict)
:
name_(dict["name"]),
W_(readScalar(dict["W"])),
z_(readScalar(dict["z"]))
{
label geometry (dict.lookupOrDefault("geometry", 0));
const entry* entryPtr = dict.lookupEntryPtr("tranlib", false, true);
if (entryPtr)
{
scalarList tranlib(entryPtr->stream());
geometry = tranlib[0];
}
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;
}
// ************************************************************************* //