26 #ifndef MECURYDPM_PSD_H
27 #define MECURYDPM_PSD_H
141 unitScalingFactorRadii = 1.0);
204 Mdouble minPolydispersity = 0.1);
double Mdouble
Definition: GeneralDefine.h:34
#define MERCURYDPM_DEPRECATED
Definition: GeneralDefine.h:37
class of DistributionElements which stores internalVariables and probabilities of a distribution....
Definition: DistributionElements.h:34
Contains a vector with radii and probabilities of a user defined particle size distribution (PSD)
Definition: PSD.h:65
Mdouble getRadius(int index) const
get a radius at a certain index of the particleSizeDistribution_
Definition: PSD.cc:987
void setDistributionNormal(Mdouble mean, Mdouble standardDeviation, int numberOfBins)
create a PSD vector for a normal distribution.
Definition: PSD.cc:323
Mdouble drawSample()
Draw a sample radius from a CUMULATIVE_NUMBER_DISTRIBUTION.
Definition: PSD.cc:114
Mdouble getVolumetricMeanRadius() const
get a volumetric mean radius of the PSD.
Definition: PSD.cc:826
Mdouble getQuantileByRadius(Mdouble radius) const
Calculates the quantile corresponding to a certain radius.
Definition: PSD.cc:810
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:1020
void convertCumulativeToCumulativeNumberDistribution(TYPE CDFType)
convert any other CDF to a CUMULATIVE_NUMBER_DISTRIBUTION.
Definition: PSD.cc:656
int getInsertedParticleNumber() const
Get the number of particles already inserted into the simulation.
Definition: PSD.cc:923
Mdouble getMinRadius() const
Get smallest radius of the PSD.
Definition: PSD.cc:886
void printPSD() const
Prints radii and probabilities of the PSD vector.
Definition: PSD.cc:76
void decrementVolumePerClass(Mdouble volume)
Decrement volumePerClass_ counter.
Definition: PSD.cc:852
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
void convertCumulativeToProbabilityDensity()
Converts a CDF to a PDF by derivation.
Definition: PSD.cc:546
static PSD getDistributionNormal(Mdouble mean, Mdouble standardDeviation, int numberOfBins)
Definition: PSD.h:153
void decrementNParticlesPerClass()
Decrement nParticlesPerClass_ counter.
Definition: PSD.cc:842
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:462
friend std::ostream & operator<<(std::ostream &os, DistributionElements &p)
Writes to output stream.
Definition: PSD.cc:1060
friend std::istream & operator>>(std::istream &is, DistributionElements &p)
Reads from input stream.
Definition: PSD.cc:1049
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:139
void setDistributionLogNormal(Mdouble mean, Mdouble standardDeviation, int numberOfBins)
create a PSD vector for a normal distribution.
Definition: PSD.cc:357
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:309
RNG random_
Definition: PSD.h:370
friend Mdouble operator==(DistributionElements l, Mdouble r)
Determines if a certain value of the PSD vector is equal to a double.
Definition: PSD.cc:1040
PSD * copy() const
Creates a copy on the heap and returns a pointer.
Definition: PSD.cc:64
void validateProbabilityDensityDistribution()
Validates if the integral of the PDF equals to unity.
Definition: PSD.cc:260
std::vector< Mdouble > volumePerClass_
Definition: PSD.h:360
~PSD()
Destructor; default destructor.
PSD()
Constructor; sets everything to 0 or default.
Definition: PSD.cc:32
void convertProbabilityDensityToCumulative()
Converts a PDF to a CDF by integration.
Definition: PSD.cc:531
std::vector< int > nParticlesPerClass_
Definition: PSD.h:351
void convertProbabilityDensityToProbabilityDensityNumberDistribution(TYPE PDFType)
convert any PDF to a PROBABILITYDENSITY_NUMBER_DISTRIBUTION.
Definition: PSD.cc:566
std::vector< DistributionElements > particleSizeDistribution_
Definition: PSD.h:344
std::vector< DistributionElements > getParticleSizeDistribution() const
Get the PSD vector.
Definition: PSD.cc:904
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:767
Mdouble getMaxRadius() const
Get largest radius of the PSD.
Definition: PSD.cc:895
TYPE
Enum class which stores the possible types of CDFs and PDFs. Particle size distributions can be repre...
Definition: PSD.h:74
@ 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:872
int index_
Definition: PSD.h:365
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.cc:749
static PSD getDistributionLogNormal(Mdouble mean, Mdouble standardDeviation, int numberOfBins)
Definition: PSD.h:164
Mdouble getSizeRatio() const
get the size ratio (width) of the PSD.
Definition: PSD.cc:861
void validateCumulativeDistribution()
Validates if a CDF starts with zero and adds up to unity.
Definition: PSD.cc:213
Mdouble getRadiusByQuantile(Mdouble quantile) const
Calculate the quantile of the PSD.
Definition: PSD.cc:791
void convertProbabilityDensityNumberDistributionToProbabilityDensityVolumeDistribution()
convert a PROBABILITYDENSITY_NUMBER_DISTRIBUTION to a PROBABILITYDENSITY_VOLUME_DISTRIBUTION.
Definition: PSD.cc:630
void cutoffCumulativeNumber(Mdouble quantileMin, Mdouble quantileMax, Mdouble minPolydispersity=0.1)
cutoff the PSD at given quantiles.
Definition: PSD.cc:715
MERCURYDPM_DEPRECATED void setPSDFromVector(std::vector< DistributionElements > psd, TYPE PSDType)
Deprecated version of reading in PSDs from a vector.
Definition: PSD.cc:396
static std::vector< Mdouble > linspace(Mdouble Min, Mdouble Max, int numberOfBins)
compute central momenta of the user defined PSD. / void computeCentralMomenta();
Definition: PSD.cc:999
void setDistributionUniform(Mdouble radMin, Mdouble radMax, int numberOfBins)
create a PSD vector for a uniform distribution.
Definition: PSD.cc:299
void setParticleSizeDistribution(std::vector< DistributionElements >)
set the PSD by a suitable vector.
Definition: PSD.cc:913
This is a class that generates random numbers i.e. named the Random Number Generator (RNG).
Definition: RNG.h:53
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:53
T square(const T val)
squares a number
Definition: ExtendedMath.h:106
T cubic(const T val)
calculates the cube of a number
Definition: ExtendedMath.h:115