MPPICCloud: Predictor corrector scheme
This change replaces the MPPIC cloud's approximate correcton tracks with a formal predictor-corrector scheme. This reduces the parcels' memory usage and prevents ad-hoc corrections to tracking time and associated parcel properties.
This commit is contained in:
@ -28,7 +28,7 @@ License
|
||||
#include "polyMesh.H"
|
||||
#include "calculatedPointPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::interpolation<Type>::interpolation
|
||||
@ -41,6 +41,14 @@ Foam::interpolation<Type>::interpolation
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::interpolation<Type>::interpolation(const interpolation<Type>& i)
|
||||
:
|
||||
psi_(i.psi_),
|
||||
mesh_(i.mesh_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
|
||||
@ -110,6 +110,13 @@ public:
|
||||
const VolField<Type>& psi
|
||||
);
|
||||
|
||||
//- Copy constructor
|
||||
interpolation(const interpolation<Type>& i);
|
||||
|
||||
//- Clone
|
||||
virtual autoPtr<interpolation<Type>> clone() const = 0;
|
||||
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~interpolation()
|
||||
|
||||
@ -38,6 +38,16 @@ Foam::interpolationCell<Type>::interpolationCell
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::interpolationCell<Type>::interpolationCell
|
||||
(
|
||||
const interpolationCell<Type>& i
|
||||
)
|
||||
:
|
||||
fieldInterpolation<Type, interpolationCell<Type>>(i)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
|
||||
@ -65,6 +65,19 @@ public:
|
||||
const VolField<Type>& psi
|
||||
);
|
||||
|
||||
//- Copy construct
|
||||
interpolationCell(const interpolationCell<Type>& i);
|
||||
|
||||
//- Clone
|
||||
virtual autoPtr<interpolation<Type>> clone() const
|
||||
{
|
||||
return autoPtr<interpolation<Type>>
|
||||
(
|
||||
new interpolationCell<Type>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
@ -38,6 +38,16 @@ Foam::interpolationCellPatchConstrained<Type>::interpolationCellPatchConstrained
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::interpolationCellPatchConstrained<Type>::interpolationCellPatchConstrained
|
||||
(
|
||||
const interpolationCellPatchConstrained<Type>& i
|
||||
)
|
||||
:
|
||||
fieldInterpolation<Type, interpolationCellPatchConstrained<Type>>(i)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
|
||||
@ -67,6 +67,21 @@ public:
|
||||
const VolField<Type>& psi
|
||||
);
|
||||
|
||||
//- Copy construct
|
||||
interpolationCellPatchConstrained
|
||||
(
|
||||
const interpolationCellPatchConstrained<Type>& i
|
||||
);
|
||||
|
||||
//- Clone
|
||||
virtual autoPtr<interpolation<Type>> clone() const
|
||||
{
|
||||
return autoPtr<interpolation<Type>>
|
||||
(
|
||||
new interpolationCellPatchConstrained<Type>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
@ -42,6 +42,20 @@ Foam::interpolationCellPoint<Type>::interpolationCellPoint
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::interpolationCellPoint<Type>::interpolationCellPoint
|
||||
(
|
||||
const interpolationCellPoint<Type>& i
|
||||
)
|
||||
:
|
||||
fieldInterpolation<Type, interpolationCellPoint<Type>>(i),
|
||||
interpolationVolPointInterpolation<Type>(i)
|
||||
{
|
||||
// Uses cellPointWeight to do interpolation which needs tet decomposition
|
||||
(void)this->psi().mesh().tetBasePtIs();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::interpolationCellPoint<Type>::interpolationCellPoint
|
||||
(
|
||||
|
||||
@ -65,6 +65,12 @@ public:
|
||||
const VolField<Type>& psi
|
||||
);
|
||||
|
||||
//- Copy construct
|
||||
interpolationCellPoint
|
||||
(
|
||||
const interpolationCellPoint<Type>& i
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
interpolationCellPoint
|
||||
(
|
||||
@ -72,6 +78,15 @@ public:
|
||||
tmp<PointField<Type>> psip
|
||||
);
|
||||
|
||||
//- Clone
|
||||
virtual autoPtr<interpolation<Type>> clone() const
|
||||
{
|
||||
return autoPtr<interpolation<Type>>
|
||||
(
|
||||
new interpolationCellPoint<Type>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
@ -45,6 +45,18 @@ Foam::interpolationCellPointFace<Type>::interpolationCellPointFace
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::interpolationCellPointFace<Type>::interpolationCellPointFace
|
||||
(
|
||||
const interpolationCellPointFace<Type>& i
|
||||
)
|
||||
:
|
||||
fieldInterpolation<Type, interpolationCellPointFace<Type>>(i),
|
||||
interpolationVolPointInterpolation<Type>(i),
|
||||
psis_(i.psis_.clone())
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
|
||||
@ -90,6 +90,21 @@ public:
|
||||
const VolField<Type>& psi
|
||||
);
|
||||
|
||||
//- Copy construct
|
||||
interpolationCellPointFace
|
||||
(
|
||||
const interpolationCellPointFace<Type>& i
|
||||
);
|
||||
|
||||
//- Clone
|
||||
virtual autoPtr<interpolation<Type>> clone() const
|
||||
{
|
||||
return autoPtr<interpolation<Type>>
|
||||
(
|
||||
new interpolationCellPointFace<Type>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
@ -331,4 +331,15 @@ interpolationCellPointWallModified
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::interpolationCellPointWallModified<Type>::
|
||||
interpolationCellPointWallModified
|
||||
(
|
||||
const interpolationCellPointWallModified<Type>& i
|
||||
)
|
||||
:
|
||||
interpolationCellPoint<Type>(i)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -84,6 +84,21 @@ public:
|
||||
(
|
||||
const VolField<Type>& psi
|
||||
);
|
||||
|
||||
//- Copy construct
|
||||
interpolationCellPointWallModified
|
||||
(
|
||||
const interpolationCellPointWallModified<Type>& i
|
||||
);
|
||||
|
||||
//- Clone
|
||||
virtual autoPtr<interpolation<Type>> clone() const
|
||||
{
|
||||
return autoPtr<interpolation<Type>>
|
||||
(
|
||||
new interpolationCellPointWallModified<Type>(*this)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -39,4 +39,15 @@ Foam::interpolationPointMVC<Type>::interpolationPointMVC
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::interpolationPointMVC<Type>::interpolationPointMVC
|
||||
(
|
||||
const interpolationPointMVC<Type>& i
|
||||
)
|
||||
:
|
||||
fieldInterpolation<Type, interpolationPointMVC<Type>>(i),
|
||||
interpolationVolPointInterpolation<Type>(i)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -65,6 +65,21 @@ public:
|
||||
const VolField<Type>& psi
|
||||
);
|
||||
|
||||
//- Copy construct
|
||||
interpolationPointMVC
|
||||
(
|
||||
const interpolationPointMVC<Type>& i
|
||||
);
|
||||
|
||||
//- Clone
|
||||
virtual autoPtr<interpolation<Type>> clone() const
|
||||
{
|
||||
return autoPtr<interpolation<Type>>
|
||||
(
|
||||
new interpolationPointMVC<Type>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
@ -47,6 +47,17 @@ interpolationVolPointInterpolation
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::interpolationVolPointInterpolation<Type>::
|
||||
interpolationVolPointInterpolation
|
||||
(
|
||||
const interpolationVolPointInterpolation<Type>& i
|
||||
)
|
||||
:
|
||||
psip_(i.psip_.clone())
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::interpolationVolPointInterpolation<Type>::
|
||||
interpolationVolPointInterpolation
|
||||
|
||||
@ -70,6 +70,12 @@ public:
|
||||
const VolField<Type>& psi
|
||||
);
|
||||
|
||||
//- Copy construct
|
||||
interpolationVolPointInterpolation
|
||||
(
|
||||
const interpolationVolPointInterpolation<Type>& i
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
interpolationVolPointInterpolation
|
||||
(
|
||||
|
||||
@ -62,6 +62,17 @@ void Foam::MPPICCloud<CloudType>::setModels()
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::MPPICCloud<CloudType>::cloudReset(MPPICCloud<CloudType>& c)
|
||||
{
|
||||
CloudType::cloudReset(c);
|
||||
|
||||
packingModel_.reset(c.packingModel_.ptr());
|
||||
dampingModel_.reset(c.dampingModel_.ptr());
|
||||
isotropyModel_.reset(c.isotropyModel_.ptr());
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
@ -166,7 +177,8 @@ void Foam::MPPICCloud<CloudType>::storeState()
|
||||
template<class CloudType>
|
||||
void Foam::MPPICCloud<CloudType>::restoreState()
|
||||
{
|
||||
this->cloudReset(cloudCopyPtr_());
|
||||
cloudReset(cloudCopyPtr_());
|
||||
|
||||
cloudCopyPtr_.clear();
|
||||
}
|
||||
|
||||
@ -191,98 +203,104 @@ void Foam::MPPICCloud<CloudType>::motion
|
||||
typename parcelType::trackingData& td
|
||||
)
|
||||
{
|
||||
// Momentum
|
||||
// ~~~~~~~~
|
||||
// Assign parcel ID-s
|
||||
label i = 0;
|
||||
forAllIter(typename MPPICCloud<CloudType>, *this, iter)
|
||||
{
|
||||
iter().id() = labelPair(Pstream::myProcNo(), i ++);
|
||||
}
|
||||
|
||||
// force calculation and tracking
|
||||
td.part() = parcelType::trackingData::tpPredictTrack;
|
||||
// Create a copy of all parcels and sources to use as a predictor
|
||||
autoPtr<MPPICCloud<CloudType>> predictorCloudPtr
|
||||
(
|
||||
static_cast<MPPICCloud<CloudType>*>
|
||||
(
|
||||
clone(this->name() + "Predictor").ptr()
|
||||
)
|
||||
);
|
||||
MPPICCloud<CloudType>& predictorCloud = predictorCloudPtr();
|
||||
|
||||
// Predictor move
|
||||
predictorCloud.CloudType::move(predictorCloud, td);
|
||||
|
||||
// Calculate correction velocities
|
||||
const scalar trackTime = td.trackTime();
|
||||
td.updateAverages(predictorCloud);
|
||||
predictorCloud.dampingModel().cacheFields(true);
|
||||
predictorCloud.packingModel().cacheFields(true);
|
||||
vectorField UCorr(this->size(), Zero);
|
||||
List<DynamicList<vector>> UCorrProc(Pstream::nProcs());
|
||||
List<DynamicList<label>> IDProc(Pstream::nProcs());
|
||||
forAllIter(typename MPPICCloud<CloudType>, predictorCloud, iter)
|
||||
{
|
||||
const labelPair& id = iter().id();
|
||||
|
||||
const vector dU =
|
||||
predictorCloud.packingModel().velocityCorrection(iter(), trackTime)
|
||||
+ predictorCloud.dampingModel().velocityCorrection(iter(), trackTime);
|
||||
|
||||
if (id.first() == Pstream::myProcNo())
|
||||
{
|
||||
UCorr[id.second()] = dU;
|
||||
}
|
||||
else
|
||||
{
|
||||
UCorrProc[id.first()].append(dU);
|
||||
IDProc[id.first()].append(id.second());
|
||||
}
|
||||
}
|
||||
predictorCloud.dampingModel().cacheFields(false);
|
||||
predictorCloud.packingModel().cacheFields(false);
|
||||
|
||||
// Distribute the correction velocities
|
||||
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
forAll(UCorrProc, proci)
|
||||
{
|
||||
if (proci == Pstream::myProcNo()) continue;
|
||||
|
||||
UOPstream os(proci, pBufs);
|
||||
|
||||
os << UCorrProc[proci] << IDProc[proci];
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
forAll(UCorrProc, proci)
|
||||
{
|
||||
if (proci == Pstream::myProcNo()) continue;
|
||||
|
||||
UIPstream is(proci, pBufs);
|
||||
|
||||
is >> UCorrProc[proci] >> IDProc[proci];
|
||||
}
|
||||
}
|
||||
forAll(UCorrProc, proci)
|
||||
{
|
||||
if (proci == Pstream::myProcNo()) continue;
|
||||
|
||||
forAll(UCorrProc[proci], i)
|
||||
{
|
||||
UCorr[IDProc[proci][i]] = UCorrProc[proci][i];
|
||||
}
|
||||
}
|
||||
|
||||
// Apply the correction velocities to the parcels
|
||||
forAllIter(typename MPPICCloud<CloudType>, *this, iter)
|
||||
{
|
||||
iter().U() += UCorr[iter().id().second()];
|
||||
}
|
||||
|
||||
// Corrector
|
||||
CloudType::move(cloud, td);
|
||||
|
||||
// Apply isotropy model
|
||||
td.updateAverages(cloud);
|
||||
isotropyModel_->calculate();
|
||||
|
||||
// Preliminary
|
||||
// ~~~~~~~~~~~
|
||||
|
||||
// switch forces off so they are not applied in corrector steps
|
||||
this->forces().setCalcNonCoupled(false);
|
||||
this->forces().setCalcCoupled(false);
|
||||
|
||||
|
||||
// Damping
|
||||
// ~~~~~~~
|
||||
|
||||
if (!isType<DampingModels::NoDamping<CloudType>>(dampingModel_()))
|
||||
{
|
||||
if (this->mesh().moving())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "MPPIC damping modelling does not support moving meshes."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// update averages
|
||||
td.updateAverages(cloud);
|
||||
|
||||
// memory allocation and eulerian calculations
|
||||
dampingModel_->cacheFields(true);
|
||||
|
||||
// calculate the damping velocity corrections without moving the parcels
|
||||
td.part() = parcelType::trackingData::tpDampingNoTrack;
|
||||
CloudType::move(cloud, td);
|
||||
|
||||
// correct the parcel positions and velocities
|
||||
td.part() = parcelType::trackingData::tpCorrectTrack;
|
||||
CloudType::move(cloud, td);
|
||||
|
||||
// finalise and free memory
|
||||
dampingModel_->cacheFields(false);
|
||||
}
|
||||
|
||||
|
||||
// Packing
|
||||
// ~~~~~~~
|
||||
|
||||
if (!isType<PackingModels::NoPacking<CloudType>>(packingModel_()))
|
||||
{
|
||||
if (this->mesh().moving())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "MPPIC packing modelling does not support moving meshes."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// same procedure as for damping
|
||||
td.updateAverages(cloud);
|
||||
packingModel_->cacheFields(true);
|
||||
td.part() = parcelType::trackingData::tpPackingNoTrack;
|
||||
CloudType::move(cloud, td);
|
||||
td.part() = parcelType::trackingData::tpCorrectTrack;
|
||||
CloudType::move(cloud, td);
|
||||
packingModel_->cacheFields(false);
|
||||
}
|
||||
|
||||
|
||||
// Isotropy
|
||||
// ~~~~~~~~
|
||||
|
||||
if (!isType<IsotropyModels::NoIsotropy<CloudType>>(isotropyModel_()))
|
||||
{
|
||||
// update averages
|
||||
td.updateAverages(cloud);
|
||||
|
||||
// apply isotropy model
|
||||
isotropyModel_->calculate();
|
||||
}
|
||||
|
||||
|
||||
// Final
|
||||
// ~~~~~
|
||||
|
||||
// update cell occupancy
|
||||
// Update cell occupancy
|
||||
this->updateCellOccupancy();
|
||||
|
||||
// switch forces back on
|
||||
this->forces().setCalcNonCoupled(true);
|
||||
this->forces().setCalcCoupled(this->solution().coupled());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -123,6 +123,9 @@ protected:
|
||||
//- Set cloud sub-models
|
||||
void setModels();
|
||||
|
||||
//- Reset state of cloud
|
||||
void cloudReset(MPPICCloud<CloudType>& c);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -34,74 +34,10 @@ Foam::MPPICParcel<ParcelType>::MPPICParcel
|
||||
)
|
||||
:
|
||||
ParcelType(p),
|
||||
UCorrect_(p.UCorrect_)
|
||||
id_(p.id_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class ParcelType>
|
||||
template<class TrackCloudType>
|
||||
bool Foam::MPPICParcel<ParcelType>::move
|
||||
(
|
||||
TrackCloudType& cloud,
|
||||
trackingData& td
|
||||
)
|
||||
{
|
||||
typename TrackCloudType::parcelType& p =
|
||||
static_cast<typename TrackCloudType::parcelType&>(*this);
|
||||
|
||||
switch (td.part())
|
||||
{
|
||||
case trackingData::tpPredictTrack:
|
||||
{
|
||||
ParcelType::move(cloud, td);
|
||||
|
||||
break;
|
||||
}
|
||||
case trackingData::tpDampingNoTrack:
|
||||
{
|
||||
p.UCorrect() =
|
||||
cloud.dampingModel().velocityCorrection(p, td.trackTime());
|
||||
|
||||
td.keepParticle = true;
|
||||
td.sendToProc = -1;
|
||||
|
||||
break;
|
||||
}
|
||||
case trackingData::tpPackingNoTrack:
|
||||
{
|
||||
p.UCorrect() =
|
||||
cloud.packingModel().velocityCorrection(p, td.trackTime());
|
||||
|
||||
td.keepParticle = true;
|
||||
td.sendToProc = -1;
|
||||
|
||||
break;
|
||||
}
|
||||
case trackingData::tpCorrectTrack:
|
||||
{
|
||||
const scalar f = p.stepFraction();
|
||||
const scalar a = p.age();
|
||||
|
||||
Swap(p.U(), p.UCorrect());
|
||||
|
||||
ParcelType::move(cloud, td);
|
||||
|
||||
Swap(p.U(), p.UCorrect());
|
||||
|
||||
p.U() += (p.stepFraction() - f)*p.UCorrect();
|
||||
|
||||
p.age() = a;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return td.keepParticle;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
|
||||
|
||||
#include "MPPICParcelIO.C"
|
||||
|
||||
@ -93,18 +93,6 @@ public:
|
||||
:
|
||||
public ParcelType::trackingData
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
enum trackPart
|
||||
{
|
||||
tpPredictTrack,
|
||||
tpDampingNoTrack,
|
||||
tpPackingNoTrack,
|
||||
tpCorrectTrack,
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Data
|
||||
@ -114,7 +102,7 @@ public:
|
||||
//- Volume average
|
||||
autoPtr<AveragingMethod<scalar>> volumeAverage_;
|
||||
|
||||
//- Radius average [ volume^(1/3) ]
|
||||
//- Radius average
|
||||
autoPtr<AveragingMethod<scalar>> radiusAverage_;
|
||||
|
||||
//- Density average
|
||||
@ -123,7 +111,7 @@ public:
|
||||
//- Velocity average
|
||||
autoPtr<AveragingMethod<vector>> uAverage_;
|
||||
|
||||
//- Magnitude velocity sqyuared average
|
||||
//- Magnitude velocity squared average
|
||||
autoPtr<AveragingMethod<scalar>> uSqrAverage_;
|
||||
|
||||
//- Frequency average
|
||||
@ -133,10 +121,6 @@ public:
|
||||
autoPtr<AveragingMethod<scalar>> massAverage_;
|
||||
|
||||
|
||||
//- Which part of the integration algorithm is taking place
|
||||
trackPart part_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Constructors
|
||||
@ -149,15 +133,6 @@ public:
|
||||
//- Update the MPPIC averages
|
||||
template<class TrackCloudType>
|
||||
inline void updateAverages(const TrackCloudType& cloud);
|
||||
|
||||
|
||||
//- Access
|
||||
|
||||
//- Const access to the tracking part
|
||||
inline trackPart part() const;
|
||||
|
||||
//- Non const access to the tracking part
|
||||
inline trackPart& part();
|
||||
};
|
||||
|
||||
|
||||
@ -165,8 +140,10 @@ protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Velocity correction due to collisions [m/s]
|
||||
vector UCorrect_;
|
||||
//- Processor and particle ID at the start of a tracking step. Allows
|
||||
// values calculated at the end of the step to be mapped back to the
|
||||
// starting state, in order to initialise a second corrector step.
|
||||
labelPair id_;
|
||||
|
||||
|
||||
public:
|
||||
@ -174,11 +151,7 @@ public:
|
||||
// Static Data Members
|
||||
|
||||
//- String representation of properties
|
||||
AddToPropertyList
|
||||
(
|
||||
ParcelType,
|
||||
"(UCorrectx UCorrecty UCorrectz)"
|
||||
);
|
||||
AddToPropertyList(ParcelType, "");
|
||||
|
||||
|
||||
// Constructors
|
||||
@ -227,18 +200,11 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return const access to correction velocity
|
||||
inline const vector& UCorrect() const;
|
||||
//- Return const access to the identifier
|
||||
inline const labelPair& id() const;
|
||||
|
||||
//- Return access to correction velocity
|
||||
inline vector& UCorrect();
|
||||
|
||||
|
||||
// Tracking
|
||||
|
||||
//- Move the parcel
|
||||
template<class TrackCloudType>
|
||||
bool move(TrackCloudType& cloud, trackingData& td);
|
||||
//- Return access to the identifier
|
||||
inline labelPair& id();
|
||||
|
||||
|
||||
// Friend Functions
|
||||
|
||||
@ -39,7 +39,7 @@ inline Foam::MPPICParcel<ParcelType>::MPPICParcel
|
||||
)
|
||||
:
|
||||
ParcelType(mesh, coordinates, celli, tetFacei, tetPti, facei),
|
||||
UCorrect_(Zero)
|
||||
id_(-1, -1)
|
||||
{}
|
||||
|
||||
|
||||
@ -52,23 +52,23 @@ inline Foam::MPPICParcel<ParcelType>::MPPICParcel
|
||||
)
|
||||
:
|
||||
ParcelType(mesh, position, celli),
|
||||
UCorrect_(Zero)
|
||||
id_(-1, -1)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class ParcelType>
|
||||
inline const Foam::vector& Foam::MPPICParcel<ParcelType>::UCorrect() const
|
||||
inline const Foam::labelPair& Foam::MPPICParcel<ParcelType>::id() const
|
||||
{
|
||||
return UCorrect_;
|
||||
return id_;
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline Foam::vector& Foam::MPPICParcel<ParcelType>::UCorrect()
|
||||
inline Foam::labelPair& Foam::MPPICParcel<ParcelType>::id()
|
||||
{
|
||||
return UCorrect_;
|
||||
return id_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -46,17 +46,17 @@ template<class ParcelType>
|
||||
Foam::MPPICParcel<ParcelType>::MPPICParcel(Istream& is, bool readFields)
|
||||
:
|
||||
ParcelType(is, readFields),
|
||||
UCorrect_(Zero)
|
||||
id_(-1, -1)
|
||||
{
|
||||
if (readFields)
|
||||
{
|
||||
if (is.format() == IOstream::ASCII)
|
||||
{
|
||||
is >> UCorrect_;
|
||||
is >> id_;
|
||||
}
|
||||
else
|
||||
{
|
||||
is.read(reinterpret_cast<char*>(&UCorrect_), sizeofFields_);
|
||||
is.read(reinterpret_cast<char*>(&id_), sizeofFields_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,27 +72,7 @@ template<class ParcelType>
|
||||
template<class CloudType>
|
||||
void Foam::MPPICParcel<ParcelType>::readFields(CloudType& c)
|
||||
{
|
||||
bool valid = c.size();
|
||||
|
||||
ParcelType::readFields(c);
|
||||
|
||||
IOField<vector> UCorrect
|
||||
(
|
||||
c.fieldIOobject("UCorrect", IOobject::MUST_READ),
|
||||
valid
|
||||
);
|
||||
c.checkFieldIOobject(c, UCorrect);
|
||||
|
||||
label i = 0;
|
||||
|
||||
forAllIter(typename CloudType, c, iter)
|
||||
{
|
||||
MPPICParcel<ParcelType>& p = iter();
|
||||
|
||||
p.UCorrect_ = UCorrect[i];
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -101,24 +81,6 @@ template<class CloudType>
|
||||
void Foam::MPPICParcel<ParcelType>::writeFields(const CloudType& c)
|
||||
{
|
||||
ParcelType::writeFields(c);
|
||||
|
||||
label np = c.size();
|
||||
|
||||
IOField<vector>
|
||||
UCorrect(c.fieldIOobject("UCorrect", IOobject::NO_READ), np);
|
||||
|
||||
label i = 0;
|
||||
|
||||
forAllConstIter(typename CloudType, c, iter)
|
||||
{
|
||||
const MPPICParcel<ParcelType>& p = iter();
|
||||
|
||||
UCorrect[i] = p.UCorrect();
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
UCorrect.write(np > 0);
|
||||
}
|
||||
|
||||
|
||||
@ -134,14 +96,14 @@ Foam::Ostream& Foam::operator<<
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
os << static_cast<const ParcelType&>(p)
|
||||
<< token::SPACE << p.UCorrect();
|
||||
<< token::SPACE << p.id();
|
||||
}
|
||||
else
|
||||
{
|
||||
os << static_cast<const ParcelType&>(p);
|
||||
os.write
|
||||
(
|
||||
reinterpret_cast<const char*>(&p.UCorrect_),
|
||||
reinterpret_cast<const char*>(&p.id_),
|
||||
MPPICParcel<ParcelType>::sizeofFields_
|
||||
);
|
||||
}
|
||||
|
||||
@ -132,8 +132,7 @@ inline Foam::MPPICParcel<ParcelType>::trackingData::trackingData
|
||||
cloud.solution().dict(),
|
||||
cloud.mesh()
|
||||
)
|
||||
),
|
||||
part_(tpPredictTrack)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -244,20 +243,4 @@ inline void Foam::MPPICParcel<ParcelType>::trackingData::updateAverages
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline typename Foam::MPPICParcel<ParcelType>::trackingData::trackPart
|
||||
Foam::MPPICParcel<ParcelType>::trackingData::part() const
|
||||
{
|
||||
return part_;
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline typename Foam::MPPICParcel<ParcelType>::trackingData::trackPart&
|
||||
Foam::MPPICParcel<ParcelType>::trackingData::part()
|
||||
{
|
||||
return part_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -59,7 +59,7 @@ template<class CloudType>
|
||||
Foam::DampingModel<CloudType>::DampingModel(const DampingModel<CloudType>& cm)
|
||||
:
|
||||
CloudSubModelBase<CloudType>(cm),
|
||||
timeScaleModel_(cm.timeScaleModel_)
|
||||
timeScaleModel_(cm.timeScaleModel_, false)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ Foam::DampingModels::Relaxation<CloudType>::Relaxation
|
||||
:
|
||||
DampingModel<CloudType>(cm),
|
||||
uAverage_(nullptr),
|
||||
oneByTimeScaleAverage_(cm.oneByTimeScaleAverage_->clone())
|
||||
oneByTimeScaleAverage_(cm.oneByTimeScaleAverage_, false)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -63,7 +63,7 @@ Foam::IsotropyModel<CloudType>::IsotropyModel
|
||||
)
|
||||
:
|
||||
CloudSubModelBase<CloudType>(cm),
|
||||
timeScaleModel_(cm.timeScaleModel_)
|
||||
timeScaleModel_(cm.timeScaleModel_->clone())
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -53,11 +53,8 @@ Foam::PackingModels::Explicit<CloudType>::Explicit
|
||||
)
|
||||
:
|
||||
PackingModel<CloudType>(cm),
|
||||
stressAverage_(cm.stressAverage_->clone()),
|
||||
correctionLimiting_
|
||||
(
|
||||
cm.correctionLimiting_->clone()
|
||||
)
|
||||
stressAverage_(cm.stressAverage_, false),
|
||||
correctionLimiting_(cm.correctionLimiting_, false)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -76,8 +76,18 @@ Foam::PackingModels::Implicit<CloudType>::Implicit
|
||||
:
|
||||
PackingModel<CloudType>(cm),
|
||||
alpha_(cm.alpha_),
|
||||
phiCorrect_(cm.phiCorrect_()),
|
||||
uCorrect_(cm.uCorrect_()),
|
||||
phiCorrect_
|
||||
(
|
||||
cm.phiCorrect_.valid()
|
||||
? cm.phiCorrect_().clone()
|
||||
: tmp<surfaceScalarField>(nullptr)
|
||||
),
|
||||
uCorrect_
|
||||
(
|
||||
cm.uCorrect_.valid()
|
||||
? cm.uCorrect_().clone()
|
||||
: tmp<volVectorField>(nullptr)
|
||||
),
|
||||
applyLimiting_(cm.applyLimiting_),
|
||||
applyGravity_(cm.applyGravity_),
|
||||
alphaMin_(cm.alphaMin_),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -61,7 +61,7 @@ template<class CloudType>
|
||||
Foam::PackingModel<CloudType>::PackingModel(const PackingModel<CloudType>& cm)
|
||||
:
|
||||
CloudSubModelBase<CloudType>(cm),
|
||||
particleStressModel_(cm.particleStressModel_)
|
||||
particleStressModel_(cm.particleStressModel_, false)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2019-2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2019-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -53,8 +53,8 @@ Foam::DenseDragForce<CloudType>::DenseDragForce
|
||||
:
|
||||
ParticleForce<CloudType>(df),
|
||||
alphacName_(df.alphacName_),
|
||||
alphacPtr_(nullptr),
|
||||
alphacInterpPtr_(nullptr)
|
||||
alphacPtr_(df.alphacPtr_, false),
|
||||
alphacInterpPtr_(df.alphacInterpPtr_, false)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user