Open lizhuo1108 opened 2 months ago
Hi @lizhuo1108, I just edited your comment to enclose the code example in tick marks ``` so it displays correctly.
I'll take a look at the example.
Hi @lizhuo1108, I have reproduced your result and found the same issue. Looking through code from which swhr
is calculated (e.g. here), I didn't see anything obvious like a division by zero. So I'm still confused about the reason for the inf
values.
The reason why this was never detected before is that climlab does not use the swhr
diagnostic. If you look at the climlab wrapper for RRTMG_SW you'll see that the heating rate (in K/s) is calculated in the Python code from the divergence of the radiative flux and the heat capacity of the grid cell. The diagnostic swhr
is returned from the Fortran code but ignored.
That would be my suggested workaround.
Hi @lizhuo1108, I have reproduced your result and found the same issue. Looking through code from which
swhr
is calculated (e.g. here), I didn't see anything obvious like a division by zero. So I'm still confused about the reason for theinf
values.The reason why this was never detected before is that climlab does not use the
swhr
diagnostic. If you look at the climlab wrapper for RRTMG_SW you'll see that the heating rate (in K/s) is calculated in the Python code from the divergence of the radiative flux and the heat capacity of the grid cell. The diagnosticswhr
is returned from the Fortran code but ignored.That would be my suggested workaround.
Hi @brian-rose , Thanks for your time and effort on this! I think that maybe it is possible to calculate swhr based on lwhr and longwave flux convergence at each layer, I will take a look at this.
Hi All, I copied the function "test_rrtmg_sw_mcica" from the example code: https://github.com/climlab/climlab-rrtmg/blob/main/climlab_rrtmg/tests/test_climlab_rrtmg.py, but the solar heating rate (swhr) are all inf. However, the upward and downward solar radiation fluxes are normal. Anyone else run into this problem? Please find my code attached (Just copy the code:)