From 62afbdf40fd1ed07c6f0d5c0a7b2e1fcf26aa4df Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Mon, 29 Apr 2024 20:30:03 +0200 Subject: [PATCH] feat: numconc is input parameter --- libs/cartesiandomain/add_supers_at_domain_top.cpp | 3 +-- libs/cartesiandomain/add_supers_at_domain_top.hpp | 12 +++++++----- libs/initialise/optional_config_params.cpp | 2 ++ libs/initialise/optional_config_params.hpp | 1 + src/config/config.yaml | 7 ++++--- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/libs/cartesiandomain/add_supers_at_domain_top.cpp b/libs/cartesiandomain/add_supers_at_domain_top.cpp index 994bb6155..0925c4163 100644 --- a/libs/cartesiandomain/add_supers_at_domain_top.cpp +++ b/libs/cartesiandomain/add_supers_at_domain_top.cpp @@ -138,7 +138,7 @@ std::pair CreateSuperdrop::new_xi_radius(const double gbxvolume) const auto log10r = double{log10rlow + frac * log10rwidth}; const auto radius = double{Kokkos::pow(10.0, log10r)}; - const auto xi = droplet_numconc_distribution(log10r, log10rwidth) * gbxvolume; + const size_t xi = std::round(droplet_numconc_distribution(log10r, log10rwidth) * gbxvolume); return std::make_pair(xi, radius); // xi_radius } @@ -158,6 +158,5 @@ double CreateSuperdrop::new_msol(const double radius) const { distribution for a bin of width log10rwidth in log_10(r) space centred at log_10(r). */ double CreateSuperdrop::droplet_numconc_distribution(const double log10r, const double log10rwidth) const { - const double numconc = 100 / dlc::COORD0 / dlc::COORD0 / dlc::COORD0; return numconc; // number of droplets per unit volume of size log_10(r) } diff --git a/libs/cartesiandomain/add_supers_at_domain_top.hpp b/libs/cartesiandomain/add_supers_at_domain_top.hpp index e0241192c..09193cfbc 100644 --- a/libs/cartesiandomain/add_supers_at_domain_top.hpp +++ b/libs/cartesiandomain/add_supers_at_domain_top.hpp @@ -46,10 +46,11 @@ struct CreateSuperdrop { std::shared_ptr> randgen; /**< pointer to Kokkos random number generator */ std::shared_ptr - sdIdGen; /**< Pointer Superdrop::IDType object for super-droplet ID generation. */ - double dryradius; /**< dry radius of new superdrop */ - size_t nbins; /**< number of bins for sampling superdroplet radius */ + sdIdGen; /**< Pointer Superdrop::IDType object for super-droplet ID generation. */ + size_t nbins; /**< number of bins for sampling superdroplet radius */ std::vector log10redges; /**< edges of bins for superdroplet log_10(radius) */ + double dryradius; /**< dry radius of new superdrop */ + double numconc; /**< number concentration of new droplets*/ /* create spatial coordinates for super-droplet by setting coord1 = coord2 = 0.0 and coord3 to a random value within the gridbox's bounds */ @@ -74,9 +75,10 @@ struct CreateSuperdrop { explicit CreateSuperdrop(const OptionalConfigParams::AddSupersAtDomainTopParams &config) : randgen(std::make_shared>(std::random_device {}())), sdIdGen(std::make_shared(config.initnsupers)), - dryradius(config.DRYRADIUS / dlc::R0), nbins(config.newnsupers), - log10redges() { + log10redges(), + dryradius(config.DRYRADIUS / dlc::R0), + numconc(config.NUMCONC * 100 * dlc::VOL0) { const auto log10rmin = std::log10(config.MINRADIUS / dlc::R0); const auto log10rmax = std::log10(config.MAXRADIUS / dlc::R0); const auto log10deltar = double{(log10rmax - log10rmin) / nbins}; diff --git a/libs/initialise/optional_config_params.cpp b/libs/initialise/optional_config_params.cpp index 1bf389676..7da9a19d6 100644 --- a/libs/initialise/optional_config_params.cpp +++ b/libs/initialise/optional_config_params.cpp @@ -195,6 +195,7 @@ void OptionalConfigParams::AddSupersAtDomainTopParams::set_params(const YAML::No DRYRADIUS = node["DRYRADIUS"].as(); MINRADIUS = node["MINRADIUS"].as(); MAXRADIUS = node["MAXRADIUS"].as(); + NUMCONC = node["NUMCONC"].as(); } void OptionalConfigParams::AddSupersAtDomainTopParams::print_params() const { @@ -202,5 +203,6 @@ void OptionalConfigParams::AddSupersAtDomainTopParams::print_params() const { << "\ninitnsupers: " << initnsupers << "\nnewnsupers: " << newnsupers << "\nCOORD3LIM: " << COORD3LIM << "\nDRYRADIUS: " << DRYRADIUS << "\nMINRADIUS: " << MINRADIUS << "\nMAXRADIUS: " << MAXRADIUS + << "\nNUMCONC: " << NUMCONC << "\n---------------------------------------------------------\n"; } diff --git a/libs/initialise/optional_config_params.hpp b/libs/initialise/optional_config_params.hpp index f281e300e..3c26f3ad7 100644 --- a/libs/initialise/optional_config_params.hpp +++ b/libs/initialise/optional_config_params.hpp @@ -118,6 +118,7 @@ struct OptionalConfigParams { double DRYRADIUS = NaNVals::dbl(); /**< dry radius of new super-droplets (for msol) [m] */ double MINRADIUS = NaNVals::dbl(); /**< minimum radius of new super-droplets [m] */ double MAXRADIUS = NaNVals::dbl(); /**< maximum radius of new super-droplets [m] */ + double NUMCONC = NaNVals::dbl(); /**< number concentration of new droplets [cm^-3] */ } addsupersatdomaintop; }; diff --git a/src/config/config.yaml b/src/config/config.yaml index 6729856ee..90b63da01 100644 --- a/src/config/config.yaml +++ b/src/config/config.yaml @@ -76,8 +76,9 @@ coupled_dynamics: ### Bounday Conditions Parameters ### boundary_conditions: type: addsupersatdomaintop - COORD3LIM: 805 # SDs added to domain with coord3 >= COORD3LIM [m] + COORD3LIM: 800 # SDs added to domain with coord3 >= COORD3LIM [m] newnsupers: 256 # number SDs to add to each gridbox above COORD3LIM DRYRADIUS: 1e-9 # dry radius of new super-droplets (for solute mass) [m] - MINRADIUS: 1e-6 # minimum radius of new super-droplets [m] - MAXRADIUS: 1e-3 # maximum radius of new super-droplets [m] + MINRADIUS: 1e-7 # minimum radius of new super-droplets [m] + MAXRADIUS: 1e-4 # maximum radius of new super-droplets [m] + NUMCONC: 1e6 # number concentration of new droplets [cm^-3]