69 logger(
DEBUG,
"Screw(const Screw&) copy constructor finished.");
92 logger(
DEBUG,
"Screw(Vec3D, Mdouble, Mdouble, Mdouble, Mdouble, Mdouble) constructor finished.");
97 logger(
DEBUG,
"~Screw() finished, destroyed the Screw.");
105 return new Screw(*
this);
139 Vec3D& normal_return)
const
197 const unsigned maxCount = 30;
204 if(++count>maxCount) {
205 logger(
WARN,
"Screw % contact detection did not converge (err=%); continuing with approximate contact point",
getId(),fabs(dd/ddd));
208 }
while (fabs(dd / ddd) > 5e-14);
216 if (distance>wallInteractionRadius) {
219 normal_return =
Vec3D(0,-position.
Y/R,-position.
Z/R);
236 2.0 *
l_ * (X - q *
l_);
240 if(++count>maxCount) {
241 logger(
WARN,
"Screw % contact detection at left boundary did not converge (err=%); continuing with approximate contact point",
getId(),fabs(dd/ddd));
244 }
while (fabs(dd / ddd) > 1e-13);
277 distance = sqrt(distanceSquared) -
thickness_;
281 normal_return = (ContactPoint - position);
320 >> dummy >> screwType;
349 <<
" Radius " <<
maxR_
350 <<
" Revolutions " <<
n_
354 <<
" ScrewType " <<
static_cast<unsigned>(
screwType_);
370 unsigned nz =
static_cast<unsigned int>(99 * fabs(
n_));
372 unsigned long nPoints = vtk.
points.size();
377 for (
unsigned iz = 0; iz < nz; iz++)
379 for (
unsigned ir = 0; ir < nr; ir++)
381 double q = (double) iz / nz;
382 double r = (double) ir / (nr - 1) *
maxR_;
388 vtk.
points.push_back(contactPoint);
390 for (
unsigned ir = 0; ir < nr; ir++)
392 double q = (double) iz / nz;
393 double r = (double) (nr - 1 - ir) / (nr - 1) *
maxR_;
399 vtk.
points.push_back(contactPoint);
410 std::vector<double> cell;
411 cell.reserve(2 * nr);
412 for (
unsigned ir = 0; ir < 2*nr; ir++)
414 cell.push_back(nPoints + ir + 2*iz * nr);
415 cell.push_back(nPoints + ir + 2*(iz + 1) * nr);
426 std::stringstream file;
427 file <<
"# vtk DataFile Version 2.0\n"
430 "DATASET UNSTRUCTURED_GRID\n"
431 "POINTS " << vtk.
points.size() <<
" double\n";
432 for (
const auto& vertex : vtk.
points)
433 file << vertex <<
'\n';
436 file <<
"3 " << face[0] <<
' ' << face[1] <<
' ' << face[2] <<
'\n';
unsigned int getId() const
Returns the unique identifier of any particular object.
std::enable_if<!std::is_pointer< typename U::MixedSpeciesType >::value, typename U::MixedSpeciesType * >::type getMixedObject(const U *S, const U *T)
bool writeToFile(std::string filename, std::string filecontent)
Writes a string to a file.
const Vec3D & getPosition() const
Returns the position of this BaseInteractable.
Mdouble X
the vector components
BaseSpecies is the class from which all other species are derived.
void read(std::istream &is) override
Reads a Screw from an input stream, for example a restart file.
Mdouble maxR_
The outer radius of the Screw.
This function defines an Archimedes' screw in the z-direction from a (constant) starting point...
void writeVTK(VTKContainer &vtk) const override
void rotateBack(Vec3D &position) const
Applies the inverse rotation to a position.
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here...
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
void normalise()
Makes this Vec3D unit length.
bool getDistanceAndNormal(const BaseParticle &P, Mdouble &distance, Vec3D &normal_return) const final
Compute the distance from the Screw for a given BaseParticle and return if there is a collision...
void setZero()
Sets all elements to zero.
void write(std::ostream &os) const override
Function that writes a BaseWall to an output stream, usually a restart file.
int sign(T val)
This is a sign function, it returns -1 for negative numbers, 1 for positive numbers and 0 for 0...
void rotate(Vec3D &position) const
Applies the rotation to a position.
void move_time(Mdouble dt)
Rotate the Screw for a period dt, so that the offset_ changes with omega_*dt.
Mdouble getInteractionDistance() const
returns the largest separation distance at which adhesive short-range forces can occur.
WallHandler * getHandler() const
A function which returns the WallHandler that handles this BaseWall.
std::string getName() const final
Returns the name of the object, here the string "Screw".
ScrewType screwType_
Single or double helix screw.
Vec3D start_
The centre of the lower end of the screw.
Mdouble offset_
The angle that describes how much the Screw has turned, going from 0 to 1 for a rotation.
~Screw() override
Default destructor.
std::vector< std::vector< double > > triangleStrips
Mdouble l_
The length of the Screw.
Screw * copy() const final
Copy this screw and return a pointer to the copy.
Mdouble getRadius() const
Returns the particle's radius.
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
bool getDistanceAndNormalLabCoordinates(Vec3D position, Mdouble wallInteractionRadius, Mdouble &distance, Vec3D &normal_return) const
void read(std::istream &is) override
Function that reads a BaseWall from an input stream, usually a restart file.
void write(std::ostream &os) const override
Writes this Screw to an output stream, for example a restart file.
std::vector< Vec3D > points
void rotate(const Vec3D &angularVelocityDt) override
Mdouble round(const Mdouble value, unsigned precision)
virtual void rotate(const Vec3D &angularVelocityDt)
Rotates this BaseInteractable.
Mdouble n_
The number of revelations.
ScrewType
used to define if the screw consists of a single or double helical thread
void setOrientationViaNormal(Vec3D normal)
Sets the orientation of this BaseInteractable by defining the vector that results from the rotation o...
Screw()
Default constructor: make a screw with default parameters.
Mdouble thickness_
The thickness of the Screw.
Mdouble omega_
Rotation speed in rev/s.
T square(const T val)
squares a number
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
Mdouble getTimeStep() const
Returns the simulation time step.
const Quaternion & getOrientation() const
Returns the orientation of this BaseInteractable.
void oldRead(std::istream &is)
Reads a Screw in the old style from an input stream, for example a restart file old style...