From 121d1dc9566f9cd56c846c147557fef13460dffe Mon Sep 17 00:00:00 2001 From: Ricky Wong <141156427+mo-rickywong@users.noreply.github.com> Date: Fri, 9 Jan 2026 09:35:55 +0000 Subject: [PATCH 01/12] Use the lfric_core with new config api --- dependencies.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dependencies.yaml b/dependencies.yaml index 473a2c6ee..43552fbed 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: 5d4d72f0e35f00e71b1757df6beadec21ece97f0 + source: git@github.com:mo-rickywong/lfric_core.git + ref: ConfigTypeAccess moci: source: git@github.com:MetOffice/moci.git From 9521e1d2abc0ecb1f3f5ae6f140603578c131729 Mon Sep 17 00:00:00 2001 From: Ricky Wong <141156427+mo-rickywong@users.noreply.github.com> Date: Fri, 9 Jan 2026 23:05:44 +0000 Subject: [PATCH 02/12] Port as much across to new api without incurring a linked ticket --- .../adjoint_tests/source/adjoint_tests.f90 | 5 +- .../source/algorithm/gravity_wave_alg_mod.x90 | 42 +++++--------- .../gravity_wave_infrastructure_mod.f90 | 38 +++--------- .../gravity_wave/source/gravity_wave.f90 | 4 +- .../analytic_buoyancy_profiles_mod_test.pf | 2 +- .../compute_q_operator_kernel_mod_test.pf | 2 +- .../initial_buoyancy_kernel_mod_test.pf | 4 +- .../gungho_model/source/gungho_model.f90 | 5 +- .../algorithm/algorithm_test.f90 | 34 +++++------ .../jedi-interface/jedi_checksum_mod.f90 | 10 ++-- .../source/jedi-interface/jedi_run_mod.f90 | 23 +++++++- .../source/jedi_lfric_tests.f90 | 5 +- applications/jules/source/jules.f90 | 6 +- .../source/driver/lfric2lfric_driver_mod.F90 | 22 +++---- .../lfric2lfric_infrastructure_mod.X90 | 44 ++++++-------- .../lfric2lfric/source/lfric2lfric.F90 | 6 +- applications/lfric_atm/source/lfric_atm.f90 | 12 ++-- .../lfric_coupled/source/lfric_coupled.f90 | 5 +- .../common/lfricinp_lfric_driver_mod.f90 | 37 ++++++------ .../linear_model/source/linear_model.f90 | 5 +- .../driver/name_transport_driver_mod.f90 | 37 ++++-------- .../name_transport/source/name_transport.f90 | 5 +- .../analytic_name_field_profiles_mod_test.pf | 2 +- .../kernel/set_name_field_kernel_mod_test.pf | 4 +- applications/ngarch/source/ngarch.f90 | 8 ++- .../source/driver/shallow_water_model_mod.F90 | 26 ++------- .../shallow_water/source/shallow_water.f90 | 6 +- .../analytic_geopot_profiles_mod_test.pf | 2 +- ...analytic_swe_buoyancy_profiles_mod_test.pf | 2 +- ...ic_swe_streamfunction_profiles_mod_test.pf | 2 +- .../analytic_swe_wind_profiles_mod_test.pf | 2 +- .../galewsky_test_case_mod_test.pf | 2 +- .../kernel/initial_geopot_kernel_mod_test.pf | 4 +- .../initial_swe_buoyancy_kernel_mod_test.pf | 4 +- .../initial_swe_tracer_kernel_mod_test.pf | 2 +- .../kernel/initial_swe_u_kernel_mod_test.pf | 4 +- ...buoyancy_gradient_facet_kernel_mod_test.pf | 2 +- applications/solver/source/solver.F90 | 37 +++++------- .../source/driver/transport_driver_mod.f90 | 58 +++++-------------- applications/transport/source/transport.f90 | 7 ++- ...analytic_tracer_field_profiles_mod_test.pf | 2 +- ...ial_tracer_field_sample_kernel_mod_test.pf | 2 +- .../set_tracer_field_kernel_mod_test.pf | 4 +- .../jedi_lfric_linear_modeldb_driver_mod.f90 | 5 +- .../nl/jedi_lfric_nl_modeldb_driver_mod.f90 | 5 +- .../timestepping/atl_si_timestep_alg_mod.x90 | 9 +-- .../integration-test/cma_test/cma_test.f90 | 39 ++++++------- .../limited_area/init_gungho_lbcs_alg_mod.x90 | 11 +--- .../semi_implicit_timestep_alg_mod.X90 | 32 ++++------ .../gungho/source/driver/gungho_model_mod.F90 | 44 ++++---------- .../iau_multifile_io/iau_firstfile_io_mod.F90 | 29 ++++------ .../runge_kutta/runge_kutta.f90 | 8 ++- .../semi_implicit/semi_implicit.f90 | 8 ++- .../timestepping/tl_si_timestep_alg_mod.x90 | 8 +-- .../source/driver/linear_driver_mod.f90 | 51 +++++----------- 55 files changed, 322 insertions(+), 462 deletions(-) diff --git a/applications/adjoint_tests/source/adjoint_tests.f90 b/applications/adjoint_tests/source/adjoint_tests.f90 index 5fa5b2232..06e9ccf45 100644 --- a/applications/adjoint_tests/source/adjoint_tests.f90 +++ b/applications/adjoint_tests/source/adjoint_tests.f90 @@ -38,6 +38,7 @@ program adjoint_tests modeldb%mpi => global_mpi call modeldb%configuration%initialise( application_name, table_len=10 ) + call modeldb%config%initialise( application_name ) call modeldb%values%initialise('values', 5) @@ -59,7 +60,9 @@ program adjoint_tests call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), application_name ) call init_collections() call init_time( modeldb ) diff --git a/applications/gravity_wave/source/algorithm/gravity_wave_alg_mod.x90 b/applications/gravity_wave/source/algorithm/gravity_wave_alg_mod.x90 index f5a9bbd93..7a0fcd983 100644 --- a/applications/gravity_wave/source/algorithm/gravity_wave_alg_mod.x90 +++ b/applications/gravity_wave/source/algorithm/gravity_wave_alg_mod.x90 @@ -18,7 +18,6 @@ module gravity_wave_alg_mod LOG_LEVEL_INFO, & LOG_LEVEL_ERROR, & LOG_LEVEL_TRACE - use namelist_mod, only: namelist_type ! Configuration options use finite_element_config_mod, only: element_order_h, element_order_v @@ -496,7 +495,6 @@ contains use transpose_matrix_vector_kernel_mod, only: transpose_matrix_vector_kernel_type use sci_enforce_bc_kernel_mod, only: enforce_bc_kernel_type use fs_continuity_mod, only: W0, W2, W3, Wtheta - use boundaries_config_mod, only: limited_area implicit none @@ -513,34 +511,23 @@ contains type( field_type ) :: rhs_p type(mesh_type), pointer :: mesh => null() - ! Namelists - type(namelist_type), pointer :: base_mesh_nml - type(namelist_type), pointer :: timestepping_nml - type(namelist_type), pointer :: initial_temperature_nml - type(namelist_type), pointer :: gravity_wave_constants_nml - type(namelist_type), pointer :: io_nml - ! Namelist parameters - character(len=str_def) :: prime_mesh_name - real(kind=r_second) :: dt - real(kind=r_def) :: bvf_square - integer(kind=i_def) :: b_space - logical(kind=l_def) :: subroutine_timers + character(str_def) :: prime_mesh_name + real(r_second) :: dt + real(r_def) :: bvf_square + integer(i_def) :: b_space + logical(l_def) :: subroutine_timers + logical(l_def) :: limited_area ! Auxiliary constants to group invokes real(kind=r_def) :: const1, const2 - if ( subroutine_timers ) call timer('gravity_wave_alg') - - ! Pointers to namelists - timestepping_nml => modeldb%configuration%get_namelist('timestepping') - initial_temperature_nml => modeldb%configuration%get_namelist('initial_temperature') - io_nml => modeldb%configuration%get_namelist('io') + dt = modeldb%config%timestepping%dt() + bvf_square = modeldb%config%initial_temperature%bvf_square() + subroutine_timers = modeldb%config%io%subroutine_timers() + limited_area = modeldb%config%boundaries%limited_area() - ! Obtain namelist parameters - call timestepping_nml%get_value( 'dt', dt ) - call initial_temperature_nml%get_value( 'bvf_square', bvf_square ) - call io_nml%get_value( 'subroutine_timers', subroutine_timers ) + if ( subroutine_timers ) call timer('gravity_wave_alg') !=== Do a single timestep ==============================================! mesh => wind%get_mesh() @@ -548,10 +535,9 @@ contains m3_inv => get_inverse_mass_matrix_fe(W3, mesh%get_id()) if ( limited_area ) then - base_mesh_nml => modeldb%configuration%get_namelist('base_mesh') - gravity_wave_constants_nml => modeldb%configuration%get_namelist('gravity_wave_constants') - call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) - call gravity_wave_constants_nml%get_value( 'b_space', b_space ) + + prime_mesh_name = modeldb%config%base_mesh%prime_mesh_name() + b_space = modeldb%config%gravity_wave_constants%b_space() select case(b_space) case(b_space_w0) diff --git a/applications/gravity_wave/source/driver/gravity_wave_infrastructure_mod.f90 b/applications/gravity_wave/source/driver/gravity_wave_infrastructure_mod.f90 index 46b88ddad..c19930b51 100644 --- a/applications/gravity_wave/source/driver/gravity_wave_infrastructure_mod.f90 +++ b/applications/gravity_wave/source/driver/gravity_wave_infrastructure_mod.f90 @@ -30,7 +30,6 @@ module gravity_wave_infrastructure_mod LOG_LEVEL_ALWAYS, & LOG_LEVEL_ERROR use mesh_collection_mod, only : mesh_collection - use namelist_mod, only : namelist_type use field_mod, only : field_type use driver_fem_mod, only : init_fem, init_function_space_chains use driver_io_mod, only : init_io, final_io @@ -89,43 +88,24 @@ subroutine initialise_infrastructure( program_name, & real(r_def) :: domain_height real(r_def) :: scaled_radius - type(namelist_type), pointer :: base_mesh_nml => null() - type(namelist_type), pointer :: formulation_nml => null() - type(namelist_type), pointer :: extrusion_nml => null() - type(namelist_type), pointer :: planet_nml => null() - type(namelist_type), pointer :: multigrid_nml => null() - integer(i_def) :: i integer(i_def), parameter :: one_layer = 1_i_def !======================================================================= ! 0.0 Extract configuration variables !======================================================================= - base_mesh_nml => modeldb%configuration%get_namelist('base_mesh') - formulation_nml => modeldb%configuration%get_namelist('formulation') - extrusion_nml => modeldb%configuration%get_namelist('extrusion') - planet_nml => modeldb%configuration%get_namelist('planet') - - call formulation_nml%get_value( 'l_multigrid', l_multigrid ) - + l_multigrid = modeldb%config%formulation%l_multigrid() if (l_multigrid) then - multigrid_nml => modeldb%configuration%get_namelist('multigrid') - call multigrid_nml%get_value( 'chain_mesh_tags', chain_mesh_tags ) - multigrid_nml => null() + chain_mesh_tags = modeldb%config%multigrid%chain_mesh_tags() end if - call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) - call base_mesh_nml%get_value( 'geometry', geometry ) - call base_mesh_nml%get_value( 'prepartitioned', prepartitioned ) - call extrusion_nml%get_value( 'method', method ) - call extrusion_nml%get_value( 'domain_height', domain_height ) - call extrusion_nml%get_value( 'number_of_layers', number_of_layers ) - call planet_nml%get_value( 'scaled_radius', scaled_radius ) - - base_mesh_nml => null() - extrusion_nml => null() - formulation_nml => null() - planet_nml => null() + prime_mesh_name = modeldb%config%base_mesh%prime_mesh_name() + geometry = modeldb%config%base_mesh%geometry() + prepartitioned = modeldb%config%base_mesh%prepartitioned() + method = modeldb%config%extrusion%method() + domain_height = modeldb%config%extrusion%domain_height() + number_of_layers = modeldb%config%extrusion%number_of_layers() + scaled_radius = modeldb%config%planet%scaled_radius() !------------------------------------------------------------------------- ! Initialise infrastructure diff --git a/applications/gravity_wave/source/gravity_wave.f90 b/applications/gravity_wave/source/gravity_wave.f90 index e1a988dd0..7fb067f84 100644 --- a/applications/gravity_wave/source/gravity_wave.f90 +++ b/applications/gravity_wave/source/gravity_wave.f90 @@ -35,11 +35,13 @@ program gravity_wave call parse_command_line( filename ) call modeldb%configuration%initialise( program_name, table_len=10 ) + call modeldb%config%initialise( program_name ) modeldb%mpi => global_mpi call init_comm( program_name, modeldb ) call init_config( filename, gravity_wave_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) deallocate( filename ) call init_logger( modeldb%mpi%get_comm(), program_name ) diff --git a/applications/gravity_wave/unit-test/initialisation/analytic_buoyancy_profiles_mod_test.pf b/applications/gravity_wave/unit-test/initialisation/analytic_buoyancy_profiles_mod_test.pf index 743fdf381..5c7e44646 100644 --- a/applications/gravity_wave/unit-test/initialisation/analytic_buoyancy_profiles_mod_test.pf +++ b/applications/gravity_wave/unit-test/initialisation/analytic_buoyancy_profiles_mod_test.pf @@ -116,7 +116,7 @@ contains @after subroutine tear_down() - use configuration_mod, only: final_configuration + use config_loader_mod, only: final_configuration implicit none diff --git a/applications/gravity_wave/unit-test/kernel/compute_q_operator_kernel_mod_test.pf b/applications/gravity_wave/unit-test/kernel/compute_q_operator_kernel_mod_test.pf index e4337c084..2b0edf682 100644 --- a/applications/gravity_wave/unit-test/kernel/compute_q_operator_kernel_mod_test.pf +++ b/applications/gravity_wave/unit-test/kernel/compute_q_operator_kernel_mod_test.pf @@ -52,7 +52,7 @@ contains !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine tearDown( this ) - use configuration_mod, only: final_configuration + use config_loader_mod, only: final_configuration implicit none diff --git a/applications/gravity_wave/unit-test/kernel/initial_buoyancy_kernel_mod_test.pf b/applications/gravity_wave/unit-test/kernel/initial_buoyancy_kernel_mod_test.pf index 8a3ca705d..8b18ba861 100644 --- a/applications/gravity_wave/unit-test/kernel/initial_buoyancy_kernel_mod_test.pf +++ b/applications/gravity_wave/unit-test/kernel/initial_buoyancy_kernel_mod_test.pf @@ -85,8 +85,8 @@ contains @after subroutine tear_down() - use configuration_mod, only: final_configuration - use sci_chi_transform_mod, only: final_chi_transforms + use config_loader_mod, only: final_configuration + use sci_chi_transform_mod, only: final_chi_transforms implicit none diff --git a/applications/gungho_model/source/gungho_model.f90 b/applications/gungho_model/source/gungho_model.f90 index da2050f69..50d4b2170 100644 --- a/applications/gungho_model/source/gungho_model.f90 +++ b/applications/gungho_model/source/gungho_model.f90 @@ -47,6 +47,7 @@ program gungho_model call modeldb%configuration%initialise( application_name, & table_len=10 ) + call modeldb%config%initialise( application_name ) call modeldb%values%initialise( 'values', 5 ) ! Create the depository, prognostics and diagnostics field collections @@ -70,7 +71,9 @@ program gungho_model call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), application_name ) call init_timers( application_name ) call init_collections() diff --git a/applications/jedi_lfric_tests/integration-test/algorithm/algorithm_test.f90 b/applications/jedi_lfric_tests/integration-test/algorithm/algorithm_test.f90 index 9748e3f94..4b4614f1c 100644 --- a/applications/jedi_lfric_tests/integration-test/algorithm/algorithm_test.f90 +++ b/applications/jedi_lfric_tests/integration-test/algorithm/algorithm_test.f90 @@ -13,8 +13,9 @@ program algorithm_test use add_mesh_map_mod, only: assign_mesh_maps - use configuration_mod, only: final_configuration, & + use config_loader_mod, only: final_configuration, & read_configuration + use config_mod, only: config_type use constants_mod, only: i_def, r_def, str_def, l_def use create_mesh_mod, only: create_extrusion, create_mesh use test_algorithm_mod, only: test_algorithm_finalise, & @@ -36,7 +37,6 @@ program algorithm_test LOG_LEVEL_ERROR, & LOG_LEVEL_INFO use namelist_collection_mod, only: namelist_collection_type - use namelist_mod, only: namelist_type use base_mesh_config_mod, only: GEOMETRY_SPHERICAL, & GEOMETRY_PLANAR @@ -52,6 +52,7 @@ program algorithm_test character(:), allocatable :: filename type(namelist_collection_type), save :: configuration + type(config_type), save :: config ! Variables used for parsing command line arguments integer :: length, status, nargs @@ -76,10 +77,6 @@ program algorithm_test real(r_def) :: domain_height real(r_def) :: scaled_radius - type(namelist_type), pointer :: base_mesh_nml => null() - type(namelist_type), pointer :: planet_nml => null() - type(namelist_type), pointer :: extrusion_nml => null() - integer(i_def) :: i integer(i_def), parameter :: one_layer = 1_i_def @@ -145,27 +142,22 @@ program algorithm_test ! Setup configuration, mesh, and fem call configuration%initialise( program_name, table_len=10 ) - call read_configuration( filename, configuration ) + call config%initialise( program_name ) + call read_configuration( filename, & + configuration=configuration, & + config=config ) call init_collections() !-------------------------------------- ! 0.0 Extract namelist variables !-------------------------------------- - base_mesh_nml => configuration%get_namelist('base_mesh') - planet_nml => configuration%get_namelist('planet') - extrusion_nml => configuration%get_namelist('extrusion') - - call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) - call base_mesh_nml%get_value( 'geometry', geometry ) - call extrusion_nml%get_value( 'method', method ) - call extrusion_nml%get_value( 'domain_height', domain_height ) - call extrusion_nml%get_value( 'number_of_layers', number_of_layers ) - call planet_nml%get_value( 'scaled_radius', scaled_radius ) - - base_mesh_nml => null() - planet_nml => null() - extrusion_nml => null() + prime_mesh_name = config%base_mesh%prime_mesh_name() + geometry = config%base_mesh%geometry() + method = config%extrusion%method() + domain_height = config%extrusion%domain_height() + number_of_layers = config%extrusion%number_of_layers() + scaled_radius = config%planet%scaled_radius() !-------------------------------------- ! 1.0 Create the meshes diff --git a/applications/jedi_lfric_tests/source/jedi-interface/jedi_checksum_mod.f90 b/applications/jedi_lfric_tests/source/jedi-interface/jedi_checksum_mod.f90 index b5c3faf9f..f383262a3 100644 --- a/applications/jedi_lfric_tests/source/jedi-interface/jedi_checksum_mod.f90 +++ b/applications/jedi_lfric_tests/source/jedi-interface/jedi_checksum_mod.f90 @@ -58,7 +58,6 @@ subroutine output_linear_checksum( program_name, modeldb ) use constants_mod, only: i_def use formulation_config_mod, only: moisture_formulation_dry - use namelist_mod, only: namelist_type implicit none @@ -73,11 +72,11 @@ subroutine output_linear_checksum( program_name, modeldb ) type(field_type), pointer :: theta type(field_type), pointer :: u type(field_type), pointer :: rho - type(namelist_type), pointer :: formulation_nml - integer(kind=i_def) :: moisture_formulation + + integer(i_def) :: moisture_formulation nullify(moisture_fields, prognostic_fields, mr_array) - nullify(mr, theta, u, rho, formulation_nml) + nullify(mr, theta, u, rho) ! Get the fields to checksum prognostic_fields => modeldb%fields%get_field_collection("prognostic_fields") @@ -90,8 +89,7 @@ subroutine output_linear_checksum( program_name, modeldb ) mr => mr_array%bundle ! Get configuration to inform if moisture is output - formulation_nml => modeldb%configuration%get_namelist('formulation') - call formulation_nml%get_value( 'moisture_formulation', moisture_formulation ) + moisture_formulation = modeldb%config%formulation%moisture_formulation() ! Write checksums to file if (moisture_formulation /= moisture_formulation_dry) then diff --git a/applications/jedi_lfric_tests/source/jedi-interface/jedi_run_mod.f90 b/applications/jedi_lfric_tests/source/jedi-interface/jedi_run_mod.f90 index 8e981a2e9..943b1d691 100644 --- a/applications/jedi_lfric_tests/source/jedi-interface/jedi_run_mod.f90 +++ b/applications/jedi_lfric_tests/source/jedi-interface/jedi_run_mod.f90 @@ -13,6 +13,8 @@ module jedi_run_mod use constants_mod, only : i_def, l_def, str_def use namelist_collection_mod, only : namelist_collection_type + use config_mod, only : config_type + implicit none private @@ -21,6 +23,7 @@ module jedi_run_mod private character(str_def) :: jedi_run_name type(namelist_collection_type) :: configuration + type(config_type) :: config logical(kind=l_def) :: timers_finalised contains @@ -34,6 +37,9 @@ module jedi_run_mod !> Get a pointer to the stored configuration. procedure, public :: get_configuration + !> Get a pointer to the stored config_type. + procedure, public :: get_config + !> Just finalise subroutine timing; to get useful timing statistics from failed adjoint tests procedure, public :: finalise_timers @@ -104,13 +110,15 @@ subroutine initialise_infrastructure( self, filename, model_communicator ) ! Initialise the configuration call self%configuration%initialise( self%jedi_run_name, table_len=10 ) + call self%config%initialise( self%jedi_run_name ) ! Initialise the model communicator to setup global_mpi call init_internal_comm( model_communicator ) ! Setup the config which is curently global call init_config( filename, jedi_lfric_tests_required_namelists, & - self%configuration ) + configuration=self%configuration, & + config=self%config ) ! Initialise the logger call lfric_comm%set_comm_mpi_val(model_communicator) @@ -137,6 +145,19 @@ function get_configuration(self) result(configuration) end function get_configuration +!> @brief Get pointer to the stored configuration (config_type) +!> +!> @return configuration A pointer to the configuration +function get_config(self) result(config) + + class( jedi_run_type ), target, intent(inout) :: self + + type( config_type ), pointer :: config + + config => self%config + +end function get_config + !> @brief Just finalise subroutine timing; to get useful timing statistics from failed adjoint tests !> subroutine finalise_timers(self) diff --git a/applications/jedi_lfric_tests/source/jedi_lfric_tests.f90 b/applications/jedi_lfric_tests/source/jedi_lfric_tests.f90 index 2937a18de..dad145aed 100644 --- a/applications/jedi_lfric_tests/source/jedi_lfric_tests.f90 +++ b/applications/jedi_lfric_tests/source/jedi_lfric_tests.f90 @@ -43,6 +43,7 @@ program jedi_lfric_tests modeldb%mpi => global_mpi call modeldb%configuration%initialise( application_name, table_len=10 ) + call modeldb%config%initialise( application_name ) call modeldb%values%initialise('values', 5) @@ -64,7 +65,9 @@ program jedi_lfric_tests call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), application_name ) call init_timers( application_name ) call init_collections() diff --git a/applications/jules/source/jules.f90 b/applications/jules/source/jules.f90 index 5b2ca853a..522930328 100644 --- a/applications/jules/source/jules.f90 +++ b/applications/jules/source/jules.f90 @@ -44,6 +44,7 @@ program jules call modeldb%configuration%initialise( application_name, & table_len=10 ) + call modeldb%config%initialise( application_name ) call modeldb%values%initialise( 'values', 5 ) ! Create the depository, prognostics and diagnostics field collections @@ -65,8 +66,11 @@ program jules call modeldb%io_contexts%initialise(application_name, 100) call init_comm( application_name, modeldb ) + call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), application_name ) call init_timers( application_name ) call init_collections() diff --git a/applications/lfric2lfric/source/driver/lfric2lfric_driver_mod.F90 b/applications/lfric2lfric/source/driver/lfric2lfric_driver_mod.F90 index c38f37b34..6dea31420 100644 --- a/applications/lfric2lfric/source/driver/lfric2lfric_driver_mod.F90 +++ b/applications/lfric2lfric/source/driver/lfric2lfric_driver_mod.F90 @@ -7,7 +7,8 @@ !> module lfric2lfric_driver_mod - use constants_mod, only: str_def, i_def, l_def, r_second + use constants_mod, only: str_def, str_max_filename, & + i_def, l_def, r_second use driver_fem_mod, only: final_fem use driver_io_mod, only: final_io use driver_modeldb_mod, only: modeldb_type @@ -25,7 +26,6 @@ module lfric2lfric_driver_mod log_scratch_space use mesh_collection_mod, only: mesh_collection use mesh_mod, only: mesh_type - use namelist_mod, only: namelist_type use sci_checksum_alg_mod, only: checksum_alg !------------------------------------ @@ -94,13 +94,11 @@ subroutine run( modeldb ) integer(kind=i_def), parameter :: start_timestep = 1_i_def ! Namelist variables - character(len=str_def) :: start_dump_filename - character(len=str_def) :: checkpoint_stem_name - integer(kind=i_def) :: regrid_method + character(str_max_filename) :: start_dump_filename + character(str_max_filename) :: checkpoint_stem_name + integer(i_def) :: regrid_method ! Local parameters - type(namelist_type), pointer :: files_nml - type(namelist_type), pointer :: lfric2lfric_nml type(field_collection_type), pointer :: source_fields type(field_collection_type), pointer :: target_fields @@ -117,14 +115,10 @@ subroutine run( modeldb ) real(r_second) :: checkpoint_times(1) - ! Namelist pointers - files_nml => modeldb%configuration%get_namelist('files') - lfric2lfric_nml => modeldb%configuration%get_namelist('lfric2lfric') - ! Extract configuration variables - call files_nml%get_value( 'start_dump_filename', start_dump_filename ) - call files_nml%get_value( 'checkpoint_stem_name', checkpoint_stem_name ) - call lfric2lfric_nml%get_value( 'regrid_method', regrid_method ) + start_dump_filename = modeldb%config%files%start_dump_filename() + checkpoint_stem_name = modeldb%config%files%checkpoint_stem_name() + regrid_method = modeldb%config%lfric2lfric%regrid_method() ! Point to source and target field collections source_fields => modeldb%fields%get_field_collection(source_collection_name) diff --git a/applications/lfric2lfric/source/initialisation/lfric2lfric_infrastructure_mod.X90 b/applications/lfric2lfric/source/initialisation/lfric2lfric_infrastructure_mod.X90 index 108104c11..c4ec19867 100644 --- a/applications/lfric2lfric/source/initialisation/lfric2lfric_infrastructure_mod.X90 +++ b/applications/lfric2lfric/source/initialisation/lfric2lfric_infrastructure_mod.X90 @@ -14,7 +14,8 @@ module lfric2lfric_infrastructure_mod use add_mesh_map_mod, only: assign_mesh_maps use blend_orography_alg_mod, only: blend_orography - use constants_mod, only: str_def, r_def, i_def, l_def, r_second + use constants_mod, only: str_def, str_max_filename, & + r_def, i_def, l_def, r_second use create_mesh_mod, only: create_extrusion, & create_mesh use driver_modeldb_mod, only: modeldb_type @@ -154,16 +155,12 @@ contains type(uniform_extrusion_type), allocatable :: extrusion_2d ! Pointers for namelists - type(namelist_type), pointer :: planet_nml - type(namelist_type), pointer :: extrusion_nml type(namelist_type), pointer :: lfric2lfric_nml - type(namelist_type), pointer :: files_nml - 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(str_max_filename) :: start_dump_filename ! lfric2lfric namelist parameters integer(kind=i_def) :: origin_domain @@ -213,31 +210,24 @@ contains ! ------------------------------- ! Extract namelist variables ! ------------------------------- - planet_nml => modeldb%configuration%get_namelist('planet') - extrusion_nml => modeldb%configuration%get_namelist('extrusion') - lfric2lfric_nml => modeldb%configuration%get_namelist('lfric2lfric') - files_nml => modeldb%configuration%get_namelist('files') - finite_element_nml => modeldb%configuration%get_namelist('finite_element') - - call planet_nml%get_value( 'scaled_radius', scaled_radius ) - call extrusion_nml%get_value( 'method', extrusion_method ) - call extrusion_nml%get_value( 'number_of_layers', number_of_layers ) - call extrusion_nml%get_value( 'domain_height', domain_height ) ! Check lfric2lfric configuration settings are allowed + lfric2lfric_nml => modeldb%configuration%get_namelist('lfric2lfric') call lfric2lfric_check_configuration( lfric2lfric_nml ) - call lfric2lfric_nml%get_value( 'origin_domain', origin_domain ) - 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( 'source_mesh_name', & - mesh_names(src) ) - call lfric2lfric_nml%get_value( 'target_domain', target_domain ) - call lfric2lfric_nml%get_value( 'source_geometry', source_geometry ) - call files_nml%get_value( 'start_dump_filename', start_dump_filename ) - call finite_element_nml%get_value( 'element_order_h', element_order_h) - call finite_element_nml%get_value( 'element_order_v', element_order_v) + scaled_radius = modeldb%config%planet%scaled_radius() + extrusion_method = modeldb%config%extrusion%method() + number_of_layers = modeldb%config%extrusion%number_of_layers() + domain_height = modeldb%config%extrusion%domain_height() + origin_domain = modeldb%config%lfric2lfric%origin_domain() + regrid_method = modeldb%config%lfric2lfric%regrid_method() + mesh_names(dst) = modeldb%config%lfric2lfric%destination_mesh_name() + mesh_names(src) = modeldb%config%lfric2lfric%source_mesh_name() + target_domain = modeldb%config%lfric2lfric%target_domain() + source_geometry = modeldb%config%lfric2lfric%source_geometry() + start_dump_filename = modeldb%config%files%start_dump_filename() + element_order_h = modeldb%config%finite_element%element_order_h() + element_order_v = modeldb%config%finite_element%element_order_v() !======================================================================= ! Mesh diff --git a/applications/lfric2lfric/source/lfric2lfric.F90 b/applications/lfric2lfric/source/lfric2lfric.F90 index c40c5cc3d..92d560706 100644 --- a/applications/lfric2lfric/source/lfric2lfric.F90 +++ b/applications/lfric2lfric/source/lfric2lfric.F90 @@ -49,6 +49,7 @@ program lfric2lfric call parse_command_line( filename ) call modeldb%configuration%initialise( program_name, table_len=10 ) + call modeldb%config%initialise( program_name ) write(log_scratch_space,'(A)') & 'Application built with '// trim(precision_real) // & @@ -67,8 +68,11 @@ program lfric2lfric call modeldb%values%add_key_value('coupling_dst', coupler) #endif call init_comm( program_name, modeldb ) + call init_config( filename, lfric2lfric_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), program_name ) call init_collections() call init_time( modeldb ) diff --git a/applications/lfric_atm/source/lfric_atm.f90 b/applications/lfric_atm/source/lfric_atm.f90 index 8f314f64d..e6b39ad23 100644 --- a/applications/lfric_atm/source/lfric_atm.f90 +++ b/applications/lfric_atm/source/lfric_atm.f90 @@ -28,7 +28,6 @@ program lfric_atm use driver_modeldb_mod, only: modeldb_type use gungho_driver_mod, only: initialise, step, finalise use lfric_mpi_mod, only: global_mpi - use namelist_mod, only: namelist_type use timing_mod, only: init_timing, start_timing, stop_timing, final_timing, tik, LPROF @@ -40,7 +39,6 @@ program lfric_atm character(*), parameter :: application_name = "lfric_atm" character(:), allocatable :: filename integer(tik) :: timing_handle_global - type(namelist_type), pointer :: io_nml logical :: lsubroutine_timers call parse_command_line( filename ) @@ -49,6 +47,7 @@ program lfric_atm call modeldb%configuration%initialise( application_name, & table_len=10 ) + call modeldb%config%initialise( application_name ) call modeldb%values%initialise( 'values', 5 ) ! Create the depository, prognostics and diagnostics field collections @@ -72,14 +71,15 @@ program lfric_atm call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), application_name ) call init_timers( application_name ) - io_nml => modeldb%configuration%get_namelist('io') - call io_nml%get_value('subroutine_timers', lsubroutine_timers) + lsubroutine_timers = modeldb%config%io%subroutine_timers() call init_timing( modeldb%mpi%get_comm(), lsubroutine_timers ) - nullify( io_nml ) + if ( LPROF ) call start_timing( timing_handle_global, '__lfric_atm__ ') call init_collections() diff --git a/applications/lfric_coupled/source/lfric_coupled.f90 b/applications/lfric_coupled/source/lfric_coupled.f90 index 16b5d7375..41cde4cd5 100644 --- a/applications/lfric_coupled/source/lfric_coupled.f90 +++ b/applications/lfric_coupled/source/lfric_coupled.f90 @@ -43,6 +43,7 @@ program lfric_coupled modeldb%mpi => global_mpi call modeldb%configuration%initialise( application_name, table_len=10 ) + call modeldb%config%initialise( application_name ) call modeldb%values%initialise( 'values', 5 ) @@ -67,7 +68,9 @@ program lfric_coupled call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), application_name ) call init_collections() call init_time( modeldb ) diff --git a/applications/lfricinputs/source/common/lfricinp_lfric_driver_mod.f90 b/applications/lfricinputs/source/common/lfricinp_lfric_driver_mod.f90 index a0630d7bf..e250353d9 100644 --- a/applications/lfricinputs/source/common/lfricinp_lfric_driver_mod.f90 +++ b/applications/lfricinputs/source/common/lfricinp_lfric_driver_mod.f90 @@ -13,6 +13,8 @@ module lfricinp_lfric_driver_mod ! LFRic Modules use add_mesh_map_mod, only: assign_mesh_maps use create_mesh_mod, only: create_mesh +use config_mod, only: config_type + use driver_collections_mod, only: init_collections, final_collections use driver_mesh_mod, only: init_mesh use driver_fem_mod, only: init_fem @@ -117,10 +119,7 @@ subroutine lfricinp_initialise_lfric(program_name_arg, & type(namelist_collection_type), save :: configuration - -type(namelist_type), pointer :: base_mesh_nml -type(namelist_type), pointer :: planet_nml -type(namelist_type), pointer :: extrusion_nml +type(config_type), save :: config class(extrusion_type), allocatable :: extrusion type(uniform_extrusion_type), allocatable :: extrusion_2d @@ -164,8 +163,9 @@ subroutine lfricinp_initialise_lfric(program_name_arg, & call initialise_halo_comms( comm ) call configuration%initialise( program_name_arg, table_len=10 ) +call config%initialise( program_name_arg ) call load_configuration( lfric_nl_fname, required_lfric_namelists, & - configuration ) + configuration, config ) ! Initialise logging system call init_logger( comm, program_name ) @@ -184,16 +184,12 @@ subroutine lfricinp_initialise_lfric(program_name_arg, & ! ------------------------------- ! 0.0 Extract namelist variables ! ------------------------------- -base_mesh_nml => configuration%get_namelist('base_mesh') -planet_nml => configuration%get_namelist('planet') -extrusion_nml => configuration%get_namelist('extrusion') - -call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) -call base_mesh_nml%get_value( 'geometry', geometry ) -call planet_nml%get_value( 'scaled_radius', scaled_radius ) -call extrusion_nml%get_value( 'method', extrusion_method ) -call extrusion_nml%get_value( 'number_of_layers', number_of_layers ) -call extrusion_nml%get_value( 'domain_height', domain_height ) +prime_mesh_name = config%base_mesh%prime_mesh_name() +geometry = config%base_mesh%geometry() +scaled_radius = config%planet%scaled_radius() +extrusion_method = config%extrusion%method() +number_of_layers = config%extrusion%number_of_layers() +domain_height = config%extrusion%domain_height() !------------------------------------------------------------------------- ! 1.0 Create the meshes @@ -279,12 +275,12 @@ end subroutine lfricinp_initialise_lfric !------------------------------------------------------------------ subroutine load_configuration( lfric_nl, required_lfric_namelists, & - configuration ) + configuration, config ) ! Description: ! Reads lfric namelists and checks that all required namelists are present -use configuration_mod, only: read_configuration, ensure_configuration +use config_loader_mod, only: read_configuration, ensure_configuration implicit none @@ -292,7 +288,8 @@ subroutine load_configuration( lfric_nl, required_lfric_namelists, & character(*), intent(in) :: required_lfric_namelists(:) -type(namelist_collection_type), intent(INOUT) :: configuration +type(namelist_collection_type), intent(inout) :: configuration +type(config_type), intent(inout) :: config logical :: okay logical, allocatable :: success_map(:) @@ -303,7 +300,9 @@ subroutine load_configuration( lfric_nl, required_lfric_namelists, & call log_event('Loading '//trim(program_name)//' configuration ...', & LOG_LEVEL_ALWAYS) -call read_configuration( lfric_nl, configuration ) +call read_configuration( lfric_nl, & + configuration=configuration, & + config=config ) okay = ensure_configuration(required_lfric_namelists, success_map) if (.not. okay) then diff --git a/applications/linear_model/source/linear_model.f90 b/applications/linear_model/source/linear_model.f90 index e58099d46..d113c68d1 100644 --- a/applications/linear_model/source/linear_model.f90 +++ b/applications/linear_model/source/linear_model.f90 @@ -42,6 +42,7 @@ program linear_model modeldb%mpi => global_mpi call modeldb%configuration%initialise( application_name, table_len=10 ) + call modeldb%config%initialise( application_name ) call modeldb%values%initialise('values', 5) @@ -63,7 +64,9 @@ program linear_model call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), application_name ) call init_timers( application_name ) call init_collections() diff --git a/applications/name_transport/source/driver/name_transport_driver_mod.f90 b/applications/name_transport/source/driver/name_transport_driver_mod.f90 index 94e8365c0..01964e2f9 100644 --- a/applications/name_transport/source/driver/name_transport_driver_mod.f90 +++ b/applications/name_transport/source/driver/name_transport_driver_mod.f90 @@ -39,7 +39,6 @@ module name_transport_driver_mod use mesh_mod, only: mesh_type use mesh_collection_mod, only: mesh_collection use model_clock_mod, only: model_clock_type - use namelist_mod, only: namelist_type use runtime_constants_mod, only: create_runtime_constants use sci_checksum_alg_mod, only: checksum_alg use sci_geometric_constants_mod, only: get_chi_inventory, & @@ -123,38 +122,22 @@ subroutine initialise_name_transport( program_name, modeldb ) logical(kind=l_def) :: write_diag logical(kind=l_def) :: use_xios_io - type(namelist_type), pointer :: base_mesh_nml - type(namelist_type), pointer :: extrusion_nml - type(namelist_type), pointer :: planet_nml - type(namelist_type), pointer :: io_nml - integer(i_def) :: i integer(i_def), parameter :: one_layer = 1_i_def !======================================================================= ! 0.0 Extract configuration variables !======================================================================= - - base_mesh_nml => modeldb%configuration%get_namelist('base_mesh') - extrusion_nml => modeldb%configuration%get_namelist('extrusion') - planet_nml => modeldb%configuration%get_namelist('planet') - io_nml => modeldb%configuration%get_namelist('io') - - call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) - call base_mesh_nml%get_value( 'geometry', geometry ) - call base_mesh_nml%get_value( 'prepartitioned', prepartitioned ) - call extrusion_nml%get_value( 'method', method ) - call extrusion_nml%get_value( 'domain_height', domain_height ) - call extrusion_nml%get_value( 'number_of_layers', number_of_layers ) - call planet_nml%get_value( 'scaled_radius', scaled_radius ) - call io_nml%get_value( 'nodal_output_on_w3', nodal_output_on_w3 ) - call io_nml%get_value( 'write_diag', write_diag ) - call io_nml%get_value( 'use_xios_io', use_xios_io ) - - base_mesh_nml => null() - extrusion_nml => null() - planet_nml => null() - io_nml => null() + prime_mesh_name = modeldb%config%base_mesh%prime_mesh_name() + geometry = modeldb%config%base_mesh%geometry() + prepartitioned = modeldb%config%base_mesh%prepartitioned() + method = modeldb%config%extrusion%method() + domain_height = modeldb%config%extrusion%domain_height() + number_of_layers = modeldb%config%extrusion%number_of_layers() + scaled_radius = modeldb%config%planet%scaled_radius() + nodal_output_on_w3 = modeldb%config%io%nodal_output_on_w3() + write_diag = modeldb%config%io%write_diag() + use_xios_io = modeldb%config%io%use_xios_io() !----------------------------------------------------------------------- ! Initialise infrastructure diff --git a/applications/name_transport/source/name_transport.f90 b/applications/name_transport/source/name_transport.f90 index 7f8faab1d..baa29557d 100644 --- a/applications/name_transport/source/name_transport.f90 +++ b/applications/name_transport/source/name_transport.f90 @@ -40,10 +40,13 @@ program name_transport call parse_command_line( filename ) call modeldb%configuration%initialise( program_name, table_len=10 ) + call modeldb%config%initialise( program_name ) + modeldb%mpi => global_mpi call init_comm( program_name, modeldb ) call init_config( filename, name_transport_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) call init_logger( modeldb%mpi%get_comm(), program_name ) call log_event( 'Miniapp will run with default precision set as:', & diff --git a/applications/name_transport/unit-test/initialisation/analytic_name_field_profiles_mod_test.pf b/applications/name_transport/unit-test/initialisation/analytic_name_field_profiles_mod_test.pf index 9cd49a2b4..3882ca469 100644 --- a/applications/name_transport/unit-test/initialisation/analytic_name_field_profiles_mod_test.pf +++ b/applications/name_transport/unit-test/initialisation/analytic_name_field_profiles_mod_test.pf @@ -59,7 +59,7 @@ contains @after subroutine tear_down() - use configuration_mod, only: final_configuration + use config_loader_mod, only: final_configuration implicit none diff --git a/applications/name_transport/unit-test/kernel/set_name_field_kernel_mod_test.pf b/applications/name_transport/unit-test/kernel/set_name_field_kernel_mod_test.pf index 7ae24e5d4..1376cdc32 100644 --- a/applications/name_transport/unit-test/kernel/set_name_field_kernel_mod_test.pf +++ b/applications/name_transport/unit-test/kernel/set_name_field_kernel_mod_test.pf @@ -99,8 +99,8 @@ contains @after subroutine tear_down() - use configuration_mod, only: final_configuration - use sci_chi_transform_mod, only: final_chi_transforms + use config_loader_mod, only: final_configuration + use sci_chi_transform_mod, only: final_chi_transforms implicit none diff --git a/applications/ngarch/source/ngarch.f90 b/applications/ngarch/source/ngarch.f90 index 919eec564..a4d445918 100644 --- a/applications/ngarch/source/ngarch.f90 +++ b/applications/ngarch/source/ngarch.f90 @@ -35,6 +35,7 @@ program ngarch call parse_command_line( filename ) call modeldb%configuration%initialise( application_name, table_len=10 ) + call modeldb%config%initialise( application_name ) call modeldb%values%initialise( 'values', 5 ) ! Create the field collections in modeldb @@ -58,9 +59,10 @@ program ngarch modeldb%mpi => global_mpi call init_comm( application_name, modeldb ) - call init_config( filename, & - ngarch_required_namelists, & - modeldb%configuration ) + call init_config( filename, ngarch_required_namelists, & + configuration=modeldb%configuration, & + config=modeldb%config ) + deallocate( filename ) call init_logger( modeldb%mpi%get_comm(), application_name ) diff --git a/applications/shallow_water/source/driver/shallow_water_model_mod.F90 b/applications/shallow_water/source/driver/shallow_water_model_mod.F90 index f2706ce97..35e0d4402 100644 --- a/applications/shallow_water/source/driver/shallow_water_model_mod.F90 +++ b/applications/shallow_water/source/driver/shallow_water_model_mod.F90 @@ -43,8 +43,6 @@ module shallow_water_model_mod use minmax_tseries_mod, only: minmax_tseries, & minmax_tseries_init, & minmax_tseries_final - use namelist_collection_mod, only: namelist_collection_type - use namelist_mod, only: namelist_type use runtime_constants_mod, only: create_runtime_constants use shallow_water_setup_io_mod, only: init_shallow_water_files use xios, only: xios_update_calendar @@ -87,10 +85,6 @@ subroutine initialise_infrastructure( program_name, modeldb) class(extrusion_type), allocatable :: extrusion type(uniform_extrusion_type), allocatable :: extrusion_2d - type(namelist_type), pointer :: base_mesh_nml => null() - type(namelist_type), pointer :: planet_nml => null() - type(namelist_type), pointer :: extrusion_nml => null() - character(str_def) :: prime_mesh_name integer(i_def) :: stencil_depth @@ -108,20 +102,12 @@ subroutine initialise_infrastructure( program_name, modeldb) !======================================================================= ! 0.0 Extract configuration variables !======================================================================= - base_mesh_nml => modeldb%configuration%get_namelist('base_mesh') - planet_nml => modeldb%configuration%get_namelist('planet') - extrusion_nml => modeldb%configuration%get_namelist('extrusion') - - call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) - call base_mesh_nml%get_value( 'geometry', geometry ) - call extrusion_nml%get_value( 'method', method ) - call extrusion_nml%get_value( 'domain_height', domain_height ) - call extrusion_nml%get_value( 'number_of_layers', number_of_layers ) - call planet_nml%get_value( 'scaled_radius', scaled_radius ) - - base_mesh_nml => null() - planet_nml => null() - extrusion_nml => null() + prime_mesh_name = modeldb%config%base_mesh%prime_mesh_name() + geometry = modeldb%config%base_mesh%geometry() + method = modeldb%config%extrusion%method() + domain_height = modeldb%config%extrusion%domain_height() + number_of_layers = modeldb%config%extrusion%number_of_layers() + scaled_radius = modeldb%config%planet%scaled_radius() !------------------------------------------------------------------------- ! Initialise aspects of the infrastructure diff --git a/applications/shallow_water/source/shallow_water.f90 b/applications/shallow_water/source/shallow_water.f90 index c74a664b5..2b4fe2459 100644 --- a/applications/shallow_water/source/shallow_water.f90 +++ b/applications/shallow_water/source/shallow_water.f90 @@ -45,6 +45,7 @@ program shallow_water modeldb%mpi => global_mpi call modeldb%configuration%initialise( program_name, table_len=10 ) + call modeldb%config%initialise( program_name ) ! Create the depository and prognostics field collections call modeldb%fields%add_empty_field_collection("depository", & @@ -58,8 +59,11 @@ program shallow_water call modeldb%io_contexts%initialise(program_name, 100) call init_comm( program_name, modeldb ) + call init_config( filename, shallow_water_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) + call init_logger( global_mpi%get_comm(), program_name ) call init_timers( program_name ) call init_counters( program_name ) diff --git a/applications/shallow_water/unit-test/initialisation/analytic_geopot_profiles_mod_test.pf b/applications/shallow_water/unit-test/initialisation/analytic_geopot_profiles_mod_test.pf index a985748e0..b6ef9f975 100644 --- a/applications/shallow_water/unit-test/initialisation/analytic_geopot_profiles_mod_test.pf +++ b/applications/shallow_water/unit-test/initialisation/analytic_geopot_profiles_mod_test.pf @@ -93,7 +93,7 @@ contains @after subroutine tear_down() - use configuration_mod, only: final_configuration + use config_loader_mod, only: final_configuration implicit none diff --git a/applications/shallow_water/unit-test/initialisation/analytic_swe_buoyancy_profiles_mod_test.pf b/applications/shallow_water/unit-test/initialisation/analytic_swe_buoyancy_profiles_mod_test.pf index 3fe39d2bb..ae0fc9ecb 100644 --- a/applications/shallow_water/unit-test/initialisation/analytic_swe_buoyancy_profiles_mod_test.pf +++ b/applications/shallow_water/unit-test/initialisation/analytic_swe_buoyancy_profiles_mod_test.pf @@ -94,7 +94,7 @@ contains @after subroutine tear_down() - use configuration_mod, only: final_configuration + use config_loader_mod, only: final_configuration implicit none diff --git a/applications/shallow_water/unit-test/initialisation/analytic_swe_streamfunction_profiles_mod_test.pf b/applications/shallow_water/unit-test/initialisation/analytic_swe_streamfunction_profiles_mod_test.pf index 3a773ccfd..be54919c6 100644 --- a/applications/shallow_water/unit-test/initialisation/analytic_swe_streamfunction_profiles_mod_test.pf +++ b/applications/shallow_water/unit-test/initialisation/analytic_swe_streamfunction_profiles_mod_test.pf @@ -95,7 +95,7 @@ contains @after subroutine tear_down() - use configuration_mod, only: final_configuration + use config_loader_mod, only: final_configuration implicit none diff --git a/applications/shallow_water/unit-test/initialisation/analytic_swe_wind_profiles_mod_test.pf b/applications/shallow_water/unit-test/initialisation/analytic_swe_wind_profiles_mod_test.pf index 5e1740da0..7bd513eeb 100644 --- a/applications/shallow_water/unit-test/initialisation/analytic_swe_wind_profiles_mod_test.pf +++ b/applications/shallow_water/unit-test/initialisation/analytic_swe_wind_profiles_mod_test.pf @@ -94,7 +94,7 @@ contains @after subroutine tear_down() - use configuration_mod, only: final_configuration + use config_loader_mod, only: final_configuration implicit none diff --git a/applications/shallow_water/unit-test/initialisation/galewsky_test_case_mod_test.pf b/applications/shallow_water/unit-test/initialisation/galewsky_test_case_mod_test.pf index 20365147d..3ee3b9185 100644 --- a/applications/shallow_water/unit-test/initialisation/galewsky_test_case_mod_test.pf +++ b/applications/shallow_water/unit-test/initialisation/galewsky_test_case_mod_test.pf @@ -93,7 +93,7 @@ contains @after subroutine tear_down() - use configuration_mod, only: final_configuration + use config_loader_mod, only: final_configuration implicit none diff --git a/applications/shallow_water/unit-test/kernel/initial_geopot_kernel_mod_test.pf b/applications/shallow_water/unit-test/kernel/initial_geopot_kernel_mod_test.pf index fe44262b4..3d1b1f697 100644 --- a/applications/shallow_water/unit-test/kernel/initial_geopot_kernel_mod_test.pf +++ b/applications/shallow_water/unit-test/kernel/initial_geopot_kernel_mod_test.pf @@ -104,8 +104,8 @@ contains @after subroutine tear_down() - use sci_chi_transform_mod, only: final_chi_transforms - use configuration_mod, only: final_configuration + use sci_chi_transform_mod, only: final_chi_transforms + use config_loader_mod, only: final_configuration implicit none diff --git a/applications/shallow_water/unit-test/kernel/initial_swe_buoyancy_kernel_mod_test.pf b/applications/shallow_water/unit-test/kernel/initial_swe_buoyancy_kernel_mod_test.pf index 3c69d79cb..151ecd58b 100644 --- a/applications/shallow_water/unit-test/kernel/initial_swe_buoyancy_kernel_mod_test.pf +++ b/applications/shallow_water/unit-test/kernel/initial_swe_buoyancy_kernel_mod_test.pf @@ -105,8 +105,8 @@ contains @after subroutine tear_down() - use sci_chi_transform_mod, only: final_chi_transforms - use configuration_mod, only: final_configuration + use sci_chi_transform_mod, only: final_chi_transforms + use config_loader_mod, only: final_configuration implicit none diff --git a/applications/shallow_water/unit-test/kernel/initial_swe_tracer_kernel_mod_test.pf b/applications/shallow_water/unit-test/kernel/initial_swe_tracer_kernel_mod_test.pf index 29103cf75..8a7da1b3a 100644 --- a/applications/shallow_water/unit-test/kernel/initial_swe_tracer_kernel_mod_test.pf +++ b/applications/shallow_water/unit-test/kernel/initial_swe_tracer_kernel_mod_test.pf @@ -105,7 +105,7 @@ contains subroutine tear_down() use sci_chi_transform_mod, only: final_chi_transforms - use configuration_mod, only: final_configuration + use config_loader_mod, only: final_configuration implicit none diff --git a/applications/shallow_water/unit-test/kernel/initial_swe_u_kernel_mod_test.pf b/applications/shallow_water/unit-test/kernel/initial_swe_u_kernel_mod_test.pf index 846105876..439798b5d 100644 --- a/applications/shallow_water/unit-test/kernel/initial_swe_u_kernel_mod_test.pf +++ b/applications/shallow_water/unit-test/kernel/initial_swe_u_kernel_mod_test.pf @@ -103,8 +103,8 @@ contains !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine tearDown( this ) - use sci_chi_transform_mod, only: final_chi_transforms - use configuration_mod, only: final_configuration + use sci_chi_transform_mod, only: final_chi_transforms + use config_loader_mod, only: final_configuration implicit none diff --git a/applications/shallow_water/unit-test/kernel/swe_buoyancy_gradient_facet_kernel_mod_test.pf b/applications/shallow_water/unit-test/kernel/swe_buoyancy_gradient_facet_kernel_mod_test.pf index aa6e2d9fb..d848994a3 100644 --- a/applications/shallow_water/unit-test/kernel/swe_buoyancy_gradient_facet_kernel_mod_test.pf +++ b/applications/shallow_water/unit-test/kernel/swe_buoyancy_gradient_facet_kernel_mod_test.pf @@ -52,7 +52,7 @@ contains @after subroutine tear_down() - use configuration_mod, only: final_configuration + use config_loader_mod, only: final_configuration implicit none diff --git a/applications/solver/source/solver.F90 b/applications/solver/source/solver.F90 index 9c06cb220..acac6298b 100644 --- a/applications/solver/source/solver.F90 +++ b/applications/solver/source/solver.F90 @@ -12,6 +12,8 @@ program solver use add_mesh_map_mod, only: assign_mesh_maps + use config_mod, only: config_type + use config_loader_mod, only: final_configuration use constants_mod, only: i_def, r_def, PRECISION_REAL, str_def use convert_to_upper_mod, only: convert_to_upper use cli_mod, only: parse_command_line @@ -34,7 +36,6 @@ program solver use field_mod, only: field_type use sci_field_vector_mod, only: field_vector_type use solver_miniapp_alg_mod, only: solver_miniapp_alg - use configuration_mod, only: final_configuration use solver_miniapp_mod, only: solver_required_namelists use log_mod, only: log_event, & log_scratch_space, & @@ -44,10 +45,8 @@ program solver use mesh_mod, only: mesh_type use mesh_collection_mod, only: mesh_collection use namelist_collection_mod, only: namelist_collection_type - use namelist_mod, only: namelist_type use sci_checksum_alg_mod, only: checksum_alg - !------------------------------------ ! Configuration modules !------------------------------------ @@ -60,6 +59,7 @@ program solver character(:), allocatable :: filename type(namelist_collection_type), SAVE :: configuration + type(config_type), SAVE :: config integer(i_def) :: total_ranks, local_rank type(lfric_comm_type) :: comm @@ -80,10 +80,6 @@ program solver class(extrusion_type), allocatable :: extrusion type(uniform_extrusion_type), allocatable :: extrusion_2d - type(namelist_type), pointer :: base_mesh_nml => null() - type(namelist_type), pointer :: planet_nml => null() - type(namelist_type), pointer :: extrusion_nml => null() - character(str_def) :: prime_mesh_name integer(i_def) :: stencil_depth @@ -117,8 +113,12 @@ program solver local_rank = global_mpi%get_comm_rank() call configuration%initialise( program_name, table_len=10 ) + call config%initialise( program_name ) + call init_config( filename, solver_required_namelists, & - configuration ) + configuration=configuration, & + config=config ) + call init_logger( comm, program_name ) call init_collections() @@ -132,24 +132,15 @@ program solver !-------------------------------------- ! 0.0 Extract namelist variables !-------------------------------------- - base_mesh_nml => configuration%get_namelist('base_mesh') - planet_nml => configuration%get_namelist('planet') - extrusion_nml => configuration%get_namelist('extrusion') - - call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) - call base_mesh_nml%get_value( 'geometry', geometry ) - call extrusion_nml%get_value( 'method', method ) - call extrusion_nml%get_value( 'domain_height', domain_height ) - call extrusion_nml%get_value( 'number_of_layers', number_of_layers ) - call planet_nml%get_value( 'scaled_radius', scaled_radius ) - - base_mesh_nml => null() - planet_nml => null() - extrusion_nml => null() + prime_mesh_name = config%base_mesh%prime_mesh_name() + geometry = config%base_mesh%geometry() + method = config%extrusion%method() + domain_height = config%extrusion%domain_height() + number_of_layers = config%extrusion%number_of_layers() + scaled_radius = config%planet%scaled_radius() call log_event( 'Initialising '//program_name//' ...', LOG_LEVEL_ALWAYS ) - !======================================================================= ! 1.0 Mesh !======================================================================= diff --git a/applications/transport/source/driver/transport_driver_mod.f90 b/applications/transport/source/driver/transport_driver_mod.f90 index 2f9d4361d..530b49009 100644 --- a/applications/transport/source/driver/transport_driver_mod.f90 +++ b/applications/transport/source/driver/transport_driver_mod.f90 @@ -11,7 +11,7 @@ module transport_driver_mod use add_mesh_map_mod, only: assign_mesh_maps use sci_checksum_alg_mod, only: checksum_alg use check_configuration_mod, only: get_required_stencil_depth - use configuration_mod, only: final_configuration + use config_loader_mod, only: final_configuration use constants_mod, only: i_def, l_def, & r_def, r_second, str_def use create_mesh_mod, only: create_mesh, create_extrusion @@ -49,7 +49,6 @@ module transport_driver_mod use mesh_collection_mod, only: mesh_collection use model_clock_mod, only: model_clock_type use mr_indices_mod, only: nummr - use namelist_mod, only: namelist_type use runtime_constants_mod, only: create_runtime_constants use timer_mod, only: timer use transport_init_fields_alg_mod, only: transport_init_fields_alg @@ -142,58 +141,33 @@ subroutine initialise_transport( program_name, modeldb ) logical(kind=l_def) :: write_diag logical(kind=l_def) :: use_xios_io - type(namelist_type), pointer :: base_mesh_nml - type(namelist_type), pointer :: formulation_nml - type(namelist_type), pointer :: extrusion_nml - type(namelist_type), pointer :: planet_nml - type(namelist_type), pointer :: multigrid_nml - type(namelist_type), pointer :: multires_coupling_nml - type(namelist_type), pointer :: io_nml - integer(i_def) :: i integer(i_def), parameter :: one_layer = 1_i_def !======================================================================= ! 0.0 Extract configuration variables !======================================================================= - base_mesh_nml => modeldb%configuration%get_namelist('base_mesh') - formulation_nml => modeldb%configuration%get_namelist('formulation') - extrusion_nml => modeldb%configuration%get_namelist('extrusion') - planet_nml => modeldb%configuration%get_namelist('planet') - io_nml => modeldb%configuration%get_namelist('io') - - call formulation_nml%get_value( 'l_multigrid', l_multigrid ) - call formulation_nml%get_value( 'use_multires_coupling', & - use_multires_coupling ) + l_multigrid = modeldb%config%formulation%l_multigrid() + use_multires_coupling = modeldb%config%formulation%use_multires_coupling() + if (use_multires_coupling) then - multires_coupling_nml => modeldb%configuration%get_namelist('multires_coupling') - call multires_coupling_nml%get_value( 'aerosol_mesh_name', & - aerosol_mesh_name ) - multires_coupling_nml => null() + aerosol_mesh_name = modeldb%config%multires_coupling%aerosol_mesh_name() end if if (l_multigrid) then - multigrid_nml => modeldb%configuration%get_namelist('multigrid') - call multigrid_nml%get_value( 'chain_mesh_tags', chain_mesh_tags ) - multigrid_nml => null() + chain_mesh_tags = modeldb%config%multigrid%chain_mesh_tags() end if - call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) - call base_mesh_nml%get_value( 'geometry', geometry ) - call base_mesh_nml%get_value( 'prepartitioned', prepartitioned ) - call extrusion_nml%get_value( 'method', method ) - call extrusion_nml%get_value( 'domain_height', domain_height ) - call extrusion_nml%get_value( 'number_of_layers', number_of_layers ) - call planet_nml%get_value( 'scaled_radius', scaled_radius ) - call io_nml%get_value( 'nodal_output_on_w3', nodal_output_on_w3 ) - call io_nml%get_value( 'write_diag', write_diag ) - call io_nml%get_value( 'use_xios_io', use_xios_io ) - - base_mesh_nml => null() - extrusion_nml => null() - formulation_nml => null() - planet_nml => null() - io_nml => null() + prime_mesh_name = modeldb%config%base_mesh%prime_mesh_name() + geometry = modeldb%config%base_mesh%geometry() + prepartitioned = modeldb%config%base_mesh%prepartitioned() + method = modeldb%config%extrusion%method() + domain_height = modeldb%config%extrusion%domain_height() + number_of_layers = modeldb%config%extrusion%number_of_layers() + scaled_radius = modeldb%config%planet%scaled_radius() + nodal_output_on_w3 = modeldb%config%io%nodal_output_on_w3() + write_diag = modeldb%config%io%write_diag() + use_xios_io = modeldb%config%io%use_xios_io() !----------------------------------------------------------------------- ! Initialise infrastructure diff --git a/applications/transport/source/transport.f90 b/applications/transport/source/transport.f90 index a4ea8347a..bcc454675 100644 --- a/applications/transport/source/transport.f90 +++ b/applications/transport/source/transport.f90 @@ -37,10 +37,15 @@ program transport call parse_command_line( filename ) call modeldb%configuration%initialise( program_name, table_len=10 ) + call modeldb%config%initialise( program_name ) + modeldb%mpi => global_mpi call init_comm( program_name, modeldb ) + call init_config( filename, transport_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), program_name ) call log_event( 'Miniapp will run with default precision set as:', & diff --git a/applications/transport/unit-test/initialisation/analytic_tracer_field_profiles_mod_test.pf b/applications/transport/unit-test/initialisation/analytic_tracer_field_profiles_mod_test.pf index 9628fa396..2b000cb90 100644 --- a/applications/transport/unit-test/initialisation/analytic_tracer_field_profiles_mod_test.pf +++ b/applications/transport/unit-test/initialisation/analytic_tracer_field_profiles_mod_test.pf @@ -60,7 +60,7 @@ contains @after subroutine tear_down() - use configuration_mod, only: final_configuration + use config_loader_mod, only: final_configuration implicit none diff --git a/applications/transport/unit-test/kernel/initial_tracer_field_sample_kernel_mod_test.pf b/applications/transport/unit-test/kernel/initial_tracer_field_sample_kernel_mod_test.pf index 7fcd8dc18..db903e964 100644 --- a/applications/transport/unit-test/kernel/initial_tracer_field_sample_kernel_mod_test.pf +++ b/applications/transport/unit-test/kernel/initial_tracer_field_sample_kernel_mod_test.pf @@ -90,7 +90,7 @@ contains subroutine tearDown( this ) use sci_chi_transform_mod, only: final_chi_transforms - use configuration_mod, only: final_configuration + use config_loader_mod, only: final_configuration implicit none diff --git a/applications/transport/unit-test/kernel/set_tracer_field_kernel_mod_test.pf b/applications/transport/unit-test/kernel/set_tracer_field_kernel_mod_test.pf index 04e00da19..6d57a726b 100644 --- a/applications/transport/unit-test/kernel/set_tracer_field_kernel_mod_test.pf +++ b/applications/transport/unit-test/kernel/set_tracer_field_kernel_mod_test.pf @@ -111,8 +111,8 @@ contains @after subroutine tear_down() - use configuration_mod, only: final_configuration - use sci_chi_transform_mod, only: final_chi_transforms + use config_loader_mod, only: final_configuration + use sci_chi_transform_mod, only: final_chi_transforms implicit none diff --git a/interfaces/jedi_lfric_interface/source/driver/linear/jedi_lfric_linear_modeldb_driver_mod.f90 b/interfaces/jedi_lfric_interface/source/driver/linear/jedi_lfric_linear_modeldb_driver_mod.f90 index c7d2bb148..4ddd50aae 100644 --- a/interfaces/jedi_lfric_interface/source/driver/linear/jedi_lfric_linear_modeldb_driver_mod.f90 +++ b/interfaces/jedi_lfric_interface/source/driver/linear/jedi_lfric_linear_modeldb_driver_mod.f90 @@ -119,7 +119,7 @@ subroutine initialise_modeldb( modeldb_name, filename, mpi_obj, modeldb, atl_si_ ! 1. Initialise modeldb field collections, configuration and mpi. modeldb%mpi => mpi_obj call modeldb%configuration%initialise( modeldb_name, table_len=10 ) - + call modeldb%config%initialise( modeldb_name ) call modeldb%values%initialise('values', 5) ! Create the depository, prognostics and diagnostics field collections @@ -139,7 +139,8 @@ subroutine initialise_modeldb( modeldb_name, filename, mpi_obj, modeldb, atl_si_ call modeldb%io_contexts%initialise(modeldb_name, table_len=100) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) ! 2. Setup some model modeldb%values and initialise infrastructure call modeldb%values%add_key_value( 'temperature_correction_rate', 0.0_r_def ) diff --git a/interfaces/jedi_lfric_interface/source/driver/nl/jedi_lfric_nl_modeldb_driver_mod.f90 b/interfaces/jedi_lfric_interface/source/driver/nl/jedi_lfric_nl_modeldb_driver_mod.f90 index 6d1405ba6..37773a05e 100644 --- a/interfaces/jedi_lfric_interface/source/driver/nl/jedi_lfric_nl_modeldb_driver_mod.f90 +++ b/interfaces/jedi_lfric_interface/source/driver/nl/jedi_lfric_nl_modeldb_driver_mod.f90 @@ -67,7 +67,7 @@ subroutine initialise_modeldb( modeldb_name, filename, mpi_obj, modeldb ) ! 1. Initialise modeldb field collections, configuration and mpi. modeldb%mpi => mpi_obj call modeldb%configuration%initialise( modeldb_name, table_len=10 ) - + call modeldb%config%initialise( modeldb_name ) call modeldb%values%initialise('values', table_len = 5) ! 2. Create the depository, prognostics and diagnostics field collections @@ -89,7 +89,8 @@ subroutine initialise_modeldb( modeldb_name, filename, mpi_obj, modeldb ) call modeldb%io_contexts%initialise(modeldb_name, table_len=100) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) ! 3. Initialise the clock and calendar call init_time( modeldb ) diff --git a/science/adjoint/source/algorithm/timestepping/atl_si_timestep_alg_mod.x90 b/science/adjoint/source/algorithm/timestepping/atl_si_timestep_alg_mod.x90 index 04c466748..31d40ccd1 100644 --- a/science/adjoint/source/algorithm/timestepping/atl_si_timestep_alg_mod.x90 +++ b/science/adjoint/source/algorithm/timestepping/atl_si_timestep_alg_mod.x90 @@ -12,7 +12,6 @@ module atl_si_timestep_alg_mod use log_mod, only: log_event, log_scratch_space, & LOG_LEVEL_INFO, LOG_LEVEL_ERROR use driver_modeldb_mod, only: modeldb_type - use namelist_mod, only: namelist_type use reference_element_mod, only: T use formulation_config_mod, only: dlayer_on, exner_from_eos, si_momentum_equation, & moisture_formulation, moisture_formulation_dry, & @@ -314,8 +313,6 @@ contains integer(kind=i_def) :: ls_outer, ls_inner integer(kind=i_def) :: next_outer, next_inner real(kind=r_def) :: varalpha, varbeta - type(namelist_type), pointer :: mixed_solver_nml - type(namelist_type), pointer :: base_mesh_nml real(kind=r_def) :: mixed_solver_a_tol type(field_type) :: rhs_n_igh_u type(field_type) :: advected_u @@ -329,8 +326,7 @@ contains qr => get_qr_fe() ! Get mesh - base_mesh_nml => modeldb%configuration%get_namelist('base_mesh') - call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) + prime_mesh_name = modeldb%config%base_mesh%prime_mesh_name() mesh => mesh_collection%get_mesh(prime_mesh_name) mm_wt => get_mass_matrix_fe( Wtheta, mesh%get_id() ) @@ -627,8 +623,7 @@ contains ! Solve adjoint of semi-implicit system: A * inc = rhs !----------------------------------------------------------------------- - mixed_solver_nml => modeldb%configuration%get_namelist('mixed_solver') - call mixed_solver_nml%get_value( 'mixed_solver_a_tol', mixed_solver_a_tol ) + mixed_solver_a_tol = modeldb%config%mixed_solver%mixed_solver_a_tol() ! If self%state is zero, there is no need to call the SI solver if (.not. bundle_is_zero( mixed_solver_a_tol, self%state, bundle_size )) then diff --git a/science/gungho/integration-test/cma_test/cma_test.f90 b/science/gungho/integration-test/cma_test/cma_test.f90 index 2797865da..31179bda1 100644 --- a/science/gungho/integration-test/cma_test/cma_test.f90 +++ b/science/gungho/integration-test/cma_test/cma_test.f90 @@ -29,8 +29,10 @@ program cma_test test_cma_add, & test_cma_apply_inv, & test_cma_diag_DhMDhT + use config_mod, only : config_type use constants_mod, only : i_def, r_def, i_def, l_def, & - r_solver, pi, str_def + r_solver, pi, str_def, & + str_max_filename use derived_config_mod, only : set_derived_config use extrusion_mod, only : extrusion_type, & uniform_extrusion_type, & @@ -57,8 +59,6 @@ program cma_test use mesh_mod, only : mesh_type use mesh_collection_mod, only : mesh_collection use namelist_collection_mod, only : namelist_collection_type - use namelist_mod, only : namelist_type - use base_mesh_config_mod, only : GEOMETRY_SPHERICAL use create_mesh_mod, only : create_mesh use add_mesh_map_mod, only : assign_mesh_maps @@ -125,13 +125,11 @@ program cma_test ! Namelist and configuration variables type(namelist_collection_type), save :: configuration + type(config_type), save :: config - type(namelist_type), pointer :: extrusion_nml - type(namelist_type), pointer :: base_mesh_nml - type(namelist_type), pointer :: planet_nml + character(str_max_filename) :: file_prefix integer(i_def) :: stencil_depth - character(str_def) :: file_prefix character(str_def) :: prime_mesh_name real(r_def) :: radius real(r_def) :: scaled_radius @@ -232,6 +230,7 @@ program cma_test end select call configuration%initialise( program_name, table_len=10 ) + call config%initialise( program_name ) deallocate(program_name) deallocate(test_flag) @@ -243,7 +242,9 @@ program cma_test call log_event( log_scratch_space, LOG_LEVEL_INFO ) allocate( success_map(size(required_configuration)) ) - call read_configuration( filename, configuration ) + call read_configuration( filename, & + configuration=configuration, & + config=config ) okay = ensure_configuration( required_configuration, success_map ) if (.not. okay) then @@ -262,19 +263,15 @@ program cma_test call init_collections() - extrusion_nml => configuration%get_namelist('extrusion') - base_mesh_nml => configuration%get_namelist('base_mesh') - planet_nml => configuration%get_namelist('planet') - - call extrusion_nml%get_value( 'method', extrusion_method ) - call extrusion_nml%get_value( 'planet_radius', radius ) - call extrusion_nml%get_value( 'number_of_layers', number_of_layers ) - call extrusion_nml%get_value( 'domain_height', domain_height ) - call base_mesh_nml%get_value( 'file_prefix', file_prefix ) - call base_mesh_nml%get_value( 'prepartitioned', prepartitioned ) - call base_mesh_nml%get_value( 'geometry', geometry ) - call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) - call planet_nml%get_value( 'scaled_radius', scaled_radius ) + extrusion_method = config%extrusion%method() + radius = config%extrusion%planet_radius() + number_of_layers = config%extrusion%number_of_layers() + domain_height = config%extrusion%domain_height() + file_prefix = config%base_mesh%file_prefix() + prepartitioned = config%base_mesh%prepartitioned() + geometry = config%base_mesh%geometry() + prime_mesh_name = config%base_mesh%prime_mesh_name() + scaled_radius = config%planet%scaled_radius() !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Initialise diff --git a/science/gungho/source/algorithm/limited_area/init_gungho_lbcs_alg_mod.x90 b/science/gungho/source/algorithm/limited_area/init_gungho_lbcs_alg_mod.x90 index 24391689a..d93de2056 100644 --- a/science/gungho/source/algorithm/limited_area/init_gungho_lbcs_alg_mod.x90 +++ b/science/gungho/source/algorithm/limited_area/init_gungho_lbcs_alg_mod.x90 @@ -91,18 +91,11 @@ module init_gungho_lbcs_alg_mod integer(i_def) :: imr type(mesh_type), pointer :: mesh - type(namelist_type), pointer :: base_mesh_nml - type(namelist_type), pointer :: formulation_nml - character(len=str_def) :: prime_mesh_name integer(i_def) :: moisture_formulation - - base_mesh_nml => modeldb%configuration%get_namelist('base_mesh') - formulation_nml => modeldb%configuration%get_namelist('formulation') - - call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) - call formulation_nml%get_value( 'moisture_formulation', moisture_formulation ) + prime_mesh_name = modeldb%config%base_mesh%prime_mesh_name() + moisture_formulation = modeldb%config%formulation%moisture_formulation() call prognostic_fields%get_field( 'theta', theta ) call prognostic_fields%get_field( 'u', u ) diff --git a/science/gungho/source/algorithm/timestepping/semi_implicit_timestep_alg_mod.X90 b/science/gungho/source/algorithm/timestepping/semi_implicit_timestep_alg_mod.X90 index 7aa360475..4f10820d6 100644 --- a/science/gungho/source/algorithm/timestepping/semi_implicit_timestep_alg_mod.X90 +++ b/science/gungho/source/algorithm/timestepping/semi_implicit_timestep_alg_mod.X90 @@ -14,7 +14,6 @@ module semi_implicit_timestep_alg_mod log_scratch_space, & LOG_LEVEL_INFO use extrusion_mod, only: TWOD - use namelist_mod, only: namelist_type use sci_fem_constants_mod, only: get_mass_matrix_fe, & get_mass_matrix_fv use sci_field_bundle_builtins_mod, & @@ -651,40 +650,29 @@ contains logical(kind=l_def) :: checkpoint_reference_fields ! Namelist parameters - type(namelist_type), pointer :: base_mesh_nml - type(namelist_type), pointer :: initialization_nml - type(namelist_type), pointer :: microphysics_nml - type(namelist_type), pointer :: aerosol_nml - type(namelist_type), pointer :: timestepping_nml - - character(str_def) :: prime_mesh_name - integer(i_def) :: lbc_option - logical(l_def) :: microphysics_casim - logical(l_def) :: murk_lbc - real(r_def) :: tau_r + character(str_def) :: prime_mesh_name + integer(i_def) :: lbc_option + logical(l_def) :: microphysics_casim + logical(l_def) :: murk_lbc + real(r_def) :: tau_r if ( subroutine_timers ) call timer('semi_implicit_timestep_alg') cast_dt = real(model_clock%get_seconds_per_step(), r_def) if (limited_area .and. use_wavedynamics) then - base_mesh_nml => modeldb%configuration%get_namelist('base_mesh') - initialization_nml => modeldb%configuration%get_namelist('initialization') - timestepping_nml => modeldb%configuration%get_namelist('timestepping') - call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) - call initialization_nml%get_value( 'lbc_option', lbc_option ) - call timestepping_nml%get_value( 'tau_r', tau_r ) + prime_mesh_name = modeldb%config%base_mesh%prime_mesh_name() + lbc_option = modeldb%config%initialization%lbc_option() + tau_r = modeldb%config%timestepping%tau_r() if (lbc_option == lbc_option_um2lfric_file) then - aerosol_nml => modeldb%configuration%get_namelist('aerosol') - call aerosol_nml%get_value( 'murk_lbc', murk_lbc ) + murk_lbc = modeldb%config%aerosol%murk_lbc() end if end if if (lbc_option == lbc_option_um2lfric_file .or. & (use_physics .and. cloud == cloud_um)) then - microphysics_nml => modeldb%configuration%get_namelist('microphysics') - call microphysics_nml%get_value( 'microphysics_casim', microphysics_casim ) + microphysics_casim = modeldb%config%microphysics%microphysics_casim() end if if (element_order_h == 0 .and. element_order_v == 0) then diff --git a/science/gungho/source/driver/gungho_model_mod.F90 b/science/gungho/source/driver/gungho_model_mod.F90 index e91f0fbd6..8a885b432 100644 --- a/science/gungho/source/driver/gungho_model_mod.F90 +++ b/science/gungho/source/driver/gungho_model_mod.F90 @@ -73,8 +73,6 @@ module gungho_model_mod use model_clock_mod, only : model_clock_type use moisture_conservation_alg_mod, & only : moisture_conservation_alg - use namelist_collection_mod, only : namelist_collection_type - use namelist_mod, only : namelist_type use mr_indices_mod, only : nummr use no_timestep_alg_mod, only : no_timestep_type use remove_duplicates_mod, only : remove_duplicates @@ -451,12 +449,6 @@ subroutine initialise_infrastructure( io_context_name, modeldb ) real(r_def) :: scaled_radius integer(i_def) :: number_of_layers - type(namelist_type), pointer :: base_mesh_nml - type(namelist_type), pointer :: formulation_nml - type(namelist_type), pointer :: extrusion_nml - type(namelist_type), pointer :: planet_nml - type(namelist_type), pointer :: multigrid_nml - type(namelist_type), pointer :: multires_coupling_nml #ifdef UM_PHYSICS real(r_def) :: dt #endif @@ -473,37 +465,25 @@ subroutine initialise_infrastructure( io_context_name, modeldb ) call check_configuration(modeldb) - base_mesh_nml => modeldb%configuration%get_namelist('base_mesh') - formulation_nml => modeldb%configuration%get_namelist('formulation') - extrusion_nml => modeldb%configuration%get_namelist('extrusion') - planet_nml => modeldb%configuration%get_namelist('planet') - multires_coupling_nml => null() - multigrid_nml => null() - - call formulation_nml%get_value( 'l_multigrid', l_multigrid ) - call formulation_nml%get_value( 'use_multires_coupling', & - use_multires_coupling ) + l_multigrid = modeldb%config%formulation%l_multigrid() + use_multires_coupling = modeldb%config%formulation%use_multires_coupling() if ( use_multires_coupling ) then - multires_coupling_nml => modeldb%configuration%get_namelist('multires_coupling') - call multires_coupling_nml%get_value( 'multires_coupling_mesh_tags', & - multires_coupling_mesh_tags ) - call multires_coupling_nml%get_value( 'orography_mesh_name', & - orography_mesh_name ) + multires_coupling_mesh_tags = modeldb%config%multires_coupling%multires_coupling_mesh_tags() + orography_mesh_name = modeldb%config%multires_coupling%orography_mesh_name() end if if ( l_multigrid ) then - multigrid_nml => modeldb%configuration%get_namelist('multigrid') - call multigrid_nml%get_value( 'chain_mesh_tags', chain_mesh_tags ) + chain_mesh_tags = modeldb%config%multigrid%chain_mesh_tags() end if - call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) - call base_mesh_nml%get_value( 'geometry', geometry ) - call base_mesh_nml%get_value( 'prepartitioned', prepartitioned ) - call extrusion_nml%get_value( 'domain_height', domain_height ) - call extrusion_nml%get_value( 'method', extrusion_method ) - call extrusion_nml%get_value( 'number_of_layers', number_of_layers ) - call planet_nml%get_value( 'scaled_radius', scaled_radius ) + prime_mesh_name = modeldb%config%base_mesh%prime_mesh_name() + geometry = modeldb%config%base_mesh%geometry() + prepartitioned = modeldb%config%base_mesh%prepartitioned() + domain_height = modeldb%config%extrusion%domain_height() + extrusion_method = modeldb%config%extrusion%method() + number_of_layers = modeldb%config%extrusion%number_of_layers() + scaled_radius = modeldb%config%planet%scaled_radius() !------------------------------------------------------------------------- ! Initialise infrastructure diff --git a/science/gungho/source/driver/iau_multifile_io/iau_firstfile_io_mod.F90 b/science/gungho/source/driver/iau_multifile_io/iau_firstfile_io_mod.F90 index efca60c32..dfc166e87 100644 --- a/science/gungho/source/driver/iau_multifile_io/iau_firstfile_io_mod.F90 +++ b/science/gungho/source/driver/iau_multifile_io/iau_firstfile_io_mod.F90 @@ -9,7 +9,7 @@ module iau_firstfile_io_mod use calendar_mod, only: calendar_type - use constants_mod, only: str_def, l_def + use constants_mod, only: str_def, str_max_filename, l_def use driver_modeldb_mod, only: modeldb_type use field_collection_mod, only: field_collection_type use field_mod, only: field_type @@ -22,7 +22,6 @@ module iau_firstfile_io_mod use linked_list_mod, only: linked_list_type use mesh_collection_mod, only: mesh_collection use mesh_mod, only: mesh_type - use namelist_mod, only: namelist_type use sci_geometric_constants_mod, only: get_chi_inventory, & get_panel_id_inventory use step_calendar_mod, only: step_calendar_type @@ -58,10 +57,6 @@ subroutine iau_incs_firstfile_io ( io_context_name, modeldb, & type(lfric_xios_context_type), pointer :: io_context type(linked_list_type), pointer :: file_list type(field_collection_type), pointer :: multifile_fields - type(namelist_type), pointer :: time_nml - type(namelist_type), pointer :: base_mesh_nml - type(namelist_type), pointer :: files_nml - type(namelist_type), pointer :: io_nml class(calendar_type), allocatable :: tmp_calendar @@ -69,8 +64,9 @@ subroutine iau_incs_firstfile_io ( io_context_name, modeldb, & character(str_def) :: time_start character(str_def) :: prime_mesh_name character(str_def) :: context_name - character(str_def) :: iau_addinf_path - character(str_def) :: iau_bcorr_path + + character(str_max_filename) :: iau_addinf_path + character(str_max_filename) :: iau_bcorr_path logical(l_def) :: use_xios_io @@ -81,17 +77,12 @@ subroutine iau_incs_firstfile_io ( io_context_name, modeldb, & chi_inventory => get_chi_inventory() panel_id_inventory => get_panel_id_inventory() - time_nml => modeldb%configuration%get_namelist('time') - base_mesh_nml => modeldb%configuration%get_namelist('base_mesh') - files_nml => modeldb%configuration%get_namelist('files') - io_nml => modeldb%configuration%get_namelist('io') - - call time_nml%get_value('calendar_origin', time_origin) - call time_nml%get_value('calendar_start', time_start) - call base_mesh_nml%get_value('prime_mesh_name', prime_mesh_name) - call files_nml%get_value('iau_addinf_path', iau_addinf_path) - call files_nml%get_value('iau_bcorr_path', iau_bcorr_path) - call io_nml%get_value('use_xios_io', use_xios_io) + time_origin = modeldb%config%time%calendar_origin() + time_start = modeldb%config%time%calendar_start() + prime_mesh_name = modeldb%config%base_mesh%prime_mesh_name() + iau_addinf_path = modeldb%config%files%iau_addinf_path() + iau_bcorr_path = modeldb%config%files%iau_bcorr_path() + use_xios_io = modeldb%config%io%use_xios_io() ! get filename and set up context name for this file context_name = "multifile_context_" // trim(iau_incs_path) diff --git a/science/linear/integration-test/runge_kutta/runge_kutta.f90 b/science/linear/integration-test/runge_kutta/runge_kutta.f90 index f460201ac..d49c8638f 100644 --- a/science/linear/integration-test/runge_kutta/runge_kutta.f90 +++ b/science/linear/integration-test/runge_kutta/runge_kutta.f90 @@ -10,7 +10,7 @@ !! corresponding nonlinear code. program runge_kutta - use configuration_mod, only: read_configuration, final_configuration + use config_loader_mod, only: read_configuration, final_configuration use driver_collections_mod, only: init_collections, final_collections use driver_time_mod, only: init_time, final_time use driver_modeldb_mod, only: modeldb_type @@ -146,7 +146,11 @@ program runge_kutta end select call modeldb%configuration%initialise( program_name, table_len=10 ) - call read_configuration( filename, modeldb%configuration ) + call modeldb%config%initialise( program_name ) + call read_configuration( filename, & + configuration=modeldb%configuration, & + config=modeldb%config ) + deallocate( filename ) call init_collections() diff --git a/science/linear/integration-test/semi_implicit/semi_implicit.f90 b/science/linear/integration-test/semi_implicit/semi_implicit.f90 index af625729c..4ee8e4888 100644 --- a/science/linear/integration-test/semi_implicit/semi_implicit.f90 +++ b/science/linear/integration-test/semi_implicit/semi_implicit.f90 @@ -10,7 +10,7 @@ !! corresponding nonlinear code. program semi_implicit - use configuration_mod, only: read_configuration, final_configuration + use config_loader_mod, only: read_configuration, final_configuration use driver_collections_mod, only: init_collections, final_collections use driver_time_mod, only: init_time, final_time use driver_modeldb_mod, only: modeldb_type @@ -22,7 +22,6 @@ program semi_implicit log_event, & LOG_LEVEL_ERROR, & LOG_LEVEL_INFO - use namelist_collection_mod, only: namelist_collection_type use tl_test_driver_mod, only: initialise, & finalise, & run_timesteps, & @@ -133,7 +132,10 @@ program semi_implicit end select call modeldb%configuration%initialise( program_name, table_len=10 ) - call read_configuration( filename, modeldb%configuration ) + call modeldb%config%initialise( program_name ) + call read_configuration( filename, & + configuration=modeldb%configuration, & + config=modeldb%config ) deallocate( filename ) call init_collections() diff --git a/science/linear/source/algorithm/timestepping/tl_si_timestep_alg_mod.x90 b/science/linear/source/algorithm/timestepping/tl_si_timestep_alg_mod.x90 index c4bfedbd2..97638f671 100644 --- a/science/linear/source/algorithm/timestepping/tl_si_timestep_alg_mod.x90 +++ b/science/linear/source/algorithm/timestepping/tl_si_timestep_alg_mod.x90 @@ -14,7 +14,6 @@ module tl_si_timestep_alg_mod LOG_LEVEL_INFO, & LOG_LEVEL_ERROR use driver_modeldb_mod, only: modeldb_type - use namelist_mod, only: namelist_type use reference_element_mod, only: T ! Configuration options @@ -394,8 +393,7 @@ contains logical( kind=l_def ) :: write_moisture_diag = .false. ! Configuration - type( namelist_type ), pointer :: mixed_solver_nml - real( kind=r_def ) :: mixed_solver_a_tol + real( kind=r_def ) :: mixed_solver_a_tol if ( subroutine_timers ) call timer('semi_implicit_timestep_alg') @@ -803,9 +801,7 @@ contains ! Solve semi-implicit system: A*inc = rhs, and increment state by inc !-------------------------------------------------------------------- - mixed_solver_nml => modeldb%configuration%get_namelist('mixed_solver') - call mixed_solver_nml%get_value( 'mixed_solver_a_tol', & - mixed_solver_a_tol ) + mixed_solver_a_tol = modeldb%config%mixed_solver%mixed_solver_a_tol() ! If rhs_np1 is zero, there is no need to call the SI solver if ( .not. & diff --git a/science/linear/source/driver/linear_driver_mod.f90 b/science/linear/source/driver/linear_driver_mod.f90 index 662faea60..9b6d80282 100644 --- a/science/linear/source/driver/linear_driver_mod.f90 +++ b/science/linear/source/driver/linear_driver_mod.f90 @@ -49,7 +49,6 @@ module linear_driver_mod use linear_data_algorithm_mod, only : update_ls_file_alg use mesh_mod, only : mesh_type use mesh_collection_mod, only : mesh_collection - use namelist_mod, only : namelist_type use create_tl_prognostics_mod, only : create_tl_prognostics implicit none @@ -79,11 +78,6 @@ subroutine initialise( program_name, modeldb ) type( mesh_type ), pointer :: aerosol_mesh type( mesh_type ), pointer :: aerosol_twod_mesh - type( namelist_type ), pointer :: base_mesh_nml - type( namelist_type ), pointer :: multires_coupling_nml - type( namelist_type ), pointer :: initialization_nml - type( namelist_type ), pointer :: io_nml - character( len=str_def ) :: prime_mesh_name character( len=str_def ) :: aerosol_mesh_name logical( kind=l_def ) :: coarse_aerosol_ancil @@ -101,7 +95,6 @@ subroutine initialise( program_name, modeldb ) real(r_def), allocatable :: real_array(:) nullify( mesh, twod_mesh, aerosol_mesh, aerosol_twod_mesh, depository ) - nullify( base_mesh_nml, multires_coupling_nml, initialization_nml ) depository => modeldb%fields%get_field_collection("depository") fd_fields => modeldb%fields%get_field_collection("fd_fields") @@ -129,26 +122,21 @@ subroutine initialise( program_name, modeldb ) call modeldb%values%add_key_value('model_axes', model_axes) ! Get primary and 2D meshes for initialising model data - base_mesh_nml => modeldb%configuration%get_namelist('base_mesh') - call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) + prime_mesh_name = modeldb%config%base_mesh%prime_mesh_name() + mesh => mesh_collection%get_mesh(prime_mesh_name) twod_mesh => mesh_collection%get_mesh(mesh, TWOD) ! Get initialization configuration - initialization_nml => modeldb%configuration%get_namelist('initialization') - call initialization_nml%get_value( 'coarse_aerosol_ancil', & - coarse_aerosol_ancil ) - call initialization_nml%get_value( 'coarse_ozone_ancil', & - coarse_ozone_ancil ) - call initialization_nml%get_value( 'init_option', init_option ) + coarse_aerosol_ancil = modeldb%config%initialization%coarse_aerosol_ancil() + coarse_ozone_ancil = modeldb%config%initialization%coarse_ozone_ancil() + init_option = modeldb%config%initialization%init_option() ! If aerosol data is on a different mesh, get this if (coarse_aerosol_ancil .or. coarse_ozone_ancil) then ! For now use the coarsest mesh - multires_coupling_nml => & - modeldb%configuration%get_namelist('multires_coupling') - call multires_coupling_nml%get_value( 'aerosol_mesh_name', & - aerosol_mesh_name ) + aerosol_mesh_name = modeldb%config%multires_coupling%aerosol_mesh_name() + aerosol_mesh => mesh_collection%get_mesh(aerosol_mesh_name) aerosol_twod_mesh => mesh_collection%get_mesh(aerosol_mesh, TWOD) write( log_scratch_space,'(A,A)' ) "aerosol mesh name:", aerosol_mesh%get_mesh_name() @@ -196,8 +184,7 @@ subroutine initialise( program_name, modeldb ) modeldb ) ! Get io configuration - io_nml => modeldb%configuration%get_namelist('io') - call io_nml%get_value( 'nodal_output_on_w3', nodal_output_on_w3 ) + nodal_output_on_w3 = modeldb%config%io%nodal_output_on_w3() ! Initial output call write_initial_output( modeldb, mesh, twod_mesh, & @@ -227,16 +214,14 @@ subroutine step( modeldb ) type( gungho_time_axes_type ), pointer :: model_axes type( mesh_type ), pointer :: mesh type( mesh_type ), pointer :: twod_mesh - type( namelist_type ), pointer :: base_mesh_nml - type( namelist_type ), pointer :: initialization_nml - type( namelist_type ), pointer :: io_nml + character( len=str_def ) :: prime_mesh_name integer( kind=i_def ) :: ls_option logical( kind=l_def ) :: write_diag integer( kind=i_medium ) :: diagnostic_frequency logical( kind=l_def ) :: nodal_output_on_w3 - nullify(mesh, twod_mesh, base_mesh_nml, initialization_nml, io_nml) + nullify(mesh, twod_mesh) nullify(moisture_fields, ls_mr_array, ls_moist_dyn_array) ! Get model_axes out of modeldb @@ -248,10 +233,7 @@ subroutine step( modeldb ) ls_fields => modeldb%fields%get_field_collection("ls_fields") - ! Get initialization configuration - initialization_nml => modeldb%configuration%get_namelist('initialization') - call initialization_nml%get_value( 'ls_option', ls_option ) - + ls_option = modeldb%config%initialization%ls_option() if ( ls_option == ls_option_file ) then call update_ls_file_alg( model_axes%ls_times_list, & modeldb%clock, & @@ -261,19 +243,16 @@ subroutine step( modeldb ) end if ! Get Mesh - base_mesh_nml => modeldb%configuration%get_namelist('base_mesh') - call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) + prime_mesh_name = modeldb%config%base_mesh%prime_mesh_name() mesh => mesh_collection%get_mesh(prime_mesh_name) twod_mesh => mesh_collection%get_mesh(mesh, TWOD) call linear_step( mesh, twod_mesh, & modeldb, modeldb%clock ) - ! Get io configuration - io_nml => modeldb%configuration%get_namelist('io') - call io_nml%get_value( 'diagnostic_frequency', diagnostic_frequency ) - call io_nml%get_value( 'write_diag', write_diag ) - call io_nml%get_value( 'nodal_output_on_w3', nodal_output_on_w3 ) + diagnostic_frequency = modeldb%config%io%diagnostic_frequency() + write_diag = modeldb%config%io%write_diag() + nodal_output_on_w3 = modeldb%config%io%nodal_output_on_w3() if ( ( mod(modeldb%clock%get_step(), diagnostic_frequency) == 0 ) & .and. ( write_diag ) ) then From 577447858067be0774c63297b82fdb06f337019c Mon Sep 17 00:00:00 2001 From: Ricky Wong <141156427+mo-rickywong@users.noreply.github.com> Date: Mon, 12 Jan 2026 07:25:01 +0000 Subject: [PATCH 03/12] Add some kinds --- applications/lfric_atm/source/lfric_atm.f90 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/applications/lfric_atm/source/lfric_atm.f90 b/applications/lfric_atm/source/lfric_atm.f90 index e6b39ad23..757f207b9 100644 --- a/applications/lfric_atm/source/lfric_atm.f90 +++ b/applications/lfric_atm/source/lfric_atm.f90 @@ -17,6 +17,7 @@ program lfric_atm use cli_mod, only: parse_command_line + use constants_mod, only: l_def use driver_collections_mod, only: init_collections, final_collections use driver_comm_mod, only: init_comm, final_comm use driver_config_mod, only: init_config, final_config @@ -29,7 +30,8 @@ program lfric_atm use gungho_driver_mod, only: initialise, step, finalise use lfric_mpi_mod, only: global_mpi - use timing_mod, only: init_timing, start_timing, stop_timing, final_timing, tik, LPROF + use timing_mod, only: init_timing, start_timing, & + stop_timing, final_timing, tik, LPROF implicit none @@ -39,7 +41,8 @@ program lfric_atm character(*), parameter :: application_name = "lfric_atm" character(:), allocatable :: filename integer(tik) :: timing_handle_global - logical :: lsubroutine_timers + + logical(l_def) :: lsubroutine_timers call parse_command_line( filename ) From 7867f00f179d3882f5048bb61bb97d5240ff63fe Mon Sep 17 00:00:00 2001 From: Ricky Wong <141156427+mo-rickywong@users.noreply.github.com> Date: Mon, 12 Jan 2026 12:09:39 +0000 Subject: [PATCH 04/12] Remove configuration variables that weren't being used --- .../source/driver/iau_multifile_io/iau_firstfile_io_mod.F90 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/science/gungho/source/driver/iau_multifile_io/iau_firstfile_io_mod.F90 b/science/gungho/source/driver/iau_multifile_io/iau_firstfile_io_mod.F90 index dfc166e87..0dd45d4c0 100644 --- a/science/gungho/source/driver/iau_multifile_io/iau_firstfile_io_mod.F90 +++ b/science/gungho/source/driver/iau_multifile_io/iau_firstfile_io_mod.F90 @@ -65,9 +65,6 @@ subroutine iau_incs_firstfile_io ( io_context_name, modeldb, & character(str_def) :: prime_mesh_name character(str_def) :: context_name - character(str_max_filename) :: iau_addinf_path - character(str_max_filename) :: iau_bcorr_path - logical(l_def) :: use_xios_io procedure(callback_clock_arg), pointer :: before_close @@ -80,8 +77,6 @@ subroutine iau_incs_firstfile_io ( io_context_name, modeldb, & time_origin = modeldb%config%time%calendar_origin() time_start = modeldb%config%time%calendar_start() prime_mesh_name = modeldb%config%base_mesh%prime_mesh_name() - iau_addinf_path = modeldb%config%files%iau_addinf_path() - iau_bcorr_path = modeldb%config%files%iau_bcorr_path() use_xios_io = modeldb%config%io%use_xios_io() ! get filename and set up context name for this file From 438c54da661ddd083a46896090fefd94c923a2bd Mon Sep 17 00:00:00 2001 From: Ricky Wong <141156427+mo-rickywong@users.noreply.github.com> Date: Mon, 26 Jan 2026 11:43:27 +0000 Subject: [PATCH 05/12] Only changes that allow Apps to work with the purge of intermediate namelist api from core --- .../adjoint_tests/source/adjoint_tests.f90 | 8 +- .../gravity_wave_infrastructure_mod.f90 | 10 +- .../gravity_wave/source/gravity_wave.f90 | 7 +- .../gungho_model/source/gungho_model.f90 | 8 +- .../algorithm/algorithm_test.f90 | 11 +- .../jedi-interface/jedi_geometry_mod.f90 | 7 +- .../source/jedi-interface/jedi_run_mod.f90 | 25 +- .../jedi_lfric_tests/source/jedi_forecast.f90 | 5 +- .../source/jedi_forecast_pseudo.f90 | 6 +- .../source/jedi_id_tlm_tests.f90 | 6 +- .../source/jedi_lfric_tests.f90 | 9 +- .../source/jedi_tlm_forecast_tl.f90 | 6 +- .../source/jedi_tlm_tests.f90 | 5 +- applications/jules/source/jules.f90 | 9 +- .../lfric2lfric_infrastructure_mod.X90 | 2 +- .../initialisation/lfric2lfric_init_mesh.f90 | 42 +- .../lfric2lfric/source/lfric2lfric.F90 | 7 +- applications/lfric_atm/source/lfric_atm.f90 | 6 +- .../lfric_coupled/source/lfric_coupled.f90 | 8 +- .../common/lfricinp_lfric_driver_mod.f90 | 20 +- .../linear_model/source/linear_model.f90 | 7 +- .../driver/name_transport_driver_mod.f90 | 10 +- .../name_transport/source/name_transport.f90 | 9 +- applications/ngarch/source/ngarch.f90 | 12 +- .../source/driver/shallow_water_model_mod.F90 | 3 +- .../shallow_water/source/shallow_water.f90 | 8 +- applications/solver/source/solver.F90 | 11 +- .../source/driver/transport_driver_mod.f90 | 2 +- applications/transport/source/transport.f90 | 12 +- dependencies.yaml | 4 +- .../time/jedi_lfric_time_test.f90 | 12 +- .../jedi_lfric_linear_modeldb_driver_mod.f90 | 6 +- .../nl/jedi_lfric_nl_modeldb_driver_mod.f90 | 7 +- .../source/mesh/jedi_lfric_mesh_setup_mod.F90 | 7 +- .../integration-test/cma_test/cma_test.f90 | 14 +- .../gungho/source/driver/gungho_model_mod.F90 | 3 +- .../runge_kutta/runge_kutta.f90 | 7 +- .../semi_implicit/semi_implicit.f90 | 7 +- .../source/utils/check_config_api_mod.f90 | 393 ++++++++++++++++++ 39 files changed, 665 insertions(+), 76 deletions(-) create mode 100644 science/shared/source/utils/check_config_api_mod.f90 diff --git a/applications/adjoint_tests/source/adjoint_tests.f90 b/applications/adjoint_tests/source/adjoint_tests.f90 index 5fa5b2232..6b507c26c 100644 --- a/applications/adjoint_tests/source/adjoint_tests.f90 +++ b/applications/adjoint_tests/source/adjoint_tests.f90 @@ -10,6 +10,7 @@ program adjoint_tests + use check_config_api_mod, only : check_config_api use cli_mod, only : parse_command_line use driver_collections_mod, only : init_collections, final_collections use driver_comm_mod, only : init_comm, final_comm @@ -38,6 +39,7 @@ program adjoint_tests modeldb%mpi => global_mpi call modeldb%configuration%initialise( application_name, table_len=10 ) + call modeldb%config%initialise( application_name ) call modeldb%values%initialise('values', 5) @@ -59,8 +61,12 @@ program adjoint_tests call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) call init_logger( modeldb%mpi%get_comm(), application_name ) + + call check_config_api( modeldb%configuration, modeldb%config ) + call init_collections() call init_time( modeldb ) deallocate( filename ) diff --git a/applications/gravity_wave/source/driver/gravity_wave_infrastructure_mod.f90 b/applications/gravity_wave/source/driver/gravity_wave_infrastructure_mod.f90 index 46b88ddad..5ecef8fd2 100644 --- a/applications/gravity_wave/source/driver/gravity_wave_infrastructure_mod.f90 +++ b/applications/gravity_wave/source/driver/gravity_wave_infrastructure_mod.f90 @@ -197,11 +197,11 @@ subroutine initialise_infrastructure( program_name, & apply_partition_check = .true. end if - call init_mesh( modeldb%configuration, & - modeldb%mpi%get_comm_rank(), & - modeldb%mpi%get_comm_size(), & - base_mesh_names, & - extrusion, stencil_depth, & + call init_mesh( modeldb%config, & + modeldb%mpi%get_comm_rank(), & + modeldb%mpi%get_comm_size(), & + base_mesh_names, & + extrusion, stencil_depth, & apply_partition_check ) allocate( twod_names, source=base_mesh_names ) diff --git a/applications/gravity_wave/source/gravity_wave.f90 b/applications/gravity_wave/source/gravity_wave.f90 index e1a988dd0..1492a7b68 100644 --- a/applications/gravity_wave/source/gravity_wave.f90 +++ b/applications/gravity_wave/source/gravity_wave.f90 @@ -11,6 +11,7 @@ program gravity_wave + use check_config_api_mod, only: check_config_api use cli_mod, only: parse_command_line use driver_modeldb_mod, only: modeldb_type use driver_collections_mod, only: init_collections, final_collections @@ -35,11 +36,15 @@ program gravity_wave call parse_command_line( filename ) call modeldb%configuration%initialise( program_name, table_len=10 ) + call modeldb%config%initialise( program_name ) modeldb%mpi => global_mpi call init_comm( program_name, modeldb ) call init_config( filename, gravity_wave_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) + call check_config_api( modeldb%configuration, modeldb%config ) + deallocate( filename ) call init_logger( modeldb%mpi%get_comm(), program_name ) diff --git a/applications/gungho_model/source/gungho_model.f90 b/applications/gungho_model/source/gungho_model.f90 index da2050f69..6d9d5bdc5 100644 --- a/applications/gungho_model/source/gungho_model.f90 +++ b/applications/gungho_model/source/gungho_model.f90 @@ -15,6 +15,7 @@ program gungho_model + use check_config_api_mod, only: check_config_api use cli_mod, only: parse_command_line use derived_config_mod, only: l_esm_couple use driver_collections_mod, only: init_collections, final_collections @@ -47,6 +48,7 @@ program gungho_model call modeldb%configuration%initialise( application_name, & table_len=10 ) + call modeldb%config%initialise( application_name ) call modeldb%values%initialise( 'values', 5 ) ! Create the depository, prognostics and diagnostics field collections @@ -70,8 +72,12 @@ program gungho_model call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) call init_logger( modeldb%mpi%get_comm(), application_name ) + + call check_config_api( modeldb%configuration, modeldb%config ) + call init_timers( application_name ) call init_collections() call init_time( modeldb ) diff --git a/applications/jedi_lfric_tests/integration-test/algorithm/algorithm_test.f90 b/applications/jedi_lfric_tests/integration-test/algorithm/algorithm_test.f90 index 9748e3f94..093539b9b 100644 --- a/applications/jedi_lfric_tests/integration-test/algorithm/algorithm_test.f90 +++ b/applications/jedi_lfric_tests/integration-test/algorithm/algorithm_test.f90 @@ -13,8 +13,10 @@ program algorithm_test use add_mesh_map_mod, only: assign_mesh_maps + use check_config_api_mod, only: check_config_api use configuration_mod, only: final_configuration, & read_configuration + use config_mod, only: config_type use constants_mod, only: i_def, r_def, str_def, l_def use create_mesh_mod, only: create_extrusion, create_mesh use test_algorithm_mod, only: test_algorithm_finalise, & @@ -52,6 +54,7 @@ program algorithm_test character(:), allocatable :: filename type(namelist_collection_type), save :: configuration + type(config_type), save :: config ! Variables used for parsing command line arguments integer :: length, status, nargs @@ -145,7 +148,11 @@ program algorithm_test ! Setup configuration, mesh, and fem call configuration%initialise( program_name, table_len=10 ) - call read_configuration( filename, configuration ) + call config%initialise( program_name ) + call read_configuration( filename, & + configuration=configuration, & + config=config ) + call check_config_api( configuration, config ) call init_collections() @@ -199,7 +206,7 @@ program algorithm_test !------------------------------------------------------------------------- stencil_depth = 1 apply_partition_check = .false. - call init_mesh( configuration, & + call init_mesh( config, & local_rank, total_ranks, & base_mesh_names, extrusion, & stencil_depth, & diff --git a/applications/jedi_lfric_tests/source/jedi-interface/jedi_geometry_mod.f90 b/applications/jedi_lfric_tests/source/jedi-interface/jedi_geometry_mod.f90 index 4fd1b473b..5e5dc3761 100644 --- a/applications/jedi_lfric_tests/source/jedi-interface/jedi_geometry_mod.f90 +++ b/applications/jedi_lfric_tests/source/jedi-interface/jedi_geometry_mod.f90 @@ -14,6 +14,7 @@ module jedi_geometry_mod use, intrinsic :: iso_fortran_env, only : real64 use calendar_mod, only : calendar_type + use config_mod, only : config_type use constants_mod, only : i_def, l_def, str_def, & r_second, i_timestep use extrusion_mod, only : extrusion_type, TWOD @@ -92,9 +93,8 @@ module jedi_geometry_mod !> @brief Initialiser for jedi_geometry_type !> -subroutine initialise( self, mpi_comm, configuration ) +subroutine initialise( self, mpi_comm, configuration, config ) ! 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 @@ -104,6 +104,7 @@ subroutine initialise( self, mpi_comm, configuration ) class( jedi_geometry_type ), intent(inout) :: self integer( kind=i_def ), intent(in) :: mpi_comm type(namelist_collection_type), intent(in) :: configuration + type(config_type), intent(in) :: config ! Local type(mesh_type), pointer :: mesh @@ -121,7 +122,7 @@ subroutine initialise( self, mpi_comm, configuration ) ! Setup mesh mpi_obj = self%get_mpi_comm() - call initialise_mesh( self%mesh_name, configuration, mpi_obj ) + call initialise_mesh( self%mesh_name, configuration, config, mpi_obj ) geometry_configuration => configuration%get_namelist('jedi_geometry') ! Setup the IO diff --git a/applications/jedi_lfric_tests/source/jedi-interface/jedi_run_mod.f90 b/applications/jedi_lfric_tests/source/jedi-interface/jedi_run_mod.f90 index 8e981a2e9..cf463dc68 100644 --- a/applications/jedi_lfric_tests/source/jedi-interface/jedi_run_mod.f90 +++ b/applications/jedi_lfric_tests/source/jedi-interface/jedi_run_mod.f90 @@ -10,6 +10,8 @@ ! module jedi_run_mod + use check_config_api_mod, only : check_config_api + use config_mod, only : config_type use constants_mod, only : i_def, l_def, str_def use namelist_collection_mod, only : namelist_collection_type @@ -21,6 +23,7 @@ module jedi_run_mod private character(str_def) :: jedi_run_name type(namelist_collection_type) :: configuration + type(config_type) :: config logical(kind=l_def) :: timers_finalised contains @@ -34,6 +37,9 @@ module jedi_run_mod !> Get a pointer to the stored configuration. procedure, public :: get_configuration + !> Get a pointer to the stored config + procedure, public :: get_config + !> Just finalise subroutine timing; to get useful timing statistics from failed adjoint tests procedure, public :: finalise_timers @@ -104,18 +110,22 @@ subroutine initialise_infrastructure( self, filename, model_communicator ) ! Initialise the configuration call self%configuration%initialise( self%jedi_run_name, table_len=10 ) + call self%config%initialise( self%jedi_run_name ) ! Initialise the model communicator to setup global_mpi call init_internal_comm( model_communicator ) ! Setup the config which is curently global call init_config( filename, jedi_lfric_tests_required_namelists, & - self%configuration ) + configuration=self%configuration, & + config=self%config ) ! Initialise the logger call lfric_comm%set_comm_mpi_val(model_communicator) call init_logger( lfric_comm, self%jedi_run_name ) + call check_config_api( self%configuration, self%config ) + ! Initialise subroutine timers call init_timers( self%jedi_run_name ) self%timers_finalised = .false. @@ -137,6 +147,19 @@ function get_configuration(self) result(configuration) end function get_configuration +!> @brief Get pointer to the stored configuration +!> +!> @return config A pointer to the configuration +function get_config(self) result(config) + + class( jedi_run_type ), target, intent(inout) :: self + + type( config_type ), pointer :: config + + config => self%config + +end function get_config + !> @brief Just finalise subroutine timing; to get useful timing statistics from failed adjoint tests !> subroutine finalise_timers(self) diff --git a/applications/jedi_lfric_tests/source/jedi_forecast.f90 b/applications/jedi_lfric_tests/source/jedi_forecast.f90 index 00150b30d..fcf48de84 100644 --- a/applications/jedi_lfric_tests/source/jedi_forecast.f90 +++ b/applications/jedi_lfric_tests/source/jedi_forecast.f90 @@ -20,6 +20,7 @@ program jedi_forecast use cli_mod, only : parse_command_line + use config_mod, only : config_type use constants_mod, only : PRECISION_REAL, i_def, str_def use field_collection_mod, only : field_collection_type use log_mod, only : log_event, log_scratch_space, & @@ -47,6 +48,7 @@ program jedi_forecast ! Local type( namelist_collection_type ), pointer :: configuration + type( config_type ), pointer :: config character(:), allocatable :: filename integer( i_def ) :: model_communicator type( jedi_duration_type ) :: forecast_length @@ -76,6 +78,7 @@ program jedi_forecast ! Get the configuration configuration => jedi_run%get_configuration() + config => jedi_run%get_config() ! Get the forecast length jedi_lfric_settings_config => configuration%get_namelist('jedi_lfric_settings') @@ -83,7 +86,7 @@ program jedi_forecast call forecast_length%init(forecast_length_str) ! Create geometry - call jedi_geometry%initialise( model_communicator, configuration ) + call jedi_geometry%initialise( model_communicator, configuration, config ) ! Create state (requires the configuration file name to setup the modeldb) call jedi_state%initialise( jedi_geometry, configuration, filename ) diff --git a/applications/jedi_lfric_tests/source/jedi_forecast_pseudo.f90 b/applications/jedi_lfric_tests/source/jedi_forecast_pseudo.f90 index cec71e9d4..eb30c92c3 100644 --- a/applications/jedi_lfric_tests/source/jedi_forecast_pseudo.f90 +++ b/applications/jedi_lfric_tests/source/jedi_forecast_pseudo.f90 @@ -20,6 +20,7 @@ program jedi_forecast_pseudo use cli_mod, only : parse_command_line + use config_mod, only : config_type use constants_mod, only : PRECISION_REAL, i_def, str_def use field_collection_mod, only : field_collection_type use log_mod, only : log_event, log_scratch_space, & @@ -47,6 +48,8 @@ program jedi_forecast_pseudo ! Local type( namelist_collection_type ), pointer :: configuration + type( config_type ), pointer :: config + character(:), allocatable :: filename integer(i_def) :: model_communicator type( jedi_duration_type ) :: forecast_length @@ -75,6 +78,7 @@ program jedi_forecast_pseudo ! Get the configuration configuration => jedi_run%get_configuration() + config => jedi_run%get_config() ! Get the forecast length jedi_lfric_settings_config => configuration%get_namelist('jedi_lfric_settings') @@ -82,7 +86,7 @@ program jedi_forecast_pseudo call forecast_length%init(forecast_length_str) ! Create geometry - call jedi_geometry%initialise( model_communicator, configuration ) + call jedi_geometry%initialise( model_communicator, configuration, config ) ! Create state call jedi_state%initialise( jedi_geometry, configuration ) diff --git a/applications/jedi_lfric_tests/source/jedi_id_tlm_tests.f90 b/applications/jedi_lfric_tests/source/jedi_id_tlm_tests.f90 index ed8b0db66..adfa8a2b3 100644 --- a/applications/jedi_lfric_tests/source/jedi_id_tlm_tests.f90 +++ b/applications/jedi_lfric_tests/source/jedi_id_tlm_tests.f90 @@ -47,6 +47,7 @@ program jedi_id_tlm_tests use cli_mod, only : parse_command_line + use config_mod, only : config_type use constants_mod, only : PRECISION_REAL, i_def, str_def, r_def use field_collection_mod, only : field_collection_type use log_mod, only : log_event, log_scratch_space, & @@ -81,6 +82,8 @@ program jedi_id_tlm_tests ! Local type( namelist_collection_type ), pointer :: configuration + type( config_type ), pointer :: config + character(:), allocatable :: filename integer( kind=i_def ) :: model_communicator type( jedi_duration_type ) :: forecast_length @@ -115,6 +118,7 @@ program jedi_id_tlm_tests ! Get the configuration configuration => run%get_configuration() + config => run%get_config() ! Get the forecast length jedi_lfric_settings_config => configuration%get_namelist('jedi_lfric_settings') @@ -122,7 +126,7 @@ program jedi_id_tlm_tests call forecast_length%init(forecast_length_str) ! Create geometry - call geometry%initialise( model_communicator, configuration ) + call geometry%initialise( model_communicator, configuration, config ) ! Create state call state%initialise( geometry, configuration ) diff --git a/applications/jedi_lfric_tests/source/jedi_lfric_tests.f90 b/applications/jedi_lfric_tests/source/jedi_lfric_tests.f90 index 2937a18de..dd9a75c29 100644 --- a/applications/jedi_lfric_tests/source/jedi_lfric_tests.f90 +++ b/applications/jedi_lfric_tests/source/jedi_lfric_tests.f90 @@ -15,6 +15,7 @@ !> program jedi_lfric_tests + use check_config_api_mod, only : check_config_api use cli_mod, only : parse_command_line use driver_collections_mod, only : init_collections, final_collections use driver_comm_mod, only : init_comm, final_comm @@ -43,6 +44,7 @@ program jedi_lfric_tests modeldb%mpi => global_mpi call modeldb%configuration%initialise( application_name, table_len=10 ) + call modeldb%config%initialise( application_name ) call modeldb%values%initialise('values', 5) @@ -64,8 +66,13 @@ program jedi_lfric_tests call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), application_name ) + + call check_config_api( modeldb%configuration, modeldb%config ) + call init_timers( application_name ) call init_collections() call init_time( modeldb ) diff --git a/applications/jedi_lfric_tests/source/jedi_tlm_forecast_tl.f90 b/applications/jedi_lfric_tests/source/jedi_tlm_forecast_tl.f90 index b3c2aa004..728b3e04f 100644 --- a/applications/jedi_lfric_tests/source/jedi_tlm_forecast_tl.f90 +++ b/applications/jedi_lfric_tests/source/jedi_tlm_forecast_tl.f90 @@ -22,6 +22,7 @@ program jedi_tlm_forecast_tl use cli_mod, only : parse_command_line + use config_mod, only : config_type use constants_mod, only : PRECISION_REAL, i_def, str_def use field_collection_mod, only : field_collection_type use log_mod, only : log_event, log_scratch_space, & @@ -53,6 +54,8 @@ program jedi_tlm_forecast_tl ! Local type( namelist_collection_type ), pointer :: configuration + type( config_type ), pointer :: config + character(:), allocatable :: filename integer( kind=i_def ) :: model_communicator type( jedi_duration_type ) :: forecast_length @@ -81,6 +84,7 @@ program jedi_tlm_forecast_tl ! Get the configuration configuration => jedi_run%get_configuration() + config => jedi_run%get_config() ! Get the forecast length jedi_lfric_settings_config => configuration%get_namelist('jedi_lfric_settings') @@ -88,7 +92,7 @@ program jedi_tlm_forecast_tl call forecast_length%init(forecast_length_str) ! Create geometry - call jedi_geometry%initialise( model_communicator, configuration ) + call jedi_geometry%initialise( model_communicator, configuration, config ) ! Create state call jedi_state%initialise( jedi_geometry, configuration ) diff --git a/applications/jedi_lfric_tests/source/jedi_tlm_tests.f90 b/applications/jedi_lfric_tests/source/jedi_tlm_tests.f90 index da7f0342b..bfff68a72 100644 --- a/applications/jedi_lfric_tests/source/jedi_tlm_tests.f90 +++ b/applications/jedi_lfric_tests/source/jedi_tlm_tests.f90 @@ -35,6 +35,7 @@ program jedi_tlm_tests use cli_mod, only : parse_command_line + use config_mod, only : config_type use constants_mod, only : PRECISION_REAL, i_def, str_def, r_def use field_collection_mod, only : field_collection_type use log_mod, only : log_event, log_scratch_space, & @@ -67,6 +68,7 @@ program jedi_tlm_tests ! Local type( namelist_collection_type ), pointer :: configuration + type( config_type ), pointer :: config character(:), allocatable :: filename integer( kind=i_def ) :: model_communicator type( jedi_duration_type ) :: forecast_length @@ -101,6 +103,7 @@ program jedi_tlm_tests ! Get the configuration configuration => run%get_configuration() + config => run%get_config() ! Get the forecast length jedi_lfric_settings_config => configuration%get_namelist('jedi_lfric_settings') @@ -108,7 +111,7 @@ program jedi_tlm_tests call forecast_length%init(forecast_length_str) ! Create geometry - call geometry%initialise( model_communicator, configuration ) + call geometry%initialise( model_communicator, configuration, config ) ! Create state call state%initialise( geometry, configuration ) diff --git a/applications/jules/source/jules.f90 b/applications/jules/source/jules.f90 index 5b2ca853a..e772b358d 100644 --- a/applications/jules/source/jules.f90 +++ b/applications/jules/source/jules.f90 @@ -16,6 +16,7 @@ program jules + use check_config_api_mod, only: check_config_api use cli_mod, only: parse_command_line use driver_collections_mod, only: init_collections, final_collections use driver_comm_mod, only: init_comm, final_comm @@ -44,6 +45,7 @@ program jules call modeldb%configuration%initialise( application_name, & table_len=10 ) + call modeldb%config%initialise( application_name ) call modeldb%values%initialise( 'values', 5 ) ! Create the depository, prognostics and diagnostics field collections @@ -66,8 +68,13 @@ program jules call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), application_name ) + + call check_config_api( modeldb%configuration, modeldb%config ) + call init_timers( application_name ) call init_collections() call init_time( modeldb ) diff --git a/applications/lfric2lfric/source/initialisation/lfric2lfric_infrastructure_mod.X90 b/applications/lfric2lfric/source/initialisation/lfric2lfric_infrastructure_mod.X90 index 108104c11..70f23cb84 100644 --- a/applications/lfric2lfric/source/initialisation/lfric2lfric_infrastructure_mod.X90 +++ b/applications/lfric2lfric/source/initialisation/lfric2lfric_infrastructure_mod.X90 @@ -316,7 +316,7 @@ contains ! Create the required meshes !----------------------------------------------------------------------- stencil_depth = get_required_stencil_depth() - call init_mesh( modeldb%configuration, & + call init_mesh( modeldb%config, modeldb%configuration, & modeldb%mpi%get_comm_rank(), & modeldb%mpi%get_comm_size(), & mesh_names, extrusion, & diff --git a/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 b/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 index f1134fce5..b2b544282 100644 --- a/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 +++ b/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 @@ -25,6 +25,7 @@ module lfric2lfric_init_mesh_mod use add_mesh_map_mod, only: assign_mesh_maps + use config_mod, only: config_type use constants_mod, only: i_def, l_def, str_max_filename use check_local_mesh_mod, only: check_local_mesh use create_mesh_mod, only: create_mesh @@ -81,17 +82,21 @@ module lfric2lfric_init_mesh_mod !> regridding method is 'map'. !> (unpartitioned mesh input only) !=============================================================================== -subroutine init_mesh( configuration, & +subroutine init_mesh( config, configuration, & local_rank, total_ranks, & mesh_names, & extrusion, & stencil_depth, & regrid_method ) + use partitioning_nml_iterator_mod, only: partitioning_nml_iterator_type + use partitioning_nml_mod, only: partitioning_nml_type + implicit none ! Arguments - type(namelist_collection_type) :: configuration + type(namelist_collection_type), intent(in) :: configuration + type(config_type), intent(in) :: config integer(kind=i_def), intent(in) :: local_rank integer(kind=i_def), intent(in) :: total_ranks @@ -108,8 +113,10 @@ subroutine init_mesh( configuration, & ! 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(partitioning_nml_type), pointer :: partitioning + type(partitioning_nml_type), pointer :: src_partitioning_nml + type(partitioning_nml_type), pointer :: dst_partitioning_nml ! partitioning namelist variables logical(l_def) :: generate_inner_halos(2) @@ -131,23 +138,28 @@ subroutine init_mesh( configuration, & class(panel_decomposition_type), allocatable :: decomposition_src, & decomposition_dst + type(partitioning_nml_iterator_type) :: iter !============================================================================ ! Extract and check configuration variables !============================================================================ - ! Read partitioning namelist for source and destination meshes - src_partitioning_nml => configuration%get_namelist('partitioning', & - 'source') - call src_partitioning_nml%get_value( 'generate_inner_halos', & - generate_inner_halos(src) ) + call iter%initialise(config%partitioning) + do while (iter%has_next()) + + partitioning => iter%next() + + if (trim(partitioning%get_profile_name()) == 'source') then + src_partitioning_nml => partitioning + else if (trim(partitioning%get_profile_name()) == 'destination') then + dst_partitioning_nml => partitioning + end if + end do - dst_partitioning_nml => configuration%get_namelist('partitioning', & - 'destination') - call dst_partitioning_nml%get_value( 'generate_inner_halos', & - generate_inner_halos(dst) ) + generate_inner_halos(src) = src_partitioning_nml%generate_inner_halos() + generate_inner_halos(dst) = dst_partitioning_nml%generate_inner_halos() ! Read lfric2lfric namelist - lfric2lfric_nml => configuration%get_namelist('lfric2lfric') + lfric2lfric_nml => configuration%get_namelist('lfric2lfric') call lfric2lfric_nml%get_value( 'prepartitioned_meshes', & prepartitioned ) @@ -231,7 +243,7 @@ subroutine init_mesh( configuration, & ! meshes are suitable for the supplied application ! configuration. !=========================================================== - call check_local_mesh( configuration, & + call check_local_mesh( config, & stencil_depth, & mesh_names ) diff --git a/applications/lfric2lfric/source/lfric2lfric.F90 b/applications/lfric2lfric/source/lfric2lfric.F90 index c40c5cc3d..8d119094c 100644 --- a/applications/lfric2lfric/source/lfric2lfric.F90 +++ b/applications/lfric2lfric/source/lfric2lfric.F90 @@ -15,6 +15,7 @@ program lfric2lfric use cli_mod, only: parse_command_line + use check_config_api_mod, only: check_config_api use constants_mod, only: precision_real use driver_collections_mod, only: init_collections, final_collections use driver_config_mod, only: init_config, final_config @@ -49,6 +50,7 @@ program lfric2lfric call parse_command_line( filename ) call modeldb%configuration%initialise( program_name, table_len=10 ) + call modeldb%config%initialise( program_name ) write(log_scratch_space,'(A)') & 'Application built with '// trim(precision_real) // & @@ -68,8 +70,11 @@ program lfric2lfric #endif call init_comm( program_name, modeldb ) call init_config( filename, lfric2lfric_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), program_name ) + call check_config_api( modeldb%configuration, modeldb%config ) call init_collections() call init_time( modeldb ) deallocate( filename ) diff --git a/applications/lfric_atm/source/lfric_atm.f90 b/applications/lfric_atm/source/lfric_atm.f90 index 8f314f64d..e20bb167f 100644 --- a/applications/lfric_atm/source/lfric_atm.f90 +++ b/applications/lfric_atm/source/lfric_atm.f90 @@ -16,6 +16,7 @@ program lfric_atm + use check_config_api_mod, only: check_config_api use cli_mod, only: parse_command_line use driver_collections_mod, only: init_collections, final_collections use driver_comm_mod, only: init_comm, final_comm @@ -49,6 +50,7 @@ program lfric_atm call modeldb%configuration%initialise( application_name, & table_len=10 ) + call modeldb%config%initialise( application_name ) call modeldb%values%initialise( 'values', 5 ) ! Create the depository, prognostics and diagnostics field collections @@ -72,8 +74,10 @@ program lfric_atm call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) call init_logger( modeldb%mpi%get_comm(), application_name ) + call check_config_api( modeldb%configuration, modeldb%config ) call init_timers( application_name ) io_nml => modeldb%configuration%get_namelist('io') diff --git a/applications/lfric_coupled/source/lfric_coupled.f90 b/applications/lfric_coupled/source/lfric_coupled.f90 index 16b5d7375..5b050a8db 100644 --- a/applications/lfric_coupled/source/lfric_coupled.f90 +++ b/applications/lfric_coupled/source/lfric_coupled.f90 @@ -16,6 +16,7 @@ program lfric_coupled + use check_config_api_mod, only : check_config_api use cli_mod, only : parse_command_line use coupler_mod, only : set_cpl_name use driver_collections_mod, only : init_collections, final_collections @@ -43,7 +44,7 @@ program lfric_coupled modeldb%mpi => global_mpi call modeldb%configuration%initialise( application_name, table_len=10 ) - + call modeldb%config%initialise( application_name ) call modeldb%values%initialise( 'values', 5 ) ! Create the depository, prognostics and diagnostics field collections @@ -67,8 +68,11 @@ program lfric_coupled call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), application_name ) + call check_config_api( modeldb%configuration, modeldb%config ) call init_collections() call init_time( modeldb ) deallocate(filename) diff --git a/applications/lfricinputs/source/common/lfricinp_lfric_driver_mod.f90 b/applications/lfricinputs/source/common/lfricinp_lfric_driver_mod.f90 index a0630d7bf..24bd883a6 100644 --- a/applications/lfricinputs/source/common/lfricinp_lfric_driver_mod.f90 +++ b/applications/lfricinputs/source/common/lfricinp_lfric_driver_mod.f90 @@ -5,6 +5,7 @@ ! *****************************COPYRIGHT******************************* module lfricinp_lfric_driver_mod +use check_config_api_mod, only: check_config_api use constants_mod, only: i_def, r_def, l_def, r_second, str_def use log_mod, only: log_event, log_scratch_space, & LOG_LEVEL_INFO, LOG_LEVEL_ERROR, & @@ -12,6 +13,7 @@ module lfricinp_lfric_driver_mod ! LFRic Modules use add_mesh_map_mod, only: assign_mesh_maps +use config_mod, only: config_type use create_mesh_mod, only: create_mesh use driver_collections_mod, only: init_collections, final_collections use driver_mesh_mod, only: init_mesh @@ -117,6 +119,7 @@ subroutine lfricinp_initialise_lfric(program_name_arg, & type(namelist_collection_type), save :: configuration +type(config_type), save :: config type(namelist_type), pointer :: base_mesh_nml type(namelist_type), pointer :: planet_nml @@ -164,12 +167,17 @@ subroutine lfricinp_initialise_lfric(program_name_arg, & call initialise_halo_comms( comm ) call configuration%initialise( program_name_arg, table_len=10 ) +call config%initialise( program_name_arg ) + call load_configuration( lfric_nl_fname, required_lfric_namelists, & - configuration ) + configuration=configuration, & + config=config ) ! Initialise logging system call init_logger( comm, program_name ) +call check_config_api( configuration, config ) + call init_collections() write(log_scratch_space, '(2(A,I0))') 'total ranks = ', total_ranks, & @@ -234,7 +242,8 @@ subroutine lfricinp_initialise_lfric(program_name_arg, & !------------------------------------------------------------------------- stencil_depth = 2_i_def check_partitions = .false. -call init_mesh( configuration, & + +call init_mesh( config, & local_rank, total_ranks, & base_mesh_names, extrusion, & stencil_depth, check_partitions ) @@ -279,7 +288,7 @@ end subroutine lfricinp_initialise_lfric !------------------------------------------------------------------ subroutine load_configuration( lfric_nl, required_lfric_namelists, & - configuration ) + configuration, config ) ! Description: ! Reads lfric namelists and checks that all required namelists are present @@ -293,6 +302,7 @@ subroutine load_configuration( lfric_nl, required_lfric_namelists, & character(*), intent(in) :: required_lfric_namelists(:) type(namelist_collection_type), intent(INOUT) :: configuration +type(config_type), intent(INOUT) :: config logical :: okay logical, allocatable :: success_map(:) @@ -303,7 +313,9 @@ subroutine load_configuration( lfric_nl, required_lfric_namelists, & call log_event('Loading '//trim(program_name)//' configuration ...', & LOG_LEVEL_ALWAYS) -call read_configuration( lfric_nl, configuration ) +call read_configuration( lfric_nl, & + configuration=configuration, & + config=config ) okay = ensure_configuration(required_lfric_namelists, success_map) if (.not. okay) then diff --git a/applications/linear_model/source/linear_model.f90 b/applications/linear_model/source/linear_model.f90 index e58099d46..780c3715d 100644 --- a/applications/linear_model/source/linear_model.f90 +++ b/applications/linear_model/source/linear_model.f90 @@ -42,7 +42,7 @@ program linear_model modeldb%mpi => global_mpi call modeldb%configuration%initialise( application_name, table_len=10 ) - + call modeldb%config%initialise( application_name ) call modeldb%values%initialise('values', 5) ! Create the depository, prognostics and diagnostics field collections @@ -63,8 +63,11 @@ program linear_model call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), application_name ) + call init_timers( application_name ) call init_collections() call init_time( modeldb ) diff --git a/applications/name_transport/source/driver/name_transport_driver_mod.f90 b/applications/name_transport/source/driver/name_transport_driver_mod.f90 index 94e8365c0..061dbc5e3 100644 --- a/applications/name_transport/source/driver/name_transport_driver_mod.f90 +++ b/applications/name_transport/source/driver/name_transport_driver_mod.f90 @@ -239,11 +239,11 @@ subroutine initialise_name_transport( program_name, modeldb ) stencil_depth = get_required_stencil_depth() 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, & + call init_mesh( modeldb%config, & + modeldb%mpi%get_comm_rank(), & + modeldb%mpi%get_comm_size(), & + base_mesh_names, & + extrusion, stencil_depth, & apply_partition_check ) call create_mesh( base_mesh_names, extrusion_2d, & diff --git a/applications/name_transport/source/name_transport.f90 b/applications/name_transport/source/name_transport.f90 index 7f8faab1d..4420440e7 100644 --- a/applications/name_transport/source/name_transport.f90 +++ b/applications/name_transport/source/name_transport.f90 @@ -9,6 +9,7 @@ program name_transport + use check_config_api_mod, only: check_config_api use cli_mod, only: parse_command_line use constants_mod, only: i_def, r_def use driver_collections_mod, only: init_collections, final_collections @@ -40,12 +41,18 @@ program name_transport call parse_command_line( filename ) call modeldb%configuration%initialise( program_name, table_len=10 ) + call modeldb%config%initialise( program_name ) + modeldb%mpi => global_mpi call init_comm( program_name, modeldb ) call init_config( filename, name_transport_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), program_name ) + call check_config_api( modeldb%configuration, modeldb%config ) + call log_event( 'Miniapp will run with default precision set as:', & log_level_info ) write(log_scratch_space, '(" r_def kind = ", I0)') kind(1.0_r_def) diff --git a/applications/ngarch/source/ngarch.f90 b/applications/ngarch/source/ngarch.f90 index 919eec564..68076a9a7 100644 --- a/applications/ngarch/source/ngarch.f90 +++ b/applications/ngarch/source/ngarch.f90 @@ -8,6 +8,7 @@ !> @details Runs a GungHo model with a custom step method program ngarch + use check_config_api_mod, only : check_config_api use cli_mod, only : parse_command_line use driver_collections_mod, only : init_collections, final_collections use constants_mod, only : precision_real @@ -35,6 +36,8 @@ program ngarch call parse_command_line( filename ) call modeldb%configuration%initialise( application_name, table_len=10 ) + call modeldb%config%initialise( application_name ) + call modeldb%values%initialise( 'values', 5 ) ! Create the field collections in modeldb @@ -58,9 +61,12 @@ program ngarch modeldb%mpi => global_mpi call init_comm( application_name, modeldb ) - call init_config( filename, & - ngarch_required_namelists, & - modeldb%configuration ) + call init_config( filename, & + ngarch_required_namelists, & + configuration=modeldb%configuration, & + config=modeldb%config ) + call check_config_api( modeldb%configuration, modeldb%config ) + deallocate( filename ) call init_logger( modeldb%mpi%get_comm(), application_name ) diff --git a/applications/shallow_water/source/driver/shallow_water_model_mod.F90 b/applications/shallow_water/source/driver/shallow_water_model_mod.F90 index f2706ce97..40ac6cf93 100644 --- a/applications/shallow_water/source/driver/shallow_water_model_mod.F90 +++ b/applications/shallow_water/source/driver/shallow_water_model_mod.F90 @@ -181,7 +181,8 @@ subroutine initialise_infrastructure( program_name, modeldb) ! --------------------------------------------------------- check_partitions = .false. stencil_depth = get_required_stencil_depth() - call init_mesh( modeldb%configuration, & + + call init_mesh( modeldb%config, & modeldb%mpi%get_comm_rank(), & modeldb%mpi%get_comm_size(), & base_mesh_names, extrusion, & diff --git a/applications/shallow_water/source/shallow_water.f90 b/applications/shallow_water/source/shallow_water.f90 index c74a664b5..b164c1b48 100644 --- a/applications/shallow_water/source/shallow_water.f90 +++ b/applications/shallow_water/source/shallow_water.f90 @@ -14,6 +14,7 @@ program shallow_water + use check_config_api_mod, only: check_config_api use cli_mod, only: parse_command_line use driver_collections_mod, only: init_collections, final_collections use driver_comm_mod, only: init_comm, final_comm @@ -45,6 +46,7 @@ program shallow_water modeldb%mpi => global_mpi call modeldb%configuration%initialise( program_name, table_len=10 ) + call modeldb%config%initialise( program_name ) ! Create the depository and prognostics field collections call modeldb%fields%add_empty_field_collection("depository", & @@ -59,8 +61,12 @@ program shallow_water call init_comm( program_name, modeldb ) call init_config( filename, shallow_water_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) call init_logger( global_mpi%get_comm(), program_name ) + + call check_config_api( modeldb%configuration, modeldb%config ) + call init_timers( program_name ) call init_counters( program_name ) call init_collections() diff --git a/applications/solver/source/solver.F90 b/applications/solver/source/solver.F90 index 9c06cb220..65d816094 100644 --- a/applications/solver/source/solver.F90 +++ b/applications/solver/source/solver.F90 @@ -12,6 +12,7 @@ program solver use add_mesh_map_mod, only: assign_mesh_maps + use config_mod, only: config_type use constants_mod, only: i_def, r_def, PRECISION_REAL, str_def use convert_to_upper_mod, only: convert_to_upper use cli_mod, only: parse_command_line @@ -47,7 +48,6 @@ program solver use namelist_mod, only: namelist_type use sci_checksum_alg_mod, only: checksum_alg - !------------------------------------ ! Configuration modules !------------------------------------ @@ -60,6 +60,7 @@ program solver character(:), allocatable :: filename type(namelist_collection_type), SAVE :: configuration + type(config_type), SAVE :: config integer(i_def) :: total_ranks, local_rank type(lfric_comm_type) :: comm @@ -117,9 +118,13 @@ program solver local_rank = global_mpi%get_comm_rank() call configuration%initialise( program_name, table_len=10 ) + call config%initialise( program_name ) + call init_config( filename, solver_required_namelists, & - configuration ) + configuration=configuration, & + config=config ) call init_logger( comm, program_name ) + call init_collections() deallocate( filename ) @@ -185,7 +190,7 @@ program solver !----------------------------------------------------------------------- stencil_depth = 1 check_partitions = .false. - call init_mesh( configuration, & + call init_mesh( config, & local_rank, total_ranks, & base_mesh_names, extrusion, & stencil_depth, check_partitions ) diff --git a/applications/transport/source/driver/transport_driver_mod.f90 b/applications/transport/source/driver/transport_driver_mod.f90 index 2f9d4361d..666c0f1c1 100644 --- a/applications/transport/source/driver/transport_driver_mod.f90 +++ b/applications/transport/source/driver/transport_driver_mod.f90 @@ -290,7 +290,7 @@ subroutine initialise_transport( program_name, modeldb ) apply_partition_check = .true. end if - call init_mesh( modeldb%configuration, & + call init_mesh( modeldb%config, & modeldb%mpi%get_comm_rank(), & modeldb%mpi%get_comm_size(), & base_mesh_names, & diff --git a/applications/transport/source/transport.f90 b/applications/transport/source/transport.f90 index a4ea8347a..b027424ee 100644 --- a/applications/transport/source/transport.f90 +++ b/applications/transport/source/transport.f90 @@ -8,6 +8,7 @@ !> run_transport() and finalise_transport(). program transport + use check_config_api_mod, only: check_config_api use cli_mod, only: parse_command_line use constants_mod, only: i_def, r_def use driver_collections_mod, only: init_collections, final_collections @@ -36,13 +37,20 @@ program transport call parse_command_line( filename ) - call modeldb%configuration%initialise( program_name, table_len=10 ) modeldb%mpi => global_mpi + call init_comm( program_name, modeldb ) + + call modeldb%configuration%initialise( program_name, table_len=10 ) + call modeldb%config%initialise( program_name ) + call init_config( filename, transport_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) call init_logger( modeldb%mpi%get_comm(), program_name ) + call check_config_api( modeldb%configuration, modeldb%config ) + call log_event( 'Miniapp will run with default precision set as:', & log_level_trace ) write(log_scratch_space, '(" r_def kind = ", I0)') kind(1.0_r_def) diff --git a/dependencies.yaml b/dependencies.yaml index 473a2c6ee..e6df37946 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: 5d4d72f0e35f00e71b1757df6beadec21ece97f0 + source: cazld000020:/data/users/ricky.wong/GitHub/lfric_core + ref: IntermediateApiPurge moci: source: git@github.com:MetOffice/moci.git diff --git a/interfaces/jedi_lfric_interface/integration-test/time/jedi_lfric_time_test.f90 b/interfaces/jedi_lfric_interface/integration-test/time/jedi_lfric_time_test.f90 index 3f75a4c82..4e073568f 100644 --- a/interfaces/jedi_lfric_interface/integration-test/time/jedi_lfric_time_test.f90 +++ b/interfaces/jedi_lfric_interface/integration-test/time/jedi_lfric_time_test.f90 @@ -10,6 +10,8 @@ !! jedi_lfric_time_test.py. program jedi_lfric_time_test + use check_config_api_mod, only : check_config_api + use config_mod, only : config_type use configuration_mod, only : final_configuration, & read_configuration use constants_mod, only : i_def, r_def, l_def @@ -52,6 +54,7 @@ program jedi_lfric_time_test character(:), allocatable :: filename type(namelist_collection_type), save :: configuration + type(config_type), save :: config ! Variables used for parsing command line arguments integer(i_def) :: length, status, nargs @@ -172,7 +175,14 @@ program jedi_lfric_time_test ! Setup configuration, and initialise tests call configuration%initialise( program_name, table_len=10 ) - call read_configuration( filename, configuration ) + call config%initialise( program_name ) + + call read_configuration( filename, & + configuration=configuration, & + config=config ) + + call check_config_api( configuration, config ) + call test_jedi_interface_init() if ( do_test_init_string_err ) then diff --git a/interfaces/jedi_lfric_interface/source/driver/linear/jedi_lfric_linear_modeldb_driver_mod.f90 b/interfaces/jedi_lfric_interface/source/driver/linear/jedi_lfric_linear_modeldb_driver_mod.f90 index c7d2bb148..0c1192351 100644 --- a/interfaces/jedi_lfric_interface/source/driver/linear/jedi_lfric_linear_modeldb_driver_mod.f90 +++ b/interfaces/jedi_lfric_interface/source/driver/linear/jedi_lfric_linear_modeldb_driver_mod.f90 @@ -43,6 +43,7 @@ module jedi_lfric_linear_modeldb_driver_mod adjoint_step, & finalise_adjoint_model use atl_si_timestep_alg_mod, only : atl_si_timestep_type + use check_config_api_mod, only : check_config_api use constants_mod, only : r_def, l_def, str_def use driver_config_mod, only : init_config use driver_time_mod, only : init_time, final_time @@ -119,6 +120,7 @@ subroutine initialise_modeldb( modeldb_name, filename, mpi_obj, modeldb, atl_si_ ! 1. Initialise modeldb field collections, configuration and mpi. modeldb%mpi => mpi_obj call modeldb%configuration%initialise( modeldb_name, table_len=10 ) + call modeldb%config%initialise( modeldb_name ) call modeldb%values%initialise('values', 5) @@ -139,7 +141,8 @@ subroutine initialise_modeldb( modeldb_name, filename, mpi_obj, modeldb, atl_si_ call modeldb%io_contexts%initialise(modeldb_name, table_len=100) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) ! 2. Setup some model modeldb%values and initialise infrastructure call modeldb%values%add_key_value( 'temperature_correction_rate', 0.0_r_def ) @@ -149,6 +152,7 @@ subroutine initialise_modeldb( modeldb_name, filename, mpi_obj, modeldb, atl_si_ ! Initialise infrastructure call init_time( modeldb ) call initialise_infrastructure( io_context_name, modeldb ) + call check_config_api( modeldb%configuration, modeldb%config ) ! Add a place to store time axes in modeldb call modeldb%values%add_key_value('model_axes', model_axes) diff --git a/interfaces/jedi_lfric_interface/source/driver/nl/jedi_lfric_nl_modeldb_driver_mod.f90 b/interfaces/jedi_lfric_interface/source/driver/nl/jedi_lfric_nl_modeldb_driver_mod.f90 index 6d1405ba6..8272ed2dd 100644 --- a/interfaces/jedi_lfric_interface/source/driver/nl/jedi_lfric_nl_modeldb_driver_mod.f90 +++ b/interfaces/jedi_lfric_interface/source/driver/nl/jedi_lfric_nl_modeldb_driver_mod.f90 @@ -22,6 +22,7 @@ !> module jedi_lfric_nl_modeldb_driver_mod + use check_config_api_mod, only : check_config_api use constants_mod, only : l_def use driver_config_mod, only : init_config use driver_time_mod, only : init_time, final_time @@ -67,6 +68,7 @@ subroutine initialise_modeldb( modeldb_name, filename, mpi_obj, modeldb ) ! 1. Initialise modeldb field collections, configuration and mpi. modeldb%mpi => mpi_obj call modeldb%configuration%initialise( modeldb_name, table_len=10 ) + call modeldb%config%initialise( modeldb_name ) call modeldb%values%initialise('values', table_len = 5) @@ -89,7 +91,8 @@ subroutine initialise_modeldb( modeldb_name, filename, mpi_obj, modeldb ) call modeldb%io_contexts%initialise(modeldb_name, table_len=100) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + configuration=modeldb%configuration, & + config=modeldb%config ) ! 3. Initialise the clock and calendar call init_time( modeldb ) @@ -97,6 +100,8 @@ subroutine initialise_modeldb( modeldb_name, filename, mpi_obj, modeldb ) ! 4. Call the gungho driver initialise call gh_initialise(modeldb_name, modeldb) + call check_config_api( modeldb%configuration, modeldb%config ) + end subroutine initialise_modeldb !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/interfaces/jedi_lfric_interface/source/mesh/jedi_lfric_mesh_setup_mod.F90 b/interfaces/jedi_lfric_interface/source/mesh/jedi_lfric_mesh_setup_mod.F90 index 24665d5b9..6857363e6 100644 --- a/interfaces/jedi_lfric_interface/source/mesh/jedi_lfric_mesh_setup_mod.F90 +++ b/interfaces/jedi_lfric_interface/source/mesh/jedi_lfric_mesh_setup_mod.F90 @@ -10,6 +10,7 @@ module jedi_lfric_mesh_setup_mod use add_mesh_map_mod, only: assign_mesh_maps use base_mesh_config_mod, only: GEOMETRY_SPHERICAL, & GEOMETRY_PLANAR + use config_mod, only: config_type use constants_mod, only: str_def, i_def, l_def, r_def use create_mesh_mod, only: create_mesh use driver_mesh_mod, only: init_mesh @@ -36,14 +37,16 @@ module jedi_lfric_mesh_setup_mod !> !> @param [out] mesh_name The name of the mesh being setup !> @param [in] configuration The geometry configuration + !> @param [in] config The geometry configuration !> @param [inout] mpi_obj The mpi communicator !> @param [in] alt_mesh_name The name of an alternative mesh_name to setup - subroutine initialise_mesh( mesh_name, configuration, mpi_obj, alt_mesh_name ) + subroutine initialise_mesh( mesh_name, configuration, config, mpi_obj, alt_mesh_name ) implicit none character(len=*), intent(out) :: mesh_name type(namelist_collection_type), intent(in) :: configuration + type(config_type), intent(in) :: config !> @todo: This should be intent in but when calling the method I get !> a compiler failure class(lfric_mpi_type), intent(inout) :: mpi_obj @@ -124,7 +127,7 @@ subroutine initialise_mesh( mesh_name, configuration, mpi_obj, alt_mesh_name ) !------------------------------------------------------------------------- stencil_depth = 2 apply_partition_check = .false. - call init_mesh( configuration, & + call init_mesh( config, & mpi_obj%get_comm_rank(), & mpi_obj%get_comm_size(), & base_mesh_names, & diff --git a/science/gungho/integration-test/cma_test/cma_test.f90 b/science/gungho/integration-test/cma_test/cma_test.f90 index 2797865da..743fca508 100644 --- a/science/gungho/integration-test/cma_test/cma_test.f90 +++ b/science/gungho/integration-test/cma_test/cma_test.f90 @@ -29,6 +29,7 @@ program cma_test test_cma_add, & test_cma_apply_inv, & test_cma_diag_DhMDhT + use config_mod, only : config_type use constants_mod, only : i_def, r_def, i_def, l_def, & r_solver, pi, str_def use derived_config_mod, only : set_derived_config @@ -65,6 +66,8 @@ program cma_test use sci_chi_transform_mod, only : init_chi_transforms, & final_chi_transforms + use check_config_api_mod, only: check_config_api + implicit none ! MPI communicator @@ -125,6 +128,7 @@ program cma_test ! Namelist and configuration variables type(namelist_collection_type), save :: configuration + type(config_type), save :: config type(namelist_type), pointer :: extrusion_nml type(namelist_type), pointer :: base_mesh_nml @@ -232,6 +236,9 @@ program cma_test end select call configuration%initialise( program_name, table_len=10 ) + call config%initialise( program_name ) + + call check_config_api( configuration, config ) deallocate(program_name) deallocate(test_flag) @@ -243,7 +250,9 @@ program cma_test call log_event( log_scratch_space, LOG_LEVEL_INFO ) allocate( success_map(size(required_configuration)) ) - call read_configuration( filename, configuration ) + call read_configuration( filename, & + configuration=configuration, & + config=config ) okay = ensure_configuration( required_configuration, success_map ) if (.not. okay) then @@ -291,7 +300,8 @@ program cma_test stencil_depth = get_required_stencil_depth() check_partitions = .false. - call init_mesh( configuration, & + + call init_mesh( config, & local_rank, total_ranks, & base_mesh_names, extrusion, & stencil_depth, check_partitions ) diff --git a/science/gungho/source/driver/gungho_model_mod.F90 b/science/gungho/source/driver/gungho_model_mod.F90 index e91f0fbd6..ee30f64fd 100644 --- a/science/gungho/source/driver/gungho_model_mod.F90 +++ b/science/gungho/source/driver/gungho_model_mod.F90 @@ -673,7 +673,8 @@ subroutine initialise_infrastructure( io_context_name, modeldb ) end if stencil_depth = get_required_stencil_depth() - call init_mesh( modeldb%configuration, & + + call init_mesh( modeldb%config, & modeldb%mpi%get_comm_rank(), & modeldb%mpi%get_comm_size(), & base_mesh_names, & diff --git a/science/linear/integration-test/runge_kutta/runge_kutta.f90 b/science/linear/integration-test/runge_kutta/runge_kutta.f90 index f460201ac..ac4fae76d 100644 --- a/science/linear/integration-test/runge_kutta/runge_kutta.f90 +++ b/science/linear/integration-test/runge_kutta/runge_kutta.f90 @@ -146,7 +146,12 @@ program runge_kutta end select call modeldb%configuration%initialise( program_name, table_len=10 ) - call read_configuration( filename, modeldb%configuration ) + call modeldb%config%initialise( program_name ) + + call read_configuration( filename, & + configuration=modeldb%configuration, & + config=modeldb%config ) + deallocate( filename ) call init_collections() diff --git a/science/linear/integration-test/semi_implicit/semi_implicit.f90 b/science/linear/integration-test/semi_implicit/semi_implicit.f90 index af625729c..572475e7f 100644 --- a/science/linear/integration-test/semi_implicit/semi_implicit.f90 +++ b/science/linear/integration-test/semi_implicit/semi_implicit.f90 @@ -133,7 +133,12 @@ program semi_implicit end select call modeldb%configuration%initialise( program_name, table_len=10 ) - call read_configuration( filename, modeldb%configuration ) + call modeldb%config%initialise( program_name) + + call read_configuration( filename, & + configuration=modeldb%configuration, & + config=modeldb%config ) + deallocate( filename ) call init_collections() diff --git a/science/shared/source/utils/check_config_api_mod.f90 b/science/shared/source/utils/check_config_api_mod.f90 new file mode 100644 index 000000000..ea0c61ce3 --- /dev/null +++ b/science/shared/source/utils/check_config_api_mod.f90 @@ -0,0 +1,393 @@ +! ADD Licence????? +!================================================================ +! Temporary code to check new and old confiuration objects return +! the same configuration values. This is to manage the transition +! of the codebase from using a namelist_collection_type to a +! config_type +!================================================================ +module check_config_api_mod + + use constants_mod, only: l_def, i_def, r_def, & + str_def, str_max_filename, & + r_second, i_medium + use config_mod, only: config_type + use log_mod, only: log_event, log_level_warning, & + log_level_info + use namelist_collection_mod, only: namelist_collection_type + use namelist_mod, only: namelist_type + + implicit none + + private + public :: check_config_api + +contains + +subroutine check_config_api( configuration, config ) + + implicit none + + type(namelist_collection_type), intent(in) :: configuration + type(config_type), intent(in) :: config + + type(namelist_type), pointer :: aerosol_nml + type(namelist_type), pointer :: base_mesh_nml + type(namelist_type), pointer :: extrusion_nml + type(namelist_type), pointer :: files_nml + + type(namelist_type), pointer :: planet_nml + type(namelist_type), pointer :: io_nml + type(namelist_type), pointer :: timestepping_nml + type(namelist_type), pointer :: time_nml + type(namelist_type), pointer :: mixed_solver_nml + type(namelist_type), pointer :: microphysics_nml + type(namelist_type), pointer :: multires_coupling_nml + type(namelist_type), pointer :: multigrid_nml + type(namelist_type), pointer :: formulation_nml + type(namelist_type), pointer :: initialization_nml + type(namelist_type), pointer :: boundaries_nml + type(namelist_type), pointer :: finite_element_nml + +! initial_temperature, bvf_square r_def +! gravity_wave_constants b_space i_def + character(str_max_filename) :: start_dump_filename + character(str_max_filename) :: checkpoint_stem_name +! lfric2lfric regrid_method i_def + character(str_def) :: prime_mesh_name + character(str_def) :: aerosol_mesh_name + character(str_def) :: orography_mesh_name + character(str_def) :: time_origin + character(str_def) :: time_start + character(str_max_filename) :: file_prefix + + logical(l_def) :: prepartitioned + integer(i_def) :: geometry + integer(i_def) :: moisture_formulation + integer(i_def) :: lbc_option + integer(i_def) :: ls_option + integer(i_def) :: init_option + integer(i_def) :: lbc_eos_height + integer(i_def) :: model_eos_height + + real(r_def) :: tau_r + real(r_def) :: atol + real(r_def) :: domain_height + real(r_def) :: planet_radius + real(r_def) :: scaled_radius + real(r_second) :: dt + integer(i_def) :: method + integer(i_def) :: nlayers + integer(i_def) :: element_order_h + integer(i_def) :: element_order_v + integer(i_medium) :: diag_freq + logical(l_def) :: nodal + logical(l_def) :: write_diag + logical(l_def) :: use_xios_io + logical(l_def) :: l_multigrid + logical(l_def) :: use_multires_coupling + logical(l_def) :: subroutine_timers + logical(l_def) :: ozone_ancil + logical(l_def) :: aero_ancil + logical(l_def) :: murk_lbc + logical(l_def) :: microphysics_casim + logical(l_def) :: read_w2h_wind + +! character(str_def), allocatable :: chain_mesh_tags(:) +! character(str_def), allocatable :: multires_coupling_mesh_tags(:) + + character(*), parameter :: message = 'Difference in config objects ' + + call log_event('Validating Config/Configuration object data.', & + log_level_info) + + if (configuration%namelist_exists('base_mesh')) then + base_mesh_nml => configuration%get_namelist('base_mesh') + + call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) + call base_mesh_nml%get_value( 'file_prefix', file_prefix ) + call base_mesh_nml%get_value( 'geometry', geometry ) + call base_mesh_nml%get_value( 'prepartitioned', prepartitioned ) + + if (prime_mesh_name /= config%base_mesh%prime_mesh_name()) then + call log_event(message//'prime_mesh_name', log_level_warning) + end if + + if (file_prefix /= config%base_mesh%file_prefix()) then + call log_event(message//'file_prefix', log_level_warning) + end if + + if (geometry /= config%base_mesh%geometry()) then + call log_event(message//'geometry', log_level_warning) + end if + + if (prepartitioned .neqv. config%base_mesh%prepartitioned()) then + call log_event(message//'prepartitioned', log_level_warning) + end if + end if + + if (configuration%namelist_exists('extrusion')) then + extrusion_nml => configuration%get_namelist('extrusion') + + call extrusion_nml%get_value( 'method', method ) + call extrusion_nml%get_value( 'planet_radius', planet_radius ) + call extrusion_nml%get_value( 'domain_height', domain_height ) + call extrusion_nml%get_value( 'number_of_layers', nlayers ) + + if (method /= config%extrusion%method()) then + call log_event(message//'method', log_level_warning) + end if + + if (planet_radius /= config%extrusion%planet_radius()) then + call log_event(message//'planet_radius', log_level_warning) + end if + + if (domain_height /= config%extrusion%domain_height()) then + call log_event(message//'domain_height', log_level_warning) + end if + + if (nlayers /= config%extrusion%number_of_layers()) then + call log_event(message//'number_of_layers', log_level_warning) + end if + end if + + if (configuration%namelist_exists('io')) then + io_nml => configuration%get_namelist('io') + + call io_nml%get_value( 'nodal_output_on_w3', nodal ) + call io_nml%get_value( 'write_diag', write_diag ) + call io_nml%get_value( 'use_xios_io', use_xios_io ) + call io_nml%get_value( 'subroutine_timers', subroutine_timers ) + call io_nml%get_value( 'diagnostic_frequency', diag_freq ) + + if (diag_freq /= config%io%diagnostic_frequency()) then + call log_event(message//'diagnostic_frequency', log_level_warning) + end if + + if (nodal .neqv. config%io%nodal_output_on_w3()) then + call log_event(message//'nodal_output_on_w3', log_level_warning) + end if + + if (write_diag .neqv. config%io%write_diag()) then + call log_event(message//'write_diag', log_level_warning) + end if + + if (use_xios_io .neqv. config%io%use_xios_io()) then + call log_event(message//'use_xios_io', log_level_warning) + end if + + if (subroutine_timers .neqv. config%io%subroutine_timers()) then + call log_event(message//'subroutine_timers', log_level_warning) + end if + end if + + if (configuration%namelist_exists('finite_element')) then + finite_element_nml => configuration%get_namelist('finite_element') + + call finite_element_nml%get_value('element_order_h', element_order_h) + call finite_element_nml%get_value('element_order_v', element_order_v) + + if (element_order_h /= config%finite_element%element_order_h()) then + call log_event( message//'element_order_h', log_level_warning ) + end if + + if (element_order_v /= config%finite_element%element_order_v()) then + call log_event( message//'element_order_v', log_level_warning ) + end if + end if + + if (configuration%namelist_exists('formulation')) then + formulation_nml => configuration%get_namelist('formulation') + + call formulation_nml%get_value('l_multigrid', l_multigrid) + call formulation_nml%get_value('moisture_formulation', moisture_formulation) + call formulation_nml%get_value('use_multires_coupling', use_multires_coupling) + + if (moisture_formulation /= config%formulation%moisture_formulation()) then + call log_event( message//'moisture_formulation', log_level_warning ) + end if + + if (l_multigrid .neqv. config%formulation%l_multigrid()) then + call log_event( message//'l_multigrid', log_level_warning ) + end if + + if (use_multires_coupling .neqv. config%formulation%use_multires_coupling()) then + call log_event( message//'use_multires_coupling', log_level_warning ) + end if + end if + + if (configuration%namelist_exists('planet')) then + planet_nml => configuration%get_namelist('planet') + + call planet_nml%get_value( 'scaled_radius', scaled_radius ) + + if (scaled_radius /= config%planet%scaled_radius()) then + call log_event( message//'scaled_radius', log_level_warning ) + end if + end if + + + if (configuration%namelist_exists('timestepping')) then + timestepping_nml => configuration%get_namelist('timestepping') + + call timestepping_nml%get_value( 'dt', dt ) + call timestepping_nml%get_value( 'tau_r', tau_r ) + + if (dt /= config%timestepping%dt()) then + call log_event( message//'dt', log_level_warning ) + end if + + if (tau_r /= config%timestepping%tau_r()) then + call log_event( message//'tau_r', log_level_warning ) + end if + + end if + + + if (configuration%namelist_exists('mixed_solver')) then + mixed_solver_nml => configuration%get_namelist('mixed_solver') + + call mixed_solver_nml%get_value('mixed_solver_a_tol', atol) + + if (atol /= config%mixed_solver%mixed_solver_a_tol()) then + call log_event( message//'mixed_solver_a_tol', log_level_warning ) + end if + end if + + + if (configuration%namelist_exists('initialization')) then + initialization_nml => configuration%get_namelist('initialization') + + call initialization_nml%get_value('ls_option', ls_option) + call initialization_nml%get_value('lbc_option', lbc_option) + call initialization_nml%get_value('coarse_aerosol_ancil', aero_ancil) + call initialization_nml%get_value('coarse_ozone_ancil', ozone_ancil) + call initialization_nml%get_value('init_option', init_option) + call initialization_nml%get_value('model_eos_height', model_eos_height) + call initialization_nml%get_value('read_w2h_wind', read_w2h_wind) + + if (ls_option /= config%initialization%ls_option()) then + call log_event( message//'ls_option', log_level_warning ) + end if + + if (lbc_option /= config%initialization%lbc_option()) then + call log_event( message//'lbc_option', log_level_warning ) + end if + + if (init_option /= config%initialization%init_option()) then + call log_event( message//'init_option', log_level_warning ) + end if + + if (aero_ancil .neqv. config%initialization%coarse_aerosol_ancil()) then + call log_event( message//'aerosol_ancil', log_level_warning ) + end if + + if (ozone_ancil .neqv. config%initialization%coarse_ozone_ancil()) then + call log_event( message//'ozone_ancil', log_level_warning ) + end if + + if (model_eos_height /= config%initialization%model_eos_height()) then + call log_event( message//'model_eos_height', log_level_warning ) + end if + + if (read_w2h_wind .neqv. config%initialization%read_w2h_wind()) then + call log_event( message//'read_w2h_wind', log_level_warning ) + end if + + end if + + + if (configuration%namelist_exists('boundaries')) then + boundaries_nml => configuration%get_namelist('boundaries') + + call boundaries_nml%get_value('lbc_eos_height', lbc_eos_height) + + if (lbc_eos_height /= config%boundaries%lbc_eos_height()) then + call log_event( message//'lbc_eos_height', log_level_warning ) + end if + end if + + if (configuration%namelist_exists('multires_coupling')) then + multires_coupling_nml => configuration%get_namelist('multires_coupling') + + call multires_coupling_nml%get_value('aerosol_mesh_name', aerosol_mesh_name) + call multires_coupling_nml%get_value('orography_mesh_name', orography_mesh_name) +! call multires_coupling_nml%get_value('multires_coupling_mesh_tags', multires_coupling_mesh_tags) + + if (orography_mesh_name /= config%multires_coupling%orography_mesh_name()) then + call log_event( message//'orography_mesh_name', log_level_warning ) + end if + +!!$ if (multires_coupling_mesh_tags /= config%multires_coupling%multires_coupling_mesh_tags()) then +!!$ call log_event( message//'multires_coupling_mesh_tags', log_level_warning ) +!!$ end if + + if (aerosol_mesh_name /= config%multires_coupling%aerosol_mesh_name()) then + call log_event( message//'aerosol_mesh_name', log_level_warning ) + end if + end if + + if (configuration%namelist_exists('aerosol')) then + aerosol_nml => configuration%get_namelist('aerosol') + + call aerosol_nml%get_value('murk_lbc', murk_lbc) + + if (murk_lbc .neqv. config%aerosol%murk_lbc()) then + call log_event( message//'murk_lbc', log_level_warning ) + end if + end if + + if (configuration%namelist_exists('multigrid')) then + multigrid_nml => configuration%get_namelist('multigrid') + +!!$ call multigrid_nml%get_value('chain_mesh__tags', chain_mesh_tags) +!!$ chain_mesh_tags_2 = config%multigrid%chain_mesh_tags() +!!$ do i=1, size(chain_mesh_tags) +!!$ if (chain_mesh_tags /= config%multigrid%chain_mesh_tags()) then +!!$ call log_event( message//'chain_mesh_tags', log_level_warning ) +!!$ end if +!!$ end do + end if + + if (configuration%namelist_exists('microphysics')) then + microphysics_nml => configuration%get_namelist('microphysics') + + call microphysics_nml%get_value('microphysics_casim', microphysics_casim) + + if (microphysics_casim .neqv. config%microphysics%microphysics_casim()) then + call log_event( message//'microphysics_casim', log_level_warning ) + end if + end if + + if (configuration%namelist_exists('time')) then + time_nml => configuration%get_namelist('time') + + call time_nml%get_value('calendar_origin', time_origin) + call time_nml%get_value('calendar_start', time_start) + + if (time_origin /= config%time%calendar_origin()) then + call log_event( message//'calendar_origin', log_level_warning ) + end if + + if (time_start /= config%time%calendar_start()) then + call log_event( message//'calendar_start', log_level_warning ) + end if + end if + + if (configuration%namelist_exists('files')) then + files_nml => configuration%get_namelist('files') + + call files_nml%get_value('start_dump_filename', start_dump_filename) + call files_nml%get_value('checkpoint_stem_name', checkpoint_stem_name) + + if (start_dump_filename /= config%files%start_dump_filename()) then + call log_event( message//'start_dump_filename', log_level_warning ) + end if + + if (checkpoint_stem_name /= config%files%checkpoint_stem_name()) then + call log_event( message//'checkpoint_stem_name', log_level_warning ) + end if + end if + +end subroutine check_config_api + +end module check_config_api_mod From f146829b2faa992560b769de9863c15c8fc3c516 Mon Sep 17 00:00:00 2001 From: Ricky Wong <141156427+mo-rickywong@users.noreply.github.com> Date: Mon, 26 Jan 2026 12:22:23 +0000 Subject: [PATCH 06/12] Link this branch to the LFRic Core Branch --- dependencies.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies.yaml b/dependencies.yaml index 6bf41fd78..5b56a8aba 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -31,7 +31,7 @@ lfric_apps: lfric_core: source: git@github.com:MetOffice/lfric_core.git - ref: aa328242675491338ddb888d4d747b5e02d3754c + ref: FloatJacobian moci: source: git@github.com:MetOffice/moci.git From c763d41e56775cf7e4943914a93ecae0758ec6e8 Mon Sep 17 00:00:00 2001 From: Ricky Wong <141156427+mo-rickywong@users.noreply.github.com> Date: Mon, 26 Jan 2026 14:49:37 +0000 Subject: [PATCH 07/12] Add changes to argument lists --- .../initial_buoyancy_kernel_mod_test.pf | 2 +- .../kernel/set_name_field_kernel_mod.F90 | 8 ++++++- .../kernel/set_name_field_kernel_mod_test.pf | 2 +- .../initial_swe_streamfunc_kernel_mod.F90 | 15 ++++++++---- .../kernel/initial_swe_u_kernel_mod.F90 | 22 ++++++++++------- .../initial_vorticity_v2_kernel_mod.F90 | 14 +++++++---- .../kernel/initial_geopot_kernel_mod_test.pf | 2 +- .../initial_swe_buoyancy_kernel_mod_test.pf | 2 +- .../initial_swe_tracer_kernel_mod_test.pf | 2 +- .../kernel/initial_swe_u_kernel_mod_test.pf | 2 +- .../kernel/set_tracer_field_kernel_mod.F90 | 10 ++++++-- ...ial_tracer_field_sample_kernel_mod_test.pf | 2 +- .../set_tracer_field_kernel_mod_test.pf | 2 +- dependencies.yaml | 4 ++-- .../adj_sci_convert_hdiv_field_kernel_mod.F90 | 11 +++++++-- .../integration-test/cma_test/cma_test.f90 | 5 ++-- .../compute_coriolis_matrix_kernel_mod.F90 | 14 +++++++---- .../compute_dl_matrix_kernel_mod.F90 | 11 ++++++--- ...ompute_vert_coriolis_matrix_kernel_mod.F90 | 14 +++++++---- .../kinetic_energy_gradient_kernel_mod.F90 | 7 +++++- .../project_eos_pressure_kernel_mod.F90 | 7 +++++- .../project_eos_rho_kernel_mod.F90 | 10 ++++++-- .../rhs_project_eos_kernel_mod.F90 | 7 +++++- .../vorticity_rhs_kernel_mod.F90 | 7 +++++- .../compute_energetics_kernel_mod.f90 | 7 +++++- .../compute_entropy_kernel_mod.F90 | 7 +++++- .../compute_moist_mass_kernel_mod.F90 | 7 +++++- .../compute_total_aam_kernel_mod.F90 | 9 ++++++- .../compute_total_pv_kernel_mod.F90 | 11 +++++---- .../initial_streamfunc_kernel_mod.F90 | 15 ++++++++---- .../initialisation/initial_u_kernel_mod.F90 | 19 ++++++++++----- .../initialisation/set_exner_kernel_mod.F90 | 10 ++++++-- .../initialisation/set_rho_kernel_mod.F90 | 9 +++++-- .../eliminated_theta_q22_kernel_mod.F90 | 8 ++++++- .../project_eos_operators_kernel_mod.F90 | 8 ++++++- .../solver/w2_normalisation_kernel_mod.F90 | 24 ++++++++++++------- .../kernel/solver/weighted_m3_kernel_mod.F90 | 7 +++++- .../common/vorticity_advection_kernel_mod.F90 | 10 ++++++-- .../w2_vorticity_advection_kernel_mod.F90 | 7 +++++- ...compute_coriolis_matrix_kernel_mod_test.pf | 2 +- .../compute_dl_matrix_kernel_mod_test.pf | 4 ++-- ...te_vert_coriolis_matrix_kernel_mod_test.pf | 2 +- ...kinetic_energy_gradient_kernel_mod_test.pf | 4 ++-- .../project_eos_pressure_kernel_mod_test.pf | 2 +- .../project_eos_rho_kernel_mod_test.pf | 2 +- .../rhs_project_eos_kernel_mod_test.pf | 2 +- .../vorticity_rhs_kernel_mod_test.pf | 4 ++-- .../compute_energetics_kernel_mod_test.pf | 5 ++-- .../compute_entropy_kernel_mod_test.pf | 4 ++-- .../compute_moist_mass_kernel_mod_test.pf | 4 ++-- .../compute_total_aam_kernel_mod_test.pf | 2 +- .../compute_total_pv_kernel_mod_test.pf | 3 ++- .../momentum_viscosity_kernel_mod_test.pf | 4 ++-- ...tracer_smagorinsky_diff_kernel_mod_test.pf | 4 ++-- .../tracer_viscosity_kernel_mod_test.pf | 4 ++-- .../deep_hot_jupiter_kernel_mod_test.pf | 4 ++-- .../earth_like_kernel_mod_test.pf | 4 ++-- .../held_suarez_kernel_mod_test.pf | 6 ++--- .../shallow_hot_jupiter_kernel_mod_test.pf | 4 ++-- .../tidally_locked_earth_kernel_mod_test.pf | 14 ++++++----- .../hydrostatic_exner_kernel_mod_test.pf | 2 +- .../initial_rho_sample_kernel_mod_test.pf | 2 +- .../initial_u_kernel_mod_test.pf | 2 +- .../initialisation/set_rho_kernel_mod_test.pf | 2 +- .../eliminated_theta_q22_kernel_mod_test.pf | 4 ++-- .../project_eos_operators_kernel_mod_test.pf | 2 +- .../solver/weighted_m3_kernel_mod_test.pf | 4 ++-- .../panel_edge_coords_kernel_mod_test.pf | 2 +- .../panel_edge_weights_kernel_mod_test.pf | 2 +- .../vorticity_advection_kernel_mod_test.pf | 4 ++-- .../w2_vorticity_advection_kernel_mod_test.pf | 4 ++-- ...poly1d_advective_coeffs_kernel_mod_test.pf | 2 +- .../mol/poly1d_flux_coeffs_kernel_mod_test.pf | 2 +- ...poly2d_advective_coeffs_kernel_mod_test.pf | 2 +- .../mol/poly2d_flux_coeffs_kernel_mod_test.pf | 3 ++- ...ytic_orography_field_spherical_mod_test.pf | 2 +- .../tl_kinetic_energy_gradient_kernel_mod.F90 | 7 +++++- .../tl_project_eos_pressure_kernel_mod.F90 | 7 +++++- .../tl_rhs_project_eos_kernel_mod.F90 | 7 +++++- .../tl_vorticity_advection_kernel_mod.F90 | 10 ++++++-- .../initial_theta_ref_kernel_mod_test.pf | 2 +- ...kinetic_energy_gradient_kernel_mod_test.pf | 4 ++-- ...tl_project_eos_pressure_kernel_mod_test.pf | 2 +- .../tl_rhs_project_eos_kernel_mod_test.pf | 2 +- .../tl_sample_eos_pressure_kernel_mod_test.pf | 2 +- .../tl_vorticity_advection_kernel_mod_test.pf | 4 ++-- 86 files changed, 350 insertions(+), 162 deletions(-) diff --git a/applications/gravity_wave/unit-test/kernel/initial_buoyancy_kernel_mod_test.pf b/applications/gravity_wave/unit-test/kernel/initial_buoyancy_kernel_mod_test.pf index 8a3ca705d..be9f43f92 100644 --- a/applications/gravity_wave/unit-test/kernel/initial_buoyancy_kernel_mod_test.pf +++ b/applications/gravity_wave/unit-test/kernel/initial_buoyancy_kernel_mod_test.pf @@ -77,7 +77,7 @@ contains p_zero=100000.0_r_def, & scaling_factor=1.0_r_def ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar, topology_fully_periodic) end subroutine set_up diff --git a/applications/name_transport/source/kernel/set_name_field_kernel_mod.F90 b/applications/name_transport/source/kernel/set_name_field_kernel_mod.F90 index b0a58ca5c..453a1cc18 100644 --- a/applications/name_transport/source/kernel/set_name_field_kernel_mod.F90 +++ b/applications/name_transport/source/kernel/set_name_field_kernel_mod.F90 @@ -21,6 +21,10 @@ module set_name_field_kernel_mod use kernel_mod, only : kernel_type use log_mod, only : log_event, LOG_LEVEL_ERROR + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + implicit none private @@ -143,7 +147,9 @@ subroutine set_name_field_code(nlayers, tracer, & chi_2_e(df1) = chi_2( map_chi(df1) + k ) chi_3_e(df1) = chi_3( map_chi(df1) + k ) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, & + call coordinate_jacobian(coord_system, geometry, & + topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, & chi_1_e, chi_2_e, chi_3_e, & ipanel, chi_basis, chi_diff_basis, & jac, dj) diff --git a/applications/name_transport/unit-test/kernel/set_name_field_kernel_mod_test.pf b/applications/name_transport/unit-test/kernel/set_name_field_kernel_mod_test.pf index 7ae24e5d4..554823758 100644 --- a/applications/name_transport/unit-test/kernel/set_name_field_kernel_mod_test.pf +++ b/applications/name_transport/unit-test/kernel/set_name_field_kernel_mod_test.pf @@ -91,7 +91,7 @@ contains p_zero=100000.0_r_def, & scaling_factor=1.0_r_def ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar, topology_fully_periodic) end subroutine set_up diff --git a/applications/shallow_water/source/kernel/initial_swe_streamfunc_kernel_mod.F90 b/applications/shallow_water/source/kernel/initial_swe_streamfunc_kernel_mod.F90 index 26df19f6e..b9221ca88 100644 --- a/applications/shallow_water/source/kernel/initial_swe_streamfunc_kernel_mod.F90 +++ b/applications/shallow_water/source/kernel/initial_swe_streamfunc_kernel_mod.F90 @@ -18,8 +18,13 @@ module initial_swe_streamfunc_kernel_mod use constants_mod, only : r_def, i_def, PI use fs_continuity_mod, only : W1 use kernel_mod, only : kernel_type + + use base_mesh_config_mod, only: geometry, topology, & + geometry_spherical + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius use shallow_water_settings_config_mod, & - only : swe_test + only: swe_test implicit none @@ -86,8 +91,6 @@ subroutine initial_swe_streamfunc_code(nlayers, rhs, chi_1, chi_2, chi_3, panel_ use analytic_swe_streamfunction_profiles_mod, & only: analytic_swe_streamfunction - use base_mesh_config_mod, only: geometry, & - geometry_spherical use sci_coordinate_jacobian_mod, only: coordinate_jacobian, & coordinate_jacobian_inverse use coord_transform_mod, only: sphere2cart_vector @@ -135,7 +138,11 @@ subroutine initial_swe_streamfunc_code(nlayers, rhs, chi_1, chi_2, chi_3, panel_ chi_3_cell(df) = chi_3( map_chi(df) ) end do - call coordinate_jacobian( ndf_chi, & + call coordinate_jacobian( coord_system, & + geometry, & + topology, & + scaled_radius, & + ndf_chi, & nqp_h, & nqp_v, & chi_1_cell, & diff --git a/applications/shallow_water/source/kernel/initial_swe_u_kernel_mod.F90 b/applications/shallow_water/source/kernel/initial_swe_u_kernel_mod.F90 index fbad6cef9..6d93ab3d9 100644 --- a/applications/shallow_water/source/kernel/initial_swe_u_kernel_mod.F90 +++ b/applications/shallow_water/source/kernel/initial_swe_u_kernel_mod.F90 @@ -19,13 +19,17 @@ module initial_swe_u_kernel_mod ANY_DISCONTINUOUS_SPACE_3 use constants_mod, only : r_def, PI, i_def use fs_continuity_mod, only : W2 - use initial_wind_config_mod, only : profile_sin_uv, & - profile, sbr_angle_lat, sbr_angle_lon, & - u0, v0, shear, wavelength - use kernel_mod, only : kernel_type + + use base_mesh_config_mod, only: geometry, topology, & + geometry_spherical + use finite_element_config_mod, only: coord_system + use initial_wind_config_mod, only: profile_sin_uv, & + profile, sbr_angle_lat, sbr_angle_lon, & + u0, v0, shear, wavelength + use planet_config_mod, only: scaled_radius use shallow_water_settings_config_mod, & - only : swe_test + only: swe_test implicit none @@ -94,8 +98,6 @@ subroutine initial_swe_u_code( nlayers, rhs, & nqp_h, nqp_v, wqp_h, wqp_v ) use analytic_swe_wind_profiles_mod, only : analytic_swe_wind - use base_mesh_config_mod, only : geometry, & - geometry_spherical use sci_coordinate_jacobian_mod, only : coordinate_jacobian use coord_transform_mod, only : sphere2cart_vector use sci_chi_transform_mod, only : chi2llr, chi2xyz @@ -142,7 +144,11 @@ subroutine initial_swe_u_code( nlayers, rhs, & chi_3_cell(df) = chi_3( map_chi(df) ) end do - call coordinate_jacobian(ndf_chi, & + call coordinate_jacobian( coord_system, & + geometry, & + topology, & + scaled_radius, & + ndf_chi, & nqp_h, & nqp_v, & chi_1_cell, & diff --git a/applications/shallow_water/source/kernel/initial_vorticity_v2_kernel_mod.F90 b/applications/shallow_water/source/kernel/initial_vorticity_v2_kernel_mod.F90 index 4cb12608c..afb4b6f1c 100644 --- a/applications/shallow_water/source/kernel/initial_vorticity_v2_kernel_mod.F90 +++ b/applications/shallow_water/source/kernel/initial_vorticity_v2_kernel_mod.F90 @@ -25,12 +25,12 @@ module initial_vorticity_v2_kernel_mod use kernel_mod, only: kernel_type use sci_coordinate_jacobian_mod, only: coordinate_jacobian, & coordinate_jacobian_inverse - use base_mesh_config_mod, only: geometry, & - geometry_spherical, & - f_lat use rotation_vector_mod, only: rotation_vector_fplane, & rotation_vector_sphere - use planet_config_mod, only: scaled_omega + + use base_mesh_config_mod, only: geometry, topology, & + geometry_spherical, f_lat + use planet_config_mod, only: scaled_radius, scaled_omega implicit none @@ -165,7 +165,11 @@ subroutine initial_vorticity_v2_code(nlayers, r_q, curl_u, geopot, & rotation_vector) end if - call coordinate_jacobian(ndf_chi, & + call coordinate_jacobian(coord_system, & + geometry, & + topology, & + scaled_radius, & + ndf_chi, & nqp_h, & nqp_v, & chi_1_e, & diff --git a/applications/shallow_water/unit-test/kernel/initial_geopot_kernel_mod_test.pf b/applications/shallow_water/unit-test/kernel/initial_geopot_kernel_mod_test.pf index fe44262b4..75d5fe402 100644 --- a/applications/shallow_water/unit-test/kernel/initial_geopot_kernel_mod_test.pf +++ b/applications/shallow_water/unit-test/kernel/initial_geopot_kernel_mod_test.pf @@ -96,7 +96,7 @@ contains swe_test = swe_test_swe_geostr_balance, & thermal_swe = .false. ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar, topology_fully_periodic) end subroutine set_up diff --git a/applications/shallow_water/unit-test/kernel/initial_swe_buoyancy_kernel_mod_test.pf b/applications/shallow_water/unit-test/kernel/initial_swe_buoyancy_kernel_mod_test.pf index 3c69d79cb..02ca8474e 100644 --- a/applications/shallow_water/unit-test/kernel/initial_swe_buoyancy_kernel_mod_test.pf +++ b/applications/shallow_water/unit-test/kernel/initial_swe_buoyancy_kernel_mod_test.pf @@ -97,7 +97,7 @@ contains swe_test = swe_test_swe_gaussian_hill, & thermal_swe = .false.) - call init_chi_transforms() + call init_chi_transforms(geometry_planar, topology_fully_periodic) end subroutine set_up diff --git a/applications/shallow_water/unit-test/kernel/initial_swe_tracer_kernel_mod_test.pf b/applications/shallow_water/unit-test/kernel/initial_swe_tracer_kernel_mod_test.pf index 29103cf75..2e69572db 100644 --- a/applications/shallow_water/unit-test/kernel/initial_swe_tracer_kernel_mod_test.pf +++ b/applications/shallow_water/unit-test/kernel/initial_swe_tracer_kernel_mod_test.pf @@ -96,7 +96,7 @@ contains swe_test = swe_test_swe_geostr_balance, & thermal_swe = .false. ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar, topology_fully_periodic) end subroutine set_up diff --git a/applications/shallow_water/unit-test/kernel/initial_swe_u_kernel_mod_test.pf b/applications/shallow_water/unit-test/kernel/initial_swe_u_kernel_mod_test.pf index 846105876..df091a7f8 100644 --- a/applications/shallow_water/unit-test/kernel/initial_swe_u_kernel_mod_test.pf +++ b/applications/shallow_water/unit-test/kernel/initial_swe_u_kernel_mod_test.pf @@ -96,7 +96,7 @@ contains swe_test = swe_test_swe_gaussian_hill, & ref_gp = 10000.0_r_def ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar, topology_fully_periodic) end subroutine setUp diff --git a/applications/transport/source/kernel/set_tracer_field_kernel_mod.F90 b/applications/transport/source/kernel/set_tracer_field_kernel_mod.F90 index 7e06eaea4..e6cd86ab4 100644 --- a/applications/transport/source/kernel/set_tracer_field_kernel_mod.F90 +++ b/applications/transport/source/kernel/set_tracer_field_kernel_mod.F90 @@ -18,10 +18,14 @@ module set_tracer_field_kernel_mod GH_QUADRATURE_XYoZ use fs_continuity_mod, only : Wchi use constants_mod, only : r_def, i_def - use idealised_config_mod, only : test use kernel_mod, only : kernel_type use log_mod, only : log_event, LOG_LEVEL_ERROR + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use idealised_config_mod, only: test + use planet_config_mod, only: scaled_radius + implicit none private @@ -148,7 +152,9 @@ subroutine set_tracer_field_code(nlayers, tracer, & chi_2_e(df1) = chi_2( map_chi(df1) + k ) chi_3_e(df1) = chi_3( map_chi(df1) + k ) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, & + call coordinate_jacobian(coord_system, geometry, & + topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, & chi_1_e, chi_2_e, chi_3_e, & ipanel, chi_basis, chi_diff_basis, & jac, dj) diff --git a/applications/transport/unit-test/kernel/initial_tracer_field_sample_kernel_mod_test.pf b/applications/transport/unit-test/kernel/initial_tracer_field_sample_kernel_mod_test.pf index 7fcd8dc18..851d10191 100644 --- a/applications/transport/unit-test/kernel/initial_tracer_field_sample_kernel_mod_test.pf +++ b/applications/transport/unit-test/kernel/initial_tracer_field_sample_kernel_mod_test.pf @@ -82,7 +82,7 @@ contains f_lon_deg=0.0_r_def, perturb_init=.false., & perturb_magnitude=0, perturb_seed=0 ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar, topology_fully_periodic) end subroutine setUp diff --git a/applications/transport/unit-test/kernel/set_tracer_field_kernel_mod_test.pf b/applications/transport/unit-test/kernel/set_tracer_field_kernel_mod_test.pf index 04e00da19..12e83028f 100644 --- a/applications/transport/unit-test/kernel/set_tracer_field_kernel_mod_test.pf +++ b/applications/transport/unit-test/kernel/set_tracer_field_kernel_mod_test.pf @@ -103,7 +103,7 @@ contains p_zero=100000.0_r_def, & scaling_factor=1.0_r_def ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar, topology_fully_periodic) end subroutine set_up diff --git a/dependencies.yaml b/dependencies.yaml index 5b56a8aba..73e82a168 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: FloatJacobian + source: cazld000020:/data/users/ricky.wong/GitHub/lfric_core + ref: moci: source: git@github.com:MetOffice/moci.git diff --git a/science/adjoint/source/kernel/inter_function_space/adj_sci_convert_hdiv_field_kernel_mod.F90 b/science/adjoint/source/kernel/inter_function_space/adj_sci_convert_hdiv_field_kernel_mod.F90 index 86f1ffce1..190108550 100644 --- a/science/adjoint/source/kernel/inter_function_space/adj_sci_convert_hdiv_field_kernel_mod.F90 +++ b/science/adjoint/source/kernel/inter_function_space/adj_sci_convert_hdiv_field_kernel_mod.F90 @@ -17,6 +17,10 @@ module adj_sci_convert_hdiv_field_kernel_mod CELL_COLUMN, GH_EVALUATOR use constants_mod, only : i_def, r_def +use base_mesh_config_mod, only: geometry, topology +use finite_element_config_mod, only: coord_system +use planet_config_mod, only: scaled_radius + !> NOTE: Kernel requires PSyKAl lite code to invoke. Kernel metadata commented out. !> Please see PSyclone issue #2798 for further information. implicit none @@ -107,6 +111,7 @@ subroutine adj_convert_hdiv_field_code(nlayers, & map_pid) use sci_coordinate_jacobian_mod, only : coordinate_jacobian + implicit none ! Arguments @@ -154,8 +159,10 @@ subroutine adj_convert_hdiv_field_code(nlayers, & chi3_e(df) = chi3(map_chi(df) + k) end do - call coordinate_jacobian(ndf_chi, ndf1, chi1_e(:), chi2_e(:), chi3_e(:), & - ipanel, basis_chi(:,:,:), diff_basis_chi(:,:,:), jacobian(:,:,:), dj(:)) + call coordinate_jacobian(coord_system, geometry, topology, scaled_radius, & + ndf_chi, ndf1, chi1_e(:), chi2_e(:), chi3_e(:), & + ipanel, basis_chi(:,:,:), diff_basis_chi(:,:,:), & + jacobian(:,:,:), dj(:)) do df = ndf1, 1, -1 vector_out(3) = vector_out(3) + physical_field3(map1(df) + k) diff --git a/science/gungho/integration-test/cma_test/cma_test.f90 b/science/gungho/integration-test/cma_test/cma_test.f90 index 2797865da..e938bf99d 100644 --- a/science/gungho/integration-test/cma_test/cma_test.f90 +++ b/science/gungho/integration-test/cma_test/cma_test.f90 @@ -29,7 +29,7 @@ program cma_test test_cma_add, & test_cma_apply_inv, & test_cma_diag_DhMDhT - use constants_mod, only : i_def, r_def, i_def, l_def, & + use constants_mod, only : i_def, r_def, i_def, l_def, imdi, & r_solver, pi, str_def use derived_config_mod, only : set_derived_config use extrusion_mod, only : extrusion_type, & @@ -307,7 +307,8 @@ program cma_test alt_name=twod_names ) call assign_mesh_maps(twod_names) - call init_chi_transforms(mesh_collection) + call init_chi_transforms(geometry_spherical, imdi, & + mesh_collection=mesh_collection) ! Work out grid spacing, which should be of order 1 mesh => mesh_collection%get_mesh(prime_mesh_name) diff --git a/science/gungho/source/kernel/core_dynamics/compute_coriolis_matrix_kernel_mod.F90 b/science/gungho/source/kernel/core_dynamics/compute_coriolis_matrix_kernel_mod.F90 index 9ca14d532..408a5ac63 100644 --- a/science/gungho/source/kernel/core_dynamics/compute_coriolis_matrix_kernel_mod.F90 +++ b/science/gungho/source/kernel/core_dynamics/compute_coriolis_matrix_kernel_mod.F90 @@ -27,14 +27,16 @@ module compute_coriolis_matrix_kernel_mod GH_BASIS, GH_DIFF_BASIS, & CELL_COLUMN, GH_QUADRATURE_XYoZ use fs_continuity_mod, only: W2 - use sci_coordinate_jacobian_mod, only: coordinate_jacobian -use base_mesh_config_mod, only: geometry, & - geometry_spherical use rotation_vector_mod, only: rotation_vector_fplane, & rotation_vector_sphere use cross_product_mod, only: cross_product +use base_mesh_config_mod, only: geometry, topology, & + geometry_spherical +use finite_element_config_mod, only: coord_system +use planet_config_mod, only: scaled_radius + implicit none private @@ -167,8 +169,10 @@ subroutine compute_coriolis_matrix_code(cell, nlayers, ncell_3d, & end if ! Calculate the Jacobian and its determinant - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, & - chi_1_e, chi_2_e, chi_3_e, ipanel, & + call coordinate_jacobian(coord_system, geometry, & + topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, & + chi_1_e, chi_2_e, chi_3_e, ipanel, & basis_chi, diff_basis_chi, jac, dj) diff --git a/science/gungho/source/kernel/core_dynamics/compute_dl_matrix_kernel_mod.F90 b/science/gungho/source/kernel/core_dynamics/compute_dl_matrix_kernel_mod.F90 index 74064b04e..e67efa12e 100644 --- a/science/gungho/source/kernel/core_dynamics/compute_dl_matrix_kernel_mod.F90 +++ b/science/gungho/source/kernel/core_dynamics/compute_dl_matrix_kernel_mod.F90 @@ -20,15 +20,19 @@ module compute_dl_matrix_kernel_mod GH_BASIS, GH_DIFF_BASIS, & GH_SCALAR, GH_INTEGER, & CELL_COLUMN, GH_QUADRATURE_XYoZ - use base_mesh_config_mod, only: geometry, geometry_spherical use constants_mod, only: i_def, r_def, r_second, & PI, degrees_to_radians use sci_chi_transform_mod, only: chi2llr - use damping_layer_config_mod, only: dl_type, dl_type_latitude use fs_continuity_mod, only: W2 use kernel_mod, only: kernel_type use sci_coordinate_jacobian_mod, only: coordinate_jacobian + use base_mesh_config_mod, only: geometry, topology, & + geometry_spherical + use damping_layer_config_mod, only: dl_type, dl_type_latitude + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + implicit none private @@ -189,7 +193,8 @@ subroutine compute_dl_matrix_code(cell, nlayers, ncell_3d, & chi2_e(df) = chi2(map_chi(df) + k - 1) chi3_e(df) = chi3(map_chi(df) + k - 1) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, chi1_e, chi2_e, chi3_e, & + call coordinate_jacobian(coord_system, geometry, topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, chi1_e, chi2_e, chi3_e, & ipanel, basis_chi, diff_basis_chi, jac, dj) ! Only use dofs corresponding to vertical part of basis function diff --git a/science/gungho/source/kernel/core_dynamics/compute_vert_coriolis_matrix_kernel_mod.F90 b/science/gungho/source/kernel/core_dynamics/compute_vert_coriolis_matrix_kernel_mod.F90 index dff2de0b4..71785a9b0 100644 --- a/science/gungho/source/kernel/core_dynamics/compute_vert_coriolis_matrix_kernel_mod.F90 +++ b/science/gungho/source/kernel/core_dynamics/compute_vert_coriolis_matrix_kernel_mod.F90 @@ -28,15 +28,17 @@ module compute_vert_coriolis_matrix_kernel_mod GH_BASIS, GH_DIFF_BASIS, & CELL_COLUMN, GH_QUADRATURE_XYoZ use fs_continuity_mod, only: W2, Wtheta - use sci_coordinate_jacobian_mod, only: coordinate_jacobian -use base_mesh_config_mod, only: geometry, & - geometry_spherical use rotation_vector_mod, only: rotation_vector_fplane, & rotation_vector_sphere, & vert_vector_sphere use cross_product_mod, only: cross_product +use base_mesh_config_mod, only: geometry, topology, & + geometry_spherical +use finite_element_config_mod, only: coord_system +use planet_config_mod, only: scaled_radius + implicit none private @@ -180,8 +182,10 @@ subroutine compute_vert_coriolis_matrix_code(col_idx, nlayers, ncell_3d, & end if ! Calculate the Jacobian - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, & - chi_1_e, chi_2_e, chi_3_e, ipanel, & + call coordinate_jacobian(coord_system, geometry, & + topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, & + chi_1_e, chi_2_e, chi_3_e, ipanel, & basis_chi, diff_basis_chi, jac, dj) ! To convert from reference space to physical space: diff --git a/science/gungho/source/kernel/core_dynamics/kinetic_energy_gradient_kernel_mod.F90 b/science/gungho/source/kernel/core_dynamics/kinetic_energy_gradient_kernel_mod.F90 index a692c28b5..8022dbe03 100644 --- a/science/gungho/source/kernel/core_dynamics/kinetic_energy_gradient_kernel_mod.F90 +++ b/science/gungho/source/kernel/core_dynamics/kinetic_energy_gradient_kernel_mod.F90 @@ -32,6 +32,10 @@ module kinetic_energy_gradient_kernel_mod use fs_continuity_mod, only : W2 use kernel_mod, only : kernel_type + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + implicit none private @@ -152,7 +156,8 @@ subroutine kinetic_energy_gradient_code(nlayers, & chi_2_e(df) = chi_2( loc ) chi_3_e(df) = chi_3( loc ) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, chi_1_e, chi_2_e, chi_3_e, & + call coordinate_jacobian(coord_system, geometry, topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, chi_1_e, chi_2_e, chi_3_e, & ipanel, chi_basis, chi_diff_basis, jac, dj) do df = 1, ndf_w2 diff --git a/science/gungho/source/kernel/core_dynamics/project_eos_pressure_kernel_mod.F90 b/science/gungho/source/kernel/core_dynamics/project_eos_pressure_kernel_mod.F90 index af05571eb..ffe8eb68a 100644 --- a/science/gungho/source/kernel/core_dynamics/project_eos_pressure_kernel_mod.F90 +++ b/science/gungho/source/kernel/core_dynamics/project_eos_pressure_kernel_mod.F90 @@ -19,6 +19,10 @@ module project_eos_pressure_kernel_mod use fs_continuity_mod, only : W3, Wtheta use kernel_mod, only : kernel_type + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + implicit none private @@ -158,7 +162,8 @@ subroutine project_eos_pressure_code(cell, nlayers, chi2_e(df) = chi2(map_chi(df) + k) chi3_e(df) = chi3(map_chi(df) + k) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, chi1_e, chi2_e, chi3_e, & + call coordinate_jacobian(coord_system, geometry, topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, chi1_e, chi2_e, chi3_e, & ipanel, chi_basis, chi_diff_basis, jac, dj) do df = 1, ndf_w3 diff --git a/science/gungho/source/kernel/core_dynamics/project_eos_rho_kernel_mod.F90 b/science/gungho/source/kernel/core_dynamics/project_eos_rho_kernel_mod.F90 index 3c34582d0..b380f84fa 100644 --- a/science/gungho/source/kernel/core_dynamics/project_eos_rho_kernel_mod.F90 +++ b/science/gungho/source/kernel/core_dynamics/project_eos_rho_kernel_mod.F90 @@ -16,10 +16,14 @@ module project_eos_rho_kernel_mod GH_BASIS, GH_DIFF_BASIS, GH_SCALAR, & CELL_COLUMN, GH_QUADRATURE_XYoZ use constants_mod, only : r_def, i_def -use idealised_config_mod, only : test use fs_continuity_mod, only : WTHETA, W3 use kernel_mod, only : kernel_type +use base_mesh_config_mod, only: geometry, topology +use finite_element_config_mod, only: coord_system +use idealised_config_mod, only: test +use planet_config_mod, only: scaled_radius + implicit none !------------------------------------------------------------------------------- @@ -159,7 +163,9 @@ subroutine project_eos_rho_code(nlayers, & chi3_e(df) = chi3( map_chi(df) + k ) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, & + call coordinate_jacobian(coord_system, geometry, & + topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, & chi1_e, chi2_e, chi3_e, & ipanel, chi_basis, chi_diff_basis, & jac, dj ) diff --git a/science/gungho/source/kernel/core_dynamics/rhs_project_eos_kernel_mod.F90 b/science/gungho/source/kernel/core_dynamics/rhs_project_eos_kernel_mod.F90 index c0bcd137f..108a17051 100644 --- a/science/gungho/source/kernel/core_dynamics/rhs_project_eos_kernel_mod.F90 +++ b/science/gungho/source/kernel/core_dynamics/rhs_project_eos_kernel_mod.F90 @@ -22,6 +22,10 @@ module rhs_project_eos_kernel_mod use fs_continuity_mod, only : W3, Wtheta use kernel_mod, only : kernel_type + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + implicit none private @@ -168,7 +172,8 @@ subroutine rhs_project_eos_code(nlayers, & chi2_e(df) = chi2(map_chi(df) + k) chi3_e(df) = chi3(map_chi(df) + k) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, chi1_e, chi2_e, chi3_e, & + call coordinate_jacobian(coord_system, geometry, topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, chi1_e, chi2_e, chi3_e, & ipanel, chi_basis, chi_diff_basis, jac, dj) do df = 1, ndf_wt theta_vd_e(df) = theta(map_wt(df) + k) * moist_dyn_gas(map_wt(df) + k) diff --git a/science/gungho/source/kernel/core_dynamics/vorticity_rhs_kernel_mod.F90 b/science/gungho/source/kernel/core_dynamics/vorticity_rhs_kernel_mod.F90 index d70d25f2d..ab31b0f5e 100644 --- a/science/gungho/source/kernel/core_dynamics/vorticity_rhs_kernel_mod.F90 +++ b/science/gungho/source/kernel/core_dynamics/vorticity_rhs_kernel_mod.F90 @@ -21,6 +21,10 @@ module vorticity_rhs_kernel_mod use fs_continuity_mod, only : W1, W2 use kernel_mod, only : kernel_type + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + implicit none private @@ -148,7 +152,8 @@ subroutine vorticity_rhs_code(nlayers, & chi_2_e(df) = chi_2( loc ) chi_3_e(df) = chi_3( loc ) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, chi_1_e, chi_2_e, chi_3_e, & + call coordinate_jacobian(coord_system, geometry, topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, chi_1_e, chi_2_e, chi_3_e, & ipanel, basis_chi, diff_basis_chi, jac, dj) do df = 1, ndf_u u_cell(df) = u( map_u(df) + k ) diff --git a/science/gungho/source/kernel/diagnostics/compute_energetics_kernel_mod.f90 b/science/gungho/source/kernel/diagnostics/compute_energetics_kernel_mod.f90 index 121490e96..a7d49fa39 100644 --- a/science/gungho/source/kernel/diagnostics/compute_energetics_kernel_mod.f90 +++ b/science/gungho/source/kernel/diagnostics/compute_energetics_kernel_mod.f90 @@ -30,6 +30,10 @@ module compute_energetics_kernel_mod use fs_continuity_mod, only : W2, W3, Wtheta use kernel_mod, only : kernel_type + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + implicit none private @@ -219,7 +223,8 @@ subroutine compute_energetics_code( & chi_2_e(df) = chi_2( loc ) chi_3_e(df) = chi_3( loc ) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, chi_1_e, chi_2_e, chi_3_e, & + call coordinate_jacobian(coord_system, geometry, topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, chi_1_e, chi_2_e, chi_3_e, & ipanel, chi_basis, chi_diff_basis, jac, dj) do df = 1, ndf_w3 diff --git a/science/gungho/source/kernel/diagnostics/compute_entropy_kernel_mod.F90 b/science/gungho/source/kernel/diagnostics/compute_entropy_kernel_mod.F90 index 478eb4676..89a92b82b 100644 --- a/science/gungho/source/kernel/diagnostics/compute_entropy_kernel_mod.F90 +++ b/science/gungho/source/kernel/diagnostics/compute_entropy_kernel_mod.F90 @@ -22,6 +22,10 @@ module compute_entropy_kernel_mod use fs_continuity_mod, only : W3, Wtheta use kernel_mod, only : kernel_type + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + implicit none private @@ -160,7 +164,8 @@ subroutine compute_entropy_code( nlayers, & chi_2_e(df) = chi_2( loc ) chi_3_e(df) = chi_3( loc ) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, chi_1_e, chi_2_e, chi_3_e, & + call coordinate_jacobian(coord_system, geometry, topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, chi_1_e, chi_2_e, chi_3_e, & ipanel, chi_basis, chi_diff_basis, jac, dj) do df = 1, ndf_wtheta diff --git a/science/gungho/source/kernel/diagnostics/compute_moist_mass_kernel_mod.F90 b/science/gungho/source/kernel/diagnostics/compute_moist_mass_kernel_mod.F90 index 57da7183a..5327c8ce1 100644 --- a/science/gungho/source/kernel/diagnostics/compute_moist_mass_kernel_mod.F90 +++ b/science/gungho/source/kernel/diagnostics/compute_moist_mass_kernel_mod.F90 @@ -21,6 +21,10 @@ module compute_moist_mass_kernel_mod use fs_continuity_mod, only : W3, Wtheta use kernel_mod, only : kernel_type + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + implicit none private @@ -153,7 +157,8 @@ subroutine compute_moist_mass_code( chi_3_e(df) = chi_3(l) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, chi_1_e, chi_2_e, chi_3_e, & + call coordinate_jacobian(coord_system, geometry, topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, chi_1_e, chi_2_e, chi_3_e, & ipanel, chi_basis, chi_diff_basis, jac, dj) ! Loop through dofs, grabbing the values for this cell for reference element diff --git a/science/gungho/source/kernel/diagnostics/compute_total_aam_kernel_mod.F90 b/science/gungho/source/kernel/diagnostics/compute_total_aam_kernel_mod.F90 index cca143aaa..eb37a2328 100644 --- a/science/gungho/source/kernel/diagnostics/compute_total_aam_kernel_mod.F90 +++ b/science/gungho/source/kernel/diagnostics/compute_total_aam_kernel_mod.F90 @@ -25,6 +25,11 @@ module compute_total_aam_kernel_mod use fs_continuity_mod, only : W2, W3 use kernel_mod, only : kernel_type + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + + implicit none private @@ -168,7 +173,9 @@ subroutine compute_total_aam_code( & chi_3_e(df) = chi_3( loc ) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, & + call coordinate_jacobian(coord_system, geometry, & + topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, & chi_1_e, chi_2_e, chi_3_e, ipanel, & chi_basis, chi_diff_basis, jac, dj) do df = 1, ndf_w3 diff --git a/science/gungho/source/kernel/diagnostics/compute_total_pv_kernel_mod.F90 b/science/gungho/source/kernel/diagnostics/compute_total_pv_kernel_mod.F90 index 781ce8115..56b5c9cc8 100644 --- a/science/gungho/source/kernel/diagnostics/compute_total_pv_kernel_mod.F90 +++ b/science/gungho/source/kernel/diagnostics/compute_total_pv_kernel_mod.F90 @@ -19,13 +19,15 @@ module compute_total_pv_kernel_mod use constants_mod, only : r_def, i_def use fs_continuity_mod, only : W0, W1, W3 use kernel_mod, only : kernel_type - use base_mesh_config_mod, & - only: geometry, & - geometry_spherical use rotation_vector_mod, & only: rotation_vector_fplane, & rotation_vector_sphere + use base_mesh_config_mod, only: geometry, topology, & + geometry_spherical + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + implicit none private @@ -180,7 +182,8 @@ subroutine compute_total_pv_code( chi2_e(df) = chi2( map_chi(df) + k ) chi3_e(df) = chi3( map_chi(df) + k ) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, chi1_e, chi2_e, chi3_e, & + call coordinate_jacobian(coord_system, geometry, topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, chi1_e, chi2_e, chi3_e, & ipanel, chi_basis, chi_diff_basis, jac, dj) call coordinate_jacobian_inverse(nqp_h, nqp_v, jac, dj, jac_inv) diff --git a/science/gungho/source/kernel/initialisation/initial_streamfunc_kernel_mod.F90 b/science/gungho/source/kernel/initialisation/initial_streamfunc_kernel_mod.F90 index c44406bd0..e6f53573f 100644 --- a/science/gungho/source/kernel/initialisation/initial_streamfunc_kernel_mod.F90 +++ b/science/gungho/source/kernel/initialisation/initial_streamfunc_kernel_mod.F90 @@ -20,6 +20,12 @@ module initial_streamfunc_kernel_mod use kernel_mod, only : kernel_type use initial_wind_config_mod, only : profile +use base_mesh_config_mod, only: geometry, topology, & + geometry_planar, & + geometry_spherical +use finite_element_config_mod, only: coord_system +use planet_config_mod, only: scaled_radius + implicit none private @@ -108,9 +114,6 @@ subroutine initial_streamfunc_code(nlayers, & ) use analytic_streamfunction_profiles_mod, only: analytic_streamfunction - use base_mesh_config_mod, only: geometry, & - geometry_planar, & - geometry_spherical use sci_chi_transform_mod, only: chi2llr use sci_coordinate_jacobian_mod, only: coordinate_jacobian, & coordinate_jacobian_inverse @@ -169,7 +172,11 @@ subroutine initial_streamfunc_code(nlayers, & end do - call coordinate_jacobian(ndf_chi, & + call coordinate_jacobian(coord_system, & + geometry, & + topology, & + scaled_radius, & + ndf_chi, & nqp_h, & nqp_v, & chi_1_cell, & diff --git a/science/gungho/source/kernel/initialisation/initial_u_kernel_mod.F90 b/science/gungho/source/kernel/initialisation/initial_u_kernel_mod.F90 index f154a0606..ca19b15bb 100644 --- a/science/gungho/source/kernel/initialisation/initial_u_kernel_mod.F90 +++ b/science/gungho/source/kernel/initialisation/initial_u_kernel_mod.F90 @@ -20,11 +20,16 @@ module initial_u_kernel_mod CELL_COLUMN, GH_QUADRATURE_XYoZ use constants_mod, only : r_def, i_def, PI use fs_continuity_mod, only : W2 - use initial_wind_config_mod, only : profile_sin_uv, & - profile, sbr_angle_lat, sbr_angle_lon, & - u0, v0, shear, wavelength use kernel_mod, only : kernel_type + use base_mesh_config_mod, only: geometry, topology, & + geometry_spherical + use finite_element_config_mod, only: coord_system + use initial_wind_config_mod, only: profile_sin_uv, profile, & + sbr_angle_lat, sbr_angle_lon, & + u0, v0, shear, wavelength + use planet_config_mod, only: scaled_radius + implicit none private @@ -106,8 +111,6 @@ subroutine initial_u_code(nlayers, & ) use analytic_wind_profiles_mod, only : analytic_wind - use base_mesh_config_mod, only : geometry, & - geometry_spherical use sci_chi_transform_mod, only : chi2llr use sci_coordinate_jacobian_mod, only : coordinate_jacobian use coord_transform_mod, only : sphere2cart_vector @@ -175,7 +178,11 @@ subroutine initial_u_code(nlayers, & chi_3_cell(df) = chi_3( map_chi(df) + k) end do - call coordinate_jacobian(ndf_chi, & + call coordinate_jacobian(coord_system, & + geometry, & + topology, & + scaled_radius, & + ndf_chi, & nqp_h, & nqp_v, & chi_1_cell, & diff --git a/science/gungho/source/kernel/initialisation/set_exner_kernel_mod.F90 b/science/gungho/source/kernel/initialisation/set_exner_kernel_mod.F90 index ebbde1980..692fda7c8 100644 --- a/science/gungho/source/kernel/initialisation/set_exner_kernel_mod.F90 +++ b/science/gungho/source/kernel/initialisation/set_exner_kernel_mod.F90 @@ -16,9 +16,13 @@ module set_exner_kernel_mod CELL_COLUMN, GH_QUADRATURE_XYoZ use constants_mod, only : r_def, i_def use fs_continuity_mod, only : W3 - use idealised_config_mod, only : test use kernel_mod, only : kernel_type + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use idealised_config_mod, only: test + use planet_config_mod, only: scaled_radius + implicit none private @@ -142,7 +146,9 @@ subroutine set_exner_code(nlayers, & chi_2_e(df1) = chi_2(map_chi(df1) + k) chi_3_e(df1) = chi_3(map_chi(df1) + k) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, & + call coordinate_jacobian(coord_system, geometry, & + topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, & chi_1_e, chi_2_e, chi_3_e, & ipanel, chi_basis, chi_diff_basis, & jac, dj) diff --git a/science/gungho/source/kernel/initialisation/set_rho_kernel_mod.F90 b/science/gungho/source/kernel/initialisation/set_rho_kernel_mod.F90 index bc6f1bf39..90ec2182b 100644 --- a/science/gungho/source/kernel/initialisation/set_rho_kernel_mod.F90 +++ b/science/gungho/source/kernel/initialisation/set_rho_kernel_mod.F90 @@ -17,9 +17,12 @@ module set_rho_kernel_mod CELL_COLUMN, GH_QUADRATURE_XYoZ use fs_continuity_mod, only : Wchi use constants_mod, only : r_def, i_def - use idealised_config_mod, only : test use kernel_mod, only : kernel_type + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use idealised_config_mod, only: test + use planet_config_mod, only: scaled_radius implicit none private @@ -142,7 +145,9 @@ subroutine set_rho_code(nlayers, rho, & chi_2_e(df1) = chi_2( map_chi(df1) + k ) chi_3_e(df1) = chi_3( map_chi(df1) + k ) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, & + call coordinate_jacobian(coord_system, geometry, & + topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, & chi_1_e, chi_2_e, chi_3_e, & ipanel, chi_basis, chi_diff_basis, & jac, dj) diff --git a/science/gungho/source/kernel/solver/eliminated_theta_q22_kernel_mod.F90 b/science/gungho/source/kernel/solver/eliminated_theta_q22_kernel_mod.F90 index acabd2c24..442002ce4 100644 --- a/science/gungho/source/kernel/solver/eliminated_theta_q22_kernel_mod.F90 +++ b/science/gungho/source/kernel/solver/eliminated_theta_q22_kernel_mod.F90 @@ -30,6 +30,10 @@ module eliminated_theta_q22_kernel_mod use fs_continuity_mod, only: W2, Wtheta, Wchi use kernel_mod, only: kernel_type + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + implicit none private @@ -176,8 +180,10 @@ subroutine eliminated_theta_q22_code(cell, nlayers, ncell_3d, & chi3_e(df) = chi3(map_chi(df) + k) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, chi1_e, chi2_e, chi3_e, & + call coordinate_jacobian(coord_system, geometry, topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, chi1_e, chi2_e, chi3_e, & ipanel, basis_chi, diff_basis_chi, jac, dj) + q22_op(ik, :, :) = 0.0_r_solver do qp2 = 1, nqp_v do qp1 = 1, nqp_h diff --git a/science/gungho/source/kernel/solver/project_eos_operators_kernel_mod.F90 b/science/gungho/source/kernel/solver/project_eos_operators_kernel_mod.F90 index e9714db8c..474f6064b 100644 --- a/science/gungho/source/kernel/solver/project_eos_operators_kernel_mod.F90 +++ b/science/gungho/source/kernel/solver/project_eos_operators_kernel_mod.F90 @@ -28,6 +28,10 @@ module project_eos_operators_kernel_mod use fs_continuity_mod, only: W3, Wtheta use kernel_mod, only: kernel_type + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + implicit none private @@ -201,7 +205,9 @@ subroutine project_eos_operators_code(cell, nlayers, & p3theta(ik,:,:) = 0.0_r_solver do qp2 = 1, nqp_v do qp1 = 1, nqp_h - call pointwise_coordinate_jacobian(ndf_chi, chi1_e, chi2_e, chi3_e, & + call pointwise_coordinate_jacobian(coord_system, geometry, & + topology, scaled_radius, & + ndf_chi, chi1_e, chi2_e, chi3_e, & ipanel, rsol_basis_chi(:,:,qp1,qp2), & rsol_diff_basis_chi(:,:,qp1,qp2), & jac, dj ) diff --git a/science/gungho/source/kernel/solver/w2_normalisation_kernel_mod.F90 b/science/gungho/source/kernel/solver/w2_normalisation_kernel_mod.F90 index 7116bbdb7..29ae1b64e 100644 --- a/science/gungho/source/kernel/solver/w2_normalisation_kernel_mod.F90 +++ b/science/gungho/source/kernel/solver/w2_normalisation_kernel_mod.F90 @@ -25,6 +25,10 @@ module w2_normalisation_kernel_mod use fs_continuity_mod, only : W2, Wchi use kernel_mod, only : kernel_type + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + implicit none private @@ -136,15 +140,19 @@ subroutine w2_normalisation_code(nlayers, & chi_2_cell(df) = chi_2(map_chi(df) + k) chi_3_cell(df) = chi_3(map_chi(df) + k) end do - call coordinate_jacobian(ndf_chi, & - ndf, & - chi_1_cell, & - chi_2_cell, & - chi_3_cell, & - ipanel, & - chi_basis, & + call coordinate_jacobian(coord_system, & + geometry, & + topology, & + scaled_radius, & + ndf_chi, & + ndf, & + chi_1_cell, & + chi_2_cell, & + chi_3_cell, & + ipanel, & + chi_basis, & chi_diff_basis, & - jacobian, & + jacobian, & dj) do df = 1,ndf JTJ = matmul(transpose(jacobian(:,:,df)),jacobian(:,:,df)) diff --git a/science/gungho/source/kernel/solver/weighted_m3_kernel_mod.F90 b/science/gungho/source/kernel/solver/weighted_m3_kernel_mod.F90 index cb8728598..8242d80db 100644 --- a/science/gungho/source/kernel/solver/weighted_m3_kernel_mod.F90 +++ b/science/gungho/source/kernel/solver/weighted_m3_kernel_mod.F90 @@ -21,6 +21,10 @@ module weighted_m3_kernel_mod use fs_continuity_mod, only: W3 use kernel_mod, only: kernel_type + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + implicit none private @@ -139,7 +143,8 @@ subroutine weighted_m3_code(cell, nlayers, ncell_3d, & chi2_e(df) = chi2(loc) chi3_e(df) = chi3(loc) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, chi1_e, chi2_e, chi3_e, & + call coordinate_jacobian(coord_system, geometry, topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, chi1_e, chi2_e, chi3_e, & ipanel, basis_chi, diff_basis_chi, jac, dj) ik = 1 + k + (cell-1)*nlayers diff --git a/science/gungho/source/kernel/transport/common/vorticity_advection_kernel_mod.F90 b/science/gungho/source/kernel/transport/common/vorticity_advection_kernel_mod.F90 index cfb37ab12..6e882ff2b 100644 --- a/science/gungho/source/kernel/transport/common/vorticity_advection_kernel_mod.F90 +++ b/science/gungho/source/kernel/transport/common/vorticity_advection_kernel_mod.F90 @@ -34,6 +34,10 @@ module vorticity_advection_kernel_mod use fs_continuity_mod, only: W1, W2 use cross_product_mod, only: cross_product +use base_mesh_config_mod, only: geometry, topology +use finite_element_config_mod, only: coord_system +use planet_config_mod, only: scaled_radius + implicit none private @@ -177,8 +181,10 @@ subroutine vorticity_advection_code(nlayers, & vorticity_at_quad(:) = vorticity_at_quad(:) & + vorticity( map_w1(df) + k )*w1_basis(:,df,qp1,qp2) end do - call pointwise_coordinate_jacobian(ndf_chi, chi_1_e, chi_2_e, chi_3_e, & - ipanel, chi_basis(:,:,qp1,qp2), & + call pointwise_coordinate_jacobian(coord_system, geometry, & + topology, scaled_radius, & + ndf_chi, chi_1_e, chi_2_e, chi_3_e, & + ipanel, chi_basis(:,:,qp1,qp2), & chi_diff_basis(:,:,qp1,qp2), jac, dj) jac_inv = pointwise_coordinate_jacobian_inverse(jac, dj) jac = matmul(jac_inv,transpose(jac_inv)) diff --git a/science/gungho/source/kernel/transport/common/w2_vorticity_advection_kernel_mod.F90 b/science/gungho/source/kernel/transport/common/w2_vorticity_advection_kernel_mod.F90 index f9bfb5db2..01d08c0d8 100644 --- a/science/gungho/source/kernel/transport/common/w2_vorticity_advection_kernel_mod.F90 +++ b/science/gungho/source/kernel/transport/common/w2_vorticity_advection_kernel_mod.F90 @@ -32,6 +32,10 @@ module w2_vorticity_advection_kernel_mod use fs_continuity_mod, only : W2 use kernel_mod, only : kernel_type + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + implicit none private @@ -152,7 +156,8 @@ subroutine w2_vorticity_advection_code(nlayers, & chi_2_e(df) = chi_2( loc ) chi_3_e(df) = chi_3( loc ) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, chi_1_e, chi_2_e, chi_3_e, & + call coordinate_jacobian(coord_system, geometry, topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, chi_1_e, chi_2_e, chi_3_e, & ipanel, chi_basis, chi_diff_basis, jac, dj) do df = 1, ndf_w2 diff --git a/science/gungho/unit-test/kernel/core_dynamics/compute_coriolis_matrix_kernel_mod_test.pf b/science/gungho/unit-test/kernel/core_dynamics/compute_coriolis_matrix_kernel_mod_test.pf index 658e676fd..5f714217c 100644 --- a/science/gungho/unit-test/kernel/core_dynamics/compute_coriolis_matrix_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/core_dynamics/compute_coriolis_matrix_kernel_mod_test.pf @@ -95,7 +95,7 @@ contains horizontal_transport_predictor=.false., & vector_invariant=.true.) - call init_chi_transforms() + call init_chi_transforms(geometry_planar, topology_fully_periodic) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/core_dynamics/compute_dl_matrix_kernel_mod_test.pf b/science/gungho/unit-test/kernel/core_dynamics/compute_dl_matrix_kernel_mod_test.pf index 348fb1efa..2b28dfd31 100644 --- a/science/gungho/unit-test/kernel/core_dynamics/compute_dl_matrix_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/core_dynamics/compute_dl_matrix_kernel_mod_test.pf @@ -8,7 +8,7 @@ !> module compute_dl_matrix_kernel_mod_test - use constants_mod, only : i_def, r_def, r_second + use constants_mod, only : i_def, r_def, r_second, imdi use damping_layer_config_mod, only : dl_base, dl_str, dl_type, dl_type_standard use get_unit_test_m3x3_dofmap_mod, & only : get_w0_m3x3_dofmap, get_w3_m3x3_dofmap @@ -67,7 +67,7 @@ contains rehabilitate=.true., & vorticity_in_w1=.false. ) - call init_chi_transforms() + call init_chi_transforms(imdi,imdi) end subroutine set_up diff --git a/science/gungho/unit-test/kernel/core_dynamics/compute_vert_coriolis_matrix_kernel_mod_test.pf b/science/gungho/unit-test/kernel/core_dynamics/compute_vert_coriolis_matrix_kernel_mod_test.pf index dc3e55e0d..4077a2386 100644 --- a/science/gungho/unit-test/kernel/core_dynamics/compute_vert_coriolis_matrix_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/core_dynamics/compute_vert_coriolis_matrix_kernel_mod_test.pf @@ -121,7 +121,7 @@ contains scaling_factor=1.0_r_def & ) - call init_chi_transforms() + call init_chi_transforms(geometry_spherical, topology_non_periodic) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/core_dynamics/kinetic_energy_gradient_kernel_mod_test.pf b/science/gungho/unit-test/kernel/core_dynamics/kinetic_energy_gradient_kernel_mod_test.pf index aa9b4b51b..a99a9cae9 100644 --- a/science/gungho/unit-test/kernel/core_dynamics/kinetic_energy_gradient_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/core_dynamics/kinetic_energy_gradient_kernel_mod_test.pf @@ -8,7 +8,7 @@ !> module kinetic_energy_gradient_kernel_mod_test - use constants_mod, only : i_def, r_def + use constants_mod, only : i_def, r_def, imdi use get_unit_test_m3x3_q3x3x3_sizes_mod, only : get_w0_m3x3_q3x3x3_size, & get_w2_m3x3_q3x3x3_size, & @@ -92,7 +92,7 @@ contains horizontal_transport_predictor=.false., & vector_invariant=.false.) - call init_chi_transforms() + call init_chi_transforms(imdi,imdi) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/core_dynamics/project_eos_pressure_kernel_mod_test.pf b/science/gungho/unit-test/kernel/core_dynamics/project_eos_pressure_kernel_mod_test.pf index 7dbe255e1..2f78ebc87 100644 --- a/science/gungho/unit-test/kernel/core_dynamics/project_eos_pressure_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/core_dynamics/project_eos_pressure_kernel_mod_test.pf @@ -89,7 +89,7 @@ contains p_zero=100000.0_r_def, & scaling_factor=1.0_r_def ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar, topology_fully_periodic ) end subroutine set_up diff --git a/science/gungho/unit-test/kernel/core_dynamics/project_eos_rho_kernel_mod_test.pf b/science/gungho/unit-test/kernel/core_dynamics/project_eos_rho_kernel_mod_test.pf index f08a05fd7..2edd683f7 100644 --- a/science/gungho/unit-test/kernel/core_dynamics/project_eos_rho_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/core_dynamics/project_eos_rho_kernel_mod_test.pf @@ -92,7 +92,7 @@ contains profile_data=profile_data, & profile_heights=profile_heights ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar, topology_fully_periodic) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/core_dynamics/rhs_project_eos_kernel_mod_test.pf b/science/gungho/unit-test/kernel/core_dynamics/rhs_project_eos_kernel_mod_test.pf index 47193101b..6b83c0dc1 100644 --- a/science/gungho/unit-test/kernel/core_dynamics/rhs_project_eos_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/core_dynamics/rhs_project_eos_kernel_mod_test.pf @@ -92,7 +92,7 @@ contains profile_data=profile_data, & profile_heights=profile_heights ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar, topology_fully_periodic) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/core_dynamics/vorticity_rhs_kernel_mod_test.pf b/science/gungho/unit-test/kernel/core_dynamics/vorticity_rhs_kernel_mod_test.pf index f5751b76d..3156c5223 100644 --- a/science/gungho/unit-test/kernel/core_dynamics/vorticity_rhs_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/core_dynamics/vorticity_rhs_kernel_mod_test.pf @@ -8,7 +8,7 @@ !> module vorticity_rhs_kernel_mod_test - use constants_mod, only: i_def, r_def + use constants_mod, only: i_def, r_def, imdi use funit implicit none @@ -48,7 +48,7 @@ contains rehabilitate=.true., & vorticity_in_w1=.false. ) - call init_chi_transforms() + call init_chi_transforms(imdi,imdi) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/diagnostics/compute_energetics_kernel_mod_test.pf b/science/gungho/unit-test/kernel/diagnostics/compute_energetics_kernel_mod_test.pf index e9e92bf81..f8b18f065 100644 --- a/science/gungho/unit-test/kernel/diagnostics/compute_energetics_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/diagnostics/compute_energetics_kernel_mod_test.pf @@ -9,7 +9,8 @@ !> module compute_energetics_kernel_mod_test - use constants_mod, only : i_def, r_def + use constants_mod, only: i_def, r_def, imdi + use driver_water_constants_mod, only : Lv => latent_heat_h2o_condensation, & Lf => latent_heat_h2o_fusion use get_unit_test_m3x3_q3x3x3_sizes_mod, only : get_w0_m3x3_q3x3x3_size, & @@ -74,7 +75,7 @@ contains rehabilitate=.true., & vorticity_in_w1=.false. ) - call init_chi_transforms() + call init_chi_transforms(imdi,imdi) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/diagnostics/compute_entropy_kernel_mod_test.pf b/science/gungho/unit-test/kernel/diagnostics/compute_entropy_kernel_mod_test.pf index 6e4dd39b0..14fe4aaa5 100644 --- a/science/gungho/unit-test/kernel/diagnostics/compute_entropy_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/diagnostics/compute_entropy_kernel_mod_test.pf @@ -8,7 +8,7 @@ !> module compute_entropy_kernel_mod_test - use constants_mod, only : i_def, r_def + use constants_mod, only : i_def, r_def, imdi use get_unit_test_m3x3_q3x3x3_sizes_mod, only : get_w0_m3x3_q3x3x3_size, & get_wtheta_m3x3_q3x3x3_size, & get_w3_m3x3_q3x3x3_size @@ -63,7 +63,7 @@ contains rehabilitate=.true., & vorticity_in_w1=.false. ) - call init_chi_transforms() + call init_chi_transforms(imdi, imdi) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/diagnostics/compute_moist_mass_kernel_mod_test.pf b/science/gungho/unit-test/kernel/diagnostics/compute_moist_mass_kernel_mod_test.pf index 63133246b..b19858479 100644 --- a/science/gungho/unit-test/kernel/diagnostics/compute_moist_mass_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/diagnostics/compute_moist_mass_kernel_mod_test.pf @@ -7,7 +7,7 @@ !> module compute_moist_mass_kernel_mod_test - use constants_mod, only : i_def, r_def + use constants_mod, only : i_def, r_def, imdi use get_unit_test_m3x3_q3x3x3_sizes_mod, only : get_w0_m3x3_q3x3x3_size, & get_w3_m3x3_q3x3x3_size, & get_wtheta_m3x3_q3x3x3_size @@ -67,7 +67,7 @@ contains rehabilitate=.true., & vorticity_in_w1=.false. ) - call init_chi_transforms() + call init_chi_transforms(imdi,imdi) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/diagnostics/compute_total_aam_kernel_mod_test.pf b/science/gungho/unit-test/kernel/diagnostics/compute_total_aam_kernel_mod_test.pf index 851d06ebc..2ca6692f2 100644 --- a/science/gungho/unit-test/kernel/diagnostics/compute_total_aam_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/diagnostics/compute_total_aam_kernel_mod_test.pf @@ -82,7 +82,7 @@ contains p_zero=100000.0_r_def, & scaling_factor=1.0_r_def ) - call init_chi_transforms() + call init_chi_transforms(geometry_spherical,topology_fully_periodic) end subroutine set_up diff --git a/science/gungho/unit-test/kernel/diagnostics/compute_total_pv_kernel_mod_test.pf b/science/gungho/unit-test/kernel/diagnostics/compute_total_pv_kernel_mod_test.pf index 4eae5a9be..6c6c69042 100644 --- a/science/gungho/unit-test/kernel/diagnostics/compute_total_pv_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/diagnostics/compute_total_pv_kernel_mod_test.pf @@ -86,7 +86,8 @@ contains rd=300.0_r_def, cp=1000.0_r_def, & p_zero=100000.0_r_def, & scaling_factor=1.0_r_def ) - call init_chi_transforms() + + call init_chi_transforms(geometry_spherical, topology_fully_periodic) end subroutine set_up diff --git a/science/gungho/unit-test/kernel/diffusion/momentum_viscosity_kernel_mod_test.pf b/science/gungho/unit-test/kernel/diffusion/momentum_viscosity_kernel_mod_test.pf index 31f0bb9cf..8f326b335 100644 --- a/science/gungho/unit-test/kernel/diffusion/momentum_viscosity_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/diffusion/momentum_viscosity_kernel_mod_test.pf @@ -6,7 +6,7 @@ module momentum_viscosity_kernel_mod_test - use constants_mod, only : i_def, r_def + use constants_mod, only : i_def, r_def, imdi use get_unit_test_m3x3_q3x3x3_sizes_mod, only : get_w2_m3x3_q3x3x3_size use get_unit_test_m3x3_dofmap_mod, only : get_w2_m3x3_dofmap, & @@ -51,7 +51,7 @@ contains rehabilitate=.true., & vorticity_in_w1=.false. ) - call init_chi_transforms() + call init_chi_transforms(imdi,imdi) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/diffusion/tracer_smagorinsky_diff_kernel_mod_test.pf b/science/gungho/unit-test/kernel/diffusion/tracer_smagorinsky_diff_kernel_mod_test.pf index 604ca9319..776ae5fb7 100644 --- a/science/gungho/unit-test/kernel/diffusion/tracer_smagorinsky_diff_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/diffusion/tracer_smagorinsky_diff_kernel_mod_test.pf @@ -6,7 +6,7 @@ module tracer_smagorinsky_diff_kernel_mod_test - use constants_mod, only : i_def, r_def + use constants_mod, only : i_def, r_def, imdi use get_unit_test_m3x3_q3x3x3_sizes_mod, only : get_w2_m3x3_q3x3x3_size, & get_wtheta_m3x3_q3x3x3_size use get_unit_test_m3x3_dofmap_mod, only : get_w2_m3x3_dofmap, & @@ -64,7 +64,7 @@ contains rehabilitate=.true., & vorticity_in_w1=.false. ) - call init_chi_transforms() + call init_chi_transforms(imdi,imdi) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/diffusion/tracer_viscosity_kernel_mod_test.pf b/science/gungho/unit-test/kernel/diffusion/tracer_viscosity_kernel_mod_test.pf index 495c48dff..8e27edc62 100644 --- a/science/gungho/unit-test/kernel/diffusion/tracer_viscosity_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/diffusion/tracer_viscosity_kernel_mod_test.pf @@ -6,7 +6,7 @@ module tracer_viscosity_kernel_mod_test - use constants_mod, only: i_def, r_def + use constants_mod, only: i_def, r_def, imdi use funit implicit none @@ -47,7 +47,7 @@ contains rehabilitate=.true., & vorticity_in_w1=.false. ) - call init_chi_transforms() + call init_chi_transforms(imdi,imdi) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/external_forcing/deep_hot_jupiter_kernel_mod_test.pf b/science/gungho/unit-test/kernel/external_forcing/deep_hot_jupiter_kernel_mod_test.pf index 00640b1af..3f914a2a0 100644 --- a/science/gungho/unit-test/kernel/external_forcing/deep_hot_jupiter_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/external_forcing/deep_hot_jupiter_kernel_mod_test.pf @@ -8,7 +8,7 @@ !> module deep_hot_jupiter_kernel_mod_test - use constants_mod, only : i_def, r_def, r_second, PI + use constants_mod, only : i_def, r_def, r_second, PI, imdi use coord_transform_mod, only : llr2xyz use funit @@ -70,7 +70,7 @@ contains runge_kutta_method=runge_kutta_method_ssp3, & spinup_period=0.0_r_second, spinup_alpha=.false.) - call init_chi_transforms() + call init_chi_transforms(imdi, imdi) end subroutine set_up diff --git a/science/gungho/unit-test/kernel/external_forcing/earth_like_kernel_mod_test.pf b/science/gungho/unit-test/kernel/external_forcing/earth_like_kernel_mod_test.pf index 17e485b6b..d95f80afd 100644 --- a/science/gungho/unit-test/kernel/external_forcing/earth_like_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/external_forcing/earth_like_kernel_mod_test.pf @@ -8,7 +8,7 @@ !> module earth_like_kernel_mod_test - use constants_mod, only : i_def, r_def, r_second, PI + use constants_mod, only : i_def, r_def, r_second, PI, imdi use coord_transform_mod, only : llr2xyz use funit @@ -76,7 +76,7 @@ contains runge_kutta_method=runge_kutta_method_ssp3, & spinup_period=0.0_r_second, spinup_alpha=.false.) - call init_chi_transforms() + call init_chi_transforms(imdi, imdi) end subroutine set_up diff --git a/science/gungho/unit-test/kernel/external_forcing/held_suarez_kernel_mod_test.pf b/science/gungho/unit-test/kernel/external_forcing/held_suarez_kernel_mod_test.pf index d1e1f11e9..18f0dc4a9 100644 --- a/science/gungho/unit-test/kernel/external_forcing/held_suarez_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/external_forcing/held_suarez_kernel_mod_test.pf @@ -8,8 +8,8 @@ !> module held_suarez_kernel_mod_test - use constants_mod, only : i_def, r_def, r_second, PI - use coord_transform_mod, only : llr2xyz + use constants_mod, only: i_def, r_def, r_second, PI, imdi + use coord_transform_mod, only: llr2xyz use funit implicit none @@ -72,7 +72,7 @@ contains runge_kutta_method=runge_kutta_method_ssp3, & spinup_period=0.0_r_second, spinup_alpha=.false.) - call init_chi_transforms() + call init_chi_transforms(imdi, imdi) end subroutine set_up diff --git a/science/gungho/unit-test/kernel/external_forcing/shallow_hot_jupiter_kernel_mod_test.pf b/science/gungho/unit-test/kernel/external_forcing/shallow_hot_jupiter_kernel_mod_test.pf index 854255e9c..37975fbb5 100644 --- a/science/gungho/unit-test/kernel/external_forcing/shallow_hot_jupiter_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/external_forcing/shallow_hot_jupiter_kernel_mod_test.pf @@ -8,7 +8,7 @@ !> module shallow_hot_jupiter_kernel_mod_test - use constants_mod, only : i_def, r_def, r_second, PI + use constants_mod, only : i_def, r_def, r_second, PI, imdi use coord_transform_mod, only : llr2xyz use funit @@ -71,7 +71,7 @@ contains runge_kutta_method=runge_kutta_method_ssp3, & spinup_period=0.0_r_second, spinup_alpha=.false.) - call init_chi_transforms() + call init_chi_transforms(imdi,imdi) end subroutine set_up diff --git a/science/gungho/unit-test/kernel/external_forcing/tidally_locked_earth_kernel_mod_test.pf b/science/gungho/unit-test/kernel/external_forcing/tidally_locked_earth_kernel_mod_test.pf index 5971150fe..e394ad44a 100644 --- a/science/gungho/unit-test/kernel/external_forcing/tidally_locked_earth_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/external_forcing/tidally_locked_earth_kernel_mod_test.pf @@ -17,11 +17,13 @@ module tidally_locked_earth_kernel_mod_test private public :: set_up, tear_down, test_all - real(kind=r_def), parameter :: rd = 287.05_r_def - real(kind=r_def), parameter :: cp = 1005.0_r_def - real(kind=r_def), parameter :: kappa = rd/cp - real(kind=r_def), parameter :: dlat = 1.0_r_def, dlon = 1.0_r_def, dz = 10000.0_r_def - real(kind=r_def), parameter :: dt = 1800.0_r_def + real(kind=r_def), parameter :: rd = 287.05_r_def + real(kind=r_def), parameter :: cp = 1005.0_r_def + real(kind=r_def), parameter :: kappa = rd/cp + real(kind=r_def), parameter :: dlat = 1.0_r_def + real(kind=r_def), parameter :: dlon = 1.0_r_def + real(kind=r_def), parameter :: dz = 10000.0_r_def + real(kind=r_def), parameter :: dt = 1800.0_r_def contains @@ -70,7 +72,7 @@ contains runge_kutta_method=runge_kutta_method_ssp3, & spinup_period=0.0_r_second, spinup_alpha=.false.) - call init_chi_transforms() + call init_chi_transforms(imdi,imdi) end subroutine set_up diff --git a/science/gungho/unit-test/kernel/initialisation/hydrostatic_exner_kernel_mod_test.pf b/science/gungho/unit-test/kernel/initialisation/hydrostatic_exner_kernel_mod_test.pf index e91b2770c..576816e6c 100644 --- a/science/gungho/unit-test/kernel/initialisation/hydrostatic_exner_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/initialisation/hydrostatic_exner_kernel_mod_test.pf @@ -148,7 +148,7 @@ contains perturb_init=.false., perturb_magnitude=0, & perturb_seed=0 ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar,topology_fully_periodic) nlayers=3 call get_w0_m3x3_q3x3x3_size( this%ndf_w0, this%undf_w0, ncells, & diff --git a/science/gungho/unit-test/kernel/initialisation/initial_rho_sample_kernel_mod_test.pf b/science/gungho/unit-test/kernel/initialisation/initial_rho_sample_kernel_mod_test.pf index 4c2b182e8..4dea345c7 100644 --- a/science/gungho/unit-test/kernel/initialisation/initial_rho_sample_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/initialisation/initial_rho_sample_kernel_mod_test.pf @@ -82,7 +82,7 @@ contains perturb_init=.false., perturb_magnitude=0, & perturb_seed=0 ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar,topology_fully_periodic) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/initialisation/initial_u_kernel_mod_test.pf b/science/gungho/unit-test/kernel/initialisation/initial_u_kernel_mod_test.pf index 4ff877458..6c55d4496 100644 --- a/science/gungho/unit-test/kernel/initialisation/initial_u_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/initialisation/initial_u_kernel_mod_test.pf @@ -114,7 +114,7 @@ contains wavelength=wavelength, & wind_time_period=wind_time_period ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar,topology_fully_periodic) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/initialisation/set_rho_kernel_mod_test.pf b/science/gungho/unit-test/kernel/initialisation/set_rho_kernel_mod_test.pf index dac91d1a6..83fdb7aff 100644 --- a/science/gungho/unit-test/kernel/initialisation/set_rho_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/initialisation/set_rho_kernel_mod_test.pf @@ -132,7 +132,7 @@ contains p_zero=100000.0_r_def, & scaling_factor=1.0_r_def ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar,topology_fully_periodic) end subroutine set_up diff --git a/science/gungho/unit-test/kernel/solver/eliminated_theta_q22_kernel_mod_test.pf b/science/gungho/unit-test/kernel/solver/eliminated_theta_q22_kernel_mod_test.pf index 96a0b0d16..c9ab77fb0 100644 --- a/science/gungho/unit-test/kernel/solver/eliminated_theta_q22_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/solver/eliminated_theta_q22_kernel_mod_test.pf @@ -8,7 +8,7 @@ module eliminated_theta_q22_kernel_mod_test use, intrinsic :: iso_fortran_env, only : real64 - use constants_mod, only : i_def, r_def, r_solver + use constants_mod, only : i_def, r_def, r_solver, imdi use funit implicit none @@ -48,7 +48,7 @@ contains coord_system=coord_system_xyz, & vorticity_in_w1=.false. ) - call init_chi_transforms() + call init_chi_transforms(imdi,imdi) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/solver/project_eos_operators_kernel_mod_test.pf b/science/gungho/unit-test/kernel/solver/project_eos_operators_kernel_mod_test.pf index 4537740b9..38f8a35af 100644 --- a/science/gungho/unit-test/kernel/solver/project_eos_operators_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/solver/project_eos_operators_kernel_mod_test.pf @@ -95,7 +95,7 @@ contains rd=rd, cp=cp, p_zero=p_zero, & scaling_factor=1.0_r_def ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar, topology_fully_periodic) end subroutine set_up diff --git a/science/gungho/unit-test/kernel/solver/weighted_m3_kernel_mod_test.pf b/science/gungho/unit-test/kernel/solver/weighted_m3_kernel_mod_test.pf index e23ec3575..7c55ee6d3 100644 --- a/science/gungho/unit-test/kernel/solver/weighted_m3_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/solver/weighted_m3_kernel_mod_test.pf @@ -8,7 +8,7 @@ !> module weighted_m3_kernel_mod_test - use constants_mod, only: i_def, r_def + use constants_mod, only: i_def, r_def, imdi use funit implicit none @@ -48,7 +48,7 @@ contains rehabilitate=.true., & vorticity_in_w1=.false. ) - call init_chi_transforms() + call init_chi_transforms(imdi,imdi) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/transport/common/panel_edge_coords_kernel_mod_test.pf b/science/gungho/unit-test/kernel/transport/common/panel_edge_coords_kernel_mod_test.pf index e85a0bc8a..a2a9f90c0 100644 --- a/science/gungho/unit-test/kernel/transport/common/panel_edge_coords_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/transport/common/panel_edge_coords_kernel_mod_test.pf @@ -80,7 +80,7 @@ contains vorticity_in_w1=.false. & ) - call init_chi_transforms() + call init_chi_transforms(geometry_spherical,topology_fully_periodic) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/transport/common/panel_edge_weights_kernel_mod_test.pf b/science/gungho/unit-test/kernel/transport/common/panel_edge_weights_kernel_mod_test.pf index bd34c90e1..d6cbc6f16 100644 --- a/science/gungho/unit-test/kernel/transport/common/panel_edge_weights_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/transport/common/panel_edge_weights_kernel_mod_test.pf @@ -80,7 +80,7 @@ contains vorticity_in_w1=.false. & ) - call init_chi_transforms() + call init_chi_transforms(geometry_spherical,topology_fully_periodic) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/transport/common/vorticity_advection_kernel_mod_test.pf b/science/gungho/unit-test/kernel/transport/common/vorticity_advection_kernel_mod_test.pf index fd1051185..fd905afa2 100644 --- a/science/gungho/unit-test/kernel/transport/common/vorticity_advection_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/transport/common/vorticity_advection_kernel_mod_test.pf @@ -8,7 +8,7 @@ !> module vorticity_advection_kernel_mod_test - use constants_mod, only: i_def, r_def + use constants_mod, only: i_def, r_def, imdi use funit implicit none @@ -48,7 +48,7 @@ contains rehabilitate=.true., & vorticity_in_w1=.false. ) - call init_chi_transforms() + call init_chi_transforms(imdi,imdi) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/transport/common/w2_vorticity_advection_kernel_mod_test.pf b/science/gungho/unit-test/kernel/transport/common/w2_vorticity_advection_kernel_mod_test.pf index 071d03792..bbc16acaa 100644 --- a/science/gungho/unit-test/kernel/transport/common/w2_vorticity_advection_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/transport/common/w2_vorticity_advection_kernel_mod_test.pf @@ -8,7 +8,7 @@ !> module w2_vorticity_advection_kernel_mod_test - use constants_mod, only: i_def, r_def + use constants_mod, only: i_def, r_def, imdi use funit implicit none @@ -48,7 +48,7 @@ contains rehabilitate=.true., & vorticity_in_w1=.false. ) - call init_chi_transforms() + call init_chi_transforms(imdi,imdi) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/transport/mol/poly1d_advective_coeffs_kernel_mod_test.pf b/science/gungho/unit-test/kernel/transport/mol/poly1d_advective_coeffs_kernel_mod_test.pf index d2e8ae4ee..76abb7490 100644 --- a/science/gungho/unit-test/kernel/transport/mol/poly1d_advective_coeffs_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/transport/mol/poly1d_advective_coeffs_kernel_mod_test.pf @@ -52,7 +52,7 @@ contains rehabilitate = .true., & vorticity_in_w1 = .true. ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar,topology_fully_periodic) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/transport/mol/poly1d_flux_coeffs_kernel_mod_test.pf b/science/gungho/unit-test/kernel/transport/mol/poly1d_flux_coeffs_kernel_mod_test.pf index 26c6a3be1..e347ae2f2 100644 --- a/science/gungho/unit-test/kernel/transport/mol/poly1d_flux_coeffs_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/transport/mol/poly1d_flux_coeffs_kernel_mod_test.pf @@ -52,7 +52,7 @@ contains rehabilitate = .true., & vorticity_in_w1 = .true. ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar, topology_fully_periodic) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/transport/mol/poly2d_advective_coeffs_kernel_mod_test.pf b/science/gungho/unit-test/kernel/transport/mol/poly2d_advective_coeffs_kernel_mod_test.pf index eec36089b..d37ccb7c5 100644 --- a/science/gungho/unit-test/kernel/transport/mol/poly2d_advective_coeffs_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/transport/mol/poly2d_advective_coeffs_kernel_mod_test.pf @@ -52,7 +52,7 @@ contains rehabilitate = .true., & vorticity_in_w1 = .true. ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar,topology_fully_periodic) end subroutine setUp diff --git a/science/gungho/unit-test/kernel/transport/mol/poly2d_flux_coeffs_kernel_mod_test.pf b/science/gungho/unit-test/kernel/transport/mol/poly2d_flux_coeffs_kernel_mod_test.pf index bc2105654..aad312e79 100644 --- a/science/gungho/unit-test/kernel/transport/mol/poly2d_flux_coeffs_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/transport/mol/poly2d_flux_coeffs_kernel_mod_test.pf @@ -50,7 +50,8 @@ contains element_order_v = 0, & rehabilitate = .true., & vorticity_in_w1 = .true. ) - call init_chi_transforms() + + call init_chi_transforms(geometry_planar,topology_fully_periodic) end subroutine setUp diff --git a/science/gungho/unit-test/orography/analytic_orography_field_spherical_mod_test.pf b/science/gungho/unit-test/orography/analytic_orography_field_spherical_mod_test.pf index e45d1fd81..c56647382 100644 --- a/science/gungho/unit-test/orography/analytic_orography_field_spherical_mod_test.pf +++ b/science/gungho/unit-test/orography/analytic_orography_field_spherical_mod_test.pf @@ -134,7 +134,7 @@ contains lambda_focus, & phi_focus ) ) - call init_chi_transforms() + call init_chi_transforms(geometry_spherical, topology_fully_periodic) end subroutine setUp diff --git a/science/linear/source/kernel/core_dynamics/tl_kinetic_energy_gradient_kernel_mod.F90 b/science/linear/source/kernel/core_dynamics/tl_kinetic_energy_gradient_kernel_mod.F90 index 87b4df84b..2763b7bd1 100644 --- a/science/linear/source/kernel/core_dynamics/tl_kinetic_energy_gradient_kernel_mod.F90 +++ b/science/linear/source/kernel/core_dynamics/tl_kinetic_energy_gradient_kernel_mod.F90 @@ -24,6 +24,10 @@ module tl_kinetic_energy_gradient_kernel_mod use fs_continuity_mod, only : W2 use kernel_mod, only : kernel_type + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + implicit none private @@ -161,7 +165,8 @@ subroutine tl_kinetic_energy_gradient_code(nlayers, & chi_2_e(df) = chi_2( loc ) chi_3_e(df) = chi_3( loc ) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, chi_1_e, chi_2_e, chi_3_e, & + call coordinate_jacobian(coord_system, geometry, topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, chi_1_e, chi_2_e, chi_3_e, & ipanel, chi_basis, chi_diff_basis, jac, dj) ! Linearisation state - values at dofs diff --git a/science/linear/source/kernel/core_dynamics/tl_project_eos_pressure_kernel_mod.F90 b/science/linear/source/kernel/core_dynamics/tl_project_eos_pressure_kernel_mod.F90 index d2c9c8193..fd814e936 100644 --- a/science/linear/source/kernel/core_dynamics/tl_project_eos_pressure_kernel_mod.F90 +++ b/science/linear/source/kernel/core_dynamics/tl_project_eos_pressure_kernel_mod.F90 @@ -19,6 +19,10 @@ module tl_project_eos_pressure_kernel_mod use fs_continuity_mod, only : W3, Wtheta use kernel_mod, only : kernel_type + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + implicit none private @@ -171,7 +175,8 @@ subroutine tl_project_eos_pressure_code(cell, nlayers, chi2_e(df) = chi2(map_chi(df) + k) chi3_e(df) = chi3(map_chi(df) + k) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, chi1_e, chi2_e, chi3_e, & + call coordinate_jacobian(coord_system, geometry, topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, chi1_e, chi2_e, chi3_e, & ipanel, chi_basis, chi_diff_basis, jac, dj) ! Linearisation state diff --git a/science/linear/source/kernel/core_dynamics/tl_rhs_project_eos_kernel_mod.F90 b/science/linear/source/kernel/core_dynamics/tl_rhs_project_eos_kernel_mod.F90 index ad726c204..ddb5f7313 100644 --- a/science/linear/source/kernel/core_dynamics/tl_rhs_project_eos_kernel_mod.F90 +++ b/science/linear/source/kernel/core_dynamics/tl_rhs_project_eos_kernel_mod.F90 @@ -30,6 +30,10 @@ module tl_rhs_project_eos_kernel_mod use fs_continuity_mod, only : W3, Wtheta use kernel_mod, only : kernel_type + use base_mesh_config_mod, only: geometry, topology + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius + implicit none private @@ -194,7 +198,8 @@ subroutine tl_rhs_project_eos_code(nlayers, chi2_e(df) = chi2(map_chi(df) + k) chi3_e(df) = chi3(map_chi(df) + k) end do - call coordinate_jacobian(ndf_chi, nqp_h, nqp_v, chi1_e, chi2_e, chi3_e, & + call coordinate_jacobian(coord_system, geometry, topology, scaled_radius, & + ndf_chi, nqp_h, nqp_v, chi1_e, chi2_e, chi3_e, & ipanel, chi_basis, chi_diff_basis, jac, dj) ! Linearisation state diff --git a/science/linear/source/kernel/transport/common/tl_vorticity_advection_kernel_mod.F90 b/science/linear/source/kernel/transport/common/tl_vorticity_advection_kernel_mod.F90 index a2c4c1078..009dc5998 100644 --- a/science/linear/source/kernel/transport/common/tl_vorticity_advection_kernel_mod.F90 +++ b/science/linear/source/kernel/transport/common/tl_vorticity_advection_kernel_mod.F90 @@ -23,6 +23,10 @@ module tl_vorticity_advection_kernel_mod use fs_continuity_mod, only: W1, W2 use cross_product_mod, only: cross_product +use base_mesh_config_mod, only: geometry, topology +use finite_element_config_mod, only: coord_system +use planet_config_mod, only: scaled_radius + implicit none !------------------------------------------------------------------------------- @@ -183,8 +187,10 @@ subroutine tl_vorticity_advection_code(nlayers, & do qp1 = 1, nqp_h ! Constants - call pointwise_coordinate_jacobian(ndf_chi, chi_1_e, chi_2_e, chi_3_e, & - ipanel, chi_basis(:,:,qp1,qp2), & + call pointwise_coordinate_jacobian(coord_system, geometry, & + topology, scaled_radius, & + ndf_chi, chi_1_e, chi_2_e, chi_3_e, & + ipanel, chi_basis(:,:,qp1,qp2), & chi_diff_basis(:,:,qp1,qp2), jac, dj) jac_inv = pointwise_coordinate_jacobian_inverse(jac, dj) jac = matmul(jac_inv,transpose(jac_inv)) diff --git a/science/linear/unit-test/kernel/core_dynamics/initial_theta_ref_kernel_mod_test.pf b/science/linear/unit-test/kernel/core_dynamics/initial_theta_ref_kernel_mod_test.pf index c3b98a7b0..45a8e1ae3 100644 --- a/science/linear/unit-test/kernel/core_dynamics/initial_theta_ref_kernel_mod_test.pf +++ b/science/linear/unit-test/kernel/core_dynamics/initial_theta_ref_kernel_mod_test.pf @@ -112,7 +112,7 @@ contains profile_data=profile_data, & profile_heights=profile_heights ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar, topology_fully_periodic) end subroutine set_up diff --git a/science/linear/unit-test/kernel/core_dynamics/tl_kinetic_energy_gradient_kernel_mod_test.pf b/science/linear/unit-test/kernel/core_dynamics/tl_kinetic_energy_gradient_kernel_mod_test.pf index 9a44a87ab..7fbc2b3a6 100644 --- a/science/linear/unit-test/kernel/core_dynamics/tl_kinetic_energy_gradient_kernel_mod_test.pf +++ b/science/linear/unit-test/kernel/core_dynamics/tl_kinetic_energy_gradient_kernel_mod_test.pf @@ -7,7 +7,7 @@ !>@brief Test the tangent linear gradient of the kinetic energy computation module tl_kinetic_energy_gradient_kernel_mod_test - use constants_mod, only : i_def, r_def + use constants_mod, only : i_def, r_def, imdi use get_unit_test_m3x3_q3x3x3_sizes_mod, only : get_w0_m3x3_q3x3x3_size, & get_w2_m3x3_q3x3x3_size, & @@ -91,7 +91,7 @@ contains horizontal_transport_predictor=.false., & vector_invariant=.false.) - call init_chi_transforms() + call init_chi_transforms(imdi, imdi) end subroutine setUp diff --git a/science/linear/unit-test/kernel/core_dynamics/tl_project_eos_pressure_kernel_mod_test.pf b/science/linear/unit-test/kernel/core_dynamics/tl_project_eos_pressure_kernel_mod_test.pf index e739d0615..a34f52bc8 100644 --- a/science/linear/unit-test/kernel/core_dynamics/tl_project_eos_pressure_kernel_mod_test.pf +++ b/science/linear/unit-test/kernel/core_dynamics/tl_project_eos_pressure_kernel_mod_test.pf @@ -86,7 +86,7 @@ contains profile_heights=profile_heights ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar, topology_fully_periodic) call feign_planet_config( gravity=10.0_r_def, & omega=8.0E-5_r_def, & diff --git a/science/linear/unit-test/kernel/core_dynamics/tl_rhs_project_eos_kernel_mod_test.pf b/science/linear/unit-test/kernel/core_dynamics/tl_rhs_project_eos_kernel_mod_test.pf index c80f072b3..f8cae079c 100644 --- a/science/linear/unit-test/kernel/core_dynamics/tl_rhs_project_eos_kernel_mod_test.pf +++ b/science/linear/unit-test/kernel/core_dynamics/tl_rhs_project_eos_kernel_mod_test.pf @@ -91,7 +91,7 @@ contains profile_data=profile_data, & profile_heights=profile_heights ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar, topology_fully_periodic) end subroutine setUp diff --git a/science/linear/unit-test/kernel/core_dynamics/tl_sample_eos_pressure_kernel_mod_test.pf b/science/linear/unit-test/kernel/core_dynamics/tl_sample_eos_pressure_kernel_mod_test.pf index e1dc1c860..9617cb413 100644 --- a/science/linear/unit-test/kernel/core_dynamics/tl_sample_eos_pressure_kernel_mod_test.pf +++ b/science/linear/unit-test/kernel/core_dynamics/tl_sample_eos_pressure_kernel_mod_test.pf @@ -91,7 +91,7 @@ contains p_zero=100000.0_r_def, & scaling_factor=1.0_r_def ) - call init_chi_transforms() + call init_chi_transforms(geometry_planar, topology_fully_periodic) end subroutine set_up diff --git a/science/linear/unit-test/kernel/transport/common/tl_vorticity_advection_kernel_mod_test.pf b/science/linear/unit-test/kernel/transport/common/tl_vorticity_advection_kernel_mod_test.pf index 9dea4bf34..32c184999 100644 --- a/science/linear/unit-test/kernel/transport/common/tl_vorticity_advection_kernel_mod_test.pf +++ b/science/linear/unit-test/kernel/transport/common/tl_vorticity_advection_kernel_mod_test.pf @@ -7,7 +7,7 @@ !>@brief Test the tangent linear of the vorticity advection. module tl_vorticity_advection_kernel_mod_test - use constants_mod, only: i_def, r_def + use constants_mod, only: i_def, r_def, imdi use funit use finite_element_config_mod, & @@ -134,7 +134,7 @@ contains rehabilitate=.true., & vorticity_in_w1=.false. ) - call init_chi_transforms() + call init_chi_transforms(imdi, imdi) ! Get infrastructure support data !===================================== From 02f3f03231fd4260dd3f6e06f613aaacbecdccc5 Mon Sep 17 00:00:00 2001 From: Ricky Wong <141156427+mo-rickywong@users.noreply.github.com> Date: Tue, 27 Jan 2026 11:25:19 +0000 Subject: [PATCH 08/12] Update patche to help adjoint build --- .../kernel/initial_vorticity_v2_kernel_mod.F90 | 7 ++++--- ...atl_kinetic_energy_gradient_kernel_mod.patch | 13 +++++++------ .../atl_project_eos_pressure_kernel_mod.patch | 17 +++++++++++------ .../kernel/atl_rhs_project_eos_kernel_mod.patch | 13 +++++++------ .../atl_vorticity_advection_kernel_mod.patch | 9 ++++++--- .../earth_like_kernel_mod_test.pf | 1 - .../tidally_locked_earth_kernel_mod_test.pf | 2 +- 7 files changed, 36 insertions(+), 26 deletions(-) diff --git a/applications/shallow_water/source/kernel/initial_vorticity_v2_kernel_mod.F90 b/applications/shallow_water/source/kernel/initial_vorticity_v2_kernel_mod.F90 index afb4b6f1c..f5a5b5c26 100644 --- a/applications/shallow_water/source/kernel/initial_vorticity_v2_kernel_mod.F90 +++ b/applications/shallow_water/source/kernel/initial_vorticity_v2_kernel_mod.F90 @@ -28,9 +28,10 @@ module initial_vorticity_v2_kernel_mod use rotation_vector_mod, only: rotation_vector_fplane, & rotation_vector_sphere - use base_mesh_config_mod, only: geometry, topology, & - geometry_spherical, f_lat - use planet_config_mod, only: scaled_radius, scaled_omega + use base_mesh_config_mod, only: geometry, topology, & + geometry_spherical, f_lat + use finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius, scaled_omega implicit none diff --git a/science/adjoint/patches/kernel/atl_kinetic_energy_gradient_kernel_mod.patch b/science/adjoint/patches/kernel/atl_kinetic_energy_gradient_kernel_mod.patch index c82ba1b0d..78961208c 100644 --- a/science/adjoint/patches/kernel/atl_kinetic_energy_gradient_kernel_mod.patch +++ b/science/adjoint/patches/kernel/atl_kinetic_energy_gradient_kernel_mod.patch @@ -1,18 +1,19 @@ -@@ -1,11 +1,11 @@ +@@ -1,4 +1,4 @@ -module adj_kinetic_energy_gradient_kernel_mod +module atl_kinetic_energy_gradient_kernel_mod use argument_mod, only : any_discontinuous_space_3, any_space_9, arg_type, cell_column, func_type, gh_basis, gh_diff_basis, & &gh_field, gh_inc, gh_quadrature_xyoz, gh_read, gh_real use constants_mod, only : i_def, r_def - use fs_continuity_mod, only : w2 - use kernel_mod, only : kernel_type +@@ -8,7 +8,7 @@ + use finite_element_config_mod, only : coord_system + use planet_config_mod, only : scaled_radius implicit none - type, public, extends(kernel_type) :: adj_kinetic_energy_gradient_kernel_type + type, public, extends(kernel_type) :: atl_kinetic_energy_gradient_kernel_type type(ARG_TYPE) :: META_ARGS(5) = (/ & arg_type(gh_field, gh_real, gh_read, w2), & arg_type(gh_field, gh_real, gh_inc, w2), & -@@ -18,15 +18,15 @@ +@@ -21,15 +21,15 @@ INTEGER :: GH_SHAPE = gh_quadrature_xyoz INTEGER :: OPERATES_ON = cell_column CONTAINS @@ -32,7 +33,7 @@ &w2_basis, w2_diff_basis, ndf_chi, undf_chi, map_chi, chi_basis, chi_diff_basis, ndf_pid, undf_pid, map_pid, nqp_h, nqp_v, wqp_h, & &wqp_v) use sci_coordinate_jacobian_mod, only : coordinate_jacobian -@@ -75,7 +75,6 @@ +@@ -78,7 +78,6 @@ real(kind=r_def) :: dv real(kind=r_def), dimension(3) :: mul1 real(kind=r_def), dimension(3) :: mul2 @@ -40,7 +41,7 @@ real(kind=r_def) :: res_dot_product integer :: idx integer :: idx_1 -@@ -153,6 +152,6 @@ +@@ -156,6 +155,6 @@ enddo enddo diff --git a/science/adjoint/patches/kernel/atl_project_eos_pressure_kernel_mod.patch b/science/adjoint/patches/kernel/atl_project_eos_pressure_kernel_mod.patch index b4564ee1a..2e491bbdd 100644 --- a/science/adjoint/patches/kernel/atl_project_eos_pressure_kernel_mod.patch +++ b/science/adjoint/patches/kernel/atl_project_eos_pressure_kernel_mod.patch @@ -1,19 +1,24 @@ -@@ -1,11 +1,12 @@ +--- ./applications/adjoint_tests/working/build_adjoint_tests/kernel/core_dynamics/atl_project_eos_pressure_kernel_mod.F90.orig 2026-01-27 07:11:08.000000000 +0000 ++++ ./applications/adjoint_tests/working/build_adjoint_tests/kernel/core_dynamics/atl_project_eos_pressure_kernel_mod.F90 2026-01-27 07:30:11.000000000 +0000 +@@ -1,4 +1,4 @@ -module adj_project_eos_pressure_kernel_mod +module atl_project_eos_pressure_kernel_mod use argument_mod, only : any_discontinuous_space_3, any_space_2, arg_type, cell_column, func_type, gh_basis, gh_diff_basis, & &gh_field, gh_operator, gh_quadrature_xyoz, gh_read, gh_readwrite, gh_real, gh_write use constants_mod, only : i_def, r_def - use fs_continuity_mod, only : w3, wtheta +@@ -6,9 +6,9 @@ use kernel_mod, only : kernel_type -+ use planet_config_mod, only : kappa, rd, p_zero + use base_mesh_config_mod, only : geometry, topology + use finite_element_config_mod, only : coord_system +- use planet_config_mod, only : scaled_radius ++ use planet_config_mod, only : scaled_radius, kappa, rd, p_zero implicit none - type, public, extends(kernel_type) :: adj_project_eos_pressure_kernel_type + type, public, extends(kernel_type) :: atl_project_eos_pressure_kernel_type type(ARG_TYPE) :: META_ARGS(10) = (/ & arg_type(gh_field, gh_real, gh_readwrite, w3), & arg_type(gh_field, gh_real, gh_readwrite, w3), & -@@ -24,15 +25,15 @@ +@@ -27,15 +27,15 @@ INTEGER :: GH_SHAPE = gh_quadrature_xyoz INTEGER :: OPERATES_ON = cell_column CONTAINS @@ -33,7 +38,7 @@ &chi1, chi2, chi3, panel_id, ncell_3d, m3_inv, ndf_w3, undf_w3, map_w3, w3_basis, ndf_wt, undf_wt, map_wt, wt_basis, ndf_chi, & &undf_chi, map_chi, chi_basis, chi_diff_basis, ndf_pid, undf_pid, map_pid, nqp_h, nqp_v, wqp_h, wqp_v) use sci_coordinate_jacobian_mod, only : coordinate_jacobian -@@ -96,9 +97,6 @@ +@@ -99,9 +99,6 @@ real(kind=r_def) :: ls_theta_vd_at_quad real(kind=r_def) :: tmp_ls_exner real(kind=r_def) :: tmp_exner @@ -43,7 +48,7 @@ exner_e = 0.0_r_def exner_at_quad = 0.0_r_def -@@ -176,6 +174,6 @@ +@@ -179,6 +176,6 @@ enddo enddo diff --git a/science/adjoint/patches/kernel/atl_rhs_project_eos_kernel_mod.patch b/science/adjoint/patches/kernel/atl_rhs_project_eos_kernel_mod.patch index 9707453f6..a8d455937 100644 --- a/science/adjoint/patches/kernel/atl_rhs_project_eos_kernel_mod.patch +++ b/science/adjoint/patches/kernel/atl_rhs_project_eos_kernel_mod.patch @@ -1,18 +1,19 @@ -@@ -1,11 +1,11 @@ +@@ -1,4 +1,4 @@ -module adj_rhs_project_eos_kernel_mod +module atl_rhs_project_eos_kernel_mod use argument_mod, only : any_discontinuous_space_3, any_space_9, arg_type, cell_column, func_type, gh_basis, gh_diff_basis, & &gh_field, gh_quadrature_xyoz, gh_read, gh_readwrite, gh_real, gh_scalar, gh_write use constants_mod, only : i_def, r_def - use fs_continuity_mod, only : w3, wtheta - use kernel_mod, only : kernel_type +@@ -8,7 +8,7 @@ + use finite_element_config_mod, only : coord_system + use planet_config_mod, only : scaled_radius implicit none - type, public, extends(kernel_type) :: adj_rhs_project_eos_kernel_type + type, public, extends(kernel_type) :: atl_rhs_project_eos_kernel_type type(ARG_TYPE) :: META_ARGS(14) = (/ & arg_type(gh_field, gh_real, gh_readwrite, w3), & arg_type(gh_field, gh_real, gh_readwrite, w3), & -@@ -28,15 +28,15 @@ +@@ -31,15 +31,15 @@ INTEGER :: GH_SHAPE = gh_quadrature_xyoz INTEGER :: OPERATES_ON = cell_column CONTAINS @@ -31,8 +32,8 @@ + subroutine atl_rhs_project_eos_code(nlayers, rhs_eos, exner, rho, theta, moist_dyn_gas, ls_exner, ls_rho, ls_theta, & &ls_moist_dyn_gas, chi1, chi2, chi3, panel_id, kappa, rd, p_zero, ndf_w3, undf_w3, map_w3, w3_basis, ndf_wt, undf_wt, map_wt, & &wt_basis, ndf_chi, undf_chi, map_chi, chi_basis, chi_diff_basis, ndf_pid, undf_pid, map_pid, nqp_h, nqp_v, wqp_h, wqp_v) - use coordinate_jacobian_mod, only : coordinate_jacobian -@@ -176,6 +176,6 @@ + use sci_coordinate_jacobian_mod, only : coordinate_jacobian +@@ -179,6 +179,6 @@ enddo enddo diff --git a/science/adjoint/patches/kernel/atl_vorticity_advection_kernel_mod.patch b/science/adjoint/patches/kernel/atl_vorticity_advection_kernel_mod.patch index 2e526c9d8..20441d4ed 100644 --- a/science/adjoint/patches/kernel/atl_vorticity_advection_kernel_mod.patch +++ b/science/adjoint/patches/kernel/atl_vorticity_advection_kernel_mod.patch @@ -1,4 +1,4 @@ -@@ -1,34 +1,34 @@ +@@ -1,37 +1,37 @@ -module adj_vorticity_advection_kernel_mod +module atl_vorticity_advection_kernel_mod use kernel_mod, only : kernel_type @@ -8,6 +8,9 @@ - use fs_continuity_mod, only : w1, w2, wchi + use fs_continuity_mod, only : w1, w2 use cross_product_mod, only : cross_product + use base_mesh_config_mod, only : geometry, topology + use finite_element_config_mod, only : coord_system + use planet_config_mod, only : scaled_radius implicit none - type, public, extends(kernel_type) :: adj_vorticity_advection_kernel_type + type, public, extends(kernel_type) :: atl_vorticity_advection_kernel_type @@ -41,7 +44,7 @@ &ndf_w2, undf_w2, map_w2, w2_basis, ndf_w1, undf_w1, map_w1, w1_basis, ndf_chi, undf_chi, map_chi, chi_basis, chi_diff_basis, & &ndf_pid, undf_pid, map_pid, nqp_h, nqp_v, wqp_h, wqp_v) use sci_coordinate_jacobian_mod, only : pointwise_coordinate_jacobian, pointwise_coordinate_jacobian_inverse -@@ -86,7 +86,6 @@ +@@ -89,7 +89,6 @@ real(kind=r_def), dimension(3) :: mul2 real(kind=r_def), dimension(3) :: cross_product1 real(kind=r_def), dimension(3) :: cross_product2 @@ -49,7 +52,7 @@ real(kind=r_def) :: res_dot_product integer :: idx integer :: idx_1 -@@ -207,6 +206,6 @@ +@@ -210,6 +209,6 @@ enddo enddo diff --git a/science/gungho/unit-test/kernel/external_forcing/earth_like_kernel_mod_test.pf b/science/gungho/unit-test/kernel/external_forcing/earth_like_kernel_mod_test.pf index d95f80afd..27f8410de 100644 --- a/science/gungho/unit-test/kernel/external_forcing/earth_like_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/external_forcing/earth_like_kernel_mod_test.pf @@ -99,7 +99,6 @@ contains @test subroutine test_all() -use planet_config_mod, only : scaled_radius use, intrinsic :: iso_fortran_env, only : real64 use earth_like_kernel_mod, only : earth_like_code diff --git a/science/gungho/unit-test/kernel/external_forcing/tidally_locked_earth_kernel_mod_test.pf b/science/gungho/unit-test/kernel/external_forcing/tidally_locked_earth_kernel_mod_test.pf index e394ad44a..0514ececc 100644 --- a/science/gungho/unit-test/kernel/external_forcing/tidally_locked_earth_kernel_mod_test.pf +++ b/science/gungho/unit-test/kernel/external_forcing/tidally_locked_earth_kernel_mod_test.pf @@ -8,7 +8,7 @@ !> module tidally_locked_earth_kernel_mod_test - use constants_mod, only : i_def, r_def, r_second, PI + use constants_mod, only : i_def, r_def, r_second, PI, imdi use coord_transform_mod, only : llr2xyz use funit From b3edcf1cb0f3b769b89d93b899b7a2d172dde687 Mon Sep 17 00:00:00 2001 From: Ricky Wong <141156427+mo-rickywong@users.noreply.github.com> Date: Tue, 27 Jan 2026 15:58:43 +0000 Subject: [PATCH 09/12] Update file for linked PR --- CONTRIBUTORS.md | 1 + dependencies.yaml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index d0daddc68..e156a79fe 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -6,6 +6,7 @@ | jennyhickson | Jenny Hickson | Met Office | 2025-12-10 | | mike-hobson | Mike Hobson | Met Office | 2025-12-17 | | mo-marqh | mark Hedley | Met Office | 2025-12-11 | +| mo-rickywong | Ricky Wong | Met Office | 2026-01-27 | | yaswant | Yaswant Pradhan | Met Office | 2025-12-16 | | oakleybrunt | Oakley Brunt | Met Office | 2025-12-19 | | harry-shepherd | Harry Shepherd | Met Office | 2026-01-08 | diff --git a/dependencies.yaml b/dependencies.yaml index 73e82a168..146c3dd51 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -30,8 +30,8 @@ lfric_apps: ref: lfric_core: - source: cazld000020:/data/users/ricky.wong/GitHub/lfric_core - ref: + source: git@github.com:mo-rickywong/lfric_core.git + ref: FloatJacobian moci: source: git@github.com:MetOffice/moci.git From 003f062f323eeaf86a4cd9d28444d9e0248d82f0 Mon Sep 17 00:00:00 2001 From: Ricky Wong <141156427+mo-rickywong@users.noreply.github.com> Date: Tue, 27 Jan 2026 16:16:20 +0000 Subject: [PATCH 10/12] remove comments out of patch files --- .../patches/kernel/atl_project_eos_pressure_kernel_mod.patch | 2 -- .../source/kernel/diagnostics/compute_total_aam_kernel_mod.F90 | 1 - 2 files changed, 3 deletions(-) diff --git a/science/adjoint/patches/kernel/atl_project_eos_pressure_kernel_mod.patch b/science/adjoint/patches/kernel/atl_project_eos_pressure_kernel_mod.patch index 2e491bbdd..85bcc5536 100644 --- a/science/adjoint/patches/kernel/atl_project_eos_pressure_kernel_mod.patch +++ b/science/adjoint/patches/kernel/atl_project_eos_pressure_kernel_mod.patch @@ -1,5 +1,3 @@ ---- ./applications/adjoint_tests/working/build_adjoint_tests/kernel/core_dynamics/atl_project_eos_pressure_kernel_mod.F90.orig 2026-01-27 07:11:08.000000000 +0000 -+++ ./applications/adjoint_tests/working/build_adjoint_tests/kernel/core_dynamics/atl_project_eos_pressure_kernel_mod.F90 2026-01-27 07:30:11.000000000 +0000 @@ -1,4 +1,4 @@ -module adj_project_eos_pressure_kernel_mod +module atl_project_eos_pressure_kernel_mod diff --git a/science/gungho/source/kernel/diagnostics/compute_total_aam_kernel_mod.F90 b/science/gungho/source/kernel/diagnostics/compute_total_aam_kernel_mod.F90 index eb37a2328..786b4f2d8 100644 --- a/science/gungho/source/kernel/diagnostics/compute_total_aam_kernel_mod.F90 +++ b/science/gungho/source/kernel/diagnostics/compute_total_aam_kernel_mod.F90 @@ -29,7 +29,6 @@ module compute_total_aam_kernel_mod use finite_element_config_mod, only: coord_system use planet_config_mod, only: scaled_radius - implicit none private From 2b19c6be199e4664fd9db72fe6aa3815151428cc Mon Sep 17 00:00:00 2001 From: Ricky Wong <141156427+mo-rickywong@users.noreply.github.com> Date: Wed, 4 Feb 2026 14:02:25 +0000 Subject: [PATCH 11/12] Point repo to corresponing lfric_core --- dependencies.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies.yaml b/dependencies.yaml index 0b903e639..e0fbfd8c5 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -30,7 +30,7 @@ lfric_apps: ref: lfric_core: - source: cazld000020:/data/users/ricky.wong/GitHub/lfric_core + source: git@github.com:mo-rickywong/lfric_core.git ref: IntermediateApiFullPurge moci: From af5ac1ecb863eaef8cdfb97e73f5258c4c8d17dc Mon Sep 17 00:00:00 2001 From: Ricky Wong <141156427+mo-rickywong@users.noreply.github.com> Date: Wed, 4 Feb 2026 14:45:17 +0000 Subject: [PATCH 12/12] Revert any change to CONTRIBUTORS file --- CONTRIBUTORS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 9535a50b2..06d974b4f 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -7,7 +7,6 @@ | jennyhickson | Jenny Hickson | Met Office | 2025-12-10 | | mike-hobson | Mike Hobson | Met Office | 2025-12-17 | | mo-marqh | mark Hedley | Met Office | 2025-12-11 | -| mo-rickywong | Ricky Wong | Met Office | 2026-01-27 | | yaswant | Yaswant Pradhan | Met Office | 2025-12-16 | | oakleybrunt | Oakley Brunt | Met Office | 2025-12-19 | | harry-shepherd | Harry Shepherd | Met Office | 2026-01-08 | @@ -24,4 +23,5 @@ | mo-lottieturner | Lottie Turner | Met Office | 2026-01-27 | | andrewcoughtrie | Andrew Coughtrie | Met Office | 2026-01-28 | | tommbendall | Thomas Bendall | Met Office | 2026-01-13 | +| mo-jmanners | James Manners | Met Office | 2026-01-14 | | maggiehendry | Maggie Hendry | Met Office | 2026-01-29 |