Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
2 changes: 2 additions & 0 deletions applications/gungho_model/example/file_def_initial.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<field field_ref="init_exner"/>
<field field_ref="init_height_w3"/>
<field field_ref="init_height_wth"/>
<field field_ref="init_height_w2h"/>
<field field_ref="init_height_w0"/>
</field_group>
</file>

Expand Down
2 changes: 2 additions & 0 deletions applications/lfric_atm/metadata/field_def_diags.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
<field id="w_in_w3_star" name="w_in_w3_star" long_name="physics_predictor_upward_air_velocity_at_cell_centres" unit="ms-1" grid_ref="half_level_face_grid" />
<field id="height_w3" name="height_w3" long_name="height_of_cell_centres_above_earth_radius" standard_name="height_above_mean_sea_level" unit="m" grid_ref="half_level_face_grid" />
<field id="height_wth" name="height_wth" long_name="height_of_cell_interfaces_above_earth_radius" standard_name="height_above_mean_sea_level" unit="m" grid_ref="full_level_face_grid" />
<field id="height_w2h" name="height_w2h" long_name="height_of_cell_faces_above_earth_radius" standard_name="height_above_mean_sea_level" unit="m" grid_ref="half_level_edge_grid" />
<field id="height_w0" name="height_w0" long_name="height_of_cell_vertices_above_earth_radius" standard_name="height_above_mean_sea_level" unit="m" grid_ref="node_grid" />
<!-- First line extracts level 0, second line removes vertical coordinate, cannot do as one -->
<field id="zoomed__orography" field_ref="height_wth" grid_ref="full_level_0_face_zoom" />
<field id="orography" name="orography" long_name="surface_altitude" standard_name="surface_altitude" unit="m" domain_ref="face" > zoomed__orography </field>
Expand Down
2 changes: 2 additions & 0 deletions applications/lfric_atm/metadata/field_def_initial_diags.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<field id="init_exner" name="exner" long_name="exner_pressure" unit="1" grid_ref="half_level_face_grid" />
<field id="init_height_w3" name="height_w3" long_name="height_of_cell_centres_above_earth_radius" unit="m" grid_ref="half_level_face_grid" />
<field id="init_height_wth" name="height_wth" long_name="height_of_cell_interfaces_above_earth_radius" unit="m" grid_ref="full_level_face_grid" />
<field id="init_height_w0" name="height_w0" long_name="height_of_cell_vertices_above_earth_radius" unit="m" grid_ref="node_grid" />
<field id="init_height_w2h" name="height_w2h" long_name="height_of_cell_faces_above_earth_radius" unit="m" grid_ref="half_level_edge_grid" />
<field id="init_ageofair" name="ageofair" long_name="ageofair" unit="s" grid_ref="half_level_face_grid" />
<field id="init_area_at_msl" name="cell_area" long_name="grid_cell_area" standard_name="grid_cell_area" unit="m2" domain_ref="face"/>
</field_group>
Expand Down
4 changes: 2 additions & 2 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions rose-stem/app/gungho_model/file/file_def_initial.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<field field_ref="init_exner"/>
<field field_ref="init_height_w3"/>
<field field_ref="init_height_wth"/>
<field field_ref="init_height_w2h"/>
<field field_ref="init_height_w0"/>
</field_group>
</file>

Expand Down
135 changes: 69 additions & 66 deletions science/gungho/source/driver/gungho_diagnostics_driver_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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, &
Expand All @@ -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
Expand Down Expand Up @@ -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')

Expand All @@ -161,31 +157,38 @@ 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)
call write_scalar_diagnostic('theta', theta, &
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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading