STLRotationSelfTest.cpp File Reference

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)
31 {
32  // Problem setup
33  Mercury3D problem;
34  // Set name of output files
35  problem.setName("STLRotationSelfTest");
36  // Set domain size
37  problem.setMax({450,50,50});
38  problem.setMin({-450,-50,-50});
39  // Set time step, final time and how often to output
40  problem.setTimeStep(0.01);
41  problem.setTimeMax(0.1);
42  problem.setSaveCount(1);
43  // Turn off most output files except data and wall-vtu files
47  problem.wallHandler.setWriteVTK(true);
48  // Introduce a material (no properties set, as no collisions happen here)
50  // introduce an outer wall
51  problem.wallHandler.readTriangleWall("Casing.stl",problem.speciesHandler.getObject(0));
52  // introduce an inner, rotating wall
53  Mdouble scaleFactor = 1;
54  Vec3D shift = {0,0,0};
55  Vec3D velocity = {0,0,0};
56  Vec3D angularVelocity = {2.0*constants::pi,0,0};
57  problem.wallHandler.readTriangleWall("Screw.stl",problem.speciesHandler.getObject(0),
58  scaleFactor,shift,velocity,angularVelocity);
59  // start solving in time
60  problem.solve();
61  logger.assert_always(problem.wallHandler.getSize()==4316,"Didn't read the right number of walls");
62  logger(INFO,"Load %Wall_*.vtu in paraview to see the wall geometry",problem.getName());
63  return 0;
64 }
@ NO_FILE
file will not be created/read
double Mdouble
Definition: GeneralDefine.h:34
Species< LinearViscoelasticNormalSpecies > LinearViscoelasticSpecies
Definition: LinearViscoelasticSpecies.h:33
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:55
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddObject(const U &object)
Creates a copy of a Object and adds it to the BaseHandler.
Definition: BaseHandler.h:379
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:655
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
Definition: BaseHandler.h:613
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:408
File eneFile
An instance of class File to handle in- and output into a .ene file.
Definition: DPMBase.h:1488
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1427
File fStatFile
An instance of class File to handle in- and output into a .fstat file.
Definition: DPMBase.h:1483
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:422
const std::string & getName() const
Returns the name of the file. Does not allow to change it though.
Definition: DPMBase.cc:399
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1447
void setMin(const Vec3D &min)
Sets the minimum coordinates of the problem domain.
Definition: DPMBase.cc:1118
File restartFile
An instance of class File to handle in- and output into a .restart file.
Definition: DPMBase.h:1493
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1234
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:873
void solve()
The work horse of the code.
Definition: DPMBase.cc:4270
void setMax(const Vec3D &max)
Sets the maximum coordinates of the problem domain.
Definition: DPMBase.cc:1082
void setFileType(FileType fileType)
Sets the type of file needed to write into or read from. File::fileType_.
Definition: File.cc:215
This adds on the hierarchical grid code for 3D problems.
Definition: Mercury3D.h:37
Definition: Vector.h:51
void setWriteVTK(FileType)
Sets whether walls are written into a VTK file.
Definition: WallHandler.cc:467
unsigned readTriangleWall(std::string filename, ParticleSpecies *species, Mdouble scaleFactor=1, Vec3D centerOfRotation={0, 0, 0}, Vec3D velocity={0, 0, 0}, Vec3D angularVelocity={0, 0, 0})
Reads triangulated walls from vtk or stl files, and converts them into a set of TriangleWalls.
Definition: WallHandler.cc:341
const Mdouble pi
Definition: ExtendedMath.h:45

References BaseHandler< T >::copyAndAddObject(), DPMBase::eneFile, DPMBase::fStatFile, DPMBase::getName(), BaseHandler< T >::getObject(), BaseHandler< T >::getSize(), INFO, logger, NO_FILE, constants::pi, WallHandler::readTriangleWall(), DPMBase::restartFile, File::setFileType(), DPMBase::setMax(), DPMBase::setMin(), DPMBase::setName(), DPMBase::setSaveCount(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), WallHandler::setWriteVTK(), DPMBase::solve(), DPMBase::speciesHandler, and DPMBase::wallHandler.