Commit af3c1a77 authored by henry's avatar henry
Browse files
parents 85152a2d e06171fe
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 "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();
......
......@@ -113,7 +113,16 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
return;
}
wordList extensiveVVFNames(IStringStream ("(momentumMean)")());
wordList extensiveVVFNames
(
IStringStream
(
"( \
momentumMean \
fDMean \
)"
)()
);
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;
dsmcCloud dsmc("dsmc", mesh);
dsmcCloud dsmc("dsmc", mesh, dsmcInitialiseDict);
label totalMolecules = dsmc.size();
......
......@@ -377,6 +377,7 @@ DebugSwitches
displacementLaplacian 0;
displacementSBRStress 0;
distanceSurface 0;
distribution 0;
downwind 0;
dragModel 0;
duplicatePoints 0;
......
......@@ -4,9 +4,6 @@ parcels/derived/dsmcParcel/dsmcParcel.C
/* Cloud base classes */
clouds/baseClasses/DsmcBaseCloud/DsmcBaseCloud.C
/* Clouds */
clouds/derived/dsmcCloud/dsmcCloud.C
/* submodels */
parcels/derived/dsmcParcel/defineDsmcParcel.C
parcels/derived/dsmcParcel/makeDsmcParcelBinaryCollisionModels.C
......
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \
-llagrangian \
-lfiniteVolume
-lfiniteVolume \
-lmeshTools
......@@ -297,7 +297,7 @@ void Foam::DsmcCloud<ParcelType>::collisions()
// Temporary storage for subCells
List<DynamicList<label> > subCells(8);
scalar deltaT = cachedDeltaT();
scalar deltaT = mesh().time().deltaTValue();
label collisionCandidates = 0;
......@@ -473,21 +473,92 @@ 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);
fD_ = dimensionedVector
(
"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
);
}
forAll(qBF, p)
{
qBF[p] = 0.0;
}
volVectorField::GeometricBoundaryField& fDBF(fD_.boundaryField());
template<class ParcelType>
void Foam::DsmcCloud<ParcelType>::calculateFields()
{
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();
forAll(fDBF, p)
forAllConstIter(typename DsmcCloud<ParcelType>, *this, iter)
{
fDBF[p] = vector::zero;
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
(
const word& cloudName,
const volScalarField& T,
const volVectorField& U,
const fvMesh& mesh,
bool readFields
)
:
Cloud<ParcelType>(T.mesh(), cloudName, false),
Cloud<ParcelType>(mesh, cloudName, false),
DsmcBaseCloud(),
cloudName_(cloudName),
mesh_(T.mesh()),
mesh_(mesh),
particleProperties_
(
IOobject
......@@ -563,37 +633,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
mesh_
),
rhoN_
(
IOobject
(
"zero",
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_(),
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
......@@ -641,7 +816,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),
......@@ -707,15 +883,111 @@ Foam::DsmcCloud<ParcelType>::DsmcCloud
vector::zero
)
),
rhoN_