diff --git a/examples/boxmodelcollisions/shima2009.py b/examples/boxmodelcollisions/shima2009.py index f56395c24..5f8f1d1fc 100644 --- a/examples/boxmodelcollisions/shima2009.py +++ b/examples/boxmodelcollisions/shima2009.py @@ -78,7 +78,7 @@ samplevol = rgrid.calc_domainvol(zgrid, xgrid, ygrid) radiiprobdist = xiprobdistribs.VolExponential(volexpr0, rspan) -radiigen = coordgen.SampleDryradiiGen(rspan) # radii are sampled from rspan [m] +radiigen = coordgen.SampleLog10RadiiGen(rspan) # radii are sampled from rspan [m] coord3gen = None # do not generate superdroplet coords coord1gen = None coord2gen = None diff --git a/examples/constthermo2d/constthermo2d.py b/examples/constthermo2d/constthermo2d.py index 0eb578558..98723ebc8 100644 --- a/examples/constthermo2d/constthermo2d.py +++ b/examples/constthermo2d/constthermo2d.py @@ -137,7 +137,7 @@ coord1gen = iattrs.SampleCoordGen(True) # sample coord1 randomly coord2gen = None # do not generate superdroplet coord2s radiiprobdist = rprobs.LnNormal(geomeans, geosigs, scalefacs) -radiigen = iattrs.SampleDryradiiGen(rspan) # randomly sample radii from rspan [m] +radiigen = iattrs.SampleLog10RadiiGen(rspan) # randomly sample radii from rspan [m] initattrsgen = iattrs.InitManyAttrsGen(radiigen, radiiprobdist, coord3gen, coord1gen, coord2gen) diff --git a/examples/divfreemotion/divfree2d.py b/examples/divfreemotion/divfree2d.py index b57bf4710..a60893181 100644 --- a/examples/divfreemotion/divfree2d.py +++ b/examples/divfreemotion/divfree2d.py @@ -136,7 +136,7 @@ coord1gen = iattrs.SampleCoordGen(True) # sample coord1 randomly coord2gen = None # do not generate superdroplet coord2s radiiprobdist = rprobs.LnNormal(geomeans, geosigs, scalefacs) -radiigen = iattrs.SampleDryradiiGen(rspan) # randomly sample radii from rspan [m] +radiigen = iattrs.SampleLog10RadiiGen(rspan) # randomly sample radii from rspan [m] initattrsgen = iattrs.InitManyAttrsGen(radiigen, radiiprobdist, coord3gen, coord1gen, coord2gen) diff --git a/examples/speedtest/speedtest.py b/examples/speedtest/speedtest.py index c90a4e15d..864ede86e 100644 --- a/examples/speedtest/speedtest.py +++ b/examples/speedtest/speedtest.py @@ -193,7 +193,7 @@ def write_outstats(nruns, n, outdatafile, buildtype, stats): coord1gen = iattrs.SampleCoordGen(True) # sample coord1 randomly coord2gen = iattrs.SampleCoordGen(True) # sample coord2 randomly radiiprobdist = rprobs.LnNormal(geomeans, geosigs, scalefacs) -radiigen = iattrs.SampleDryradiiGen(rspan) # randomly sample radii from rspan [m] +radiigen = iattrs.SampleLog10RadiiGen(rspan) # randomly sample radii from rspan [m] initattrsgen = iattrs.InitManyAttrsGen(radiigen, radiiprobdist, coord3gen, coord1gen, coord2gen) diff --git a/libs/superdrops/coalescence.hpp b/libs/superdrops/coalescence.hpp index 70d216b18..67255dc10 100644 --- a/libs/superdrops/coalescence.hpp +++ b/libs/superdrops/coalescence.hpp @@ -6,7 +6,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Thursday 14th December 2023 + * Last Modified: Friday 22nd December 2023 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -40,7 +40,7 @@ struct DoCoalescence twin_superdroplet_coalescence(const unsigned long long gamma, Superdrop &drop1, Superdrop &drop2) const; - /* if xi1 = gamma*eps2 coalescence makes twin SDs + /* if xi1 = gamma*xi2 coalescence makes twin SDs with same xi, r and solute mass. According to Shima et al. 2009 Section 5.1.3. part (5) option (b) */ @@ -48,7 +48,7 @@ struct DoCoalescence different_superdroplet_coalescence(const unsigned long long gamma, Superdrop &drop1, Superdrop &drop2) const; - /* if xi1 > gamma*eps2 coalescence grows sd2 radius and mass + /* if xi1 > gamma*xi2 coalescence grows sd2 radius and mass via decreasing multiplicity of sd1. According to Shima et al. 2009 Section 5.1.3. part (5) option (a) */ diff --git a/pySD/initsuperdropsbinary_src/read_initsuperdrops.py b/pySD/initsuperdropsbinary_src/read_initsuperdrops.py index d283d08ad..dad004f5c 100644 --- a/pySD/initsuperdropsbinary_src/read_initsuperdrops.py +++ b/pySD/initsuperdropsbinary_src/read_initsuperdrops.py @@ -238,7 +238,7 @@ def plot_numconcdistrib(ax, hedgs, xi, radius, vol): def plot_masssolutedistrib(ax, hedgs, xi, radius, msol, vol): ''' get and plot frequency of real droplets in each log10(r) bin ''' - wghts = msol*eps/vol * 1000 / 1e6 # [g cm^-3] + wghts = msol*xi/vol * 1000 / 1e6 # [g cm^-3] hist, hedgs, hwdths, hcens = log10r_frequency_distribution( radius, hedgs, wghts) diff --git a/scripts/create_initsuperdropsbinary_script.py b/scripts/create_initsuperdropsbinary_script.py index adbbb0ae8..2c6e524a5 100644 --- a/scripts/create_initsuperdropsbinary_script.py +++ b/scripts/create_initsuperdropsbinary_script.py @@ -25,10 +25,12 @@ from pathlib import Path sys.path.append(sys.argv[1]) # path to pySD (same as to CLEO) -from pySD.initsuperdropsbinary_src import coordgen as iattrs +from pySD.initsuperdropsbinary_src import radiigen as rgens +from pySD.initsuperdropsbinary_src import coordgen as cgens from pySD.initsuperdropsbinary_src import probdistribs as rprobs from pySD.initsuperdropsbinary_src import create_initsuperdrops as csupers from pySD.initsuperdropsbinary_src import read_initsuperdrops as rsupers +from pySD.initsuperdropsbinary_src import attrsgenerator as attrsgen ### ----------------------- INPUT PARAMETERS ----------------------- ### ### --- absolute or relative paths for --- ### @@ -53,23 +55,28 @@ ### --- (an int or dict of ints) --- ### # zlim = 1000 # npergbx = 8 -# nsupers = iattrs.nsupers_at_domain_base(gridfile, constsfile, npergbx, zlim) +# nsupers = cgens.nsupers_at_domain_base(gridfile, constsfile, npergbx, zlim) nsupers = 40 ### ------------------------------------------- ### ### --- Choice of Superdroplet Radii Generator --- ### # monor = 0.05e-6 # all SDs have this same radius [m] -# radiigen = iattrs.MonoAttrGen(monor) # all SDs have the same dryradius [m] +# radiigen = rgens.MonoAttrGen(monor) # all SDs have the same radius [m] rspan = [7.5e-9, 7.5e-7] # min and max range of radii to sample [m] -radiigen = iattrs.SampleDryradiiGen(rspan) # radii are sampled from rspan [m] +radiigen = rgens.SampleLog10RadiiGen(rspan) # radii are sampled from rspan [m] +### ---------------------------------------------- ### + +### --- Choice of Superdroplet Dry Radii Generator --- ### +monodryr = 5e-9 # all SDs have this same dryradius [m] +dryradiigen = rgens.MonoAttrGen(monodryr) # all SDs have the same dryradius [m] ### ---------------------------------------------- ### ### --- Choice of Droplet Radius Probability Distribution --- ### # dirac0 = monor # radius in sample closest to this value is dirac delta peak # numconc = 1e6 # total no. conc of real droplets [m^-3] # numconc = 512e6 # total no. conc of real droplets [m^-3] -# radiiprobdist = rprobs.DiracDelta(dirac0) +# xiprobdist = rprobs.DiracDelta(dirac0) geomeans = [0.075e-6] # lnnormal modes' geometric mean droplet radius [m] geosigs = [1.5] # lnnormal modes' geometric standard deviation @@ -81,46 +88,46 @@ # geosigs = [1.4, 1.6] # scalefacs = [6e6, 4e6] numconc = np.sum(scalefacs) -radiiprobdist = rprobs.LnNormal(geomeans, geosigs, scalefacs) +xiprobdist = rprobs.LnNormal(geomeans, geosigs, scalefacs) # volexpr0 = 30.531e-6 # peak of volume exponential distribution [m] # numconc = 2**(23) # total no. conc of real droplets [m^-3] -# radiiprobdist = rprobs.VolExponential(volexpr0, rspan) +# xiprobdist = rprobs.VolExponential(volexpr0, rspan) # reff = 7e-6 # effective radius [m] # nueff = 0.08 # effective variance -# # radiiprobdist = rprobs.ClouddropsHansenGamma(reff, nueff) +# # xiprobdist = rprobs.ClouddropsHansenGamma(reff, nueff) # rdist1 = rprobs.ClouddropsHansenGamma(reff, nueff) # nrain = 3000 # raindrop concentration [m^-3] # qrain = 0.9 # rainwater content [g/m^3] # dvol = 8e-4 # mean volume diameter [m] -# # radiiprobdist = rprobs.RaindropsGeoffroyGamma(nrain, qrain, dvol) +# # xiprobdist = rprobs.RaindropsGeoffroyGamma(nrain, qrain, dvol) # rdist2 = rprobs.RaindropsGeoffroyGamma(nrain, qrain, dvol) # numconc = 1e9 # [m^3] # distribs = [rdist1, rdist2] # scalefacs = [1000, 1] -# radiiprobdist = rprobs.CombinedRadiiProbDistribs(distribs, scalefacs) +# xiprobdist = rprobs.CombinedRadiiProbDistribs(distribs, scalefacs) ### --------------------------------------------------------- ### ### --- Choice of Superdroplet Coord3 Generator --- ### # monocoord3 = 1000 # all SDs have this same coord3 [m] -# coord3gen = iattrs.MonoCoordGen(monocoord3) -coord3gen = iattrs.SampleCoordGen(True) # sample coord3 range randomly or not +# coord3gen = cgens.MonoCoordGen(monocoord3) +coord3gen = cgens.SampleCoordGen(True) # sample coord3 range randomly or not # coord3gen = None # do not generate superdroplet coord3s ### ----------------------------------------------- ### ### --- Choice of Superdroplet Coord1 Generator --- ### # monocoord1 = 200 # all SDs have this same coord1 [m] -# coord1gen = iattrs.MonoCoordGen(monocoord1) -# coord1gen = iattrs.SampleCoordGen(True) # sample coord1 range randomly or not +# coord1gen = cgens.MonoCoordGen(monocoord1) +# coord1gen = cgens.SampleCoordGen(True) # sample coord1 range randomly or not coord1gen = None # do not generate superdroplet coord1s ### ----------------------------------------------- ### ### --- Choice of Superdroplet Coord2 Generator --- ### # monocoord2 = 1000 # all SDs have this same coord2 [m] -# coord2gen = iattrs.MonoCoordGen(monocoord2) -# coord2gen = iattrs.SampleCoordGen(True) # sample coord1 range randomly or not +# coord2gen = cgens.MonoCoordGen(monocoord2) +# coord2gen = cgens.SampleCoordGen(True) # sample coord1 range randomly or not coord2gen = None # do not generate superdroplet coord2s ### ----------------------------------------------- ### @@ -136,7 +143,7 @@ Path(binariespath).mkdir(exist_ok=True) ### write initial superdrops binary -attrsgen = iattrs.AttrsGenerator(radiigen, dryradiigen, xiprobdist, +attrsgen = attrsgen.AttrsGenerator(radiigen, dryradiigen, xiprobdist, coord3gen, coord1gen, coord2gen) csupers.write_initsuperdrops_binary(initsupersfile, attrsgen, configfile, constsfile,