-
Notifications
You must be signed in to change notification settings - Fork 47
Safely compute height fields for continuous function spaces #284
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
tommbendall
wants to merge
8
commits into
MetOffice:main
Choose a base branch
from
tommbendall:TBendall/HeightContinuous
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 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4c24461
implement continuous height kernel, and rename existing height kernel
tommbendall a545d03
fix test
tommbendall 24bba86
remove unused variables
tommbendall 6afc9ca
treat height_wtheta with discontinuous kernel
tommbendall 0bba602
Main to Stable 2026.03.1 (#297)
james-bruten-mo 25b1083
Merge pull request #4 from MetOffice/stable
tommbendall 4c1deff
Merge remote-tracking branch 'origin/stable' into TBendall/HeightCont…
tommbendall c08820f
science review: fix height_w2h names and add comments
tommbendall 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 |
|---|---|---|
|
|
@@ -1177,8 +1177,12 @@ contains | |
| !> @return A height field | ||
| function get_height_fe(space_id, mesh_id) result(height) | ||
|
|
||
| use sci_get_height_kernel_mod, only: get_height_kernel_type | ||
| use planet_config_mod, only: scaled_radius | ||
| use sci_height_continuous_kernel_mod, only: height_continuous_kernel_type | ||
| use sci_height_discontinuous_kernel_mod, & | ||
| only: height_discontinuous_kernel_type | ||
| use base_mesh_config_mod, only: geometry | ||
| use finite_element_config_mod, only: coord_system | ||
| use planet_config_mod, only: scaled_radius | ||
|
|
||
| implicit none | ||
|
|
||
|
|
@@ -1190,6 +1194,9 @@ contains | |
| type(function_space_type), pointer :: space | ||
| type(field_type), pointer :: chi(:) | ||
| type(field_type), pointer :: height | ||
| type(field_type) :: rmultiplicity | ||
| type(field_type) :: nodal_multiplicity | ||
| type(field_type) :: ones | ||
| character(len=str_def) :: inventory_name | ||
| integer(tik) :: id | ||
|
|
||
|
|
@@ -1238,11 +1245,37 @@ contains | |
|
|
||
| if ( LPROF ) call start_timing( id, 'runtime_constants.geometric' ) | ||
|
|
||
| space => function_space_collection%get_fs(mesh, element_order_h, & | ||
| element_order_v, space_id) | ||
| space => function_space_collection%get_fs( & | ||
| mesh, element_order_h, element_order_v, space_id & | ||
| ) | ||
| call inventory%add_field(height, space, mesh) | ||
|
|
||
| call invoke( get_height_kernel_type(height, chi, scaled_radius) ) | ||
| select case (space_id) | ||
| case (W3, Wtheta) | ||
| call invoke( & | ||
| height_discontinuous_kernel_type( & | ||
| height, chi, geometry, coord_system, scaled_radius & | ||
| ) & | ||
| ) | ||
|
|
||
| case default | ||
| ! Can't import multiplicity, so must calculate it | ||
| call ones%initialise( space ) | ||
| call nodal_multiplicity%initialise( space ) | ||
| call rmultiplicity%initialise( space ) | ||
|
|
||
| call invoke( & | ||
| setval_c(ones, 1.0_r_def), & | ||
| setval_c(nodal_multiplicity, 0.0_r_def), & | ||
| multiplicity_kernel_type(nodal_multiplicity), & | ||
| X_divideby_Y(rmultiplicity, ones, nodal_multiplicity), & | ||
| setval_c(height, 0.0_r_def), & | ||
| height_continuous_kernel_type( & | ||
| height, chi, rmultiplicity, & | ||
| geometry, coord_system, scaled_radius & | ||
| ) & | ||
| ) | ||
| end select | ||
|
|
||
| if ( LPROF ) call stop_timing( id, 'runtime_constants.geometric' ) | ||
| else | ||
|
|
@@ -1257,8 +1290,12 @@ contains | |
| !> @return A height field | ||
| function get_height_fv(space_id, mesh_id) result(height) | ||
|
|
||
| use sci_get_height_kernel_mod, only: get_height_kernel_type | ||
| use planet_config_mod, only: scaled_radius | ||
| use sci_height_continuous_kernel_mod, only: height_continuous_kernel_type | ||
| use sci_height_discontinuous_kernel_mod, & | ||
| only: height_discontinuous_kernel_type | ||
| use base_mesh_config_mod, only: geometry | ||
| use finite_element_config_mod, only: coord_system | ||
| use planet_config_mod, only: scaled_radius | ||
|
|
||
| implicit none | ||
|
|
||
|
|
@@ -1270,6 +1307,9 @@ contains | |
| type(function_space_type), pointer :: space | ||
| type(field_type), pointer :: chi(:) | ||
| type(field_type), pointer :: height | ||
| type(field_type) :: rmultiplicity | ||
| type(field_type) :: nodal_multiplicity | ||
| type(field_type) :: ones | ||
| character(len=str_def) :: inventory_name | ||
| integer(tik) :: id | ||
|
|
||
|
|
@@ -1315,7 +1355,32 @@ contains | |
| space => function_space_collection%get_fs(mesh, 0, 0, space_id) | ||
| call inventory%add_field(height, space, mesh) | ||
|
|
||
| call invoke( get_height_kernel_type(height, chi, scaled_radius) ) | ||
| select case (space_id) | ||
| case (W3, Wtheta) | ||
| call invoke( & | ||
| height_discontinuous_kernel_type( & | ||
| height, chi, geometry, coord_system, scaled_radius & | ||
| ) & | ||
| ) | ||
|
|
||
| case default | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above, maybe a comment about continuous spaces |
||
| ! Can't import multiplicity, so must calculate it | ||
| call ones%initialise( space ) | ||
| call nodal_multiplicity%initialise( space ) | ||
| call rmultiplicity%initialise( space ) | ||
|
|
||
| call invoke( & | ||
| setval_c(ones, 1.0_r_def), & | ||
| setval_c(nodal_multiplicity, 0.0_r_def), & | ||
| multiplicity_kernel_type(nodal_multiplicity), & | ||
| X_divideby_Y(rmultiplicity, ones, nodal_multiplicity), & | ||
| setval_c(height, 0.0_r_def), & | ||
| height_continuous_kernel_type( & | ||
| height, chi, rmultiplicity, & | ||
| geometry, coord_system, scaled_radius & | ||
| ) & | ||
| ) | ||
| end select | ||
|
|
||
| if ( LPROF ) call stop_timing( id, 'runtime_constants.geometric' ) | ||
| else | ||
|
|
||
144 changes: 0 additions & 144 deletions
144
components/science/source/kernel/geometry/sci_get_height_kernel_mod.F90
This file was deleted.
Oops, something went wrong.
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.
It might be helpful to put a comment here saying that this is for continuous spaces (or continuous horizontal spaces, hence wtheta using the discontinuous kernel)