SinterForceUnitTest.cpp File Reference
#include "DPMBase.h"
#include <iostream>
#include <vector>
#include <Species/SinterSpecies.h>
#include <Logger.h>

Classes

class  SinterForceUnitTest
 [T11:contactModel] More...
 

Functions

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

Function Documentation

◆ main()

int main ( int argc  UNUSED,
char *argv[]  UNUSED 
)
79 {
81  double k1=5.0;
82  sf.radius = 2e-6;
84  sf.species->setPlasticParameters(k1, 5.0*k1, k1, 0.5);
86  sf.setSystemDimensions(3);
87  sf.species->setSinterRate(1000);
88 
90  sf.species->setDissipation(5e5*mass);
91  sf.setTimeStep(sf.species->computeTimeStep(mass)*2.0);
92  sf.setTimeMax(sf.getTimeStep()*400.0);
94  sf.setSaveCount(1);
95 
96  logger(INFO,"Testing particle particles collision for elastic plastic forces. \n"
97  "This will be done for several values of scaled relative velocity chi");
98 
99  //Set up constant data that will be used
100  const std::vector<double> chi = {0.34, 0.69, 1.05, 1.25};
101 
102  //Loop over all test cases
103  for (int i=0; i<4; i++)
104  {
105  logger(INFO, "Running for chi=%",chi[i]);
106  sf.set_chi(chi[i]);
107  std::stringstream ss("");
108  ss << "SinterForceUnitTest" << sf.get_chi();
109  sf.setName(ss.str().c_str());
110  sf.solve();
111  sf.writeRestartFile();
112  }
113 
114  //A longer simulation, with sintering activated
115  sf.set_chi(1.15);
116  sf.setName("LongSinterForceUnitTest");
117  sf.setSaveCount(2500);
118  sf.setTimeMax(5e-4);
119  sf.solve();
120  sf.writeRestartFile();
121 
122  logger(INFO, "Execute 'gnuplot SinterForceUnitTest.gnu' to view output");
123  helpers::writeToFile("SinterForceUnitTest.gnu",
124  "set xlabel 'displacement'\n"
125  "set ylabel 'force'\n"
126  "plot 'SinterForceUnitTest1.05.fstat' u 7:9 w lp\n"
127  );
128 
129  logger(INFO, "Execute 'gnuplot LongSinterForceUnitTest.gnu' to view output");
130  helpers::writeToFile("LongSinterForceUnitTest.gnu",
131  "sinterRate = 1000\n"
132  "radius = 2e-6\n"
133  "set xlabel 'time'\n"
134  "set ylabel 'displacement'\n"
135  "plot 'LongSinterForceUnitTest.fstat' u 1:(sqrt(2.0*$7/radius)), sqrt((sinterRate*x)+0.5**2)\n"
136  //"plot 'LongSinterForceUnitTest.fstat' u 1:(sqrt(2.0*$7/radius)), sqrt((2.0/radius*sinterRate*x)+0.77**2)\n"
137  //"plot 'LongSinterForceUnitTest.fstat' u 1:(sqrt(2.0*$7/radius)), sqrt(sinterRate*x)\n"
138  );
139 }
@ ONE_FILE
all data will be written into/ read from a single file called name_
double Mdouble
Definition: GeneralDefine.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.
void setSaveCount(unsigned int saveCount)
Sets File::saveCount_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:408
void setName(const std::string &name)
Allows to set the name of all the files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:422
Mdouble getTimeStep() const
Returns the simulation time step.
Definition: DPMBase.cc:1250
void setParticleDimensions(unsigned int particleDimensions)
Sets the particle dimensionality.
Definition: DPMBase.cc:1448
void setFileType(FileType fileType)
Sets File::fileType_ for all files (ene, data, fstat, restart, stat)
Definition: DPMBase.cc:459
virtual void writeRestartFile()
Stores all the particle data for current save time step to a "restart" file, which is a file simply i...
Definition: DPMBase.cc:2942
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 setSystemDimensions(unsigned int newDim)
Sets the system dimensionality.
Definition: DPMBase.cc:1417
void solve()
The work horse of the code.
Definition: DPMBase.cc:4270
void setDensity(Mdouble density)
Definition: ParticleSpecies.cc:108
Mdouble getDensity() const
Allows density_ to be accessed.
Definition: ParticleSpecies.cc:118
[T11:contactModel]
Definition: SinterForceUnitTest.cpp:36
SinterSpecies * species
Definition: SinterForceUnitTest.cpp:75
void set_chi(double new_)
Definition: SinterForceUnitTest.cpp:70
Mdouble radius
Definition: SinterForceUnitTest.cpp:74
double get_chi()
Definition: SinterForceUnitTest.cpp:71
const Mdouble pi
Definition: ExtendedMath.h:45
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51
bool writeToFile(std::string filename, std::string filecontent)
Writes a string to a file.
Definition: FileIOHelpers.cc:58
T cubic(const T val)
calculates the cube of a number
Definition: ExtendedMath.h:115

References mathsFunc::cubic(), SinterForceUnitTest::get_chi(), ParticleSpecies::getDensity(), DPMBase::getTimeStep(), constants::i, INFO, logger, ONE_FILE, constants::pi, SinterForceUnitTest::radius, SinterForceUnitTest::set_chi(), ParticleSpecies::setDensity(), DPMBase::setFileType(), DPMBase::setName(), DPMBase::setParticleDimensions(), DPMBase::setSaveCount(), DPMBase::setSystemDimensions(), DPMBase::setTimeMax(), DPMBase::setTimeStep(), DPMBase::solve(), SinterForceUnitTest::species, DPMBase::writeRestartFile(), and helpers::writeToFile().