Skip to content

Commit

Permalink
feat: numconc is input parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
yoctoyotta1024 committed Apr 29, 2024
1 parent 5f91ea0 commit 62afbdf
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
3 changes: 1 addition & 2 deletions libs/cartesiandomain/add_supers_at_domain_top.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ std::pair<size_t, double> 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
}
Expand All @@ -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)
}
12 changes: 7 additions & 5 deletions libs/cartesiandomain/add_supers_at_domain_top.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ struct CreateSuperdrop {
std::shared_ptr<Kokkos::Random_XorShift64<HostSpace>>
randgen; /**< pointer to Kokkos random number generator */
std::shared_ptr<Superdrop::IDType::Gen>
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<double> 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 */
Expand All @@ -74,9 +75,10 @@ struct CreateSuperdrop {
explicit CreateSuperdrop(const OptionalConfigParams::AddSupersAtDomainTopParams &config)
: randgen(std::make_shared<Kokkos::Random_XorShift64<HostSpace>>(std::random_device {}())),
sdIdGen(std::make_shared<Superdrop::IDType::Gen>(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};
Expand Down
2 changes: 2 additions & 0 deletions libs/initialise/optional_config_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,14 @@ void OptionalConfigParams::AddSupersAtDomainTopParams::set_params(const YAML::No
DRYRADIUS = node["DRYRADIUS"].as<double>();
MINRADIUS = node["MINRADIUS"].as<double>();
MAXRADIUS = node["MAXRADIUS"].as<double>();
NUMCONC = node["NUMCONC"].as<double>();
}

void OptionalConfigParams::AddSupersAtDomainTopParams::print_params() const {
std::cout << "\n-------- AddSupersAtDomainTop Configuration Parameters --------------"
<< "\ninitnsupers: " << initnsupers << "\nnewnsupers: " << newnsupers
<< "\nCOORD3LIM: " << COORD3LIM << "\nDRYRADIUS: " << DRYRADIUS
<< "\nMINRADIUS: " << MINRADIUS << "\nMAXRADIUS: " << MAXRADIUS
<< "\nNUMCONC: " << NUMCONC
<< "\n---------------------------------------------------------\n";
}
1 change: 1 addition & 0 deletions libs/initialise/optional_config_params.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
7 changes: 4 additions & 3 deletions src/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]

0 comments on commit 62afbdf

Please sign in to comment.