diff --git a/applications/solvers/dsmc/dsmcFoam/Make/options b/applications/solvers/dsmc/dsmcFoam/Make/options index 5ec7ea20fd..bc99834af6 100755 --- a/applications/solvers/dsmc/dsmcFoam/Make/options +++ b/applications/solvers/dsmc/dsmcFoam/Make/options @@ -1,10 +1,12 @@ 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 diff --git a/applications/solvers/dsmc/dsmcFoam/createFields.H b/applications/solvers/dsmc/dsmcFoam/createFields.H index 8663ea7c6c..68a44f03fd 100644 --- a/applications/solvers/dsmc/dsmcFoam/createFields.H +++ b/applications/solvers/dsmc/dsmcFoam/createFields.H @@ -1,4 +1,4 @@ Info<< "Constructing dsmcCloud " << endl; - dsmcCloud dsmc(mesh); + dsmcCloud dsmc("dsmc", mesh); diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C index 152009efd5..bf3db68a29 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C @@ -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 +void Foam::DsmcCloud::buildConstProps() +{ + Info<< "Building Constant Properties - PLACEHOLDER." << endl; +} + + +template +void Foam::DsmcCloud::buildCellOccupancy() +{ + forAll(cellOccupancy_, cO) + { + cellOccupancy_[cO].clear(); + } + + forAllIter(typename DsmcCloud, *this, iter) + { + cellOccupancy_[iter().cell()].append(&iter()); + } +} + + +template +void Foam::DsmcCloud::collisions() +{ + Info<< "DsmcCloud collisions() - PLACEHOLDER" << endl; +} + // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // @@ -38,7 +67,7 @@ void Foam::DsmcCloud::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::addNewParcel position, U, cellId, - speciesId, - constProps_(speciesId) + typeId ); addParticle(pPtr); @@ -73,26 +101,18 @@ Foam::DsmcCloud::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_ + binaryElasticCollisionModel_ ( - CollisionModel >::New - ( - particleProperties_, - *this - ) - ), - injectionModel_ - ( - InjectionModel >::New + BinaryElasticCollisionModel >::New ( particleProperties_, *this @@ -105,16 +125,12 @@ Foam::DsmcCloud::DsmcCloud particleProperties_, *this ) - ), - UIntegrator_ - ( - vectorIntegrationScheme::New - ( - "U", - particleProperties_.subDict("integrationSchemes") - ) ) -{} +{ + buildConstProps(); + + buildCellOccupancy(); +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -129,22 +145,20 @@ Foam::DsmcCloud::~DsmcCloud() template void Foam::DsmcCloud::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::move(td); - this->collision().collide(); + // Calculate new velocities via stochastic collisions + collisions(); } diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H index d95036688b..7d9d094ac5 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H @@ -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 CollisionModel; - -template -class InjectionModel; +class BinaryElasticCollisionModel; template 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 > cellOccupancy_; - //- Parcel constant properties - one for each species + //- Parcel constant properties - one for each type List constProps_; //- Random number generator Random rndGen_; - //- Interpolation schemes dictionary - dictionary interpolationSchemes_; - - // References to the cloud sub-models - //- Injector model - autoPtr > > - collisionModel_; - - //- Injector model - autoPtr > > - injectionModel_; + //- Binary Elastic Collision model + autoPtr > > + binaryElasticCollisionModel_; //- Wall interaction model autoPtr > > wallInteractionModel_; - // Reference to the particle integration schemes - - //- Velocity integration - autoPtr 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 >& + cellOccupancy() const; + + //- Return all of the constant properties + inline const List& + 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 >& - collision() const; - - //- Return reference to injection model - inline const InjectionModel >& - injection() const; - - inline InjectionModel >& - injection(); + //- Return reference to binary elastic collision model + inline const + BinaryElasticCollisionModel >& + binaryElasticCollision() const; //- Return reference to wall interaction model inline const WallInteractionModel >& 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 U() const; //- Return the temperature field - inline const tmp T() const; + inline const tmp 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) diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H index 4385907b75..6dce82d46b 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H @@ -49,26 +49,52 @@ Foam::DsmcCloud::particleProperties() const template -inline const Foam::CollisionModel >& -Foam::DsmcCloud::collision() const +inline Foam::label Foam::DsmcCloud::nParticle() const { - return collisionModel_; + return nParticle_; } template -inline const Foam::InjectionModel >& -Foam::DsmcCloud::injection() const +inline const Foam::List >& +Foam::DsmcCloud::cellOccupancy() const { - return injectionModel_; + return cellOccupancy_; } template -inline Foam::InjectionModel >& -Foam::DsmcCloud::injection() +inline const Foam::List& +Foam::DsmcCloud::constProps() const { - return injectionModel_(); + return constProps_; +} + + +template +inline const typename ParcelType::constantProperties& +Foam::DsmcCloud::constProps +( + label typeId +) const +{ + if (typeId < 0 || typeId >= constProps_.size()) + { + FatalErrorIn("Foam::DsmcCloud::constProps(label typeId)") + << "constantProperties for requested typeId index " + << typeId << " do not exist" << nl + << abort(FatalError); + } + + return constProps_[typeId]; +} + + +template +inline const Foam::BinaryElasticCollisionModel >& +Foam::DsmcCloud::binaryElasticCollision() const +{ + return binaryElasticCollisionModel_; } @@ -80,14 +106,6 @@ Foam::DsmcCloud::wallInteraction() const } -template -inline const Foam::vectorIntegrationScheme& -Foam::DsmcCloud::UIntegrator() const -{ - return UIntegrator_; -} - - template inline Foam::scalar Foam::DsmcCloud::massInSystem() const { @@ -188,7 +206,7 @@ Foam::DsmcCloud::U() const { tmp tU ( - new volScalarField + new volVectorField ( IOobject ( @@ -215,15 +233,15 @@ Foam::DsmcCloud::U() const template inline const Foam::tmp -Foam::DsmcCloud::T() const +Foam::DsmcCloud::totalKE() const { - tmp tT + tmp 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::T() const ) ); - return tT; + return ttotalKE; } // template diff --git a/src/lagrangian/dsmc/clouds/baseClasses/DsmcBaseCloud/DsmcBaseCloud.H b/src/lagrangian/dsmc/clouds/baseClasses/DsmcBaseCloud/DsmcBaseCloud.H index 915becafaa..94727407f4 100644 --- a/src/lagrangian/dsmc/clouds/baseClasses/DsmcBaseCloud/DsmcBaseCloud.H +++ b/src/lagrangian/dsmc/clouds/baseClasses/DsmcBaseCloud/DsmcBaseCloud.H @@ -35,6 +35,8 @@ SourceFiles #ifndef DsmcBaseCloud_H #define DsmcBaseCloud_H +#include "volFields.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam