BUGFIX: Mesh update in lagrangian

This commit is contained in:
Henrik Rusche 2018-08-19 16:49:25 +02:00
parent c001bc33b7
commit a9c7a176e3
21 changed files with 170 additions and 53 deletions

View file

@ -278,13 +278,9 @@ void Foam::KinematicCloud<CloudType>::updateMesh()
template<class CloudType> template<class CloudType>
void Foam::KinematicCloud<CloudType>::autoMap(const mapPolyMesh& mapper) void Foam::KinematicCloud<CloudType>::autoMap(const mapPolyMesh& mapper)
{ {
//typedef typename particle::TrackingData<KinematicCloud<CloudType>> tdType; Cloud<parcelType>::autoMap(mapper);
//tdType td(*this); this->updateMesh();
//Cloud<parcelType>::template autoMap<tdType>(td, mapper);
updateMesh();
} }

View file

@ -278,6 +278,15 @@ void Foam::ReactingCloud<ParcelType>::evolve()
} }
template<class CloudType>
void Foam::ReactingCloud<CloudType>::autoMap(const mapPolyMesh& mapper)
{
Cloud<parcelType>::autoMap(mapper);
this->updateMesh();
}
template<class ParcelType> template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::info() const void Foam::ReactingCloud<ParcelType>::info() const
{ {

View file

@ -239,6 +239,12 @@ public:
//- Evolve the spray (inject, move) //- Evolve the spray (inject, move)
void evolve(); void evolve();
// Mapping
//- Remap the cells of particles corresponding to the
// mesh topology change with a default tracking data object
virtual void autoMap(const mapPolyMesh&);
}; };

View file

@ -234,6 +234,18 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::evolve()
} }
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::autoMap
(
const mapPolyMesh& mapper
)
{
Cloud<parcelType>::autoMap(mapper);
this->updateMesh();
}
template<class ParcelType> template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::info() const void Foam::ReactingMultiphaseCloud<ParcelType>::info() const
{ {

View file

@ -202,7 +202,12 @@ public:
//- Evolve the spray (inject, move) //- Evolve the spray (inject, move)
void evolve(); void evolve();
};
// Mapping
//- Remap the cells of particles corresponding to the
// mesh topology change with a default tracking data object
virtual void autoMap(const mapPolyMesh&);};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -225,6 +225,15 @@ void Foam::ThermoCloud<ParcelType>::evolve()
} }
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::autoMap(const mapPolyMesh& mapper)
{
Cloud<parcelType>::autoMap(mapper);
this->updateMesh();
}
template<class ParcelType> template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::info() const void Foam::ThermoCloud<ParcelType>::info() const
{ {

View file

@ -227,6 +227,13 @@ public:
//- Evolve the spray (inject, move) //- Evolve the spray (inject, move)
void evolve(); void evolve();
// Mapping
//- Remap the cells of particles corresponding to the
// mesh topology change with a default tracking data object
virtual void autoMap(const mapPolyMesh&);
}; };

View file

