HourGlass2DDemoMPI.cpp File Reference
#include "Mercury3D.h"
#include "Walls/IntersectionOfWalls.h"
#include "Walls/AxisymmetricIntersectionOfWalls.h"
#include "Boundaries/DeletionBoundary.h"
#include <iostream>
#include "Species/LinearViscoelasticFrictionSpecies.h"
#include <cstdlib>
#include <chrono>

Classes

class  HourGlass2D
 

Functions

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

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)
107 {
108  // Start measuring elapsed time
109  std::chrono::time_point<std::chrono::system_clock> startClock, endClock;
110  startClock = std::chrono::system_clock::now();
111 
112 
113  logger(INFO, "Hourglass Simulation");
114  // note: this code is based on stefan's implementation, see
115  // /storage2/usr/people/sluding/COMPUTERS/hpc01/sluding/MDCC/MDCLR/DEMO/W7
116  // however, it is scaled to SI units by the scaling factors
117  // d=1e-3, m=1e-6, g=1
118 
119  //all parameters should be set in the main file
120  //here, we use SI units (generally, other, scaled units are possible)
121 
122  //create an instance of the class and name it
123  HourGlass2D HG;
124  HG.setName("HourGlass2DMPI");
126  //LinearViscoelasticSpecies* species = HG.speciesHandler.copyAndAddObject(LinearViscoelasticSpecies());
127  species->setDensity(2000);
128 
129  //specify geometry
130  //specify dimensions of the hourglass
131  Mdouble Width = 60e-2; // 10cm
132  Mdouble Height = 60e-2; // 60cm
133  //specify how big the wedge of the contraction should be
134  Mdouble ContractionWidth = 15e-2; //2.5cm
135  Mdouble ContractionHeight = 5e-2; //5cm
136  //set domain accordingly (domain boundaries are not walls!)
137  HG.setXMin(0.0);
138  HG.setXMax(Width);
139  HG.setYMin(0.0);
140  HG.setYMax(Width);
141  HG.setZMin(0.0);
142  HG.setZMax(Height);
143  //these parameters are needed in setupInitialConditions()
144  HG.ContractionWidth = ContractionWidth;
145  HG.ContractionHeight = ContractionHeight;
146 
147  //specify particle properties
148  species->setDensity(2000.0);
149  //these parameters are needed in setupInitialConditions()
150  HG.MinParticleRadius = 6e-3; // 6mm
151  HG.MaxParticleRadius = 10e-3; //10mm
152 
153  //specify body forces
154  HG.setGravity(Vec3D(0.0, 0.0, -9.8));
155 
156  //Set the number of domains for parallel decomposition
157  HG.setNumberOfDomains({2,2,1});
158 
159  //specify contact properties
160  //normal forces
161  species->setStiffness(1e5);
162  species->setDissipation(0.63);
163  //tangential (sliding) forces
164  species->setSlidingFrictionCoefficient(0.5);
165  species->setSlidingStiffness(1.2e4);
166  species->setSlidingDissipation(0.16);
167  //tangential (rolling) torques
168  species->setRollingFrictionCoefficient(0.2);
169  species->setRollingStiffness(1.2e4);
170  species->setRollingDissipation(6.3e-2);
171  //normal (torsion/spin) torques
172  species->setTorsionFrictionCoefficient(0.1);
173  species->setTorsionStiffness(1.2e4);
174  species->setSlidingDissipation(6.3e-2);
175 
176 
177 
178  //test normal forces
179  Mdouble MinParticleMass =
180  species->getDensity() * 4.0 / 3.0 * constants::pi * mathsFunc::cubic(HG.MinParticleRadius);
181  logger(INFO, "MinParticleMass =%\n", MinParticleMass, Flusher::NO_FLUSH);
182  Mdouble tc = species->getCollisionTime(MinParticleMass);
183  logger(INFO, "tc =%\n"
184  "r =%\n"
185  "vmax=%\n",
186  tc, species->getRestitutionCoefficient(MinParticleMass),
187  species->getMaximumVelocity(HG.MinParticleRadius, MinParticleMass), Flusher::NO_FLUSH);
188 
189  //set other simulation parameters
190  HG.setTimeStep(tc / 50.0);
191  HG.setTimeMax(0.5);//run until 3.0 to see full simulation
192  HG.setSaveCount(500); //used to be 500
193  HG.setXBallsAdditionalArguments("-v0 -solidf");
194  HG.N = 900; //number of particles
195  logger(INFO, "N = %", HG.N);
196 
197  //Set output to paraview
198  HG.setParticlesWriteVTK(true);
199 
200  //Call setup for the shared-file output model: comment or uncomment for processing either ASCII or Binary output
201  //problem.setFileType(FileType::MPI_SHARED_FILE_ASCII);
202  //problem.setFileType(FileType::MPI_SHARED_FILE_BINARY);
203 
204  HG.solve(argc, argv);
205 
206  // Measure elapsed time
207  endClock = std::chrono::system_clock::now();
208  std::chrono::duration<double> elapsed_seconds = endClock - startClock;
209  logger(INFO, "Elapsed time for solving the PDE: % s", elapsed_seconds.count());
210 
211 
212  return 0;
213 }
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 setXBallsAdditionalArguments(std::string newXBArgs)
Set the additional arguments for xballs.
Definition: DPMBase.cc:1347
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: HourGlass2DDemo.cpp:43
Mdouble MinParticleRadius
Definition: HourGlass2DDemo.cpp:106
Mdouble ContractionWidth
Definition: HourGlass2DDemo.cpp:104
Mdouble MaxParticleRadius
Definition: HourGlass2DDemo.cpp:107
Mdouble ContractionHeight
Definition: HourGlass2DDemo.cpp:105
unsigned int N
Definition: HourGlass2DDemo.cpp:108
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
T cubic(const T val)
calculates the cube of a number
Definition: ExtendedMath.h:115

References HourGlass2D::ContractionHeight, HourGlass2D::ContractionWidth, BaseHandler< T >::copyAndAddObject(), mathsFunc::cubic(), ParticleSpecies::getDensity(), INFO, logger, HourGlass2D::MaxParticleRadius, HourGlass2D::MinParticleRadius, HourGlass2D::N, NO_FLUSH, constants::pi, ParticleSpecies::setDensity(), DPMBase::setGravity(), DPMBase::setName(), DPMBase::setNumberOfDomains(), DPMBase::setParticlesWriteVTK(), DPMBase::setSaveCount(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), DPMBase::setXBallsAdditionalArguments(), DPMBase::setXMax(), DPMBase::setXMin(), DPMBase::setYMax(), DPMBase::setYMin(), DPMBase::setZMax(), DPMBase::setZMin(), DPMBase::solve(), and DPMBase::speciesHandler.