Skip to content

Commit

Permalink
name changes
Browse files Browse the repository at this point in the history
  • Loading branch information
yoctoyotta1024 committed Dec 22, 2023
1 parent 5ec2bb1 commit 1f56384
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 25 deletions.
2 changes: 1 addition & 1 deletion examples/boxmodelcollisions/shima2009.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/constthermo2d/constthermo2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/divfreemotion/divfree2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/speedtest/speedtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions libs/superdrops/coalescence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -40,15 +40,15 @@ 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) */

KOKKOS_FUNCTION void
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) */

Expand Down
2 changes: 1 addition & 1 deletion pySD/initsuperdropsbinary_src/read_initsuperdrops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
41 changes: 24 additions & 17 deletions scripts/create_initsuperdropsbinary_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 --- ###
Expand All @@ -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
Expand All @@ -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
### ----------------------------------------------- ###

Expand All @@ -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,
Expand Down

0 comments on commit 1f56384

Please sign in to comment.