-
Notifications
You must be signed in to change notification settings - Fork 118
Consistent wind metric #791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
thomasmelvin
wants to merge
10
commits into
MetOffice:main
Choose a base branch
from
thomasmelvin:consistent_wind_metric
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d0281ac
Add consistent metrics for the wind computation
thomasmelvin 0879e92
Undo changes to fs argument obtained from main
thomasmelvin ee531e8
Undo changes to fs argument obtained from main
thomasmelvin e42a905
Update to metric kernel for regions near stencil boundaries
thomasmelvin 7045309
Fix code to use correct r_tran types
thomasmelvin 89611bb
KGO update
thomasmelvin 303c68c
Remove added debug tests
thomasmelvin d51e41a
Update to v3.2 and regen KGO's
thomasmelvin 07ab27b
Response to coppilot reviews
thomasmelvin 56b3ada
Revert accidental commit of local changes to azspice config
thomasmelvin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
rose-stem/app/gungho_model/opt/rose-app-consistent_metric.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [namelist:transport] | ||
| consistent_metric=.true. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...checksum_gungho_model_schar_cart-alt2-BiP100x4-1000x1000_azspice_gnu_fast-debug-64bit.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| Inner product checksum rho = 40C1E40C4086849A | ||
| Inner product checksum theta = 41F1395D4034FE76 | ||
| Inner product checksum u = 4393B67691E55F6A | ||
| Inner product checksum rho = 40C1E4433CA1DC11 | ||
| Inner product checksum theta = 41F13951C1547028 | ||
| Inner product checksum u = 4393B5A758E1AA4A |
6 changes: 3 additions & 3 deletions
6
...ecksum_gungho_model_straka_200m-alt2-BiP256x16-200x50_op_azspice_gnu_fast-debug-64bit.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| Inner product checksum rho = 40FA16E969D82696 | ||
| Inner product checksum theta = 42069BF1BB6EBF3E | ||
| Inner product checksum u = 42FFC30F4FBB102B | ||
| Inner product checksum rho = 40FA16E969D85AAC | ||
| Inner product checksum theta = 42069BF1BB6EB372 | ||
| Inner product checksum u = 42FFC30F4FCF542B |
6 changes: 3 additions & 3 deletions
6
...1a/checksum_gungho_model_schar_cart-alt2-BiP100x4-1000x1000_ex1a_gnu_fast-debug-64bit.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| Inner product checksum rho = 40C1E40C40869417 | ||
| Inner product checksum theta = 41F1395D4034FF38 | ||
| Inner product checksum u = 4393B67691E550BA | ||
| Inner product checksum rho = 40C1E4433CA1EF89 | ||
| Inner product checksum theta = 41F13951C1546C60 | ||
| Inner product checksum u = 4393B5A758E14822 |
6 changes: 3 additions & 3 deletions
6
.../checksum_gungho_model_straka_200m-alt2-BiP256x16-200x50_op_ex1a_gnu_fast-debug-64bit.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| Inner product checksum rho = 40FA16E968D7D432 | ||
| Inner product checksum theta = 42069BF1BC3DF21E | ||
| Inner product checksum u = 42FFC30DC52E5C94 | ||
| Inner product checksum rho = 40FA16E968D7D9F7 | ||
| Inner product checksum theta = 42069BF1BC3EC677 | ||
| Inner product checksum u = 42FFC30DC4F57FAF |
164 changes: 164 additions & 0 deletions
164
science/gungho/source/algorithm/transport/control/consistent_wind_alg_mod.X90
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,164 @@ | ||
| !----------------------------------------------------------------------------- | ||
| ! (c) Crown copyright 2026 | ||
| !----------------------------------------------------------------------------- | ||
| !> @brief Compute the consistent vertical wind | ||
|
|
||
| module consistent_wind_alg_mod | ||
|
|
||
| use config_mod, only: config_type | ||
| use constants_mod, only: i_def, l_def, r_def | ||
| use log_mod, only: log_event, LOG_LEVEL_INFO | ||
| use transport_metadata_collection_mod, only: transport_metadata_collection | ||
| use transport_metadata_mod, only: transport_metadata_type | ||
| use transport_controller_mod, only: transport_controller_type | ||
| use sci_geometric_constants_mod, only: get_coordinates, & | ||
| get_height_fv, & | ||
| get_face_selector_ew, & | ||
| get_face_selector_ns | ||
| use consistent_wind_kernel_mod, only: consistent_wind_kernel_type | ||
| use fs_continuity_mod, only: Wtheta, W2v, W2h | ||
| use model_clock_mod, only: model_clock_type | ||
| use combine_w2_field_kernel_mod, only: combine_w2_field_kernel_type | ||
| use split_w2_field_kernel_mod, only: split_w2_field_kernel_type | ||
| use integer_field_mod, only: integer_field_type | ||
| use field_mod, only: field_type | ||
| use r_tran_field_mod, only: r_tran_field_type | ||
| use function_space_mod, only: function_space_type | ||
| use function_space_collection_mod, only: function_space_collection | ||
| use wt_advective_update_alg_mod, only: hori_wt_update_alg | ||
| use transport_enumerated_types_mod, only: split_method_mol | ||
| use horizontal_cubic_sl_metric_kernel_mod, & | ||
| only: horizontal_cubic_sl_metric_kernel_type | ||
|
|
||
| implicit none | ||
|
|
||
| private | ||
|
|
||
| ! Contained suroutines | ||
| public :: consistent_wind_alg | ||
|
|
||
|
|
||
| contains | ||
|
|
||
| !============================================================================= | ||
| !> @brief Compute a consistent vertical wind for the current transport step. | ||
| !> @details Modifies the vertical advecting wind so that the component that comes | ||
| !! from the horizontal wind over terrain uses the transport scheme reconstruction | ||
| !! to compute the orographic gradient instead of the finite element scheme. This | ||
| !! results in the correct cancellation with the horizontal transport of the field | ||
| !! over terrain. | ||
| !> @param[in] config Application namelist configuration object | ||
| !> @param[in,out] transport_controller Encapsulating object containing the | ||
| !! transport counter and precomputations | ||
| !> @param[in] rho_d_latest Dry density at the latest time level | ||
| !> @param[in] wind_n Wind at the start of the step | ||
| !> @param[in] wind_np1 Wind at the end of the step | ||
| !> @param[in] model_clock Model time information | ||
| !> @param[in] outer Outer iteration index | ||
| !> @param[in] cheap_update_step Whether a cheap controller update is used | ||
| subroutine consistent_wind_alg(config, & | ||
| transport_controller, & | ||
| rho_d_latest, & | ||
| wind_n, & | ||
| wind_np1, & | ||
| model_clock, & | ||
| outer, & | ||
| cheap_update_step) | ||
|
|
||
| implicit none | ||
|
|
||
| type(config_type), intent(in) :: config | ||
| integer(kind=i_def), intent(in) :: outer | ||
| logical(kind=l_def), intent(in) :: cheap_update_step | ||
| class(model_clock_type), intent(in) :: model_clock | ||
| type(field_type), intent(in) :: rho_d_latest, wind_n, wind_np1 | ||
| type(transport_controller_type), intent(inout) :: transport_controller | ||
|
|
||
| type(field_type) :: chi3_inc, chi3 | ||
| type(field_type), pointer :: chi3_default | ||
| type(transport_metadata_type), pointer :: transport_metadata | ||
|
|
||
| integer(kind=i_def) :: mesh_id | ||
|
|
||
| type(field_type), pointer :: chi(:) | ||
| type(field_type), pointer :: wind_adv_ptr | ||
| type(field_type), target :: wind_adv | ||
| type(field_type) :: wind_v, wind_h | ||
|
|
||
| type(r_tran_field_type) :: chi3_inc_r_tran, wind_h_r_tran, chi3_r_tran | ||
|
|
||
| type(integer_field_type), pointer :: face_selector_ew | ||
| type(integer_field_type), pointer :: face_selector_ns | ||
|
|
||
| type(function_space_type), pointer :: w2h_fs, w2v_fs | ||
|
|
||
| integer(kind=i_def), parameter :: stencil_depth = 2 | ||
|
|
||
| ! Get the height field with a big halo | ||
| mesh_id = rho_d_latest%get_mesh_id() | ||
| chi3_default => get_height_fv(config, rho_d_latest%get_mesh(), Wtheta) | ||
| call chi3%initialise( chi3_default%get_function_space(), halo_depth = stencil_depth ) | ||
| call invoke( setval_X( chi3, chi3_default ) ) | ||
|
|
||
|
|
||
| ! Transport the height field | ||
| call log_event( "Computing consistent vertical wind...", LOG_LEVEL_INFO) | ||
| transport_metadata => & | ||
| transport_metadata_collection%get_transport_metadata('potential_temperature') | ||
| call chi3_inc%initialise( chi3%get_function_space() ) | ||
|
|
||
| ! Split out the horzontal and vertical components of the wind | ||
| w2h_fs => function_space_collection%get_fs( wind_n%get_mesh(), & | ||
| wind_n%get_element_order_h(), & | ||
| wind_n%get_element_order_v(), W2h ) | ||
| w2v_fs => function_space_collection%get_fs( wind_n%get_mesh(), & | ||
| wind_n%get_element_order_h(), & | ||
| wind_n%get_element_order_v(), W2v ) | ||
| call wind_h%initialise( w2h_fs ) | ||
| call wind_v%initialise( w2v_fs ) | ||
| call wind_adv%initialise( wind_n%get_function_space() ) | ||
| face_selector_ew => get_face_selector_ew( wind_n%get_mesh() ) | ||
| face_selector_ns => get_face_selector_ns( wind_n%get_mesh() ) | ||
| call invoke( aX_plus_bY( wind_adv, 0.5_r_def, wind_n, 0.5_r_def, wind_np1 ), & | ||
| split_w2_field_kernel_type( wind_h, wind_v, wind_adv, & | ||
| face_selector_ew, & | ||
| face_selector_ns ) ) | ||
|
|
||
| ! Compute u.grad(chi3) | ||
| if ( transport_metadata%get_horizontal_method() == split_method_mol ) then | ||
| ! With MoL | ||
| call chi3_inc_r_tran%initialise( chi3_inc%get_function_space() ) | ||
| call wind_h_r_tran%initialise( wind_h%get_function_space() ) | ||
| call chi3_r_tran%initialise( chi3%get_function_space() ) | ||
| call invoke( real_to_real_X( chi3_inc_r_tran, chi3_inc ), & | ||
| real_to_real_X( wind_h_r_tran, wind_h ), & | ||
| real_to_real_X( chi3_r_tran, chi3 ) ) | ||
| call hori_wt_update_alg(config, chi3_inc_r_tran, wind_h_r_tran, wind_h_r_tran, & | ||
| chi3_r_tran, transport_metadata) | ||
| call invoke( real_to_real_X( chi3_inc, chi3_inc_r_tran ) ) | ||
| else | ||
| ! With SL | ||
| call invoke(horizontal_cubic_sl_metric_kernel_type(chi3_inc, chi3, stencil_depth, wind_h) ) | ||
| end if | ||
|
|
||
| ! Modify the vertical componenet of the transporting wind | ||
| chi => get_coordinates( wind_n%get_mesh() ) | ||
| call invoke( consistent_wind_kernel_type(wind_v, wind_adv, & | ||
| chi3_inc, chi(3)) ) | ||
|
|
||
| ! Combine the modified vertical wind with the horizontal wind to form a new consistent wind | ||
| call invoke( combine_w2_field_kernel_type( wind_adv, wind_h, wind_v, & | ||
| face_selector_ew, & | ||
| face_selector_ns ) ) | ||
|
|
||
| ! Recompute controller object (departure points etc) using new consistent wind | ||
| call log_event( "Recomputing transport controller with consistent wind...", LOG_LEVEL_INFO) | ||
| wind_adv_ptr => wind_adv | ||
| call transport_controller%finalise() | ||
| call transport_controller%initialise( & | ||
| config, model_clock, rho_d_latest, wind_adv, wind_adv_ptr, outer, & | ||
| cheap_update_step & | ||
| ) | ||
| end subroutine consistent_wind_alg | ||
|
|
||
| end module consistent_wind_alg_mod | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.