mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -1,162 +0,0 @@
|
|||||||
|
|
||||||
Info<< nl << "Reading field boundaryT" << endl;
|
|
||||||
volScalarField boundaryT
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"boundaryT",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field boundaryU" << endl;
|
|
||||||
volVectorField boundaryU
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"boundaryU",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field rhoN (number density)" << endl;
|
|
||||||
volScalarField rhoN
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"rhoN",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field rhoM (mass density)" << endl;
|
|
||||||
volScalarField rhoM
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"rhoM",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field rhoNdsmc (dsmc particle density)" << endl;
|
|
||||||
volScalarField dsmcRhoN
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"dsmcRhoN",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field momentum (momentum density)" << endl;
|
|
||||||
volVectorField momentum
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"momentum",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field linearKE (linear kinetic energy density)"
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
volScalarField linearKE
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"linearKE",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field internalE (internal energy density)" << endl;
|
|
||||||
volScalarField internalE
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"internalE",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field iDof (internal degree of freedom density)"
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
volScalarField iDof
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"iDof",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field q (surface heat transfer)" << endl;
|
|
||||||
volScalarField q
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"q",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Reading field fD (surface force density)" << endl;
|
|
||||||
volVectorField fD
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"fD",
|
|
||||||
runTime.timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< nl << "Constructing dsmcCloud " << endl;
|
|
||||||
|
|
||||||
dsmcCloud dsmc("dsmc", boundaryT, boundaryU);
|
|
||||||
@ -41,53 +41,21 @@ int main(int argc, char *argv[])
|
|||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
#include "createFields.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Info<< nl << "Constructing dsmcCloud " << endl;
|
||||||
|
|
||||||
|
dsmcCloud dsmc("dsmc", mesh);
|
||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
while (runTime.run())
|
while (runTime.loop())
|
||||||
{
|
{
|
||||||
runTime++;
|
|
||||||
|
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
// Carry out dsmcCloud timestep
|
|
||||||
|
|
||||||
dsmc.evolve();
|
dsmc.evolve();
|
||||||
|
|
||||||
// Retrieve flow field data from dsmcCloud
|
|
||||||
|
|
||||||
rhoN = dsmc.rhoN();
|
|
||||||
rhoN.correctBoundaryConditions();
|
|
||||||
|
|
||||||
rhoM = dsmc.rhoM();
|
|
||||||
rhoM.correctBoundaryConditions();
|
|
||||||
|
|
||||||
dsmcRhoN = dsmc.dsmcRhoN();
|
|
||||||
dsmcRhoN.correctBoundaryConditions();
|
|
||||||
|
|
||||||
momentum = dsmc.momentum();
|
|
||||||
momentum.correctBoundaryConditions();
|
|
||||||
|
|
||||||
linearKE = dsmc.linearKE();
|
|
||||||
linearKE.correctBoundaryConditions();
|
|
||||||
|
|
||||||
internalE = dsmc.internalE();
|
|
||||||
internalE.correctBoundaryConditions();
|
|
||||||
|
|
||||||
iDof = dsmc.iDof();
|
|
||||||
iDof.correctBoundaryConditions();
|
|
||||||
|
|
||||||
// Retrieve surface field data from dsmcCloud
|
|
||||||
|
|
||||||
q = dsmc.q();
|
|
||||||
|
|
||||||
fD = dsmc.fD();
|
|
||||||
|
|
||||||
// Print status of dsmcCloud
|
|
||||||
|
|
||||||
dsmc.info();
|
dsmc.info();
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|||||||
@ -113,7 +113,16 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wordList extensiveVVFNames(IStringStream ("(momentumMean)")());
|
wordList extensiveVVFNames
|
||||||
|
(
|
||||||
|
IStringStream
|
||||||
|
(
|
||||||
|
"( \
|
||||||
|
momentumMean \
|
||||||
|
fDMean \
|
||||||
|
)"
|
||||||
|
)()
|
||||||
|
);
|
||||||
|
|
||||||
PtrList<volVectorField> extensiveVVFs(extensiveVVFNames.size());
|
PtrList<volVectorField> extensiveVVFs(extensiveVVFNames.size());
|
||||||
|
|
||||||
|
|||||||
@ -44,9 +44,21 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
IOdictionary dsmcInitialiseDict
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"dsmcInitialiseDict",
|
||||||
|
mesh.time().system(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
Info<< "Initialising dsmc for Time = " << runTime.timeName() << nl << endl;
|
Info<< "Initialising dsmc for Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
dsmcCloud dsmc("dsmc", mesh);
|
dsmcCloud dsmc("dsmc", mesh, dsmcInitialiseDict);
|
||||||
|
|
||||||
label totalMolecules = dsmc.size();
|
label totalMolecules = dsmc.size();
|
||||||
|
|
||||||
|
|||||||
@ -377,6 +377,7 @@ DebugSwitches
|
|||||||
displacementLaplacian 0;
|
displacementLaplacian 0;
|
||||||
displacementSBRStress 0;
|
displacementSBRStress 0;
|
||||||
distanceSurface 0;
|
distanceSurface 0;
|
||||||
|
distribution 0;
|
||||||
downwind 0;
|
downwind 0;
|
||||||
dragModel 0;
|
dragModel 0;
|
||||||
duplicatePoints 0;
|
duplicatePoints 0;
|
||||||
|
|||||||
@ -4,9 +4,6 @@ parcels/derived/dsmcParcel/dsmcParcel.C
|
|||||||
/* Cloud base classes */
|
/* Cloud base classes */
|
||||||
clouds/baseClasses/DsmcBaseCloud/DsmcBaseCloud.C
|
clouds/baseClasses/DsmcBaseCloud/DsmcBaseCloud.C
|
||||||
|
|
||||||
/* Clouds */
|
|
||||||
clouds/derived/dsmcCloud/dsmcCloud.C
|
|
||||||
|
|
||||||
/* submodels */
|
/* submodels */
|
||||||
parcels/derived/dsmcParcel/defineDsmcParcel.C
|
parcels/derived/dsmcParcel/defineDsmcParcel.C
|
||||||
parcels/derived/dsmcParcel/makeDsmcParcelBinaryCollisionModels.C
|
parcels/derived/dsmcParcel/makeDsmcParcelBinaryCollisionModels.C
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-llagrangian \
|
-llagrangian \
|
||||||
-lfiniteVolume
|
-lfiniteVolume \
|
||||||
|
-lmeshTools
|
||||||
|
|||||||
@ -297,7 +297,7 @@ void Foam::DsmcCloud<ParcelType>::collisions()
|
|||||||
// Temporary storage for subCells
|
// Temporary storage for subCells
|
||||||
List<DynamicList<label> > subCells(8);
|
List<DynamicList<label> > subCells(8);
|
||||||
|
|
||||||
scalar deltaT = cachedDeltaT();
|
scalar deltaT = mesh().time().deltaTValue();
|
||||||
|
|
||||||
label collisionCandidates = 0;
|
label collisionCandidates = 0;
|
||||||
|
|
||||||
@ -473,21 +473,92 @@ void Foam::DsmcCloud<ParcelType>::collisions()
|
|||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
void Foam::DsmcCloud<ParcelType>::resetSurfaceDataFields()
|
void Foam::DsmcCloud<ParcelType>::resetFields()
|
||||||
{
|
{
|
||||||
volScalarField::GeometricBoundaryField& qBF(q_.boundaryField());
|
q_ = dimensionedScalar("zero", dimensionSet(1, 0, -3, 0, 0), 0.0);
|
||||||
|
|
||||||
forAll(qBF, p)
|
fD_ = dimensionedVector
|
||||||
{
|
(
|
||||||
qBF[p] = 0.0;
|
"zero",
|
||||||
|
dimensionSet(1, -1, -2, 0, 0),
|
||||||
|
vector::zero
|
||||||
|
);
|
||||||
|
|
||||||
|
rhoN_ = dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), VSMALL);
|
||||||
|
|
||||||
|
rhoM_ = dimensionedScalar("zero", dimensionSet(1, -3, 0, 0, 0), VSMALL);
|
||||||
|
|
||||||
|
dsmcRhoN_ = dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), 0.0);
|
||||||
|
|
||||||
|
linearKE_ = dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0);
|
||||||
|
|
||||||
|
internalE_ = dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0);
|
||||||
|
|
||||||
|
iDof_ = dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), VSMALL);
|
||||||
|
|
||||||
|
momentum_ = dimensionedVector
|
||||||
|
(
|
||||||
|
"zero",
|
||||||
|
dimensionSet(1, -2, -1, 0, 0),
|
||||||
|
vector::zero
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
volVectorField::GeometricBoundaryField& fDBF(fD_.boundaryField());
|
|
||||||
|
|
||||||
forAll(fDBF, p)
|
template<class ParcelType>
|
||||||
|
void Foam::DsmcCloud<ParcelType>::calculateFields()
|
||||||
{
|
{
|
||||||
fDBF[p] = vector::zero;
|
scalarField& rhoN = rhoN_.internalField();
|
||||||
|
|
||||||
|
scalarField& rhoM = rhoM_.internalField();
|
||||||
|
|
||||||
|
scalarField& dsmcRhoN = dsmcRhoN_.internalField();
|
||||||
|
|
||||||
|
scalarField& linearKE = linearKE_.internalField();
|
||||||
|
|
||||||
|
scalarField& internalE = internalE_.internalField();
|
||||||
|
|
||||||
|
scalarField& iDof = iDof_.internalField();
|
||||||
|
|
||||||
|
vectorField& momentum = momentum_.internalField();
|
||||||
|
|
||||||
|
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
|
||||||
|
{
|
||||||
|
const ParcelType& p = iter();
|
||||||
|
const label cellI = p.cell();
|
||||||
|
|
||||||
|
rhoN[cellI]++;
|
||||||
|
|
||||||
|
rhoM[cellI] += constProps(p.typeId()).mass();
|
||||||
|
|
||||||
|
dsmcRhoN[cellI]++;
|
||||||
|
|
||||||
|
linearKE[cellI] += 0.5*constProps(p.typeId()).mass()*(p.U() & p.U());
|
||||||
|
|
||||||
|
internalE[cellI] += p.Ei();
|
||||||
|
|
||||||
|
iDof[cellI] += constProps(p.typeId()).internalDegreesOfFreedom();
|
||||||
|
|
||||||
|
momentum[cellI] += constProps(p.typeId()).mass()*p.U();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rhoN *= nParticle_/mesh().cellVolumes();
|
||||||
|
rhoN_.correctBoundaryConditions();
|
||||||
|
|
||||||
|
rhoM *= nParticle_/mesh().cellVolumes();
|
||||||
|
rhoM_.correctBoundaryConditions();
|
||||||
|
|
||||||
|
linearKE *= nParticle_/mesh().cellVolumes();
|
||||||
|
linearKE_.correctBoundaryConditions();
|
||||||
|
|
||||||
|
internalE *= nParticle_/mesh().cellVolumes();
|
||||||
|
internalE_.correctBoundaryConditions();
|
||||||
|
|
||||||
|
iDof *= nParticle_/mesh().cellVolumes();
|
||||||
|
iDof_.correctBoundaryConditions();
|
||||||
|
|
||||||
|
momentum *= nParticle_/mesh().cellVolumes();
|
||||||
|
momentum_.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -523,15 +594,14 @@ template<class ParcelType>
|
|||||||
Foam::DsmcCloud<ParcelType>::DsmcCloud
|
Foam::DsmcCloud<ParcelType>::DsmcCloud
|
||||||
(
|
(
|
||||||
const word& cloudName,
|
const word& cloudName,
|
||||||
const volScalarField& T,
|
const fvMesh& mesh,
|
||||||
const volVectorField& U,
|
|
||||||
bool readFields
|
bool readFields
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Cloud<ParcelType>(T.mesh(), cloudName, false),
|
Cloud<ParcelType>(mesh, cloudName, false),
|
||||||
DsmcBaseCloud(),
|
DsmcBaseCloud(),
|
||||||
cloudName_(cloudName),
|
cloudName_(cloudName),
|
||||||
mesh_(T.mesh()),
|
mesh_(mesh),
|
||||||
particleProperties_
|
particleProperties_
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -563,37 +633,142 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
this->name() + "q_",
|
"q",
|
||||||
mesh_.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::AUTO_WRITE
|
||||||
),
|
),
|
||||||
mesh_,
|
mesh_
|
||||||
dimensionedScalar("zero", dimensionSet(1, 0, -3, 0, 0), 0.0)
|
|
||||||
),
|
),
|
||||||
fD_
|
fD_
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
this->name() + "fD_",
|
"fD",
|
||||||
mesh_.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::AUTO_WRITE
|
||||||
),
|
),
|
||||||
mesh_,
|
mesh_
|
||||||
dimensionedVector
|
),
|
||||||
|
rhoN_
|
||||||
(
|
(
|
||||||
"zero",
|
IOobject
|
||||||
dimensionSet(1, -1, -2, 0, 0),
|
(
|
||||||
vector::zero
|
"rhoN",
|
||||||
)
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
),
|
||||||
|
rhoM_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"rhoM",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
),
|
||||||
|
dsmcRhoN_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"dsmcRhoN",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
),
|
||||||
|
linearKE_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"linearKE",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
),
|
||||||
|
internalE_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"internalE",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
),
|
||||||
|
iDof_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"iDof",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
),
|
||||||
|
momentum_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"momentum",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
),
|
),
|
||||||
constProps_(),
|
constProps_(),
|
||||||
rndGen_(label(149382906) + 7183*Pstream::myProcNo()),
|
rndGen_(label(149382906) + 7183*Pstream::myProcNo()),
|
||||||
T_(T),
|
boundaryT_
|
||||||
U_(U),
|
(
|
||||||
|
volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"boundaryT",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
)
|
||||||
|
),
|
||||||
|
boundaryU_
|
||||||
|
(
|
||||||
|
volVectorField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"boundaryU",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
)
|
||||||
|
),
|
||||||
binaryCollisionModel_
|
binaryCollisionModel_
|
||||||
(
|
(
|
||||||
BinaryCollisionModel<DsmcCloud<ParcelType> >::New
|
BinaryCollisionModel<DsmcCloud<ParcelType> >::New
|
||||||
@ -641,7 +816,8 @@ template<class ParcelType>
|
|||||||
Foam::DsmcCloud<ParcelType>::DsmcCloud
|
Foam::DsmcCloud<ParcelType>::DsmcCloud
|
||||||
(
|
(
|
||||||
const word& cloudName,
|
const word& cloudName,
|
||||||
const fvMesh& mesh
|
const fvMesh& mesh,
|
||||||
|
const IOdictionary& dsmcInitialiseDict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Cloud<ParcelType>(mesh, cloudName, false),
|
Cloud<ParcelType>(mesh, cloudName, false),
|
||||||
@ -707,15 +883,111 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
|
|||||||
vector::zero
|
vector::zero
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
rhoN_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
this->name() + "rhoN_",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), VSMALL)
|
||||||
|
),
|
||||||
|
rhoM_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
this->name() + "rhoM_",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("zero", dimensionSet(1, -3, 0, 0, 0), VSMALL)
|
||||||
|
),
|
||||||
|
dsmcRhoN_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
this->name() + "dsmcRhoN_",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), 0.0)
|
||||||
|
),
|
||||||
|
linearKE_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
this->name() + "linearKE_",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0)
|
||||||
|
),
|
||||||
|
internalE_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
this->name() + "internalE_",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0)
|
||||||
|
),
|
||||||
|
iDof_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
this->name() + "iDof_",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), VSMALL)
|
||||||
|
),
|
||||||
|
momentum_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
this->name() + "momentum_",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedVector
|
||||||
|
(
|
||||||
|
"zero",
|
||||||
|
dimensionSet(1, -2, -1, 0, 0),
|
||||||
|
vector::zero
|
||||||
|
)
|
||||||
|
),
|
||||||
constProps_(),
|
constProps_(),
|
||||||
rndGen_(label(971501) + 1526*Pstream::myProcNo()),
|
rndGen_(label(971501) + 1526*Pstream::myProcNo()),
|
||||||
T_
|
boundaryT_
|
||||||
(
|
(
|
||||||
volScalarField
|
volScalarField
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"T",
|
"boundaryT",
|
||||||
mesh_.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -725,13 +997,13 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
|
|||||||
dimensionedScalar("zero", dimensionSet(0, 0, 0, 1, 0), 0.0)
|
dimensionedScalar("zero", dimensionSet(0, 0, 0, 1, 0), 0.0)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
U_
|
boundaryU_
|
||||||
(
|
(
|
||||||
volVectorField
|
volVectorField
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"U",
|
"boundaryU",
|
||||||
mesh_.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -754,18 +1026,6 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
|
|||||||
|
|
||||||
buildConstProps();
|
buildConstProps();
|
||||||
|
|
||||||
IOdictionary dsmcInitialiseDict
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"dsmcInitialiseDict",
|
|
||||||
mesh_.time().system(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
initialise(dsmcInitialiseDict);
|
initialise(dsmcInitialiseDict);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -782,13 +1042,10 @@ Foam::DsmcCloud<ParcelType>::~DsmcCloud()
|
|||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
void Foam::DsmcCloud<ParcelType>::evolve()
|
void Foam::DsmcCloud<ParcelType>::evolve()
|
||||||
{
|
{
|
||||||
// cache the value of deltaT for this timestep
|
|
||||||
storeDeltaT();
|
|
||||||
|
|
||||||
typename ParcelType::trackData td(*this);
|
typename ParcelType::trackData td(*this);
|
||||||
|
|
||||||
// Reset the surface data collection fields
|
// Reset the data collection fields
|
||||||
resetSurfaceDataFields();
|
resetFields();
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -803,6 +1060,9 @@ void Foam::DsmcCloud<ParcelType>::evolve()
|
|||||||
|
|
||||||
// Calculate new velocities via stochastic collisions
|
// Calculate new velocities via stochastic collisions
|
||||||
collisions();
|
collisions();
|
||||||
|
|
||||||
|
// Calculate the volume field data
|
||||||
|
calculateFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -110,24 +110,41 @@ class DsmcCloud
|
|||||||
//- Force density at surface field
|
//- Force density at surface field
|
||||||
volVectorField fD_;
|
volVectorField fD_;
|
||||||
|
|
||||||
|
//- number density field
|
||||||
|
volScalarField rhoN_;
|
||||||
|
|
||||||
|
//- Mass density field
|
||||||
|
volScalarField rhoM_;
|
||||||
|
|
||||||
|
//- dsmc particle density field
|
||||||
|
volScalarField dsmcRhoN_;
|
||||||
|
|
||||||
|
//- linear kinetic energy density field
|
||||||
|
volScalarField linearKE_;
|
||||||
|
|
||||||
|
//- Internal energy density field
|
||||||
|
volScalarField internalE_;
|
||||||
|
|
||||||
|
// Internal degree of freedom density field
|
||||||
|
volScalarField iDof_;
|
||||||
|
|
||||||
|
//- Momentum density field
|
||||||
|
volVectorField momentum_;
|
||||||
|
|
||||||
//- Parcel constant properties - one for each type
|
//- Parcel constant properties - one for each type
|
||||||
List<typename ParcelType::constantProperties> constProps_;
|
List<typename ParcelType::constantProperties> constProps_;
|
||||||
|
|
||||||
//- Random number generator
|
//- Random number generator
|
||||||
Random rndGen_;
|
Random rndGen_;
|
||||||
|
|
||||||
//- In-cloud cache of deltaT, lookup in submodels and parcel is
|
|
||||||
// expensive
|
|
||||||
scalar cachedDeltaT_;
|
|
||||||
|
|
||||||
|
// boundary value fields
|
||||||
|
|
||||||
// References to the macroscopic fields
|
//- boundary temperature
|
||||||
|
volScalarField boundaryT_;
|
||||||
|
|
||||||
//- Temperature
|
//- boundary velocity
|
||||||
const volScalarField& T_;
|
volVectorField boundaryU_;
|
||||||
|
|
||||||
//- Velocity
|
|
||||||
const volVectorField& U_;
|
|
||||||
|
|
||||||
|
|
||||||
// References to the cloud sub-models
|
// References to the cloud sub-models
|
||||||
@ -159,8 +176,11 @@ class DsmcCloud
|
|||||||
//- Calculate collisions between molecules
|
//- Calculate collisions between molecules
|
||||||
void collisions();
|
void collisions();
|
||||||
|
|
||||||
//- Reset the surface data accumulation field values
|
//- Reset the data accumulation field values to zero
|
||||||
void resetSurfaceDataFields();
|
void resetFields();
|
||||||
|
|
||||||
|
//- Calculate the volume field data
|
||||||
|
void calculateFields();
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
DsmcCloud(const DsmcCloud&);
|
DsmcCloud(const DsmcCloud&);
|
||||||
@ -173,20 +193,21 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct given name and mesh, will read Parcels from file
|
//- Construct given name and mesh, will read Parcels and fields from
|
||||||
|
// file
|
||||||
DsmcCloud
|
DsmcCloud
|
||||||
(
|
(
|
||||||
const word& cloudName,
|
const word& cloudName,
|
||||||
const volScalarField& T,
|
const fvMesh& mesh,
|
||||||
const volVectorField& U,
|
|
||||||
bool readFields = true
|
bool readFields = true
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct given name and mesh. Used to initialise.
|
//- Construct given name, mesh and initialisation dictionary.
|
||||||
DsmcCloud
|
DsmcCloud
|
||||||
(
|
(
|
||||||
const word& cloudName,
|
const word& cloudName,
|
||||||
const fvMesh& mesh
|
const fvMesh& mesh,
|
||||||
|
const IOdictionary& dsmcInitialiseDict
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -242,35 +263,72 @@ public:
|
|||||||
//- Return refernce to the random object
|
//- Return refernce to the random object
|
||||||
inline Random& rndGen();
|
inline Random& rndGen();
|
||||||
|
|
||||||
//- Store (cache) the current value of deltaT
|
|
||||||
inline void storeDeltaT();
|
|
||||||
|
|
||||||
//- Return the cached value of deltaT
|
// References to the boundary fields for surface data collection
|
||||||
inline scalar cachedDeltaT() const;
|
|
||||||
|
|
||||||
|
//- Return non-const heat flux boundary field reference
|
||||||
|
inline volScalarField::GeometricBoundaryField& qBF();
|
||||||
|
|
||||||
// References to the surface data collection fields
|
//- Return non-const force density at boundary field reference
|
||||||
|
inline volVectorField::GeometricBoundaryField& fDBF();
|
||||||
|
|
||||||
//- Return heat flux at surface field
|
//- Return non-const number density boundary field reference
|
||||||
inline const volScalarField& q() const;
|
inline volScalarField::GeometricBoundaryField& rhoNBF();
|
||||||
|
|
||||||
//- Return non-const heat flux at surface field
|
//- Return non-const mass density boundary field reference
|
||||||
inline volScalarField& q();
|
inline volScalarField::GeometricBoundaryField& rhoMBF();
|
||||||
|
|
||||||
//- Return force density at surface field
|
//- Return non-const linear kinetic energy density boundary
|
||||||
inline const volVectorField& fD() const;
|
// field reference
|
||||||
|
inline volScalarField::GeometricBoundaryField& linearKEBF();
|
||||||
|
|
||||||
//- Return non-const force density at surface field
|
//- Return non-const internal energy density boundary field
|
||||||
inline volVectorField& fD();
|
// reference
|
||||||
|
inline volScalarField::GeometricBoundaryField& internalEBF();
|
||||||
|
|
||||||
|
//- Return non-const internal degree of freedom density boundary
|
||||||
|
// field reference
|
||||||
|
inline volScalarField::GeometricBoundaryField& iDofBF();
|
||||||
|
|
||||||
|
//- Return non-const momentum density boundary field reference
|
||||||
|
inline volVectorField::GeometricBoundaryField& momentumBF();
|
||||||
|
|
||||||
|
|
||||||
// References to the macroscopic fields
|
// References to the macroscopic fields
|
||||||
|
|
||||||
//- Return macroscopic temperature
|
//- Return macroscopic temperature
|
||||||
inline const volScalarField& T() const;
|
inline const volScalarField& boundaryT() const;
|
||||||
|
|
||||||
//- Return macroscopic velocity
|
//- Return macroscopic velocity
|
||||||
inline const volVectorField& U() const;
|
inline const volVectorField& boundaryU() const;
|
||||||
|
|
||||||
|
//- Return heat flux at surface field
|
||||||
|
inline const volScalarField& q() const;
|
||||||
|
|
||||||
|
//- Return force density at surface field
|
||||||
|
inline const volVectorField& fD() const;
|
||||||
|
|
||||||
|
//- Return the real particle number density field
|
||||||
|
inline const volScalarField& rhoN() const;
|
||||||
|
|
||||||
|
//- Return the particle mass density field
|
||||||
|
inline const volScalarField& rhoM() const;
|
||||||
|
|
||||||
|
//- Return the field of number of DSMC particles
|
||||||
|
inline const volScalarField& dsmcRhoN() const;
|
||||||
|
|
||||||
|
//- Return the total linear kinetic energy (translational and
|
||||||
|
// thermal density field
|
||||||
|
inline const volScalarField& linearKE() const;
|
||||||
|
|
||||||
|
//- Return the internal energy density field
|
||||||
|
inline const volScalarField& internalE() const;
|
||||||
|
|
||||||
|
//- Return the average internal degrees of freedom field
|
||||||
|
inline const volScalarField& iDof() const;
|
||||||
|
|
||||||
|
//- Return the momentum density field
|
||||||
|
inline const volVectorField& momentum() const;
|
||||||
|
|
||||||
|
|
||||||
// Kinetic theory helper functions
|
// Kinetic theory helper functions
|
||||||
@ -385,29 +443,6 @@ public:
|
|||||||
void dumpParticlePositions() const;
|
void dumpParticlePositions() const;
|
||||||
|
|
||||||
|
|
||||||
// Fields
|
|
||||||
|
|
||||||
//- Return the real particle number density field
|
|
||||||
inline const tmp<volScalarField> rhoN() const;
|
|
||||||
|
|
||||||
//- Return the particle mass density field
|
|
||||||
inline const tmp<volScalarField> rhoM() const;
|
|
||||||
|
|
||||||
//- Return the field of number of DSMC particles
|
|
||||||
inline const tmp<volScalarField> dsmcRhoN() const;
|
|
||||||
|
|
||||||
//- Return the momentum density field
|
|
||||||
inline const tmp<volVectorField> momentum() const;
|
|
||||||
|
|
||||||
//- Return the total linear kinetic energy (translational and
|
|
||||||
// thermal density field
|
|
||||||
inline const tmp<volScalarField> linearKE() const;
|
|
||||||
|
|
||||||
//- Return the internal energy density field
|
|
||||||
inline const tmp<volScalarField> internalE() const;
|
|
||||||
|
|
||||||
//- Return the average internal degrees of freedom field
|
|
||||||
inline const tmp<volScalarField> iDof() const;
|
|
||||||
|
|
||||||
|
|
||||||
// Cloud evolution functions
|
// Cloud evolution functions
|
||||||
|
|||||||
@ -126,58 +126,82 @@ inline Foam::Random& Foam::DsmcCloud<ParcelType>::rndGen()
|
|||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline void Foam::DsmcCloud<ParcelType>::storeDeltaT()
|
inline Foam::volScalarField::GeometricBoundaryField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::qBF()
|
||||||
{
|
{
|
||||||
cachedDeltaT_ = mesh().time().deltaTValue();
|
return q_.boundaryField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline Foam::scalar Foam::DsmcCloud<ParcelType>::cachedDeltaT() const
|
inline Foam::volVectorField::GeometricBoundaryField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::fDBF()
|
||||||
{
|
{
|
||||||
return cachedDeltaT_;
|
return fD_.boundaryField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::volScalarField& Foam::DsmcCloud<ParcelType>::q() const
|
inline Foam::volScalarField::GeometricBoundaryField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::rhoNBF()
|
||||||
{
|
{
|
||||||
return q_;
|
return rhoN_.boundaryField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline Foam::volScalarField& Foam::DsmcCloud<ParcelType>::q()
|
inline Foam::volScalarField::GeometricBoundaryField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::rhoMBF()
|
||||||
{
|
{
|
||||||
return q_;
|
return rhoM_.boundaryField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::volVectorField& Foam::DsmcCloud<ParcelType>::fD() const
|
inline Foam::volScalarField::GeometricBoundaryField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::linearKEBF()
|
||||||
{
|
{
|
||||||
return fD_;
|
return linearKE_.boundaryField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline Foam::volVectorField& Foam::DsmcCloud<ParcelType>::fD()
|
inline Foam::volScalarField::GeometricBoundaryField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::internalEBF()
|
||||||
{
|
{
|
||||||
return fD_;
|
return internalE_.boundaryField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::volScalarField& Foam::DsmcCloud<ParcelType>::T() const
|
inline Foam::volScalarField::GeometricBoundaryField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::iDofBF()
|
||||||
{
|
{
|
||||||
return T_;
|
return iDof_.boundaryField();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::volVectorField& Foam::DsmcCloud<ParcelType>::U() const
|
inline Foam::volVectorField::GeometricBoundaryField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::momentumBF()
|
||||||
{
|
{
|
||||||
return U_;
|
return momentum_.boundaryField();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ParcelType>
|
||||||
|
inline const Foam::volScalarField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::boundaryT() const
|
||||||
|
{
|
||||||
|
return boundaryT_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ParcelType>
|
||||||
|
inline const Foam::volVectorField&
|
||||||
|
Foam::DsmcCloud<ParcelType>::boundaryU() const
|
||||||
|
{
|
||||||
|
return boundaryU_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -381,265 +405,70 @@ Foam::DsmcCloud<ParcelType>::maxwellianMostProbableSpeed
|
|||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::tmp<Foam::volScalarField>
|
inline const Foam::volScalarField& Foam::DsmcCloud<ParcelType>::q() const
|
||||||
|
{
|
||||||
|
return q_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ParcelType>
|
||||||
|
inline const Foam::volVectorField& Foam::DsmcCloud<ParcelType>::fD() const
|
||||||
|
{
|
||||||
|
return fD_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ParcelType>
|
||||||
|
inline const Foam::volScalarField&
|
||||||
Foam::DsmcCloud<ParcelType>::rhoN() const
|
Foam::DsmcCloud<ParcelType>::rhoN() const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> trhoN
|
return rhoN_;
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
this->name() + "rhoN",
|
|
||||||
this->db().time().timeName(),
|
|
||||||
this->db(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), VSMALL)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
scalarField& rhoN = trhoN().internalField();
|
|
||||||
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
|
|
||||||
{
|
|
||||||
const ParcelType& p = iter();
|
|
||||||
const label cellI = p.cell();
|
|
||||||
|
|
||||||
rhoN[cellI]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
rhoN *= nParticle_/mesh().cellVolumes();
|
|
||||||
|
|
||||||
return trhoN;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::tmp<Foam::volScalarField>
|
inline const Foam::volScalarField& Foam::DsmcCloud<ParcelType>::rhoM() const
|
||||||
Foam::DsmcCloud<ParcelType>::rhoM() const
|
|
||||||
{
|
{
|
||||||
tmp<volScalarField> trhoM
|
return rhoM_;
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
this->name() + "rhoM",
|
|
||||||
this->db().time().timeName(),
|
|
||||||
this->db(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar("zero", dimensionSet(1, -3, 0, 0, 0), VSMALL)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
scalarField& rhoM = trhoM().internalField();
|
|
||||||
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
|
|
||||||
{
|
|
||||||
const ParcelType& p = iter();
|
|
||||||
const label cellI = p.cell();
|
|
||||||
|
|
||||||
rhoM[cellI] += constProps(p.typeId()).mass();
|
|
||||||
}
|
|
||||||
|
|
||||||
rhoM *= nParticle_/mesh().cellVolumes();
|
|
||||||
|
|
||||||
return trhoM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::tmp<Foam::volScalarField>
|
inline const Foam::volScalarField&
|
||||||
Foam::DsmcCloud<ParcelType>::dsmcRhoN() const
|
Foam::DsmcCloud<ParcelType>::dsmcRhoN() const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tdsmcRhoN
|
return dsmcRhoN_;
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
this->name() + "dsmcRhoN",
|
|
||||||
this->db().time().timeName(),
|
|
||||||
this->db(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), 0.0)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
scalarField& dsmcRhoN = tdsmcRhoN().internalField();
|
|
||||||
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
|
|
||||||
{
|
|
||||||
const ParcelType& p = iter();
|
|
||||||
const label cellI = p.cell();
|
|
||||||
|
|
||||||
dsmcRhoN[cellI]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return tdsmcRhoN;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::tmp<Foam::volVectorField>
|
inline const Foam::volScalarField&
|
||||||
Foam::DsmcCloud<ParcelType>::momentum() const
|
|
||||||
{
|
|
||||||
tmp<volVectorField> tmomentum
|
|
||||||
(
|
|
||||||
new volVectorField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
this->name() + "momentum",
|
|
||||||
this->db().time().timeName(),
|
|
||||||
this->db(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedVector
|
|
||||||
(
|
|
||||||
"zero",
|
|
||||||
dimensionSet(1, -2, -1, 0, 0),
|
|
||||||
vector::zero
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
vectorField& momentum = tmomentum().internalField();
|
|
||||||
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
|
|
||||||
{
|
|
||||||
const ParcelType& p = iter();
|
|
||||||
const label cellI = p.cell();
|
|
||||||
|
|
||||||
momentum[cellI] += constProps(p.typeId()).mass()*p.U();
|
|
||||||
}
|
|
||||||
|
|
||||||
momentum *= nParticle_/mesh().cellVolumes();
|
|
||||||
|
|
||||||
return tmomentum;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
|
||||||
inline const Foam::tmp<Foam::volScalarField>
|
|
||||||
Foam::DsmcCloud<ParcelType>::linearKE() const
|
Foam::DsmcCloud<ParcelType>::linearKE() const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tlinearKE
|
return linearKE_;
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
this->name() + "linearKE",
|
|
||||||
this->db().time().timeName(),
|
|
||||||
this->db(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
scalarField& linearKE = tlinearKE().internalField();
|
|
||||||
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
|
|
||||||
{
|
|
||||||
const ParcelType& p = iter();
|
|
||||||
const label cellI = p.cell();
|
|
||||||
|
|
||||||
linearKE[cellI] += 0.5*constProps(p.typeId()).mass()*(p.U() & p.U());
|
|
||||||
}
|
|
||||||
|
|
||||||
linearKE *= nParticle_/mesh().cellVolumes();
|
|
||||||
|
|
||||||
return tlinearKE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::tmp<Foam::volScalarField>
|
inline const Foam::volScalarField&
|
||||||
Foam::DsmcCloud<ParcelType>::internalE() const
|
Foam::DsmcCloud<ParcelType>::internalE() const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tinternalE
|
return internalE_;
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
this->name() + "internalE",
|
|
||||||
this->db().time().timeName(),
|
|
||||||
this->db(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar("zero", dimensionSet(1, -1, -2, 0, 0), 0.0)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
scalarField& internalE = tinternalE().internalField();
|
|
||||||
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
|
|
||||||
{
|
|
||||||
const ParcelType& p = iter();
|
|
||||||
const label cellI = p.cell();
|
|
||||||
|
|
||||||
internalE[cellI] += p.Ei();
|
|
||||||
}
|
|
||||||
|
|
||||||
internalE *= nParticle_/mesh().cellVolumes();
|
|
||||||
|
|
||||||
return tinternalE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ParcelType>
|
template<class ParcelType>
|
||||||
inline const Foam::tmp<Foam::volScalarField>
|
inline const Foam::volScalarField&
|
||||||
Foam::DsmcCloud<ParcelType>::iDof() const
|
Foam::DsmcCloud<ParcelType>::iDof() const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tiDof
|
return iDof_;
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
this->name() + "iDof",
|
|
||||||
this->db().time().timeName(),
|
|
||||||
this->db(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar("zero", dimensionSet(0, -3, 0, 0, 0), VSMALL)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
scalarField& iDof = tiDof().internalField();
|
|
||||||
|
|
||||||
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
|
|
||||||
{
|
|
||||||
const ParcelType& p = iter();
|
|
||||||
const label cellI = p.cell();
|
|
||||||
|
|
||||||
iDof[cellI] += constProps(p.typeId()).internalDegreesOfFreedom();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
iDof *= nParticle_/mesh().cellVolumes();
|
|
||||||
|
|
||||||
return tiDof;
|
template<class ParcelType>
|
||||||
|
inline const Foam::volVectorField& Foam::DsmcCloud<ParcelType>::momentum() const
|
||||||
|
{
|
||||||
|
return momentum_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,66 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2009-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& cloudName,
|
|
||||||
const volScalarField& T,
|
|
||||||
const volVectorField& U
|
|
||||||
)
|
|
||||||
:
|
|
||||||
DsmcCloud<dsmcParcel>(cloudName, T, U)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::dsmcCloud::dsmcCloud
|
|
||||||
(
|
|
||||||
const word& cloudName,
|
|
||||||
const fvMesh& mesh
|
|
||||||
)
|
|
||||||
:
|
|
||||||
DsmcCloud<dsmcParcel>(cloudName, mesh)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::dsmcCloud::~dsmcCloud()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -43,54 +43,8 @@ SourceFiles
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
typedef DsmcCloud<dsmcParcel> dsmcCloud;
|
||||||
/*---------------------------------------------------------------------------*\
|
}
|
||||||
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& cloudName,
|
|
||||||
const volScalarField& T,
|
|
||||||
const volVectorField& U
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from name and mesh, used to initialise.
|
|
||||||
dsmcCloud
|
|
||||||
(
|
|
||||||
const word& cloudName,
|
|
||||||
const fvMesh& mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Destructor
|
|
||||||
~dsmcCloud();
|
|
||||||
};
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "DsmcParcel.H"
|
#include "DsmcParcel.H"
|
||||||
|
#include "meshTools.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -43,16 +44,31 @@ bool Foam::DsmcParcel<ParcelType>::move
|
|||||||
const polyMesh& mesh = td.cloud().pMesh();
|
const polyMesh& mesh = td.cloud().pMesh();
|
||||||
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
|
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
|
||||||
|
|
||||||
const scalar deltaT = td.cloud().cachedDeltaT();
|
const scalar deltaT = mesh.time().deltaTValue();
|
||||||
scalar tEnd = (1.0 - p.stepFraction())*deltaT;
|
scalar tEnd = (1.0 - p.stepFraction())*deltaT;
|
||||||
const scalar dtMax = tEnd;
|
const scalar dtMax = tEnd;
|
||||||
|
|
||||||
|
// For reduced-D cases, the velocity used to track needs to be
|
||||||
|
// constrained, but the actual U_ of the parcel must not be
|
||||||
|
// altered or used, as it is altered by patch interactions an
|
||||||
|
// needs to retain its 3D value for collision purposes.
|
||||||
|
vector Utracking = U_;
|
||||||
|
|
||||||
while (td.keepParticle && !td.switchProcessor && tEnd > ROOTVSMALL)
|
while (td.keepParticle && !td.switchProcessor && tEnd > ROOTVSMALL)
|
||||||
{
|
{
|
||||||
|
// Apply correction to position for reduced-D cases
|
||||||
|
meshTools::constrainToMeshCentre(mesh, p.position());
|
||||||
|
|
||||||
|
Utracking = U_;
|
||||||
|
|
||||||
|
// Apply correction to velocity to constrain tracking for
|
||||||
|
// reduced-D cases
|
||||||
|
meshTools::constrainDirection(mesh, mesh.solutionD(), Utracking);
|
||||||
|
|
||||||
// Set the Lagrangian time-step
|
// Set the Lagrangian time-step
|
||||||
scalar dt = min(dtMax, tEnd);
|
scalar dt = min(dtMax, tEnd);
|
||||||
|
|
||||||
dt *= p.trackToFace(p.position() + dt*U_, td);
|
dt *= p.trackToFace(p.position() + dt*Utracking, td);
|
||||||
|
|
||||||
tEnd -= dt;
|
tEnd -= dt;
|
||||||
|
|
||||||
@ -113,10 +129,41 @@ void Foam::DsmcParcel<ParcelType>::hitWallPatch
|
|||||||
TrackData& td
|
TrackData& td
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
label wppIndex = wpp.index();
|
||||||
|
|
||||||
|
label wppLocalFace = wpp.whichFace(this->face());
|
||||||
|
|
||||||
|
const scalar fA = mag(wpp.faceAreas()[wppLocalFace]);
|
||||||
|
|
||||||
|
const scalar deltaT = td.cloud().pMesh().time().deltaTValue();
|
||||||
|
|
||||||
const constantProperties& constProps(td.cloud().constProps(typeId_));
|
const constantProperties& constProps(td.cloud().constProps(typeId_));
|
||||||
|
|
||||||
scalar m = constProps.mass();
|
scalar m = constProps.mass();
|
||||||
|
|
||||||
|
vector nw = wpp.faceAreas()[wppLocalFace];
|
||||||
|
nw /= mag(nw);
|
||||||
|
|
||||||
|
scalar U_dot_nw = U_ & nw;
|
||||||
|
|
||||||
|
vector Ut = U_ - U_dot_nw*nw;
|
||||||
|
|
||||||
|
scalar invMagUnfA = 1/max(mag(U_dot_nw)*fA, VSMALL);
|
||||||
|
|
||||||
|
td.cloud().rhoNBF()[wppIndex][wppLocalFace] += invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().rhoMBF()[wppIndex][wppLocalFace] += m*invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().linearKEBF()[wppIndex][wppLocalFace] +=
|
||||||
|
0.5*m*(U_ & U_)*invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().internalEBF()[wppIndex][wppLocalFace] += Ei_*invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().iDofBF()[wppIndex][wppLocalFace] +=
|
||||||
|
constProps.internalDegreesOfFreedom()*invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().momentumBF()[wppIndex][wppLocalFace] += m*Ut*invMagUnfA;
|
||||||
|
|
||||||
// pre-interaction energy
|
// pre-interaction energy
|
||||||
scalar preIE = 0.5*m*(U_ & U_) + Ei_;
|
scalar preIE = 0.5*m*(U_ & U_) + Ei_;
|
||||||
|
|
||||||
@ -132,27 +179,40 @@ void Foam::DsmcParcel<ParcelType>::hitWallPatch
|
|||||||
typeId_
|
typeId_
|
||||||
);
|
);
|
||||||
|
|
||||||
|
U_dot_nw = U_ & nw;
|
||||||
|
|
||||||
|
Ut = U_ - U_dot_nw*nw;
|
||||||
|
|
||||||
|
invMagUnfA = 1/max(mag(U_dot_nw)*fA, VSMALL);
|
||||||
|
|
||||||
|
td.cloud().rhoNBF()[wppIndex][wppLocalFace] += invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().rhoMBF()[wppIndex][wppLocalFace] += m*invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().linearKEBF()[wppIndex][wppLocalFace] +=
|
||||||
|
0.5*m*(U_ & U_)*invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().internalEBF()[wppIndex][wppLocalFace] += Ei_*invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().iDofBF()[wppIndex][wppLocalFace] +=
|
||||||
|
constProps.internalDegreesOfFreedom()*invMagUnfA;
|
||||||
|
|
||||||
|
td.cloud().momentumBF()[wppIndex][wppLocalFace] += m*Ut*invMagUnfA;
|
||||||
|
|
||||||
// post-interaction energy
|
// post-interaction energy
|
||||||
scalar postIE = 0.5*m*(U_ & U_) + Ei_;
|
scalar postIE = 0.5*m*(U_ & U_) + Ei_;
|
||||||
|
|
||||||
// post-interaction momentum
|
// post-interaction momentum
|
||||||
vector postIMom = m*U_;
|
vector postIMom = m*U_;
|
||||||
|
|
||||||
label wppIndex = wpp.index();
|
|
||||||
|
|
||||||
label wppLocalFace = wpp.whichFace(this->face());
|
|
||||||
|
|
||||||
const scalar fA = mag(wpp.faceAreas()[wppLocalFace]);
|
|
||||||
|
|
||||||
const scalar deltaT = td.cloud().cachedDeltaT();
|
|
||||||
|
|
||||||
scalar deltaQ = td.cloud().nParticle()*(preIE - postIE)/(deltaT*fA);
|
scalar deltaQ = td.cloud().nParticle()*(preIE - postIE)/(deltaT*fA);
|
||||||
|
|
||||||
vector deltaFD = td.cloud().nParticle()*(preIMom - postIMom)/(deltaT*fA);
|
vector deltaFD = td.cloud().nParticle()*(preIMom - postIMom)/(deltaT*fA);
|
||||||
|
|
||||||
td.cloud().q().boundaryField()[wppIndex][wppLocalFace] += deltaQ;
|
td.cloud().qBF()[wppIndex][wppLocalFace] += deltaQ;
|
||||||
|
|
||||||
|
td.cloud().fDBF()[wppIndex][wppLocalFace] += deltaFD;
|
||||||
|
|
||||||
td.cloud().fD().boundaryField()[wppIndex][wppLocalFace] += deltaFD;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -212,4 +272,3 @@ void Foam::DsmcParcel<ParcelType>::transformProperties
|
|||||||
#include "DsmcParcelIO.C"
|
#include "DsmcParcelIO.C"
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ License
|
|||||||
#include "DsmcCloud.H"
|
#include "DsmcCloud.H"
|
||||||
#include "MaxwellianThermal.H"
|
#include "MaxwellianThermal.H"
|
||||||
#include "SpecularReflection.H"
|
#include "SpecularReflection.H"
|
||||||
|
#include "MixedDiffuseSpecular.H"
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
@ -46,6 +47,12 @@ namespace Foam
|
|||||||
DsmcCloud,
|
DsmcCloud,
|
||||||
dsmcParcel
|
dsmcParcel
|
||||||
);
|
);
|
||||||
|
makeWallInteractionModelType
|
||||||
|
(
|
||||||
|
MixedDiffuseSpecular,
|
||||||
|
DsmcCloud,
|
||||||
|
dsmcParcel
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -129,7 +129,7 @@ void Foam::FreeStream<CloudType>::inflow()
|
|||||||
|
|
||||||
const polyMesh& mesh(cloud.mesh());
|
const polyMesh& mesh(cloud.mesh());
|
||||||
|
|
||||||
const scalar deltaT = cloud.cachedDeltaT();
|
const scalar deltaT = mesh.time().deltaTValue();
|
||||||
|
|
||||||
Random& rndGen(cloud.rndGen());
|
Random& rndGen(cloud.rndGen());
|
||||||
|
|
||||||
@ -139,12 +139,12 @@ void Foam::FreeStream<CloudType>::inflow()
|
|||||||
|
|
||||||
const volScalarField::GeometricBoundaryField& boundaryT
|
const volScalarField::GeometricBoundaryField& boundaryT
|
||||||
(
|
(
|
||||||
cloud.T().boundaryField()
|
cloud.boundaryT().boundaryField()
|
||||||
);
|
);
|
||||||
|
|
||||||
const volVectorField::GeometricBoundaryField& boundaryU
|
const volVectorField::GeometricBoundaryField& boundaryU
|
||||||
(
|
(
|
||||||
cloud.U().boundaryField()
|
cloud.boundaryU().boundaryField()
|
||||||
);
|
);
|
||||||
|
|
||||||
forAll(patches_, p)
|
forAll(patches_, p)
|
||||||
@ -168,7 +168,8 @@ void Foam::FreeStream<CloudType>::inflow()
|
|||||||
if (min(boundaryT[patchI]) < SMALL)
|
if (min(boundaryT[patchI]) < SMALL)
|
||||||
{
|
{
|
||||||
FatalErrorIn ("Foam::FreeStream<CloudType>::inflow()")
|
FatalErrorIn ("Foam::FreeStream<CloudType>::inflow()")
|
||||||
<< "Zero boundary temperature detected, check boundaryT condition." << nl
|
<< "Zero boundary temperature detected, check boundaryT "
|
||||||
|
<< "condition." << nl
|
||||||
<< nl << abort(FatalError);
|
<< nl << abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -71,10 +71,10 @@ void Foam::MaxwellianThermal<CloudType>::correct
|
|||||||
nw /= mag(nw);
|
nw /= mag(nw);
|
||||||
|
|
||||||
// Normal velocity magnitude
|
// Normal velocity magnitude
|
||||||
scalar magUn = U & nw;
|
scalar U_dot_nw = U & nw;
|
||||||
|
|
||||||
// Wall tangential velocity (flow direction)
|
// Wall tangential velocity (flow direction)
|
||||||
vector Ut = U - magUn*nw;
|
vector Ut = U - U_dot_nw*nw;
|
||||||
|
|
||||||
CloudType& cloud(this->owner());
|
CloudType& cloud(this->owner());
|
||||||
|
|
||||||
@ -93,9 +93,9 @@ void Foam::MaxwellianThermal<CloudType>::correct
|
|||||||
U.z()*(0.8 + 0.2*rndGen.scalar01())
|
U.z()*(0.8 + 0.2*rndGen.scalar01())
|
||||||
);
|
);
|
||||||
|
|
||||||
magUn = U & nw;
|
U_dot_nw = U & nw;
|
||||||
|
|
||||||
Ut = U - magUn*nw;
|
Ut = U - U_dot_nw*nw;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wall tangential unit vector
|
// Wall tangential unit vector
|
||||||
@ -104,7 +104,7 @@ void Foam::MaxwellianThermal<CloudType>::correct
|
|||||||
// Other tangential unit vector
|
// Other tangential unit vector
|
||||||
vector tw2 = nw^tw1;
|
vector tw2 = nw^tw1;
|
||||||
|
|
||||||
scalar T = cloud.T().boundaryField()[wppIndex][wppLocalFace];
|
scalar T = cloud.boundaryT().boundaryField()[wppIndex][wppLocalFace];
|
||||||
|
|
||||||
scalar mass = cloud.constProps(typeId).mass();
|
scalar mass = cloud.constProps(typeId).mass();
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ void Foam::MaxwellianThermal<CloudType>::correct
|
|||||||
- sqrt(-2.0*log(max(1 - rndGen.scalar01(), VSMALL)))*nw
|
- sqrt(-2.0*log(max(1 - rndGen.scalar01(), VSMALL)))*nw
|
||||||
);
|
);
|
||||||
|
|
||||||
U += cloud.U().boundaryField()[wppIndex][wppLocalFace];
|
U += cloud.boundaryU().boundaryField()[wppIndex][wppLocalFace];
|
||||||
|
|
||||||
Ei = cloud.equipartitionInternalEnergy(T, iDof);
|
Ei = cloud.equipartitionInternalEnergy(T, iDof);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,140 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2009-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 "MixedDiffuseSpecular.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template <class CloudType>
|
||||||
|
Foam::MixedDiffuseSpecular<CloudType>::MixedDiffuseSpecular
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
CloudType& cloud
|
||||||
|
)
|
||||||
|
:
|
||||||
|
WallInteractionModel<CloudType>(dict, cloud, typeName),
|
||||||
|
diffuseFraction_(readScalar(this->coeffDict().lookup("diffuseFraction")))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template <class CloudType>
|
||||||
|
Foam::MixedDiffuseSpecular<CloudType>::~MixedDiffuseSpecular()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template <class CloudType>
|
||||||
|
void Foam::MixedDiffuseSpecular<CloudType>::correct
|
||||||
|
(
|
||||||
|
const wallPolyPatch& wpp,
|
||||||
|
const label faceId,
|
||||||
|
vector& U,
|
||||||
|
scalar& Ei,
|
||||||
|
label typeId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
label wppIndex = wpp.index();
|
||||||
|
|
||||||
|
label wppLocalFace = wpp.whichFace(faceId);
|
||||||
|
|
||||||
|
vector nw = wpp.faceAreas()[wppLocalFace];
|
||||||
|
|
||||||
|
// Normal unit vector
|
||||||
|
nw /= mag(nw);
|
||||||
|
|
||||||
|
// Normal velocity magnitude
|
||||||
|
scalar U_dot_nw = U & nw;
|
||||||
|
|
||||||
|
CloudType& cloud(this->owner());
|
||||||
|
|
||||||
|
Random& rndGen(cloud.rndGen());
|
||||||
|
|
||||||
|
if (diffuseFraction_ > rndGen.scalar01())
|
||||||
|
{
|
||||||
|
// Diffuse reflection
|
||||||
|
|
||||||
|
// Wall tangential velocity (flow direction)
|
||||||
|
vector Ut = U - U_dot_nw*nw;
|
||||||
|
|
||||||
|
while (mag(Ut) < SMALL)
|
||||||
|
{
|
||||||
|
// If the incident velocity is parallel to the face normal, no
|
||||||
|
// tangential direction can be chosen. Add a perturbation to the
|
||||||
|
// incoming velocity and recalculate.
|
||||||
|
|
||||||
|
U = vector
|
||||||
|
(
|
||||||
|
U.x()*(0.8 + 0.2*rndGen.scalar01()),
|
||||||
|
U.y()*(0.8 + 0.2*rndGen.scalar01()),
|
||||||
|
U.z()*(0.8 + 0.2*rndGen.scalar01())
|
||||||
|
);
|
||||||
|
|
||||||
|
U_dot_nw = U & nw;
|
||||||
|
|
||||||
|
Ut = U - U_dot_nw*nw;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wall tangential unit vector
|
||||||
|
vector tw1 = Ut/mag(Ut);
|
||||||
|
|
||||||
|
// Other tangential unit vector
|
||||||
|
vector tw2 = nw^tw1;
|
||||||
|
|
||||||
|
scalar T = cloud.boundaryT().boundaryField()[wppIndex][wppLocalFace];
|
||||||
|
|
||||||
|
scalar mass = cloud.constProps(typeId).mass();
|
||||||
|
|
||||||
|
scalar iDof = cloud.constProps(typeId).internalDegreesOfFreedom();
|
||||||
|
|
||||||
|
U =
|
||||||
|
sqrt(physicoChemical::k.value()*T/mass)
|
||||||
|
*(
|
||||||
|
rndGen.GaussNormal()*tw1
|
||||||
|
+ rndGen.GaussNormal()*tw2
|
||||||
|
- sqrt(-2.0*log(max(1 - rndGen.scalar01(), VSMALL)))*nw
|
||||||
|
);
|
||||||
|
|
||||||
|
U += cloud.boundaryU().boundaryField()[wppIndex][wppLocalFace];
|
||||||
|
|
||||||
|
Ei = cloud.equipartitionInternalEnergy(T, iDof);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Specular reflection
|
||||||
|
|
||||||
|
if (U_dot_nw > 0.0)
|
||||||
|
{
|
||||||
|
U -= 2.0*U_dot_nw*nw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,106 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2009-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::MixedDiffuseSpecular
|
||||||
|
|
||||||
|
Description
|
||||||
|
Wall interaction setting microscopic velocity to a random one drawn from a
|
||||||
|
Maxwellian distribution corresponding to a specified temperature
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef MixedDiffuseSpecular_H
|
||||||
|
#define MixedDiffuseSpecular_H
|
||||||
|
|
||||||
|
#include "WallInteractionModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class MixedDiffuseSpecular Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
class MixedDiffuseSpecular
|
||||||
|
:
|
||||||
|
public WallInteractionModel<CloudType>
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Fraction of wall interactions that are diffuse
|
||||||
|
scalar diffuseFraction_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("MixedDiffuseSpecular");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
MixedDiffuseSpecular
|
||||||
|
(
|
||||||
|
const dictionary& dict,
|
||||||
|
CloudType& cloud
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
virtual ~MixedDiffuseSpecular();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Apply wall correction
|
||||||
|
virtual void correct
|
||||||
|
(
|
||||||
|
const wallPolyPatch& wpp,
|
||||||
|
const label faceId,
|
||||||
|
vector& U,
|
||||||
|
scalar& Ei,
|
||||||
|
label typeId
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "MixedDiffuseSpecular.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -63,11 +63,11 @@ void Foam::SpecularReflection<CloudType>::correct
|
|||||||
vector nw = wpp.faceAreas()[wpp.whichFace(faceId)];
|
vector nw = wpp.faceAreas()[wpp.whichFace(faceId)];
|
||||||
nw /= mag(nw);
|
nw /= mag(nw);
|
||||||
|
|
||||||
scalar magUn = U & nw;
|
scalar U_dot_nw = U & nw;
|
||||||
|
|
||||||
if (magUn > 0.0)
|
if (U_dot_nw > 0.0)
|
||||||
{
|
{
|
||||||
U -= 2.0*magUn*nw;
|
U -= 2.0*U_dot_nw*nw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,27 +25,49 @@ License
|
|||||||
\*----------------------------------------------------------------------------*/
|
\*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "distribution.H"
|
#include "distribution.H"
|
||||||
|
#include "OFstream.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
defineTypeNameAndDebug(distribution, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::distribution::write
|
||||||
|
(
|
||||||
|
const fileName& file,
|
||||||
|
const List<Pair<scalar> >& pairs
|
||||||
|
)
|
||||||
|
{
|
||||||
|
OFstream os(file);
|
||||||
|
|
||||||
|
forAll(pairs, i)
|
||||||
|
{
|
||||||
|
os << pairs[i].first() << ' ' << pairs[i].second() << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
distribution::distribution()
|
Foam::distribution::distribution()
|
||||||
:
|
:
|
||||||
Map<label>(),
|
Map<label>(),
|
||||||
binWidth_(1)
|
binWidth_(1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
distribution::distribution(const scalar binWidth)
|
Foam::distribution::distribution(const scalar binWidth)
|
||||||
:
|
:
|
||||||
Map<label>(),
|
Map<label>(),
|
||||||
binWidth_(binWidth)
|
binWidth_(binWidth)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
distribution::distribution(const distribution& d)
|
Foam::distribution::distribution(const distribution& d)
|
||||||
:
|
:
|
||||||
Map<label>(static_cast< Map<label> >(d)),
|
Map<label>(static_cast< Map<label> >(d)),
|
||||||
binWidth_(d.binWidth())
|
binWidth_(d.binWidth())
|
||||||
@ -54,13 +76,13 @@ distribution::distribution(const distribution& d)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
distribution::~distribution()
|
Foam::distribution::~distribution()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
label distribution::totalEntries() const
|
Foam::label Foam::distribution::totalEntries() const
|
||||||
{
|
{
|
||||||
label sumOfEntries = 0;
|
label sumOfEntries = 0;
|
||||||
|
|
||||||
@ -88,7 +110,7 @@ label distribution::totalEntries() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
scalar distribution::approxTotalEntries() const
|
Foam::scalar Foam::distribution::approxTotalEntries() const
|
||||||
{
|
{
|
||||||
scalar sumOfEntries = 0;
|
scalar sumOfEntries = 0;
|
||||||
|
|
||||||
@ -101,7 +123,7 @@ scalar distribution::approxTotalEntries() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
scalar distribution::mean() const
|
Foam::scalar Foam::distribution::mean() const
|
||||||
{
|
{
|
||||||
scalar runningSum = 0;
|
scalar runningSum = 0;
|
||||||
|
|
||||||
@ -124,7 +146,7 @@ scalar distribution::mean() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
scalar distribution::median()
|
Foam::scalar Foam::distribution::median()
|
||||||
{
|
{
|
||||||
// From:
|
// From:
|
||||||
// http://mathworld.wolfram.com/StatisticalMedian.html
|
// http://mathworld.wolfram.com/StatisticalMedian.html
|
||||||
@ -188,7 +210,7 @@ scalar distribution::median()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void distribution::add(const scalar valueToAdd)
|
void Foam::distribution::add(const scalar valueToAdd)
|
||||||
{
|
{
|
||||||
iterator iter(this->begin());
|
iterator iter(this->begin());
|
||||||
|
|
||||||
@ -218,13 +240,13 @@ void distribution::add(const scalar valueToAdd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void distribution::add(const label valueToAdd)
|
void Foam::distribution::add(const label valueToAdd)
|
||||||
{
|
{
|
||||||
add(scalar(valueToAdd));
|
add(scalar(valueToAdd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void distribution::insertMissingKeys()
|
void Foam::distribution::insertMissingKeys()
|
||||||
{
|
{
|
||||||
iterator iter(this->begin());
|
iterator iter(this->begin());
|
||||||
|
|
||||||
@ -247,7 +269,7 @@ void distribution::insertMissingKeys()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List< Pair<scalar> > distribution::normalised()
|
Foam::List<Foam::Pair<Foam::scalar> > Foam::distribution::normalised()
|
||||||
{
|
{
|
||||||
scalar totEnt = approxTotalEntries();
|
scalar totEnt = approxTotalEntries();
|
||||||
|
|
||||||
@ -268,17 +290,25 @@ List< Pair<scalar> > distribution::normalised()
|
|||||||
normDist[k].second() = scalar((*this)[key])/totEnt/binWidth_;
|
normDist[k].second() = scalar((*this)[key])/totEnt/binWidth_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "totEnt: " << totEnt << endl;
|
||||||
|
}
|
||||||
|
|
||||||
return normDist;
|
return normDist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List< Pair<scalar> > distribution::normalisedMinusMean()
|
Foam::List<Foam::Pair<Foam::scalar> > Foam::distribution::normalisedMinusMean()
|
||||||
{
|
{
|
||||||
return normalisedShifted(mean());
|
return normalisedShifted(mean());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List< Pair<scalar> > distribution::normalisedShifted(const scalar shiftValue)
|
Foam::List<Foam::Pair<Foam::scalar> > Foam::distribution::normalisedShifted
|
||||||
|
(
|
||||||
|
scalar shiftValue
|
||||||
|
)
|
||||||
{
|
{
|
||||||
List<Pair<scalar> > oldDist(normalised());
|
List<Pair<scalar> > oldDist(normalised());
|
||||||
|
|
||||||
@ -301,20 +331,23 @@ List< Pair<scalar> > distribution::normalisedShifted(const scalar shiftValue)
|
|||||||
|
|
||||||
label newKey = lowestNewKey;
|
label newKey = lowestNewKey;
|
||||||
|
|
||||||
// Info << shiftValue
|
if (debug)
|
||||||
// << nl << lowestOldBin
|
{
|
||||||
// << nl << lowestNewKey
|
Info<< shiftValue
|
||||||
// << nl << interpolationStartDirection
|
<< nl << lowestOldBin
|
||||||
// << endl;
|
<< nl << lowestNewKey
|
||||||
|
<< nl << interpolationStartDirection
|
||||||
|
<< endl;
|
||||||
|
|
||||||
// scalar checkNormalisation = 0;
|
scalar checkNormalisation = 0;
|
||||||
|
|
||||||
// forAll (oldDist, oD)
|
forAll (oldDist, oD)
|
||||||
// {
|
{
|
||||||
// checkNormalisation += oldDist[oD].second()*binWidth_;
|
checkNormalisation += oldDist[oD].second()*binWidth_;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Info << "Initial normalisation = " << checkNormalisation << endl;
|
Info<< "Initial normalisation = " << checkNormalisation << endl;
|
||||||
|
}
|
||||||
|
|
||||||
forAll(oldDist,u)
|
forAll(oldDist,u)
|
||||||
{
|
{
|
||||||
@ -368,20 +401,23 @@ List< Pair<scalar> > distribution::normalisedShifted(const scalar shiftValue)
|
|||||||
newKey++;
|
newKey++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkNormalisation = 0;
|
if (debug)
|
||||||
|
{
|
||||||
|
scalar checkNormalisation = 0;
|
||||||
|
|
||||||
// forAll (newDist, nD)
|
forAll (newDist, nD)
|
||||||
// {
|
{
|
||||||
// checkNormalisation += newDist[nD].second()*binWidth_;
|
checkNormalisation += newDist[nD].second()*binWidth_;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Info << "Shifted normalisation = " << checkNormalisation << endl;
|
Info<< "Shifted normalisation = " << checkNormalisation << endl;
|
||||||
|
}
|
||||||
|
|
||||||
return newDist;
|
return newDist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List<Pair<scalar> > distribution::raw()
|
Foam::List<Foam::Pair<Foam::scalar> > Foam::distribution::raw()
|
||||||
{
|
{
|
||||||
insertMissingKeys();
|
insertMissingKeys();
|
||||||
|
|
||||||
@ -406,7 +442,7 @@ List<Pair<scalar> > distribution::raw()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void distribution::operator=(const distribution& rhs)
|
void Foam::distribution::operator=(const distribution& rhs)
|
||||||
{
|
{
|
||||||
// Check for assignment to self
|
// Check for assignment to self
|
||||||
if (this == &rhs)
|
if (this == &rhs)
|
||||||
@ -424,7 +460,7 @@ void distribution::operator=(const distribution& rhs)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Ostream& operator<<(Ostream& os, const distribution& d)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const distribution& d)
|
||||||
{
|
{
|
||||||
os << d.binWidth_
|
os << d.binWidth_
|
||||||
<< static_cast<const Map<label>&>(d);
|
<< static_cast<const Map<label>&>(d);
|
||||||
@ -440,8 +476,4 @@ Ostream& operator<<(Ostream& os, const distribution& d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -26,6 +26,8 @@ Class
|
|||||||
Foam::distribution
|
Foam::distribution
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
Accumulating histogram of values. Specified bin resolution
|
||||||
|
automatic generation of bins.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
distributionI.H
|
distributionI.H
|
||||||
@ -59,6 +61,21 @@ class distribution
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
|
||||||
|
TypeName("distribution");
|
||||||
|
|
||||||
|
// Static functions
|
||||||
|
|
||||||
|
//- write to file
|
||||||
|
|
||||||
|
static void write
|
||||||
|
(
|
||||||
|
const fileName& file,
|
||||||
|
const List<Pair<scalar> >& pairs
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null
|
||||||
@ -73,7 +90,7 @@ public:
|
|||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
|
||||||
~distribution();
|
virtual ~distribution();
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -97,7 +114,7 @@ public:
|
|||||||
|
|
||||||
List<Pair<scalar> > normalisedMinusMean();
|
List<Pair<scalar> > normalisedMinusMean();
|
||||||
|
|
||||||
List<Pair<scalar> > normalisedShifted(const scalar shiftValue);
|
List<Pair<scalar> > normalisedShifted(scalar shiftValue);
|
||||||
|
|
||||||
List<Pair<scalar> > raw();
|
List<Pair<scalar> > raw();
|
||||||
|
|
||||||
|
|||||||
@ -110,6 +110,7 @@ void Foam::dsmcFields::write()
|
|||||||
word linearKEMeanName = "linearKEMean";
|
word linearKEMeanName = "linearKEMean";
|
||||||
word internalEMeanName = "internalEMean";
|
word internalEMeanName = "internalEMean";
|
||||||
word iDofMeanName = "iDofMean";
|
word iDofMeanName = "iDofMean";
|
||||||
|
word fDMeanName = "fDMean";
|
||||||
|
|
||||||
const volScalarField& rhoNMean = obr_.lookupObject<volScalarField>
|
const volScalarField& rhoNMean = obr_.lookupObject<volScalarField>
|
||||||
(
|
(
|
||||||
@ -141,6 +142,11 @@ void Foam::dsmcFields::write()
|
|||||||
iDofMeanName
|
iDofMeanName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
volVectorField fDMean = obr_.lookupObject<volVectorField>
|
||||||
|
(
|
||||||
|
fDMeanName
|
||||||
|
);
|
||||||
|
|
||||||
if (min(mag(rhoNMean)).value() > VSMALL)
|
if (min(mag(rhoNMean)).value() > VSMALL)
|
||||||
{
|
{
|
||||||
Info<< "Calculating dsmcFields." << endl;
|
Info<< "Calculating dsmcFields." << endl;
|
||||||
@ -168,6 +174,7 @@ void Foam::dsmcFields::write()
|
|||||||
obr_,
|
obr_,
|
||||||
IOobject::NO_READ
|
IOobject::NO_READ
|
||||||
),
|
),
|
||||||
|
|
||||||
2.0/(3.0*physicoChemical::k.value()*rhoNMean)
|
2.0/(3.0*physicoChemical::k.value()*rhoNMean)
|
||||||
*(linearKEMean - 0.5*rhoMMean*(UMean & UMean))
|
*(linearKEMean - 0.5*rhoMMean*(UMean & UMean))
|
||||||
);
|
);
|
||||||
@ -182,7 +189,7 @@ void Foam::dsmcFields::write()
|
|||||||
obr_,
|
obr_,
|
||||||
IOobject::NO_READ
|
IOobject::NO_READ
|
||||||
),
|
),
|
||||||
2.0/(physicoChemical::k.value()*iDofMean)*internalEMean
|
(2.0/physicoChemical::k.value())*(internalEMean/iDofMean)
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< " Calculating overallT field." << endl;
|
Info<< " Calculating overallT field." << endl;
|
||||||
@ -199,6 +206,33 @@ void Foam::dsmcFields::write()
|
|||||||
*(linearKEMean - 0.5*rhoMMean*(UMean & UMean) + internalEMean)
|
*(linearKEMean - 0.5*rhoMMean*(UMean & UMean) + internalEMean)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Info<< " Calculating pressure field." << endl;
|
||||||
|
volScalarField p
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"p",
|
||||||
|
obr_.time().timeName(),
|
||||||
|
obr_,
|
||||||
|
IOobject::NO_READ
|
||||||
|
),
|
||||||
|
physicoChemical::k.value()*rhoNMean*translationalT
|
||||||
|
);
|
||||||
|
|
||||||
|
const fvMesh& mesh = fDMean.mesh();
|
||||||
|
|
||||||
|
forAll(mesh.boundaryMesh(), i)
|
||||||
|
{
|
||||||
|
const polyPatch& patch = mesh.boundaryMesh()[i];
|
||||||
|
|
||||||
|
if (isA<wallPolyPatch>(patch))
|
||||||
|
{
|
||||||
|
p.boundaryField()[i] =
|
||||||
|
fDMean.boundaryField()[i]
|
||||||
|
& (patch.faceAreas()/mag(patch.faceAreas()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Info<< " mag(UMean) max/min : "
|
Info<< " mag(UMean) max/min : "
|
||||||
<< max(mag(UMean)).value() << " "
|
<< max(mag(UMean)).value() << " "
|
||||||
<< min(mag(UMean)).value() << endl;
|
<< min(mag(UMean)).value() << endl;
|
||||||
@ -215,6 +249,10 @@ void Foam::dsmcFields::write()
|
|||||||
<< max(overallT).value() << " "
|
<< max(overallT).value() << " "
|
||||||
<< min(overallT).value() << endl;
|
<< min(overallT).value() << endl;
|
||||||
|
|
||||||
|
Info<< " p max/min : "
|
||||||
|
<< max(p).value() << " "
|
||||||
|
<< min(p).value() << endl;
|
||||||
|
|
||||||
UMean.write();
|
UMean.write();
|
||||||
|
|
||||||
translationalT.write();
|
translationalT.write();
|
||||||
@ -223,6 +261,8 @@ void Foam::dsmcFields::write()
|
|||||||
|
|
||||||
overallT.write();
|
overallT.write();
|
||||||
|
|
||||||
|
p.write();
|
||||||
|
|
||||||
Info<< "dsmcFields written." << nl << endl;
|
Info<< "dsmcFields written." << nl << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -32,7 +32,8 @@ boundaryField
|
|||||||
|
|
||||||
walls
|
walls
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,8 @@ boundaryField
|
|||||||
|
|
||||||
walls
|
walls
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,8 @@ boundaryField
|
|||||||
|
|
||||||
walls
|
walls
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,8 @@ boundaryField
|
|||||||
|
|
||||||
walls
|
walls
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
|
value uniform (0 0 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,8 @@ boundaryField
|
|||||||
|
|
||||||
walls
|
walls
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,8 @@ boundaryField
|
|||||||
|
|
||||||
walls
|
walls
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,8 @@ boundaryField
|
|||||||
|
|
||||||
obstacle
|
obstacle
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
periodic
|
periodic
|
||||||
|
|||||||
@ -27,7 +27,8 @@ boundaryField
|
|||||||
|
|
||||||
obstacle
|
obstacle
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
periodic
|
periodic
|
||||||
|
|||||||
@ -27,7 +27,8 @@ boundaryField
|
|||||||
|
|
||||||
obstacle
|
obstacle
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
periodic
|
periodic
|
||||||
|
|||||||
@ -27,7 +27,8 @@ boundaryField
|
|||||||
|
|
||||||
obstacle
|
obstacle
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
|
value uniform (0 0 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
periodic
|
periodic
|
||||||
|
|||||||
@ -27,7 +27,8 @@ boundaryField
|
|||||||
|
|
||||||
obstacle
|
obstacle
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
periodic
|
periodic
|
||||||
|
|||||||
@ -27,7 +27,8 @@ boundaryField
|
|||||||
|
|
||||||
obstacle
|
obstacle
|
||||||
{
|
{
|
||||||
type zeroGradient;
|
type calculated;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
periodic
|
periodic
|
||||||
|
|||||||
Reference in New Issue
Block a user