ENH: lagrangian/intermediate - improved localInteraction restart behaviour

This commit is contained in:
andy
2012-06-01 14:48:32 +01:00
parent 74d6e813ca
commit 21ba59c46d
2 changed files with 27 additions and 35 deletions

View File

@ -36,21 +36,11 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
:
PatchInteractionModel<CloudType>(dict, cloud, typeName),
patchData_(cloud.mesh(), this->coeffDict()),
nEscape0_(patchData_.size(), 0),
massEscape0_(patchData_.size(), 0.0),
nStick0_(patchData_.size(), 0),
massStick0_(patchData_.size(), 0.0),
nEscape_(patchData_.size(), 0),
massEscape_(patchData_.size(), 0.0),
nStick_(patchData_.size(), 0),
massStick_(patchData_.size(), 0.0)
{
// intialise starting counters
this->getModelProperty("nEscape", nEscape0_);
this->getModelProperty("massEscape", massEscape0_);
this->getModelProperty("nStick", nStick0_);
this->getModelProperty("massStick", massStick0_);
// check that interactions are valid/specified
forAll(patchData_, patchI)
{
@ -81,10 +71,6 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
:
PatchInteractionModel<CloudType>(pim),
patchData_(pim.patchData_),
nEscape0_(pim.nEscape0_),
massEscape0_(pim.massEscape0_),
nStick0_(pim.nStick0_),
massStick0_(pim.massStick0_),
nEscape_(pim.nEscape_),
massEscape_(pim.massEscape_),
nStick_(pim.nStick_),
@ -204,21 +190,35 @@ bool Foam::LocalInteraction<CloudType>::correct
template<class CloudType>
void Foam::LocalInteraction<CloudType>::info(Ostream& os)
{
labelList npe(nEscape_);
// retrieve any stored data
labelList npe0(patchData_.size(), 0);
this->getModelProperty("nEscape", npe0);
scalarList mpe0(patchData_.size(), 0.0);
this->getModelProperty("massEscape", mpe0);
labelList nps0(patchData_.size(), 0);
this->getModelProperty("nStick", nps0);
scalarList mps0(patchData_.size(), 0.0);
this->getModelProperty("massStick", mps0);
// accumulate current data
labelList npe(nEscape_, 0);
Pstream::listCombineGather(npe, plusEqOp<label>());
npe = npe + nEscape0_;
npe = npe + npe0;
scalarList mpe(massEscape_);
Pstream::listCombineGather(mpe, plusEqOp<scalar>());
mpe = mpe + massEscape0_;
mpe = mpe + mpe0;
labelList nps(nStick_);
Pstream::listCombineGather(nps, plusEqOp<label>());
nps = nps + nStick0_;
nps = nps + nps0;
scalarList mps(massStick_);
Pstream::listCombineGather(mps, plusEqOp<scalar>());
mps = mps + massStick0_;
mps = mps + mps0;
forAll(patchData_, i)
@ -234,9 +234,16 @@ void Foam::LocalInteraction<CloudType>::info(Ostream& os)
if (this->outputTime())
{
this->setModelProperty("nEscape", npe);
nEscape_ = 0;
this->setModelProperty("massEscape", mpe);
massEscape_ = 0.0;
this->setModelProperty("nStick", nps);
nStick_ = 0;
this->setModelProperty("massStick", mps);
massStick_ = 0.0;
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -54,21 +54,6 @@ class LocalInteraction
const patchInteractionDataList patchData_;
// Counters for initial particle fates
//- Number of parcels escaped
List<label> nEscape0_;
//- Mass of parcels escaped
List<scalar> massEscape0_;
//- Number of parcels stuck to patches
List<label> nStick0_;
//- Mass of parcels stuck to patches
List<scalar> massStick0_;
// Counters for particle fates
//- Number of parcels escaped