mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Cloud patch interaction model updates
- MultiInteraction: updated to call info() function of child models - PatchInteractionModel: added postEvolve hook - KinematicCloud: call patchInteraction() postEvolve hook
This commit is contained in:
committed by
Kutalmis Bercin
parent
7d897ee7a3
commit
b25c4611cb
@ -244,6 +244,8 @@ void Foam::KinematicCloud<CloudType>::postEvolve
|
|||||||
|
|
||||||
this->dispersion().cacheFields(false);
|
this->dispersion().cacheFields(false);
|
||||||
|
|
||||||
|
this->patchInteraction().postEvolve();
|
||||||
|
|
||||||
forces_.cacheFields(false);
|
forces_.cacheFields(false);
|
||||||
|
|
||||||
functions_.postEvolve(td);
|
functions_.postEvolve(td);
|
||||||
|
|||||||
@ -147,6 +147,7 @@ void Foam::patchInjectionBase::updateMesh(const polyMesh& mesh)
|
|||||||
void Foam::patchInjectionBase::setPositionAndCell
|
void Foam::patchInjectionBase::setPositionAndCell
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
|
const scalar fraction01,
|
||||||
Random& rnd,
|
Random& rnd,
|
||||||
vector& position,
|
vector& position,
|
||||||
label& cellOwner,
|
label& cellOwner,
|
||||||
@ -154,23 +155,15 @@ void Foam::patchInjectionBase::setPositionAndCell
|
|||||||
label& tetPti
|
label& tetPti
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
scalar areaFraction = rnd.globalPosition(scalar(0), patchArea_);
|
|
||||||
|
|
||||||
if (cellOwners_.size() > 0)
|
if (cellOwners_.size() > 0)
|
||||||
{
|
{
|
||||||
// Determine which processor to inject from
|
// Determine which processor to inject from
|
||||||
label proci = 0;
|
const label proci = whichProc(fraction01);
|
||||||
forAllReverse(sumTriMagSf_, i)
|
|
||||||
{
|
|
||||||
if (areaFraction >= sumTriMagSf_[i])
|
|
||||||
{
|
|
||||||
proci = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Pstream::myProcNo() == proci)
|
if (Pstream::myProcNo() == proci)
|
||||||
{
|
{
|
||||||
|
const scalar areaFraction = fraction01*patchArea_;
|
||||||
|
|
||||||
// Find corresponding decomposed face triangle
|
// Find corresponding decomposed face triangle
|
||||||
label trii = 0;
|
label trii = 0;
|
||||||
scalar offset = sumTriMagSf_[proci];
|
scalar offset = sumTriMagSf_[proci];
|
||||||
@ -271,4 +264,46 @@ void Foam::patchInjectionBase::setPositionAndCell
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::patchInjectionBase::setPositionAndCell
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
Random& rnd,
|
||||||
|
vector& position,
|
||||||
|
label& cellOwner,
|
||||||
|
label& tetFacei,
|
||||||
|
label& tetPti
|
||||||
|
)
|
||||||
|
{
|
||||||
|
scalar fraction01 = rnd.globalSample01<scalar>();
|
||||||
|
|
||||||
|
setPositionAndCell
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
fraction01,
|
||||||
|
rnd,
|
||||||
|
position,
|
||||||
|
cellOwner,
|
||||||
|
tetFacei,
|
||||||
|
tetPti
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::label Foam::patchInjectionBase::whichProc(const scalar fraction01) const
|
||||||
|
{
|
||||||
|
const scalar areaFraction = fraction01*patchArea_;
|
||||||
|
|
||||||
|
// Determine which processor to inject from
|
||||||
|
forAllReverse(sumTriMagSf_, i)
|
||||||
|
{
|
||||||
|
if (areaFraction >= sumTriMagSf_[i])
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -116,6 +116,19 @@ public:
|
|||||||
//- Update patch geometry and derived info for injection locations
|
//- Update patch geometry and derived info for injection locations
|
||||||
virtual void updateMesh(const polyMesh& mesh);
|
virtual void updateMesh(const polyMesh& mesh);
|
||||||
|
|
||||||
|
//- Set the injection position and owner cell, tetFace and tetPt
|
||||||
|
// Supply the fraction used to determine the location on the patch
|
||||||
|
void setPositionAndCell
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const scalar fraction01,
|
||||||
|
Random& rnd,
|
||||||
|
vector& position,
|
||||||
|
label& cellOwner,
|
||||||
|
label& tetFacei,
|
||||||
|
label& tetPti
|
||||||
|
);
|
||||||
|
|
||||||
//- Set the injection position and owner cell, tetFace and tetPt
|
//- Set the injection position and owner cell, tetFace and tetPt
|
||||||
virtual void setPositionAndCell
|
virtual void setPositionAndCell
|
||||||
(
|
(
|
||||||
@ -126,6 +139,9 @@ public:
|
|||||||
label& tetFacei,
|
label& tetFacei,
|
||||||
label& tetPti
|
label& tetPti
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Return the processor that has the location specified by the fraction
|
||||||
|
label whichProc(const scalar fraction01) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -176,4 +176,25 @@ bool Foam::MultiInteraction<CloudType>::correct
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::MultiInteraction<CloudType>::postEvolve()
|
||||||
|
{
|
||||||
|
for (auto& m : models_)
|
||||||
|
{
|
||||||
|
m.postEvolve();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::MultiInteraction<CloudType>::info(Ostream& os)
|
||||||
|
{
|
||||||
|
for (auto& m : models_)
|
||||||
|
{
|
||||||
|
Info<< "Patch interaction model " << m.type() << ':' << endl;
|
||||||
|
m.info(os);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -148,6 +148,12 @@ public:
|
|||||||
const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
bool& keepParticle
|
bool& keepParticle
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Post-evolve hook
|
||||||
|
virtual void postEvolve();
|
||||||
|
|
||||||
|
//- Write patch interaction info to stream
|
||||||
|
virtual void info(Ostream& os);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -198,6 +198,11 @@ void Foam::PatchInteractionModel<CloudType>::addToEscapedParcels
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::PatchInteractionModel<CloudType>::postEvolve()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
void Foam::PatchInteractionModel<CloudType>::info(Ostream& os)
|
void Foam::PatchInteractionModel<CloudType>::info(Ostream& os)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -181,8 +181,10 @@ public:
|
|||||||
) = 0;
|
) = 0;
|
||||||
|
|
||||||
//- Add to escaped parcels
|
//- Add to escaped parcels
|
||||||
void addToEscapedParcels(const scalar mass);
|
virtual void addToEscapedParcels(const scalar mass);
|
||||||
|
|
||||||
|
//- Post-evolve hook
|
||||||
|
virtual void postEvolve();
|
||||||
|
|
||||||
//- Write patch interaction info to stream
|
//- Write patch interaction info to stream
|
||||||
virtual void info(Ostream& os);
|
virtual void info(Ostream& os);
|
||||||
|
|||||||
Reference in New Issue
Block a user