-
Notifications
You must be signed in to change notification settings - Fork 118
Linear Semi-Lagrangian Vertical Transport #777
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
James Kent (jameskent-metoffice)
wants to merge
2
commits into
MetOffice:main
Choose a base branch
from
jameskent-metoffice:linear_vert_sl
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 all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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,6 +1,6 @@ | ||
| [namelist:transport] | ||
| ffsl_vertical_order=5*1 | ||
| horizontal_method=2,1,2,2,2 | ||
| log_space=.false.,.true.,.false.,.false.,.false. | ||
| log_space=5*.false. | ||
| reversible=.false.,.true.,.false.,.false.,.false. | ||
| vertical_method=2,1,2,2,2 | ||
| vertical_method=2,3,2,2,2 | ||
6 changes: 3 additions & 3 deletions
6
...ar_model/azspice/checksum_linear_model_dcmip301_ffsl-C24_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 = 3F202FBD547CFA2D | ||
| Inner product checksum theta = 403285E05B4CEE85 | ||
| Inner product checksum u = 432FFEFCD1E82680 | ||
| Inner product checksum rho = 3F2019E259693832 | ||
| Inner product checksum theta = 4031F066852F6E6E | ||
| Inner product checksum u = 432F625A30D467E1 |
14 changes: 7 additions & 7 deletions
14
...model/azspice/checksum_linear_model_nwp_gal9_ffsl-C12_MG_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,9 +1,9 @@ | ||
| Inner product checksum rho = 3FB292C1A8DEAC36 | ||
| Inner product checksum theta = 4170C7E80A07EB51 | ||
| Inner product checksum u = 456DDD0B26100D01 | ||
| Inner product checksum mr1 = 3F96D21A5BF1ED5C | ||
| Inner product checksum mr2 = 3F73B1D0D7B555A1 | ||
| Inner product checksum mr3 = 3EF232F1B59B8986 | ||
| Inner product checksum mr4 = 3EF2CFD7D89D0460 | ||
| Inner product checksum rho = 3FB2CA8556C55BB7 | ||
| Inner product checksum theta = 41797208FAB6082E | ||
| Inner product checksum u = 45701C36CF132A6E | ||
| Inner product checksum mr1 = 3F96CFC5AE7C887E | ||
| Inner product checksum mr2 = 3F73B1BC0FE7F5D3 | ||
| Inner product checksum mr3 = 3EF232F5C6451F32 | ||
| Inner product checksum mr4 = 3EF2CFC507886DA2 | ||
| Inner product checksum mr5 = 0 | ||
| Inner product checksum mr6 = 0 |
6 changes: 3 additions & 3 deletions
6
...s/linear_model/ex1a/checksum_linear_model_dcmip301_ffsl-C24_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 = 3F202FBE9989F062 | ||
| Inner product checksum theta = 403285DFD9BCF1D0 | ||
| Inner product checksum u = 432FFEF63CBF50AD | ||
| Inner product checksum rho = 3F2019E2F24B8D66 | ||
| Inner product checksum theta = 4031F066379053E7 | ||
| Inner product checksum u = 432F6254B8B7054B |
14 changes: 7 additions & 7 deletions
14
...inear_model/ex1a/checksum_linear_model_nwp_gal9_ffsl-C12_MG_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,9 +1,9 @@ | ||
| Inner product checksum rho = 3FB292B6ABD3E01E | ||
| Inner product checksum theta = 4170C7E8288381C8 | ||
| Inner product checksum u = 456DDD0B80AF63F2 | ||
| Inner product checksum mr1 = 3F96D2137D2B27E5 | ||
| Inner product checksum mr2 = 3F73B1D0D7B6CD3A | ||
| Inner product checksum mr3 = 3EF232F1B44659C0 | ||
| Inner product checksum mr4 = 3EF2CFD7E1969965 | ||
| Inner product checksum rho = 3FB2CA785066B264 | ||
| Inner product checksum theta = 41797208F3830022 | ||
| Inner product checksum u = 45701C36A8FED04A | ||
| Inner product checksum mr1 = 3F96CFBC6DB7C8DE | ||
| Inner product checksum mr2 = 3F73B1BC0FE0A525 | ||
| Inner product checksum mr3 = 3EF232F5C6381B6C | ||
| Inner product checksum mr4 = 3EF2CFC505737AA9 | ||
| Inner product checksum mr5 = 0 | ||
| Inner product checksum mr6 = 0 |
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
158 changes: 158 additions & 0 deletions
158
science/linear/source/algorithm/transport/sl/tl_vertical_sl_advective_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,158 @@ | ||
| !----------------------------------------------------------------------------- | ||
| ! (c) Crown copyright Met Office. All rights reserved. | ||
| ! The file LICENCE, distributed with this code, contains details of the terms | ||
| ! under which the code may be used. | ||
| !----------------------------------------------------------------------------- | ||
| !> @brief An algorithm for performing 1D vertical semi-Lagrangian advective TL transport. | ||
| !> @details The algorithm performs a 1D vertical semi-Lagrangian advective | ||
| !! transport of a field for the linear model. It computes the perturbation field | ||
| !! at the departure point using linear or cubic interpolation, and the | ||
| !! derivative of the ls field interpolation at the departure point. | ||
|
|
||
| module tl_vertical_sl_advective_alg_mod | ||
|
|
||
| ! Constants and types | ||
| use constants_mod, only: r_tran, i_def, l_def | ||
| use integer_field_mod, only: integer_field_type | ||
| use log_mod, only: log_event, LOG_LEVEL_ERROR | ||
| use mesh_mod, only: mesh_type | ||
| use r_tran_field_mod, only: r_tran_field_type | ||
| use timing_mod, only: start_timing, stop_timing, & | ||
| tik, LPROF | ||
|
|
||
| ! Transport control | ||
| use tl_transport_controller_mod, only: tl_transport_controller_type | ||
| use transport_controller_mod, only: transport_controller_type | ||
| use transport_counter_mod, only: transport_counter_type | ||
| use transport_metadata_mod, only: transport_metadata_type | ||
| use wind_precomputations_alg_mod, only: wind_precomputations_type | ||
|
|
||
| ! Algorithms and kernels | ||
| use tl_end_of_transport_step_alg_mod, only: tl_end_of_advective_step_alg | ||
| use tl_vertical_cubic_sl_kernel_mod, only: tl_vertical_cubic_sl_kernel_type | ||
|
|
||
| ! Configs | ||
| use transport_config_mod, only: vertical_sl_order, & | ||
| vertical_sl_order_cubic, & | ||
| vertical_sl_order_cubic_hermite | ||
|
|
||
| implicit none | ||
|
|
||
| private | ||
|
|
||
| public :: tl_vertical_sl_advective_alg | ||
|
|
||
| contains | ||
|
|
||
| !----------------------------------------------------------------------------- | ||
| !> @brief An algorithm to perform 1D vertical advection in the linear model | ||
| !! by interpolating data to departure points (SL-advection) and | ||
| !! computing the ls field gradient. | ||
| !> @param[in,out] field_np1 ACTIVE Perturbation field at the end of | ||
| !! the transport step | ||
| !> @param[in] field ACTIVE Perturbation field at the start | ||
| !! of the transport step | ||
| !> @param[in] ls_field PASSIVE Linearisation state field at the | ||
| !! start of the transport step | ||
| !> @param[in,out] tl_transport_controller | ||
| !! Object controlling the transport | ||
| subroutine tl_vertical_sl_advective_alg( field_np1, field_n, ls_field_n, & | ||
| tl_transport_controller ) | ||
|
|
||
| implicit none | ||
|
|
||
| ! Arguments | ||
| type(r_tran_field_type), intent(inout) :: field_np1 | ||
| type(r_tran_field_type), intent(in) :: field_n | ||
| type(r_tran_field_type), intent(in) :: ls_field_n | ||
| type(tl_transport_controller_type), intent(inout) :: tl_transport_controller | ||
|
|
||
| ! Mesh and transport objects | ||
| type(mesh_type), pointer :: mesh | ||
| type(wind_precomputations_type), pointer :: ls_wind_precomputations | ||
| type(wind_precomputations_type), pointer :: pert_wind_precomputations | ||
| type(transport_controller_type), pointer :: ls_transport_controller | ||
| type(transport_controller_type), pointer :: pert_transport_controller | ||
| type(transport_counter_type), pointer :: transport_counter | ||
| type(transport_metadata_type), pointer :: transport_metadata | ||
| integer(kind=i_def) :: sl_order | ||
| integer(kind=i_def) :: mesh_id | ||
| integer(kind=i_def) :: space | ||
| integer(kind=i_def) :: step | ||
| integer(kind=i_def) :: splitting | ||
| logical(kind=l_def) :: reversibility | ||
| integer(tik) :: id | ||
|
|
||
| ! Interpolation coefficients | ||
| type(r_tran_field_type), pointer :: interp_coeffs(:) | ||
| type(integer_field_type), pointer :: interp_indices(:) | ||
| type(r_tran_field_type), pointer :: dep_dist_pert | ||
|
|
||
| if ( LPROF ) call start_timing( id, 'transport.tl_sl_vertical' ) | ||
|
|
||
| ! Get transport objects | ||
| ls_transport_controller => tl_transport_controller%get_ls_wind_pert_rho_controller() | ||
| pert_transport_controller => tl_transport_controller%get_pert_wind_ls_rho_controller() | ||
| ls_wind_precomputations => ls_transport_controller%get_wind_precomputations() | ||
| pert_wind_precomputations => pert_transport_controller%get_wind_precomputations() | ||
| transport_counter => pert_transport_controller%get_transport_counter() | ||
| transport_metadata => pert_transport_controller%get_transport_metadata() | ||
|
|
||
| ! Get mesh and transport options | ||
| mesh => field_n%get_mesh() | ||
| mesh_id = mesh%get_id() | ||
| space = field_n%which_function_space() | ||
| reversibility = transport_metadata%get_reversible() | ||
| step = transport_counter%get_split_step_of_substep_counter() | ||
| splitting = transport_metadata%get_splitting() | ||
|
|
||
| select case ( vertical_sl_order ) | ||
| ! Note TL only set up for cubic coefficients | ||
| case ( vertical_sl_order_cubic ) | ||
| sl_order = vertical_sl_order | ||
| if ( reversibility ) then | ||
| sl_order = vertical_sl_order_cubic_hermite | ||
| end if | ||
| case default | ||
| call log_event('TL vertical semi-Lagrangian only compatible with cubic coefficients', LOG_LEVEL_ERROR) | ||
| end select | ||
|
|
||
| ! Set field_np1 = field_n and compute TL transport as | ||
| ! field_np1 = field_n_D - dt u grad ls_field | ||
| call invoke( setval_X(field_np1, field_n) ) | ||
|
|
||
| ! Get the SL interpolation coefficients and indices | ||
| interp_coeffs => ls_wind_precomputations%get_vert_sl_coeff( & | ||
| mesh_id, space, sl_order, splitting, step & | ||
| ) | ||
| interp_indices => ls_wind_precomputations%get_vert_sl_index( & | ||
| mesh_id, space, sl_order, splitting, step & | ||
| ) | ||
| ! Require departure distance from perturbation wind | ||
| dep_dist_pert => pert_wind_precomputations%get_dep_dist_z( & | ||
| mesh_id, splitting, step & | ||
| ) | ||
|
|
||
| ! Cubic (Lagrange or Hermite) interpolation of field | ||
| call invoke( tl_vertical_cubic_sl_kernel_type( field_np1, & | ||
| ls_field_n, & | ||
| dep_dist_pert, & | ||
| interp_coeffs(1), & | ||
| interp_coeffs(2), & | ||
| interp_coeffs(3), & | ||
| interp_coeffs(4), & | ||
| interp_indices(1), & | ||
| interp_indices(2), & | ||
| interp_indices(3), & | ||
| interp_indices(4) ) ) | ||
|
|
||
| ! End of step: if necessary enforce min val and overwrite in blending zone | ||
| call tl_end_of_advective_step_alg( & | ||
| field_np1, field_n, transport_counter, transport_metadata & | ||
| ) | ||
|
|
||
| if ( LPROF ) call stop_timing( id, 'transport.tl_sl_vertical' ) | ||
|
|
||
| end subroutine tl_vertical_sl_advective_alg | ||
|
|
||
| end module tl_vertical_sl_advective_alg_mod |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just note here why this has changed from true to false. Is it because the target is to have 5*false and this is a permanent change, or is it because the log-space code is still to be created and this is temporary.