From 4ee712296564f2842d0100e26e733e50b2f6b104 Mon Sep 17 00:00:00 2001 From: "ukmo-juan.castillo" Date: Fri, 30 Jan 2026 16:17:09 +0000 Subject: [PATCH 1/7] Issue 192: update partitioning namelist in lfric2lfric --- rose-stem/app/lfric2lfric/rose-app.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rose-stem/app/lfric2lfric/rose-app.conf b/rose-stem/app/lfric2lfric/rose-app.conf index ea7ab4128..ea78a4dfb 100644 --- a/rose-stem/app/lfric2lfric/rose-app.conf +++ b/rose-stem/app/lfric2lfric/rose-app.conf @@ -835,7 +835,7 @@ wavelength=0 [namelist:partitioning(destination)] generate_inner_halos=.false. -mesh_type='destination' +mesh_target='destination' panel_decomposition='auto' !!panel_xproc=0 !!panel_yproc=0 @@ -843,7 +843,7 @@ partitioner='cubedsphere' [namelist:partitioning(source)] generate_inner_halos=.false. -mesh_type='source' +mesh_target='source' panel_decomposition='auto' !!panel_xproc=0 !!panel_yproc=0 From e5ac5f5c07c7151cbce6f47878ec504a9a57bb89 Mon Sep 17 00:00:00 2001 From: "ukmo-juan.castillo" Date: Fri, 30 Jan 2026 16:19:22 +0000 Subject: [PATCH 2/7] Revert previous change, intended for another branch --- rose-stem/app/lfric2lfric/rose-app.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rose-stem/app/lfric2lfric/rose-app.conf b/rose-stem/app/lfric2lfric/rose-app.conf index ea78a4dfb..ea7ab4128 100644 --- a/rose-stem/app/lfric2lfric/rose-app.conf +++ b/rose-stem/app/lfric2lfric/rose-app.conf @@ -835,7 +835,7 @@ wavelength=0 [namelist:partitioning(destination)] generate_inner_halos=.false. -mesh_target='destination' +mesh_type='destination' panel_decomposition='auto' !!panel_xproc=0 !!panel_yproc=0 @@ -843,7 +843,7 @@ partitioner='cubedsphere' [namelist:partitioning(source)] generate_inner_halos=.false. -mesh_target='source' +mesh_type='source' panel_decomposition='auto' !!panel_xproc=0 !!panel_yproc=0 From df949dd111ec8df65e13e06ce196116408954441 Mon Sep 17 00:00:00 2001 From: "ukmo-juan.castillo" Date: Mon, 9 Mar 2026 15:20:28 +0000 Subject: [PATCH 3/7] Version performing lbc mesh partitioning, but crashing because the orography file is tried to be read in the lbc mesh --- .../initialisation/lfric2lfric_init_mesh.f90 | 18 ++++++++++++++---- .../rose-meta/lfric-solver/HEAD/rose-meta.conf | 15 ++++++++++----- .../solver/rose-meta/lfric-solver/versions.py | 8 ++++++++ dependencies.yaml | 4 ++-- .../app/lfric2lfric/opt/rose-app-lbc.conf | 6 +++++- .../opt/rose-app-suite_controlled.conf | 1 - .../common/lfric2lfric/tasks_lfric2lfric.cylc | 1 + 7 files changed, 40 insertions(+), 13 deletions(-) diff --git a/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 b/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 index 3b20a554e..4f46fe176 100644 --- a/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 +++ b/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 @@ -43,6 +43,7 @@ module lfric2lfric_init_mesh_mod use partition_mod, only: partitioner_interface use runtime_partition_mod, only: mesh_cubedsphere, & mesh_planar, & + mesh_lfric2lfric_lbc, & create_local_mesh_maps, & create_local_mesh use runtime_partition_lfric_mod, only: get_partition_parameters @@ -53,7 +54,8 @@ module lfric2lfric_init_mesh_mod source_geometry_spherical, & destination_geometry_spherical, & source_topology_fully_periodic, & - destination_topology_fully_periodic + destination_topology_fully_periodic, & + mode_ics, mode_lbc implicit none @@ -122,6 +124,7 @@ subroutine init_mesh( configuration, & integer(kind=i_def) :: geometry(2) integer(kind=i_def) :: topology(2) integer(kind=i_def) :: mesh_selection(2) + integer(kind=i_def) :: mode ! Local variables integer(kind=i_def) :: i @@ -166,6 +169,7 @@ subroutine init_mesh( configuration, & geometry(src) ) call lfric2lfric_nml%get_value( 'source_topology', & topology(src) ) + call lfric2lfric_nml%get_value( 'mode', mode ) if ( regrid_method == regrid_method_map .and. & trim(meshfile_prefix(src)) /= trim(meshfile_prefix(dst)) ) then @@ -285,9 +289,15 @@ subroutine init_mesh( configuration, & call log_event( "Setting up cubed-sphere partition mesh(es)", & log_level_debug ) else - mesh_selection(dst) = mesh_planar - call log_event( "Setting up planar partition mesh(es)", & - log_level_debug ) + if (mode == mode_lbc) then + mesh_selection(dst) = mesh_lfric2lfric_lbc + call log_event( "Setting up planar lbc partition mesh(es)", & + log_level_debug ) + else + mesh_selection(dst) = mesh_planar + call log_event( "Setting up planar partition mesh(es)", & + log_level_debug ) + end if end if call log_event( "Setting up partition mesh(es)", log_level_info ) diff --git a/applications/solver/rose-meta/lfric-solver/HEAD/rose-meta.conf b/applications/solver/rose-meta/lfric-solver/HEAD/rose-meta.conf index e068d8a6e..f673d094b 100644 --- a/applications/solver/rose-meta/lfric-solver/HEAD/rose-meta.conf +++ b/applications/solver/rose-meta/lfric-solver/HEAD/rose-meta.conf @@ -117,6 +117,7 @@ description=The geometry on which the domain is embedded !enumeration=true fail-if=this == "'spherical'" and namelist:base_mesh=topology == "'fully_periodic'" and namelist:partitioning=partitioner != "'cubedsphere'" and namelist:base_mesh=prepartitioned == ".false." ; =this == "'planar'" and namelist:partitioning=partitioner != "'planar'" and namelist:base_mesh=prepartitioned == ".false." ; + =this == "'planar'" and namelist:partitioning=partitioner != "'lfric2lfric_lbc'" and namelist:base_mesh=prepartitioned == ".false." ; help=Along with topology this describes the domain. The geometry is the shape =on which the domain is embedded. This is currently either 'spherical' or ='planar'. @@ -645,7 +646,8 @@ description=Global mesh panel partitioning. help=For parallel computing, the 2D global mesh is divided up into partitions. =Each process rank runs an instance of the model on one partition. The =partition decompostion is specified on a `per panel` basis. - =i.e. The cubedsphere has six panels; the planar mesh has one panel. + =i.e. The cubedsphere has six panels; the planar and lfric2lfric lbc meshes + =have one panel. ns=namelist/Model/Mesh/Partitioning sort-key=Section-A02 @@ -698,6 +700,7 @@ help=Partitioner will attempt to generate partitioned panels based = * custom: x/y decompositions explicitly requested using = namelist:partitioning=panel_xproc, = namelist:partitioning=panel_yproc. + = * lfric2lfric_lbc: Especial partitioning for lbc meshes = * auto_nonuniform: As auto but allow columns of partitions = of differing heights. = * guided_nonuniform: Partition into columns according to @@ -707,8 +710,8 @@ help=Partitioner will attempt to generate partitioned panels based sort-key=Panel-A01 trigger=namelist:partitioning=panel_xproc: this == "'custom'" or this == "'guided_nonuniform'" ; =namelist:partitioning=panel_yproc: this == "'custom'" ; -value-titles=Auto, Single row, Single column, Custom, Auto nonuniform, Guided nonuniform -values='auto', 'row', 'column', 'custom', 'auto_nonuniform', 'guided_nonuniform' +value-titles=Auto, Single row, Single column, Custom, Lfric2lfric boundaries, Auto nonuniform, Guided nonuniform +values='auto', 'row', 'column', 'custom', 'lfric2lfric_lbc', 'auto_nonuniform', 'guided_nonuniform' [namelist:partitioning=panel_xproc] compulsory=true @@ -742,11 +745,13 @@ description=?????? !enumeration=true fail-if=this == "'cubedsphere'" and not ( namelist:base_mesh=geometry == "'spherical'" and namelist:base_mesh=topology == "'fully_periodic'" ); =this == "'cubedsphere'" and not ( env=TOTAL_RANKS % 6 == 0 or env=TOTAL_RANKS == 1 ) ; + =this == "'lfric2lfric_lbc'" and not namelist:base_mesh=geometry=="'planar'" ; + =this == "'lfric2lfric_lbc'" and not namelist:partitioning=panel_decomposition="'lfric2lfric_lbc'" ; help=?????? =?????? sort-key=Panel-A04 -value-titles=Planar, Cubedsphere -values='planar', 'cubedsphere' +value-titles=Planar, Lfric2lfric boundaries, Cubedsphere +values='planar', 'lfric2lfric_lbc', 'cubedsphere' [namelist:partitioning=tile_size_x] compulsory=false diff --git a/applications/solver/rose-meta/lfric-solver/versions.py b/applications/solver/rose-meta/lfric-solver/versions.py index 01798ad2b..55480fa64 100644 --- a/applications/solver/rose-meta/lfric-solver/versions.py +++ b/applications/solver/rose-meta/lfric-solver/versions.py @@ -31,3 +31,11 @@ def upgrade(self, config, meta_config=None): # Add settings return config, self.reports """ + +class vn31_t343(MacroUpgrade): + """Upgrade macro for ticket 343 by Juan M Castillo.""" + BEFORE_TAG = "vn3.1" + AFTER_TAG = "vn3.1_t343" + def upgrade(self, config, meta_config=None): + # Blank Upgrade Macro + return config, self.reports diff --git a/dependencies.yaml b/dependencies.yaml index 8455aefc4..60a2774d1 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: 2026.03.1 + source: git@github.com:ukmo-juan-castillo/lfric_core.git + ref: 0b705e00b248b1f3dd0debea06021377138a01d5 moci: source: git@github.com:MetOffice/moci.git diff --git a/rose-stem/app/lfric2lfric/opt/rose-app-lbc.conf b/rose-stem/app/lfric2lfric/opt/rose-app-lbc.conf index 629b93487..b52625899 100644 --- a/rose-stem/app/lfric2lfric/opt/rose-app-lbc.conf +++ b/rose-stem/app/lfric2lfric/opt/rose-app-lbc.conf @@ -9,11 +9,15 @@ mode=auto source=$BIG_DATA_DIR/lfric2lfric/lfric_gal_diagnostics.nc [namelist:lfric2lfric] -destination_mesh_name='dynamics' +destination_mesh_name='dynamics-lbc' mode='lbc' source_file_lbc='source_file_lbc' source_mesh_name='C12' +[namelist:partitioning(destination)] +panel_decomposition='lfric2lfric_lbc' +partitioner='lfric2lfric_lbc' + [namelist:time] timestep_end='2' diff --git a/rose-stem/app/lfric2lfric/opt/rose-app-suite_controlled.conf b/rose-stem/app/lfric2lfric/opt/rose-app-suite_controlled.conf index eceb8d060..4952cb522 100644 --- a/rose-stem/app/lfric2lfric/opt/rose-app-suite_controlled.conf +++ b/rose-stem/app/lfric2lfric/opt/rose-app-suite_controlled.conf @@ -30,7 +30,6 @@ panel_xproc=${XPROC} panel_yproc=${YPROC} [namelist:partitioning(source)] -panel_decomposition='${PANEL_DECOMP}' panel_xproc=${XPROC} panel_yproc=${YPROC} diff --git a/rose-stem/site/common/lfric2lfric/tasks_lfric2lfric.cylc b/rose-stem/site/common/lfric2lfric/tasks_lfric2lfric.cylc index b68dc1efc..f00770f0d 100644 --- a/rose-stem/site/common/lfric2lfric/tasks_lfric2lfric.cylc +++ b/rose-stem/site/common/lfric2lfric/tasks_lfric2lfric.cylc @@ -121,6 +121,7 @@ "src_mesh": "C24_C12", "src_name": "C12", "src_type": "global", + "panel_decomp": "lfric2lfric_lbc", }) %} {% elif task_ns.conf_name == "canned" %} From 65647bc3d7062d02dc2e0e682966c0a815d04b0d Mon Sep 17 00:00:00 2001 From: "ukmo-juan.castillo" Date: Tue, 10 Mar 2026 15:06:20 +0000 Subject: [PATCH 4/7] Changes to read also the lbc mesh in addition to the grid in which the destination orography is stored - untested --- .../source/driver/lfric2lfric_driver_mod.F90 | 3 +- .../lfric2lfric_file_init_mod.f90 | 38 +++++-- .../lfric2lfric_infrastructure_mod.X90 | 101 +++++++++++++++--- .../initialisation/lfric2lfric_init_mesh.f90 | 66 ++++++++++-- rose-stem/app/lfric2lfric/file/iodef_lbc.xml | 28 +++-- 5 files changed, 193 insertions(+), 43 deletions(-) diff --git a/applications/lfric2lfric/source/driver/lfric2lfric_driver_mod.F90 b/applications/lfric2lfric/source/driver/lfric2lfric_driver_mod.F90 index e02dd5580..216b048b6 100644 --- a/applications/lfric2lfric/source/driver/lfric2lfric_driver_mod.F90 +++ b/applications/lfric2lfric/source/driver/lfric2lfric_driver_mod.F90 @@ -33,6 +33,7 @@ module lfric2lfric_driver_mod use lfric2lfric_config_mod, only: mode_ics, mode_lbc use lfric2lfric_infrastructure_mod, only: initialise_infrastructure, & context_dst, context_src, & + context_lbc, & source_collection_name, & target_collection_name use lfric2lfric_regrid_mod, only: lfric2lfric_regrid @@ -153,7 +154,7 @@ subroutine run( modeldb, oasis_clock ) is_running = modeldb%clock%tick() - call modeldb%io_contexts%get_io_context(context_dst, io_context) + call modeldb%io_contexts%get_io_context(context_lbc, io_context) call io_context%set_current() call advance(io_context, modeldb%clock) diff --git a/applications/lfric2lfric/source/initialisation/lfric2lfric_file_init_mod.f90 b/applications/lfric2lfric/source/initialisation/lfric2lfric_file_init_mod.f90 index 10adc1eb6..5a10c23f7 100644 --- a/applications/lfric2lfric/source/initialisation/lfric2lfric_file_init_mod.f90 +++ b/applications/lfric2lfric/source/initialisation/lfric2lfric_file_init_mod.f90 @@ -33,7 +33,8 @@ module lfric2lfric_file_init_mod implicit none private - public :: init_lfric2lfric_src_files, init_lfric2lfric_dst_files + public :: init_lfric2lfric_src_files, init_lfric2lfric_dst_files, & + init_lfric2lfric_lbc_files contains @@ -151,14 +152,6 @@ subroutine init_lfric2lfric_dst_files( files_list, modeldb ) io_mode=FILE_MODE_WRITE, & freq=checkpoint_frequency ) ) end if - else if (mode == mode_lbc) then - ! Setup lbc writing context information - call files_list%insert_item( & - lfric_xios_file_type( "lfric2lfric_lbc", & - xios_id="lfric_lbc_write", & - io_mode=FILE_MODE_WRITE, & - operation=OPERATION_TIMESERIES, & - freq=diagnostic_frequency ) ) endif ! Setup orography ancillary file @@ -176,4 +169,31 @@ subroutine init_lfric2lfric_dst_files( files_list, modeldb ) end subroutine init_lfric2lfric_dst_files + !> @brief Sets up lbc I/O configuration. + !> @details Initialises the file list for the lbc I/O context, using + !! the checkpoint_stem_name extracted from the `files` namelist. + !> @param [out] files_list The list of I/O files. + !> @param [in,out] modeldb Required by init_io. + subroutine init_lfric2lfric_lbc_files( files_list, modeldb ) + + implicit none + + type(linked_list_type), intent(out) :: files_list + type(modeldb_type), optional, intent(inout) :: modeldb + + + if( use_xios_io ) then + + ! Setup lbc writing context information + call files_list%insert_item( & + lfric_xios_file_type( "lfric2lfric_lbc", & + xios_id="lfric_lbc_write", & + io_mode=FILE_MODE_WRITE, & + operation=OPERATION_TIMESERIES, & + freq=diagnostic_frequency ) ) + + endif + + end subroutine init_lfric2lfric_lbc_files + end module lfric2lfric_file_init_mod diff --git a/applications/lfric2lfric/source/initialisation/lfric2lfric_infrastructure_mod.X90 b/applications/lfric2lfric/source/initialisation/lfric2lfric_infrastructure_mod.X90 index 83f7f6c1f..ac2aa1caa 100644 --- a/applications/lfric2lfric/source/initialisation/lfric2lfric_infrastructure_mod.X90 +++ b/applications/lfric2lfric/source/initialisation/lfric2lfric_infrastructure_mod.X90 @@ -49,7 +49,8 @@ module lfric2lfric_infrastructure_mod use log_mod, only: log_event, & log_scratch_space, & log_level_error, & - log_level_debug + log_level_debug, & + log_level_info use mesh_mod, only: mesh_type use mesh_collection_mod, only: mesh_collection use model_clock_mod, only: model_clock_type @@ -68,7 +69,8 @@ module lfric2lfric_infrastructure_mod use lfric2lfric_init_mesh_mod, only: init_mesh use lfric2lfric_check_conf_mod, only: lfric2lfric_check_configuration use lfric2lfric_file_init_mod, only: init_lfric2lfric_dst_files, & - init_lfric2lfric_src_files + init_lfric2lfric_src_files, & + init_lfric2lfric_lbc_files use lfric2lfric_init_mod, only: init_lfric2lfric use lfric2lfric_init_coupler_mod,only: lfric2lfric_init_coupler_src, & lfric2lfric_init_coupler_dst, & @@ -109,6 +111,7 @@ module lfric2lfric_infrastructure_mod ! Source and destination XIOS context names character(len=*), public, parameter :: context_dst = "lfric2lfric_destination" character(len=*), public, parameter :: context_src = "lfric2lfric_source" + character(len=*), public, parameter :: context_lbc = "lfric2lfric_boundaries" ! Source and destination field collection names character(len=*), public, parameter :: source_collection_name = "source_fields" @@ -152,6 +155,8 @@ contains type(mesh_type), pointer :: twod_mesh_src type(mesh_type), pointer :: mesh_dst type(mesh_type), pointer :: twod_mesh_dst + type(mesh_type), pointer :: mesh_lbc + type(mesh_type), pointer :: twod_mesh_lbc type(mesh_type), pointer :: orography_twod_mesh type(mesh_type), pointer :: orography_mesh @@ -166,10 +171,10 @@ contains type(namelist_type), pointer :: finite_element_nml ! Namelist parameters - character(len=str_def) :: mesh_names(2) - character(len=str_def), allocatable :: twod_names(:) - character(len=str_def) :: start_dump_filename - character(len=str_def) :: source_file_lbc + character(len=str_def), allocatable :: mesh_names(:) + character(len=str_def), allocatable :: twod_names(:) + character(len=str_def) :: start_dump_filename + character(len=str_def) :: source_file_lbc ! lfric2lfric namelist parameters integer(kind=i_def) :: stencil_depth(1) @@ -190,6 +195,7 @@ contains integer(kind=i_def), parameter :: dst = 1 integer(kind=i_def), parameter :: src = 2 + integer(kind=i_def), parameter :: lbc = 3 type(coupling_type), pointer :: coupling_ptr type(field_collection_type), pointer :: cpl_snd_2d @@ -208,8 +214,10 @@ contains ! Source context pointer and temporary context for setup type(lfric_xios_context_type) :: tmp_io_context_src + type(lfric_xios_context_type) :: tmp_io_context_lbc type(lfric_xios_context_type), pointer :: io_context_src type(lfric_xios_context_type), pointer :: io_context_dst + type(lfric_xios_context_type), pointer :: io_context_lbc type(linked_list_type), pointer :: file_list @@ -230,10 +238,28 @@ contains ! Check lfric2lfric configuration settings are allowed call lfric2lfric_check_configuration( lfric2lfric_nml ) - call lfric2lfric_nml%get_value( 'mode', mode ) call lfric2lfric_nml%get_value( 'regrid_method', regrid_method ) - call lfric2lfric_nml%get_value( 'destination_mesh_name', & - mesh_names(dst) ) + call lfric2lfric_nml%get_value( 'mode', mode ) + + if (mode == mode_ics) then + allocate(mesh_names(2)) + call lfric2lfric_nml%get_value( 'destination_mesh_name', & + mesh_names(dst) ) + else if (mode == mode_lbc) then + allocate(mesh_names(3)) + call lfric2lfric_nml%get_value( 'destination_mesh_name', & + mesh_names(lbc) ) + ! The name of the destination mesh is the name of the lbc mesh + ! without the suffix '-lbc' + i = index(mesh_names(lbc), '-lbc', .true.) + if (i > 0) then + mesh_names(dst) = mesh_names(lbc)(:i-1) + else + mesh_names(dst) = mesh_names(lbc) + end if + call log_event('JMCS Mesh name: ' // mesh_names(dst), & + log_level_info) + end if call lfric2lfric_nml%get_value( 'source_mesh_name', & mesh_names(src) ) call lfric2lfric_nml%get_value( 'source_geometry', source_geometry ) @@ -349,6 +375,10 @@ contains twod_mesh_src => mesh_collection%get_mesh(trim(twod_names(src))) mesh_dst => mesh_collection%get_mesh(trim(mesh_names(dst))) twod_mesh_dst => mesh_collection%get_mesh(trim(twod_names(dst))) + if (mode == mode_lbc) then + mesh_lbc => mesh_collection%get_mesh(trim(mesh_names(lbc))) + twod_mesh_lbc => mesh_collection%get_mesh(trim(twod_names(lbc))) + end if ! Log this change call log_event('Source mesh set to: ' // mesh_names(src), & @@ -359,6 +389,12 @@ contains log_level_debug) call log_event('Destination 2D mesh set to: ' // twod_names(dst), & log_level_debug) + if (mode == mode_lbc) then + call log_event('LBC mesh set to: ' // mesh_names(lbc), & + log_level_debug) + call log_event('LBC 2D mesh set to: ' // twod_names(lbc), & + log_level_debug) + end if !======================================================================= ! Setup I/O system @@ -458,6 +494,37 @@ contains call init_altitude( orography_twod_mesh, surface_altitude_src ) end if + if (mode == mode_lbc) then + !----------------------------------------------------------------------- + ! Create the IO context for lbc files + !----------------------------------------------------------------------- + ! Because the source lbc are not the same as the 'prime mesh', we have + ! to initialise the lbc context manually with the desired mesh + + ! Add the lbc context to modeldb and return a pointer to it + call tmp_io_context_lbc%initialise(context_lbc) + call modeldb%io_contexts%add_context(tmp_io_context_lbc) + call modeldb%io_contexts%get_io_context(context_lbc, io_context_lbc) + + ! Get the file list of context and populate + file_list => io_context_lbc%get_filelist() + call init_lfric2lfric_lbc_files( file_list, modeldb ) + + ! Get panel_id and chi from correct mesh + call chi_inventory%get_field_array(mesh_lbc, chi) + call panel_id_inventory%get_field(mesh_lbc, panel_id) + + ! Using correct chi and panel_id, initialise xios context for lbc mesh + nullify( before_close ) + call io_context_lbc%initialise_xios_context( modeldb%mpi%get_comm(), & + chi, & + panel_id, & + modeldb%clock, & + modeldb%calendar, & + before_close ) + call io_context_src%set_current() + end if + !======================================================================= ! Create and initialise prognostic fields !======================================================================= @@ -468,10 +535,10 @@ contains target_collection_name, mesh_dst, twod_mesh_dst ) else if (mode == mode_lbc) then call lfric2lfric_nml%get_value( 'source_file_lbc', source_file_lbc ) - call init_lfric2lfric( modeldb, context_src, context_dst, & + call init_lfric2lfric( modeldb, context_src, context_lbc, & source_file_lbc, mode, & source_collection_name, mesh_src, twod_mesh_src, & - target_collection_name, mesh_dst, twod_mesh_dst ) + target_collection_name, mesh_lbc, twod_mesh_lbc ) end if !======================================================================= @@ -493,9 +560,15 @@ contains element_order_h, element_order_v, & modeldb) ! Destination fields - call lfric2lfric_init_coupler_dst(twod_mesh_dst, "coupling_dst", & - element_order_h, element_order_v, & - modeldb) + if (mode == mode_ics) then + call lfric2lfric_init_coupler_dst(twod_mesh_dst, "coupling_dst", & + element_order_h, element_order_v, & + modeldb) + else if (mode == mode_lbc) then + call lfric2lfric_init_coupler_dst(twod_mesh_lbc, "coupling_dst", & + element_order_h, element_order_v, & + modeldb) + end if ! Finish coupling definition call lfric2lfric_end_coupler_init(modeldb, "coupling") diff --git a/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 b/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 index 4f46fe176..d3e65cbb1 100644 --- a/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 +++ b/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 @@ -38,8 +38,10 @@ module lfric2lfric_init_mesh_mod log_level_error, & log_level_debug use namelist_collection_mod, only: namelist_collection_type + use namelist_item_mod, only: namelist_item_type use namelist_mod, only: namelist_type use panel_decomposition_mod, only: panel_decomposition_type + use partitioning_config_mod, only: panel_decomposition_auto use partition_mod, only: partitioner_interface use runtime_partition_mod, only: mesh_cubedsphere, & mesh_planar, & @@ -108,11 +110,14 @@ subroutine init_mesh( configuration, & integer(kind=i_def), parameter :: dst = 1 integer(kind=i_def), parameter :: src = 2 + integer(kind=i_def), parameter :: lbc = 3 ! Namelist variables type(namelist_type), pointer :: lfric2lfric_nml => null() type(namelist_type), pointer :: src_partitioning_nml => null() type(namelist_type), pointer :: dst_partitioning_nml => null() + type(namelist_type), pointer :: dummy_partitioning_nml => null() + type(namelist_item_type) :: dummy_members(1) ! partitioning namelist variables logical(l_def) :: generate_inner_halos(2) @@ -133,9 +138,11 @@ subroutine init_mesh( configuration, & procedure(partitioner_interface), pointer :: partitioner_src => null() procedure(partitioner_interface), pointer :: partitioner_dst => null() + procedure(partitioner_interface), pointer :: partitioner_lbc => null() class(panel_decomposition_type), allocatable :: decomposition_src, & - decomposition_dst + decomposition_dst, & + decomposition_lbc !============================================================================ @@ -243,6 +250,10 @@ subroutine init_mesh( configuration, & else call load_local_mesh( mesh_file(dst), mesh_names(dst) ) + if (mode == mode_lbc) then + call load_local_mesh( mesh_file(dst), mesh_names(lbc) ) + end if + call log_event( 'Using pre-partitioned mesh file:', log_level_info ) call log_event( ' '//trim(mesh_file(src)), log_level_info ) call log_event( "Loading local mesh(es)", log_level_info ) @@ -289,14 +300,14 @@ subroutine init_mesh( configuration, & call log_event( "Setting up cubed-sphere partition mesh(es)", & log_level_debug ) else + mesh_selection(dst) = mesh_planar + call log_event( "Setting up planar partition mesh(es)", & + log_level_debug ) + if (mode == mode_lbc) then - mesh_selection(dst) = mesh_lfric2lfric_lbc + mesh_selection(lbc) = mesh_lfric2lfric_lbc call log_event( "Setting up planar lbc partition mesh(es)", & log_level_debug ) - else - mesh_selection(dst) = mesh_planar - call log_event( "Setting up planar partition mesh(es)", & - log_level_debug ) end if end if @@ -312,11 +323,32 @@ subroutine init_mesh( configuration, & decomposition_src, & partitioner_src ) - call get_partition_parameters( dst_partitioning_nml, & - mesh_selection(dst), & - total_ranks, & - decomposition_dst, & - partitioner_dst ) + if (mode == mode_lbc) then + ! Create a dummy partition namelist to partition the destination mesh, + ! which by default will be set to 'auto' + call dummy_members(1)%initialise('panel_decomposition', & + panel_decomposition_auto) + call dummy_partitioning_nml%initialise('partitioning', & + dummy_members, 'boundaries') + + call get_partition_parameters( dummy_partitioning_nml, & + mesh_selection(dst), & + total_ranks, & + decomposition_dst, & + partitioner_dst ) + + call get_partition_parameters( dst_partitioning_nml, & + mesh_selection(lbc), & + total_ranks, & + decomposition_lbc, & + partitioner_lbc ) + else + call get_partition_parameters( dst_partitioning_nml, & + mesh_selection(dst), & + total_ranks, & + decomposition_dst, & + partitioner_dst ) + end if ! Read in all global meshes from input file !=========================================================== @@ -324,6 +356,9 @@ subroutine init_mesh( configuration, & call load_global_mesh( mesh_file(dst), mesh_names ) else call load_global_mesh( mesh_file(dst), mesh_names(dst) ) + if (mode == mode_lbc) then + call load_global_mesh( mesh_file(dst), mesh_names(lbc) ) + end if call load_global_mesh( mesh_file(src), mesh_names(src) ) endif @@ -336,6 +371,15 @@ subroutine init_mesh( configuration, & generate_inner_halos(dst), & partitioner_dst ) + if (mode == mode_lbc) then + call create_local_mesh( mesh_names(lbc:lbc), & + local_rank, total_ranks, & + decomposition_lbc, & + stencil_depths, & + generate_inner_halos(dst), & + partitioner_lbc ) + end if + call create_local_mesh( mesh_names(src:src), & local_rank, total_ranks, & decomposition_src, & diff --git a/rose-stem/app/lfric2lfric/file/iodef_lbc.xml b/rose-stem/app/lfric2lfric/file/iodef_lbc.xml index 3d2e14bd0..591717e21 100644 --- a/rose-stem/app/lfric2lfric/file/iodef_lbc.xml +++ b/rose-stem/app/lfric2lfric/file/iodef_lbc.xml @@ -44,6 +44,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -56,14 +76,6 @@ - - - - - - - - From d1e4cf870f6f70e75a81066644fcc9e85b87b9a9 Mon Sep 17 00:00:00 2001 From: "ukmo-juan.castillo" Date: Thu, 12 Mar 2026 21:43:59 +0000 Subject: [PATCH 5/7] Tested changes --- .../lfric2lfric_infrastructure_mod.X90 | 7 +-- .../initialisation/lfric2lfric_init_mesh.f90 | 52 +++++++++++-------- dependencies.yaml | 2 +- .../app/lfric2lfric/opt/rose-app-lbc.conf | 6 +-- .../lfric2lfric/opt/rose-app-lbc_mesh.conf | 25 +++++++++ .../common/lfric2lfric/tasks_lfric2lfric.cylc | 14 ++++- .../site/meto/groups/groups_lfric2lfric.cylc | 2 + 7 files changed, 73 insertions(+), 35 deletions(-) create mode 100644 rose-stem/app/lfric2lfric/opt/rose-app-lbc_mesh.conf diff --git a/applications/lfric2lfric/source/initialisation/lfric2lfric_infrastructure_mod.X90 b/applications/lfric2lfric/source/initialisation/lfric2lfric_infrastructure_mod.X90 index ac2aa1caa..280cb5454 100644 --- a/applications/lfric2lfric/source/initialisation/lfric2lfric_infrastructure_mod.X90 +++ b/applications/lfric2lfric/source/initialisation/lfric2lfric_infrastructure_mod.X90 @@ -14,7 +14,6 @@ module lfric2lfric_infrastructure_mod use add_mesh_map_mod, only: assign_mesh_maps use blend_orography_alg_mod, only: blend_orography - use check_configuration_mod, only: get_required_stencil_depth use constants_mod, only: str_def, r_def, i_def, l_def, r_second use create_mesh_mod, only: create_extrusion, & create_mesh @@ -38,8 +37,6 @@ module lfric2lfric_infrastructure_mod um_L120_99t_21s_40km_extrusion_type, & um_L140_122t_18s_40km_extrusion_type, & um_L70_50t_20s_80km_extrusion_type - use sci_geometric_constants_mod, only: get_chi_inventory, & - get_panel_id_inventory use init_altitude_mod, only: init_altitude use inventory_by_mesh_mod, only: inventory_by_mesh_type use io_context_mod, only: callback_clock_arg @@ -193,8 +190,8 @@ contains integer(kind=i_def) :: i integer(kind=i_def), parameter :: one_layer = 1_i_def - integer(kind=i_def), parameter :: dst = 1 - integer(kind=i_def), parameter :: src = 2 + integer(kind=i_def), parameter :: src = 1 + integer(kind=i_def), parameter :: dst = 2 integer(kind=i_def), parameter :: lbc = 3 type(coupling_type), pointer :: coupling_ptr diff --git a/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 b/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 index d3e65cbb1..4e09c995c 100644 --- a/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 +++ b/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 @@ -100,7 +100,7 @@ subroutine init_mesh( configuration, & integer(kind=i_def), intent(in) :: local_rank integer(kind=i_def), intent(in) :: total_ranks - character(len=*), intent(in) :: mesh_names(2) + character(len=*), intent(in) :: mesh_names(:) class(extrusion_type), intent(in) :: extrusion integer(kind=i_def), intent(in) :: stencil_depths_in(:) integer(kind=i_def), intent(in) :: regrid_method @@ -108,15 +108,16 @@ subroutine init_mesh( configuration, & ! Parameters character(len=9), parameter :: routine_name = 'init_mesh' - integer(kind=i_def), parameter :: dst = 1 - integer(kind=i_def), parameter :: src = 2 + integer(kind=i_def), parameter :: src = 1 + integer(kind=i_def), parameter :: dst = 2 integer(kind=i_def), parameter :: lbc = 3 ! Namelist variables type(namelist_type), pointer :: lfric2lfric_nml => null() type(namelist_type), pointer :: src_partitioning_nml => null() type(namelist_type), pointer :: dst_partitioning_nml => null() - type(namelist_type), pointer :: dummy_partitioning_nml => null() + type(namelist_type), pointer :: partitioning_nml_ptr => null() + type(namelist_type), target :: dummy_partitioning_nml type(namelist_item_type) :: dummy_members(1) ! partitioning namelist variables @@ -128,13 +129,13 @@ subroutine init_mesh( configuration, & character(len=str_max_filename) :: meshfile_prefix(2) integer(kind=i_def) :: geometry(2) integer(kind=i_def) :: topology(2) - integer(kind=i_def) :: mesh_selection(2) + integer(kind=i_def) :: mesh_selection(3) integer(kind=i_def) :: mode ! Local variables integer(kind=i_def) :: i character(len=str_max_filename) :: mesh_file(2) - integer(kind=i_def) :: stencil_depths(2) + integer(kind=i_def) :: stencil_depths(size(mesh_names)) procedure(partitioner_interface), pointer :: partitioner_src => null() procedure(partitioner_interface), pointer :: partitioner_dst => null() @@ -188,12 +189,12 @@ subroutine init_mesh( configuration, & end if ! Set up stencil depths - if ( size(stencil_depths) == 1 ) then + if ( size(stencil_depths_in) == 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 + else if ( size(stencil_depths_in) == size(mesh_names) ) then ! Stencil depths specified per mesh stencil_depths(:) = stencil_depths_in(:) else @@ -248,10 +249,10 @@ subroutine init_mesh( configuration, & if (mesh_file(dst) == mesh_file(src)) then call load_local_mesh( mesh_file(dst), mesh_names ) else - call load_local_mesh( mesh_file(dst), mesh_names(dst) ) - - if (mode == mode_lbc) then - call load_local_mesh( mesh_file(dst), mesh_names(lbc) ) + if (mode == mode_lbc .and. mesh_names(lbc) /= mesh_names(dst)) then + call load_local_mesh( mesh_file(dst), mesh_names(dst:lbc) ) + else + call load_local_mesh( mesh_file(dst), mesh_names(dst) ) end if call log_event( 'Using pre-partitioned mesh file:', log_level_info ) @@ -303,12 +304,15 @@ subroutine init_mesh( configuration, & mesh_selection(dst) = mesh_planar call log_event( "Setting up planar partition mesh(es)", & log_level_debug ) - - if (mode == mode_lbc) then + end if + if (mode == mode_lbc) then + if (mesh_names(lbc) == mesh_names(dst)) then + mesh_selection(lbc) = mesh_selection(dst) + else mesh_selection(lbc) = mesh_lfric2lfric_lbc - call log_event( "Setting up planar lbc partition mesh(es)", & - log_level_debug ) end if + call log_event( "Setting up planar lbc partition mesh(es)", & + log_level_debug ) end if call log_event( "Setting up partition mesh(es)", log_level_info ) @@ -323,15 +327,16 @@ subroutine init_mesh( configuration, & decomposition_src, & partitioner_src ) - if (mode == mode_lbc) then + if (mode == mode_lbc .and. mesh_names(lbc) /= mesh_names(dst)) then ! Create a dummy partition namelist to partition the destination mesh, ! which by default will be set to 'auto' call dummy_members(1)%initialise('panel_decomposition', & panel_decomposition_auto) call dummy_partitioning_nml%initialise('partitioning', & - dummy_members, 'boundaries') + dummy_members) + partitioning_nml_ptr => dummy_partitioning_nml - call get_partition_parameters( dummy_partitioning_nml, & + call get_partition_parameters( partitioning_nml_ptr, & mesh_selection(dst), & total_ranks, & decomposition_dst, & @@ -355,9 +360,10 @@ subroutine init_mesh( configuration, & if (mesh_file(dst) == mesh_file(src)) then call load_global_mesh( mesh_file(dst), mesh_names ) else - call load_global_mesh( mesh_file(dst), mesh_names(dst) ) - if (mode == mode_lbc) then - call load_global_mesh( mesh_file(dst), mesh_names(lbc) ) + if (mode == mode_lbc .and. mesh_names(lbc) /= mesh_names(dst)) then + call load_global_mesh( mesh_file(dst), mesh_names(dst:lbc) ) + else + call load_global_mesh( mesh_file(dst), mesh_names(dst) ) end if call load_global_mesh( mesh_file(src), mesh_names(src) ) endif @@ -371,7 +377,7 @@ subroutine init_mesh( configuration, & generate_inner_halos(dst), & partitioner_dst ) - if (mode == mode_lbc) then + if (mode == mode_lbc .and. mesh_names(lbc) /= mesh_names(dst)) then call create_local_mesh( mesh_names(lbc:lbc), & local_rank, total_ranks, & decomposition_lbc, & diff --git a/dependencies.yaml b/dependencies.yaml index 60a2774d1..3f381a293 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -31,7 +31,7 @@ lfric_apps: lfric_core: source: git@github.com:ukmo-juan-castillo/lfric_core.git - ref: 0b705e00b248b1f3dd0debea06021377138a01d5 + ref: 583e352f129324630ffe7571cef7c0d013c1d55e moci: source: git@github.com:MetOffice/moci.git diff --git a/rose-stem/app/lfric2lfric/opt/rose-app-lbc.conf b/rose-stem/app/lfric2lfric/opt/rose-app-lbc.conf index b52625899..629b93487 100644 --- a/rose-stem/app/lfric2lfric/opt/rose-app-lbc.conf +++ b/rose-stem/app/lfric2lfric/opt/rose-app-lbc.conf @@ -9,15 +9,11 @@ mode=auto source=$BIG_DATA_DIR/lfric2lfric/lfric_gal_diagnostics.nc [namelist:lfric2lfric] -destination_mesh_name='dynamics-lbc' +destination_mesh_name='dynamics' mode='lbc' source_file_lbc='source_file_lbc' source_mesh_name='C12' -[namelist:partitioning(destination)] -panel_decomposition='lfric2lfric_lbc' -partitioner='lfric2lfric_lbc' - [namelist:time] timestep_end='2' diff --git a/rose-stem/app/lfric2lfric/opt/rose-app-lbc_mesh.conf b/rose-stem/app/lfric2lfric/opt/rose-app-lbc_mesh.conf new file mode 100644 index 000000000..b52625899 --- /dev/null +++ b/rose-stem/app/lfric2lfric/opt/rose-app-lbc_mesh.conf @@ -0,0 +1,25 @@ +[env] +RESTART_STOP=2 + +[file:iodef.xml] +source=$ROSE_SUITE_DIR/app/lfric2lfric/file/iodef_lbc.xml + +[file:source_file_lbc.nc] +mode=auto +source=$BIG_DATA_DIR/lfric2lfric/lfric_gal_diagnostics.nc + +[namelist:lfric2lfric] +destination_mesh_name='dynamics-lbc' +mode='lbc' +source_file_lbc='source_file_lbc' +source_mesh_name='C12' + +[namelist:partitioning(destination)] +panel_decomposition='lfric2lfric_lbc' +partitioner='lfric2lfric_lbc' + +[namelist:time] +timestep_end='2' + +[namelist:timestepping] +dt=64800.0 diff --git a/rose-stem/site/common/lfric2lfric/tasks_lfric2lfric.cylc b/rose-stem/site/common/lfric2lfric/tasks_lfric2lfric.cylc index f00770f0d..6486da66a 100644 --- a/rose-stem/site/common/lfric2lfric/tasks_lfric2lfric.cylc +++ b/rose-stem/site/common/lfric2lfric/tasks_lfric2lfric.cylc @@ -111,11 +111,23 @@ {% elif task_ns.conf_name == "oasis_clim_gal9_C12-ral_seuk_C16_lam-lbc" %} - {# dst_name will need to change to "dynamics-lbc" when lbc meshes can be read #} {% do task_dict.update({ "opt_confs": ["clim_gal9_ral_seuk","oasis","lbc"], "resolution": "C12_C16_lam", "dst_mesh": "seuk_MG", + "dst_name": "dynamics", + "dst_type": "regional", + "src_mesh": "C24_C12", + "src_name": "C12", + "src_type": "global", + }) %} + +{% elif task_ns.conf_name == "oasis_clim_gal9_C12-ral_seuk_C16_lam-lbc_mesh" %} + + {% do task_dict.update({ + "opt_confs": ["clim_gal9_ral_seuk","oasis","lbc_mesh"], + "resolution": "C12_C16_lam", + "dst_mesh": "seuk_MG", "dst_name": "dynamics-lbc", "dst_type": "regional", "src_mesh": "C24_C12", diff --git a/rose-stem/site/meto/groups/groups_lfric2lfric.cylc b/rose-stem/site/meto/groups/groups_lfric2lfric.cylc index eca0b1d27..ed396baa2 100644 --- a/rose-stem/site/meto/groups/groups_lfric2lfric.cylc +++ b/rose-stem/site/meto/groups/groups_lfric2lfric.cylc @@ -15,6 +15,7 @@ "lfric2lfric_oasis_clim_gal9-C24_C12_azspice_gnu_fast-debug-64bit", "lfric2lfric_oasis_clim_gal9_C12-ral_seuk_C16_lam_azspice_gnu_fast-debug-64bit", "lfric2lfric_oasis_clim_gal9_C12-ral_seuk_C16_lam-lbc_azspice_gnu_fast-debug-64bit", + "lfric2lfric_oasis_clim_gal9_C12-ral_seuk_C16_lam-lbc_mesh_azspice_gnu_fast-debug-64bit", "lfric2lfric_azspice_canned", ], "lfric2lfric_azspice_extra": [ @@ -43,6 +44,7 @@ "lfric2lfric_oasis_clim_gal9-C24_C12_ex1a_cce_fast-debug-64bit", "lfric2lfric_oasis_clim_gal9_C12-ral_seuk_C16_lam_ex1a_cce_fast-debug-64bit", "lfric2lfric_oasis_clim_gal9_C12-ral_seuk_C16_lam-lbc_ex1a_cce_fast-debug-64bit", + "lfric2lfric_oasis_clim_gal9_C12-ral_seuk_C16_lam-lbc_mesh_ex1a_cce_fast-debug-64bit", "lfric2lfric_ex1a_canned", ], "lfric2lfric_ex1a_extra": [ From 475c8a816584459871cc5ecbda43db98744ed61f Mon Sep 17 00:00:00 2001 From: "ukmo-juan.castillo" Date: Fri, 13 Mar 2026 17:19:04 +0000 Subject: [PATCH 6/7] Simplify the number of namelist parameters needed to partition a lbc mesh in lfric2lfric - lfric2lfric will partition it with the default lfric2lfric lbc mesh partitioner --- .../initialisation/lfric2lfric_init_mesh.f90 | 45 ++++++++----------- .../lfric-solver/HEAD/rose-meta.conf | 12 ++--- .../solver/rose-meta/lfric-solver/versions.py | 8 ---- dependencies.yaml | 2 +- .../lfric2lfric/opt/rose-app-lbc_mesh.conf | 4 -- .../common/lfric2lfric/tasks_lfric2lfric.cylc | 1 - 6 files changed, 23 insertions(+), 49 deletions(-) diff --git a/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 b/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 index 4e09c995c..5c9781469 100644 --- a/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 +++ b/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 @@ -116,9 +116,6 @@ subroutine init_mesh( configuration, & type(namelist_type), pointer :: lfric2lfric_nml => null() type(namelist_type), pointer :: src_partitioning_nml => null() type(namelist_type), pointer :: dst_partitioning_nml => null() - type(namelist_type), pointer :: partitioning_nml_ptr => null() - type(namelist_type), target :: dummy_partitioning_nml - type(namelist_item_type) :: dummy_members(1) ! partitioning namelist variables logical(l_def) :: generate_inner_halos(2) @@ -131,6 +128,7 @@ subroutine init_mesh( configuration, & integer(kind=i_def) :: topology(2) integer(kind=i_def) :: mesh_selection(3) integer(kind=i_def) :: mode + logical(kind=l_def) :: read_lbc_mesh ! Local variables integer(kind=i_def) :: i @@ -204,6 +202,13 @@ subroutine init_mesh( configuration, & call log_event(log_scratch_space, log_level_error) end if + ! Decide if a lbc mesh has to be set up + read_lbc_mesh = .false. + if (mode == mode_lbc) then + if (mesh_names(lbc) /= mesh_names(dst)) then + read_lbc_mesh = .true. + end if + end if !=========================================================================== ! Create local mesh objects: @@ -249,7 +254,7 @@ subroutine init_mesh( configuration, & if (mesh_file(dst) == mesh_file(src)) then call load_local_mesh( mesh_file(dst), mesh_names ) else - if (mode == mode_lbc .and. mesh_names(lbc) /= mesh_names(dst)) then + if (read_lbc_mesh) then call load_local_mesh( mesh_file(dst), mesh_names(dst:lbc) ) else call load_local_mesh( mesh_file(dst), mesh_names(dst) ) @@ -327,40 +332,26 @@ subroutine init_mesh( configuration, & decomposition_src, & partitioner_src ) - if (mode == mode_lbc .and. mesh_names(lbc) /= mesh_names(dst)) then - ! Create a dummy partition namelist to partition the destination mesh, - ! which by default will be set to 'auto' - call dummy_members(1)%initialise('panel_decomposition', & - panel_decomposition_auto) - call dummy_partitioning_nml%initialise('partitioning', & - dummy_members) - partitioning_nml_ptr => dummy_partitioning_nml - - call get_partition_parameters( partitioning_nml_ptr, & - mesh_selection(dst), & - total_ranks, & - decomposition_dst, & - partitioner_dst ) - + if (read_lbc_mesh) then call get_partition_parameters( dst_partitioning_nml, & mesh_selection(lbc), & total_ranks, & decomposition_lbc, & partitioner_lbc ) - else - call get_partition_parameters( dst_partitioning_nml, & - mesh_selection(dst), & - total_ranks, & - decomposition_dst, & - partitioner_dst ) end if + call get_partition_parameters( dst_partitioning_nml, & + mesh_selection(dst), & + total_ranks, & + decomposition_dst, & + partitioner_dst ) + ! Read in all global meshes from input file !=========================================================== if (mesh_file(dst) == mesh_file(src)) then call load_global_mesh( mesh_file(dst), mesh_names ) else - if (mode == mode_lbc .and. mesh_names(lbc) /= mesh_names(dst)) then + if (read_lbc_mesh) then call load_global_mesh( mesh_file(dst), mesh_names(dst:lbc) ) else call load_global_mesh( mesh_file(dst), mesh_names(dst) ) @@ -377,7 +368,7 @@ subroutine init_mesh( configuration, & generate_inner_halos(dst), & partitioner_dst ) - if (mode == mode_lbc .and. mesh_names(lbc) /= mesh_names(dst)) then + if (read_lbc_mesh) then call create_local_mesh( mesh_names(lbc:lbc), & local_rank, total_ranks, & decomposition_lbc, & diff --git a/applications/solver/rose-meta/lfric-solver/HEAD/rose-meta.conf b/applications/solver/rose-meta/lfric-solver/HEAD/rose-meta.conf index f673d094b..c74154fd4 100644 --- a/applications/solver/rose-meta/lfric-solver/HEAD/rose-meta.conf +++ b/applications/solver/rose-meta/lfric-solver/HEAD/rose-meta.conf @@ -117,7 +117,6 @@ description=The geometry on which the domain is embedded !enumeration=true fail-if=this == "'spherical'" and namelist:base_mesh=topology == "'fully_periodic'" and namelist:partitioning=partitioner != "'cubedsphere'" and namelist:base_mesh=prepartitioned == ".false." ; =this == "'planar'" and namelist:partitioning=partitioner != "'planar'" and namelist:base_mesh=prepartitioned == ".false." ; - =this == "'planar'" and namelist:partitioning=partitioner != "'lfric2lfric_lbc'" and namelist:base_mesh=prepartitioned == ".false." ; help=Along with topology this describes the domain. The geometry is the shape =on which the domain is embedded. This is currently either 'spherical' or ='planar'. @@ -700,7 +699,6 @@ help=Partitioner will attempt to generate partitioned panels based = * custom: x/y decompositions explicitly requested using = namelist:partitioning=panel_xproc, = namelist:partitioning=panel_yproc. - = * lfric2lfric_lbc: Especial partitioning for lbc meshes = * auto_nonuniform: As auto but allow columns of partitions = of differing heights. = * guided_nonuniform: Partition into columns according to @@ -710,8 +708,8 @@ help=Partitioner will attempt to generate partitioned panels based sort-key=Panel-A01 trigger=namelist:partitioning=panel_xproc: this == "'custom'" or this == "'guided_nonuniform'" ; =namelist:partitioning=panel_yproc: this == "'custom'" ; -value-titles=Auto, Single row, Single column, Custom, Lfric2lfric boundaries, Auto nonuniform, Guided nonuniform -values='auto', 'row', 'column', 'custom', 'lfric2lfric_lbc', 'auto_nonuniform', 'guided_nonuniform' +value-titles=Auto, Single row, Single column, Custom, Auto nonuniform, Guided nonuniform +values='auto', 'row', 'column', 'custom', 'auto_nonuniform', 'guided_nonuniform' [namelist:partitioning=panel_xproc] compulsory=true @@ -745,13 +743,11 @@ description=?????? !enumeration=true fail-if=this == "'cubedsphere'" and not ( namelist:base_mesh=geometry == "'spherical'" and namelist:base_mesh=topology == "'fully_periodic'" ); =this == "'cubedsphere'" and not ( env=TOTAL_RANKS % 6 == 0 or env=TOTAL_RANKS == 1 ) ; - =this == "'lfric2lfric_lbc'" and not namelist:base_mesh=geometry=="'planar'" ; - =this == "'lfric2lfric_lbc'" and not namelist:partitioning=panel_decomposition="'lfric2lfric_lbc'" ; help=?????? =?????? sort-key=Panel-A04 -value-titles=Planar, Lfric2lfric boundaries, Cubedsphere -values='planar', 'lfric2lfric_lbc', 'cubedsphere' +value-titles=Planar, Cubedsphere +values='planar', 'cubedsphere' [namelist:partitioning=tile_size_x] compulsory=false diff --git a/applications/solver/rose-meta/lfric-solver/versions.py b/applications/solver/rose-meta/lfric-solver/versions.py index 55480fa64..01798ad2b 100644 --- a/applications/solver/rose-meta/lfric-solver/versions.py +++ b/applications/solver/rose-meta/lfric-solver/versions.py @@ -31,11 +31,3 @@ def upgrade(self, config, meta_config=None): # Add settings return config, self.reports """ - -class vn31_t343(MacroUpgrade): - """Upgrade macro for ticket 343 by Juan M Castillo.""" - BEFORE_TAG = "vn3.1" - AFTER_TAG = "vn3.1_t343" - def upgrade(self, config, meta_config=None): - # Blank Upgrade Macro - return config, self.reports diff --git a/dependencies.yaml b/dependencies.yaml index 3f381a293..71dcfae8b 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -31,7 +31,7 @@ lfric_apps: lfric_core: source: git@github.com:ukmo-juan-castillo/lfric_core.git - ref: 583e352f129324630ffe7571cef7c0d013c1d55e + ref: dbe426006b1bf3651973ade25a820c110349823c moci: source: git@github.com:MetOffice/moci.git diff --git a/rose-stem/app/lfric2lfric/opt/rose-app-lbc_mesh.conf b/rose-stem/app/lfric2lfric/opt/rose-app-lbc_mesh.conf index b52625899..b2ff57e86 100644 --- a/rose-stem/app/lfric2lfric/opt/rose-app-lbc_mesh.conf +++ b/rose-stem/app/lfric2lfric/opt/rose-app-lbc_mesh.conf @@ -14,10 +14,6 @@ mode='lbc' source_file_lbc='source_file_lbc' source_mesh_name='C12' -[namelist:partitioning(destination)] -panel_decomposition='lfric2lfric_lbc' -partitioner='lfric2lfric_lbc' - [namelist:time] timestep_end='2' diff --git a/rose-stem/site/common/lfric2lfric/tasks_lfric2lfric.cylc b/rose-stem/site/common/lfric2lfric/tasks_lfric2lfric.cylc index 6486da66a..7c622a087 100644 --- a/rose-stem/site/common/lfric2lfric/tasks_lfric2lfric.cylc +++ b/rose-stem/site/common/lfric2lfric/tasks_lfric2lfric.cylc @@ -133,7 +133,6 @@ "src_mesh": "C24_C12", "src_name": "C12", "src_type": "global", - "panel_decomp": "lfric2lfric_lbc", }) %} {% elif task_ns.conf_name == "canned" %} From c91e41316b4d0895c8544a686ee57abafedb2224 Mon Sep 17 00:00:00 2001 From: "ukmo-juan.castillo" Date: Mon, 16 Mar 2026 08:27:36 +0000 Subject: [PATCH 7/7] Small changes to reduce the number of modifications in lfric_core --- .../initialisation/lfric2lfric_init_mesh.f90 | 16 ++++++++-------- dependencies.yaml | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 b/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 index 5c9781469..1b332c242 100644 --- a/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 +++ b/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 @@ -40,16 +40,17 @@ module lfric2lfric_init_mesh_mod use namelist_collection_mod, only: namelist_collection_type use namelist_item_mod, only: namelist_item_type use namelist_mod, only: namelist_type - use panel_decomposition_mod, only: panel_decomposition_type + use panel_decomposition_mod, only: lfric2lfric_lbc_decomposition_type, & + panel_decomposition_type use partitioning_config_mod, only: panel_decomposition_auto - use partition_mod, only: partitioner_interface + use partition_mod, only: partitioner_lfric2lfric_lbc, & + partitioner_interface use runtime_partition_mod, only: mesh_cubedsphere, & mesh_planar, & mesh_lfric2lfric_lbc, & create_local_mesh_maps, & create_local_mesh use runtime_partition_lfric_mod, only: get_partition_parameters - use global_mesh_collection_mod, only: global_mesh_collection ! Lfric2lfric modules use lfric2lfric_config_mod, only: regrid_method_map, & @@ -333,11 +334,10 @@ subroutine init_mesh( configuration, & partitioner_src ) if (read_lbc_mesh) then - call get_partition_parameters( dst_partitioning_nml, & - mesh_selection(lbc), & - total_ranks, & - decomposition_lbc, & - partitioner_lbc ) + decomposition_lbc = lfric2lfric_lbc_decomposition_type() + partitioner_lbc => partitioner_lfric2lfric_lbc + call log_event( "Using lfric2lfric lbc mesh partitioner ", & + log_level_debug ) end if call get_partition_parameters( dst_partitioning_nml, & diff --git a/dependencies.yaml b/dependencies.yaml index 71dcfae8b..0b4ca63c8 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -31,7 +31,7 @@ lfric_apps: lfric_core: source: git@github.com:ukmo-juan-castillo/lfric_core.git - ref: dbe426006b1bf3651973ade25a820c110349823c + ref: 4f271ed371a9eb46254dd71050c3adfeee4ba0e2 moci: source: git@github.com:MetOffice/moci.git