mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'dsmc' of ssh://graham@hunt//home/noisy3/OpenFOAM/OpenFOAM-dev into dsmc
This commit is contained in:
@ -73,7 +73,7 @@ int main(int argc, char *argv[])
|
||||
if (!mesh.write())
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Failed writing moleculeCloud."
|
||||
<< "Failed writing moleculeCloud."
|
||||
<< nl << exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ template<class CloudType>
|
||||
class WallInteractionModel;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class DsmcCloud Declaration
|
||||
Class DsmcCloud Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class ParcelType>
|
||||
@ -69,9 +69,6 @@ class DsmcCloud
|
||||
public Cloud<ParcelType>,
|
||||
public DsmcBaseCloud
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Cloud type - used to set the name of the parcel properties
|
||||
@ -84,10 +81,10 @@ private:
|
||||
//- Dictionary of particle properties
|
||||
IOdictionary particleProperties_;
|
||||
|
||||
//- A list of unique instances of molecule types in the simulation. The
|
||||
// position of an entry in the list maps to the label identifying the
|
||||
// typeId, i.e. where typeIdList_ = (N2 O2 CO2)
|
||||
// N2 has typeId label = 0, O2 = 1, CO2 = 2.
|
||||
//- A list of unique instances of molecule types in the simulation.
|
||||
// The position of an entry in the list maps to the label identifying
|
||||
// the typeId, i.e. where typeIdList_ = (N2 O2 CO2)
|
||||
// N2 has typeId label = 0, O2 = 1, CO2 = 2.
|
||||
List<word> typeIdList_;
|
||||
|
||||
//- Number of real atoms/molecules represented by a parcel
|
||||
@ -171,6 +168,7 @@ public:
|
||||
const IOdictionary& dsmcInitialiseDict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~DsmcCloud();
|
||||
|
||||
@ -220,7 +218,8 @@ public:
|
||||
//- Return refernce to the random object
|
||||
inline Random& rndGen();
|
||||
|
||||
// Kinetic theory helper functions
|
||||
|
||||
// Kinetic theory helper functions
|
||||
|
||||
//- Generate a random velocity sampled from the Maxwellian speed
|
||||
// distribution
|
||||
@ -256,6 +255,7 @@ public:
|
||||
//- Clear the Cloud
|
||||
inline void clear();
|
||||
|
||||
|
||||
// Sub-models
|
||||
|
||||
//- Return reference to binary elastic collision model
|
||||
@ -274,6 +274,7 @@ public:
|
||||
inline WallInteractionModel<DsmcCloud<ParcelType> >&
|
||||
wallInteraction();
|
||||
|
||||
|
||||
// Check
|
||||
|
||||
//- Total mass injected
|
||||
|
||||
@ -29,6 +29,7 @@ Description
|
||||
Virtual abstract base class for templated DsmcCloud
|
||||
|
||||
SourceFiles
|
||||
DsmcBaseCloud.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -48,7 +49,6 @@ namespace Foam
|
||||
|
||||
class DsmcBaseCloud
|
||||
{
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
@ -68,15 +68,8 @@ public:
|
||||
//- Null constructor
|
||||
DsmcBaseCloud();
|
||||
|
||||
|
||||
// Destructors
|
||||
|
||||
virtual ~DsmcBaseCloud();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
//- Destructor
|
||||
virtual ~DsmcBaseCloud();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -45,14 +45,13 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class dsmcCloud Declaration
|
||||
Class dsmcCloud Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class dsmcCloud
|
||||
:
|
||||
public DsmcCloud<dsmcParcel>
|
||||
{
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
@ -86,8 +85,7 @@ public:
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
|
||||
~dsmcCloud();
|
||||
~dsmcCloud();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
@ -72,13 +72,11 @@ class DsmcParcel
|
||||
:
|
||||
public Particle<ParcelType>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Class to hold DSMC particle constant properties
|
||||
class constantProperties
|
||||
{
|
||||
|
||||
// Private data
|
||||
|
||||
//- Particle mass [kg] (constant)
|
||||
@ -93,14 +91,18 @@ public:
|
||||
//- Viscosity index
|
||||
scalar omega_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Null constructor, allows List of constantProperties to be created
|
||||
//- before the contents is initialised
|
||||
inline constantProperties();
|
||||
// Constrcutors
|
||||
|
||||
//- Null constructor, allows List of constantProperties to be
|
||||
// created before the contents is initialised
|
||||
inline constantProperties();
|
||||
|
||||
//- Constructor from dictionary
|
||||
inline constantProperties(const dictionary& dict);
|
||||
|
||||
//- Constructor from dictionary
|
||||
inline constantProperties(const dictionary& dict);
|
||||
|
||||
// Member functions
|
||||
|
||||
@ -127,18 +129,18 @@ public:
|
||||
:
|
||||
public Particle<ParcelType>::trackData
|
||||
{
|
||||
|
||||
// Private data
|
||||
|
||||
//- Reference to the cloud containing this particle
|
||||
DsmcCloud<ParcelType>& cloud_;
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
inline trackData
|
||||
//- Construct from components
|
||||
inline trackData
|
||||
(
|
||||
DsmcCloud<ParcelType>& cloud
|
||||
);
|
||||
@ -163,6 +165,7 @@ protected:
|
||||
//- Parcel type id
|
||||
label typeId_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -312,9 +315,9 @@ public:
|
||||
|
||||
#define defineParcelTypeNameAndDebug(Type, DebugSwitch) \
|
||||
template<> \
|
||||
const Foam::word DsmcParcel<Type>::typeName(#Type); \
|
||||
const Foam::word DsmcParcel<Type>::typeName(#Type); \
|
||||
template<> \
|
||||
int DsmcParcel<Type>::debug \
|
||||
int DsmcParcel<Type>::debug \
|
||||
( \
|
||||
Foam::debug::debugSwitch(#Type, DebugSwitch) \
|
||||
);
|
||||
|
||||
@ -86,8 +86,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
virtual ~dsmcParcel();
|
||||
virtual ~dsmcParcel();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -53,7 +53,6 @@ namespace Foam
|
||||
template<class CloudType>
|
||||
class BinaryCollisionModel
|
||||
{
|
||||
|
||||
// Private data
|
||||
|
||||
//- The cloud dictionary
|
||||
@ -97,17 +96,15 @@ public:
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~BinaryCollisionModel();
|
||||
virtual ~BinaryCollisionModel();
|
||||
|
||||
|
||||
// Selector
|
||||
|
||||
static autoPtr<BinaryCollisionModel<CloudType> > New
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
);
|
||||
//- Selector
|
||||
static autoPtr<BinaryCollisionModel<CloudType> > New
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
);
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
@ -36,10 +36,7 @@ Foam::BinaryCollisionModel<CloudType>::New
|
||||
CloudType& owner
|
||||
)
|
||||
{
|
||||
word BinaryCollisionModelType
|
||||
(
|
||||
dict.lookup("BinaryCollisionModel")
|
||||
);
|
||||
word BinaryCollisionModelType(dict.lookup("BinaryCollisionModel"));
|
||||
|
||||
Info<< "Selecting BinaryCollisionModel "
|
||||
<< BinaryCollisionModelType
|
||||
@ -58,7 +55,7 @@ Foam::BinaryCollisionModel<CloudType>::New
|
||||
<< "Unknown BinaryCollisionModelType type "
|
||||
<< BinaryCollisionModelType
|
||||
<< ", constructor not in hash table" << nl << nl
|
||||
<< " Valid BinaryCollisionModel types are :" << nl
|
||||
<< " Valid BinaryCollisionModel types are:" << nl
|
||||
<< dictionaryConstructorTablePtr_->toc() << exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
@ -60,15 +60,19 @@ Foam::scalar Foam::VariableHardSphere<CloudType>::sigmaTcR
|
||||
{
|
||||
const CloudType& cloud(this->owner());
|
||||
|
||||
scalar dPQ = 0.5*
|
||||
(
|
||||
cloud.constProps(typeIdP).d() + cloud.constProps(typeIdQ).d()
|
||||
);
|
||||
scalar dPQ =
|
||||
0.5
|
||||
*(
|
||||
cloud.constProps(typeIdP).d()
|
||||
+ cloud.constProps(typeIdQ).d()
|
||||
);
|
||||
|
||||
scalar omegaPQ = 0.5*
|
||||
(
|
||||
cloud.constProps(typeIdP).omega() + cloud.constProps(typeIdQ).omega()
|
||||
);
|
||||
scalar omegaPQ =
|
||||
0.5
|
||||
*(
|
||||
cloud.constProps(typeIdP).omega()
|
||||
+ cloud.constProps(typeIdQ).omega()
|
||||
);
|
||||
|
||||
scalar cR = mag(UP - UQ);
|
||||
|
||||
@ -76,12 +80,13 @@ Foam::scalar Foam::VariableHardSphere<CloudType>::sigmaTcR
|
||||
|
||||
scalar mQ = cloud.constProps(typeIdQ).mass();
|
||||
|
||||
scalar mR = mP*mQ/(mP+ mQ);
|
||||
scalar mR = mP*mQ/(mP + mQ);
|
||||
|
||||
// calculating cross section = pi * dPQ^2, where dPQ is from Bird, eq. 4.79
|
||||
scalar sigmaTPQ = mathematicalConstant::pi*dPQ*dPQ
|
||||
*pow(2.0*CloudType::kb*CloudType::Tref/(mR*cR*cR),omegaPQ - 0.5)
|
||||
/exp(Foam::lgamma(2.5 - omegaPQ));
|
||||
// calculating cross section = pi*dPQ^2, where dPQ is from Bird, eq. 4.79
|
||||
scalar sigmaTPQ =
|
||||
mathematicalConstant::pi*dPQ*dPQ
|
||||
*pow(2.0*CloudType::kb*CloudType::Tref/(mR*cR*cR), omegaPQ - 0.5)
|
||||
/exp(Foam::lgamma(2.5 - omegaPQ));
|
||||
|
||||
return sigmaTPQ*cR;
|
||||
}
|
||||
@ -114,12 +119,14 @@ void Foam::VariableHardSphere<CloudType>::collide
|
||||
|
||||
scalar phi = 2.0*mathematicalConstant::pi*rndGen.scalar01();
|
||||
|
||||
vector postCollisionRelU = cR*vector
|
||||
(
|
||||
cosTheta,
|
||||
sinTheta*cos(phi),
|
||||
sinTheta*sin(phi)
|
||||
);
|
||||
vector postCollisionRelU =
|
||||
cR
|
||||
*vector
|
||||
(
|
||||
cosTheta,
|
||||
sinTheta*cos(phi),
|
||||
sinTheta*sin(phi)
|
||||
);
|
||||
|
||||
UP = Ucm + postCollisionRelU*mQ/(mP + mQ);
|
||||
|
||||
|
||||
@ -47,11 +47,6 @@ class VariableHardSphere
|
||||
:
|
||||
public BinaryCollisionModel<CloudType>
|
||||
{
|
||||
|
||||
// Private data
|
||||
|
||||
// const scalar something_;
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -69,8 +64,7 @@ public:
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~VariableHardSphere();
|
||||
virtual ~VariableHardSphere();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -24,8 +24,6 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
|
||||
#include "MaxwellianThermal.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
@ -108,8 +106,13 @@ void Foam::MaxwellianThermal<CloudType>::correct
|
||||
|
||||
scalar C = sqrt(CloudType::kb*T_/mass);
|
||||
|
||||
U = C*(rndGen.GaussNormal()*tw1 + rndGen.GaussNormal()*tw2
|
||||
- sqrt(-2.0*log(max(1 - rndGen.scalar01(),VSMALL)))*nw);
|
||||
U =
|
||||
C
|
||||
*(
|
||||
rndGen.GaussNormal()*tw1
|
||||
+ rndGen.GaussNormal()*tw2
|
||||
- sqrt(-2.0*log(max(1 - rndGen.scalar01(),VSMALL)))*nw
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -49,7 +49,6 @@ class MaxwellianThermal
|
||||
:
|
||||
public WallInteractionModel<CloudType>
|
||||
{
|
||||
|
||||
// Private data
|
||||
|
||||
//- Temperature
|
||||
@ -73,8 +72,7 @@ public:
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~MaxwellianThermal();
|
||||
virtual ~MaxwellianThermal();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -48,7 +48,6 @@ class SpecularReflection
|
||||
:
|
||||
public WallInteractionModel<CloudType>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -66,8 +65,7 @@ public:
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~SpecularReflection();
|
||||
virtual ~SpecularReflection();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -36,10 +36,7 @@ Foam::WallInteractionModel<CloudType>::New
|
||||
CloudType& owner
|
||||
)
|
||||
{
|
||||
word WallInteractionModelType
|
||||
(
|
||||
dict.lookup("WallInteractionModel")
|
||||
);
|
||||
word WallInteractionModelType(dict.lookup("WallInteractionModel"));
|
||||
|
||||
Info<< "Selecting WallInteractionModel " << WallInteractionModelType
|
||||
<< endl;
|
||||
@ -57,7 +54,7 @@ Foam::WallInteractionModel<CloudType>::New
|
||||
<< "Unknown WallInteractionModelType type "
|
||||
<< WallInteractionModelType
|
||||
<< ", constructor not in hash table" << nl << nl
|
||||
<< " Valid WallInteractionModel types are :" << nl
|
||||
<< " Valid WallInteractionModel types are:" << nl
|
||||
<< dictionaryConstructorTablePtr_->toc() << exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,6 @@ License
|
||||
Class
|
||||
Foam::WallInteractionModel
|
||||
|
||||
|
||||
Description
|
||||
Templated wall interaction model class
|
||||
|
||||
@ -54,7 +53,6 @@ namespace Foam
|
||||
template<class CloudType>
|
||||
class WallInteractionModel
|
||||
{
|
||||
|
||||
// Private data
|
||||
|
||||
//- The cloud dictionary
|
||||
@ -98,17 +96,15 @@ public:
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~WallInteractionModel();
|
||||
virtual ~WallInteractionModel();
|
||||
|
||||
|
||||
// Selector
|
||||
|
||||
static autoPtr<WallInteractionModel<CloudType> > New
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
);
|
||||
//- Selector
|
||||
static autoPtr<WallInteractionModel<CloudType> > New
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
);
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
Reference in New Issue
Block a user