BUG: patchInjectionBase: fixed triangle indexing and processor fraction calculation

This commit is contained in:
william
2014-02-19 14:21:49 +00:00
committed by Andrew Heather
parent 10f31ddaea
commit cecf40bc81
4 changed files with 13 additions and 19 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -160,7 +160,7 @@ Foam::label Foam::PatchFlowRateInjection<CloudType>::parcelsToInject
scalar c = concentration_.value(0.5*(time0 + time1));
scalar nParcels = fraction_*parcelConcentration_*c*flowRate()*dt;
scalar nParcels = parcelConcentration_*c*flowRate()*dt;
label nParcelsToInject = floor(nParcels);
// Inject an additional parcel with a probability based on the
@ -205,7 +205,7 @@ Foam::scalar Foam::PatchFlowRateInjection<CloudType>::volumeToInject
this->volumeTotal_ = volume;
this->massTotal_ = volume*this->owner().constProps().rho0();
return fraction_*volume;
return volume;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -68,8 +68,7 @@ Foam::PatchInjection<CloudType>::PatchInjection
patchInjectionBase::updateMesh(owner.mesh());
// Set total volume/mass to inject
this->volumeTotal_ = fraction_*flowRateProfile_.integrate(0.0, duration_);
this->massTotal_ *= fraction_;
this->volumeTotal_ = flowRateProfile_.integrate(0.0, duration_);
}
@ -121,7 +120,7 @@ Foam::label Foam::PatchInjection<CloudType>::parcelsToInject
{
if ((time0 >= 0.0) && (time0 < duration_))
{
scalar nParcels = this->fraction_*(time1 - time0)*parcelsPerSecond_;
scalar nParcels = (time1 - time0)*parcelsPerSecond_;
cachedRandom& rnd = this->owner().rndGen();
@ -159,7 +158,7 @@ Foam::scalar Foam::PatchInjection<CloudType>::volumeToInject
{
if ((time0 >= 0.0) && (time0 < duration_))
{
return this->fraction_*flowRateProfile_.integrate(time0, time1);
return flowRateProfile_.integrate(time0, time1);
}
else
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -42,7 +42,6 @@ Foam::patchInjectionBase::patchInjectionBase
patchArea_(0.0),
patchNormal_(),
cellOwners_(),
fraction_(1.0),
triFace_(),
triToFace_(),
triCumulativeMagSf_(),
@ -73,7 +72,6 @@ Foam::patchInjectionBase::patchInjectionBase(const patchInjectionBase& pib)
patchArea_(pib.patchArea_),
patchNormal_(pib.patchNormal_),
cellOwners_(pib.cellOwners_),
fraction_(pib.fraction_),
triFace_(pib.triFace_),
triToFace_(pib.triToFace_),
triCumulativeMagSf_(pib.triCumulativeMagSf_),
@ -103,6 +101,9 @@ void Foam::patchInjectionBase::updateMesh(const polyMesh& mesh)
DynamicList<face> triFace(2*patch.size());
DynamicList<face> tris(5);
// set zero value at the start of the tri area list
triMagSf.append(0.0);
forAll(patch, faceI)
{
const face& f = patch[faceI];
@ -138,13 +139,10 @@ void Foam::patchInjectionBase::updateMesh(const polyMesh& mesh)
triToFace_.transfer(triToFace);
triCumulativeMagSf_.transfer(triMagSf);
// fraction of injection volume to be injected by this patch
fraction_ = sumTriMagSf_[Pstream::myProcNo() + 1]/sum(sumTriMagSf_);
// convert sumTriMagSf_ into cumulative sum of areas per proc
for (label i = 1; i < sumTriMagSf_.size(); i++)
{
sumTriMagSf_[i] += sumTriMagSf_[i - 1];
sumTriMagSf_[i] += sumTriMagSf_[i-1];
}
const scalarField magSf(mag(patch.faceAreas()));

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -80,9 +80,6 @@ protected:
//- List of cell labels corresponding to injector positions
labelList cellOwners_;
//- Fraction of injection controlled by this processor
scalar fraction_;
//- Decomposed patch faces as a list of triangles
faceList triFace_;