From a3e6deff2007f2c00715dc35e03e16c6e73e8c24 Mon Sep 17 00:00:00 2001 From: Clara Levante Date: Tue, 9 Jan 2024 15:25:19 +0100 Subject: [PATCH] use hydro lapse rates for thermogen --- examples/rainshaft1d/rainshaft1d.py | 24 ++++++++++++------------ pySD/thermobinary_src/thermogen.py | 3 +-- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/examples/rainshaft1d/rainshaft1d.py b/examples/rainshaft1d/rainshaft1d.py index b8363e47a..b27afa7be 100644 --- a/examples/rainshaft1d/rainshaft1d.py +++ b/examples/rainshaft1d/rainshaft1d.py @@ -72,14 +72,14 @@ ygrid = np.array([0, 20]) # array of yhalf coords [m] ### --- settings for 1-D Thermodynamics --- ### -PRESS0 = 101315 # [Pa] -THETA0 = 298.15 # [K] -qcond = 0.0 # [Kg/Kg] -WVEL = 0.0 # [m/s] -qvapmethod = "qvap" -Zbase = 750 # [m] -qvap0 = [0.99, 1.0025] # s_ratio [below, above] Zbase -moistlayer=False +PRESS0 = 101315 # [Pa] +THETA0 = 297.9 # [K] +qvap0 = 0.013816 # [Kg/Kg] +Zbase = 750 # [m] +thetalapses = [0, 0.01] # [K m^-1] +qvlapses = [0, -0.0001] # [Kg/Kg m^-1] +qcond = 0.0 # [Kg/Kg] +WVEL = 0.0 # [m/s] ### --- settings for initial superdroplets --- ### # settings for initial superdroplet coordinates @@ -126,13 +126,13 @@ rgrid.print_domain_info(constsfile, gridfile) ### ----- write thermodynamics binaries ----- ### -thermodyngen = thermogen.ConstHydrostaticLapseRates(configfile, constsfile, PRESS0, - THETA0, qvapmethod, sratios, Zbase, - qcond, WVEL, VVEL, UVEL) +thermodyngen = thermogen.ConstHydrostaticLapseRates(PRESS0, THETA0, qvap0, + Zbase, thetalapses, + qvlapses, qcond, + WVEL, None, None) cthermo.write_thermodynamics_binary(thermofile, thermodyngen, configfile, constsfile, gridfile) - ### ----- write initial superdroplets binary ----- ### nsupers = crdgens.nsupers_at_domain_top(gridfile, constsfile, npergbx, zlim) coord3gen = crdgens.SampleCoordGen(True) # sample coord3 randomly diff --git a/pySD/thermobinary_src/thermogen.py b/pySD/thermobinary_src/thermogen.py index c2e0ae0cc..dcabe753f 100644 --- a/pySD/thermobinary_src/thermogen.py +++ b/pySD/thermobinary_src/thermogen.py @@ -432,15 +432,14 @@ def __init__(self, PRESS0, THETA0, qvap0, Zbase, self.PRESS0 = PRESS0 # surface pressure [Pa] self.THETA0 = THETA0 # surface temperature [T] self.qvap0 = qvap0 # surface water vapour content [Kg/Kg] + self.Zbase = Zbase # cloud base height [m] self.thetalapses = thetalapses # theta lapse rates [below, above] Zbase self.qvlapses = qvlapses # qv lapse rates [below, above] Zbase - self.Zbase = Zbase # cloud base height [m] self.qcond = qcond # liquid water content [Kg/Kg] self.WVEL = WVEL # vertical (z) velocity [m/s] self.UVEL = UVEL # horizontal x velocity [m/s] self.VVEL = VVEL # horizontal y velocity [m/s] - def generate_thermo(self, gbxbounds, ndims, ntime):