PeriodicChuteUnitTestMPI.cpp File Reference
#include "Mercury3D.h"
#include "Walls/InfiniteWall.h"
#include <iostream>
#include "Species/LinearViscoelasticFrictionSpecies.h"
#include <cstdlib>
#include "Boundaries/PeriodicBoundary.h"
#include <chrono>

Classes

class  MpiPeriodicBoundaryUnitTest
 

Functions

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

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)
94 {
95 
96  // Start measuring elapsed time
97  std::chrono::time_point<std::chrono::system_clock> startClock, endClock;
98  startClock = std::chrono::system_clock::now();
99 
100  //Create the problem
102  problem.setName("PeriodicChuteUnitTestMPI");
103 
104  //Create a species
106  species->setDensity(1.0);
107 
108  //Set domain accordingly (domain boundaries are not walls!)
109  problem.setXMin(0.0);
110  problem.setXMax(80.0);
111  problem.setYMin(0.0);
112  problem.setYMax(80.0);
113  problem.setZMin(0.0);
114  problem.setZMax(40.0);
115 
116  //specify particle properties
117  species->setDensity(6.0/constants::pi);
118 
119  //specify body forces
120  double angle = 27.0;
121  double g = 1.0;
122  double val = g*std::sin(angle/360.0*2.0*constants::pi);
123  problem.setGravity(Vec3D(val, -val, -g*std::cos(angle/360.0*2.0*constants::pi)));
124 
125  //Set the number of domains for parallel decomposition
126  problem.setNumberOfDomains({2,2,1});
127 
128  //specify contact properties
129  //normal forces
130  species->setStiffness(1e5);
131  species->setDissipation(0.1);
132  //tangential (sliding) forces
133  species->setSlidingFrictionCoefficient(0.5);
134  species->setSlidingStiffness(1.2e4);
135  species->setSlidingDissipation(0.16);
136  //tangential (rolling) torques
137  species->setRollingFrictionCoefficient(0.2);
138  species->setRollingStiffness(1.2e4);
139  species->setRollingDissipation(6.3e-2);
140  //normal (torsion/spin) torques
141  species->setTorsionFrictionCoefficient(0.1);
142  species->setTorsionStiffness(1.2e4);
143  species->setSlidingDissipation(6.3e-2);
144 
145  //set other simulation parameters
146  Mdouble MinParticleMass = species->getDensity()*4.0 / 3.0 * constants::pi ;
147  Mdouble tc = species->getCollisionTime(MinParticleMass);
148  problem.setTimeStep(tc / 50.0);
149  //problem.setTimeMax(100.0);//run until 3.0 to see full simulation
150  problem.setTimeMax(40.0);//run until 3.0 to see full simulation
151  problem.setSaveCount(200); //used to be 500
152 
153  //Set output to paraview
154  problem.setParticlesWriteVTK(true);
155 
156  problem.solve(argc, argv);
157 
158  // Measure elapsed time
159  endClock = std::chrono::system_clock::now();
160  std::chrono::duration<double> elapsed_seconds = endClock - startClock;
161  logger(INFO, "Elapsed time for solving the PDE: % s", elapsed_seconds.count());
162 
163 
164  return 0;
165 }
double Mdouble
Definition: GeneralDefine.h:34
Species< LinearViscoelasticNormalSpecies, FrictionSpecies > LinearViscoelasticFrictionSpecies
Definition: LinearViscoelasticFrictionSpecies.h:34
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
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:408
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1427
void setYMin(Mdouble newYMin)
Sets the value of YMin, the lower bound of the problem domain in the y-direction.
Definition: DPMBase.cc:1034
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:422
void setNumberOfDomains(std::vector< unsigned > direction)
Sets the number of domains in x-,y- and z-direction. Required for parallel computations.
Definition: DPMBase.cc:5213
void setYMax(Mdouble newYMax)
Sets the value of YMax, the upper bound of the problem domain in the y-direction.
Definition: DPMBase.cc:1191
void setZMin(Mdouble newZMin)
Sets the value of ZMin, the lower bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1058
void setXMax(Mdouble newXMax)
Sets the value of XMax, the upper bound of the problem domain in the x-direction.
Definition: DPMBase.cc:1165
void setZMax(Mdouble newZMax)
Sets the value of ZMax, the upper bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1217
void setParticlesWriteVTK(bool writeParticlesVTK)
Sets whether particles are written in a VTK file.
Definition: DPMBase.cc:942
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 setXMin(Mdouble newXMin)
Sets the value of XMin, the lower bound of the problem domain in the x-direction.
Definition: DPMBase.cc:1010
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1383
Definition: PeriodicBoundary1MPI2Test.cpp:33
void setDensity(Mdouble density)
Definition: ParticleSpecies.cc:108
Mdouble getDensity() const
Allows density_ to be accessed.
Definition: ParticleSpecies.cc:118
Contains material and contact force properties.
Definition: Species.h:35
Definition: Vector.h:51
const Mdouble pi
Definition: ExtendedMath.h:45
Mdouble cos(Mdouble x)
Definition: ExtendedMath.cc:64
Mdouble sin(Mdouble x)
Definition: ExtendedMath.cc:44

References BaseHandler< T >::copyAndAddObject(), mathsFunc::cos(), ParticleSpecies::getDensity(), INFO, logger, constants::pi, ParticleSpecies::setDensity(), DPMBase::setGravity(), DPMBase::setName(), DPMBase::setNumberOfDomains(), DPMBase::setParticlesWriteVTK(), DPMBase::setSaveCount(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), DPMBase::setXMax(), DPMBase::setXMin(), DPMBase::setYMax(), DPMBase::setYMin(), DPMBase::setZMax(), DPMBase::setZMin(), mathsFunc::sin(), DPMBase::solve(), and DPMBase::speciesHandler.