diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index da42a74b5..04ff97bc6 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -5,3 +5,4 @@ | james-bruten-mo | James Bruten | Met Office | 2025-12-09 | | jennyhickson | Jenny Hickson | Met Office | 2025-12-10 | | mo-marqh | mark Hedley | Met Office | 2025-12-11 | +| tommbendall | Thomas Bendall | Met Office | 2025-01-20 | diff --git a/applications/gungho_model/example/file_def_initial.xml b/applications/gungho_model/example/file_def_initial.xml index 2b1050253..42cf3bfec 100644 --- a/applications/gungho_model/example/file_def_initial.xml +++ b/applications/gungho_model/example/file_def_initial.xml @@ -13,6 +13,8 @@ + + diff --git a/applications/jedi_lfric_tests/example/iodef.xml b/applications/jedi_lfric_tests/example/iodef.xml index 368ff5621..a125a581c 100644 --- a/applications/jedi_lfric_tests/example/iodef.xml +++ b/applications/jedi_lfric_tests/example/iodef.xml @@ -140,6 +140,8 @@ + + @@ -186,6 +188,8 @@ + + diff --git a/applications/jedi_lfric_tests/example_forecast/iodef.xml b/applications/jedi_lfric_tests/example_forecast/iodef.xml index 5af66f247..ffc020047 100644 --- a/applications/jedi_lfric_tests/example_forecast/iodef.xml +++ b/applications/jedi_lfric_tests/example_forecast/iodef.xml @@ -66,6 +66,8 @@ + + diff --git a/applications/jedi_lfric_tests/example_id_tlm_tests/iodef.xml b/applications/jedi_lfric_tests/example_id_tlm_tests/iodef.xml index 1de565f8b..19cdab1c7 100644 --- a/applications/jedi_lfric_tests/example_id_tlm_tests/iodef.xml +++ b/applications/jedi_lfric_tests/example_id_tlm_tests/iodef.xml @@ -234,6 +234,8 @@ + + @@ -280,6 +282,8 @@ + + diff --git a/applications/jedi_lfric_tests/example_tlm_forecast_tl/iodef.xml b/applications/jedi_lfric_tests/example_tlm_forecast_tl/iodef.xml index 1de565f8b..19cdab1c7 100644 --- a/applications/jedi_lfric_tests/example_tlm_forecast_tl/iodef.xml +++ b/applications/jedi_lfric_tests/example_tlm_forecast_tl/iodef.xml @@ -234,6 +234,8 @@ + + @@ -280,6 +282,8 @@ + + diff --git a/applications/jedi_lfric_tests/example_tlm_tests/iodef.xml b/applications/jedi_lfric_tests/example_tlm_tests/iodef.xml index 1de565f8b..19cdab1c7 100644 --- a/applications/jedi_lfric_tests/example_tlm_tests/iodef.xml +++ b/applications/jedi_lfric_tests/example_tlm_tests/iodef.xml @@ -234,6 +234,8 @@ + + @@ -280,6 +282,8 @@ + + diff --git a/applications/lfric_atm/metadata/field_def_diags.xml b/applications/lfric_atm/metadata/field_def_diags.xml index 007ee86df..a17d884f9 100644 --- a/applications/lfric_atm/metadata/field_def_diags.xml +++ b/applications/lfric_atm/metadata/field_def_diags.xml @@ -43,6 +43,8 @@ + + zoomed__orography diff --git a/applications/lfric_atm/metadata/field_def_initial_diags.xml b/applications/lfric_atm/metadata/field_def_initial_diags.xml index 707675af2..b91c8aed1 100644 --- a/applications/lfric_atm/metadata/field_def_initial_diags.xml +++ b/applications/lfric_atm/metadata/field_def_initial_diags.xml @@ -21,6 +21,8 @@ + + diff --git a/applications/linear_model/example/iodef.xml b/applications/linear_model/example/iodef.xml index 65df40e15..ff821d75b 100644 --- a/applications/linear_model/example/iodef.xml +++ b/applications/linear_model/example/iodef.xml @@ -80,9 +80,9 @@ - - - + + + @@ -134,6 +134,8 @@ + + @@ -180,6 +182,8 @@ + + diff --git a/dependencies.yaml b/dependencies.yaml index caab36487..93062a68c 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -30,8 +30,8 @@ lfric_apps: ref: lfric_core: - source: git@github.com:MetOffice/lfric_core.git - ref: 2025.12.1 + source: git@github.com:tommbendall/lfric_core.git + ref: TBendall/HeightW0 moci: source: git@github.com:MetOffice/moci.git diff --git a/rose-stem/app/gungho_model/file/file_def_initial.xml b/rose-stem/app/gungho_model/file/file_def_initial.xml index 2b1050253..42cf3bfec 100644 --- a/rose-stem/app/gungho_model/file/file_def_initial.xml +++ b/rose-stem/app/gungho_model/file/file_def_initial.xml @@ -13,6 +13,8 @@ + + diff --git a/rose-stem/app/jedi_forecast/file/iodef.xml b/rose-stem/app/jedi_forecast/file/iodef.xml index 5af66f247..ffc020047 100644 --- a/rose-stem/app/jedi_forecast/file/iodef.xml +++ b/rose-stem/app/jedi_forecast/file/iodef.xml @@ -66,6 +66,8 @@ + + diff --git a/rose-stem/app/jedi_id_tlm_tests/file/iodef.xml b/rose-stem/app/jedi_id_tlm_tests/file/iodef.xml index 7d20e4080..cbb274d07 100644 --- a/rose-stem/app/jedi_id_tlm_tests/file/iodef.xml +++ b/rose-stem/app/jedi_id_tlm_tests/file/iodef.xml @@ -234,6 +234,8 @@ + + @@ -280,6 +282,8 @@ + + diff --git a/rose-stem/app/jedi_lfric_tests/file/iodef.xml b/rose-stem/app/jedi_lfric_tests/file/iodef.xml index 07b94bab0..883ad750e 100644 --- a/rose-stem/app/jedi_lfric_tests/file/iodef.xml +++ b/rose-stem/app/jedi_lfric_tests/file/iodef.xml @@ -140,6 +140,8 @@ + + @@ -186,6 +188,8 @@ + + diff --git a/rose-stem/app/jedi_tlm_forecast_tl/file/iodef.xml b/rose-stem/app/jedi_tlm_forecast_tl/file/iodef.xml index 7d20e4080..cbb274d07 100644 --- a/rose-stem/app/jedi_tlm_forecast_tl/file/iodef.xml +++ b/rose-stem/app/jedi_tlm_forecast_tl/file/iodef.xml @@ -234,6 +234,8 @@ + + @@ -280,6 +282,8 @@ + + diff --git a/rose-stem/app/jedi_tlm_tests/file/iodef.xml b/rose-stem/app/jedi_tlm_tests/file/iodef.xml index 7d20e4080..cbb274d07 100644 --- a/rose-stem/app/jedi_tlm_tests/file/iodef.xml +++ b/rose-stem/app/jedi_tlm_tests/file/iodef.xml @@ -234,6 +234,8 @@ + + @@ -280,6 +282,8 @@ + + diff --git a/rose-stem/app/linear_model/file/iodef.xml b/rose-stem/app/linear_model/file/iodef.xml index 8591084dc..191f72f4b 100644 --- a/rose-stem/app/linear_model/file/iodef.xml +++ b/rose-stem/app/linear_model/file/iodef.xml @@ -140,6 +140,8 @@ + + @@ -186,6 +188,8 @@ + + diff --git a/science/gungho/source/driver/gungho_diagnostics_driver_mod.F90 b/science/gungho/source/driver/gungho_diagnostics_driver_mod.F90 index 12cc745a4..497e1b984 100644 --- a/science/gungho/source/driver/gungho_diagnostics_driver_mod.F90 +++ b/science/gungho/source/driver/gungho_diagnostics_driver_mod.F90 @@ -35,7 +35,7 @@ module gungho_diagnostics_driver_mod use formulation_config_mod, only : use_physics, & moisture_formulation, & moisture_formulation_dry - use fs_continuity_mod, only : W3, Wtheta + use fs_continuity_mod, only : W3, Wtheta, W2H, W0 use integer_field_mod, only : integer_field_type use initialization_config_mod, only : ls_option, & ls_option_analytic, & @@ -46,8 +46,8 @@ module gungho_diagnostics_driver_mod use log_mod, only : log_event, & LOG_LEVEL_DEBUG use sci_geometric_constants_mod, & - only : get_panel_id, get_height_fe, & - get_height_fv, get_da_msl_proj + only : get_panel_id, & + get_height_fe, get_da_msl_proj use io_config_mod, only : subroutine_timers, use_xios_io, write_fluxes use timer_mod, only : timer use transport_config_mod, only : transport_ageofair @@ -86,56 +86,52 @@ subroutine gungho_diagnostics_driver( modeldb, & type(mesh_type), intent(in), pointer :: twod_mesh logical, intent(in) :: nodal_output_on_w3 - type( field_collection_type ), pointer :: prognostic_fields => null() - type( field_collection_type ), pointer :: con_tracer_last_outer - type( field_collection_type ), pointer :: lbc_fields - type( field_collection_type ), pointer :: moisture_fields => null() - type( field_type ), pointer :: mr(:) => null() - type( field_type ), pointer :: moist_dyn(:) => null() - type( field_collection_type ), pointer :: derived_fields - - type( field_type), pointer :: theta => null() - type( field_type), pointer :: u => null() - type( field_type), pointer :: h_u => null() - type( field_type), pointer :: v_u => null() - type( field_type), pointer :: rho => null() - type( field_type), pointer :: exner => null() - type( field_type), pointer :: panel_id => null() - type( field_type), pointer :: height_w3 => null() - type( field_type), pointer :: height_wth => null() - type( field_type), pointer :: lbc_u => null() - type( field_type), pointer :: lbc_theta => null() - type( field_type), pointer :: lbc_rho => null() - type( field_type), pointer :: lbc_exner => null() - type( field_type), pointer :: lbc_m_v=> null() - type( field_type), pointer :: lbc_q=> null() - type( field_type), pointer :: u_in_w2h => null() - type( field_type), pointer :: v_in_w2h => null() - type( field_type), pointer :: w_in_wth => null() - type( field_type), pointer :: ageofair => null() - type( field_type), pointer :: exner_in_wth => null() - type( field_type), pointer :: dA => null() - - type(field_array_type), pointer :: mr_array => null() - type(field_array_type), pointer :: moist_dyn_array => null() + type(field_collection_type), pointer :: prognostic_fields + type(field_collection_type), pointer :: con_tracer_last_outer + type(field_collection_type), pointer :: lbc_fields + type(field_collection_type), pointer :: moisture_fields + type(field_type), pointer :: mr(:) + type(field_type), pointer :: moist_dyn(:) + type(field_collection_type), pointer :: derived_fields + + type(field_type), pointer :: theta + type(field_type), pointer :: u + type(field_type), pointer :: h_u + type(field_type), pointer :: v_u + type(field_type), pointer :: rho + type(field_type), pointer :: exner + type(field_type), pointer :: panel_id + type(field_type), pointer :: height + type(field_type), pointer :: lbc_u + type(field_type), pointer :: lbc_theta + type(field_type), pointer :: lbc_rho + type(field_type), pointer :: lbc_exner + type(field_type), pointer :: lbc_m_v + type(field_type), pointer :: lbc_q + type(field_type), pointer :: u_in_w2h + type(field_type), pointer :: v_in_w2h + type(field_type), pointer :: w_in_wth + type(field_type), pointer :: ageofair + type(field_type), pointer :: exner_in_wth + type(field_type), pointer :: dA + + type(field_array_type), pointer :: mr_array + type(field_array_type), pointer :: moist_dyn_array ! Iterator for field collection type(field_collection_iterator_type) :: iterator ! A pointer used for retrieving fields from collections ! when iterating over them - class( field_parent_type ), pointer :: field_ptr => null() + class(field_parent_type), pointer :: field_ptr => null() + procedure(write_interface), pointer :: tmp_write_ptr + type(io_value_type), pointer :: temp_corr_io_value - type(io_value_type), pointer :: temp_corr_io_value + integer(kind=i_def) :: i, fs + character(len=str_def) :: name, prefix, field_name - character(str_def) :: name - - integer :: fs - integer :: element_order_h, element_order_v - - procedure(write_interface), pointer :: tmp_write_ptr => null() - - integer :: i + integer(kind=i_def), allocatable :: fs_ids(:) + character(len=str_def), allocatable :: fs_names(:) if ( subroutine_timers ) call timer('gungho_diagnostics_driver') @@ -161,20 +157,6 @@ subroutine gungho_diagnostics_driver( modeldb, & call prognostic_fields%get_field('rho', rho) call prognostic_fields%get_field('exner', exner) - ! Get element orders and get the finite element or finite volume height - element_order_h = theta%get_element_order_h() - element_order_v = theta%get_element_order_v() - - if (element_order_h > 0 .or. element_order_v > 0) then - ! Get the finite element height - height_w3 => get_height_fe(W3, mesh%get_id()) - height_wth => get_height_fe(Wtheta, mesh%get_id()) - else - ! Get the finite volume height - height_w3 => get_height_fv(W3, mesh%get_id()) - height_wth => get_height_fv(Wtheta, mesh%get_id()) - end if - ! Scalar fields call write_scalar_diagnostic('rho', rho, & modeldb%clock, mesh, nodal_output_on_w3) @@ -182,10 +164,31 @@ subroutine gungho_diagnostics_driver( modeldb, & modeldb%clock, mesh, nodal_output_on_w3) call write_scalar_diagnostic('exner', exner, & modeldb%clock, mesh, nodal_output_on_w3) - call write_scalar_diagnostic('height_w3', height_w3, & - modeldb%clock, mesh, nodal_output_on_w3) - call write_scalar_diagnostic('height_wth', height_wth, & - modeldb%clock, mesh, nodal_output_on_w3) + + ! Write out heights of function space DoFs, if requested + allocate(fs_names(4)) + allocate(fs_ids(4)) + fs_names = (/ "w0 ", "w2h", "w3 ", "wth" /) ! Spaces to align lengths + fs_ids = (/ W0, W2H, W3, Wtheta /) + if (use_xios_io) then + if (modeldb%clock%is_initialisation()) then + prefix = "init_" + else + prefix = "" + end if + tmp_write_ptr => write_field_generic + do i = 1, SIZE(fs_names) + field_name = trim(prefix)//"height_"//trim(fs_names(i)) + fs = fs_ids(i) + if (diagnostic_to_be_sampled(trim(field_name))) then + height => get_height_fe(fs, mesh%get_id()) + call height%set_write_behaviour(tmp_write_ptr) + call height%write_field(trim(field_name)) + end if + end do + end if + deallocate(fs_names) + deallocate(fs_ids) if (transport_ageofair) then call con_tracer_last_outer%get_field('ageofair',ageofair) @@ -233,7 +236,7 @@ subroutine gungho_diagnostics_driver( modeldb, & ! Moisture fields if ( moisture_formulation /= moisture_formulation_dry ) then - do i=1,nummr + do i = 1, nummr call write_scalar_diagnostic( trim(mr_names(i)), mr(i), & modeldb%clock, mesh, nodal_output_on_w3 ) end do @@ -276,8 +279,8 @@ subroutine gungho_diagnostics_driver( modeldb, & modeldb%clock, mesh, nodal_output_on_w3) call write_vector_diagnostic('readlbc_h_u', h_u, & modeldb%clock, mesh, nodal_output_on_w3) - endif - endif + end if + end if ! Derived physics fields (only those on W3 or Wtheta) if (use_physics .and. use_xios_io .and. .not. modeldb%clock%is_initialisation()) then