mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Adding report per injectorId to StandardWallInteraction
This commit is contained in:
@ -88,8 +88,6 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
|
||||
{
|
||||
injIdToIndex_.insert(cloud.injectors()[i].injectorID(), i);
|
||||
}
|
||||
|
||||
DebugVar(injIdToIndex_);
|
||||
}
|
||||
|
||||
nEscape_[patchi].setSize(nInjectors, 0);
|
||||
@ -114,6 +112,7 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
|
||||
massStick_(pim.massStick_),
|
||||
writeFields_(pim.writeFields_),
|
||||
outputByInjectorId_(pim.outputByInjectorId_),
|
||||
injIdToIndex_(pim.injIdToIndex_),
|
||||
massEscapePtr_(nullptr),
|
||||
massStickPtr_(nullptr)
|
||||
{}
|
||||
|
||||
@ -90,7 +90,6 @@ class LocalInteraction
|
||||
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,16 +35,19 @@ Foam::StandardWallInteraction<CloudType>::StandardWallInteraction
|
||||
)
|
||||
:
|
||||
PatchInteractionModel<CloudType>(dict, cloud, typeName),
|
||||
mesh_(cloud.mesh()),
|
||||
interactionType_
|
||||
(
|
||||
this->wordToInteractionType(this->coeffDict().lookup("type"))
|
||||
),
|
||||
e_(0.0),
|
||||
mu_(0.0),
|
||||
nEscape_(0),
|
||||
massEscape_(0.0),
|
||||
nStick_(0),
|
||||
massStick_(0.0)
|
||||
nEscape_(cloud.mesh().boundary().size()),
|
||||
massEscape_(nEscape_.size()),
|
||||
nStick_(nEscape_.size()),
|
||||
massStick_(nEscape_.size()),
|
||||
outputByInjectorId_(this->coeffDict().lookupOrDefault("outputByInjectorId", false)),
|
||||
injIdToIndex_(cloud.injectors().size())
|
||||
{
|
||||
switch (interactionType_)
|
||||
{
|
||||
@ -69,6 +72,24 @@ Foam::StandardWallInteraction<CloudType>::StandardWallInteraction
|
||||
default:
|
||||
{}
|
||||
}
|
||||
|
||||
forAll(nEscape_, patchi)
|
||||
{
|
||||
label nInjectors(1);
|
||||
if (outputByInjectorId_)
|
||||
{
|
||||
nInjectors = cloud.injectors().size();
|
||||
for (label i=0; i<nInjectors; i++)
|
||||
{
|
||||
injIdToIndex_.insert(cloud.injectors()[i].injectorID(), i);
|
||||
}
|
||||
}
|
||||
|
||||
nEscape_[patchi].setSize(nInjectors, 0);
|
||||
massEscape_[patchi].setSize(nInjectors, 0.0);
|
||||
nStick_[patchi].setSize(nInjectors, 0);
|
||||
massStick_[patchi].setSize(nInjectors, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -79,13 +100,16 @@ Foam::StandardWallInteraction<CloudType>::StandardWallInteraction
|
||||
)
|
||||
:
|
||||
PatchInteractionModel<CloudType>(pim),
|
||||
mesh_(pim.mesh_),
|
||||
interactionType_(pim.interactionType_),
|
||||
e_(pim.e_),
|
||||
mu_(pim.mu_),
|
||||
nEscape_(pim.nEscape_),
|
||||
massEscape_(pim.massEscape_),
|
||||
nStick_(pim.nStick_),
|
||||
massStick_(pim.massStick_)
|
||||
massStick_(pim.massStick_),
|
||||
outputByInjectorId_(pim.outputByInjectorId_),
|
||||
injIdToIndex_(pim.injIdToIndex_)
|
||||
{}
|
||||
|
||||
|
||||
@ -121,8 +145,17 @@ bool Foam::StandardWallInteraction<CloudType>::correct
|
||||
keepParticle = false;
|
||||
p.active(false);
|
||||
U = Zero;
|
||||
nEscape_++;
|
||||
massEscape_ += p.nParticle()*p.mass();
|
||||
const scalar dm = p.nParticle()*p.mass();
|
||||
if (outputByInjectorId_)
|
||||
{
|
||||
nEscape_[pp.index()][injIdToIndex_[p.typeId()]]++;
|
||||
massEscape_[pp.index()][injIdToIndex_[p.typeId()]] += dm;
|
||||
}
|
||||
else
|
||||
{
|
||||
nEscape_[pp.index()][0]++;
|
||||
massEscape_[pp.index()][0] += dm;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PatchInteractionModel<CloudType>::itStick:
|
||||
@ -130,8 +163,17 @@ bool Foam::StandardWallInteraction<CloudType>::correct
|
||||
keepParticle = true;
|
||||
p.active(false);
|
||||
U = Zero;
|
||||
nStick_++;
|
||||
massStick_ += p.nParticle()*p.mass();
|
||||
const scalar dm = p.nParticle()*p.mass();
|
||||
if (outputByInjectorId_)
|
||||
{
|
||||
nStick_[pp.index()][injIdToIndex_[p.typeId()]]++;
|
||||
massStick_[pp.index()][injIdToIndex_[p.typeId()]] += dm;
|
||||
}
|
||||
else
|
||||
{
|
||||
nStick_[pp.index()][0]++;
|
||||
massStick_[pp.index()][0] += dm;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PatchInteractionModel<CloudType>::itRebound:
|
||||
@ -184,28 +226,87 @@ void Foam::StandardWallInteraction<CloudType>::info(Ostream& os)
|
||||
{
|
||||
PatchInteractionModel<CloudType>::info(os);
|
||||
|
||||
label npe0 = this->template getModelProperty<scalar>("nEscape");
|
||||
label npe = npe0 + returnReduce(nEscape_, sumOp<label>());
|
||||
labelListList npe0(nEscape_);
|
||||
this->getModelProperty("nEscape", npe0);
|
||||
|
||||
scalar mpe0 = this->template getModelProperty<scalar>("massEscape");
|
||||
scalar mpe = mpe0 + returnReduce(massEscape_, sumOp<scalar>());
|
||||
scalarListList mpe0(massEscape_);
|
||||
this->getModelProperty("massEscape", mpe0);
|
||||
|
||||
label nps0 = this->template getModelProperty<scalar>("nStick");
|
||||
label nps = nps0 + returnReduce(nStick_, sumOp<label>());
|
||||
labelListList nps0(nStick_);
|
||||
this->getModelProperty("nStick", nps0);
|
||||
|
||||
scalar mps0 = this->template getModelProperty<scalar>("massStick");
|
||||
scalar mps = mps0 + returnReduce(massStick_, sumOp<scalar>());
|
||||
scalarListList mps0(massStick_);
|
||||
this->getModelProperty("massStick", mps0);
|
||||
|
||||
os << " Parcel fate: walls (number, mass)" << nl
|
||||
<< " - escape = " << npe << ", " << mpe << nl
|
||||
<< " - stick = " << nps << ", " << mps << nl;
|
||||
// accumulate current data
|
||||
labelListList npe(nEscape_);
|
||||
forAll(npe, i)
|
||||
{
|
||||
Pstream::listCombineGather(npe[i], plusEqOp<label>());
|
||||
npe[i] = npe[i] + npe0[i];
|
||||
}
|
||||
|
||||
scalarListList mpe(massEscape_);
|
||||
forAll(mpe, i)
|
||||
{
|
||||
Pstream::listCombineGather(mpe[i], plusEqOp<scalar>());
|
||||
mpe[i] = mpe[i] + mpe0[i];
|
||||
}
|
||||
|
||||
labelListList nps(nStick_);
|
||||
forAll(nps, i)
|
||||
{
|
||||
Pstream::listCombineGather(nps[i], plusEqOp<label>());
|
||||
nps[i] = nps[i] + nps0[i];
|
||||
}
|
||||
|
||||
scalarListList mps(massStick_);
|
||||
forAll(nps, i)
|
||||
{
|
||||
Pstream::listCombineGather(mps[i], plusEqOp<scalar>());
|
||||
mps[i] = mps[i] + mps0[i];
|
||||
}
|
||||
|
||||
if (outputByInjectorId_)
|
||||
{
|
||||
forAll(npe, i)
|
||||
{
|
||||
forAll (mpe[i], injId)
|
||||
{
|
||||
os << " Parcel fate: patch " << mesh_.boundary()[i].name()
|
||||
<< " (number, mass)" << nl
|
||||
<< " - escape (injector " << injIdToIndex_.toc()[injId]
|
||||
<< " ) = " << npe[i][injId]
|
||||
<< ", " << mpe[i][injId] << nl
|
||||
<< " - stick (injector " << injIdToIndex_.toc()[injId]
|
||||
<< " ) = " << nps[i][injId]
|
||||
<< ", " << mps[i][injId] << nl;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(npe, i)
|
||||
{
|
||||
os << " Parcel fate: walls (number, mass) "
|
||||
<< mesh_.boundary()[i].name() << nl
|
||||
<< " - escape = "
|
||||
<< npe[i][0] << ", " << mpe[i][0] << nl
|
||||
<< " - stick = "
|
||||
<< nps[i][0] << ", " << mps[i][0] << nl;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->writeTime())
|
||||
{
|
||||
this->setModelProperty("nEscape", npe);
|
||||
nEscape_ = Zero;
|
||||
this->setModelProperty("massEscape", mpe);
|
||||
massEscape_ = Zero;
|
||||
this->setModelProperty("nStick", nps);
|
||||
nStick_ = Zero;
|
||||
this->setModelProperty("massStick", mps);
|
||||
massStick_ = Zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -69,6 +69,9 @@ protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
// Reference to mesh
|
||||
const fvMesh& mesh_;
|
||||
|
||||
//- Interaction type
|
||||
typename PatchInteractionModel<CloudType>::interactionType
|
||||
interactionType_;
|
||||
@ -82,17 +85,23 @@ protected:
|
||||
|
||||
// Counters for particle fates
|
||||
|
||||
//- Number of parcels escaped
|
||||
label nEscape_;
|
||||
//- Number of parcels escaped
|
||||
List<List<label>> nEscape_;
|
||||
|
||||
//- Mass of parcels escaped
|
||||
scalar massEscape_;
|
||||
List<List<scalar>> massEscape_;
|
||||
|
||||
//- Number of parcels stuck to patches
|
||||
label nStick_;
|
||||
List<List<label>> nStick_;
|
||||
|
||||
//- Mass of parcels stuck to patches
|
||||
scalar massStick_;
|
||||
List<List<scalar>> massStick_;
|
||||
|
||||
//- Flag to output escaped/mass particles sorted by injectorID
|
||||
Switch outputByInjectorId_;
|
||||
|
||||
//- InjectorId to index map
|
||||
Map<label> injIdToIndex_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user