英文:
Why is mixing ratio at LCL not the same as for starting condition?
问题
我很新于metpy。作为第一个例子,我尝试计算温度为25℃,气压为950hPa,相对湿度为70%的空气气块的LCL。
首先,计算此空气的混合比为:
mr: 15.016493919350289 克/千克
然后,计算LCL为:
pLCL: 871.9597894290378 百帕斯卡
TLCL: 17.786684840244334 摄氏度
然后,我尝试计算从pLCL开始的各个高度的饱和等效位温和混合比。令人惊讶的是,在LCL处使用mixing_ratio_from_relative_humidity
计算的混合比与原始气块的混合比不同。与再次得到mr=15.016493919350289克/千克不同,我得到了14.862703501798386克/千克。它不应该相同吗,因为在LCL时,相对湿度为100%,在干绝热升至LCL期间,混合比不能改变吗?
英文:
I'm very new to metpy. As a first example I tried to calculate the LCL of an air parcel with T=25°C, p=950hPa and relative humidity=70%.
First, the mixing ratio of this air is calculated to be
mr: 15.016493919350289 gram / kilogram
Afterwards, the LCL is calculated as:
pLCL: 871.9597894290378 hectopascal
TLCL: 17.786684840244334 degree_Celsius
Now, I tried to calculate saturation equivalent potential temperature and mixing_ratio for levels starting with pLCL. To my surprise, the mixing ratio, calculated with mixing_ratio_from_relative_humidity
at the LCL differs from the mixing ratio of the original parcel. Instead of getting again mr=15.016493919350289 gram / kilogram I get 14.862703501798386 gram / kilogram. Shouldn't it be the same, because at LCL the relative humidity is 100% and during dry adiabatic rise to LCL mixing ratio cannot change?
There is a link to this question in: https://earthscience.stackexchange.com/questions/25188/why-is-mixing-ratio-at-lcl-not-the-same-as-for-starting-condition
from metpy.calc import dewpoint_from_relative_humidity
from metpy.calc import equivalent_potential_temperature
from metpy.calc import mixing_ratio_from_relative_humidity
from metpy.calc import equivalent_potential_temperature
from metpy.calc import lcl
from metpy.calc import moist_lapse
from metpy.calc import saturation_equivalent_potential_temperature
from metpy.units import units
p = 950 * units.hPa
T = 25 * units.degC
rh = 70 * units.percent
print('p:\t', p)
print('T:\t', T)
print('RF:\t', rh)
dp = dewpoint_from_relative_humidity(T, rh)
mr = mixing_ratio_from_relative_humidity(p, T, rh).to('g/kg')
print('mr:\t', mr)
ept = equivalent_potential_temperature(p, T, dp)
print('Θe :\t', ept.to(units.degC))
mylcl = lcl(p, T, dp)
plcl = mylcl[0]
tlcl = mylcl[1]
print('pLCL:\t', plcl)
print('TLCL:\t', tlcl)
plevs = [plcl.magnitude, 800, 700, 600, 500, 400, 300, 200, 100, 50, 25] * units.hPa
ml = moist_lapse(plevs, tlcl).to('degC')
print()
print('Moist adiabatic lift, starting from LCL')
print()
rh100 = 100 * units.percent
for idx in range(len(plevs)):
p = plevs[idx]
T = ml[idx]
print('-------------------------------------------------------------')
print('p:\t', p)
print('T(p):\t', T)
ept = saturation_equivalent_potential_temperature(plevs[idx], ml[idx])
print('Θe(p):\t', ept.to(units.degC))
mr = mixing_ratio_from_relative_humidity(p, T, rh100)
print('mr:\t', mr.to('g/kg'))
p: 950 hectopascal
T: 25 degree_Celsius
RF: 70 percent
mr: 15.016493919350289 gram / kilogram
Θe : 73.59933073452271 degree_Celsius
pLCL: 871.9597894290378 hectopascal
TLCL: 17.786684840244334 degree_Celsius
Moist adiabatic lift, starting from LCL
-------------------------------------------------------------
p: 871.9597894290378 hectopascal
T(p): 17.786684840244334 degree_Celsius
Θe(p): 73.56266438016314 degree_Celsius
mr: 14.862703501798386 gram / kilogram <--- !!!!!!!
-------------------------------------------------------------
p: 800.0 hectopascal
T(p): 14.680478970030833 degree_Celsius
Θe(p): 73.7567612561337 degree_Celsius
mr: 13.254531670351966 gram / kilogram
-------------------------------------------------------------
p: 700.0 hectopascal
T(p): 9.70674918909208 degree_Celsius
Θe(p): 73.97100713514288 degree_Celsius
mr: 10.878278101841651 gram / kilogram
-------------------------------------------------------------
p: 600.0 hectopascal
T(p): 3.6628633969115754 degree_Celsius
Θe(p): 74.0966050124087 degree_Celsius
mr: 8.34266379949833 gram / kilogram
-------------------------------------------------------------
p: 500.0 hectopascal
T(p): -4.036747412608861 degree_Celsius
Θe(p): 74.09741860835788 degree_Celsius
mr: 5.6959850509157075 gram / kilogram
-------------------------------------------------------------
p: 400.0 hectopascal
T(p): -14.539107430252784 degree_Celsius
Θe(p): 73.9329618099161 degree_Celsius
mr: 3.10991709553994 gram / kilogram
-------------------------------------------------------------
p: 300.0 hectopascal
T(p): -30.169336134705304 degree_Celsius
Θe(p): 73.61031144188621 degree_Celsius
mr: 1.043016676418755 gram / kilogram
-------------------------------------------------------------
p: 200.0 hectopascal
T(p): -54.703600518566134 degree_Celsius
Θe(p): 73.32450117793161 degree_Celsius
mr: 0.11362204759565221 gram / kilogram
-------------------------------------------------------------
p: 100.0 hectopascal
T(p): -93.72997677325506 degree_Celsius
Θe(p): 73.25906799180353 degree_Celsius
mr: 0.0005989154996261802 gram / kilogram
-------------------------------------------------------------
p: 50.0 hectopascal
T(p): -125.96434978295119 degree_Celsius
Θe(p): 73.2583328918671 degree_Celsius
mr: 4.5360156886986637e-07 gram / kilogram
-------------------------------------------------------------
p: 25.0 hectopascal
T(p): -152.4084163524267 degree_Celsius
Θe(p): 73.25830368606137 degree_Celsius
mr: 2.1998938295740055e-11 gram / kilogram
答案1
得分: 2
你没有分享如何计算第二个混合比值,但我假设它是mixing_ratio_from_relative_humidity(plcl, tlcl, 100 * units.percent)
。无论如何,我认为这源于MetPy中相对湿度(因此饱和度)假设的不一致性,正如这个GitHub问题中所指出的。mixing_ratio_from_relative_humidity()
的当前实现依赖于WMO的定义(因为这对于这个计算更直接),即RH = w / w_s
(其中w
是混合比,_s
表示饱和状态下的量)。
另一方面,lcl()
假设当环境水汽压力达到其饱和值时就达到了饱和状态。因此,在这种情况下,实际上使用的是RH = e / e_s
的定义(其中e
是水汽分压)--这是AMS词汇表中给出的定义,并且在很多其他软件中也使用,比如GEMPAK。
如果你改变初始值,使其经过使用AMS相对湿度定义的计算路径,你可以看到混合比的守恒:
Td = mpcalc.dewpoint_from_relative_humidity(T, rh)
mr = mpcalc.mixing_ratio(mpcalc.saturation_vapor_pressure(Td), p)
这给出了14.86 g/kg的值,并且还与LCL处的混合比相匹配:
mpcalc.mixing_ratio(mpcalc.saturation_vapor_pressure(tlcl), plcl)
在某个时候,我们将解决GitHub问题,并使内部保持一致,以避免这样的困扰。然而,应该指出的是,你的原始值在彼此之间的差异约为1%,所以我们并不谈论一个重大的差异。
英文:
You didn't share how you calculated the second mixing ratio value, but I assume it's mixing_ratio_from_relative_humidity(plcl, tlcl, 100 * units.percent)
. Regardless, I think this stems from an inconsistency in MetPy in how relative humidity (and thus saturation) is assumed, as noted in this GitHub issue. The current implementation of mixing_ratio_from_relative_humidity()
relies upon the WMO definition (since it's more direct for this calculation), which is: RH = w / w_s
(where w
is mixing ratio and _s
denotes the quantity at saturation.
lcl()
on the other hand, assumes saturation is reached when the ambient water vapor pressure reaches its saturation value. So in this case, effectively using a definition of RH = e / e_s
(where e
is water vapor partial pressure)--the definition given by the AMS glossary and used in a lot of other software, like GEMPAK.
You can see the conservation of mixing ratio if you change your initial value to go through a computation path that uses the AMS definition of RH:
Td = mpcalc.dewpoint_from_relative_humidity(T, rh)
mr = mpcalc.mixing_ratio(mpcalc.saturation_vapor_pressure(Td), p)
which gives the 14.86 g/kg value, and also then matches the mixing ratio at the LCL:
mpcalc.mixing_ratio(mpcalc.saturation_vapor_pressure(tlcl), plcl)
At some point we'll resolve the GitHub issue and make things internally consistent to avoid confusion like this. It should be noted, though, that your original values are within ~1% of each other, so we're not talking about a significant discrepancy.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论