10 logger.assert_always(dpm,
"You can only run DropletBoundary with Mercury2D or Mercury3D, not DPMBase");
19 d.position += dt*d.velocity;
25 for (
auto &d : droplets_) {
30 double liquidVolume = std::pow(d.radius, 3) *
constants::pi / 6.0 / q.size();
31 for (
auto particle : q) {
52 droplets_.erase(std::remove_if(droplets_.begin(), droplets_.end(),
53 [](
const Droplet &d) {
return d.radius == 0; }), droplets_.end());
66 Vec3D position, velocity;
72 for (
int i = 0;
i < n; ++
i) {
73 is >> position >> velocity >> radius;
88 os <<
" " << d.position;
89 os <<
" " << d.velocity;
90 os <<
" " << d.radius;
95 file <<
"<Piece NumberOfPoints=\"" <<
droplets_.size() <<
"\" NumberOfCells=\"" << 0 <<
"\">\n";
97 file <<
" <DataArray type=\"Float32\" Name=\"Position\" NumberOfComponents=\"3\" format=\"ascii\">\n";
98 for (
const auto& d :
droplets_) file <<
'\t' << d.position <<
'\n';
99 file <<
" </DataArray>\n";
100 file <<
"</Points>\n";
101 file <<
"<PointData Vectors=\"vector\">\n";
102 file <<
" <DataArray type=\"Float32\" Name=\"Velocity\" NumberOfComponents=\"3\" format=\"ascii\">\n";
103 for (
const auto& d : droplets_) file <<
'\t' << d.velocity <<
'\n';
104 file <<
" </DataArray>\n";
105 file <<
" <DataArray type=\"Float32\" Name=\"Radius\" format=\"ascii\">\n";
106 for (
const auto& d : droplets_) file <<
'\t' << d.radius <<
'\n';
107 file <<
" </DataArray>\n";
108 file <<
"</PointData>\n";
void writeVTK(std::fstream &file) override
void addLiquidVolume(Mdouble liquidVolume)
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here...
virtual void setRadius(Mdouble radius)
Sets the particle's radius_ (and adjusts the mass_ accordingly, based on the particle's species) ...
std::vector< Droplet > droplets_
const std::complex< Mdouble > i
void setSpecies(const ParticleSpecies *species)
void read(std::istream &is) override=0
Reads the object's id_ from given istream NB: purely virtual function, overriding the version of Base...
std::function< void(DropletBoundary &)> generateDroplets_
virtual std::vector< BaseParticle * > hGridFindParticleContacts(const BaseParticle *obj)=0
Purely virtual function that returns all particles that have a contact with a given particle...
This is the base class for both Mercury2D and Mercury3D. Note the actually abstract grid is defined i...
unsigned int getNumberOfTimeSteps() const
Returns the current counter of time-steps, i.e. the number of time-steps that the simulation has unde...
Vec3D getGravity() const
Returns the gravitational acceleration.
void write(std::ostream &os) const override=0
Adds object's id_ to given ostream NB: purely virtual function, overriding the version of BaseObject...
BoundaryHandler * getHandler() const
Returns the boundary's BoundaryHandler.
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Container to store all BaseParticle.
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
void setPosition(const Vec3D &position)
Sets the position of this BaseInteractable.
T * getLastObject()
Gets a pointer to the last Object in this BaseHandler.
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Mdouble getTimeStep() const
Returns the simulation time step.
void write(std::ostream &os) const override
Writes the boundary properties to an std::ostream.
virtual bool getDistanceNormalOverlap(const BaseParticle &P, Mdouble &distance, Vec3D &normal_return, Mdouble &overlap) const
void read(std::istream &is) override
Reads some boundary properties from an std::istream.
void checkBoundaryAfterParticlesMove(ParticleHandler &pH) override
Runs at the end of each time step.