From a92de83589ba36289cfd7ac8574a997bf7ebc385 Mon Sep 17 00:00:00 2001 From: ignis Date: Mon, 30 Apr 2018 04:18:15 +0900 Subject: [PATCH] class Ion base, copy of class Neutral --- Make/files | 1 + Make/options | 1 + diffusivityModel/Ion/Ion.C | 120 ++++++++++++++++++++++++ diffusivityModel/Ion/Ion.H | 176 ++++++++++++++++++++++++++++++++++++ diffusivityModel/Ion/IonI.H | 121 +++++++++++++++++++++++++ 5 files changed, 419 insertions(+) create mode 100644 diffusivityModel/Ion/Ion.C create mode 100644 diffusivityModel/Ion/Ion.H create mode 100644 diffusivityModel/Ion/IonI.H diff --git a/Make/files b/Make/files index f2c3a82..68e469c 100644 --- a/Make/files +++ b/Make/files @@ -1,5 +1,6 @@ diffusivityModel/Particle/Particle.C diffusivityModel/Neutral/Neutral.C +diffusivityModel/Ion/Ion.C diffusivityModel/Stockmayer/Stockmayer.C diff --git a/Make/options b/Make/options index 71ab37f..c4ab78a 100644 --- a/Make/options +++ b/Make/options @@ -1,6 +1,7 @@ EXE_INC = \ -IdiffusivityModel/Particle \ -IdiffusivityModel/Neutral \ + -IdiffusivityModel/Ion \ -IdiffusivityModel/Stockmayer \ -IdiffusivityModel/diffusivityModel \ -I$(LIB_SRC)/finiteVolume/lnInclude \ diff --git a/diffusivityModel/Ion/Ion.C b/diffusivityModel/Ion/Ion.C new file mode 100644 index 0000000..080db99 --- /dev/null +++ b/diffusivityModel/Ion/Ion.C @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +\*---------------------------------------------------------------------------*/ + +#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& dict) +: + Particle(dict), + wellDepth_(dict.lookupOrDefault("wellDepth", 0.0)), + diameter_(dict.lookupOrDefault("diameter", 0.0)), + dipoleMoment_(dict.lookupOrDefault("dipoleMoment", 0.0)), + alpha_(dict.lookupOrDefault("dipolePolarizability", 0.0)), + alphaQ_(dict.lookupOrDefault("quadpolePolarizability", 0.0)), + C6_(dict.lookupOrDefault("dispersionCoef", 0.0)), + Zrot_(dict.lookupOrDefault("rotationalRelaxation", 0.0)) +{ + + const entry* entryPtr = dict.lookupEntryPtr("tranlib", false, true); + + if (entryPtr) + { + scalarList tranlib(entryPtr->stream()); + + wellDepth_ = tranlib[1]; + diameter_ = tranlib[2]; + dipoleMoment_ = tranlib[3]; + alpha_ = tranlib[4]; + // alphaQ_ = tranlib[0]; + // C6_ = tranlib[0]; + Zrot_ = tranlib[5]; + } + +} + + +// * * * * * * * * * * * * * * * * 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(st) << tab + << st.wellDepth_ << tab + << st.diameter_ << tab + << st.dipoleMoment_ << tab + << st.alpha_ << tab + << st.alphaQ_ << tab + << st.C6_ << tab + << st.Zrot_; + + os.check("Ostream& operator<<(Ostream& os, const specie& st)"); + return os; +} + + +// ************************************************************************* // diff --git a/diffusivityModel/Ion/Ion.H b/diffusivityModel/Ion/Ion.H new file mode 100644 index 0000000..f728bda --- /dev/null +++ b/diffusivityModel/Ion/Ion.H @@ -0,0 +1,176 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +Class + Foam::Ion + +Description + +SourceFiles + IonI.H + Ion.C + IonIO.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Ion_H +#define Ion_H + +#include "Particle.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class Istream; +class Ostream; + +// Forward declaration of friend functions and operators +class Ion; +Istream& operator>>(Istream&, Ion&); +Ostream& operator<<(Ostream&, const Ion&); + + +/*---------------------------------------------------------------------------*\ + Class Ion Declaration +\*---------------------------------------------------------------------------*/ + +class Ion +: + public Particle +{ + // Private data + + //- Lenard-Jones parameter - potential well depth + //- epsilon / kB [K] + scalar wellDepth_; + + //- Lenard-Jones parameter - collision diameter [Angstrom] + scalar diameter_; + + //- Dipole moment [Debye] + scalar dipoleMoment_; + + //- Dipole polarizability [Angstrom^3] + scalar alpha_; + + //- Quadrupole polarizability [] + scalar alphaQ_; + + //- Dispersion coefficient [] + scalar C6_; + + //- Rotational relaxation collision number [-] + scalar Zrot_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + Ion(const Ion&); + + //- Disallow default bitwise assignment + void operator=(const Ion&); + + +public: + + // Static data members + + //- Static data staticData + // static const dataType staticData; + + + // Constructors + + //- Construct from components + Ion(const dictionary& dict); + + //- Construct from Istream + Ion(Istream&); + + //- Construct as copy + // Ion(const Ion&); + + + //- Destructor + ~Ion(); + + + // Member Functions + + // Access + inline scalar wellDepth() const; + + inline scalar diameter() const; + + inline scalar dipoleMoment() const; + + inline scalar alpha() const; + + inline scalar alphaQ() const; + + inline scalar C6() const; + + inline scalar Zrot() const; + + inline scalar Zrot(scalar T) const; + + // Check + + // Edit + + // Write + + + // Member Operators + + // void operator=(const Ion&); + + + // Friend Functions + + // Friend Operators + + // IOstream Operators + + friend Istream& operator>>(Istream&, Ion&); + friend Ostream& operator<<(Ostream&, const Ion&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "IonI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/diffusivityModel/Ion/IonI.H b/diffusivityModel/Ion/IonI.H new file mode 100644 index 0000000..db6f423 --- /dev/null +++ b/diffusivityModel/Ion/IonI.H @@ -0,0 +1,121 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +inline Foam::scalar Foam::Ion::wellDepth() + const +{ + return wellDepth_; +} + + +inline Foam::scalar Foam::Ion::diameter() + const +{ + return diameter_ * Angstrom; +} + + +inline Foam::scalar Foam::Ion::dipoleMoment() + const +{ + return dipoleMoment_ * Debye; +} + + +inline Foam::scalar Foam::Ion::alpha() + const +{ + return alpha_; +} + + +inline Foam::scalar Foam::Ion::alphaQ() + const +{ + return alphaQ_; +} + + +inline Foam::scalar Foam::Ion::C6() + const +{ + return C6_; +} + + +inline Foam::scalar Foam::Ion::Zrot() + const +{ + return Zrot_; +} + +inline Foam::scalar Foam::Ion::Zrot(const scalar T) + const +{ + scalar a3 = sqrt(pow3(pi)); + scalar a1 = a3/2.0; + scalar a2 = sqr(pi) / 4.0 + 2.0; + + scalar t1 = sqrt(wellDepth_/T); + scalar t2 = wellDepth_/T; + scalar t3 = t1 * t2; + + return 1.0 + a1 * t1 + a2 * t2 + a3 * t3; +} + + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +// ************************************************************************* //