Commit f38e4fdd authored by graham's avatar graham
Browse files

Forgot to git add new files referred to in commit...

Forgot to git add new files referred to in commit 5fca1e87 message.  Initial DSMC implementation now included properly.
parent 5fca1e87
/* Parcels */
parcels/derived/dsmcParcel/dsmcParcel.C
/* Cloud base classes */
clouds/baseClasses/DsmcBaseCloud/DsmcBaseCloud.C
/* Clouds */
clouds/derived/dsmcCloud/dsmcCloud.C
/* submodels */
parcels/derived/dsmcParcel/defineDsmcParcel.C
parcels/derived/dsmcParcel/makeDsmcParcelBinaryElasticCollisionModels.C
parcels/derived/dsmcParcel/makeDsmcParcelWallInteractionModels.C
LIB = $(FOAM_LIBBIN)/libdsmc
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude
LIB_LIBS = \
-llagrangian \
-lfiniteVolume
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "dsmcCloud.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(dsmcCloud, 0);
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::dsmcCloud::dsmcCloud
(
const word& cloudType,
const fvMesh& mesh
)
:
DsmcCloud<dsmcParcel>(cloudType, mesh)
{
dsmcParcel::readFields(*this);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::dsmcCloud::~dsmcCloud()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::dsmcCloud::writeFields() const
{
dsmcParcel::writeFields(*this);
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::dsmcCloud
Description
Cloud class to simulate dsmc parcels
SourceFiles
dsmcCloud.C
\*---------------------------------------------------------------------------*/
#ifndef dsmcCloud_H
#define dsmcCloud_H
#include "DsmcCloud.H"
#include "dsmcParcel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class dsmcCloud Declaration
\*---------------------------------------------------------------------------*/
class dsmcCloud
:
public DsmcCloud<dsmcParcel>
{
// Private member functions
//- Disallow default bitwise copy construct
dsmcCloud(const dsmcCloud&);
//- Disallow default bitwise assignment
void operator=(const dsmcCloud&);
public:
//- Runtime type information
TypeName("dsmcCloud");
// Constructors
//- Construct from components
dsmcCloud
(
const word& cloudType,
const fvMesh& mesh
);
//- Destructor
~dsmcCloud();
// Member functions
//- Write fields
void writeFields() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "DsmcParcel.H"
#include "dimensionedConstants.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
template<class TrackData>
bool Foam::DsmcParcel<ParcelType>::move
(
TrackData& td
)
{
ParcelType& p = static_cast<ParcelType&>(*this);
td.switchProcessor = false;
td.keepParticle = true;
const polyMesh& mesh = td.cloud().pMesh();
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
const scalar deltaT = mesh.time().deltaT().value();
scalar tEnd = (1.0 - p.stepFraction())*deltaT;
const scalar dtMax = tEnd;
while (td.keepParticle && !td.switchProcessor && tEnd > ROOTVSMALL)
{
// Set the Lagrangian time-step
scalar dt = min(dtMax, tEnd);
dt *= p.trackToFace(p.position() + dt*U_, td);
tEnd -= dt;
p.stepFraction() = 1.0 - tEnd/deltaT;
if (p.onBoundary() && td.keepParticle)
{
if (p.face() > -1)
{
if
(
isType<processorPolyPatch>
(pbMesh[p.patch(p.face())])
)
{
td.switchProcessor = true;
}
}
}
}
return td.keepParticle;
}
template<class ParcelType>
template<class TrackData>
void Foam::DsmcParcel<ParcelType>::hitProcessorPatch
(
const processorPolyPatch&,
TrackData& td
)
{
td.switchProcessor = true;
}
template<class ParcelType>
void Foam::DsmcParcel<ParcelType>::hitProcessorPatch
(
const processorPolyPatch&,
int&
)
{}
template<class ParcelType>
template<class TrackData>
void Foam::DsmcParcel<ParcelType>::hitWallPatch
(
const wallPolyPatch& wpp,
TrackData& td
)
{
const constantProperties& constProps(td.cloud().constProps(typeId_));
td.cloud().wallInteraction().correct
(
wpp,
this->face(),
U_,
constProps.mass()
);
}
template<class ParcelType>
void Foam::DsmcParcel<ParcelType>::hitWallPatch
(
const wallPolyPatch&,
int&
)
{}
template<class ParcelType>
template<class TrackData>
void Foam::DsmcParcel<ParcelType>::hitPatch
(
const polyPatch&,
TrackData& td
)
{
td.keepParticle = false;
}
template<class ParcelType>
void Foam::DsmcParcel<ParcelType>::hitPatch
(
const polyPatch&,
int&
)
{}
template<class ParcelType>
void Foam::DsmcParcel<ParcelType>::transformProperties
(
const tensor& T
)
{
Particle<ParcelType>::transformProperties(T);
U_ = transform(T, U_);
}
template<class ParcelType>
void Foam::DsmcParcel<ParcelType>::transformProperties
(
const vector& separation
)
{
Particle<ParcelType>::transformProperties(separation);
}
// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * //
#include "DsmcParcelIO.C"
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
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 "mathematicalConstants.H"
#include "DsmcCloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template<class ParcelType>
class DsmcParcel;
// Forward declaration of friend functions
template<class ParcelType>
Ostream& operator<<
(
Ostream&,
const DsmcParcel<ParcelType>&
);
/*---------------------------------------------------------------------------*\
Class DsmcParcel Declaration
\*---------------------------------------------------------------------------*/
template<class ParcelType>
class DsmcParcel
:
public Particle<ParcelType>
{
public:
//- Class to hold DSMC particle constant properties
class constantProperties
{
// Private data
//- Name of species
const word name_;
//- Particle mass [kg] (constant)
const scalar mass_;
//- Particle hard sphere diameter [m] (constant)
const scalar d_;
public:
//- 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 the name of the species
inline const word& name() const;
//- Return const access to the particle density
inline scalar mass() const;
//- Return const access to the minimum particle mass
inline scalar d() const;
};
//- Class used to pass kinematic tracking data to the trackToFace function
class trackData
:
public Particle<ParcelType>::trackData
{
// Private data
//- Reference to the cloud containing this particle
DsmcCloud<ParcelType>& cloud_;
public:
// Constructors
//- Construct from components
inline trackData
(
DsmcCloud<ParcelType>& cloud
);
// Member functions
//- Return access to the owner cloud
inline DsmcCloud<ParcelType>& cloud();
};
protected:
// Protected member data
// Parcel properties
//- Velocity of Parcel [m/s]
vector U_;
//- Parcel type id
label typeId_;
public:
//- Runtime type information
TypeName("DsmcParcel");
friend class Cloud<ParcelType>;
// Constructors
//- Construct from components
inline DsmcParcel
(
DsmcCloud<ParcelType>& owner,
const vector& position,
const vector& U,
const label celli,
const label typeId
);
//- Construct from Istream
DsmcParcel
(
const Cloud<ParcelType>& c,
Istream& is,
bool readFields = true
);
//- Construct and return a clone
autoPtr<ParcelType> clone() const
{
return autoPtr<ParcelType>(new DsmcParcel<ParcelType>(*this));
}
// Member Functions
// Access
//- Return type id
inline label typeId() const;
//- Return const access to velocity
inline const vector& U() const;
//- The nearest distance to a wall that
// the particle can be in the n direction
inline scalar wallImpactDistance(const vector& n) const;
// Edit
//- Return access to diameter
inline scalar& d();
//- Return access to velocity
inline vector& U();
// Main calculation loop
// Tracking
//- Move the parcel
template<class TrackData>
bool move(TrackData& td);
// Patch interactions
//- Overridable function to handle the particle hitting a
// processorPatch
template<class TrackData>
void hitProcessorPatch
(
const processorPolyPatch&,
TrackData& td
);
//- Overridable function to handle the particle hitting a