Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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 @@ -7,3 +7,4 @@
| jennyhickson | Jenny Hickson | Met Office | 2025-12-10 |
| mo-marqh | Mark Hedley | Met Office | 2025-12-11 |
| MatthewHambley | Matthew Hambley | Met Office | 2025-12-15 |
| tommbendall | Thomas Bendall | Met Office | 2026-01-22 |
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ subroutine initialise( program_name, modeldb, calendar )

character(str_def) :: prime_mesh_name

integer(i_def) :: stencil_depth
integer(i_def) :: stencil_depth(1)
integer(i_def) :: geometry
integer(i_def) :: method
integer(i_def) :: number_of_layers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ subroutine initialise( program_name, modeldb)

character(str_def) :: prime_mesh_name

integer(i_def) :: stencil_depth
integer(i_def) :: stencil_depth(1)
integer(i_def) :: geometry
integer(i_def) :: method
integer(i_def) :: number_of_layers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ subroutine initialise( program_name, modeldb)
character(str_def) :: output_mesh_name
character(str_def) :: context_name

integer(i_def) :: stencil_depth
integer(i_def) :: stencil_depth(1)
integer(i_def) :: geometry
integer(i_def) :: method
integer(i_def) :: number_of_layers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ subroutine initialise( program_name, modeldb)

character(str_def) :: prime_mesh_name

integer(i_def) :: stencil_depth
integer(i_def) :: stencil_depth(1)
integer(i_def) :: geometry
integer(i_def) :: method
integer(i_def) :: number_of_layers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ subroutine initialise( program_name, modeldb, calendar )

character(str_def) :: prime_mesh_name

integer(i_def) :: stencil_depth
integer(i_def) :: stencil_depth(1)
integer(i_def) :: geometry
integer(i_def) :: method
integer(i_def) :: number_of_layers
Expand Down
50 changes: 39 additions & 11 deletions components/driver/source/driver_mesh_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ module driver_mesh_mod
!> @param[in] total_ranks Total number of MPI ranks in this job.
!> @param[in] mesh_names Mesh names to load from the mesh input file(s).
!> @param[in] extrusion Extrusion object to be applied to meshes.
!> @param[in] stencil_depth Required stencil depth for the application.
!> @param[in] stencil_depths_in Required stencil depth for each mesh for
!! the application. If this array is of size 1 then
!! the single value is applied to all meshes.
!! Otherwise the array size must match the size
!! the mesh name array, allowing different depths
!! to be specified for different meshes.
!> @param[in] check_partitions Apply check for even partitions with the
!> configured partition stratedy.
!> (unpartitioned mesh input only)
Expand All @@ -90,7 +95,7 @@ module driver_mesh_mod
subroutine init_mesh( configuration, &
local_rank, total_ranks, &
mesh_names, extrusion, &
stencil_depth, &
stencil_depths_in, &
check_partitions, &
alt_names )

