mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: for-range, forAllIters() ... in lagrangian/intermediate/
- reduced clutter when iterating over containers
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011, 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
@ -65,10 +65,8 @@ Foam::CollidingCloud<CloudType>::rotationalKineticEnergyOfSystem() const
|
||||
{
|
||||
scalar rotationalKineticEnergy = 0.0;
|
||||
|
||||
forAllConstIter(typename CollidingCloud<CloudType>, *this, iter)
|
||||
for (const parcelType& p : *this)
|
||||
{
|
||||
const parcelType& p = iter();
|
||||
|
||||
rotationalKineticEnergy +=
|
||||
p.nParticle()*0.5*p.momentOfInertia()*(p.omega() & p.omega());
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2011, 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011, 2016-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
@ -155,14 +155,14 @@ void Foam::KinematicCloud<CloudType>::buildCellOccupancy()
|
||||
|
||||
List<DynamicList<parcelType*>>& cellOccupancy = cellOccupancyPtr_();
|
||||
|
||||
forAll(cellOccupancy, cO)
|
||||
for (auto& list : cellOccupancy)
|
||||
{
|
||||
cellOccupancy[cO].clear();
|
||||
list.clear();
|
||||
}
|
||||
|
||||
forAllIter(typename KinematicCloud<CloudType>, *this, iter)
|
||||
for (parcelType& p : *this)
|
||||
{
|
||||
cellOccupancy[iter().cell()].append(&iter());
|
||||
cellOccupancy[p.cell()].append(&p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011, 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
@ -273,10 +273,9 @@ template<class CloudType>
|
||||
inline Foam::scalar Foam::KinematicCloud<CloudType>::massInSystem() const
|
||||
{
|
||||
scalar sysMass = 0.0;
|
||||
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
|
||||
for (const parcelType& p : *this)
|
||||
{
|
||||
const parcelType& p = iter();
|
||||
sysMass += p.nParticle()*p.mass();
|
||||
sysMass += p.nParticle()*p.mass();
|
||||
}
|
||||
|
||||
return sysMass;
|
||||
@ -289,10 +288,8 @@ Foam::KinematicCloud<CloudType>::linearMomentumOfSystem() const
|
||||
{
|
||||
vector linearMomentum(Zero);
|
||||
|
||||
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
|
||||
for (const parcelType& p : *this)
|
||||
{
|
||||
const parcelType& p = iter();
|
||||
|
||||
linearMomentum += p.nParticle()*p.mass()*p.U();
|
||||
}
|
||||
|
||||
@ -306,10 +303,8 @@ Foam::KinematicCloud<CloudType>::linearKineticEnergyOfSystem() const
|
||||
{
|
||||
scalar linearKineticEnergy = 0.0;
|
||||
|
||||
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
|
||||
for (const parcelType& p : *this)
|
||||
{
|
||||
const parcelType& p = iter();
|
||||
|
||||
linearKineticEnergy += p.nParticle()*0.5*p.mass()*(p.U() & p.U());
|
||||
}
|
||||
|
||||
@ -326,9 +321,8 @@ inline Foam::scalar Foam::KinematicCloud<CloudType>::Dij
|
||||
{
|
||||
scalar si = 0.0;
|
||||
scalar sj = 0.0;
|
||||
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
|
||||
for (const parcelType& p : *this)
|
||||
{
|
||||
const parcelType& p = iter();
|
||||
si += p.nParticle()*pow(p.d(), i);
|
||||
sj += p.nParticle()*pow(p.d(), j);
|
||||
}
|
||||
@ -345,9 +339,8 @@ template<class CloudType>
|
||||
inline Foam::scalar Foam::KinematicCloud<CloudType>::Dmax() const
|
||||
{
|
||||
scalar d = -GREAT;
|
||||
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
|
||||
for (const parcelType& p : *this)
|
||||
{
|
||||
const parcelType& p = iter();
|
||||
d = max(d, p.d());
|
||||
}
|
||||
|
||||
@ -477,9 +470,8 @@ Foam::KinematicCloud<CloudType>::vDotSweep() const
|
||||
);
|
||||
|
||||
volScalarField& vDotSweep = tvDotSweep.ref();
|
||||
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
|
||||
for (const parcelType& p : *this)
|
||||
{
|
||||
const parcelType& p = iter();
|
||||
const label celli = p.cell();
|
||||
|
||||
vDotSweep[celli] += p.nParticle()*p.areaP()*mag(p.U() - U_[celli]);
|
||||
@ -516,9 +508,8 @@ Foam::KinematicCloud<CloudType>::theta() const
|
||||
);
|
||||
|
||||
volScalarField& theta = ttheta.ref();
|
||||
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
|
||||
for (const parcelType& p : *this)
|
||||
{
|
||||
const parcelType& p = iter();
|
||||
const label celli = p.cell();
|
||||
|
||||
theta[celli] += p.nParticle()*p.volume();
|
||||
@ -554,9 +545,8 @@ Foam::KinematicCloud<CloudType>::alpha() const
|
||||
);
|
||||
|
||||
scalarField& alpha = talpha.ref().primitiveFieldRef();
|
||||
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
|
||||
for (const parcelType& p : *this)
|
||||
{
|
||||
const parcelType& p = iter();
|
||||
const label celli = p.cell();
|
||||
|
||||
alpha[celli] += p.nParticle()*p.mass();
|
||||
@ -591,9 +581,8 @@ Foam::KinematicCloud<CloudType>::rhoEff() const
|
||||
);
|
||||
|
||||
scalarField& rhoEff = trhoEff.ref().primitiveFieldRef();
|
||||
forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
|
||||
for (const parcelType& p : *this)
|
||||
{
|
||||
const parcelType& p = iter();
|
||||
const label celli = p.cell();
|
||||
|
||||
rhoEff[celli] += p.nParticle()*p.mass();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011, 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
@ -374,48 +374,42 @@ Foam::ThermoCloud<CloudType>::sigmap() const
|
||||
template<class CloudType>
|
||||
inline Foam::scalar Foam::ThermoCloud<CloudType>::Tmax() const
|
||||
{
|
||||
scalar T = -GREAT;
|
||||
scalar n = 0;
|
||||
forAllConstIter(typename ThermoCloud<CloudType>, *this, iter)
|
||||
scalar val = -GREAT;
|
||||
bool nonEmpty = false;
|
||||
|
||||
for (const parcelType& p : *this)
|
||||
{
|
||||
const parcelType& p = iter();
|
||||
T = max(T, p.T());
|
||||
n++;
|
||||
val = max(val, p.T());
|
||||
nonEmpty = true;
|
||||
}
|
||||
|
||||
reduce(T, maxOp<scalar>());
|
||||
reduce(n, sumOp<label>());
|
||||
|
||||
if (n > 0)
|
||||
if (returnReduce(nonEmpty, orOp<bool>()))
|
||||
{
|
||||
return T;
|
||||
return returnReduce(val, maxOp<scalar>());
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
inline Foam::scalar Foam::ThermoCloud<CloudType>::Tmin() const
|
||||
{
|
||||
scalar T = GREAT;
|
||||
scalar n = 0;
|
||||
forAllConstIter(typename ThermoCloud<CloudType>, *this, iter)
|
||||
scalar val = GREAT;
|
||||
bool nonEmpty = false;
|
||||
|
||||
for (const parcelType& p : *this)
|
||||
{
|
||||
const parcelType& p = iter();
|
||||
T = min(T, p.T());
|
||||
n++;
|
||||
val = min(val, p.T());
|
||||
nonEmpty = true;
|
||||
}
|
||||
|
||||
reduce(T, minOp<scalar>());
|
||||
reduce(n, sumOp<label>());
|
||||
|
||||
if (n > 0)
|
||||
if (returnReduce(nonEmpty, orOp<bool>()))
|
||||
{
|
||||
return T;
|
||||
return returnReduce(val, minOp<scalar>());
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2011-2011, 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
@ -164,10 +164,8 @@ void Foam::CollidingParcel<ParcelType>::readFields(CloudType& c)
|
||||
|
||||
label i = 0;
|
||||
|
||||
forAllIter(typename CloudType, c, iter)
|
||||
for (CollidingParcel<ParcelType>& p : c)
|
||||
{
|
||||
CollidingParcel<ParcelType>& p = iter();
|
||||
|
||||
p.f_ = f[i];
|
||||
p.angularMomentum_ = angularMomentum[i];
|
||||
p.torque_ = torque[i];
|
||||
@ -183,7 +181,7 @@ void Foam::CollidingParcel<ParcelType>::readFields(CloudType& c)
|
||||
collisionRecordsWallData[i]
|
||||
);
|
||||
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
@ -245,11 +243,8 @@ void Foam::CollidingParcel<ParcelType>::writeFields(const CloudType& c)
|
||||
);
|
||||
|
||||
label i = 0;
|
||||
|
||||
forAllConstIter(typename CloudType, c, iter)
|
||||
for (const CollidingParcel<ParcelType>& p : c)
|
||||
{
|
||||
const CollidingParcel<ParcelType>& p = iter();
|
||||
|
||||
f[i] = p.f();
|
||||
angularMomentum[i] = p.angularMomentum();
|
||||
torque[i] = p.torque();
|
||||
@ -264,7 +259,7 @@ void Foam::CollidingParcel<ParcelType>::writeFields(const CloudType& c)
|
||||
collisionRecordsWallPRel[i] = p.collisionRecords().wallPRel();
|
||||
collisionRecordsWallData[i] = p.collisionRecords().wallData();
|
||||
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
|
||||
const bool valid = (np > 0);
|
||||
@ -303,15 +298,13 @@ void Foam::CollidingParcel<ParcelType>::writeObjects
|
||||
IOField<vector>& torque(cloud::createIOField<vector>("torque", np, obr));
|
||||
|
||||
label i = 0;
|
||||
forAllConstIter(typename CloudType, c, iter)
|
||||
for (const CollidingParcel<ParcelType>& p : c)
|
||||
{
|
||||
const CollidingParcel<ParcelType>& p = iter();
|
||||
|
||||
f[i] = p.f();
|
||||
angularMomentum[i] = p.angularMomentum();
|
||||
torque[i] = p.torque();
|
||||
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2011, 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011, 2016-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
@ -176,10 +176,8 @@ void Foam::KinematicParcel<ParcelType>::readFields(CloudType& c)
|
||||
|
||||
label i = 0;
|
||||
|
||||
forAllIter(typename CloudType, c, iter)
|
||||
for (KinematicParcel<ParcelType>& p : c)
|
||||
{
|
||||
KinematicParcel<ParcelType>& p = iter();
|
||||
|
||||
p.active_ = active[i];
|
||||
p.typeId_ = typeId[i];
|
||||
p.nParticle_ = nParticle[i];
|
||||
@ -191,7 +189,7 @@ void Foam::KinematicParcel<ParcelType>::readFields(CloudType& c)
|
||||
p.tTurb_ = tTurb[i];
|
||||
p.UTurb_ = UTurb[i];
|
||||
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
@ -221,10 +219,8 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const CloudType& c)
|
||||
|
||||
label i = 0;
|
||||
|
||||
forAllConstIter(typename CloudType, c, iter)
|
||||
for (const KinematicParcel<ParcelType>& p : c)
|
||||
{
|
||||
const KinematicParcel<ParcelType>& p = iter();
|
||||
|
||||
active[i] = p.active();
|
||||
typeId[i] = p.typeId();
|
||||
nParticle[i] = p.nParticle();
|
||||
@ -236,7 +232,7 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const CloudType& c)
|
||||
tTurb[i] = p.tTurb();
|
||||
UTurb[i] = p.UTurb();
|
||||
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
|
||||
const bool valid = np > 0;
|
||||
@ -282,10 +278,8 @@ void Foam::KinematicParcel<ParcelType>::writeObjects
|
||||
|
||||
label i = 0;
|
||||
|
||||
forAllConstIter(typename CloudType, c, iter)
|
||||
for (const KinematicParcel<ParcelType>& p : c)
|
||||
{
|
||||
const KinematicParcel<ParcelType>& p = iter();
|
||||
|
||||
active[i] = p.active();
|
||||
typeId[i] = p.typeId();
|
||||
nParticle[i] = p.nParticle();
|
||||
@ -297,7 +291,7 @@ void Foam::KinematicParcel<ParcelType>::writeObjects
|
||||
tTurb[i] = p.tTurb();
|
||||
UTurb[i] = p.UTurb();
|
||||
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2013-2017 OpenFOAM Foundation
|
||||
@ -92,14 +92,11 @@ void Foam::MPPICParcel<ParcelType>::readFields(CloudType& c)
|
||||
c.checkFieldIOobject(c, UCorrect);
|
||||
|
||||
label i = 0;
|
||||
|
||||
forAllIter(typename CloudType, c, iter)
|
||||
for (MPPICParcel<ParcelType>& p : c)
|
||||
{
|
||||
MPPICParcel<ParcelType>& p = iter();
|
||||
|
||||
p.UCorrect_ = UCorrect[i];
|
||||
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,13 +114,11 @@ void Foam::MPPICParcel<ParcelType>::writeFields(const CloudType& c)
|
||||
|
||||
label i = 0;
|
||||
|
||||
forAllConstIter(typename CloudType, c, iter)
|
||||
for (const MPPICParcel<ParcelType>& p : c)
|
||||
{
|
||||
const MPPICParcel<ParcelType>& p = iter();
|
||||
|
||||
UCorrect[i] = p.UCorrect();
|
||||
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
|
||||
UCorrect.write(np > 0);
|
||||
@ -147,13 +142,11 @@ void Foam::MPPICParcel<ParcelType>::writeObjects
|
||||
|
||||
label i = 0;
|
||||
|
||||
forAllConstIter(typename CloudType, c, iter)
|
||||
for (const MPPICParcel<ParcelType>& p : c)
|
||||
{
|
||||
const MPPICParcel<ParcelType>& p = iter();
|
||||
|
||||
UCorrect[i] = p.UCorrect();
|
||||
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2013-2017 OpenFOAM Foundation
|
||||
@ -174,9 +174,8 @@ inline void Foam::MPPICParcel<ParcelType>::trackingData::updateAverages
|
||||
AveragingMethod<scalar>& weightAverage = weightAveragePtr();
|
||||
|
||||
// averaging sums
|
||||
forAllConstIter(typename TrackCloudType, cloud, iter)
|
||||
for (const typename TrackCloudType::parcelType& p : cloud)
|
||||
{
|
||||
const typename TrackCloudType::parcelType& p = iter();
|
||||
const tetIndices tetIs = p.currentTetIndices();
|
||||
|
||||
const scalar m = p.nParticle()*p.mass();
|
||||
@ -192,9 +191,8 @@ inline void Foam::MPPICParcel<ParcelType>::trackingData::updateAverages
|
||||
uAverage_->average(*massAverage_);
|
||||
|
||||
// squared velocity deviation
|
||||
forAllConstIter(typename TrackCloudType, cloud, iter)
|
||||
for (const typename TrackCloudType::parcelType& p : cloud)
|
||||
{
|
||||
const typename TrackCloudType::parcelType& p = iter();
|
||||
const tetIndices tetIs = p.currentTetIndices();
|
||||
|
||||
const vector u = uAverage_->interpolate(p.coordinates(), tetIs);
|
||||
@ -211,9 +209,8 @@ inline void Foam::MPPICParcel<ParcelType>::trackingData::updateAverages
|
||||
// sauter mean radius
|
||||
radiusAverage_() = volumeAverage_();
|
||||
weightAverage = 0;
|
||||
forAllConstIter(typename TrackCloudType, cloud, iter)
|
||||
for (const typename TrackCloudType::parcelType& p : cloud)
|
||||
{
|
||||
const typename TrackCloudType::parcelType& p = iter();
|
||||
const tetIndices tetIs = p.currentTetIndices();
|
||||
|
||||
weightAverage.add
|
||||
@ -228,9 +225,8 @@ inline void Foam::MPPICParcel<ParcelType>::trackingData::updateAverages
|
||||
|
||||
// collision frequency
|
||||
weightAverage = 0;
|
||||
forAllConstIter(typename TrackCloudType, cloud, iter)
|
||||
for (const typename TrackCloudType::parcelType& p : cloud)
|
||||
{
|
||||
const typename TrackCloudType::parcelType& p = iter();
|
||||
const tetIndices tetIs = p.currentTetIndices();
|
||||
|
||||
const scalar a = volumeAverage_->interpolate(p.coordinates(), tetIs);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2011, 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011, 2016-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
@ -115,9 +115,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::readFields
|
||||
const wordList& stateLabels = compModel.stateLabels();
|
||||
|
||||
// Set storage for each Y... for each parcel
|
||||
forAllIter(typename Cloud<ReactingMultiphaseParcel<ParcelType>>, c, iter)
|
||||
for (ReactingMultiphaseParcel<ParcelType>& p : c)
|
||||
{
|
||||
ReactingMultiphaseParcel<ParcelType>& p = iter();
|
||||
p.YGas_.setSize(gasNames.size(), 0.0);
|
||||
p.YLiquid_.setSize(liquidNames.size(), 0.0);
|
||||
p.YSolid_.setSize(solidNames.size(), 0.0);
|
||||
@ -137,14 +136,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::readFields
|
||||
);
|
||||
|
||||
label i = 0;
|
||||
forAllIter
|
||||
(
|
||||
typename Cloud<ReactingMultiphaseParcel<ParcelType>>,
|
||||
c,
|
||||
iter
|
||||
)
|
||||
for (ReactingMultiphaseParcel<ParcelType>& p : c)
|
||||
{
|
||||
ReactingMultiphaseParcel<ParcelType>& p = iter();
|
||||
p.YGas_[j] = YGas[i++]/(p.Y()[GAS] + ROOTVSMALL);
|
||||
}
|
||||
}
|
||||
@ -162,14 +155,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::readFields
|
||||
);
|
||||
|
||||
label i = 0;
|
||||
forAllIter
|
||||
(
|
||||
typename Cloud<ReactingMultiphaseParcel<ParcelType>>,
|
||||
c,
|
||||
iter
|
||||
)
|
||||
for (ReactingMultiphaseParcel<ParcelType>& p : c)
|
||||
{
|
||||
ReactingMultiphaseParcel<ParcelType>& p = iter();
|
||||
p.YLiquid_[j] = YLiquid[i++]/(p.Y()[LIQ] + ROOTVSMALL);
|
||||
}
|
||||
}
|
||||
@ -187,14 +174,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::readFields
|
||||
);
|
||||
|
||||
label i = 0;
|
||||
forAllIter
|
||||
(
|
||||
typename Cloud<ReactingMultiphaseParcel<ParcelType>>,
|
||||
c,
|
||||
iter
|
||||
)
|
||||
for (ReactingMultiphaseParcel<ParcelType>& p : c)
|
||||
{
|
||||
ReactingMultiphaseParcel<ParcelType>& p = iter();
|
||||
p.YSolid_[j] = YSolid[i++]/(p.Y()[SLD] + ROOTVSMALL);
|
||||
}
|
||||
}
|
||||
@ -240,14 +221,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::writeFields
|
||||
);
|
||||
|
||||
label i = 0;
|
||||
forAllConstIter
|
||||
(
|
||||
typename Cloud<ReactingMultiphaseParcel<ParcelType>>,
|
||||
c,
|
||||
iter
|
||||
)
|
||||
for (const ReactingMultiphaseParcel<ParcelType>& p0 : c)
|
||||
{
|
||||
const ReactingMultiphaseParcel<ParcelType>& p0 = iter();
|
||||
YGas[i++] = p0.YGas()[j]*p0.Y()[GAS];
|
||||
}
|
||||
|
||||
@ -269,14 +244,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::writeFields
|
||||
);
|
||||
|
||||
label i = 0;
|
||||
forAllConstIter
|
||||
(
|
||||
typename Cloud<ReactingMultiphaseParcel<ParcelType>>,
|
||||
c,
|
||||
iter
|
||||
)
|
||||
for (const ReactingMultiphaseParcel<ParcelType>& p0 : c)
|
||||
{
|
||||
const ReactingMultiphaseParcel<ParcelType>& p0 = iter();
|
||||
YLiquid[i++] = p0.YLiquid()[j]*p0.Y()[LIQ];
|
||||
}
|
||||
|
||||
@ -298,14 +267,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::writeFields
|
||||
);
|
||||
|
||||
label i = 0;
|
||||
forAllConstIter
|
||||
(
|
||||
typename Cloud<ReactingMultiphaseParcel<ParcelType>>,
|
||||
c,
|
||||
iter
|
||||
)
|
||||
for (const ReactingMultiphaseParcel<ParcelType>& p0 : c)
|
||||
{
|
||||
const ReactingMultiphaseParcel<ParcelType>& p0 = iter();
|
||||
YSolid[i++] = p0.YSolid()[j]*p0.Y()[SLD];
|
||||
}
|
||||
|
||||
@ -356,14 +319,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::writeObjects
|
||||
);
|
||||
|
||||
label i = 0;
|
||||
forAllConstIter
|
||||
(
|
||||
typename Cloud<ReactingMultiphaseParcel<ParcelType>>,
|
||||
c,
|
||||
iter
|
||||
)
|
||||
for (const ReactingMultiphaseParcel<ParcelType>& p0 : c)
|
||||
{
|
||||
const ReactingMultiphaseParcel<ParcelType>& p0 = iter();
|
||||
YGas[i++] = p0.YGas()[j]*p0.Y()[GAS];
|
||||
}
|
||||
}
|
||||
@ -379,14 +336,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::writeObjects
|
||||
);
|
||||
|
||||
label i = 0;
|
||||
forAllConstIter
|
||||
(
|
||||
typename Cloud<ReactingMultiphaseParcel<ParcelType>>,
|
||||
c,
|
||||
iter
|
||||
)
|
||||
for (const ReactingMultiphaseParcel<ParcelType>& p0 : c)
|
||||
{
|
||||
const ReactingMultiphaseParcel<ParcelType>& p0 = iter();
|
||||
YLiquid[i++] = p0.YLiquid()[j]*p0.Y()[LIQ];
|
||||
}
|
||||
}
|
||||
@ -402,14 +353,8 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::writeObjects
|
||||
);
|
||||
|
||||
label i = 0;
|
||||
forAllConstIter
|
||||
(
|
||||
typename Cloud<ReactingMultiphaseParcel<ParcelType>>,
|
||||
c,
|
||||
iter
|
||||
)
|
||||
for (const ReactingMultiphaseParcel<ParcelType>& p0 : c)
|
||||
{
|
||||
const ReactingMultiphaseParcel<ParcelType>& p0 = iter();
|
||||
YSolid[i++] = p0.YSolid()[j]*p0.Y()[SLD];
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2011, 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011, 2016-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
@ -109,10 +109,11 @@ void Foam::ReactingParcel<ParcelType>::readFields
|
||||
c.checkFieldIOobject(c, mass0);
|
||||
|
||||
label i = 0;
|
||||
forAllIter(typename Cloud<ReactingParcel<ParcelType>>, c, iter)
|
||||
for (ReactingParcel<ParcelType>& p : c)
|
||||
{
|
||||
ReactingParcel<ParcelType>& p = iter();
|
||||
p.mass0_ = mass0[i++];
|
||||
p.mass0_ = mass0[i];
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
// Get names and sizes for each Y...
|
||||
@ -126,9 +127,8 @@ void Foam::ReactingParcel<ParcelType>::readFields
|
||||
|
||||
|
||||
// Set storage for each Y... for each parcel
|
||||
forAllIter(typename Cloud<ReactingParcel<ParcelType>>, c, iter)
|
||||
for (ReactingParcel<ParcelType>& p : c)
|
||||
{
|
||||
ReactingParcel<ParcelType>& p = iter();
|
||||
p.Y_.setSize(nPhases, 0.0);
|
||||
}
|
||||
|
||||
@ -146,10 +146,11 @@ void Foam::ReactingParcel<ParcelType>::readFields
|
||||
);
|
||||
|
||||
label i = 0;
|
||||
forAllIter(typename Cloud<ReactingParcel<ParcelType>>, c, iter)
|
||||
for (ReactingParcel<ParcelType>& p : c)
|
||||
{
|
||||
ReactingParcel<ParcelType>& p = iter();
|
||||
p.Y_[j] = Y[i++];
|
||||
p.Y_[j] = Y[i];
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -179,10 +180,11 @@ void Foam::ReactingParcel<ParcelType>::writeFields
|
||||
IOField<scalar> mass0(c.fieldIOobject("mass0", IOobject::NO_READ), np);
|
||||
|
||||
label i = 0;
|
||||
forAllConstIter(typename Cloud<ReactingParcel<ParcelType>>, c, iter)
|
||||
for (const ReactingParcel<ParcelType>& p : c)
|
||||
{
|
||||
const ReactingParcel<ParcelType>& p = iter();
|
||||
mass0[i++] = p.mass0_;
|
||||
|
||||
++i;
|
||||
}
|
||||
mass0.write(np > 0);
|
||||
|
||||
@ -205,16 +207,13 @@ void Foam::ReactingParcel<ParcelType>::writeFields
|
||||
),
|
||||
np
|
||||
);
|
||||
|
||||
label i = 0;
|
||||
forAllConstIter
|
||||
(
|
||||
typename Cloud<ReactingParcel<ParcelType>>,
|
||||
c,
|
||||
iter
|
||||
)
|
||||
for (const ReactingParcel<ParcelType>& p : c)
|
||||
{
|
||||
const ReactingParcel<ParcelType>& p = iter();
|
||||
Y[i++] = p.Y()[j];
|
||||
Y[i] = p.Y()[j];
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
Y.write(np > 0);
|
||||
@ -253,10 +252,11 @@ void Foam::ReactingParcel<ParcelType>::writeObjects
|
||||
IOField<scalar>& mass0(cloud::createIOField<scalar>("mass0", np, obr));
|
||||
|
||||
label i = 0;
|
||||
forAllConstIter(typename Cloud<ReactingParcel<ParcelType>>, c, iter)
|
||||
for (const ReactingParcel<ParcelType>& p : c)
|
||||
{
|
||||
const ReactingParcel<ParcelType>& p = iter();
|
||||
mass0[i++] = p.mass0_;
|
||||
mass0[i] = p.mass0_;
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
// Write the composition fractions
|
||||
@ -276,15 +276,11 @@ void Foam::ReactingParcel<ParcelType>::writeObjects
|
||||
);
|
||||
|
||||
label i = 0;
|
||||
forAllConstIter
|
||||
(
|
||||
typename Cloud<ReactingParcel<ParcelType>>,
|
||||
c,
|
||||
iter
|
||||
)
|
||||
for (const ReactingParcel<ParcelType>& p : c)
|
||||
{
|
||||
const ReactingParcel<ParcelType>& p = iter();
|
||||
Y[i++] = p.Y()[j];
|
||||
Y[i] = p.Y()[j];
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2011, 2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011, 2016-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
@ -94,13 +94,11 @@ void Foam::ThermoParcel<ParcelType>::readFields(CloudType& c)
|
||||
|
||||
|
||||
label i = 0;
|
||||
forAllIter(typename Cloud<ThermoParcel<ParcelType>>, c, iter)
|
||||
for (ThermoParcel<ParcelType>& p : c)
|
||||
{
|
||||
ThermoParcel<ParcelType>& p = iter();
|
||||
|
||||
p.T_ = T[i];
|
||||
p.Cp_ = Cp[i];
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,13 +115,11 @@ void Foam::ThermoParcel<ParcelType>::writeFields(const CloudType& c)
|
||||
IOField<scalar> Cp(c.fieldIOobject("Cp", IOobject::NO_READ), np);
|
||||
|
||||
label i = 0;
|
||||
forAllConstIter(typename Cloud<ThermoParcel<ParcelType>>, c, iter)
|
||||
for (const ThermoParcel<ParcelType>& p : c)
|
||||
{
|
||||
const ThermoParcel<ParcelType>& p = iter();
|
||||
|
||||
T[i] = p.T_;
|
||||
Cp[i] = p.Cp_;
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
|
||||
T.write(np > 0);
|
||||
@ -147,13 +143,11 @@ void Foam::ThermoParcel<ParcelType>::writeObjects
|
||||
IOField<scalar>& Cp(cloud::createIOField<scalar>("Cp", np, obr));
|
||||
|
||||
label i = 0;
|
||||
forAllConstIter(typename Cloud<ThermoParcel<ParcelType>>, c, iter)
|
||||
for (const ThermoParcel<ParcelType>& p : c)
|
||||
{
|
||||
const ThermoParcel<ParcelType>& p = iter();
|
||||
|
||||
T[i] = p.T_;
|
||||
Cp[i] = p.Cp_;
|
||||
i++;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011, 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
@ -46,10 +46,7 @@ void Foam::ParticleTracks<CloudType>::write()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction << "cloupPtr invalid" << endl;
|
||||
}
|
||||
DebugInFunction << "invalid cloud pointer" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,23 +122,12 @@ void Foam::ParticleTracks<CloudType>::postFace(const parcelType& p, bool&)
|
||||
<< "Cloud storage not allocated" << abort(FatalError);
|
||||
}
|
||||
|
||||
labelPairLookup::iterator iter =
|
||||
faceHitCounter_.find(labelPair(p.origProc(), p.origId()));
|
||||
const label count =
|
||||
++(faceHitCounter_(labelPair(p.origProc(), p.origId()), 0));
|
||||
|
||||
label localI = -1;
|
||||
if (iter != faceHitCounter_.end())
|
||||
{
|
||||
iter()++;
|
||||
localI = iter();
|
||||
}
|
||||
else
|
||||
{
|
||||
localI = 1;
|
||||
faceHitCounter_.insert(labelPair(p.origProc(), p.origId()), localI);
|
||||
}
|
||||
const label nSamples = floor(count/trackInterval_);
|
||||
|
||||
label nSamples = floor(localI/trackInterval_);
|
||||
if ((localI % trackInterval_ == 0) && (nSamples < maxSamples_))
|
||||
if ((count % trackInterval_) == 0 && nSamples < maxSamples_)
|
||||
{
|
||||
cloudPtr_->append
|
||||
(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2009-2011, 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
@ -45,10 +45,8 @@ template<class CloudType>
|
||||
void Foam::PairCollision<CloudType>::preInteraction()
|
||||
{
|
||||
// Set accumulated quantities to zero
|
||||
forAllIter(typename CloudType, this->owner(), iter)
|
||||
for (typename CloudType::parcelType& p : this->owner())
|
||||
{
|
||||
typename CloudType::parcelType& p = iter();
|
||||
|
||||
p.f() = Zero;
|
||||
|
||||
p.torque() = Zero;
|
||||
@ -145,11 +143,10 @@ void Foam::PairCollision<CloudType>::realReferredInteraction()
|
||||
|
||||
// Loop over all referred parcels in the referred cell
|
||||
|
||||
forAllIter
|
||||
for
|
||||
(
|
||||
typename IDLList<typename CloudType::parcelType>,
|
||||
refCellRefParticles,
|
||||
referredParcel
|
||||
typename CloudType::parcelType& referredParcel
|
||||
: refCellRefParticles
|
||||
)
|
||||
{
|
||||
// Loop over all real cells in that the referred cell is
|
||||
@ -165,7 +162,7 @@ void Foam::PairCollision<CloudType>::realReferredInteraction()
|
||||
evaluatePair
|
||||
(
|
||||
*realCellParcels[realParcelI],
|
||||
referredParcel()
|
||||
referredParcel
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -481,10 +478,8 @@ void Foam::PairCollision<CloudType>::postInteraction()
|
||||
{
|
||||
// Delete any collision records where no collision occurred this step
|
||||
|
||||
forAllIter(typename CloudType, this->owner(), iter)
|
||||
for (typename CloudType::parcelType& p : this->owner())
|
||||
{
|
||||
typename CloudType::parcelType& p = iter();
|
||||
|
||||
p.collisionRecords().update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2011, 2018 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011, 2018-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
@ -41,10 +41,8 @@ void Foam::PairSpringSliderDashpot<CloudType>::findMinMaxProperties
|
||||
rhoMax = -VGREAT;
|
||||
UMagMax = -VGREAT;
|
||||
|
||||
forAllConstIter(typename CloudType, this->owner(), iter)
|
||||
for (const typename CloudType::parcelType& p : this->owner())
|
||||
{
|
||||
const typename CloudType::parcelType& p = iter();
|
||||
|
||||
// Finding minimum diameter to avoid excessive arithmetic
|
||||
|
||||
scalar dEff = p.d();
|
||||
@ -125,13 +123,6 @@ Foam::PairSpringSliderDashpot<CloudType>::PairSpringSliderDashpot
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::PairSpringSliderDashpot<CloudType>::~PairSpringSliderDashpot()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011, 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
@ -136,7 +136,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~PairSpringSliderDashpot();
|
||||
virtual ~PairSpringSliderDashpot() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -41,10 +41,8 @@ void Foam::WallLocalSpringSliderDashpot<CloudType>::findMinMaxProperties
|
||||
rhoMax = -VGREAT;
|
||||
UMagMax = -VGREAT;
|
||||
|
||||
forAllConstIter(typename CloudType, this->owner(), iter)
|
||||
for (const typename CloudType::parcelType& p : this->owner())
|
||||
{
|
||||
const typename CloudType::parcelType& p = iter();
|
||||
|
||||
// Finding minimum diameter to avoid excessive arithmetic
|
||||
|
||||
scalar dEff = p.d();
|
||||
@ -213,11 +211,11 @@ Foam::WallLocalSpringSliderDashpot<CloudType>::WallLocalSpringSliderDashpot
|
||||
|
||||
DynamicList<label> wallPatchIndices;
|
||||
|
||||
forAll(bMesh, patchi)
|
||||
for (const polyPatch& pp : bMesh)
|
||||
{
|
||||
if (isA<wallPolyPatch>(bMesh[patchi]))
|
||||
if (isA<wallPolyPatch>(pp))
|
||||
{
|
||||
wallPatchIndices.append(bMesh[patchi].index());
|
||||
wallPatchIndices.append(pp.index());
|
||||
}
|
||||
}
|
||||
|
||||
@ -271,13 +269,6 @@ Foam::WallLocalSpringSliderDashpot<CloudType>::WallLocalSpringSliderDashpot
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::WallLocalSpringSliderDashpot<CloudType>::~WallLocalSpringSliderDashpot()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011, 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
@ -150,7 +150,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~WallLocalSpringSliderDashpot();
|
||||
virtual ~WallLocalSpringSliderDashpot() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -41,10 +41,8 @@ void Foam::WallSpringSliderDashpot<CloudType>::findMinMaxProperties
|
||||
rhoMax = -VGREAT;
|
||||
UMagMax = -VGREAT;
|
||||
|
||||
forAllConstIter(typename CloudType, this->owner(), iter)
|
||||
for (const typename CloudType::parcelType& p : this->owner())
|
||||
{
|
||||
const typename CloudType::parcelType& p = iter();
|
||||
|
||||
// Finding minimum diameter to avoid excessive arithmetic
|
||||
|
||||
scalar dEff = p.d();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -45,9 +45,8 @@ void Foam::InjectedParticleDistributionInjection<CloudType>::initialise()
|
||||
|
||||
// Flatten all data
|
||||
label particlei = 0;
|
||||
forAllConstIter(injectedParticleCloud, ipCloud, iter)
|
||||
for (const injectedParticle& p : ipCloud)
|
||||
{
|
||||
const injectedParticle& p = iter();
|
||||
tag[particlei] = p.tag();
|
||||
position[particlei] = p.position();
|
||||
U[particlei] = p.U();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -46,16 +46,14 @@ void Foam::InjectedParticleInjection<CloudType>::initialise()
|
||||
|
||||
label particlei = 0;
|
||||
|
||||
forAllConstIter(injectedParticleCloud, cloud, iter)
|
||||
for (const injectedParticle& p : cloud)
|
||||
{
|
||||
const injectedParticle& p = iter();
|
||||
|
||||
time[particlei] = p.soi();
|
||||
position[particlei] = p.position() + positionOffset_;
|
||||
diameter[particlei] = p.d();
|
||||
U[particlei] = p.U();
|
||||
|
||||
particlei++;
|
||||
++particlei;
|
||||
}
|
||||
|
||||
// Combine all proc data
|
||||
@ -218,13 +216,6 @@ Foam::InjectedParticleInjection<CloudType>::InjectedParticleInjection
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::InjectedParticleInjection<CloudType>::~InjectedParticleInjection()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
@ -289,7 +280,7 @@ Foam::label Foam::InjectedParticleInjection<CloudType>::parcelsToInject
|
||||
{
|
||||
if ((time_[particlei] >= time0) && (time_[particlei] < time1))
|
||||
{
|
||||
nParticles++;
|
||||
++nParticles;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -155,7 +155,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~InjectedParticleInjection();
|
||||
virtual ~InjectedParticleInjection() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2013-2017 OpenFOAM Foundation
|
||||
@ -165,9 +165,8 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate()
|
||||
)();
|
||||
|
||||
// random sampling
|
||||
forAllIter(typename CloudType, this->owner(), iter)
|
||||
for (typename CloudType::parcelType& p : this->owner())
|
||||
{
|
||||
typename CloudType::parcelType& p = iter();
|
||||
const tetIndices tetIs(p.currentTetIndices());
|
||||
|
||||
const scalar x = exponentAverage.interpolate(p.coordinates(), tetIs);
|
||||
@ -200,9 +199,8 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate()
|
||||
)
|
||||
);
|
||||
AveragingMethod<vector>& uTildeAverage = uTildeAveragePtr();
|
||||
forAllIter(typename CloudType, this->owner(), iter)
|
||||
for (typename CloudType::parcelType& p : this->owner())
|
||||
{
|
||||
typename CloudType::parcelType& p = iter();
|
||||
const tetIndices tetIs(p.currentTetIndices());
|
||||
uTildeAverage.add(p.coordinates(), tetIs, p.nParticle()*p.mass()*p.U());
|
||||
}
|
||||
@ -223,9 +221,8 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate()
|
||||
)
|
||||
);
|
||||
AveragingMethod<scalar>& uTildeSqrAverage = uTildeSqrAveragePtr();
|
||||
forAllIter(typename CloudType, this->owner(), iter)
|
||||
for (typename CloudType::parcelType& p : this->owner())
|
||||
{
|
||||
typename CloudType::parcelType& p = iter();
|
||||
const tetIndices tetIs(p.currentTetIndices());
|
||||
const vector uTilde = uTildeAverage.interpolate(p.coordinates(), tetIs);
|
||||
uTildeSqrAverage.add
|
||||
@ -238,9 +235,8 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate()
|
||||
uTildeSqrAverage.average(massAverage);
|
||||
|
||||
// conservation correction
|
||||
forAllIter(typename CloudType, this->owner(), iter)
|
||||
for (typename CloudType::parcelType& p : this->owner())
|
||||
{
|
||||
typename CloudType::parcelType& p = iter();
|
||||
const tetIndices tetIs(p.currentTetIndices());
|
||||
|
||||
const vector u = uAverage.interpolate(p.coordinates(), tetIs);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd |
|
||||
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
| Copyright (C) 2013-2017 OpenFOAM Foundation
|
||||
@ -46,10 +46,9 @@ void Foam::SuppressionCollision<CloudType>::collide
|
||||
dimensionedScalar Dt("dt", dimTime, dt);
|
||||
volScalarField P(type() + ":p", 1.0 - exp(-vDotSweep*Dt));
|
||||
|
||||
forAllIter(typename CloudType, this->owner(), iter)
|
||||
for (typename CloudType::parcelType& p : this->owner())
|
||||
{
|
||||
typename CloudType::parcelType& p = iter();
|
||||
label celli = p.cell();
|
||||
const label celli = p.cell();
|
||||
|
||||
scalar xx = this->owner().rndGen().template sample01<scalar>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user