Skip to content

Commit

Permalink
Fix particle size distributions
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-germer committed May 29, 2018
1 parent 422eb21 commit 3a37e6f
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 13 deletions.
2 changes: 1 addition & 1 deletion code/phasefunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ DEFINE_MODEL(Distributed_Mie_Phase_Function, Polarized_Phase_Function, "A phase
DEFINE_PARAMETER(Distributed_Mie_Phase_Function, double, lambda, "Wavelength [um]", "0.532", 0xFF);
DEFINE_PARAMETER(Distributed_Mie_Phase_Function, dielectric_function, medium, "Medium surrounding spheres", "(1.33,0)", 0xFF);
DEFINE_PARAMETER(Distributed_Mie_Phase_Function, dielectric_function, sphere, "Sphere medium", "(1,0)", 0xFF);
DEFINE_PTRPARAMETER(Distributed_Mie_Phase_Function, VolumeParticleSizeDistribution_Ptr, distribution, "Size distribution", "VolumeParticleSizeDistribution", 0xFF);
DEFINE_PTRPARAMETER(Distributed_Mie_Phase_Function, VolumeParticleSizeDistribution_Ptr, distribution, "Size distribution", "Regular_VolumeParticleSizeDistribution", 0xFF);
DEFINE_PARAMETER(Distributed_Mie_Phase_Function, double, integralStart, "Start diameter for integration [um]", "0.1", 0xFF);
DEFINE_PARAMETER(Distributed_Mie_Phase_Function, double, integralEnd, "End diameter for integration [um]", "100", 0xFF);
DEFINE_PARAMETER(Distributed_Mie_Phase_Function, double, integralStep, "Fractional step diameter for integration", "0.01", 0xFF);
Expand Down
2 changes: 1 addition & 1 deletion code/polydisperse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ mueller()
}

DEFINE_MODEL(Polydisperse_Sphere_BRDF_Model,BRDF_Model,"Double interaction theory with a Mie scatterer and polydispersity.");
DEFINE_PTRPARAMETER(Polydisperse_Sphere_BRDF_Model,SurfaceParticleSizeDistribution_Ptr,distribution,"Size distribution","SurfaceParticleSizeDistribution",0xFF);
DEFINE_PTRPARAMETER(Polydisperse_Sphere_BRDF_Model,SurfaceParticleSizeDistribution_Ptr,distribution,"Size distribution","Regular_SurfaceParticleSizeDistribution",0xFF);
DEFINE_PTRPARAMETER(Polydisperse_Sphere_BRDF_Model,StackModel_Ptr,stack,"Films on substrate","No_StackModel",0xFF);
DEFINE_PARAMETER(Polydisperse_Sphere_BRDF_Model,dielectric_function,particle,"Optical properties of the particle","(1.5,0.0)",0xFF);
DEFINE_PARAMETER(Polydisperse_Sphere_BRDF_Model,double,Dstart,"Starting diameter [um]","1",0xFF);
Expand Down
18 changes: 12 additions & 6 deletions code/sizedistribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,26 @@ namespace SCATMECH {
Register_Model(Weibull_Distribution);
Register_Model(Bimodal_Distribution);
Register_Model(VolumeParticleSizeDistribution);
Register_Model(Regular_VolumeParticleSizeDistribution);
Register_Model(SurfaceParticleSizeDistribution);
Register_Model(Regular_SurfaceParticleSizeDistribution);
Register_Model(CC1246E_SurfaceParticleSizeDistribution);
}
}

DEFINE_VIRTUAL_MODEL(Distribution, Model, "Base class for diameter distributions");

DEFINE_MODEL(VolumeParticleSizeDistribution, Model, "Volume particle size and number distribution");
DEFINE_PTRPARAMETER(VolumeParticleSizeDistribution, Distribution_Ptr, distribution, "Diameter distribution", "Log_Normal_Distribution", 0xFF);
DEFINE_PARAMETER(VolumeParticleSizeDistribution, double, numberdensity, "Volume number density [1/um^3]", "0.00001", 0xFF);
DEFINE_VIRTUAL_MODEL(VolumeParticleSizeDistribution, Model, "Volume particle size and number distribution");

