Initialise with true gravity#511
Conversation
Thomas Bendall (tommbendall)
left a comment
There was a problem hiding this comment.
Thanks Chris, sorry if I've jumped the gun here with a review since the PR is still in "draft" state. I'm really excited about this potentially facilitating the use deep gravity.
Along with some minor in-line comments, I have two major suggestions:
-
Do we need to still include all of the different
isotherm*options? I don't think any of theisotherm*options are tested, and since thegeopotoption seems to perform best, should we remove all of theisotherm*options? Or possibly keep only one that preserves the old behaviour? -
Do we need unit-tests for the new kernels?
| =Used when the shallow switch is false and reading a start dump | ||
| =that has been created by a constant gravity model, such as the UM. | ||
| =All methods calculate an Exner field in hydrostatic balance with | ||
| =height-varying gravity. This is done by upward integr |
There was a problem hiding this comment.
there seems to be some of the help section missing here!
| @@ -3247,23 +3221,39 @@ help=Horizontal winds are read in on a W2h space from a start dump. If | |||
| sort-key=02b | |||
| type=logical | |||
|
|
|||
| [namelist:initialization=regravitate] | |||
| compulsory=true | |||
| description=Method for switching gravity | |||
There was a problem hiding this comment.
Could you make this slightly clearer?
| description=Method for switching gravity | |
| description=Method for setting up initial hydrostatic balance when using deep gravity but a start dump that assumed shallow gravity |
| =that has been created by a constant gravity model, such as the UM. | ||
| =All methods calculate an Exner field in hydrostatic balance with | ||
| =height-varying gravity. This is done by upward integr | ||
| =Isothermodynamic: Preserve absolute temperature and pressure on |
There was a problem hiding this comment.
If we're to keep the different isothermal methods (I wonder if we don't!), should we explain the differences between them here?
| ! under which the code may be used. | ||
| !----------------------------------------------------------------------------- | ||
|
|
||
| !> @brief Need to say something here |
There was a problem hiding this comment.
I think you might have forgotten to fill these in!
| end do | ||
|
|
||
| ! Map temperature from newly computed grid back onto current model grid | ||
| call interp( nlayers+1, ht_wt, th, nlayers+1, height_wth(map_wt(1)), & |
There was a problem hiding this comment.
I'm a bit confused about this call, based on the interp function, shouldn't this be height_wth(map_wt(1):map_wt(1)+nlayers)?
It looks like we are passing in an element of an array instead of a section of an array
There was a problem hiding this comment.
I wasn't thinking! It's the whole array that's being passed in any case. It works, though. In Fortran, when one element of an array is in an argument list, it's just the memory address of the start point for part of the array. This avoids the creation and copying to and from a temporary array when a whole slice is put in the argument list. Perhaps this is a bit of an f77 throwback?!
|
|
||
| ! Map temperature from newly computed grid back onto current model grid | ||
| call interp( nlayers+1, ht_wt, th, nlayers+1, height_wth(map_wt(1)), & | ||
| temperature(map_wt(1)) ) |
There was a problem hiding this comment.
Similarly, I'm a bit confused about this call, based on the interp function, shouldn't this be temperature(map_wt(1):map_wt(1)+nlayers)?
It looks like we are passing in an element of an array instead of a section of an array
| ! Geopotential height | ||
| do k = 0, nlayers | ||
| ht_wt(k) = planet_radius * height_wth(map_wt(1)+k) / & | ||
| ( planet_radius - height_wth(map_wt(1)+k) ) |
There was a problem hiding this comment.
I'm wondering if we should enforce that this calculation is done at double precision, since planet_radius could be very large and height_wth could be very small
There was a problem hiding this comment.
I tried promoting to double without success. First using r_double then real64. Both caused failures in the developer suite. For Earth and UM grids at least, the loss of accuracy isn't disastrous if no promotion is done. Also, the geopotential is calculated in just the same way elsewhere in the model.
| call invoke( & | ||
|
|
||
| select case( regravitate ) | ||
| case( regravitate_isotherm1 ) |
There was a problem hiding this comment.
I wonder if we need all of these isotherm methods? Or if you want to preserve the current behaviour, we could just keep your isotherm1 method?
There was a problem hiding this comment.
There used to be more! But you're right, a further cull is required. I've decided to keep the current scheme as originally intended, though, rather than what actually made it on to trunk. The version on trunk isn't in a rose stem test, so no KGOs are harmed. And we know the trunk version isn't one that we want.
|
Hi Tom, Thanks, Chris. |
PR Summary
Sci/Tech Reviewer: Thomas Bendall (@tommbendall)
Code Reviewer:
Although the shallow atmosphere approximation is not used by UM(ENDgame) , it still retains the constant gravity field of earlier models. If LFRic is to run with true height-varying gravity, initialisation from a UM start-dump must take account of the change in gravity between the two models to avoid a significant change to the meteorology of the data. The code to do this hasn't performed as expected. This ticket does the following:
A significant change comes with the above. In the hydro_shallow_to_deep kernel the downward integration stage used absolute temperature, which was obtained from T=theta*exner using the equation of state to find exner from theta and density information. This differs from how the scheme was originally developed. The changes above return the scheme to its original form, while also introducing the optional interpolation stage.
== Code Changes ==
geo_on_pres_kernel_mod.F90 and pres_lev_diags_alg_mod.x90: Diagnostic of geopotential height on a constant pressure level changed to use the model geopotential, rather than height_w3 field, so that it is valid for shallow=.false. as well as shallow=.true..
rose-meta.conf: New setting in the initialization namelist, regrav_order, which sets the order of interpolation used in step (3) above. Currently the only values available are 0=no interpolation and 1=linear interpolation.
map_fd_to_prognostics_alg_mod.x90: Place from which kernels are called.
== New Code ==
initialisation/regrav_preserve_t_kernel_mod.F90: Finds Exner by upward integration of hydrostatic balance, formulated with absolute temperature.
initialisation/regrav_geopot_kernel_mod.F90: Interpolates temperature onto the grid from locations associated with given geopotential heights.
Code Quality Checklist
Testing
trac.log
Test Suite Results - lfric_apps - test2_reset_gravity/run6
Suite Information
Task Information
✅ succeeded tasks - 1164
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