You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clarify inconsistent pressure units in QuickBeam gases and quickbeam_optics #166
The documented pressure units for the QuickBeam gases function are inconsistent with both its implementation and its COSPv2 caller. The current COSPv2 driver passes pressure in Pa, and the implementation converts Pa to kPa correctly. However, the function documents its input as hPa. A caller following that documentation would calculate pressures 100 times too small.
Relevant code
1. gases documents pressure as hPa
In quickbeam_optics.F90:1050
! [PRES_mb] pressure (mb) (hPa)
The argument declaration repeats that unit at quickbeam_optics.F90
PRES_mb, & ! Pressure (mb) (hPa)
2. The implementation treats the input as Pa
At quickbeam_optics.F90:1171-1177:
e = SH*PRES_mb/(SH+0.622_wp)/1000._wp !kPa
p = PRES_mb/1000._wp-e ! kPa
Division by 1000 converts Pa to kPa. If PRES_mb were actually supplied in hPa, the correct conversion to kPa would be division by 10.
3. The COSPv2 driver supplies pressure in Pa
The driver assigns pfull in Pa in cosp2_test.F90
cospstateIN%pfull = p(start_idx:end_idx,Nlevels:1:-1) ! Pa
It then passes pfull directly to gases at cosp2_test.F90:1049:
Therefore, the current driver path is consistent with a Pa input, despite the function documenting hPa.
4. Related inconsistency in quickbeam_optics
p_matrix is also documented as hPa:
p_matrix, & ! Pressure profile (hPa)
However, it is used directly to calculate air density at quickbeam_optics.F90:156 :
rho_a = p_matrix(pr,k)/(287._wp*t_kelvin)
This calculation requires pressure in Pa, which is also what the driver supplies.
Impact
The standard COSPv2 driver currently produces the intended pressure scaling because it passes Pa. However:
the interface is misleading
callers following the documented hPa convention would obtain pressures and gaseous attenuation that are underestimated
Proposed fix
Use Pa consistently and preserve the current numerical behavior. However if kPa is intended for gaseous attenuation, then the pressure conversion factors should be modified.
Activity