216 lines
5.3 KiB
C++
216 lines
5.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::CrossSection
|
|
|
|
Description
|
|
|
|
SourceFiles
|
|
CrossSectionI.H
|
|
CrossSection.C
|
|
CrossSectionIO.C
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
#ifndef CrossSection_H
|
|
#define CrossSection_H
|
|
|
|
#include "scalar.H"
|
|
#include "scalarField.H"
|
|
#include "Electron.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 CrossSection;
|
|
Istream& operator>>(Istream&, CrossSection&);
|
|
Ostream& operator<<(Ostream&, const CrossSection&);
|
|
|
|
|
|
/*---------------------------------------------------------------------------*\
|
|
Class CrossSection Declaration
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
class CrossSection
|
|
: public Interaction
|
|
{
|
|
// Private data
|
|
//
|
|
//- Highest polynomial order of diffusivity fitting formular
|
|
static constexpr label M = 7;
|
|
|
|
//- Collision participant ion a
|
|
const Electron &a_;
|
|
|
|
//- Collision participant neutral b
|
|
const Neutral &b_;
|
|
|
|
//- p * Dej Fit Coefficient
|
|
scalarField b11_;
|
|
|
|
//- Buffer for polynomial feature
|
|
static scalarField vec;
|
|
|
|
// Private Member Functions
|
|
|
|
//- Disallow default bitwise copy construct
|
|
CrossSection(const CrossSection&);
|
|
|
|
//- Disallow default bitwise assignment
|
|
void operator=(const CrossSection&);
|
|
|
|
// 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 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)>::product(x1,x2);
|
|
}
|
|
|
|
|
|
public:
|
|
|
|
// Static data members
|
|
|
|
|
|
// Constructors
|
|
|
|
//- Construct null
|
|
CrossSection();
|
|
|
|
//- Construct from components
|
|
CrossSection(const Electron& a, const Neutral& b);
|
|
|
|
//- Construct from Istream
|
|
CrossSection(Istream&);
|
|
|
|
//- Construct as copy
|
|
// CrossSection(const CrossSection&);
|
|
|
|
|
|
//- Destructor
|
|
~CrossSection();
|
|
|
|
|
|
// Member Functions
|
|
|
|
// Access
|
|
|
|
// Check
|
|
|
|
// Edit
|
|
|
|
// Write
|
|
|
|
inline scalar Dfit(const scalar T);
|
|
|
|
|
|
inline scalar D(const scalar p, const scalar T);
|
|
|
|
|
|
// Member Operators
|
|
|
|
|
|
// Friend Functions
|
|
|
|
// Friend Operators
|
|
|
|
// IOstream Operators
|
|
|
|
friend Istream& operator>>(Istream&, CrossSection&);
|
|
friend Ostream& operator<<(Ostream&, const CrossSection&);
|
|
};
|
|
|
|
// partial specialization as end criteria
|
|
template <>
|
|
class CrossSection::UnivarPolyFeat<0>
|
|
{
|
|
public:
|
|
static scalar transform (scalar x1, scalar *vec)
|
|
{
|
|
*vec = 1.0;
|
|
return 1.0;
|
|
}
|
|
};
|
|
|
|
template <>
|
|
struct CrossSection::ScalarProduct<1>
|
|
{
|
|
static scalar product (const scalar* first, const scalar* second) {
|
|
return *first * *second;
|
|
};
|
|
};
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
} // End namespace Foam
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
#include "CrossSectionI.H"
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
#endif
|
|
|
|
// ************************************************************************* //
|