ENH: Added particle local interaction output stats

This commit is contained in:
andy
2011-02-15 17:32:25 +00:00
parent 4c13528ff4
commit 0e1945268e
13 changed files with 213 additions and 22 deletions

View File

@ -830,8 +830,10 @@ void Foam::KinematicCloud<ParcelType>::info() const
<< linearKineticEnergy << nl
<< " Rotational kinetic energy = "
<< rotationalKineticEnergy << nl;
this->injection().info(Info);
this->surfaceFilm().info(Info);
this->patchInteraction().info(Info);
}

View File

@ -555,6 +555,10 @@ public:
inline const PatchInteractionModel<KinematicCloud<ParcelType> >&
patchInteraction() const;
//- Return reference to the patch interaction model
inline PatchInteractionModel<KinematicCloud<ParcelType> >&
patchInteraction();
//- Return reference to post-processing model
inline PostProcessingModel<KinematicCloud<ParcelType> >&
postProcessing();

View File

@ -312,6 +312,14 @@ Foam::KinematicCloud<ParcelType>::patchInteraction() const
}
template<class ParcelType>
inline Foam::PatchInteractionModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::patchInteraction()
{
return patchInteractionModel_();
}
template<class ParcelType>
inline Foam::InjectionModel<Foam::KinematicCloud<ParcelType> >&
Foam::KinematicCloud<ParcelType>::injection()

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,6 +45,67 @@ Foam::label Foam::LocalInteraction<CloudType>::applyToPatch
}
template<class CloudType>
void Foam::LocalInteraction<CloudType>::readProps()
{
IOobject propsDictHeader
(
"localInteractionProperties",
this->owner().db().time().timeName(),
"uniform"/cloud::prefix/this->owner().name(),
this->owner().db(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
if (propsDictHeader.headerOk())
{
const IOdictionary propsDict(propsDictHeader);
propsDict.readIfPresent("nEscape", nEscape0_);
propsDict.readIfPresent("massEscape", massEscape0_);
propsDict.readIfPresent("nStick", nStick0_);
propsDict.readIfPresent("massStick", massStick0_);
}
}
template<class CloudType>
void Foam::LocalInteraction<CloudType>::writeProps
(
const labelList& nEscape,
const scalarList& massEscape,
const labelList& nStick,
const scalarList& massStick
) const
{
if (this->owner().db().time().outputTime())
{
IOdictionary propsDict
(
IOobject
(
"localInteractionProperties",
this->owner().db().time().timeName(),
"uniform"/cloud::prefix/this->owner().name(),
this->owner().db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);
propsDict.add("nEscape", nEscape);
propsDict.add("massEscape", massEscape);
propsDict.add("nStick", nStick);
propsDict.add("massStick", massStick);
propsDict.regIOobject::write();
}
}
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template<class CloudType>
@ -56,7 +117,15 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
:
PatchInteractionModel<CloudType>(dict, cloud, typeName),
patchData_(this->coeffDict().lookup("patches")),
patchIds_(patchData_.size())
patchIds_(patchData_.size()),
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)
{
const polyMesh& mesh = cloud.mesh();
const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
@ -115,6 +184,8 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
<< nl << exit(FatalError);
}
}
readProps();
}
@ -126,7 +197,15 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
:
PatchInteractionModel<CloudType>(pim),
patchData_(pim.patchData_),
patchIds_(pim.patchIds_)
patchIds_(pim.patchIds_),
nEscape0_(pim.nEscape0_),
massEscape0_(pim.massEscape0_),
nStick0_(pim.nStick0_),
massStick0_(pim.massStick0_),
nEscape_(pim.nEscape_),
massEscape_(pim.massEscape_),
nStick_(pim.nStick_),
massStick_(pim.massStick_)
{}
@ -147,7 +226,7 @@ bool Foam::LocalInteraction<CloudType>::correct
bool& keepParticle,
const scalar trackFraction,
const tetIndices& tetIs
) const
)
{
vector& U = p.U();
@ -170,6 +249,8 @@ bool Foam::LocalInteraction<CloudType>::correct
keepParticle = false;
active = false;
U = vector::zero;
nEscape_[patchI]++;
massEscape_[patchI] += p.mass()*p.nParticle();
break;
}
case PatchInteractionModel<CloudType>::itStick:
@ -177,6 +258,8 @@ bool Foam::LocalInteraction<CloudType>::correct
keepParticle = true;
active = false;
U = vector::zero;
nStick_[patchI]++;
massStick_[patchI] += p.mass()*p.nParticle();
break;
}
case PatchInteractionModel<CloudType>::itRebound:
@ -235,4 +318,38 @@ bool Foam::LocalInteraction<CloudType>::correct
}
template<class CloudType>
void Foam::LocalInteraction<CloudType>::info(Ostream& os) const
{
labelList npe(nEscape_);
Pstream::listCombineGather(npe, plusEqOp<label>());
npe = npe + nEscape0_;
scalarList mpe(massEscape_);
Pstream::listCombineGather(mpe, plusEqOp<scalar>());
mpe = mpe + massEscape0_;
labelList nps(nStick_);
Pstream::listCombineGather(nps, plusEqOp<label>());
nps = nps + nStick0_;
scalarList mps(massStick_);
Pstream::listCombineGather(mps, plusEqOp<scalar>());
mps = mps + massStick0_;
forAll(patchData_, i)
{
os << " Parcel fate (number, mass) : patch "
<< patchData_[i].patchName() << nl
<< " - escape = " << npe[i]
<< ", " << mpe[i] << nl
<< " - stick = " << nps[i]
<< ", " << mps[i] << nl;
}
writeProps(npe, mpe, nps, mps);
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -57,11 +57,52 @@ class LocalInteraction
List<label> patchIds_;
// 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
List<label> nEscape_;
//- Mass of parcels escaped
List<scalar> massEscape_;
//- Number of parcels stuck to patches
List<label> nStick_;
//- Mass of parcels stuck to patches
List<scalar> massStick_;
// Private Member Functions
//- Returns local patchI if patch is in patchIds_ list
label applyToPatch(const label globalPatchI) const;
//- Read interaction properties from file
void readProps();
//- Write interaction properties to file
void writeProps
(
const labelList& nEscape,
const scalarList& massEscape,
const labelList& nStick,
const scalarList& massStick
) const;
public:
@ -103,7 +144,13 @@ public:
bool& keepParticle,
const scalar trackFraction,
const tetIndices& tetIs
) const;
);
// I-O
//- Write patch interaction info to stream
virtual void info(Ostream& os) const;
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -72,7 +72,7 @@ bool Foam::NoInteraction<CloudType>::correct
bool&,
const scalar,
const tetIndices&
) const
)
{
notImplemented
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -90,7 +90,7 @@ public:
bool& keepParticle,
const scalar trackFraction,
const tetIndices& tetIs
) const;
);
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -163,7 +163,7 @@ bool Foam::PatchInteractionModel<CloudType>::correct
bool&,
const scalar,
const tetIndices&
) const
)
{
notImplemented
(
@ -331,6 +331,13 @@ void Foam::PatchInteractionModel<CloudType>::patchData
}
template<class CloudType>
void Foam::PatchInteractionModel<CloudType>::info(Ostream& os) const
{
// do nothing
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "PatchInteractionModelNew.C"

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -162,7 +162,7 @@ public:
bool& keepParticle,
const scalar trackFraction,
const tetIndices& tetIs
) const;
);
//- Calculate the patch normal and velocity to interact with,
// accounting for patch motion if required.
@ -175,6 +175,12 @@ public:
vector& normal,
vector& Up
) const;
// I-O
//- Write patch interaction info to stream
virtual void info(Ostream& os) const;
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -64,7 +64,7 @@ bool Foam::Rebound<CloudType>::correct
bool& keepParticle,
const scalar trackFraction,
const tetIndices& tetIs
) const
)
{
vector& U = p.U();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -92,7 +92,7 @@ public:
bool& keepParticle,
const scalar trackFraction,
const tetIndices& tetIs
) const;
);
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -106,7 +106,7 @@ bool Foam::StandardWallInteraction<CloudType>::correct
bool& keepParticle,
const scalar trackFraction,
const tetIndices& tetIs
) const
)
{
vector& U = p.U();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -113,7 +113,7 @@ public:
bool& keepParticle,
const scalar trackFraction,
const tetIndices& tetIs
) const;
);
};