/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 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::DSMCParcel
Description
DSMC parcel class
SourceFiles
DSMCParcelI.H
DSMCParcel.C
DSMCParcelIO.C
\*---------------------------------------------------------------------------*/
#ifndef DSMCParcel_H
#define DSMCParcel_H
#include "particle.H"
#include "IOstream.H"
#include "autoPtr.H"
#include "contiguous.H"
#include "DSMCCloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template
class DSMCParcel;
// Forward declaration of friend functions
template
Ostream& operator<<
(
Ostream&,
const DSMCParcel&
);
/*---------------------------------------------------------------------------*\
Class DSMCParcel Declaration
\*---------------------------------------------------------------------------*/
template
class DSMCParcel
:
public ParcelType
{
// Private member data
//- Size in bytes of the fields
static const std::size_t sizeofFields_;
public:
//- Class to hold DSMC particle constant properties
class constantProperties
{
// Private data
//- Particle mass [kg] (constant)
scalar mass_;
//- Particle hard sphere diameter [m] (constant)
scalar d_;
//- Internal degrees of freedom
direction internalDegreesOfFreedom_;
//- Viscosity index
scalar omega_;
public:
// Constructors
//- Null constructor, allows List of constantProperties to be
// created before the contents is initialised
inline constantProperties();
//- Constructor from dictionary
inline constantProperties(const dictionary& dict);
// Member functions
//- Return const access to the particle mass [kg]
inline scalar mass() const;
//- Return const access to the hard sphere diameter [m]
inline scalar d() const;
//- Return the reference total collision cross section
inline scalar sigmaT() const;
//- Return the internalDegreesOfFreedom
inline direction internalDegreesOfFreedom() const;
//- Return the viscosity index
inline scalar omega() const;
};
//- Class used to pass kinematic tracking data to the trackToFace function
class trackingData
:
public particle::TrackingData > >
{
public:
// Constructors
//- Construct from components
trackingData(DSMCCloud >& cloud)
:
particle::TrackingData > >
(
cloud
)
{}
};
protected:
// Protected member data
// Parcel properties
//- Velocity of Parcel [m/s]
vector U_;
//- Internal energy of the Parcel, covering all non-translational
// degrees of freedom [J]
scalar Ei_;
//- Parcel type id
label typeId_;
public:
//- Runtime type information
TypeName("DSMCParcel");
friend class Cloud;
// Constructors
//- Construct from components
inline DSMCParcel
(
const polyMesh& mesh,
const vector& position,
const vector& U,
const scalar Ei,
const label cellI,
const label tetFaceI,
const label tetPtI,
const label typeId
);
//- Construct from Istream
DSMCParcel
(
const polyMesh& mesh,
Istream& is,
bool readFields = true
);
//- Construct and return a clone
virtual autoPtr clone() const
{
return autoPtr(new DSMCParcel(*this));
}
//- Factory class to read-construct particles used for
// parallel transfer
class iNew
{
const polyMesh& mesh_;
public:
iNew(const polyMesh& mesh)
:
mesh_(mesh)
{}
autoPtr > operator()(Istream& is) const
{
return autoPtr >
(
new DSMCParcel(mesh_, is, true)
);
}
};
// Member Functions
// Access
//- Return type id
inline label typeId() const;
//- Return const access to velocity
inline const vector& U() const;
//- Return const access to internal energy
inline scalar Ei() const;
// Edit
//- Return access to velocity
inline vector& U();
//- Return access to internal energy
inline scalar& Ei();
// Main calculation loop
// Tracking
//- Move the parcel
template
bool move(TrackData& td, const scalar trackTime);
// Patch interactions
//- Overridable function to handle the particle hitting a patch
// Executed before other patch-hitting functions
template
bool hitPatch
(
const polyPatch&,
TrackData& td,
const label patchI,
const scalar trackFraction,
const tetIndices& tetIs
);
//- Overridable function to handle the particle hitting a
// processorPatch
template
void hitProcessorPatch
(
const processorPolyPatch&,
TrackData& td
);
//- Overridable function to handle the particle hitting a wallPatch
template
void hitWallPatch
(
const wallPolyPatch&,
TrackData& td,
const tetIndices&
);
//- Overridable function to handle the particle hitting a polyPatch
template
void hitPatch
(
const polyPatch&,
TrackData& td
);
//- Transform the physical properties of the particle
// according to the given transformation tensor
virtual void transformProperties(const tensor& T);
//- Transform the physical properties of the particle
// according to the given separation vector
virtual void transformProperties(const vector& separation);
// I-O
static void readFields(Cloud >& c);
static void writeFields(const Cloud >& c);
// Ostream Operator
friend Ostream& operator<<
(
Ostream&,
const DSMCParcel&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "DSMCParcelI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "DSMCParcel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //