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[] 
)
86 {
87  // Start measuring elapsed time
88  std::chrono::time_point<std::chrono::system_clock> startClock, endClock;
89  startClock = std::chrono::system_clock::now();
90 
91 
92  logger(INFO, "Hourglass Simulation");
93  // note: this code is based on stefan's implementation, see
94  // /storage2/usr/people/sluding/COMPUTERS/hpc01/sluding/MDCC/MDCLR/DEMO/W7
95  // however, it is scaled to SI units by the scaling factors
96  // d=1e-3, m=1e-6, g=1
97 
98  //all parameters should be set in the main file
99  //here, we use SI units (generally, other, scaled units are possible)
100 
101  //create an instance of the class and name it
102  HourGlass2D HG;
103  HG.setName("HourGlass2DMPI");
105  //LinearViscoelasticSpecies* species = HG.speciesHandler.copyAndAddObject(LinearViscoelasticSpecies());
106  species->setDensity(2000);
107 
108  //specify geometry
109  //specify dimensions of the hourglass
110  Mdouble Width = 60e-2; // 10cm
111  Mdouble Height = 60e-2; // 60cm
112  //specify how big the wedge of the contraction should be
113  Mdouble ContractionWidth = 15e-2; //2.5cm
114  Mdouble ContractionHeight = 5e-2; //5cm
115  //set domain accordingly (domain boundaries are not walls!)
116  HG.setXMin(0.0);
117  HG.setXMax(Width);
118  HG.setYMin(0.0);
119  HG.setYMax(Width);
120  HG.setZMin(0.0);
121  HG.setZMax(Height);
122  //these parameters are needed in setupInitialConditions()
123  HG.ContractionWidth = ContractionWidth;
124  HG.ContractionHeight = ContractionHeight;
125 
126  //specify particle properties
127  species->setDensity(2000.0);
128  //these parameters are needed in setupInitialConditions()
129  HG.MinParticleRadius = 6e-3; // 6mm
130  HG.MaxParticleRadius = 10e-3; //10mm
131 
132  //specify body forces
133  HG.setGravity(Vec3D(0.0, 0.0, -9.8));
134 
135  //Set the number of domains for parallel decomposition
136  HG.setNumberOfDomains({2,2,1});
137 
138  //specify contact properties
139  //normal forces
140  species->setStiffness(1e5);
141  species->setDissipation(0.63);
142  //tangential (sliding) forces
143  species->setSlidingFrictionCoefficient(0.5);
144  species->setSlidingStiffness(1.2e4);
145  species->setSlidingDissipation(0.16);
146  //tangential (rolling) torques
147  species->setRollingFrictionCoefficient(0.2);
148  species->setRollingStiffness(1.2e4);
149  species->setRollingDissipation(6.3e-2);
150  //normal (torsion/spin) torques
151  species->setTorsionFrictionCoefficient(0.1);
152  species->setTorsionStiffness(1.2e4);
153  species->setSlidingDissipation(6.3e-2);
154 
155 
156 
157  //test normal forces
158  Mdouble MinParticleMass =
159  species->getDensity() * 4.0 / 3.0 * constants::pi * mathsFunc::cubic(HG.MinParticleRadius);
160  logger(INFO, "MinParticleMass =%\n", MinParticleMass, Flusher::NO_FLUSH);
161  Mdouble tc = species->getCollisionTime(MinParticleMass);
162  logger(INFO, "tc =%\n"
163  "r =%\n"
164  "vmax=%\n",
165  tc, species->getRestitutionCoefficient(MinParticleMass),
166  species->getMaximumVelocity(HG.MinParticleRadius, MinParticleMass), Flusher::NO_FLUSH);
167 
168  //set other simulation parameters
169  HG.setTimeStep(tc / 50.0);
170  HG.setTimeMax(0.5);//run until 3.0 to see full simulation
171  HG.setSaveCount(500); //used to be 500
172  HG.setXBallsAdditionalArguments("-v0 -solidf");
173  HG.N = 900; //number of particles
174  logger(INFO, "N = %", HG.N);
175 
176  //Set output to paraview
177  HG.setParticlesWriteVTK(true);
178 
179  //Call setup for the shared-file output model: comment or uncomment for processing either ASCII or Binary output
180  //problem.setFileType(FileType::MPI_SHARED_FILE_ASCII);
181  //problem.setFileType(FileType::MPI_SHARED_FILE_BINARY);
182 
183  HG.solve(argc, argv);
184 
185  // Measure elapsed time
186  endClock = std::chrono::system_clock::now();
187  std::chrono::duration<double> elapsed_seconds = endClock - startClock;
188  logger(INFO, "Elapsed time for solving the PDE: % s", elapsed_seconds.count());
189 
190 
191  return 0;
192 }
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Species< LinearViscoelasticNormalSpecies, FrictionSpecies > LinearViscoelasticFrictionSpecies
Definition: LinearViscoelasticFrictionSpecies.h:12
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:360
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:386
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1433
void setYMin(Mdouble newYMin)
Sets the value of YMin, the lower bound of the problem domain in the y-direction.
Definition: DPMBase.cc:1025
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:400
void setNumberOfDomains(std::vector< unsigned > direction)
Sets the number of domains in x-,y- and z-direction. Required for parallel computations.
Definition: DPMBase.cc:5302
void setYMax(Mdouble newYMax)
Sets the value of YMax, the upper bound of the problem domain in the y-direction.
Definition: DPMBase.cc:1182
void setZMin(Mdouble newZMin)
Sets the value of ZMin, the lower bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1049
void setXBallsAdditionalArguments(std::string newXBArgs)
Set the additional arguments for xballs.
Definition: DPMBase.cc:1338
void setXMax(Mdouble newXMax)
Sets the value of XMax, the upper bound of the problem domain in the x-direction.
Definition: DPMBase.cc:1156
void setZMax(Mdouble newZMax)
Sets the value of ZMax, the upper bound of the problem domain in the z-direction.
Definition: DPMBase.cc:1208
void setParticlesWriteVTK(bool writeParticlesVTK)
Sets whether particles are written in a VTK file.
Definition: DPMBase.cc:933
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1225
void setTimeMax(Mdouble newTMax)
Sets a new value for the maximum simulation duration.
Definition: DPMBase.cc:864
void solve()
The work horse of the code.
Definition: DPMBase.cc:4334
void setXMin(Mdouble newXMin)
Sets the value of XMin, the lower bound of the problem domain in the x-direction.
Definition: DPMBase.cc:1001
void setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1374
void setRollingFrictionCoefficient(Mdouble new_mu)
Allows the (dynamic) Coulomb friction coefficient to be changed; also sets mu_s by default.
Definition: FrictionSpecies.cc:165
void setTorsionStiffness(Mdouble new_kt)
Allows the torsion stiffness to be changed.
Definition: FrictionSpecies.cc:201
void setRollingDissipation(Mdouble new_dispt)
Allows the tangential viscosity to be changed.
Definition: FrictionSpecies.cc:147
void setTorsionFrictionCoefficient(Mdouble new_mu)
Allows the (dynamic) Coulomb torsion friction coefficient to be changed; also sets mu_s by default.
Definition: FrictionSpecies.cc:238
void setRollingStiffness(Mdouble new_kt)
Allows the spring constant to be changed.
Definition: FrictionSpecies.cc:128
Definition: HourGlass2DDemo.cpp:22
Mdouble MinParticleRadius
Definition: HourGlass2DDemo.cpp:85
Mdouble ContractionWidth
Definition: HourGlass2DDemo.cpp:83
Mdouble MaxParticleRadius
Definition: HourGlass2DDemo.cpp:86
Mdouble ContractionHeight
Definition: HourGlass2DDemo.cpp:84
unsigned int N
Definition: HourGlass2DDemo.cpp:87
Mdouble getMaximumVelocity(Mdouble radius, Mdouble mass) const
Calculates the maximum velocity allowed for a collision of two copies of P (for higher velocities par...
Definition: LinearViscoelasticNormalSpecies.cc:154
Mdouble getCollisionTime(Mdouble mass) const
Calculates collision time for two copies of a particle of given disp, k, mass.
Definition: LinearViscoelasticNormalSpecies.cc:116
void setDissipation(Mdouble dissipation)
Allows the normal dissipation to be changed.
Definition: LinearViscoelasticNormalSpecies.cc:96
void setStiffness(Mdouble new_k)
Allows the spring constant to be changed.
Definition: LinearViscoelasticNormalSpecies.cc:72
Mdouble getRestitutionCoefficient(Mdouble mass) const
Calculates restitution coefficient for two copies of given disp, k, mass.
Definition: LinearViscoelasticNormalSpecies.cc:147
void setDensity(Mdouble density)
Definition: ParticleSpecies.cc:88
Mdouble getDensity() const
Allows density_ to be accessed.
Definition: ParticleSpecies.cc:98
void setSlidingStiffness(Mdouble new_kt)
Allows the spring constant to be changed.
Definition: SlidingFrictionSpecies.cc:83
void setSlidingDissipation(Mdouble new_dispt)
Allows the tangential viscosity to be changed.
Definition: SlidingFrictionSpecies.cc:102
void setSlidingFrictionCoefficient(Mdouble new_mu)
Allows the (dynamic) Coulomb friction coefficient to be changed; also sets mu_s by default.
Definition: SlidingFrictionSpecies.cc:120
Definition: Kernel/Math/Vector.h:30
#define INFO(i)
Definition: mumps_solver.h:54
double Height
Height of domain.
Definition: flow_past_oscillating_cylinder.cc:316
const Mdouble pi
Definition: ExtendedMath.h:23
T cubic(const T val)
calculates the cube of a number
Definition: ExtendedMath.h:95

References HourGlass2D::ContractionHeight, HourGlass2D::ContractionWidth, BaseHandler< T >::copyAndAddObject(), mathsFunc::cubic(), e(), LinearViscoelasticNormalSpecies::getCollisionTime(), ParticleSpecies::getDensity(), LinearViscoelasticNormalSpecies::getMaximumVelocity(), LinearViscoelasticNormalSpecies::getRestitutionCoefficient(), GlobalParameters::Height, INFO, logger, HourGlass2D::MaxParticleRadius, HourGlass2D::MinParticleRadius, HourGlass2D::N, NO_FLUSH, constants::pi, ParticleSpecies::setDensity(), LinearViscoelasticNormalSpecies::setDissipation(), DPMBase::setGravity(), DPMBase::setName(), DPMBase::setNumberOfDomains(), DPMBase::setParticlesWriteVTK(), FrictionSpecies::setRollingDissipation(), FrictionSpecies::setRollingFrictionCoefficient(), FrictionSpecies::setRollingStiffness(), DPMBase::setSaveCount(), SlidingFrictionSpecies::setSlidingDissipation(), SlidingFrictionSpecies::setSlidingFrictionCoefficient(), SlidingFrictionSpecies::setSlidingStiffness(), LinearViscoelasticNormalSpecies::setStiffness(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), FrictionSpecies::setTorsionFrictionCoefficient(), FrictionSpecies::setTorsionStiffness(), DPMBase::setXBallsAdditionalArguments(), DPMBase::setXMax(), DPMBase::setXMin(), DPMBase::setYMax(), DPMBase::setYMin(), DPMBase::setZMax(), DPMBase::setZMin(), DPMBase::solve(), and DPMBase::speciesHandler.