Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 | 2026-01-22 |
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ module adjt_reconstruct_w3_field_alg_mod
use function_space_collection_mod, only : function_space_collection
use transport_metadata_collection_mod, only : transport_metadata_collection
use transport_metadata_mod, only : transport_metadata_type
use check_configuration_mod, only : get_required_stencil_depth

implicit none

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module gravity_wave_infrastructure_mod

use add_mesh_map_mod, only : assign_mesh_maps
use driver_modeldb_mod, only : modeldb_type
use check_configuration_mod, only : get_required_stencil_depth
use constants_mod, only : i_def, &
PRECISION_REAL, &
r_def, r_second, &
Expand Down Expand Up @@ -81,7 +80,8 @@ subroutine initialise_infrastructure( program_name, &
logical(l_def) :: prepartitioned
logical :: apply_partition_check

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 Expand Up @@ -191,7 +191,7 @@ subroutine initialise_infrastructure( program_name, &
!=======================================================================
! 1.3 Initialise mesh objects and assign InterGrid maps
!=======================================================================
stencil_depth = get_required_stencil_depth()
stencil_depth = 2
apply_partition_check = .false.
if ( .not. prepartitioned .and. l_multigrid ) then
apply_partition_check = .true.
Expand Down Expand Up @@ -237,6 +237,9 @@ subroutine initialise_infrastructure( program_name, &

nullify(chi_inventory, panel_id_inventory)
deallocate(base_mesh_names)
deallocate(twod_names)
deallocate(extrusion)
deallocate(extrusion_2d)

end subroutine initialise_infrastructure

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ program algorithm_test
logical(l_def) :: apply_partition_check

integer(i_def) :: geometry
integer(i_def) :: stencil_depth
integer(i_def) :: stencil_depth(1)
integer(i_def) :: method
integer(i_def) :: number_of_layers
real(r_def) :: domain_bottom
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ module jedi_geometry_mod
!>
subroutine initialise( self, mpi_comm, configuration )
! Access config directly until modeldb ready
use driver_mesh_mod, only: init_mesh
use driver_config_mod, only: init_config
use jedi_lfric_mesh_setup_mod, only: initialise_mesh
use jedi_lfric_tests_mod, only: jedi_lfric_tests_required_namelists
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ module lfric2lfric_infrastructure_mod
use driver_fem_mod, only: init_fem
use driver_io_mod, only: init_io, &
filelist_populator
use check_configuration_mod, only: get_required_stencil_depth
use extrusion_mod, only: extrusion_type, &
uniform_extrusion_type, &
prime_extrusion, &
Expand Down Expand Up @@ -169,7 +168,7 @@ contains
integer(kind=i_def) :: origin_domain
integer(kind=i_def) :: target_domain

integer(kind=i_def) :: stencil_depth
integer(kind=i_def) :: stencil_depth(1)
integer(kind=i_def) :: source_geometry
integer(i_def) :: regrid_method
real(kind=r_def) :: domain_bottom
Expand Down Expand Up @@ -315,7 +314,7 @@ contains
!-----------------------------------------------------------------------
! Create the required meshes
!-----------------------------------------------------------------------
stencil_depth = get_required_stencil_depth()
stencil_depth = 2
call init_mesh( modeldb%configuration, &
modeldb%mpi%get_comm_rank(), &
modeldb%mpi%get_comm_size(), &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ module lfric2lfric_init_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 the application
!! for each mesh.
!> @param[in] regrid_method Apply check for even partitions with the
!> configured partition strategy if the
!> regridding method is 'map'.
Expand All @@ -85,7 +86,7 @@ subroutine init_mesh( configuration, &
local_rank, total_ranks, &
mesh_names, &
extrusion, &
stencil_depth, &
stencil_depths_in, &
regrid_method )

implicit none
Expand All @@ -97,7 +98,7 @@ subroutine init_mesh( configuration, &
integer(kind=i_def), intent(in) :: total_ranks
character(len=*), intent(in) :: mesh_names(2)
class(extrusion_type), intent(in) :: extrusion
integer(kind=i_def), intent(in) :: stencil_depth
integer(kind=i_def), intent(in) :: stencil_depths_in(:)
integer(kind=i_def), intent(in) :: regrid_method

! Parameters
Expand All @@ -123,7 +124,9 @@ subroutine init_mesh( configuration, &
integer(kind=i_def) :: mesh_selection(2)

! Local variables
integer(kind=i_def) :: i
character(len=str_max_filename) :: mesh_file(2)
integer(kind=i_def) :: stencil_depths(2)

procedure(partitioner_interface), pointer :: partitioner_src => null()
procedure(partitioner_interface), pointer :: partitioner_dst => null()
Expand Down Expand Up @@ -173,6 +176,22 @@ subroutine init_mesh( configuration, &
call log_event(log_scratch_space, log_level_error)
end if

! Set up stencil depths
if ( size(stencil_depths) == 1 ) then
! Single stencil depth specified, apply to all meshes
do i = 1, size(mesh_names)
stencil_depths(i) = stencil_depths_in(1)
end do
else if ( size(stencil_depths) == size(mesh_names) ) then
! Stencil depths specified per mesh
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


!===========================================================================
! Create local mesh objects:
Expand Down Expand Up @@ -231,8 +250,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 )

! Load and assign mesh maps.
Expand Down Expand Up @@ -304,15 +323,15 @@ subroutine init_mesh( configuration, &
call create_local_mesh( mesh_names(dst:dst), &
local_rank, total_ranks, &
decomposition_dst, &
stencil_depth, &
generate_inner_halos(dst), &
stencil_depths, &
generate_inner_halos(dst), &
partitioner_dst )

call create_local_mesh( mesh_names(src:src), &
local_rank, total_ranks, &
decomposition_src, &
stencil_depth, &
generate_inner_halos(src), &
stencil_depths, &
generate_inner_halos(src), &
partitioner_src )

! Read in the global intergrid mesh mappings,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ subroutine lfricinp_initialise_lfric(program_name_arg, &

character(str_def) :: prime_mesh_name

integer(i_def) :: stencil_depth
integer(i_def) :: stencil_depth(1)
integer(i_def) :: geometry
real(r_def) :: domain_bottom
real(r_def) :: scaled_radius
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ subroutine initialise_name_transport( program_name, modeldb )
character(len=str_def), allocatable :: shifted_names(:)
character(len=str_def), allocatable :: double_names(:)
character(len=str_def) :: prime_mesh_name
integer(kind=i_def), allocatable :: stencil_depths(:)

logical(kind=l_def) :: prepartitioned
logical(kind=l_def) :: apply_partition_check

integer(kind=i_def) :: geometry
integer(kind=i_def) :: stencil_depth
real(kind=r_def) :: domain_bottom
real(kind=r_def) :: domain_height
real(kind=r_def) :: scaled_radius
Expand Down Expand Up @@ -236,14 +236,18 @@ subroutine initialise_name_transport( program_name, modeldb )

! 1.3a Initialise prime/2d meshes
! ---------------------------------------------------------
stencil_depth = get_required_stencil_depth()
allocate(stencil_depths(num_base_meshes))
call get_required_stencil_depth( &
stencil_depths, base_mesh_names, modeldb%configuration &
)

apply_partition_check = .false.

call init_mesh( modeldb%configuration, &
modeldb%mpi%get_comm_rank(), &
modeldb%mpi%get_comm_size(), &
base_mesh_names, &
extrusion, stencil_depth, &
extrusion, stencil_depths, &
apply_partition_check )

call create_mesh( base_mesh_names, extrusion_2d, &
Expand Down Expand Up @@ -350,11 +354,19 @@ subroutine initialise_name_transport( program_name, modeldb )

end if

if (allocated(base_mesh_names)) deallocate(base_mesh_names)
if (allocated(meshes_to_shift)) deallocate(meshes_to_shift)
if (allocated(meshes_to_double)) deallocate(meshes_to_double)

if (allocated(base_mesh_names)) deallocate(base_mesh_names)
if (allocated(meshes_to_shift)) deallocate(meshes_to_shift)
if (allocated(meshes_to_double)) deallocate(meshes_to_double)
if (allocated(twod_names)) deallocate(twod_names)
if (allocated(shifted_names)) deallocate(shifted_names)
if (allocated(double_names)) deallocate(double_names)
if (allocated(extrusion)) deallocate(extrusion)
if (allocated(extrusion_2d)) deallocate(extrusion_2d)
if (allocated(extrusion_shifted)) deallocate(extrusion_shifted)
if (allocated(extrusion_double)) deallocate(extrusion_double)
if (allocated(stencil_depths)) deallocate(stencil_depths)
if (allocated(extra_io_mesh_names)) deallocate(extra_io_mesh_names)

nullify(chi_inventory, panel_id_inventory, mesh)

end subroutine initialise_name_transport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ subroutine initialise_infrastructure( program_name, modeldb)

character(str_def), allocatable :: base_mesh_names(:)
character(str_def), allocatable :: twod_names(:)
integer(i_def), allocatable :: stencil_depths(:)

class(extrusion_type), allocatable :: extrusion
type(uniform_extrusion_type), allocatable :: extrusion_2d
Expand All @@ -93,7 +94,6 @@ subroutine initialise_infrastructure( program_name, modeldb)

character(str_def) :: prime_mesh_name

integer(i_def) :: stencil_depth
integer(i_def) :: geometry
integer(i_def) :: method
integer(i_def) :: number_of_layers
Expand Down Expand Up @@ -180,12 +180,15 @@ subroutine initialise_infrastructure( program_name, modeldb)
! Initialise prime/2d meshes
! ---------------------------------------------------------
check_partitions = .false.
stencil_depth = get_required_stencil_depth()
allocate(stencil_depths(size(base_mesh_names)))
call get_required_stencil_depth( &
stencil_depths, base_mesh_names, modeldb%configuration &
)
call init_mesh( modeldb%configuration, &
modeldb%mpi%get_comm_rank(), &
modeldb%mpi%get_comm_size(), &
base_mesh_names, extrusion, &
stencil_depth, check_partitions )
stencil_depths, check_partitions )


allocate( twod_names, source=base_mesh_names )
Expand Down Expand Up @@ -222,6 +225,8 @@ subroutine initialise_infrastructure( program_name, modeldb)
call create_runtime_constants()

deallocate(base_mesh_names)
deallocate(twod_names)
deallocate(stencil_depths)
nullify(chi_inventory, panel_id_inventory)

end subroutine initialise_infrastructure
Expand Down
2 changes: 1 addition & 1 deletion applications/solver/source/solver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ program solver

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
27 changes: 20 additions & 7 deletions applications/transport/source/driver/transport_driver_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ subroutine initialise_transport( program_name, modeldb )
character(len=str_def), allocatable :: chain_mesh_tags(:)
character(len=str_def) :: aerosol_mesh_name
character(len=str_def) :: prime_mesh_name
integer(kind=i_def), allocatable :: stencil_depths(:)

logical(kind=l_def) :: use_multires_coupling
logical(kind=l_def) :: l_multigrid
logical(kind=l_def) :: prepartitioned
logical(kind=l_def) :: apply_partition_check

integer(kind=i_def) :: geometry
integer(kind=i_def) :: stencil_depth
real(kind=r_def) :: domain_bottom
real(kind=r_def) :: domain_height
real(kind=r_def) :: scaled_radius
Expand Down Expand Up @@ -283,7 +283,11 @@ subroutine initialise_transport( program_name, modeldb )

! 1.3a Initialise prime/2d meshes
! ---------------------------------------------------------
stencil_depth = get_required_stencil_depth()
allocate(stencil_depths(num_base_meshes))
call get_required_stencil_depth( &
stencil_depths, base_mesh_names, modeldb%configuration &
)

apply_partition_check = .false.
if ( .not. prepartitioned .and. &
( l_multigrid .or. use_multires_coupling ) ) then
Expand All @@ -294,7 +298,7 @@ subroutine initialise_transport( program_name, modeldb )
modeldb%mpi%get_comm_rank(), &
modeldb%mpi%get_comm_size(), &
base_mesh_names, &
extrusion, stencil_depth, &
extrusion, stencil_depths, &
apply_partition_check )

call create_mesh( base_mesh_names, extrusion_2d, &
Expand Down Expand Up @@ -446,11 +450,20 @@ subroutine initialise_transport( program_name, modeldb )

end if

if (allocated(base_mesh_names)) deallocate(base_mesh_names)
if (allocated(meshes_to_shift)) deallocate(meshes_to_shift)
if (allocated(meshes_to_double)) deallocate(meshes_to_double)

if (allocated(base_mesh_names)) deallocate(base_mesh_names)
if (allocated(meshes_to_shift)) deallocate(meshes_to_shift)
if (allocated(meshes_to_double)) deallocate(meshes_to_double)
if (allocated(twod_names)) deallocate(twod_names)
if (allocated(shifted_names)) deallocate(shifted_names)
if (allocated(double_names)) deallocate(double_names)
if (allocated(extrusion)) deallocate(extrusion)
if (allocated(extrusion_2d)) deallocate(extrusion_2d)
if (allocated(extrusion_shifted)) deallocate(extrusion_shifted)
if (allocated(extrusion_double)) deallocate(extrusion_double)
if (allocated(chain_mesh_tags)) deallocate(chain_mesh_tags)
if (allocated(stencil_depths)) deallocate(stencil_depths)
if (allocated(extra_io_mesh_names)) deallocate(extra_io_mesh_names)

nullify(chi_inventory, panel_id_inventory, mesh, aerosol_mesh)

end subroutine initialise_transport
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/MultiStencilDepths

moci:
source: git@github.com:MetOffice/moci.git
Expand Down
Loading
Loading