DEFINE_MODEL(SurfaceParticleSizeDistribution, Model, "Surface particle size and number distribution");
DEFINE_PTRPARAMETER(SurfaceParticleSizeDistribution, Distribution_Ptr, distribution, "Diameter distribution","Log_Normal_Distribution",0xFF);
DEFINE_PARAMETER(SurfaceParticleSizeDistribution, double, numberdensity,"Surface number density [1/um^2]", "0.001", 0xFF);
DEFINE_MODEL(Regular_VolumeParticleSizeDistribution, VolumeParticleSizeDistribution, "Volume particle size and number distribution");
DEFINE_PTRPARAMETER(Regular_VolumeParticleSizeDistribution, Distribution_Ptr, distribution, "Diameter distribution", "Log_Normal_Distribution", 0xFF);
DEFINE_PARAMETER(Regular_VolumeParticleSizeDistribution, double, numberdensity, "Volume number density [1/um^3]", "0.00001", 0xFF);

DEFINE_VIRTUAL_MODEL(SurfaceParticleSizeDistribution, Model, "Surface particle size and number distribution");

DEFINE_MODEL(Regular_SurfaceParticleSizeDistribution, SurfaceParticleSizeDistribution, "Surface particle size and number distribution");
DEFINE_PTRPARAMETER(Regular_SurfaceParticleSizeDistribution, Distribution_Ptr, distribution, "Diameter distribution", "Log_Normal_Distribution", 0xFF);
DEFINE_PARAMETER(Regular_SurfaceParticleSizeDistribution, double, numberdensity, "Surface number density [1/um^2]", "0.001", 0xFF);

DEFINE_MODEL(Log_Normal_Distribution, Distribution, "Log-Normal distribution");
DEFINE_PARAMETER(Log_Normal_Distribution, double, sigma, "Standard deviation of log(diameter)", "1", 0xFF);
Expand Down
32 changes: 27 additions & 5 deletions code/sizedistribution.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,44 @@ namespace SCATMECH {
class VolumeParticleSizeDistribution : public Model {
public:
/// Returns the number of particles having diameter between D and D+dD, divided by dD.
virtual double volumedensity(double D) {
virtual double volumedensity(double D) = 0;

DECLARE_MODEL();
};

typedef Model_Ptr<VolumeParticleSizeDistribution> VolumeParticleSizeDistribution_Ptr;

///
/// @brief Volumetric particle diameter distribution that takes ad Distribution_Ptr
///
class Regular_VolumeParticleSizeDistribution : public Model {
public:
/// Returns the number of particles having diameter between D and D+dD, divided by dD.
virtual double volumedensity(double D) {
return distribution->pdf(D)*numberdensity;
};
DECLARE_MODEL();
DECLARE_PARAMETER(Distribution_Ptr, distribution); ///< The normalized size diameter distribution
DECLARE_PARAMETER(double, numberdensity); ///< The total number of particles divided by volume
};

typedef Model_Ptr<VolumeParticleSizeDistribution> VolumeParticleSizeDistribution_Ptr;

///
/// @brief Class for a particle diameter distribution on a surface
///
class SurfaceParticleSizeDistribution : public Model {
public:
/// Returns the number of particles having diameter between D and D+dD, divided by dD.
virtual double surfacedensity(double d) = 0;

DECLARE_MODEL();
};

typedef Model_Ptr<SurfaceParticleSizeDistribution> SurfaceParticleSizeDistribution_Ptr;

///
/// @brief SurfaceParticleSizeDistribution that takes a Distribution_Ptr
///
class Regular_SurfaceParticleSizeDistribution : public Model {
public:
/// Returns the number of particles having diameter between D and D+dD, divided by dD.
virtual double surfacedensity(double d) {
Expand All @@ -63,8 +87,6 @@ namespace SCATMECH {
DECLARE_PARAMETER(double, numberdensity); ///< The total number of particles divided by area
};

typedef Model_Ptr<SurfaceParticleSizeDistribution> SurfaceParticleSizeDistribution_Ptr;

///
/// @brief A log-normal distribution
///
Expand Down

0 comments on commit 3a37e6f

Please sign in to comment.