26 #ifndef MERCURY_MATERIAL_H
27 #define MERCURY_MATERIAL_H
48 void setPSD(
int argc,
char *argv[]) {
49 for (
unsigned i=0;
i<argc-1; ++
i) {
50 if (!strcmp(argv[
i],
"-psd")) {
51 std::vector<DistributionElements> psdVector;
54 if (!strcmp(argv[
i + 1],
"logNormal"))
56 logger.assert_debug(argc >
i + 5,
"Error in logNormal");
58 double meanX = std::atof(argv[
i + 4]);
59 double stdX = std::atof(argv[
i + 5]);
60 if (!strcmp(argv[
i + 3],
"radius"))
63 else if (!strcmp(argv[
i + 3],
"diameter"))
68 logger(
ERROR,
"setPSD: distribution type % not known", argv[
i+3]);
70 double meanX2 = meanX*meanX;
71 double stdX2 = stdX*stdX;
72 double mean =
log(meanX2/sqrt(meanX2+stdX2));
73 double std = sqrt(
log(1+stdX2/meanX2));
74 double lnRMin = mean-2.5*std;
75 double lnRMax = mean+2.5*std;
77 psdVector.push_back({0.5*
exp(lnRMin), 0});
79 for (
int j = 1; j <
n; ++j) {
80 double lnR = lnRMin + j / (
double)
n * (lnRMax - lnRMin);
82 value.
probability = 0.5 * (1.0 + erf((lnR - mean) / (sqrt(2) * std)));
83 psdVector.push_back(value);
87 psdVector.push_back({0.5*
exp(lnRMax), 1});
88 if (!strcmp(argv[
i+2],
"number")) {
90 }
else if (!strcmp(argv[
i+2],
"volume")) {
93 logger(
ERROR,
"setPSD: distribution type % not known", argv[
i+2]);
98 for (
unsigned j=
i+4; j<argc-1 && argv[j][0]!=
'-' && argv[j+1][0]!=
'-'; j+=2) {
99 if (!strcmp(argv[
i+3],
"radius")) {
101 }
else if (!strcmp(argv[
i+3],
"diameter")) {
104 logger(
ERROR,
"setPSD: distribution type % not known", argv[
i+3]);
107 psdVector.push_back(value);
109 if (!strcmp(argv[
i+1],
"cumulative")) {
110 if (!strcmp(argv[
i+2],
"number")) {
112 }
else if (!strcmp(argv[
i+2],
"volume")) {
115 logger(
ERROR,
"setPSD: distribution type % not known", argv[
i+1]);
117 }
else if (!strcmp(argv[
i+1],
"probability")) {
118 if (!strcmp(argv[
i+2],
"number")) {
120 }
else if (!strcmp(argv[
i+2],
"volume")) {
123 logger(
ERROR,
"setPSD: distribution type % not known", argv[
i+1]);
126 logger(
ERROR,
"setPSD: distribution type % not known", argv[
i+2]);
132 Mdouble particleRadius = 1.5e-3;
134 logger(
WARN,
"-psd argument not found; using default psd");
141 double restitutionCoefficient =
readFromCommandLine(argc,argv,
"-restitutionCoefficient",0.5);
151 species->setDensity(density);
153 species->setConstantRestitution(constantRestitution);
157 species->setCollisionTimeAndRestitutionCoefficient(collisionTime, restitutionCoefficient, massMin);
159 species->setSlidingFrictionCoefficient(slidingFriction);
160 species->setSlidingStiffness(2. / 7. * species->getStiffness());
161 species->setSlidingDissipation(2. / 7. * species->getDissipation());
162 species->setRollingFrictionCoefficient(rollingFriction);
163 species->setRollingStiffness(2. / 5. * species->getStiffness());
164 species->setRollingDissipation(2. / 5. * species->getDissipation());
165 species->setTorsionFrictionCoefficient(torsionFriction);
166 species->setTorsionStiffness(2. / 5. * species->getStiffness());
167 species->setTorsionDissipation(2. / 5. * species->getDissipation());
169 species->setAdhesionStiffness(species->getStiffness());
170 species->setAdhesionForceMax(9.8*massD50*bondNumber);
173 setTimeStep(0.05 * species->getCollisionTime(massMin));
178 mixedSpecies->setRollingFrictionCoefficient(0.0);
179 mixedSpecies->setSlidingFrictionCoefficient(0.0);
180 mixedSpecies->setAdhesionForceMax(0.0);
185 mixedSpecies->setRollingFrictionCoefficient(std::max(1.0,species->getSlidingFrictionCoefficient()));
186 mixedSpecies->setSlidingFrictionCoefficient(std::max(1.0,species->getRollingFrictionCoefficient()));
187 mixedSpecies->setAdhesionForceMax(0.0);
const unsigned n
Definition: CG3DPackingUnitTest.cpp:32
Species< LinearViscoelasticNormalSpecies, FrictionSpecies, ReversibleAdhesiveSpecies > LinearViscoelasticFrictionReversibleAdhesiveSpecies
Definition: LinearViscoelasticFrictionReversibleAdhesiveSpecies.h:35
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
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1427
Mdouble getTimeStep() const
Returns the simulation time step.
Definition: DPMBase.cc:1250
void setTimeStep(Mdouble newDt)
Sets a new value for the simulation time step.
Definition: DPMBase.cc:1234
class of DistributionElements which stores internalVariables and probabilities of a distribution....
Definition: DistributionElements.h:34
Mdouble internalVariable
Definition: DistributionElements.h:36
Mdouble probability
Definition: DistributionElements.h:37
Definition: Material.h:33
ParticleSpecies * frictionlessWallSpecies
Definition: Material.h:38
PSD psd
Definition: Material.h:35
Material(int argc, char *argv[])
Definition: Material.h:40
void setPSD(int argc, char *argv[])
Definition: Material.h:48
ParticleSpecies * frictionalWallSpecies
Definition: Material.h:37
ParticleSpecies * particleSpecies
Definition: Material.h:36
void setSpecies(int argc, char *argv[])
Definition: Material.h:138
This adds on the hierarchical grid code for 3D problems.
Definition: Mercury3D.h:37
Contains a vector with radii and probabilities of a user defined particle size distribution (PSD)
Definition: PSD.h:65
Mdouble getMinRadius() const
Get smallest radius of the PSD.
Definition: PSD.cc:886
Mdouble getVolumeDx(Mdouble x) const
Calculate a certain diameter (e.g. D10, D50, D90, etc.) from a percentile x of the volume based PSD.
Definition: PSD.cc:777
static PSD getDistributionNormal(Mdouble mean, Mdouble standardDeviation, int numberOfBins)
Definition: PSD.h:153
@ PROBABILITYDENSITY_VOLUME_DISTRIBUTION
@ CUMULATIVE_VOLUME_DISTRIBUTION
@ PROBABILITYDENSITY_NUMBER_DISTRIBUTION
@ CUMULATIVE_NUMBER_DISTRIBUTION
MERCURYDPM_DEPRECATED void setPSDFromVector(std::vector< DistributionElements > psd, TYPE PSDType)
Deprecated version of reading in PSDs from a vector.
Definition: PSD.cc:396
Definition: ParticleSpecies.h:37
std::enable_if<!std::is_pointer< typename U::MixedSpeciesType >::value, typename U::MixedSpeciesType * >::type getMixedObject(const U *S, const U *T)
Definition: SpeciesHandler.h:74
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51
bool readFromCommandLine(int argc, char *argv[], std::string varName)
Returns true if command line arguments contain varName, false else.
Definition: CommandLineHelpers.cc:103
Mdouble log(Mdouble Power)
Definition: ExtendedMath.cc:104
Mdouble exp(Mdouble Exponent)
Definition: ExtendedMath.cc:84