mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Update injector positions when mesh is updated
This commit is contained in:
@ -816,6 +816,13 @@ void Foam::KinematicCloud<CloudType>::patchData
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::KinematicCloud<CloudType>::updateMesh()
|
||||||
|
{
|
||||||
|
injectors_.updateMesh();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
void Foam::KinematicCloud<CloudType>::autoMap(const mapPolyMesh& mapper)
|
void Foam::KinematicCloud<CloudType>::autoMap(const mapPolyMesh& mapper)
|
||||||
{
|
{
|
||||||
@ -824,6 +831,8 @@ void Foam::KinematicCloud<CloudType>::autoMap(const mapPolyMesh& mapper)
|
|||||||
tdType td(*this);
|
tdType td(*this);
|
||||||
|
|
||||||
Cloud<parcelType>::template autoMap<tdType>(td, mapper);
|
Cloud<parcelType>::template autoMap<tdType>(td, mapper);
|
||||||
|
|
||||||
|
updateMesh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -566,8 +566,12 @@ public:
|
|||||||
vector& Up
|
vector& Up
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Mapping
|
// Mapping
|
||||||
|
|
||||||
|
//- Update mesh
|
||||||
|
void updateMesh();
|
||||||
|
|
||||||
//- Remap the cells of particles corresponding to the
|
//- Remap the cells of particles corresponding to the
|
||||||
// mesh topology change with a default tracking data object
|
// mesh topology change with a default tracking data object
|
||||||
virtual void autoMap(const mapPolyMesh&);
|
virtual void autoMap(const mapPolyMesh&);
|
||||||
|
|||||||
@ -345,6 +345,8 @@ void Foam::ReactingCloud<CloudType>::autoMap(const mapPolyMesh& mapper)
|
|||||||
tdType td(*this);
|
tdType td(*this);
|
||||||
|
|
||||||
Cloud<parcelType>::template autoMap<tdType>(td, mapper);
|
Cloud<parcelType>::template autoMap<tdType>(td, mapper);
|
||||||
|
|
||||||
|
this->updateMesh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -264,6 +264,8 @@ void Foam::ReactingMultiphaseCloud<CloudType>::autoMap
|
|||||||
tdType td(*this);
|
tdType td(*this);
|
||||||
|
|
||||||
Cloud<parcelType>::template autoMap<tdType>(td, mapper);
|
Cloud<parcelType>::template autoMap<tdType>(td, mapper);
|
||||||
|
|
||||||
|
this->updateMesh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -487,6 +487,8 @@ void Foam::ThermoCloud<CloudType>::autoMap(const mapPolyMesh& mapper)
|
|||||||
tdType td(*this);
|
tdType td(*this);
|
||||||
|
|
||||||
Cloud<parcelType>::template autoMap<tdType>(td, mapper);
|
Cloud<parcelType>::template autoMap<tdType>(td, mapper);
|
||||||
|
|
||||||
|
this->updateMesh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -185,60 +185,7 @@ Foam::CellZoneInjection<CloudType>::CellZoneInjection
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const fvMesh& mesh = owner.mesh();
|
updateMesh();
|
||||||
const label zoneI = mesh.cellZones().findZoneID(cellZoneName_);
|
|
||||||
|
|
||||||
if (zoneI < 0)
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"Foam::CellZoneInjection<CloudType>::CellZoneInjection"
|
|
||||||
"("
|
|
||||||
"const dictionary&, "
|
|
||||||
"CloudType&"
|
|
||||||
")"
|
|
||||||
) << "Unknown cell zone name: " << cellZoneName_
|
|
||||||
<< ". Valid cell zones are: " << mesh.cellZones().names()
|
|
||||||
<< nl << exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
const labelList& cellZoneCells = mesh.cellZones()[zoneI];
|
|
||||||
const label nCells = cellZoneCells.size();
|
|
||||||
const scalar nCellsTotal = returnReduce(nCells, sumOp<label>());
|
|
||||||
const scalar VCells = sum(scalarField(mesh.V(), cellZoneCells));
|
|
||||||
const scalar VCellsTotal = returnReduce(VCells, sumOp<scalar>());
|
|
||||||
Info<< " cell zone size = " << nCellsTotal << endl;
|
|
||||||
Info<< " cell zone volume = " << VCellsTotal << endl;
|
|
||||||
|
|
||||||
if ((nCells == 0) || (VCellsTotal*numberDensity_ < 1))
|
|
||||||
{
|
|
||||||
WarningIn
|
|
||||||
(
|
|
||||||
"Foam::CellZoneInjection<CloudType>::CellZoneInjection"
|
|
||||||
"("
|
|
||||||
"const dictionary&, "
|
|
||||||
"CloudType&"
|
|
||||||
")"
|
|
||||||
) << "Number of particles to be added to cellZone " << cellZoneName_
|
|
||||||
<< " is zero" << endl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setPositions(cellZoneCells);
|
|
||||||
|
|
||||||
Info<< " number density = " << numberDensity_ << nl
|
|
||||||
<< " number of particles = " << positions_.size() << endl;
|
|
||||||
|
|
||||||
// Construct parcel diameters
|
|
||||||
diameters_.setSize(positions_.size());
|
|
||||||
forAll(diameters_, i)
|
|
||||||
{
|
|
||||||
diameters_[i] = sizeDistribution_->sample();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine volume of particles to inject
|
|
||||||
this->volumeTotal_ = sum(pow3(diameters_))*constant::mathematical::pi/6.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -270,6 +217,55 @@ Foam::CellZoneInjection<CloudType>::~CellZoneInjection()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::CellZoneInjection<CloudType>::updateMesh()
|
||||||
|
{
|
||||||
|
// Set/cache the injector cells
|
||||||
|
const fvMesh& mesh = this->owner().mesh();
|
||||||
|
const label zoneI = mesh.cellZones().findZoneID(cellZoneName_);
|
||||||
|
|
||||||
|
if (zoneI < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn("Foam::CellZoneInjection<CloudType>::updateMesh()")
|
||||||
|
<< "Unknown cell zone name: " << cellZoneName_
|
||||||
|
<< ". Valid cell zones are: " << mesh.cellZones().names()
|
||||||
|
<< nl << exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const labelList& cellZoneCells = mesh.cellZones()[zoneI];
|
||||||
|
const label nCells = cellZoneCells.size();
|
||||||
|
const scalar nCellsTotal = returnReduce(nCells, sumOp<label>());
|
||||||
|
const scalar VCells = sum(scalarField(mesh.V(), cellZoneCells));
|
||||||
|
const scalar VCellsTotal = returnReduce(VCells, sumOp<scalar>());
|
||||||
|
Info<< " cell zone size = " << nCellsTotal << endl;
|
||||||
|
Info<< " cell zone volume = " << VCellsTotal << endl;
|
||||||
|
|
||||||
|
if ((nCells == 0) || (VCellsTotal*numberDensity_ < 1))
|
||||||
|
{
|
||||||
|
WarningIn("Foam::CellZoneInjection<CloudType>::updateMesh()")
|
||||||
|
<< "Number of particles to be added to cellZone " << cellZoneName_
|
||||||
|
<< " is zero" << endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setPositions(cellZoneCells);
|
||||||
|
|
||||||
|
Info<< " number density = " << numberDensity_ << nl
|
||||||
|
<< " number of particles = " << positions_.size() << endl;
|
||||||
|
|
||||||
|
// Construct parcel diameters
|
||||||
|
diameters_.setSize(positions_.size());
|
||||||
|
forAll(diameters_, i)
|
||||||
|
{
|
||||||
|
diameters_[i] = sizeDistribution_->sample();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine volume of particles to inject
|
||||||
|
this->volumeTotal_ = sum(pow3(diameters_))*constant::mathematical::pi/6.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::scalar Foam::CellZoneInjection<CloudType>::timeEnd() const
|
Foam::scalar Foam::CellZoneInjection<CloudType>::timeEnd() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -130,6 +130,9 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Set injector locations when mesh is updated
|
||||||
|
virtual void updateMesh();
|
||||||
|
|
||||||
//- Return the end-of-injection time
|
//- Return the end-of-injection time
|
||||||
scalar timeEnd() const;
|
scalar timeEnd() const;
|
||||||
|
|
||||||
|
|||||||
@ -126,17 +126,7 @@ Foam::ConeInjection<CloudType>::ConeInjection
|
|||||||
// Set total volume to inject
|
// Set total volume to inject
|
||||||
this->volumeTotal_ = flowRateProfile_.integrate(0.0, duration_);
|
this->volumeTotal_ = flowRateProfile_.integrate(0.0, duration_);
|
||||||
|
|
||||||
// Set/cache the injector cells
|
updateMesh();
|
||||||
forAll(positionAxis_, i)
|
|
||||||
{
|
|
||||||
this->findCellAtPosition
|
|
||||||
(
|
|
||||||
injectorCells_[i],
|
|
||||||
injectorTetFaces_[i],
|
|
||||||
injectorTetPts_[i],
|
|
||||||
positionAxis_[i].first()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -173,6 +163,23 @@ Foam::ConeInjection<CloudType>::~ConeInjection()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::ConeInjection<CloudType>::updateMesh()
|
||||||
|
{
|
||||||
|
// Set/cache the injector cells
|
||||||
|
forAll(positionAxis_, i)
|
||||||
|
{
|
||||||
|
this->findCellAtPosition
|
||||||
|
(
|
||||||
|
injectorCells_[i],
|
||||||
|
injectorTetFaces_[i],
|
||||||
|
injectorTetPts_[i],
|
||||||
|
positionAxis_[i].first()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::scalar Foam::ConeInjection<CloudType>::timeEnd() const
|
Foam::scalar Foam::ConeInjection<CloudType>::timeEnd() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -144,6 +144,9 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Set injector locations when mesh is updated
|
||||||
|
virtual void updateMesh();
|
||||||
|
|
||||||
//- Return the end-of-injection time
|
//- Return the end-of-injection time
|
||||||
scalar timeEnd() const;
|
scalar timeEnd() const;
|
||||||
|
|
||||||
|
|||||||
@ -201,6 +201,8 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
|
|||||||
|
|
||||||
// Set total volume to inject
|
// Set total volume to inject
|
||||||
this->volumeTotal_ = flowRateProfile_.integrate(0.0, duration_);
|
this->volumeTotal_ = flowRateProfile_.integrate(0.0, duration_);
|
||||||
|
|
||||||
|
updateMesh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -244,6 +246,30 @@ Foam::ConeNozzleInjection<CloudType>::~ConeNozzleInjection()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::ConeNozzleInjection<CloudType>::updateMesh()
|
||||||
|
{
|
||||||
|
// Set/cache the injector cells
|
||||||
|
switch (injectionMethod_)
|
||||||
|
{
|
||||||
|
case imPoint:
|
||||||
|
{
|
||||||
|
this->findCellAtPosition
|
||||||
|
(
|
||||||
|
injectorCell_,
|
||||||
|
tetFaceI_,
|
||||||
|
tetPtI_,
|
||||||
|
position_
|
||||||
|
);
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::scalar Foam::ConeNozzleInjection<CloudType>::timeEnd() const
|
Foam::scalar Foam::ConeNozzleInjection<CloudType>::timeEnd() const
|
||||||
{
|
{
|
||||||
@ -342,6 +368,7 @@ void Foam::ConeNozzleInjection<CloudType>::setPositionAndCell
|
|||||||
"const label, "
|
"const label, "
|
||||||
"const scalar, "
|
"const scalar, "
|
||||||
"vector&, "
|
"vector&, "
|
||||||
|
"label&, "
|
||||||
"label&"
|
"label&"
|
||||||
")"
|
")"
|
||||||
)<< "Unknown injectionMethod type" << nl
|
)<< "Unknown injectionMethod type" << nl
|
||||||
|
|||||||
@ -212,6 +212,9 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Set injector locations when mesh is updated
|
||||||
|
virtual void updateMesh();
|
||||||
|
|
||||||
//- Return the end-of-injection time
|
//- Return the end-of-injection time
|
||||||
scalar timeEnd() const;
|
scalar timeEnd() const;
|
||||||
|
|
||||||
|
|||||||
@ -96,17 +96,7 @@ Foam::FieldActivatedInjection<CloudType>::FieldActivatedInjection
|
|||||||
this->volumeTotal_ =
|
this->volumeTotal_ =
|
||||||
nParcelsPerInjector_*sum(pow3(diameters_))*pi/6.0;
|
nParcelsPerInjector_*sum(pow3(diameters_))*pi/6.0;
|
||||||
|
|
||||||
// Set/cache the injector cells
|
updateMesh();
|
||||||
forAll(positions_, i)
|
|
||||||
{
|
|
||||||
this->findCellAtPosition
|
|
||||||
(
|
|
||||||
injectorCells_[i],
|
|
||||||
injectorTetFaces_[i],
|
|
||||||
injectorTetPts_[i],
|
|
||||||
positions_[i]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -142,6 +132,23 @@ Foam::FieldActivatedInjection<CloudType>::~FieldActivatedInjection()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::FieldActivatedInjection<CloudType>::updateMesh()
|
||||||
|
{
|
||||||
|
// Set/cache the injector cells
|
||||||
|
forAll(positions_, i)
|
||||||
|
{
|
||||||
|
this->findCellAtPosition
|
||||||
|
(
|
||||||
|
injectorCells_[i],
|
||||||
|
injectorTetFaces_[i],
|
||||||
|
injectorTetPts_[i],
|
||||||
|
positions_[i]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::scalar Foam::FieldActivatedInjection<CloudType>::timeEnd() const
|
Foam::scalar Foam::FieldActivatedInjection<CloudType>::timeEnd() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -150,6 +150,9 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Set injector locations when mesh is updated
|
||||||
|
virtual void updateMesh();
|
||||||
|
|
||||||
//- Return the end-of-injection time
|
//- Return the end-of-injection time
|
||||||
scalar timeEnd() const;
|
scalar timeEnd() const;
|
||||||
|
|
||||||
|
|||||||
@ -153,6 +153,13 @@ Foam::InflationInjection<CloudType>::~InflationInjection()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::InflationInjection<CloudType>::updateMesh()
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::scalar Foam::InflationInjection<CloudType>::timeEnd() const
|
Foam::scalar Foam::InflationInjection<CloudType>::timeEnd() const
|
||||||
{
|
{
|
||||||
@ -234,8 +241,8 @@ Foam::label Foam::InflationInjection<CloudType>::parcelsToInject
|
|||||||
"Foam::label "
|
"Foam::label "
|
||||||
"Foam::InflationInjection<CloudType>::parcelsToInject"
|
"Foam::InflationInjection<CloudType>::parcelsToInject"
|
||||||
"("
|
"("
|
||||||
"const scalar time0, "
|
"const scalar, "
|
||||||
"const scalar time1"
|
"const scalar"
|
||||||
")"
|
")"
|
||||||
)
|
)
|
||||||
<< "Maximum particle split iterations ("
|
<< "Maximum particle split iterations ("
|
||||||
|
|||||||
@ -146,6 +146,9 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Set injector locations when mesh is updated
|
||||||
|
virtual void updateMesh();
|
||||||
|
|
||||||
//- Return the end-of-injection time
|
//- Return the end-of-injection time
|
||||||
scalar timeEnd() const;
|
scalar timeEnd() const;
|
||||||
|
|
||||||
|
|||||||
@ -407,6 +407,13 @@ Foam::InjectionModel<CloudType>::~InjectionModel()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::InjectionModel<CloudType>::updateMesh()
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::scalar Foam::InjectionModel<CloudType>::timeEnd() const
|
Foam::scalar Foam::InjectionModel<CloudType>::timeEnd() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -250,6 +250,12 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
// Mapping
|
||||||
|
|
||||||
|
//- Update mesh
|
||||||
|
virtual void updateMesh();
|
||||||
|
|
||||||
|
|
||||||
// Global information
|
// Global information
|
||||||
|
|
||||||
//- Return the start-of-injection time
|
//- Return the start-of-injection time
|
||||||
|
|||||||
@ -168,6 +168,16 @@ Foam::scalar Foam::InjectionModelList<CloudType>::averageParcelMass()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::InjectionModelList<CloudType>::updateMesh()
|
||||||
|
{
|
||||||
|
forAll(*this, i)
|
||||||
|
{
|
||||||
|
this->operator[](i).updateMesh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
template<class TrackData>
|
template<class TrackData>
|
||||||
void Foam::InjectionModelList<CloudType>::inject(TrackData& td)
|
void Foam::InjectionModelList<CloudType>::inject(TrackData& td)
|
||||||
|
|||||||
@ -97,6 +97,12 @@ public:
|
|||||||
scalar averageParcelMass();
|
scalar averageParcelMass();
|
||||||
|
|
||||||
|
|
||||||
|
// Edit
|
||||||
|
|
||||||
|
//- Set injector locations when mesh is updated
|
||||||
|
void updateMesh();
|
||||||
|
|
||||||
|
|
||||||
// Per-injection event functions
|
// Per-injection event functions
|
||||||
|
|
||||||
//- Main injection loop
|
//- Main injection loop
|
||||||
|
|||||||
@ -65,16 +65,7 @@ Foam::KinematicLookupTableInjection<CloudType>::KinematicLookupTableInjection
|
|||||||
injectorTetFaces_.setSize(injectors_.size());
|
injectorTetFaces_.setSize(injectors_.size());
|
||||||
injectorTetPts_.setSize(injectors_.size());
|
injectorTetPts_.setSize(injectors_.size());
|
||||||
|
|
||||||
forAll(injectors_, i)
|
updateMesh();
|
||||||
{
|
|
||||||
this->findCellAtPosition
|
|
||||||
(
|
|
||||||
injectorCells_[i],
|
|
||||||
injectorTetFaces_[i],
|
|
||||||
injectorTetPts_[i],
|
|
||||||
injectors_[i].x()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine volume of particles to inject
|
// Determine volume of particles to inject
|
||||||
this->volumeTotal_ = 0.0;
|
this->volumeTotal_ = 0.0;
|
||||||
@ -112,6 +103,23 @@ Foam::KinematicLookupTableInjection<CloudType>::~KinematicLookupTableInjection()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::KinematicLookupTableInjection<CloudType>::updateMesh()
|
||||||
|
{
|
||||||
|
// Set/cache the injector cells
|
||||||
|
forAll(injectors_, i)
|
||||||
|
{
|
||||||
|
this->findCellAtPosition
|
||||||
|
(
|
||||||
|
injectorCells_[i],
|
||||||
|
injectorTetFaces_[i],
|
||||||
|
injectorTetPts_[i],
|
||||||
|
injectors_[i].x()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::scalar Foam::KinematicLookupTableInjection<CloudType>::timeEnd() const
|
Foam::scalar Foam::KinematicLookupTableInjection<CloudType>::timeEnd() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -129,6 +129,9 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Set injector locations when mesh is updated
|
||||||
|
virtual void updateMesh();
|
||||||
|
|
||||||
//- Return the end-of-injection time
|
//- Return the end-of-injection time
|
||||||
scalar timeEnd() const;
|
scalar timeEnd() const;
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,6 @@ License
|
|||||||
#include "ManualInjection.H"
|
#include "ManualInjection.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "mathematicalConstants.H"
|
||||||
#include "PackedBoolList.H"
|
#include "PackedBoolList.H"
|
||||||
#include "Switch.H"
|
|
||||||
|
|
||||||
using namespace Foam::constant::mathematical;
|
using namespace Foam::constant::mathematical;
|
||||||
|
|
||||||
@ -65,48 +64,13 @@ Foam::ManualInjection<CloudType>::ManualInjection
|
|||||||
this->coeffDict().subDict("sizeDistribution"),
|
this->coeffDict().subDict("sizeDistribution"),
|
||||||
owner.rndGen()
|
owner.rndGen()
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
{
|
ignoreOutOfBounds_
|
||||||
Switch ignoreOutOfBounds
|
|
||||||
(
|
(
|
||||||
this->coeffDict().lookupOrDefault("ignoreOutOfBounds", false)
|
this->coeffDict().lookupOrDefault("ignoreOutOfBounds", false)
|
||||||
);
|
)
|
||||||
|
{
|
||||||
label nRejected = 0;
|
updateMesh();
|
||||||
|
|
||||||
PackedBoolList keep(positions_.size(), true);
|
|
||||||
|
|
||||||
forAll(positions_, pI)
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
|
||||||
!this->findCellAtPosition
|
|
||||||
(
|
|
||||||
injectorCells_[pI],
|
|
||||||
injectorTetFaces_[pI],
|
|
||||||
injectorTetPts_[pI],
|
|
||||||
positions_[pI],
|
|
||||||
!ignoreOutOfBounds
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
keep[pI] = false;
|
|
||||||
|
|
||||||
nRejected++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nRejected > 0)
|
|
||||||
{
|
|
||||||
inplaceSubset(keep, positions_);
|
|
||||||
inplaceSubset(keep, diameters_);
|
|
||||||
inplaceSubset(keep, injectorCells_);
|
|
||||||
inplaceSubset(keep, injectorTetFaces_);
|
|
||||||
inplaceSubset(keep, injectorTetPts_);
|
|
||||||
|
|
||||||
Info<< " " << nRejected
|
|
||||||
<< " particles ignored, out of bounds." << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Construct parcel diameters
|
// Construct parcel diameters
|
||||||
forAll(diameters_, i)
|
forAll(diameters_, i)
|
||||||
@ -133,7 +97,8 @@ Foam::ManualInjection<CloudType>::ManualInjection
|
|||||||
injectorTetFaces_(im.injectorTetFaces_),
|
injectorTetFaces_(im.injectorTetFaces_),
|
||||||
injectorTetPts_(im.injectorTetPts_),
|
injectorTetPts_(im.injectorTetPts_),
|
||||||
U0_(im.U0_),
|
U0_(im.U0_),
|
||||||
sizeDistribution_(im.sizeDistribution_().clone().ptr())
|
sizeDistribution_(im.sizeDistribution_().clone().ptr()),
|
||||||
|
ignoreOutOfBounds_(im.ignoreOutOfBounds_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -146,6 +111,46 @@ Foam::ManualInjection<CloudType>::~ManualInjection()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::ManualInjection<CloudType>::updateMesh()
|
||||||
|
{
|
||||||
|
label nRejected = 0;
|
||||||
|
|
||||||
|
PackedBoolList keep(positions_.size(), true);
|
||||||
|
|
||||||
|
forAll(positions_, pI)
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
!this->findCellAtPosition
|
||||||
|
(
|
||||||
|
injectorCells_[pI],
|
||||||
|
injectorTetFaces_[pI],
|
||||||
|
injectorTetPts_[pI],
|
||||||
|
positions_[pI],
|
||||||
|
!ignoreOutOfBounds_
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
keep[pI] = false;
|
||||||
|
nRejected++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nRejected > 0)
|
||||||
|
{
|
||||||
|
inplaceSubset(keep, positions_);
|
||||||
|
inplaceSubset(keep, diameters_);
|
||||||
|
inplaceSubset(keep, injectorCells_);
|
||||||
|
inplaceSubset(keep, injectorTetFaces_);
|
||||||
|
inplaceSubset(keep, injectorTetPts_);
|
||||||
|
|
||||||
|
Info<< " " << nRejected
|
||||||
|
<< " particles ignored, out of bounds" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::scalar Foam::ManualInjection<CloudType>::timeEnd() const
|
Foam::scalar Foam::ManualInjection<CloudType>::timeEnd() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -43,6 +43,7 @@ SourceFiles
|
|||||||
|
|
||||||
#include "InjectionModel.H"
|
#include "InjectionModel.H"
|
||||||
#include "distributionModel.H"
|
#include "distributionModel.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -50,7 +51,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class ManualInjection Declaration
|
Class ManualInjection Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
@ -84,6 +85,9 @@ class ManualInjection
|
|||||||
//- Parcel size distribution model
|
//- Parcel size distribution model
|
||||||
const autoPtr<distributionModels::distributionModel> sizeDistribution_;
|
const autoPtr<distributionModels::distributionModel> sizeDistribution_;
|
||||||
|
|
||||||
|
//- Flag to suppress errors if particle injection site is out-of-bounds
|
||||||
|
Switch ignoreOutOfBounds_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -120,6 +124,9 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Set injector locations when mesh is updated
|
||||||
|
virtual void updateMesh();
|
||||||
|
|
||||||
//- Return the end-of-injection time
|
//- Return the end-of-injection time
|
||||||
scalar timeEnd() const;
|
scalar timeEnd() const;
|
||||||
|
|
||||||
|
|||||||
@ -82,7 +82,7 @@ Foam::PatchFlowRateInjection<CloudType>::PatchFlowRateInjection
|
|||||||
|
|
||||||
duration_ = owner.db().time().userTimeToTime(duration_);
|
duration_ = owner.db().time().userTimeToTime(duration_);
|
||||||
|
|
||||||
cellOwners_ = patch.faceCells();
|
updateMesh();
|
||||||
|
|
||||||
// TODO: retrieve mean diameter from distrution model
|
// TODO: retrieve mean diameter from distrution model
|
||||||
scalar pMeanDiameter =
|
scalar pMeanDiameter =
|
||||||
@ -139,6 +139,15 @@ Foam::PatchFlowRateInjection<CloudType>::~PatchFlowRateInjection()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::PatchFlowRateInjection<CloudType>::updateMesh()
|
||||||
|
{
|
||||||
|
// Set/cache the injector cells
|
||||||
|
const polyPatch& patch = this->owner().mesh().boundaryMesh()[patchId_];
|
||||||
|
cellOwners_ = patch.faceCells();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::scalar Foam::PatchFlowRateInjection<CloudType>::timeEnd() const
|
Foam::scalar Foam::PatchFlowRateInjection<CloudType>::timeEnd() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -146,6 +146,9 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Set injector locations when mesh is updated
|
||||||
|
virtual void updateMesh();
|
||||||
|
|
||||||
//- Return the end-of-injection time
|
//- Return the end-of-injection time
|
||||||
scalar timeEnd() const;
|
scalar timeEnd() const;
|
||||||
|
|
||||||
|
|||||||
@ -80,11 +80,9 @@ Foam::PatchInjection<CloudType>::PatchInjection
|
|||||||
<< nl << exit(FatalError);
|
<< nl << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
const polyPatch& patch = owner.mesh().boundaryMesh()[patchId_];
|
|
||||||
|
|
||||||
duration_ = owner.db().time().userTimeToTime(duration_);
|
duration_ = owner.db().time().userTimeToTime(duration_);
|
||||||
|
|
||||||
cellOwners_ = patch.faceCells();
|
updateMesh();
|
||||||
|
|
||||||
label patchSize = cellOwners_.size();
|
label patchSize = cellOwners_.size();
|
||||||
label totalPatchSize = patchSize;
|
label totalPatchSize = patchSize;
|
||||||
@ -125,6 +123,15 @@ Foam::PatchInjection<CloudType>::~PatchInjection()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::PatchInjection<CloudType>::updateMesh()
|
||||||
|
{
|
||||||
|
// Set/cache the injector cells
|
||||||
|
const polyPatch& patch = this->owner().mesh().boundaryMesh()[patchId_];
|
||||||
|
cellOwners_ = patch.faceCells();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::scalar Foam::PatchInjection<CloudType>::timeEnd() const
|
Foam::scalar Foam::PatchInjection<CloudType>::timeEnd() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -129,6 +129,9 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Set injector locations when mesh is updated
|
||||||
|
virtual void updateMesh();
|
||||||
|
|
||||||
//- Return the end-of-injection time
|
//- Return the end-of-injection time
|
||||||
scalar timeEnd() const;
|
scalar timeEnd() const;
|
||||||
|
|
||||||
|
|||||||
@ -64,16 +64,7 @@ Foam::ReactingLookupTableInjection<CloudType>::ReactingLookupTableInjection
|
|||||||
injectorTetFaces_.setSize(injectors_.size());
|
injectorTetFaces_.setSize(injectors_.size());
|
||||||
injectorTetPts_.setSize(injectors_.size());
|
injectorTetPts_.setSize(injectors_.size());
|
||||||
|
|
||||||
forAll(injectors_, i)
|
updateMesh();
|
||||||
{
|
|
||||||
this->findCellAtPosition
|
|
||||||
(
|
|
||||||
injectorCells_[i],
|
|
||||||
injectorTetFaces_[i],
|
|
||||||
injectorTetPts_[i],
|
|
||||||
injectors_[i].x()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine volume of particles to inject
|
// Determine volume of particles to inject
|
||||||
this->volumeTotal_ = 0.0;
|
this->volumeTotal_ = 0.0;
|
||||||
@ -111,6 +102,23 @@ Foam::ReactingLookupTableInjection<CloudType>::~ReactingLookupTableInjection()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::ReactingLookupTableInjection<CloudType>::updateMesh()
|
||||||
|
{
|
||||||
|
// Set/cache the injector cells
|
||||||
|
forAll(injectors_, i)
|
||||||
|
{
|
||||||
|
this->findCellAtPosition
|
||||||
|
(
|
||||||
|
injectorCells_[i],
|
||||||
|
injectorTetFaces_[i],
|
||||||
|
injectorTetPts_[i],
|
||||||
|
injectors_[i].x()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::scalar Foam::ReactingLookupTableInjection<CloudType>::timeEnd() const
|
Foam::scalar Foam::ReactingLookupTableInjection<CloudType>::timeEnd() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -132,6 +132,9 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Set injector locations when mesh is updated
|
||||||
|
virtual void updateMesh();
|
||||||
|
|
||||||
//- Return the end-of-injection time
|
//- Return the end-of-injection time
|
||||||
scalar timeEnd() const;
|
scalar timeEnd() const;
|
||||||
|
|
||||||
|
|||||||
@ -65,16 +65,7 @@ ReactingMultiphaseLookupTableInjection
|
|||||||
injectorTetFaces_.setSize(injectors_.size());
|
injectorTetFaces_.setSize(injectors_.size());
|
||||||
injectorTetPts_.setSize(injectors_.size());
|
injectorTetPts_.setSize(injectors_.size());
|
||||||
|
|
||||||
forAll(injectors_, i)
|
updateMesh();
|
||||||
{
|
|
||||||
this->findCellAtPosition
|
|
||||||
(
|
|
||||||
injectorCells_[i],
|
|
||||||
injectorTetFaces_[i],
|
|
||||||
injectorTetPts_[i],
|
|
||||||
injectors_[i].x()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine volume of particles to inject
|
// Determine volume of particles to inject
|
||||||
this->volumeTotal_ = 0.0;
|
this->volumeTotal_ = 0.0;
|
||||||
@ -114,6 +105,23 @@ Foam::ReactingMultiphaseLookupTableInjection<CloudType>::
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::ReactingMultiphaseLookupTableInjection<CloudType>::updateMesh()
|
||||||
|
{
|
||||||
|
// Set/cache the injector cells
|
||||||
|
forAll(injectors_, i)
|
||||||
|
{
|
||||||
|
this->findCellAtPosition
|
||||||
|
(
|
||||||
|
injectorCells_[i],
|
||||||
|
injectorTetFaces_[i],
|
||||||
|
injectorTetPts_[i],
|
||||||
|
injectors_[i].x()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::scalar
|
Foam::scalar
|
||||||
Foam::ReactingMultiphaseLookupTableInjection<CloudType>::timeEnd() const
|
Foam::ReactingMultiphaseLookupTableInjection<CloudType>::timeEnd() const
|
||||||
|
|||||||
@ -135,6 +135,9 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Set injector locations when mesh is updated
|
||||||
|
virtual void updateMesh();
|
||||||
|
|
||||||
//- Return the end-of-injection time
|
//- Return the end-of-injection time
|
||||||
scalar timeEnd() const;
|
scalar timeEnd() const;
|
||||||
|
|
||||||
|
|||||||
@ -65,16 +65,7 @@ Foam::ThermoLookupTableInjection<CloudType>::ThermoLookupTableInjection
|
|||||||
injectorTetFaces_.setSize(injectors_.size());
|
injectorTetFaces_.setSize(injectors_.size());
|
||||||
injectorTetPts_.setSize(injectors_.size());
|
injectorTetPts_.setSize(injectors_.size());
|
||||||
|
|
||||||
forAll(injectors_, i)
|
updateMesh();
|
||||||
{
|
|
||||||
this->findCellAtPosition
|
|
||||||
(
|
|
||||||
injectorCells_[i],
|
|
||||||
injectorTetFaces_[i],
|
|
||||||
injectorTetPts_[i],
|
|
||||||
injectors_[i].x()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine volume of particles to inject
|
// Determine volume of particles to inject
|
||||||
this->volumeTotal_ = 0.0;
|
this->volumeTotal_ = 0.0;
|
||||||
@ -112,6 +103,23 @@ Foam::ThermoLookupTableInjection<CloudType>::~ThermoLookupTableInjection()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class CloudType>
|
||||||
|
void Foam::ThermoLookupTableInjection<CloudType>::updateMesh()
|
||||||
|
{
|
||||||
|
// Set/cache the injector cells
|
||||||
|
forAll(injectors_, i)
|
||||||
|
{
|
||||||
|
this->findCellAtPosition
|
||||||
|
(
|
||||||
|
injectorCells_[i],
|
||||||
|
injectorTetFaces_[i],
|
||||||
|
injectorTetPts_[i],
|
||||||
|
injectors_[i].x()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
Foam::scalar Foam::ThermoLookupTableInjection<CloudType>::timeEnd() const
|
Foam::scalar Foam::ThermoLookupTableInjection<CloudType>::timeEnd() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -132,6 +132,9 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Set injector locations when mesh is updated
|
||||||
|
virtual void updateMesh();
|
||||||
|
|
||||||
//- Return the end-of-injection time
|
//- Return the end-of-injection time
|
||||||
scalar timeEnd() const;
|
scalar timeEnd() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user