Expand All @@ -104,7 +109,7 @@ subroutine init_mesh( configuration, &
character(str_def), intent(in) :: mesh_names(:)
class(extrusion_type), intent(in) :: extrusion

integer(i_def), intent(in) :: stencil_depth
integer(i_def), intent(in) :: stencil_depths_in(:)
logical(l_def), intent(in) :: check_partitions

character(str_def), optional, intent(in) :: alt_names(:)
Expand Down Expand Up @@ -132,12 +137,13 @@ subroutine init_mesh( configuration, &
character(str_def), allocatable :: names(:)
character(str_def), allocatable :: tmp_mesh_names(:)
character(str_max_filename) :: input_mesh_file
integer(i_def), allocatable :: stencil_depths(:)

procedure(partitioner_interface), pointer :: partitioner_ptr

class(panel_decomposition_type), allocatable :: decomposition

integer(i_def) :: n_digit
integer(i_def) :: i, n_digit
character(str_def) :: fmt_str, number_str

!============================================================================
Expand All @@ -160,13 +166,33 @@ subroutine init_mesh( configuration, &
!============================================================================
! 0.1 Some basic checks
!============================================================================
! Set up stencil depth
if (stencil_depth < 0_i_def) then
write(log_scratch_space,'(A)') &
'Standard partitioned meshes must support a not -ve stencil_depth'

if ( size(stencil_depths_in) == 1 ) then
! Single stencil depth specified, apply to all meshes
allocate( stencil_depths( size(mesh_names) ) )
do i = 1, size(mesh_names)
stencil_depths(i) = stencil_depths_in(1)
end do
else if ( size(stencil_depths_in) == size(mesh_names) ) then
! Stencil depths specified per mesh
allocate( stencil_depths( size(mesh_names) ) )
stencil_depths = stencil_depths_in
else
write(log_scratch_space, '(A)') &
'Number of stencil depths specified does not '// &
'match number of requested meshes.'
call log_event(log_scratch_space, LOG_LEVEL_ERROR)
end if

! Check stencil depths are valid
do i = 1, size(stencil_depths)
if (stencil_depths(i) < 0_i_def) then
write(log_scratch_space,'(A)') &
'Standard partitioned meshes must support a not -ve stencil_depth'
call log_event(log_scratch_space, LOG_LEVEL_ERROR)
end if
end do

! Currently only quad elements are fully functional
if (cellshape /= CELLSHAPE_QUADRILATERAL) then
call log_event( "Reference_element must be QUAD for now...", &
Expand Down Expand Up @@ -240,8 +266,8 @@ subroutine init_mesh( configuration, &
! meshes are suitable for the supplied application
! configuration.
!===========================================================
call check_local_mesh( configuration, &
stencil_depth, &
call check_local_mesh( configuration, &
stencil_depths, &
mesh_names )

! 2.1c Load and assign mesh maps.
Expand Down Expand Up @@ -300,7 +326,7 @@ subroutine init_mesh( configuration, &
call create_local_mesh( mesh_names, &
local_rank, total_ranks, &
decomposition, &
stencil_depth, &
stencil_depths, &
generate_inner_halos, &
partitioner_ptr )

Expand Down Expand Up @@ -328,6 +354,8 @@ subroutine init_mesh( configuration, &
!============================================================================
call assign_mesh_maps(mesh_names)

deallocate(stencil_depths)

end subroutine init_mesh

end module driver_mesh_mod
20 changes: 10 additions & 10 deletions components/driver/source/mesh/check_local_mesh_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ module check_local_mesh_mod

!> @brief Basic validation that local meshes are suitable
!! for the specified configuration.
!> @param[in] configuration Configuration object.
!> @param[in] stencil_depth Stencil depth that local meshes
!> need to support.
!> @param[in] mesh_names Local meshes held in application
!! local mesh collection object.
subroutine check_local_mesh( configuration, &
stencil_depth, &
!> @param[in] configuration Configuration object.
!> @param[in] stencil_depths Stencil depths that each local mesh
!> needs to support.
!> @param[in] mesh_names Local meshes held in application
!! local mesh collection object.
subroutine check_local_mesh( configuration, &
stencil_depths, &
mesh_names )

implicit none

type(namelist_collection_type), intent(in) :: configuration
integer(i_def), intent(in) :: stencil_depth
integer(i_def), intent(in) :: stencil_depths(:)
character(str_def), intent(in) :: mesh_names(:)

integer(i_def) :: topology
Expand Down Expand Up @@ -120,10 +120,10 @@ subroutine check_local_mesh( configuration, &
!=====================================
max_stencil_depth = local_mesh%get_max_stencil_depth()

if ( max_stencil_depth < stencil_depth ) then
if ( max_stencil_depth < stencil_depths(i) ) then
write(log_scratch_space,'(2(A,I0),A)') &
'Insufficient stencil depth, configuration requires ', &
stencil_depth, '. Mesh "'//trim(mesh_names(i))// &
stencil_depths(i), '. Mesh "'//trim(mesh_names(i))// &
'" supports a maximum stencil depth of ', &
max_stencil_depth, '.'
call log_event(log_scratch_space, log_level_error)
Expand Down
10 changes: 5 additions & 5 deletions components/driver/source/mesh/runtime_partition_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ end subroutine get_partition_strategy
!> and method
!> @param[in] generate_inner_halos Generate inner halo regions
!! to overlap comms & compute
!> @param[in] stencil_depth Depth of cells outside the base cell
!! of stencil.
!> @param[in] stencil_depths Depth of cells outside the base cell
!! of stencil for each mesh.
!> @param[in] partitioner_ptr Mesh partitioning strategy
subroutine create_local_mesh( mesh_names, &
local_rank, total_ranks, &
decomposition, &
stencil_depth, &
stencil_depths, &
generate_inner_halos, &
partitioner_ptr )

Expand All @@ -131,7 +131,7 @@ subroutine create_local_mesh( mesh_names, &

integer(i_def), intent(in) :: local_rank
integer(i_def), intent(in) :: total_ranks
integer(i_def), intent(in) :: stencil_depth
integer(i_def), intent(in) :: stencil_depths(:)

logical(l_def), intent(in) :: generate_inner_halos

Expand All @@ -154,7 +154,7 @@ subroutine create_local_mesh( mesh_names, &
partition = partition_type( global_mesh_ptr, &
partitioner_ptr, &
decomposition, &
stencil_depth, &
stencil_depths(i), &
generate_inner_halos, &
local_rank, &
total_ranks, &
Expand Down