eReactingFoam-4.x/diffusivityModel/N64/N64.H

308 lines
7.3 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/>.
Class
Foam::N64
Description
SourceFiles
N64I.H
N64.C
N64IO.C
\*---------------------------------------------------------------------------*/
#ifndef N64_H
#define N64_H
#include "scalar.H"
#include "scalarField.H"
#include "Ion.H"
#include "Neutral.H"
#include "Interaction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class Istream;
class Ostream;
// Forward declaration of friend functions and operators
class N64;
Istream& operator>>(Istream&, N64&);
Ostream& operator<<(Ostream&, const N64&);
/*---------------------------------------------------------------------------*\
Class N64 Declaration
\*---------------------------------------------------------------------------*/
class N64
: public Interaction
{
// Private data
//
//- Highest polynomial order of collision integral fitting formular
static constexpr label M = 5;
//- Collision participant ion a
const Ion &a_;
//- Collision participant neutral b
const Neutral &b_;
//- Combined well depth parameter
scalar ksiij_;
//- Combined collision diameter [A] (Angstrom)
scalar sigmaij_;
//- Combined collision circle area [m^2]
scalar piSigmaSqr_;
//- Combined well depth, /kB [K]
scalar eij_;
//- Combined dispersion coefficient, C6/(e^2) [A^5]
scalar C6ij_;
//- Collision integral parameter
scalar gammaij_;
//- Combined molecular weight
scalar Wij_;
//- Omega(1,1) Fit Coefficient with fixed gamma_ij
scalarField b11_;
//- Omega(2,2) Fit Coefficient with fixed gamma_ij
scalarField b22_;
//- Construct null
static const scalar a11[(M+1)*(M+2)/2];
static const scalar a22[(M+1)*(M+2)/2];
// static scalar vec[(M+1)*(M+2)/2];
static scalarField vec;
//- Construct null
static constexpr scalar K1 = 1.767;
//- Construct null
static constexpr scalar K2 = 0.720;
//- Construct null
static constexpr scalar kappa = 0.0095;
//- Construct null
static const scalar digamma3;
//- Construct null
static const scalar trigamma3;
// Private Member Functions
//- Disallow default bitwise copy construct
N64(const N64&);
//- Disallow default bitwise assignment
void operator=(const N64&);
// primary template
template <label Order>
struct UnivarPolyFeat
{
static scalar transform (scalar x1, scalar *vec)
{
scalar highest = UnivarPolyFeat<Order-1>::transform(x1,vec) * x1;
*(vec+Order) = highest;
return highest;
}
};
// convenience function
inline void transform (scalar x1, scalar *vec)
{
UnivarPolyFeat<M>::transform(x1,vec);
}
// primary template
template <label Order>
struct BivarPolyFeat
{
static scalar *transform (scalar x1, scalar x2, scalar *vec)
{
scalar *src = BivarPolyFeat<Order-1>::transform(x1,x2,vec);
for (label i = 0; i < Order; i++)
{
*(src+Order+i) = *(src + i) * x1;
}
*(src+Order+Order) = *(src + (Order - 1)) * x2;
return src + Order;
}
};
// convenience function
inline void transform (scalar x1, scalar x2, scalar *vec)
{
BivarPolyFeat<M>::transform(x1,x2,vec);
}
// primary template
template <label N>
struct ScalarProduct
{
static scalar product (const scalar* first, const scalar* second)
{
return ScalarProduct<N-1>::product(first + 1, second + 1)
+ *first * *second;
}
};
// convenience function
inline scalar scalarProduct (const scalar *x1, const scalar *x2)
{
return ScalarProduct<(M+1)*(M+2)/2>::product(x1,x2);
}
public:
// Static data members
// Constructors
//- Construct null
N64();
//- Construct from components
N64(const Ion& a, const Neutral& b);
//- Construct from Istream
N64(Istream&);
//- Construct as copy
// N64(const N64&);
//- Destructor
~N64();
// Member Functions
// Access
// Check
// Edit
// Write
inline scalar Omega11(const scalar T);
inline scalar Omega22(const scalar T);
inline scalar D(const scalar p, const scalar T);
inline scalar mu(const scalar p, const scalar T);
inline scalar k(const scalar p, const scalar T);
// Member Operators
// Friend Functions
// Friend Operators
// IOstream Operators
friend Istream& operator>>(Istream&, N64&);
friend Ostream& operator<<(Ostream&, const N64&);
};
// partial specialization as end criteria
template <>
class N64::UnivarPolyFeat<0>
{
public:
static scalar transform (scalar x1, scalar *vec)
{
*vec = 1.0;
return 1.0;
}
};
template <>
class N64::BivarPolyFeat<0>
{
public:
static scalar *transform (scalar x1, scalar x2, scalar *vec)
{
*vec = 1.0;
return vec;
}
};
template <>
struct N64::ScalarProduct<1>
{
static scalar product (const scalar* first, const scalar* second) {
return *first * *second;
};
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "N64I.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //