Commit fc1bc5c5 authored by andy's avatar andy
Browse files

ENH: Update injector positions when mesh is updated

parent 362d2fda
......@@ -816,6 +816,13 @@ void Foam::KinematicCloud<CloudType>::patchData
}
template<class CloudType>
void Foam::KinematicCloud<CloudType>::updateMesh()
{
injectors_.updateMesh();
}
template<class CloudType>
void Foam::KinematicCloud<CloudType>::autoMap(const mapPolyMesh& mapper)
{
......@@ -824,6 +831,8 @@ void Foam::KinematicCloud<CloudType>::autoMap(const mapPolyMesh& mapper)
tdType td(*this);
Cloud<parcelType>::template autoMap<tdType>(td, mapper);
updateMesh();
}
......
......@@ -566,8 +566,12 @@ public:
vector& Up
) const;
// Mapping
//- Update mesh
void updateMesh();
//- Remap the cells of particles corresponding to the
// mesh topology change with a default tracking data object
virtual void autoMap(const mapPolyMesh&);
......
......@@ -345,6 +345,8 @@ void Foam::ReactingCloud<CloudType>::autoMap(const mapPolyMesh& mapper)
tdType td(*this);
Cloud<parcelType>::template autoMap<tdType>(td, mapper);
this->updateMesh();
}
......
......@@ -264,6 +264,8 @@ void Foam::ReactingMultiphaseCloud<CloudType>::autoMap
tdType td(*this);
Cloud<parcelType>::template autoMap<tdType>(td, mapper);
this->updateMesh();
}
......
......@@ -487,6 +487,8 @@ void Foam::ThermoCloud<CloudType>::autoMap(const mapPolyMesh& mapper)
tdType td(*this);
Cloud<parcelType>::template autoMap<tdType>(td, mapper);
this->updateMesh();
}
......
......@@ -185,19 +185,49 @@ Foam::CellZoneInjection<CloudType>::CellZoneInjection
)
)
{
const fvMesh& mesh = owner.mesh();
updateMesh();
}
template<class CloudType>
Foam::CellZoneInjection<CloudType>::CellZoneInjection
(
const CellZoneInjection<CloudType>& im
)
:
InjectionModel<CloudType>(im),
cellZoneName_(im.cellZoneName_),
numberDensity_(im.numberDensity_),
positions_(im.positions_),
injectorCells_(im.injectorCells_),
injectorTetFaces_(im.injectorTetFaces_),
injectorTetPts_(im.injectorTetPts_),
diameters_(im.diameters_),
U0_(im.U0_),
sizeDistribution_(im.sizeDistribution_().clone().ptr())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::CellZoneInjection<CloudType>::~CellZoneInjection()
{}
// * * * * * * * * * * * * * * * 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>::CellZoneInjection"
"("
"const dictionary&, "
"CloudType&"
")"
) << "Unknown cell zone name: " << cellZoneName_
FatalErrorIn("Foam::CellZoneInjection<CloudType>::updateMesh()")
<< "Unknown cell zone name: " << cellZoneName_
<< ". Valid cell zones are: " << mesh.cellZones().names()
<< nl << exit(FatalError);
}
......@@ -212,14 +242,8 @@ Foam::CellZoneInjection<CloudType>::CellZoneInjection
if ((nCells == 0) || (VCellsTotal*numberDensity_ < 1))
{
WarningIn
(
"Foam::CellZoneInjection<CloudType>::CellZoneInjection"
"("
"const dictionary&, "
"CloudType&"
")"
) << "Number of particles to be added to cellZone " << cellZoneName_
WarningIn("Foam::CellZoneInjection<CloudType>::updateMesh()")
<< "Number of particles to be added to cellZone " << cellZoneName_
<< " is zero" << endl;
}
else
......@@ -242,34 +266,6 @@ Foam::CellZoneInjection<CloudType>::CellZoneInjection
}
template<class CloudType>
Foam::CellZoneInjection<CloudType>::CellZoneInjection
(
const CellZoneInjection<CloudType>& im
)
:
InjectionModel<CloudType>(im),
cellZoneName_(im.cellZoneName_),
numberDensity_(im.numberDensity_),
positions_(im.positions_),
injectorCells_(im.injectorCells_),
injectorTetFaces_(im.injectorTetFaces_),
injectorTetPts_(im.injectorTetPts_),
diameters_(im.diameters_),
U0_(im.U0_),
sizeDistribution_(im.sizeDistribution_().clone().ptr())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::CellZoneInjection<CloudType>::~CellZoneInjection()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
Foam::scalar Foam::CellZoneInjection<CloudType>::timeEnd() const
{
......
......@@ -130,6 +130,9 @@ public:
// Member Functions
//- Set injector locations when mesh is updated
virtual void updateMesh();
//- Return the end-of-injection time
scalar timeEnd() const;
......
......@@ -126,17 +126,7 @@ Foam::ConeInjection<CloudType>::ConeInjection
// Set total volume to inject
this->volumeTotal_ = flowRateProfile_.integrate(0.0, duration_);
// Set/cache the injector cells
forAll(positionAxis_, i)
{
this->findCellAtPosition
(
injectorCells_[i],
injectorTetFaces_[i],
injectorTetPts_[i],
positionAxis_[i].first()
);
}
updateMesh();
}
......@@ -173,6 +163,23 @@ Foam::ConeInjection<CloudType>::~ConeInjection()
// * * * * * * * * * * * * * * * 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>
Foam::scalar Foam::ConeInjection<CloudType>::timeEnd() const
{
......
......@@ -144,6 +144,9 @@ public:
// Member Functions
//- Set injector locations when mesh is updated
virtual void updateMesh();
//- Return the end-of-injection time
scalar timeEnd() const;
......
......@@ -201,6 +201,8 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
// Set total volume to inject
this->volumeTotal_ = flowRateProfile_.integrate(0.0, duration_);
updateMesh();
}
......@@ -244,6 +246,30 @@ Foam::ConeNozzleInjection<CloudType>::~ConeNozzleInjection()
// * * * * * * * * * * * * * * * 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>
Foam::scalar Foam::ConeNozzleInjection<CloudType>::timeEnd() const
{
......@@ -342,6 +368,7 @@ void Foam::ConeNozzleInjection<CloudType>::setPositionAndCell
"const label, "
"const scalar, "
"vector&, "
"label&, "
"label&"
")"
)<< "Unknown injectionMethod type" << nl
......
......@@ -212,6 +212,9 @@ public:
// Member Functions
//- Set injector locations when mesh is updated
virtual void updateMesh();
//- Return the end-of-injection time
scalar timeEnd() const;
......
......@@ -96,17 +96,7 @@ Foam::FieldActivatedInjection<CloudType>::FieldActivatedInjection
this->volumeTotal_ =
nParcelsPerInjector_*sum(pow3(diameters_))*pi/6.0;
// Set/cache the injector cells
forAll(positions_, i)
{
this->findCellAtPosition
(
injectorCells_[i],
injectorTetFaces_[i],
injectorTetPts_[i],
positions_[i]
);
}
updateMesh();
}
......@@ -142,6 +132,23 @@ Foam::FieldActivatedInjection<CloudType>::~FieldActivatedInjection()
// * * * * * * * * * * * * * * * 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>
Foam::scalar Foam::FieldActivatedInjection<CloudType>::timeEnd() const
{
......
......@@ -150,6 +150,9 @@ public:
// Member Functions
//- Set injector locations when mesh is updated
virtual void updateMesh();
//- Return the end-of-injection time
scalar timeEnd() const;
......
......@@ -153,6 +153,13 @@ Foam::InflationInjection<CloudType>::~InflationInjection()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::InflationInjection<CloudType>::updateMesh()
{
// do nothing
}
template<class CloudType>
Foam::scalar Foam::InflationInjection<CloudType>::timeEnd() const
{
......@@ -234,8 +241,8 @@ Foam::label Foam::InflationInjection<CloudType>::parcelsToInject
"Foam::label "
"Foam::InflationInjection<CloudType>::parcelsToInject"
"("
"const scalar time0, "
"const scalar time1"
"const scalar, "
"const scalar"
")"
)
<< "Maximum particle split iterations ("
......
......@@ -146,6 +146,9 @@ public:
// Member Functions
//- Set injector locations when mesh is updated
virtual void updateMesh();
//- Return the end-of-injection time
scalar timeEnd() const;
......
......@@ -407,6 +407,13 @@ Foam::InjectionModel<CloudType>::~InjectionModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::InjectionModel<CloudType>::updateMesh()
{
// do nothing
}
template<class CloudType>
Foam::scalar Foam::InjectionModel<CloudType>::timeEnd() const
{
......
......@@ -250,6 +250,12 @@ public:
// Member Functions
// Mapping
//- Update mesh
virtual void updateMesh();
// Global information
//- 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 TrackData>
void Foam::InjectionModelList<CloudType>::inject(TrackData& td)
......
......@@ -97,6 +97,12 @@ public:
scalar averageParcelMass();
// Edit
//- Set injector locations when mesh is updated
void updateMesh();
// Per-injection event functions
//- Main injection loop
......
......@@ -65,16 +65,7 @@ Foam::KinematicLookupTableInjection<CloudType>::KinematicLookupTableInjection
injectorTetFaces_.setSize(injectors_.size());
injectorTetPts_.setSize(injectors_.size());
forAll(injectors_, i)
{
this->findCellAtPosition
(
injectorCells_[i],
injectorTetFaces_[i],
injectorTetPts_[i],
injectors_[i].x()
);
}
updateMesh();
// Determine volume of particles to inject
this->volumeTotal_ = 0.0;
......@@ -112,6 +103,23 @@ Foam::KinematicLookupTableInjection<CloudType>::~KinematicLookupTableInjection()
// * * * * * * * * * * * * * * * 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>
Foam::scalar Foam::KinematicLookupTableInjection<CloudType>::timeEnd() const
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment