ScalingTestOldCompiler.cpp File Reference
#include <iostream>
#include <iomanip>
#include <ctime>
#include <Species/LinearViscoelasticSpecies.h>
#include "Mercury3D.h"
#include "Boundaries/PeriodicBoundary.h"
#include "Math/ExtendedMath.h"

Classes

class  ScalingTestInitialConditionsRelax
 
class  ScalingTestInitialConditionsEquilibrize
 
class  ScalingTestRun
 

Functions

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

Function Documentation

◆ main()

int main ( int argc  UNUSED,
char *argv[]  UNUSED 
)
166 {
167  ScalingTestInitialConditionsRelax scalingTestInitialConditionsRelax;
168  auto species=scalingTestInitialConditionsRelax.speciesHandler.copyAndAddObject(LinearViscoelasticSpecies());
169  scalingTestInitialConditionsRelax.N = 100;
170  scalingTestInitialConditionsRelax.initialVelocity = 2.0;
171  scalingTestInitialConditionsRelax.targetVelocity = 1.0;
172  scalingTestInitialConditionsRelax.particleRadius = 0.5;
173  scalingTestInitialConditionsRelax.setName("ScalingTestInitialConditionsRelax");
174  species->setDensity(constants::pi / 6.0);
175  scalingTestInitialConditionsRelax.setSaveCount(100);
176  species->setStiffness(2e5);
177  species->setDissipation(150);
178  scalingTestInitialConditionsRelax.setTimeStep(1e-4);
179  scalingTestInitialConditionsRelax.setTimeMax(10);
180  scalingTestInitialConditionsRelax.setGravity(Vec3D(0.0, 0.0, 0.0));
181  scalingTestInitialConditionsRelax.setHGridMaxLevels(1);
182  scalingTestInitialConditionsRelax.solve();
183 
184  ScalingTestInitialConditionsEquilibrize scalingTestInitialConditionsEquilibrize(scalingTestInitialConditionsRelax);
185  species=scalingTestInitialConditionsRelax.speciesHandler.copyAndAddObject(LinearViscoelasticSpecies());
186  scalingTestInitialConditionsEquilibrize.setName("ScalingTestInitialConditionsEquilibrize");
187  species->setDissipation(0.0);
188  scalingTestInitialConditionsEquilibrize.setSaveCount(100);
189  scalingTestInitialConditionsEquilibrize.setTimeMax(1);
190  scalingTestInitialConditionsEquilibrize.solve();
191 
192  for (unsigned int i = 1; i <= 10; i++)
193  {
194  ScalingTestRun scalingTestRun(scalingTestInitialConditionsEquilibrize);
195  std::string name = "ScalingTestRun";
196  name += std::to_string(i);
197  scalingTestRun.setName(name);
198  scalingTestRun.setMultiplicationFactor(i);
199  scalingTestRun.setSaveCount(100);
200  clock_t begin = std::clock();
201  scalingTestRun.solve();
202  clock_t end = std::clock();
203  double diff = double(end - begin) / CLOCKS_PER_SEC * 1000;
204  logger(INFO, "N=% T=%%5 ms", scalingTestRun.particleHandler.getNumberOfObjects(), std::scientific, diff);
205  }
206 
207 }
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
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 setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:422
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 setGravity(Vec3D newGravity)
Sets a new value for the gravitational acceleration.
Definition: DPMBase.cc:1383
void setHGridMaxLevels(unsigned int HGridMaxLevels)
Sets the maximum number of levels of the HGrid in this MercuryBase.
Definition: MercuryBase.cc:476
Definition: ScalingTest.cpp:98
Definition: ScalingTest.cpp:36
double initialVelocity
Definition: ScalingTest.cpp:92
double targetVelocity
Definition: ScalingTest.cpp:93
int N
Definition: ScalingTest.cpp:91
double particleRadius
Definition: ScalingTest.cpp:94
Definition: ScalingTest.cpp:108
Definition: Vector.h:51
const Mdouble pi
Definition: ExtendedMath.h:45
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51
std::string name
Definition: MercuryProb.h:48

References BaseHandler< T >::copyAndAddObject(), ParticleHandler::getNumberOfObjects(), constants::i, INFO, ScalingTestInitialConditionsRelax::initialVelocity, logger, ScalingTestInitialConditionsRelax::N, units::name, DPMBase::particleHandler, ScalingTestInitialConditionsRelax::particleRadius, constants::pi, DPMBase::setGravity(), MercuryBase::setHGridMaxLevels(), ScalingTestRun::setMultiplicationFactor(), DPMBase::setName(), DPMBase::setSaveCount(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), DPMBase::solve(), DPMBase::speciesHandler, and ScalingTestInitialConditionsRelax::targetVelocity.