@ -182,15 +182,7 @@ Foam::ConeInjectionMP<CloudType>::ConeInjectionMP
// Set total volume to inject // Set total volume to inject
this->volumeTotal_ = volumeFlowRate_().integrate(0.0, duration_); this->volumeTotal_ = volumeFlowRate_().integrate(0.0, duration_);
// Set/cache the injector cells this->updateMesh();
forAll(positions_, i)
{
this->findCellAtPosition
(
injectorCells_[i],
positions_[i]
);
}
} }
@ -210,6 +202,17 @@ bool Foam::ConeInjectionMP<CloudType>::active() const
} }
template<class CloudType>
void Foam::ConeInjectionMP<CloudType>::updateMesh()
{
// Set/cache the injector cell
forAll(positions_, i)
{
this->findCellAtPosition(injectorCells_[i], positions_[i]);
}
}
template<class CloudType> template<class CloudType>
Foam::scalar Foam::ConeInjectionMP<CloudType>::timeEnd() const Foam::scalar Foam::ConeInjectionMP<CloudType>::timeEnd() const
{ {

View file

@ -162,6 +162,9 @@ public:
//- Flag to indicate whether model activates injection model //- Flag to indicate whether model activates injection model
bool active() const; bool active() const;
//- 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;

View file

@ -131,15 +131,7 @@ Foam::FieldActivatedInjection<CloudType>::FieldActivatedInjection
this->volumeTotal_ = this->volumeTotal_ =
nParcelsPerInjector_*sum(pow3(diameters_))*mathematicalConstant::pi/6.0; nParcelsPerInjector_*sum(pow3(diameters_))*mathematicalConstant::pi/6.0;
// Set/cache the injector cells updateMesh();
forAll(positions_, i)
{
this->findCellAtPosition
(
injectorCells_[i],
positions_[i]
);
}
} }
@ -159,6 +151,17 @@ bool Foam::FieldActivatedInjection<CloudType>::active() const
} }
template<class CloudType>
void Foam::FieldActivatedInjection<CloudType>::updateMesh()
{
// Set/cache the injector cell
forAll(positions_, i)
{
this->findCellAtPosition(injectorCells_[i], positions_[i]);
}
}
template<class CloudType> template<class CloudType>
Foam::scalar Foam::FieldActivatedInjection<CloudType>::timeEnd() const Foam::scalar Foam::FieldActivatedInjection<CloudType>::timeEnd() const
{ {

View file

@ -152,6 +152,9 @@ public:
//- Flag to indicate whether model activates injection model //- Flag to indicate whether model activates injection model
bool active() const; bool active() const;
//- 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;

View file

@ -97,10 +97,8 @@ Foam::KinematicLookupTableInjection<CloudType>::KinematicLookupTableInjection
{ {
// Set/cache the injector cells // Set/cache the injector cells
injectorCells_.setSize(injectors_.size()); injectorCells_.setSize(injectors_.size());
forAll(injectors_, i)
{ this->updateMesh();
this->findCellAtPosition(injectorCells_[i], injectors_[i].x());
}
// Determine volume of particles to inject // Determine volume of particles to inject
this->volumeTotal_ = 0.0; this->volumeTotal_ = 0.0;
@ -128,6 +126,17 @@ bool Foam::KinematicLookupTableInjection<CloudType>::active() const
} }
template<class CloudType>
void Foam::KinematicLookupTableInjection<CloudType>::updateMesh()
{
// Set/cache the injector cell
forAll(injectors_, i)
{
this->findCellAtPosition(injectorCells_[i], injectors_[i].x());
}
}
template<class CloudType> template<class CloudType>
Foam::scalar Foam::KinematicLookupTableInjection<CloudType>::timeEnd() const Foam::scalar Foam::KinematicLookupTableInjection<CloudType>::timeEnd() const
{ {

View file

@ -129,6 +129,9 @@ public:
//- Flag to indicate whether model activates injection model //- Flag to indicate whether model activates injection model
bool active() const; bool active() const;
//- 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;

View file

@ -117,18 +117,7 @@ Foam::PatchInjection<CloudType>::PatchInjection
<< nl << exit(FatalError); << nl << exit(FatalError);
} }
const polyPatch& patch = owner.mesh().boundaryMesh()[patchId]; updateMesh();
cellOwners_ = patch.faceCells();
label patchSize = cellOwners_.size();
label totalPatchSize = patchSize;
reduce(totalPatchSize, sumOp<label>());
fraction_ = scalar(patchSize)/totalPatchSize;
// Set total volume/mass to inject
this->volumeTotal_ = fraction_*volumeFlowRate_().integrate(0.0, duration_);
this->massTotal_ *= fraction_;
} }
@ -148,6 +137,27 @@ bool Foam::PatchInjection<CloudType>::active() const
} }
template<class CloudType>
void Foam::PatchInjection<CloudType>::updateMesh()
{
label patchId =
this->owner().mesh().boundaryMesh().findPatchID(patchName_);
const polyPatch& patch = this->owner().mesh().boundaryMesh()[patchId];
cellOwners_ = patch.faceCells();
label patchSize = cellOwners_.size();
label totalPatchSize = patchSize;
reduce(totalPatchSize, sumOp<label>());
fraction_ = scalar(patchSize)/totalPatchSize;
// Set total volume/mass to inject
this->volumeTotal_ = fraction_*volumeFlowRate_().integrate(0.0, duration_);
this->massTotal_ *= fraction_;
}
template<class CloudType> template<class CloudType>
Foam::scalar Foam::PatchInjection<CloudType>::timeEnd() const Foam::scalar Foam::PatchInjection<CloudType>::timeEnd() const
{ {

View file

@ -136,6 +136,9 @@ public:
//- Flag to indicate whether model activates injection model //- Flag to indicate whether model activates injection model
bool active() const; bool active() const;
//- 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;

View file

@ -96,10 +96,8 @@ Foam::ReactingLookupTableInjection<CloudType>::ReactingLookupTableInjection
{ {
// Set/cache the injector cells // Set/cache the injector cells
injectorCells_.setSize(injectors_.size()); injectorCells_.setSize(injectors_.size());
forAll(injectors_, i)
{ this->updateMesh();
this->findCellAtPosition(injectorCells_[i], injectors_[i].x());
}
// Determine volume of particles to inject // Determine volume of particles to inject
this->volumeTotal_ = 0.0; this->volumeTotal_ = 0.0;
@ -127,6 +125,17 @@ bool Foam::ReactingLookupTableInjection<CloudType>::active() const
} }
template<class CloudType>
void Foam::ReactingLookupTableInjection<CloudType>::updateMesh()
{
// Set/cache the injector cell
forAll(injectors_, i)
{
this->findCellAtPosition(injectorCells_[i], injectors_[i].x());
}
}
template<class CloudType> template<class CloudType>
Foam::scalar Foam::ReactingLookupTableInjection<CloudType>::timeEnd() const Foam::scalar Foam::ReactingLookupTableInjection<CloudType>::timeEnd() const
{ {

View file

@ -132,6 +132,9 @@ public:
//- Flag to indicate whether model activates injection model //- Flag to indicate whether model activates injection model
bool active() const; bool active() const;
//- 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;

View file

@ -99,10 +99,8 @@ ReactingMultiphaseLookupTableInjection
{ {
// Set/cache the injector cells // Set/cache the injector cells
injectorCells_.setSize(injectors_.size()); injectorCells_.setSize(injectors_.size());
forAll(injectors_, i)
{ this->updateMesh();
this->findCellAtPosition(injectorCells_[i], injectors_[i].x());
}
// Determine volume of particles to inject // Determine volume of particles to inject
this->volumeTotal_ = 0.0; this->volumeTotal_ = 0.0;
@ -131,6 +129,17 @@ bool Foam::ReactingMultiphaseLookupTableInjection<CloudType>::active() const
} }
template<class CloudType>
void Foam::ReactingMultiphaseLookupTableInjection<CloudType>::updateMesh()
{
// Set/cache the injector cell
forAll(injectors_, i)
{
this->findCellAtPosition(injectorCells_[i], injectors_[i].x());
}
}
template<class CloudType> template<class CloudType>
Foam::scalar Foam::scalar
Foam::ReactingMultiphaseLookupTableInjection<CloudType>::timeEnd() const Foam::ReactingMultiphaseLookupTableInjection<CloudType>::timeEnd() const

View file

@ -135,6 +135,9 @@ public:
//- Flag to indicate whether model activates injection model //- Flag to indicate whether model activates injection model
bool active() const; bool active() const;
//- 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;

View file

@ -97,10 +97,8 @@ Foam::ThermoLookupTableInjection<CloudType>::ThermoLookupTableInjection
{ {
// Set/cache the injector cells // Set/cache the injector cells
injectorCells_.setSize(injectors_.size()); injectorCells_.setSize(injectors_.size());
forAll(injectors_, i)
{ updateMesh();
this->findCellAtPosition(injectorCells_[injectorI], injectors_[i].x());
}
// Determine volume of particles to inject // Determine volume of particles to inject
this->volumeTotal_ = 0.0; this->volumeTotal_ = 0.0;
@ -128,6 +126,17 @@ bool Foam::ThermoLookupTableInjection<CloudType>::active() const
} }
template<class CloudType>
void Foam::ThermoLookupTableInjection<CloudType>::updateMesh()
{
// Set/cache the injector cells
forAll(injectors_, i)
{
this->findCellAtPosition(injectorCells_[injectorI], injectors_[i].x());
}
}
template<class CloudType> template<class CloudType>
Foam::scalar Foam::ThermoLookupTableInjection<CloudType>::timeEnd() const Foam::scalar Foam::ThermoLookupTableInjection<CloudType>::timeEnd() const
{ {

View file

@ -131,6 +131,9 @@ public:
//- Flag to indicate whether model activates injection model //- Flag to indicate whether model activates injection model
bool active() const; bool active() const;
//- 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;