mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: patchInjectionBase: fixed triangle indexing and processor fraction calculation
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -160,7 +160,7 @@ Foam::label Foam::PatchFlowRateInjection<CloudType>::parcelsToInject
|
|||||||
|
|
||||||
scalar c = concentration_.value(0.5*(time0 + time1));
|
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);
|
label nParcelsToInject = floor(nParcels);
|
||||||
|
|
||||||
// Inject an additional parcel with a probability based on the
|
// Inject an additional parcel with a probability based on the
|
||||||
@ -205,7 +205,7 @@ Foam::scalar Foam::PatchFlowRateInjection<CloudType>::volumeToInject
|
|||||||
this->volumeTotal_ = volume;
|
this->volumeTotal_ = volume;
|
||||||
this->massTotal_ = volume*this->owner().constProps().rho0();
|
this->massTotal_ = volume*this->owner().constProps().rho0();
|
||||||
|
|
||||||
return fraction_*volume;
|
return volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -68,8 +68,7 @@ Foam::PatchInjection<CloudType>::PatchInjection
|
|||||||
patchInjectionBase::updateMesh(owner.mesh());
|
patchInjectionBase::updateMesh(owner.mesh());
|
||||||
|
|
||||||
// Set total volume/mass to inject
|
// Set total volume/mass to inject
|
||||||
this->volumeTotal_ = fraction_*flowRateProfile_.integrate(0.0, duration_);
|
this->volumeTotal_ = flowRateProfile_.integrate(0.0, duration_);
|
||||||
this->massTotal_ *= fraction_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -121,7 +120,7 @@ Foam::label Foam::PatchInjection<CloudType>::parcelsToInject
|
|||||||
{
|
{
|
||||||
if ((time0 >= 0.0) && (time0 < duration_))
|
if ((time0 >= 0.0) && (time0 < duration_))
|
||||||
{
|
{
|
||||||
scalar nParcels = this->fraction_*(time1 - time0)*parcelsPerSecond_;
|
scalar nParcels = (time1 - time0)*parcelsPerSecond_;
|
||||||
|
|
||||||
cachedRandom& rnd = this->owner().rndGen();
|
cachedRandom& rnd = this->owner().rndGen();
|
||||||
|
|
||||||
@ -159,7 +158,7 @@ Foam::scalar Foam::PatchInjection<CloudType>::volumeToInject
|
|||||||
{
|
{
|
||||||
if ((time0 >= 0.0) && (time0 < duration_))
|
if ((time0 >= 0.0) && (time0 < duration_))
|
||||||
{
|
{
|
||||||
return this->fraction_*flowRateProfile_.integrate(time0, time1);
|
return flowRateProfile_.integrate(time0, time1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -42,7 +42,6 @@ Foam::patchInjectionBase::patchInjectionBase
|
|||||||
patchArea_(0.0),
|
patchArea_(0.0),
|
||||||
patchNormal_(),
|
patchNormal_(),
|
||||||
cellOwners_(),
|
cellOwners_(),
|
||||||
fraction_(1.0),
|
|
||||||
triFace_(),
|
triFace_(),
|
||||||
triToFace_(),
|
triToFace_(),
|
||||||
triCumulativeMagSf_(),
|
triCumulativeMagSf_(),
|
||||||
@ -73,7 +72,6 @@ Foam::patchInjectionBase::patchInjectionBase(const patchInjectionBase& pib)
|
|||||||
patchArea_(pib.patchArea_),
|
patchArea_(pib.patchArea_),
|
||||||
patchNormal_(pib.patchNormal_),
|
patchNormal_(pib.patchNormal_),
|
||||||
cellOwners_(pib.cellOwners_),
|
cellOwners_(pib.cellOwners_),
|
||||||
fraction_(pib.fraction_),
|
|
||||||
triFace_(pib.triFace_),
|
triFace_(pib.triFace_),
|
||||||
triToFace_(pib.triToFace_),
|
triToFace_(pib.triToFace_),
|
||||||
triCumulativeMagSf_(pib.triCumulativeMagSf_),
|
triCumulativeMagSf_(pib.triCumulativeMagSf_),
|
||||||
@ -103,6 +101,9 @@ void Foam::patchInjectionBase::updateMesh(const polyMesh& mesh)
|
|||||||
DynamicList<face> triFace(2*patch.size());
|
DynamicList<face> triFace(2*patch.size());
|
||||||
DynamicList<face> tris(5);
|
DynamicList<face> tris(5);
|
||||||
|
|
||||||
|
// set zero value at the start of the tri area list
|
||||||
|
triMagSf.append(0.0);
|
||||||
|
|
||||||
forAll(patch, faceI)
|
forAll(patch, faceI)
|
||||||
{
|
{
|
||||||
const face& f = patch[faceI];
|
const face& f = patch[faceI];
|
||||||
@ -138,13 +139,10 @@ void Foam::patchInjectionBase::updateMesh(const polyMesh& mesh)
|
|||||||
triToFace_.transfer(triToFace);
|
triToFace_.transfer(triToFace);
|
||||||
triCumulativeMagSf_.transfer(triMagSf);
|
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
|
// convert sumTriMagSf_ into cumulative sum of areas per proc
|
||||||
for (label i = 1; i < sumTriMagSf_.size(); i++)
|
for (label i = 1; i < sumTriMagSf_.size(); i++)
|
||||||
{
|
{
|
||||||
sumTriMagSf_[i] += sumTriMagSf_[i - 1];
|
sumTriMagSf_[i] += sumTriMagSf_[i-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalarField magSf(mag(patch.faceAreas()));
|
const scalarField magSf(mag(patch.faceAreas()));
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -80,9 +80,6 @@ protected:
|
|||||||
//- List of cell labels corresponding to injector positions
|
//- List of cell labels corresponding to injector positions
|
||||||
labelList cellOwners_;
|
labelList cellOwners_;
|
||||||
|
|
||||||
//- Fraction of injection controlled by this processor
|
|
||||||
scalar fraction_;
|
|
||||||
|
|
||||||
//- Decomposed patch faces as a list of triangles
|
//- Decomposed patch faces as a list of triangles
|
||||||
faceList triFace_;
|
faceList triFace_;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user