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