mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Renamed U_ and T_ to boundaryU_ and boundaryT_.
Moved all fields and field reading into the DsmcCloud, all calculation and resetting to single functions for all fields. Changed constructors so that no fields are supplied to the solver called from dsmcFoam and an initialisation dictionary is supplied by dsmcInitialise.
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);
|
||||
@ -40,53 +40,21 @@ int main(int argc, char *argv[])
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "createFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< nl << "Constructing dsmcCloud " << endl;
|
||||
|
||||
dsmcCloud dsmc("dsmc", mesh);
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
while (runTime.loop())
|
||||
{
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
// Carry out dsmcCloud timestep
|
||||
|
||||
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();
|
||||
|
||||
runTime.write();
|
||||
|
||||
@ -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;
|
||||
|
||||
dsmcCloud dsmc("dsmc", mesh);
|
||||
dsmcCloud dsmc("dsmc", mesh, dsmcInitialiseDict);
|
||||
|
||||
label totalMolecules = dsmc.size();
|
||||
|
||||
|
||||
@ -475,38 +475,99 @@ void Foam::DsmcCloud<ParcelType>::collisions()
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
qBF[p] = 0.0;
|
||||
}
|
||||
|
||||
volVectorField::GeometricBoundaryField& fDBF(fD_.boundaryField());
|
||||
|
||||
forAll(fDBF, p)
|
||||
{
|
||||
fDBF[p] = vector::zero;
|
||||
}
|
||||
|
||||
volVectorField::GeometricBoundaryField& momentumBF
|
||||
fD_ = dimensionedVector
|
||||
(
|
||||
momentum_.boundaryField()
|
||||
"zero",
|
||||
dimensionSet(1, -1, -2, 0, 0),
|
||||
vector::zero
|
||||
);
|
||||
|
||||
forAll(momentumBF, p)
|
||||
{
|
||||
momentumBF[p] = 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
|
||||
);
|
||||
}
|
||||
|
||||
volScalarField::GeometricBoundaryField& rhoMBF(rhoM_.boundaryField());
|
||||
|
||||
forAll(rhoMBF, p)
|
||||
template<class ParcelType>
|
||||
void Foam::DsmcCloud<ParcelType>::calculateFields()
|
||||
{
|
||||
rhoMBF[p] = VSMALL;
|
||||
scalarField& rhoN = rhoN_.internalField();
|
||||
rhoN = VSMALL;
|
||||
|
||||
scalarField& rhoM = rhoM_.internalField();
|
||||
rhoM = VSMALL;
|
||||
|
||||
scalarField& dsmcRhoN = dsmcRhoN_.internalField();
|
||||
dsmcRhoN = 0.0;
|
||||
|
||||
scalarField& linearKE = linearKE_.internalField();
|
||||
linearKE = 0.0;
|
||||
|
||||
scalarField& internalE = internalE_.internalField();
|
||||
internalE = 0.0;
|
||||
|
||||
scalarField& iDof = iDof_.internalField();
|
||||
iDof = VSMALL;
|
||||
|
||||
vectorField& momentum = momentum_.internalField();
|
||||
momentum = vector::zero;
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@ -542,14 +603,13 @@ template<class ParcelType>
|
||||
Foam::DsmcCloud<ParcelType>::DsmcCloud
|
||||
(
|
||||
const word& cloudName,
|
||||
const volScalarField& T,
|
||||
const volVectorField& U
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
Cloud<ParcelType>(T.mesh(), cloudName, false),
|
||||
Cloud<ParcelType>(mesh, cloudName, false),
|
||||
DsmcBaseCloud(),
|
||||
cloudName_(cloudName),
|
||||
mesh_(T.mesh()),
|
||||
mesh_(mesh),
|
||||
particleProperties_
|
||||
(
|
||||
IOobject
|
||||
@ -581,68 +641,142 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
this->name() + "q_",
|
||||
"q",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("zero", dimensionSet(1, 0, -3, 0, 0), 0.0)
|
||||
mesh_
|
||||
),
|
||||
fD_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
this->name() + "fD_",
|
||||
"fD",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedVector
|
||||
(
|
||||
"zero",
|
||||
dimensionSet(1, -1, -2, 0, 0),
|
||||
vector::zero
|
||||
)
|
||||
mesh_
|
||||
),
|
||||
momentum_
|
||||
rhoN_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
this->name() + "momentum_",
|
||||
"rhoN",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedVector
|
||||
(
|
||||
"zero",
|
||||
dimensionSet(1, -2, -1, 0, 0),
|
||||
vector::zero
|
||||
)
|
||||
mesh_
|
||||
),
|
||||
rhoM_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
this->name() + "rhoM_",
|
||||
"rhoM",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh_
|
||||
),
|
||||
dsmcRhoN_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"dsmcRhoN",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
dimensionedScalar("zero", dimensionSet(1, -3, 0, 0, 0), 0.0)
|
||||
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_(),
|
||||
rndGen_(label(149382906) + 7183*Pstream::myProcNo()),
|
||||
T_(T),
|
||||
U_(U),
|
||||
boundaryT_
|
||||
(
|
||||
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<DsmcCloud<ParcelType> >::New
|
||||
@ -685,7 +819,8 @@ template<class ParcelType>
|
||||
Foam::DsmcCloud<ParcelType>::DsmcCloud
|
||||
(
|
||||
const word& cloudName,
|
||||
const fvMesh& mesh
|
||||
const fvMesh& mesh,
|
||||
const IOdictionary& dsmcInitialiseDict
|
||||
)
|
||||
:
|
||||
Cloud<ParcelType>(mesh, cloudName, false),
|
||||
@ -751,6 +886,84 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
|
||||
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
|
||||
@ -769,28 +982,15 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
|
||||
vector::zero
|
||||
)
|
||||
),
|
||||
rhoM_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
this->name() + "rhoM_",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("zero", dimensionSet(1, -3, 0, 0, 0), 0.0)
|
||||
),
|
||||
constProps_(),
|
||||
rndGen_(label(971501) + 1526*Pstream::myProcNo()),
|
||||
T_
|
||||
boundaryT_
|
||||
(
|
||||
volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"T",
|
||||
"boundaryT",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
@ -800,13 +1000,13 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
|
||||
dimensionedScalar("zero", dimensionSet(0, 0, 0, 1, 0), 0.0)
|
||||
)
|
||||
),
|
||||
U_
|
||||
boundaryU_
|
||||
(
|
||||
volVectorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
"boundaryU",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
@ -829,18 +1029,6 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
|
||||
|
||||
buildConstProps();
|
||||
|
||||
IOdictionary dsmcInitialiseDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"dsmcInitialiseDict",
|
||||
mesh_.time().system(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
initialise(dsmcInitialiseDict);
|
||||
}
|
||||
|
||||
@ -862,8 +1050,8 @@ void Foam::DsmcCloud<ParcelType>::evolve()
|
||||
|
||||
typename ParcelType::trackData td(*this);
|
||||
|
||||
// Reset the surface data collection fields
|
||||
resetSurfaceDataFields();
|
||||
// Reset the data collection fields
|
||||
resetFields();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -878,6 +1066,9 @@ void Foam::DsmcCloud<ParcelType>::evolve()
|
||||
|
||||
// Calculate new velocities via stochastic collisions
|
||||
collisions();
|
||||
|
||||
// Calculate the volume field data
|
||||
calculateFields();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -110,12 +110,27 @@ class DsmcCloud
|
||||
//- Force density at surface field
|
||||
volVectorField fD_;
|
||||
|
||||
//- Momentum density field
|
||||
volVectorField momentum_;
|
||||
//- 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
|
||||
List<typename ParcelType::constantProperties> constProps_;
|
||||
|
||||
@ -127,13 +142,13 @@ class DsmcCloud
|
||||
scalar cachedDeltaT_;
|
||||
|
||||
|
||||
// References to the macroscopic fields
|
||||
// boundary value fields
|
||||
|
||||
//- Temperature
|
||||
const volScalarField& T_;
|
||||
//- boundary temperature
|
||||
volScalarField boundaryT_;
|
||||
|
||||
//- Velocity
|
||||
const volVectorField& U_;
|
||||
//- boundary velocity
|
||||
volVectorField boundaryU_;
|
||||
|
||||
|
||||
// References to the cloud sub-models
|
||||
@ -165,8 +180,11 @@ class DsmcCloud
|
||||
//- Calculate collisions between molecules
|
||||
void collisions();
|
||||
|
||||
//- Reset the surface data accumulation field values
|
||||
void resetSurfaceDataFields();
|
||||
//- Reset the data accumulation field values to zero
|
||||
void resetFields();
|
||||
|
||||
//- Calculate the volume field data
|
||||
void calculateFields();
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
DsmcCloud(const DsmcCloud&);
|
||||
@ -185,21 +203,22 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given name and mesh, will read Parcels from file
|
||||
DsmcCloud
|
||||
(
|
||||
const word& cloudName,
|
||||
const volScalarField& T,
|
||||
const volVectorField& U
|
||||
);
|
||||
|
||||
//- Construct given name and mesh. Used to initialise.
|
||||
//- Construct given name and mesh, will read Parcels and fields from
|
||||
// file
|
||||
DsmcCloud
|
||||
(
|
||||
const word& cloudName,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
//- Construct given name, mesh and initialisation dictionary.
|
||||
DsmcCloud
|
||||
(
|
||||
const word& cloudName,
|
||||
const fvMesh& mesh,
|
||||
const IOdictionary& dsmcInitialiseDict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~DsmcCloud();
|
||||
@ -268,20 +287,48 @@ public:
|
||||
//- Return non-const force density at boundary field reference
|
||||
inline volVectorField::GeometricBoundaryField& fDBF();
|
||||
|
||||
//- Return non-const momentum density boundary field reference
|
||||
inline volVectorField::GeometricBoundaryField& momentumBF();
|
||||
|
||||
//- Return non-const mass density boundary field reference
|
||||
inline volScalarField::GeometricBoundaryField& rhoMBF();
|
||||
|
||||
//- Return non-const momentum density boundary field reference
|
||||
inline volVectorField::GeometricBoundaryField& momentumBF();
|
||||
|
||||
|
||||
// References to the macroscopic fields
|
||||
|
||||
//- Return macroscopic temperature
|
||||
inline const volScalarField& T() const;
|
||||
inline const volScalarField& boundaryT() const;
|
||||
|
||||
//- 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
|
||||
@ -395,35 +442,6 @@ public:
|
||||
void dumpParticlePositions() const;
|
||||
|
||||
|
||||
// Fields
|
||||
|
||||
//- 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 tmp<volScalarField> rhoN() const;
|
||||
|
||||
//- Return the particle mass density field
|
||||
inline const volScalarField& rhoM();
|
||||
|
||||
//- Return the momentum density field
|
||||
inline const volVectorField& momentum();
|
||||
|
||||
//- 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;
|
||||
|
||||
//- Return the field of number of DSMC particles
|
||||
inline const tmp<volScalarField> dsmcRhoN() const;
|
||||
|
||||
|
||||
// Cloud evolution functions
|
||||
@ -441,7 +459,6 @@ public:
|
||||
//- Evolve the cloud (move, collide)
|
||||
void evolve();
|
||||
|
||||
|
||||
//- Clear the Cloud
|
||||
inline void clear();
|
||||
|
||||
|
||||
@ -167,16 +167,18 @@ Foam::DsmcCloud<ParcelType>::rhoMBF()
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline const Foam::volScalarField& Foam::DsmcCloud<ParcelType>::T() const
|
||||
inline const Foam::volScalarField&
|
||||
Foam::DsmcCloud<ParcelType>::boundaryT() const
|
||||
{
|
||||
return T_;
|
||||
return boundaryT_;
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline const Foam::volVectorField& Foam::DsmcCloud<ParcelType>::U() const
|
||||
inline const Foam::volVectorField&
|
||||
Foam::DsmcCloud<ParcelType>::boundaryU() const
|
||||
{
|
||||
return U_;
|
||||
return boundaryU_;
|
||||
}
|
||||
|
||||
|
||||
@ -392,228 +394,56 @@ inline const Foam::volVectorField& Foam::DsmcCloud<ParcelType>::fD() const
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline const Foam::tmp<Foam::volScalarField>
|
||||
inline const Foam::volScalarField&
|
||||
Foam::DsmcCloud<ParcelType>::rhoN() const
|
||||
{
|
||||
tmp<volScalarField> trhoN
|
||||
(
|
||||
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;
|
||||
return rhoN_;
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline const Foam::volScalarField& Foam::DsmcCloud<ParcelType>::rhoM()
|
||||
inline const Foam::volScalarField& Foam::DsmcCloud<ParcelType>::rhoM() const
|
||||
{
|
||||
scalarField& rM = rhoM_.internalField();
|
||||
|
||||
rM = VSMALL;
|
||||
|
||||
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
|
||||
{
|
||||
const ParcelType& p = iter();
|
||||
const label cellI = p.cell();
|
||||
|
||||
rM[cellI] += constProps(p.typeId()).mass();
|
||||
}
|
||||
|
||||
rM *= nParticle_/mesh().cellVolumes();
|
||||
|
||||
return rhoM_;
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline const Foam::volVectorField& Foam::DsmcCloud<ParcelType>::momentum()
|
||||
{
|
||||
vectorField& mom = momentum_.internalField();
|
||||
|
||||
mom = vector::zero;
|
||||
|
||||
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
|
||||
{
|
||||
const ParcelType& p = iter();
|
||||
const label cellI = p.cell();
|
||||
|
||||
mom[cellI] += constProps(p.typeId()).mass()*p.U();
|
||||
}
|
||||
|
||||
mom *= nParticle_/mesh().cellVolumes();
|
||||
|
||||
return momentum_;
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline const Foam::tmp<Foam::volScalarField>
|
||||
Foam::DsmcCloud<ParcelType>::linearKE() const
|
||||
{
|
||||
tmp<volScalarField> tlinearKE
|
||||
(
|
||||
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>
|
||||
inline const Foam::tmp<Foam::volScalarField>
|
||||
Foam::DsmcCloud<ParcelType>::internalE() const
|
||||
{
|
||||
tmp<volScalarField> tinternalE
|
||||
(
|
||||
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>
|
||||
inline const Foam::tmp<Foam::volScalarField>
|
||||
Foam::DsmcCloud<ParcelType>::iDof() const
|
||||
{
|
||||
tmp<volScalarField> tiDof
|
||||
(
|
||||
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::tmp<Foam::volScalarField>
|
||||
inline const Foam::volScalarField&
|
||||
Foam::DsmcCloud<ParcelType>::dsmcRhoN() const
|
||||
{
|
||||
tmp<volScalarField> tdsmcRhoN
|
||||
(
|
||||
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 dsmcRhoN_;
|
||||
}
|
||||
|
||||
return tdsmcRhoN;
|
||||
|
||||
template<class ParcelType>
|
||||
inline const Foam::volScalarField&
|
||||
Foam::DsmcCloud<ParcelType>::linearKE() const
|
||||
{
|
||||
return linearKE_;
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline const Foam::volScalarField&
|
||||
Foam::DsmcCloud<ParcelType>::internalE() const
|
||||
{
|
||||
return internalE_;
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline const Foam::volScalarField&
|
||||
Foam::DsmcCloud<ParcelType>::iDof() const
|
||||
{
|
||||
return iDof_;
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline const Foam::volVectorField& Foam::DsmcCloud<ParcelType>::momentum() const
|
||||
{
|
||||
return momentum_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -39,11 +39,10 @@ namespace Foam
|
||||
Foam::dsmcCloud::dsmcCloud
|
||||
(
|
||||
const word& cloudName,
|
||||
const volScalarField& T,
|
||||
const volVectorField& U
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
DsmcCloud<dsmcParcel>(cloudName, T, U)
|
||||
DsmcCloud<dsmcParcel>(cloudName, mesh)
|
||||
{
|
||||
dsmcParcel::readFields(*this);
|
||||
}
|
||||
@ -52,10 +51,11 @@ Foam::dsmcCloud::dsmcCloud
|
||||
Foam::dsmcCloud::dsmcCloud
|
||||
(
|
||||
const word& cloudName,
|
||||
const fvMesh& mesh
|
||||
const fvMesh& mesh,
|
||||
const IOdictionary& dsmcInitialiseDict
|
||||
)
|
||||
:
|
||||
DsmcCloud<dsmcParcel>(cloudName, mesh)
|
||||
DsmcCloud<dsmcParcel>(cloudName, mesh, dsmcInitialiseDict)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -69,21 +69,22 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
dsmcCloud
|
||||
(
|
||||
const word& cloudName,
|
||||
const volScalarField& T,
|
||||
const volVectorField& U
|
||||
);
|
||||
|
||||
//- Construct from name and mesh, used to initialise.
|
||||
//- Construct given name and mesh, will read Parcels and fields from
|
||||
// file
|
||||
dsmcCloud
|
||||
(
|
||||
const word& cloudName,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
//- Construct given name, mesh and initialisation dictionary.
|
||||
dsmcCloud
|
||||
(
|
||||
const word& cloudName,
|
||||
const fvMesh& mesh,
|
||||
const IOdictionary& dsmcInitialiseDict
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
~dsmcCloud();
|
||||
|
||||
|
||||
@ -136,12 +136,12 @@ void Foam::FreeStream<CloudType>::inflow()
|
||||
|
||||
const volScalarField::GeometricBoundaryField& boundaryT
|
||||
(
|
||||
cloud.T().boundaryField()
|
||||
cloud.boundaryT().boundaryField()
|
||||
);
|
||||
|
||||
const volVectorField::GeometricBoundaryField& boundaryU
|
||||
(
|
||||
cloud.U().boundaryField()
|
||||
cloud.boundaryU().boundaryField()
|
||||
);
|
||||
|
||||
forAll(patches_, p)
|
||||
@ -165,7 +165,8 @@ void Foam::FreeStream<CloudType>::inflow()
|
||||
if (min(boundaryT[patchI]) < SMALL)
|
||||
{
|
||||
FatalErrorIn ("Foam::FreeStream<CloudType>::inflow()")
|
||||
<< "Zero boundary temperature detected, check boundaryT condition." << nl
|
||||
<< "Zero boundary temperature detected, check boundaryT "
|
||||
<< "condition." << nl
|
||||
<< nl << abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
@ -101,7 +101,7 @@ void Foam::MaxwellianThermal<CloudType>::correct
|
||||
// Other tangential unit vector
|
||||
vector tw2 = nw^tw1;
|
||||
|
||||
scalar T = cloud.T().boundaryField()[wppIndex][wppLocalFace];
|
||||
scalar T = cloud.boundaryT().boundaryField()[wppIndex][wppLocalFace];
|
||||
|
||||
scalar mass = cloud.constProps(typeId).mass();
|
||||
|
||||
@ -115,7 +115,7 @@ void Foam::MaxwellianThermal<CloudType>::correct
|
||||
- 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);
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ void Foam::MixedDiffuseSpecular<CloudType>::correct
|
||||
// Other tangential unit vector
|
||||
vector tw2 = nw^tw1;
|
||||
|
||||
scalar T = cloud.T().boundaryField()[wppIndex][wppLocalFace];
|
||||
scalar T = cloud.boundaryT().boundaryField()[wppIndex][wppLocalFace];
|
||||
|
||||
scalar mass = cloud.constProps(typeId).mass();
|
||||
|
||||
@ -120,7 +120,7 @@ void Foam::MixedDiffuseSpecular<CloudType>::correct
|
||||
- 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user