Class which stores radii and probabilities of a PSD. This class should be used as a vector
void computeStandardisedMomenta()
compute standardised momenta of the user defined PSD.
friend bool operator<(const PSD::RadiusAndProbability &l, const PSD::RadiusAndProbability &r)
determines if a certain value of the PSD vector is lower than another one. Used for std::lower_bound(...
MERCURY_DEPRECATED void setPSDFromVector(std::vector< RadiusAndProbability > psd, TYPE PSDType)
Deprecated version of reading in PSDs from a vector.
std::vector< RadiusAndProbability > getParticleSizeDistribution() const
Get the PSD vector.
~PSD()
Destructor; default destructor.
friend std::istream & operator>>(std::istream &is, PSD::RadiusAndProbability &p)
Reads from input stream.
friend std::ostream & operator<<(std::ostream &os, PSD::RadiusAndProbability &p)
Writes to output stream.
void computeCentralMomenta()
compute central momenta of the user defined PSD.
std::vector< int > nParticlesPerClass_
void setDistributionNormal(Mdouble mean, Mdouble standardDeviation, int numberOfBins)
create a PSD vector for a normal distribution.
void convertCumulativeToCumulativeNumberDistribution(TYPE CDFType)
convert any other CDF to a CUMULATIVE_NUMBER_DISTRIBUTION.
void convertProbabilityDensityNumberDistributionToProbabilityDensityVolumeDistribution()
convert a PROBABILITYDENSITY_NUMBER_DISTRIBUTION to a PROBABILITYDENSITY_VOLUME_DISTRIBUTION.
friend Mdouble operator==(PSD::RadiusAndProbability l, Mdouble r)
Determines if a certain value of the PSD vector is equal to a double.
Mdouble insertManuallyByVolume(Mdouble volume)
Draw sample radius manually per size class and check the volumeAllowed of each size class to insert t...
TYPE
Enum class which stores the possible types of CDFs and PDFs. Particle size distributions can be repre...
void validateCumulativeDistribution()
Validates if a CDF starts with zero and adds up to unity.
T cubic(const T val)
calculates the cube of a number
void setParticleSizeDistribution(std::vector< RadiusAndProbability >)
set the PSD by a suitable vector.
#define MERCURY_DEPRECATED
PSD * copy() const
Creates a copy on the heap and returns a pointer.
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.
std::array< Mdouble, 6 > momenta_
int getInsertedParticleNumber() const
Get the number of particles already inserted into the simulation.
void validateProbabilityDensityDistribution()
Validates if the integral of the PDF equals to unity.
Mdouble getRadiusByQuantile(Mdouble quantile) const
Calculate the quantile of the PSD.
Mdouble getMinRadius() const
Get smallest radius of the PSD.
Mdouble drawSample()
Draw a sample radius from a CUMULATIVE_NUMBER_DISTRIBUTION.
void setDistributionUniform(Mdouble radMin, Mdouble radMax, int numberOfBins)
create a PSD vector for a uniform distribution.
void cutoffCumulativeNumber(Mdouble quantileMin, Mdouble quantileMax, Mdouble minPolydispersity=0.1)
cutoff the PSD at given quantiles.
std::vector< RadiusAndProbability > particleSizeDistribution_
std::vector< Mdouble > volumePerClass_
void printPSD() const
Prints radii and probabilities of the PSD vector.
void convertProbabilityDensityToProbabilityDensityNumberDistribution(TYPE PDFType)
convert any PDF to a PROBABILITYDENSITY_NUMBER_DISTRIBUTION.
void convertCumulativeToProbabilityDensity()
Converts a CDF to a PDF by derivation.
Mdouble getVolumeDx(Mdouble x) const
Calculate a certain diameter (e.g. D10, D50, D90, etc.) from a percentile x of the volume based PSD...
Mdouble getVolumetricMeanRadius() const
get a volumetric mean radius of the PSD.
Mdouble getNumberDx(Mdouble x) const
Calculate a certain diameter (e.g. D10, D50, D90, etc.) from a percentile x of the number based PSD...
Contains a vector with radii and probabilities of a user defined particle size distribution (PSD) ...
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.
Mdouble getSizeRatio() const
get the size ratio (width) of the PSD.
void convertProbabilityDensityToCumulative()
Converts a PDF to a CDF by integration.
T square(const T val)
squares a number
Mdouble getMaxRadius() const
Get largest radius of the PSD.
std::array< Mdouble, 6 > getMomenta() const
get momenta of the user defined PSD.
void cutHighSizeRatio()
Check if the size ratio is too high and cut it.
void computeRawMomenta()
compute raw momenta of the user defined PSD.