Skip to content
Snippets Groups Projects
Commit 5fca1e87 authored by graham's avatar graham
Browse files

Finished DSMC code initial layout and test solver - both compile. Using...

Finished DSMC code initial layout and test solver - both compile.  Using lagrangian/dsmc local version of WallInteractionModel until requirements stabilise. Removed use of InjectionModel - not suitable, designed for continuum cases, requires single constProps from trackData - multispecies DSMC requires a List of constantProperties, one for each species.
parent 9cea1db4
Branches
Tags
No related merge requests found
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/dsmc/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lmeshTools \
-lfiniteVolume \
-llagrangian
-llagrangian \
-ldsmc
Info<< "Constructing dsmcCloud " << endl;
dsmcCloud dsmc(mesh);
dsmcCloud dsmc("dsmc", mesh);
......@@ -25,10 +25,39 @@ License
\*---------------------------------------------------------------------------*/
#include "DsmcCloud.H"
#include "CollisionModel.H"
#include "InjectionModel.H"
#include "BinaryElasticCollisionModel.H"
#include "WallInteractionModel.H"
#include "IntegrationScheme.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class ParcelType>
void Foam::DsmcCloud<ParcelType>::buildConstProps()
{
Info<< "Building Constant Properties - PLACEHOLDER." << endl;
}
template<class ParcelType>
void Foam::DsmcCloud<ParcelType>::buildCellOccupancy()
{
forAll(cellOccupancy_, cO)
{
cellOccupancy_[cO].clear();
}
forAllIter(typename DsmcCloud<ParcelType>, *this, iter)
{
cellOccupancy_[iter().cell()].append(&iter());
}
}
template<class ParcelType>
void Foam::DsmcCloud<ParcelType>::collisions()
{
Info<< "DsmcCloud collisions() - PLACEHOLDER" << endl;
}
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
......@@ -38,7 +67,7 @@ void Foam::DsmcCloud<ParcelType>::addNewParcel
const vector& position,
const vector& U,
const label cellId,
const label speciesId
const label typeId
)
{
ParcelType* pPtr = new ParcelType
......@@ -47,8 +76,7 @@ void Foam::DsmcCloud<ParcelType>::addNewParcel
position,
U,
cellId,
speciesId,
constProps_(speciesId)
typeId
);
addParticle(pPtr);
......@@ -73,26 +101,18 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
IOobject
(
cloudType + "Properties",
rho.mesh().time().constant(),
rho.mesh(),
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
constProps_(particleProperties_),
nParticle_(readScalar(particleProperties_.lookup("nEquivalentParticles"))),
constProps_(),
rndGen_(label(971501)),
interpolationSchemes_(particleProperties_.subDict("interpolationSchemes")),
collisionModel_
(
CollisionModel<DsmcCloud<ParcelType> >::New
(
particleProperties_,
*this
)
),
injectionModel_
binaryElasticCollisionModel_
(
InjectionModel<DsmcCloud<ParcelType> >::New
BinaryElasticCollisionModel<DsmcCloud<ParcelType> >::New
(
particleProperties_,
*this
......@@ -105,16 +125,12 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
particleProperties_,
*this
)
),
UIntegrator_
(
vectorIntegrationScheme::New
(
"U",
particleProperties_.subDict("integrationSchemes")
)
)
{}
{
buildConstProps();
buildCellOccupancy();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
......@@ -129,22 +145,20 @@ Foam::DsmcCloud<ParcelType>::~DsmcCloud()
template<class ParcelType>
void Foam::DsmcCloud<ParcelType>::evolve()
{
typename ParcelType::trackData td
(
*this,
constProps_
);
typename ParcelType::trackData td(*this);
this->injection().inject(td);
//this->injection().inject(td);
if (debug)
{
this->dumpParticlePositions();
}
// Move the particles ballistically with their current velocities
Cloud<ParcelType>::move(td);
this->collision().collide();
// Calculate new velocities via stochastic collisions
collisions();
}
......
......@@ -45,8 +45,6 @@ SourceFiles
#include "fvMesh.H"
#include "volFields.H"
#include "IntegrationSchemesFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
......@@ -55,10 +53,7 @@ namespace Foam
// Forward declaration of classes
template<class CloudType>
class CollisionModel;
template<class CloudType>
class InjectionModel;
class BinaryElasticCollisionModel;
template<class CloudType>
class WallInteractionModel;
......@@ -88,44 +83,39 @@ private:
//- Dictionary of particle properties
IOdictionary particleProperties_;
//- Number of real atoms/molecules represented by a parcel
scalar nParticle_;
//- A data structure holding which particles are in which cell
List<DynamicList<ParcelType*> > cellOccupancy_;
//- Parcel constant properties - one for each species
//- Parcel constant properties - one for each type
List<typename ParcelType::constantProperties> constProps_;
//- Random number generator
Random rndGen_;
//- Interpolation schemes dictionary
dictionary interpolationSchemes_;
// References to the cloud sub-models
//- Injector model
autoPtr<CollisionModel<DsmcCloud<ParcelType> > >
collisionModel_;
//- Injector model
autoPtr<InjectionModel<DsmcCloud<ParcelType> > >
injectionModel_;
//- Binary Elastic Collision model
autoPtr<BinaryElasticCollisionModel<DsmcCloud<ParcelType> > >
binaryElasticCollisionModel_;
//- Wall interaction model
autoPtr<WallInteractionModel<DsmcCloud<ParcelType> > >
wallInteractionModel_;
// Reference to the particle integration schemes
//- Velocity integration
autoPtr<vectorIntegrationScheme> UIntegrator_;
// Private Member Functions
//- Build the constant properties for all of the species
void buildConstProps();
//- Record which particles are in which cell
void buildCellOccupancy()
void buildCellOccupancy();
//- Calculate collisions between molecules
void collisions();
//- Disallow default bitwise copy construct
DsmcCloud(const DsmcCloud&);
......@@ -165,35 +155,38 @@ public:
//- Return particle properties dictionary
inline const IOdictionary& particleProperties() const;
//- Return the number of real particles represented by one
//- parcel
inline label nParticle() const;
//- Return the cell occupancy addressing
inline const List<DynamicList<ParcelType*> >&
cellOccupancy() const;
//- Return all of the constant properties
inline const List<typename ParcelType::constantProperties>&
constProps() const;
//- Return the constant properties of the given typeId
inline const typename ParcelType::constantProperties&
constProps(label typeId) const;
//- Return refernce to the random object
inline Random& rndGen();
// Sub-models
//- Return reference to injection model
inline const CollisionModel<DsmcCloud<ParcelType> >&
collision() const;
//- Return reference to injection model
inline const InjectionModel<DsmcCloud<ParcelType> >&
injection() const;
inline InjectionModel<DsmcCloud<ParcelType> >&
injection();
//- Return reference to binary elastic collision model
inline const
BinaryElasticCollisionModel<DsmcCloud<ParcelType> >&
binaryElasticCollision() const;
//- Return reference to wall interaction model
inline const WallInteractionModel<DsmcCloud<ParcelType> >&
wallInteraction() const;
// Integration schemes
//-Return reference to velocity integration
inline const vectorIntegrationScheme& UIntegrator() const;
// Check
//- Total mass injected
......@@ -224,7 +217,7 @@ public:
inline const tmp<volVectorField> U() const;
//- Return the temperature field
inline const tmp<volScalarField> T() const;
inline const tmp<volScalarField> totalKE() const;
// Cloud evolution functions
......@@ -235,7 +228,7 @@ public:
const vector& position,
const vector& U,
const label cellId,
const label speciesId,
const label typeId
);
//- Evolve the cloud (move, collide)
......
......@@ -49,42 +49,60 @@ Foam::DsmcCloud<ParcelType>::particleProperties() const
template<class ParcelType>
inline const Foam::CollisionModel<Foam::DsmcCloud<ParcelType> >&
Foam::DsmcCloud<ParcelType>::collision() const
inline Foam::label Foam::DsmcCloud<ParcelType>::nParticle() const
{
return collisionModel_;
return nParticle_;
}
template<class ParcelType>
inline const Foam::InjectionModel<Foam::DsmcCloud<ParcelType> >&
Foam::DsmcCloud<ParcelType>::injection() const
inline const Foam::List<Foam::DynamicList<ParcelType*> >&
Foam::DsmcCloud<ParcelType>::cellOccupancy() const
{
return injectionModel_;
return cellOccupancy_;
}
template<class ParcelType>
inline Foam::InjectionModel<Foam::DsmcCloud<ParcelType> >&
Foam::DsmcCloud<ParcelType>::injection()
inline const Foam::List<typename ParcelType::constantProperties>&
Foam::DsmcCloud<ParcelType>::constProps() const
{
return injectionModel_();
return constProps_;
}
template<class ParcelType>
inline const Foam::WallInteractionModel<Foam::DsmcCloud<ParcelType> >&
Foam::DsmcCloud<ParcelType>::wallInteraction() const
inline const typename ParcelType::constantProperties&
Foam::DsmcCloud<ParcelType>::constProps
(
label typeId
) const
{
return wallInteractionModel_;
if (typeId < 0 || typeId >= constProps_.size())
{
FatalErrorIn("Foam::DsmcCloud<ParcelType>::constProps(label typeId)")
<< "constantProperties for requested typeId index "
<< typeId << " do not exist" << nl
<< abort(FatalError);
}
return constProps_[typeId];
}
template<class ParcelType>
inline const Foam::BinaryElasticCollisionModel<Foam::DsmcCloud<ParcelType> >&
Foam::DsmcCloud<ParcelType>::binaryElasticCollision() const
{
return binaryElasticCollisionModel_;
}
template<class ParcelType>
inline const Foam::vectorIntegrationScheme&
Foam::DsmcCloud<ParcelType>::UIntegrator() const
inline const Foam::WallInteractionModel<Foam::DsmcCloud<ParcelType> >&
Foam::DsmcCloud<ParcelType>::wallInteraction() const
{
return UIntegrator_;
return wallInteractionModel_;
}
......@@ -188,7 +206,7 @@ Foam::DsmcCloud<ParcelType>::U() const
{
tmp<volScalarField> tU
(
new volScalarField
new volVectorField
(
IOobject
(
......@@ -215,15 +233,15 @@ Foam::DsmcCloud<ParcelType>::U() const
template<class ParcelType>
inline const Foam::tmp<Foam::volScalarField>
Foam::DsmcCloud<ParcelType>::T() const
Foam::DsmcCloud<ParcelType>::totalKE() const
{
tmp<volScalarField> tT
tmp<volScalarField> ttotalKE
(
new volScalarField
(
IOobject
(
this->name() + "T",
this->name() + "totalKE",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
......@@ -235,7 +253,7 @@ Foam::DsmcCloud<ParcelType>::T() const
)
);
return tT;
return ttotalKE;
}
// template<class ParcelType>
......
......@@ -35,6 +35,8 @@ SourceFiles
#ifndef DsmcBaseCloud_H
#define DsmcBaseCloud_H
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment