-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The bug of in-cloud ice water path (ciwp) in RRTMG #19
Comments
Hi @lizhuo1108, I think your bug results from setting zero effective ice crystal radius Try changing Set up a single column
Compute clear sky LW flux
produces
Put in a liquid cloud
produces
Change the cloud from water to ice
produces
|
Hi Brian, |
Hi All, I checked the code of RRTMG and I found the reason why it crashed when the effective radius becomes very large. For the source code: Line 182-183: When the iceflag (iceflglw) is set to 1 and the radius is unreasonably large (> 130) or small (<13), the RRTMG will be forced to stop and crash. A remind for other users: when you give the information of the effective ice radius (radice) to RRTMG, please check your input radice and make sure that the radice is within this range, otherwise RRTMG will crash! Same is for other two options (iceflag=2 and 3). Li |
This is useful info! This package doesn't have any actual "documentation" but it might be helpful at least to put this into comments in the Python wrapper code. |
I copied the example code from:
https://github.com/climlab/climlab-rrtmg/blob/main/climlab_rrtmg/tests/test_climlab_rrtmg.py
to a jupyter notebook. I changed the value of ciwp from 0 to 0.1 (Line 67 in the example code) and the kernel died. Maybe there is a bug on ciwp? Has someone else run into similar problems before?
Below is my code:
import numpy as np
from climlab_rrtmg import rrtmg_lw, rrtmg_sw
import matplotlib.pyplot as plt
cp = 1004. # Specific heat at constant pressure
ps = 1000. # Surface pressure in hPa
ncol = 1
nlay = 30
deltap = ps / nlay # pressure interval
plev = np.linspace(ps, 0., nlay+1) # pressure bounds
plev = plev[np.newaxis, ...]
play = np.linspace(ps-deltap/2., deltap/2., nlay)
play = play[np.newaxis, ...]
tsfc = 288.
tlay = np.linspace(288.-10., 200., nlay)
tlay = tlay[np.newaxis, ...]
tlev = np.linspace(288., 200., nlay+1)
tlev = tlev[np.newaxis, ...]
specific_humidity = np.array([4.13141097e-03, 3.41509495e-03, 2.81099479e-03, 2.30359570e-03,
1.87920573e-03, 1.52578624e-03, 1.23279279e-03, 9.91026303e-04,
7.92494475e-04, 6.30283118e-04, 4.98437246e-04, 3.91851633e-04,
3.06170488e-04, 2.37695932e-04, 1.83304857e-04, 1.40373783e-04,
1.06711275e-04, 8.04974602e-05, 6.02302082e-05, 4.46774859e-05,
3.28354282e-05, 2.38916443e-05, 1.71932832e-05, 1.22193649e-05,
8.55682965e-06, 5.87957411e-06, 5.00000000e-06, 5.00000000e-06,
5.00000000e-06, 5.00000000e-06])
h2ovmr = specific_humidity * 28.97 / 18.01528
h2ovmr = h2ovmr[np.newaxis, ...]
o3vmr = np.array([2.25573888e-08, 2.38730436e-08, 2.52586476e-08, 2.66442517e-08,
2.80298557e-08, 2.97254145e-08, 3.14254923e-08, 3.31238355e-08,
3.46767916e-08, 3.62297478e-08, 3.76122833e-08, 3.86410454e-08,
3.96698075e-08, 4.08899052e-08, 4.21303310e-08, 4.39781220e-08,
4.60528063e-08, 4.87636254e-08, 5.16974065e-08, 5.57122567e-08,
6.17914190e-08, 7.15771368e-08, 9.29020109e-08, 1.29109217e-07,
1.75914529e-07, 2.45552383e-07, 3.92764464e-07, 7.61726407e-07,
2.25137178e-06, 7.27500161e-06])
o3vmr = o3vmr[np.newaxis, ...]
co2vmr = 348. / 1E6 * np.ones_like(play)
ch4vmr = 1650. / 1E9 * np.ones_like(play)
n2ovmr = 306. / 1E9 * np.ones_like(play)
o2vmr = 0.21 * np.ones_like(play)
cfc11vmr = 0. * np.ones_like(play)
cfc12vmr = 0. * np.ones_like(play)
cfc22vmr = 0. * np.ones_like(play)
ccl4vmr = 0. * np.ones_like(play)
cloud_level_index = 8
cldfrac = 0.5np.exp(-(play-play[0,cloud_level_index])**2/(225.)**2) # Layer cloud fraction: a Gaussian centered on a pressure level
clwp = 60. * np.ones_like(play) # in-cloud liquid water path (g/m2)
ciwp = 0.1 * np.ones_like(play) # in-cloud ice water path (g/m2)
relq = 14. * np.ones_like(play) # Cloud water drop effective radius (microns)
reic = 0 * np.ones_like(play) # Cloud ice particle effective size (microns)`
nbndlw = int(rrtmg_lw.parrrtm.nbndlw)
ngptlw = int(rrtmg_lw.parrrtm.ngptlw)
rrtmg_lw.climlab_rrtmg_lw_ini(cp)
icld = 1 # Cloud overlap method, 0: Clear only, 1: Random, 2, Maximum/random] 3: Maximum
irng = 1 # more monte carlo stuff
idrv = 0 # whether to also calculate the derivative of flux with respect to surface temp
permuteseed = 300
inflglw = 2
iceflglw = 1
liqflglw = 1
tauc = 0. * np.ones_like(play)
tauc = tauc * np.ones([nbndlw,ncol,nlay])
tauaer = 0. * np.ones_like(play)
tauaer = np.transpose(tauaer * np.ones([nbndlw,ncol,nlay]), (1,2,0))
emis = 1. * np.ones((ncol,nbndlw))
(cldfmcl, ciwpmcl, clwpmcl, reicmcl, relqmcl, taucmcl) =
rrtmg_lw.climlab_mcica_subcol_lw(
ncol, nlay, icld,
permuteseed, irng, play,
cldfrac, ciwp, clwp, reic, relq, tauc)
ispec=0
(olr_sr, uflx, dflx, hr, uflxc, dflxc, hrc, duflx_dt, duflxc_dt) =
rrtmg_lw.climlab_rrtmg_lw(ncol, nlay, icld, ispec, idrv,
play, plev, tlay, tlev, tsfc,
h2ovmr, o3vmr, co2vmr, ch4vmr, n2ovmr, o2vmr,
cfc11vmr, cfc12vmr, cfc22vmr, ccl4vmr, emis,
inflglw, iceflglw, liqflglw, cldfmcl,
taucmcl, ciwpmcl, clwpmcl, reicmcl, relqmcl,
tauaer)
The text was updated successfully, but these errors were encountered: