5 #ifndef MECURYDPM_PSD_H
6 #define MECURYDPM_PSD_H
133 unitScalingFactorRadii = 1.0);
225 Mdouble minPolydispersity = 0.1)
274 double scaleParticleSizeAuto(
int numberOfParticles,
double targetVolume,
bool allowScaleDown =
false);
#define MERCURYDPM_DEPRECATED
Definition: GeneralDefine.h:16
float * p
Definition: Tutorial_Map_using.cpp:9
class of DistributionElements which stores internalVariables and probabilities of a distribution....
Definition: DistributionElements.h:13
Contains a vector with radii and probabilities of a user defined particle size distribution (PSD)
Definition: PSD.h:47
Mdouble getRadius(int index) const
get a radius at a certain index of the particleSizeDistribution_
Definition: PSD.cc:1254
void setDistributionNormal(Mdouble mean, Mdouble standardDeviation, int numberOfBins)
create a PSD vector for a normal distribution.
Definition: PSD.cc:318
void cutoffCumulativeDistribution(TYPE CDFType, Mdouble quantileMin, Mdouble quantileMax, Mdouble minPolydispersity=0.1)
Cut off the PSD at the given quantiles, with the PSD in the provided CDF form.
Definition: PSD.cc:821
Mdouble drawSample()
Draw a sample radius from a CUMULATIVE_NUMBER_DISTRIBUTION.
Definition: PSD.cc:92
MERCURYDPM_DEPRECATED void convertProbabilityDensityNumberDistributionToProbabilityDensityVolumeDistribution()
convert a PROBABILITYDENSITY_NUMBER_DISTRIBUTION to a PROBABILITYDENSITY_VOLUME_DISTRIBUTION.
Definition: PSD.cc:762
Mdouble getVolumetricMeanRadius() const
get a volumetric mean radius of the PSD.
Definition: PSD.cc:977
Mdouble getQuantileByRadius(Mdouble radius) const
Calculates the quantile corresponding to a certain radius.
Definition: PSD.cc:961
friend bool operator<(const DistributionElements &l, const DistributionElements &r)
determines if a certain value of the PSD vector is lower than another one. Used for std::lower_bound(...
Definition: PSD.cc:1264
void convertCumulativeToCumulativeNumberDistribution(TYPE CDFType)
Convert any CDF to a CUMULATIVE_NUMBER_DISTRIBUTION.
Definition: PSD.cc:771
std::vector< DistributionElements > getParticleSizeDistributionByType(TYPE psdType, Mdouble scalingFactor=1.0) const
Gets the PSD vector, converted to the preferred type.
Definition: PSD.cc:1067
int getInsertedParticleNumber() const
Get the number of particles already inserted into the simulation.
Definition: PSD.cc:1190
Mdouble getMinRadius() const
Get smallest radius of the PSD.
Definition: PSD.cc:1037
void printPSD() const
Prints radii and probabilities of the PSD vector.
Definition: PSD.cc:54
void decrementVolumePerClass(Mdouble volume)
Decrement volumePerClass_ counter.
Definition: PSD.cc:1003
void convertProbabilityDensityNumberDistributionToProbabilityDensity(TYPE PDFType)
Convert a PROBABILITYDENSITY_NUMBER_DISTRIBUTION to any PDF.
Definition: PSD.cc:706
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:929
void scaleParticleSize(double scale)
Scales all particle sizes by a factor.
Definition: PSD.cc:1124
void convertCumulativeToProbabilityDensity()
Converts a CDF to a PDF by derivation.
Definition: PSD.cc:630
static PSD getDistributionNormal(Mdouble mean, Mdouble standardDeviation, int numberOfBins)
Definition: PSD.h:145
void decrementNParticlesPerClass()
Decrement nParticlesPerClass_ counter.
Definition: PSD.cc:993
Mdouble computeD50(std::vector< std::pair< Mdouble, Mdouble > > vectorOfPair)
compute the mass-based D_50 of the paired diameter and probabilityDensity.
Definition: PSD.cc:478
void setPSDFromCSV(const std::string &fileName, TYPE PSDType, bool headings=false, Mdouble unitScalingFactorRadii=1.0)
read in the PSD vector with probabilities and radii saved in a .csv file.
Definition: PSD.cc:590
friend std::ostream & operator<<(std::ostream &os, DistributionElements &p)
Writes to output stream.
Definition: PSD.cc:1304
friend std::istream & operator>>(std::istream &is, DistributionElements &p)
Reads from input stream.
Definition: PSD.cc:1293
Mdouble insertManuallyByVolume(Mdouble volume)
Draw sample radius manually per size class and check the volumeAllowed of each size class to insert t...
Definition: PSD.cc:117
void setDistributionLogNormal(Mdouble mean, Mdouble standardDeviation, int numberOfBins)
create a PSD vector for a normal distribution.
Definition: PSD.cc:353
void setFixedSeed(int seed)
set a fixed seed for the random number generator; this is used for the PSDSelfTest to reproduce resul...
Definition: PSD.h:380
double scaleParticleSizeAuto(int numberOfParticles, double targetVolume, bool allowScaleDown=false)
Scales all particle sizes, such that the total volume of N particles approximately equals the target ...
Definition: PSD.cc:1131
RNG random_
Definition: PSD.h:441
friend Mdouble operator==(DistributionElements l, Mdouble r)
Determines if a certain value of the PSD vector is equal to a double.
Definition: PSD.cc:1284
PSD * copy() const
Creates a copy on the heap and returns a pointer.
Definition: PSD.cc:42
PSD(std::unique_ptr< PSD > psdPtr)
Constructor; sets everything to 0 or default. This constructor is mainly used in MercuryPBM where sma...
Definition: PSD.h:77
void validateProbabilityDensityDistribution()
Validates if the integral of the PDF equals to unity.
Definition: PSD.cc:246
std::vector< Mdouble > volumePerClass_
Definition: PSD.h:431
~PSD()
Destructor; default destructor.
void convertCumulativeNumberDistributionToCumulative(TYPE CDFType)
Convert a CUMULATIVE_NUMBER_DISTRIBUTION to any CDF.
Definition: PSD.cc:794
PSD()
Constructor; sets everything to 0 or default.
Definition: PSD.cc:10
void convertProbabilityDensityToCumulative()
Converts a PDF to a CDF by integration.
Definition: PSD.cc:615
std::vector< int > nParticlesPerClass_
Definition: PSD.h:422
void convertProbabilityDensityToProbabilityDensityNumberDistribution(TYPE PDFType)
Convert any PDF to a PROBABILITYDENSITY_NUMBER_DISTRIBUTION.
Definition: PSD.cc:649
std::vector< DistributionElements > particleSizeDistribution_
Definition: PSD.h:415
std::vector< DistributionElements > getParticleSizeDistribution() const
Get the PSD vector.
Definition: PSD.cc:1055
std::vector< std::pair< Mdouble, Mdouble > > convertPdfPhiToPdfMeter(Mdouble meaninPhi, Mdouble standardDeviationinPhi, int numberOfBins)
compute central momenta of the user defined PSD. / void computeCentralMomenta();
Definition: PSD.cc:446
void cutoffAndSqueezeCumulativeDistribution(TYPE CDFType, Mdouble quantileMin, Mdouble quantileMax, Mdouble squeeze, Mdouble minPolydispersity=0.1)
Cut off the PSD at the given quantiles, with the PSD in the provided CDF form, and make it less polyd...
Definition: PSD.cc:863
Mdouble getNumberDx(Mdouble x) const
Calculate a certain diameter (e.g. D10, D50, D90, etc.) from a percentile x of the number based PSD.
Definition: PSD.cc:892
Mdouble getMaxRadius() const
Get largest radius of the PSD.
Definition: PSD.cc:1046
TYPE
Enum class which stores the possible types of CDFs and PDFs. Particle size distributions can be repre...
Definition: PSD.h:56
@ PROBABILITYDENSITY_VOLUME_DISTRIBUTION
@ CUMULATIVE_AREA_DISTRIBUTION
@ CUMULATIVE_VOLUME_DISTRIBUTION
@ PROBABILITYDENSITY_NUMBER_DISTRIBUTION
@ PROBABILITYDENSITY_LENGTH_DISTRIBUTION
@ PROBABILITYDENSITY_AREA_DISTRIBUTION
@ CUMULATIVE_LENGTH_DISTRIBUTION
@ CUMULATIVE_NUMBER_DISTRIBUTION
void cutHighSizeRatio()
Check if the size ratio is too high and cut it.
Definition: PSD.cc:1023
int index_
Definition: PSD.h:436
void setPSDFromVector(std::vector< DistributionElements > psd, TYPE PSDType)
Sets the PSD from a vector with DistributionElements.
Definition: PSD.cc:513
Mdouble getAreaDx(Mdouble x) const
Calculate a certain diameter (e.g. D10, D50, D90, etc.) from a percentile x of the area based PSD.
Definition: PSD.cc:916
Mdouble getLengthDx(Mdouble x) const
Calculate a certain diameter (e.g. D10, D50, D90, etc.) from a percentile x of the length based PSD.
Definition: PSD.cc:903
static PSD getDistributionLogNormal(Mdouble mean, Mdouble standardDeviation, int numberOfBins)
Definition: PSD.h:156
Mdouble getSizeRatio() const
get the size ratio (width) of the PSD.
Definition: PSD.cc:1012
static std::vector< Mdouble > linspace(Mdouble Min, Mdouble Max, int numberOfBins)
create a vector of linearly spaced values.
MERCURYDPM_DEPRECATED void cutoffCumulativeNumber(Mdouble quantileMin, Mdouble quantileMax, Mdouble minPolydispersity=0.1)
cutoff the PSD at given quantiles.
Definition: PSD.h:209
void validateCumulativeDistribution()
Validates if a CDF starts with zero and adds up to unity.
Definition: PSD.cc:191
MERCURYDPM_DEPRECATED void cutoffAndSqueezeCumulative(Mdouble quantileMin, Mdouble quantileMax, Mdouble squeeze, Mdouble minPolydispersity=0.1)
cutoff the PSD at given quantiles and make it less polydisperse by squeezing it.
Definition: PSD.h:224
Mdouble getRadiusByQuantile(Mdouble quantile) const
Calculate the quantile of the PSD.
Definition: PSD.cc:942
void setDistributionPhiNormal(Mdouble D50, Mdouble standardDeviationinPhi, int numberOfBins)
create a PSD vector for a normal distribution in Phi Units that has the demanded D50.
Definition: PSD.cc:393
void setDistributionUniform(Mdouble radMin, Mdouble radMax, int numberOfBins)
create a PSD vector for a uniform distribution.
Definition: PSD.cc:294
MERCURYDPM_DEPRECATED void setParticleSizeDistribution(std::vector< DistributionElements >)
set the PSD by a suitable vector.
Definition: PSD.cc:1119
This is a class that generates random numbers i.e. named the Random Number Generator (RNG).
Definition: RNG.h:32
void setRandomSeed(unsigned long int new_seed)
This is the seed for the random number generator (note the call to seed_LFG is only required really i...
Definition: RNG.cc:32
T square(const T val)
squares a number
Definition: ExtendedMath.h:86
T cubic(const T val)
calculates the cube of a number
Definition: ExtendedMath.h:95
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
list x
Definition: plotDoE.py:28