Stable diags #11, #21, #24#483
Conversation
| real(r_def), parameter :: isa_press_bot = 101325.0_r_def | ||
|
|
||
| ! Pressure (Pa) at 11,000 gpm. | ||
| real(r_def), parameter :: isa_press_mid = 22632.0_r_def |
There was a problem hiding this comment.
Claude says isa_press_mid should be 22632.1 and isa_press_top should be 5474.89. Should we do anything?
| ! Subtract geopotential heights at 850 and 500 hPa from that at 1000 hPa. | ||
| ! | ||
| ! Snow probability: | ||
| ! Implement Boyden (1964), using 850 and 1000 hPa. |
There was a problem hiding this comment.
Claude doesn't ... "think" the code further down matches the Boyden equation.
|
|
||
| call conv_cloud_base_icao_height%write_field() | ||
|
|
||
| ! Is it necessary/safe to remove this field now? |
There was a problem hiding this comment.
Need steering on this question please.
|
|
||
|
|
||
| ! Process every DOF in this cell. | ||
| do df = 1, result_ndf |
There was a problem hiding this comment.
Might be worth having a chat/steer about if/when we can skip this loop, as does the other kernel in this PR.
| ! Lapse rate (degreeC/km) for levels below 11,000 gpm. | ||
| real(r_def), parameter :: isa_lapse_ratel = 6.5e-03_r_def | ||
|
|
||
| ! Lapse rate (degreeC/km) for levels above 20,000 gpm. |
There was a problem hiding this comment.
This comment, as copied from the UM, said 11,000. Claude spotted the error. Worth mentioning just in case.
| if(snow_probability_flag .and. i850 /= -1) then | ||
| gph_850 = plev_geopot(source_map(df) + i850-1) | ||
| snow_probability(result_map(df)) = & | ||
| 5220.0_r_def + 3.86666_r_def*gph_1000 - 4.0_r_def*gph_850 |
There was a problem hiding this comment.
The earliest I've been able to track these magic numbers so far is here.
| <field field_ref="forcing__dt_force" /> | ||
| </file> | ||
|
|
||
| <file id="lfric_aviation" name="lfric_aviation" output_freq="6h" convention="UGRID" enabled=".TRUE."> |
There was a problem hiding this comment.
Couldn't find documentation for the <file> and <field_group> tags.
| </field_group> | ||
|
|
||
| <!-- Section 20 Aviation diagnostics --> | ||
| <field_group operation="instant" freq_op="6h"> |
There was a problem hiding this comment.
KGO? I got the impression there isn't any yet?
79ea31a to
8372788
Compare
| plev_geopot_clim_flag = diag_samp('plev__geopot_clim') | ||
| plev_geopot_flag = init_diag(plev_geopot, 'plev__geopot', activate=plev_geopot_clim_flag) | ||
| if ((plev_geopot_flag .or. plev_geopot_clim_flag) .and. use_xios_io) then | ||
| plev_geopot_flag = init_diag(plev_geopot, 'plev__geopot', & |
There was a problem hiding this comment.
Just an observation: From a software engineering perspective, this module (and others) should probably not know anything about the aviation module. I think it's a pattern which can lead to a rat's nest of dependencies. One solution might be to express field dependencies in a centralised place, which init_diag could check for itself, without needing the activate arg. Is that worth raising in a ticket somewhere?
iboutle
left a comment
There was a problem hiding this comment.
Hi Byron,
Sorry, quite a few comments to address - let me know if anything need clarification or you need any help on anything.
Cheers
Ian
| real(kind=r_def) :: pressure | ||
|
|
||
|
|
||
| g_over_rd = gravity / rd |
There was a problem hiding this comment.
I would suggest enabling and using this from nterfaces/physics_schemes_interface/source/constants/planet_constants_mod.F90 instead of calculating it every time
| pressure = min(isa_press_bot, pressure) | ||
|
|
||
| ! Missing or invalid data? | ||
| if (pressure == rmdi .or. pressure <= 0.0_r_def) then |
There was a problem hiding this comment.
This line differs from the UM code, and pressure=0 has already been excluded as an option by L106. I think the purpose of this line is to catch points where there is no convective cloud, but I don't think that will be happening, because of how the cloud base/top pressure is set in conv_gr and conv_comorph kernel. I think the .or. statement should be removed, and conv_gr/conv_comorph kernels should be modified to set pres_cv_base and pres_cv_top to rmdi instead of 0 when there is no convective cloud.
| @@ -0,0 +1,143 @@ | |||
| !------------------------------------------------------------------------------- | |||
| module aviation_icao_heights_kernel_mod | ||
|
|
||
| use argument_mod, only: arg_type, & | ||
| gh_field, gh_scalar, gh_logical, & |
There was a problem hiding this comment.
| gh_field, gh_scalar, gh_logical, & | |
| gh_field, & |
|
|
||
| use argument_mod, only: arg_type, & | ||
| gh_field, gh_scalar, gh_logical, & | ||
| gh_read, gh_write, gh_integer, & |
There was a problem hiding this comment.
| gh_read, gh_write, gh_integer, & | |
| gh_read, gh_write, & |
| if (nplev <= 0) then | ||
| message = 'Section 20: No pressure levels' | ||
| call log_event( message, log_level_error ) | ||
| return |
There was a problem hiding this comment.
log_level_error should terminate the model, so the returns are redundant
|
|
||
|
|
||
| ! Process every DOF in this cell. | ||
| do df = 1, result_ndf |
There was a problem hiding this comment.
I think you're right, this loop isn't needed and can be removed
|
|
||
| gph_1000 = plev_geopot(source_map(df) + i1000-1) | ||
|
|
||
| if (thickness_850_flag .and. i850 /= -1) then |
There was a problem hiding this comment.
i850 /= -1 should already be guaranteed by the algorithm checks, so this could be removed
| if ( snow_probability_flag ) then | ||
| message = 'Section 20: snow probability requested' | ||
| call log_event( message, log_level_debug ) | ||
| call invoke( setval_c(snow_probability, 0.0_r_def)) |
There was a problem hiding this comment.
I don't think these pre-initialisations to 0 or 1 are needed, because the field is entirely written to inside the kernel, so can be removed
| </field_group> | ||
|
|
||
| <!-- Section 20 Aviation diagnostics --> | ||
| <field_group operation="instant" freq_op="6h"> |
There was a problem hiding this comment.
Please can you remove this, and add the diagnostics in their correct place in the list above. That place is:
- snow probability in the instant group of standard level fields - Hourly
- the rest in the instant group of standard level fields - 3 Hourly
PR Summary
Three Section 20 aviation diagnostics created from plev_geopot.
Output from suite u-dy804:
geopotential thickness
snow probability
(That ticket contains a incorrect link to the um code, which should be pws_snow_prob_diag.F90.)

icao cloud heights
Note: we have not found a UM Section 20 example of these two fields for comparison.


Sci/Tech Reviewer: iboutle
Code Reviewer: Alistair Pirrie (@mo-alistairp)
Code Quality Checklist
Testing
trac.log
Security Considerations
Performance Impact
AI Assistance and Attribution
Documentation
PSyclone Approval
Sci/Tech Review
(Please alert the code reviewer via a tag when you have approved the SR)
Code Review