diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ed131862..06d974b4 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -23,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 | diff --git a/applications/adjoint_tests/source/adjoint_tests.f90 b/applications/adjoint_tests/source/adjoint_tests.f90 index b24cf880..0f8c0ae2 100644 --- a/applications/adjoint_tests/source/adjoint_tests.f90 +++ b/applications/adjoint_tests/source/adjoint_tests.f90 @@ -11,6 +11,7 @@ program adjoint_tests use cli_mod, only : parse_command_line + use constants_mod, only : l_def, str_max_filename 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 @@ -25,25 +26,23 @@ program adjoint_tests log_level_trace, & log_scratch_space use timing_mod, only: init_timing, final_timing - use io_config_mod, only: timer_output_path - use namelist_mod, only: namelist_type implicit none ! Model run working data set type (modeldb_type) :: modeldb - character(*), parameter :: application_name = "adjoint_tests" - character(:), allocatable :: filename + character(*), parameter :: application_name = "adjoint_tests" + character(:), allocatable :: filename - type(namelist_type), pointer :: io_nml - - logical :: lsubroutine_timers + logical(l_def) :: subroutine_timers + character(str_max_filename) :: timer_output_path call parse_command_line( filename ) + 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) @@ -65,14 +64,15 @@ program adjoint_tests call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), application_name ) - io_nml => modeldb%configuration%get_namelist('io') - call io_nml%get_value('subroutine_timers', lsubroutine_timers) - call init_timing( modeldb%mpi%get_comm(), lsubroutine_timers, & + subroutine_timers = modeldb%config%io%subroutine_timers() + timer_output_path = modeldb%config%io%timer_output_path() + + call init_timing( modeldb%mpi%get_comm(), subroutine_timers, & application_name, timer_output_path ) - nullify( io_nml ) 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 59b1a432..53db0f48 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 @@ -497,7 +496,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 @@ -514,33 +512,22 @@ 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 + character(str_def) :: prime_mesh_name + real(r_second) :: dt + real(r_def) :: bvf_square + integer(i_def) :: b_space + logical(l_def) :: limited_area ! Auxiliary constants to group invokes - real(kind=r_def) :: const1, const2 - integer(tik) :: id - - if ( LPROF ) call start_timing( id, 'gravity_wave_alg' ) + real(kind=r_def) :: const1, const2 + integer(tik) :: id - ! 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() + 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 ) + if ( LPROF ) call start_timing( id, '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_driver_mod.f90 b/applications/gravity_wave/source/driver/gravity_wave_driver_mod.f90 index a4345245..89c3dd6a 100644 --- a/applications/gravity_wave/source/driver/gravity_wave_driver_mod.f90 +++ b/applications/gravity_wave/source/driver/gravity_wave_driver_mod.f90 @@ -47,7 +47,6 @@ module gravity_wave_driver_mod log_scratch_space use mesh_mod, only: mesh_type use mesh_collection_mod, only: mesh_collection - use namelist_collection_mod, only: namelist_collection_type use io_mod, only: ts_fname use files_config_mod, only: checkpoint_stem_name 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 46b88dda..d814451a 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 @@ -197,11 +177,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 e7eb7ffe..52f56333 100644 --- a/applications/gravity_wave/source/gravity_wave.f90 +++ b/applications/gravity_wave/source/gravity_wave.f90 @@ -12,6 +12,7 @@ program gravity_wave use cli_mod, only: parse_command_line + use constants_mod, only: l_def, str_max_filename use driver_modeldb_mod, only: modeldb_type use driver_collections_mod, only: init_collections, final_collections use driver_comm_mod, only: init_comm, final_comm @@ -24,33 +25,37 @@ program gravity_wave use log_mod, only: log_event, & log_level_trace, & log_scratch_space - use namelist_mod, only: namelist_type use timing_mod, only: init_timing, final_timing - use io_config_mod, only: timer_output_path implicit none - type(modeldb_type) :: modeldb - character(*), parameter :: program_name = "gravity_wave" - character(:), allocatable :: filename - type(namelist_type), pointer :: io_nml - logical :: lsubroutine_timers + type(modeldb_type) :: modeldb + + character(*), parameter :: program_name = "gravity_wave" + character(:), allocatable :: filename + + character(str_max_filename) :: timer_output_path + logical(l_def) :: subroutine_timers 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 ) + config=modeldb%config ) deallocate( filename ) call init_logger( modeldb%mpi%get_comm(), program_name ) - io_nml => modeldb%configuration%get_namelist('io') - call io_nml%get_value('subroutine_timers', lsubroutine_timers) - call init_timing( modeldb%mpi%get_comm(), lsubroutine_timers, program_name, timer_output_path ) - nullify( io_nml ) + + subroutine_timers = modeldb%config%io%subroutine_timers() + timer_output_path = modeldb%config%io%timer_output_path() + + call init_timing( modeldb%mpi%get_comm(), subroutine_timers, & + program_name, timer_output_path ) + call init_collections() call init_time( modeldb ) 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 743fdf38..5c7e4464 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 e4337c08..2b0edf68 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 8a3ca705..cd4f5205 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 @@ -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 ee8699e4..aacdb0d2 100644 --- a/applications/gungho_model/source/gungho_model.f90 +++ b/applications/gungho_model/source/gungho_model.f90 @@ -16,6 +16,7 @@ program gungho_model use cli_mod, only: parse_command_line + use constants_mod, only: l_def, str_max_filename use derived_config_mod, only: l_esm_couple use driver_collections_mod, only: init_collections, final_collections use driver_comm_mod, only: init_comm, final_comm @@ -31,27 +32,24 @@ program gungho_model log_level_info, & log_level_trace, & log_scratch_space - use namelist_mod, only: namelist_type use timing_mod, only: init_timing, final_timing - use io_config_mod, only: timer_output_path - implicit none ! Model run working data set type(modeldb_type) :: modeldb - character(*), parameter :: application_name = "gungho_model" - character(:), allocatable :: filename - type(namelist_type), pointer :: io_nml - logical :: lsubroutine_timers + character(*), parameter :: application_name = "gungho_model" + character(:), allocatable :: filename + + logical(l_def) :: subroutine_timers + character(str_max_filename) :: timer_output_path call parse_command_line( filename ) 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 @@ -75,12 +73,16 @@ program gungho_model call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), application_name ) - io_nml => modeldb%configuration%get_namelist('io') - call io_nml%get_value('subroutine_timers', lsubroutine_timers) - call init_timing( modeldb%mpi%get_comm(), lsubroutine_timers, application_name, timer_output_path ) - nullify( io_nml ) + + subroutine_timers = modeldb%config%io%subroutine_timers() + timer_output_path = modeldb%config%io%timer_output_path() + + call init_timing( modeldb%mpi%get_comm(), subroutine_timers, & + application_name, timer_output_path ) + call init_collections() call init_time( modeldb ) call init_counters( application_name ) 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 9748e3f9..72ca0a30 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, & @@ -35,8 +36,6 @@ program algorithm_test finalise_logging, & 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 @@ -51,7 +50,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 +75,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 @@ -144,28 +139,19 @@ program algorithm_test end select ! 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, 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 @@ -199,10 +185,8 @@ program algorithm_test !------------------------------------------------------------------------- stencil_depth = 1 apply_partition_check = .false. - call init_mesh( configuration, & - local_rank, total_ranks, & - base_mesh_names, extrusion, & - stencil_depth, & + call init_mesh( config, local_rank, total_ranks, & + base_mesh_names, extrusion, stencil_depth, & apply_partition_check ) do i=1, size(twod_names) @@ -240,7 +224,6 @@ program algorithm_test call finalise_halo_comms() call global_mpi%finalise() - call configuration%clear() call destroy_comm() call finalise_logging() 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 b5c3faf9..f383262a 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_geometry_mod.f90 b/applications/jedi_lfric_tests/source/jedi-interface/jedi_geometry_mod.f90 index 4fd1b473..7c441b79 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 @@ -37,8 +38,6 @@ module jedi_geometry_mod use mesh_mod, only : mesh_type use mesh_collection_mod, only : mesh_collection use model_clock_mod, only : model_clock_type - use namelist_collection_mod, only : namelist_collection_type - use namelist_mod, only : namelist_type implicit none @@ -92,23 +91,20 @@ module jedi_geometry_mod !> @brief Initialiser for jedi_geometry_type !> -subroutine initialise( self, mpi_comm, configuration ) +subroutine initialise( self, mpi_comm, 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 implicit none 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 type(lfric_mpi_type) :: mpi_obj - type(namelist_type), pointer :: geometry_configuration integer :: i_horizontal real(real64) :: domain_height real(real64) :: stretching_height @@ -121,11 +117,10 @@ 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, config, mpi_obj ) - geometry_configuration => configuration%get_namelist('jedi_geometry') ! Setup the IO - call self%setup_io( geometry_configuration ) + call self%setup_io( config ) ! @todo: The geometry should read some fields: orog, height, ancils @@ -309,13 +304,13 @@ end function get_io_setup_increment !> @brief Private method to setup the IO for the application !> -!> @param [in] configuration A configuration object containing the IO options -subroutine setup_io(self, configuration) +!> @param [in] config A configuration object containing the IO options +subroutine setup_io(self, config) implicit none class( jedi_geometry_type ), intent(inout) :: self - type( namelist_type ), intent(in) :: configuration + type( config_type ), intent(in) :: config ! Local real( kind=r_second ) :: time_step @@ -333,6 +328,7 @@ subroutine setup_io(self, configuration) character( len=str_def ) :: io_path_inc_read character( len=str_def ) :: io_time_step_str character( len=str_def ) :: io_calender_start_str + integer( kind=i_def ) :: freq type( jedi_lfric_file_meta_type ), allocatable :: file_meta_data(:) @@ -340,12 +336,18 @@ subroutine setup_io(self, configuration) type( jedi_datetime_type ) :: io_calender_start ! Create IO clock and setup IO - call configuration%get_value( 'io_time_step', io_time_step_str ) + io_time_step_str = config%jedi_geometry%io_time_step() + io_calender_start_str = config%jedi_geometry%io_calender_start() + io_path_state_read = config%jedi_geometry%io_path_state_read() + io_path_state_write = config%jedi_geometry%io_path_state_write() + io_path_inc_read = config%jedi_geometry%io_path_inc_read() + + self%io_setup_increment = config%jedi_geometry%io_setup_increment() + call io_time_step%init( io_time_step_str ) call io_time_step%get_duration( duration ) time_step = real( duration, r_second ) - call configuration%get_value( 'io_calender_start', io_calender_start_str ) call io_calender_start%init( io_calender_start_str ) call io_calender_start%to_string(calender_start) @@ -353,7 +355,6 @@ subroutine setup_io(self, configuration) self%io_clock, self%calendar ) ! Allocate file_meta depending on how many files are required - call configuration%get_value( 'io_setup_increment', self%io_setup_increment ) if ( self%io_setup_increment ) then allocate( file_meta_data(3) ) else @@ -365,7 +366,6 @@ subroutine setup_io(self, configuration) ! Note, xios_id is arbitrary but has to be unique within a context ! Read state - call configuration%get_value( 'io_path_state_read', io_path_state_read ) file_name = io_path_state_read xios_id = "read_model_data" io_mode_str = "read" @@ -377,7 +377,6 @@ subroutine setup_io(self, configuration) freq, & field_group_id ) ! Write state - call configuration%get_value( 'io_path_state_write', io_path_state_write ) file_name = io_path_state_write xios_id = "write_model_data" io_mode_str = "write" @@ -391,7 +390,6 @@ subroutine setup_io(self, configuration) ! Read increment if required if ( self%io_setup_increment ) then - call configuration%get_value( 'io_path_inc_read', io_path_inc_read ) file_name = io_path_inc_read xios_id = "read_inc_model_data" io_mode_str = "read" diff --git a/applications/jedi_lfric_tests/source/jedi-interface/jedi_id_linear_model_mod.f90 b/applications/jedi_lfric_tests/source/jedi-interface/jedi_id_linear_model_mod.f90 index 4cf75379..d6456651 100644 --- a/applications/jedi_lfric_tests/source/jedi-interface/jedi_id_linear_model_mod.f90 +++ b/applications/jedi_lfric_tests/source/jedi-interface/jedi_id_linear_model_mod.f90 @@ -42,7 +42,6 @@ module jedi_id_linear_model_mod use log_mod, only : log_event, & log_scratch_space, & LOG_LEVEL_ERROR - use namelist_mod, only : namelist_type use normal_wind_transform_mod, only : normal_wind_transform_type use jedi_lfric_moist_fields_mod, only : update_ls_moist_fields, & init_moist_fields, & @@ -122,8 +121,6 @@ subroutine initialise( self, jedi_geometry, config_filename ) ! Local type(field_collection_type), pointer :: prognostic_fields - type( namelist_type ), pointer :: jedi_lfric_settings_config - type( namelist_type ), pointer :: jedi_linear_model_config character( str_def ) :: forecast_length_str character( str_def ) :: nl_time_step_str type( jedi_duration_type ) :: forecast_length @@ -144,8 +141,12 @@ subroutine initialise( self, jedi_geometry, config_filename ) ! Set up extra fields for incremental wind interpolation, if required prognostic_fields => self%modeldb%fields%get_field_collection("prognostic_fields") - jedi_linear_model_config => self%modeldb%configuration%get_namelist('jedi_linear_model') - call jedi_linear_model_config%get_value( 'incremental_wind_interpolation', incremental_wind_interpolation ) + + incremental_wind_interpolation = self%modeldb%config%jedi_linear_model%incremental_wind_interpolation() + nl_time_step_str = self%modeldb%config%jedi_linear_model%nl_time_step() + forecast_length_str = self%modeldb%config%jedi_lfric_settings%forecast_length() + + if (incremental_wind_interpolation) then allocate (incremental_wind_transform_type :: self%wind_transform) else @@ -154,16 +155,11 @@ subroutine initialise( self, jedi_geometry, config_filename ) call self%wind_transform%initialise(prognostic_fields) ! 2. Setup time - self%time_step = get_configuration_timestep( self%modeldb%configuration ) - - jedi_lfric_settings_config => self%modeldb%configuration%get_namelist('jedi_lfric_settings') - call jedi_lfric_settings_config%get_value( 'forecast_length', forecast_length_str ) + self%time_step = get_configuration_timestep( self%modeldb%config ) call forecast_length%init(forecast_length_str) ! 3. Setup trajactory - call jedi_linear_model_config%get_value( 'nl_time_step', nl_time_step_str ) call nl_time_step%init(nl_time_step_str) - call self%linear_state_trajectory%initialise( forecast_length, & nl_time_step ) diff --git a/applications/jedi_lfric_tests/source/jedi-interface/jedi_increment_mod.f90 b/applications/jedi_lfric_tests/source/jedi-interface/jedi_increment_mod.f90 index 43f9aa24..6629ca37 100644 --- a/applications/jedi_lfric_tests/source/jedi-interface/jedi_increment_mod.f90 +++ b/applications/jedi_lfric_tests/source/jedi-interface/jedi_increment_mod.f90 @@ -16,6 +16,7 @@ module jedi_increment_mod use, intrinsic :: iso_fortran_env, only : real64 use atlas_field_emulator_mod, only : atlas_field_emulator_type use atlas_field_interface_mod, only : atlas_field_interface_type + use config_mod, only : config_type use constants_mod, only : i_def, l_def, str_def use field_collection_mod, only : field_collection_type use io_context_mod, only : io_context_type @@ -30,8 +31,6 @@ module jedi_increment_mod LOG_LEVEL_DEBUG, & LOG_LEVEL_ERROR use model_clock_mod, only : model_clock_type - use namelist_collection_mod, only : namelist_collection_type - use namelist_mod, only : namelist_type implicit none @@ -128,33 +127,31 @@ module jedi_increment_mod !> @brief Construct and initialise fields to zero or read from file !> -!> @param [in] geometry The geometry object required to construct the -!> increment -!> @param [in] configuration The configuration object including the required -!> information to construct an increment and set the -!> data via either a file-read or setting the values -!> to zero -subroutine initialise_via_configuration( self, geometry, configuration ) +!> @param [in] geometry The geometry object required to construct the +!> increment +!> @param [in] config The configuration object including the required +!> information to construct an increment and set the +!> data via either a file-read or setting the values +!> to zero +subroutine initialise_via_configuration( self, geometry, config ) implicit none class( jedi_increment_type ), intent(inout) :: self type( jedi_geometry_type ), target, intent(in) :: geometry - type( namelist_collection_type ), intent(in) :: configuration + type( config_type ), intent(in) :: config ! Local - type( namelist_type ), pointer :: increment_config logical( l_def ) :: initialise_via_read character(str_def) :: inc_time_str character(str_def), allocatable :: variables(:) - ! 1. Setup from configuration - increment_config => configuration%get_namelist('jedi_increment') + inc_time_str = config%jedi_increment%inc_time() + variables = config%jedi_increment%variables() + initialise_via_read = config%jedi_increment%initialise_via_read() - call increment_config%get_value( 'inc_time', inc_time_str ) + ! 1. Setup from configuration call self%inc_time%init( inc_time_str ) - - call increment_config%get_value( 'variables', variables ) call setup_field_meta_data( self%field_meta_data, variables ) self%geometry => geometry @@ -163,7 +160,6 @@ subroutine initialise_via_configuration( self, geometry, configuration ) call self%construct_increment() ! 3. Initialise fields by either reading or zeroing the fields - call increment_config%get_value( 'initialise_via_read', initialise_via_read ) if ( initialise_via_read ) then if ( geometry%get_io_setup_increment() ) then call self%read_file( self%inc_time ) diff --git a/applications/jedi_lfric_tests/source/jedi-interface/jedi_linear_model_mod.f90 b/applications/jedi_lfric_tests/source/jedi-interface/jedi_linear_model_mod.f90 index 6be77032..846a083c 100644 --- a/applications/jedi_lfric_tests/source/jedi-interface/jedi_linear_model_mod.f90 +++ b/applications/jedi_lfric_tests/source/jedi-interface/jedi_linear_model_mod.f90 @@ -48,7 +48,6 @@ module jedi_linear_model_mod log_scratch_space, & LOG_LEVEL_ERROR use linear_state_trajectory_mod, only : linear_state_trajectory_type - use namelist_mod, only : namelist_type use normal_wind_transform_mod, only : normal_wind_transform_type use zero_field_collection_mod, only : zero_field_collection @@ -120,8 +119,6 @@ subroutine initialise( self, jedi_geometry, config_filename ) ! Local type(field_collection_type), pointer :: prognostic_fields - type( namelist_type ), pointer :: jedi_lfric_settings_config - type( namelist_type ), pointer :: jedi_linear_model_config character( str_def ) :: forecast_length_str character( str_def ) :: nl_time_step_str type( jedi_duration_type ) :: forecast_length @@ -142,8 +139,11 @@ subroutine initialise( self, jedi_geometry, config_filename ) ! Set up extra fields for incremental wind interpolation, if required prognostic_fields => self%modeldb%fields%get_field_collection("prognostic_fields") - jedi_linear_model_config => self%modeldb%configuration%get_namelist('jedi_linear_model') - call jedi_linear_model_config%get_value( 'incremental_wind_interpolation', incremental_wind_interpolation ) + + incremental_wind_interpolation = self%modeldb%config%jedi_linear_model%incremental_wind_interpolation() + nl_time_step_str = self%modeldb%config%jedi_linear_model%nl_time_step() + forecast_length_str = self%modeldb%config%jedi_lfric_settings%forecast_length() + if (incremental_wind_interpolation) then allocate (incremental_wind_transform_type :: self%wind_transform) else @@ -152,16 +152,11 @@ subroutine initialise( self, jedi_geometry, config_filename ) call self%wind_transform%initialise(prognostic_fields) ! 2. Setup time - self%time_step = get_configuration_timestep( self%modeldb%configuration ) - - jedi_lfric_settings_config => self%modeldb%configuration%get_namelist('jedi_lfric_settings') - call jedi_lfric_settings_config%get_value( 'forecast_length', forecast_length_str ) + self%time_step = get_configuration_timestep( self%modeldb%config ) call forecast_length%init(forecast_length_str) ! 3. Setup trajactory - call jedi_linear_model_config%get_value( 'nl_time_step', nl_time_step_str ) call nl_time_step%init(nl_time_step_str) - call self%linear_state_trajectory%initialise( forecast_length, & nl_time_step ) diff --git a/applications/jedi_lfric_tests/source/jedi-interface/jedi_model_mod.f90 b/applications/jedi_lfric_tests/source/jedi-interface/jedi_model_mod.f90 index 75228660..f6d9b608 100644 --- a/applications/jedi_lfric_tests/source/jedi-interface/jedi_model_mod.f90 +++ b/applications/jedi_lfric_tests/source/jedi-interface/jedi_model_mod.f90 @@ -15,15 +15,14 @@ !> model forecast method to propagate the state. module jedi_model_mod - use constants_mod, only : str_def - use jedi_lfric_datetime_mod, only : jedi_datetime_type - use jedi_lfric_duration_mod, only : jedi_duration_type - use jedi_state_mod, only : jedi_state_type - use log_mod, only : log_event, & - log_scratch_space, & - LOG_LEVEL_ERROR - use namelist_collection_mod, only : namelist_collection_type - use namelist_mod, only : namelist_type + use config_mod, only: config_type + use constants_mod, only: str_def + use jedi_lfric_datetime_mod, only: jedi_datetime_type + use jedi_lfric_duration_mod, only: jedi_duration_type + use jedi_state_mod, only: jedi_state_type + use log_mod, only: log_event, & + log_scratch_space, & + LOG_LEVEL_ERROR implicit none @@ -60,21 +59,20 @@ module jedi_model_mod !> @brief Initialiser for jedi_model_type !> -!> @param [in] configuration Configuration used to setup the model class -subroutine initialise( self, configuration ) +!> @param [in] config Configuration used to setup the model class +subroutine initialise( self, config ) implicit none - class( jedi_model_type ), intent(inout) :: self - type( namelist_collection_type ), intent(in) :: configuration + class( jedi_model_type ), intent(inout) :: self + type( config_type ), intent(in) :: config ! Local - type( namelist_type ), pointer :: jedi_model_config - character( str_def ) :: time_step_str + character(str_def) :: time_step_str ! Get config info and setup - jedi_model_config => configuration%get_namelist('jedi_model') - call jedi_model_config%get_value( 'time_step', time_step_str ) + time_step_str = config%jedi_model%time_step() + call self%time_step%init(time_step_str) end subroutine initialise diff --git a/applications/jedi_lfric_tests/source/jedi-interface/jedi_pseudo_model_mod.f90 b/applications/jedi_lfric_tests/source/jedi-interface/jedi_pseudo_model_mod.f90 index 9166db29..d5add768 100644 --- a/applications/jedi_lfric_tests/source/jedi-interface/jedi_pseudo_model_mod.f90 +++ b/applications/jedi_lfric_tests/source/jedi-interface/jedi_pseudo_model_mod.f90 @@ -13,14 +13,13 @@ module jedi_pseudo_model_mod use constants_mod, only : i_def, str_def + use config_mod, only : config_type use jedi_lfric_datetime_mod, only : jedi_datetime_type use jedi_lfric_duration_mod, only : jedi_duration_type use jedi_state_mod, only : jedi_state_type use log_mod, only : log_event, & log_scratch_space, & LOG_LEVEL_ERROR - use namelist_collection_mod, only : namelist_collection_type - use namelist_mod, only : namelist_type implicit none @@ -62,15 +61,14 @@ module jedi_pseudo_model_mod !> @brief Initialiser for jedi_pseudo_model_type !> !> @param [in] config Configuration used to setup the model class -subroutine initialise( self, configuration ) +subroutine initialise( self, config ) implicit none class( jedi_pseudo_model_type ), intent(inout) :: self - type( namelist_collection_type ), intent(in) :: configuration + type( config_type ), intent(in) :: config ! Local - type( namelist_type ), pointer :: jedi_model_config character( str_def ) :: initial_time character( str_def ) :: time_step_str integer( i_def ) :: number_of_steps @@ -82,16 +80,15 @@ subroutine initialise( self, configuration ) self%current_state = 1_i_def ! Get config info and setup - jedi_model_config => configuration%get_namelist('jedi_pseudo_model') + time_step_str = config%jedi_pseudo_model%time_step() + number_of_steps = config%jedi_pseudo_model%number_of_steps() + initial_time = config%jedi_pseudo_model%initial_time() - call jedi_model_config%get_value( 'number_of_steps', number_of_steps ) self%n_states = number_of_steps allocate( self%state_times(self%n_states) ) - call jedi_model_config%get_value( 'time_step', time_step_str ) call time_step%init( time_step_str ) - call jedi_model_config%get_value( 'initial_time', initial_time ) ! Initialise datetime states 1 - number_of_steps time steps after ! lfric calendar_start namelist variable time call next_datetime%init( initial_time ) 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 b1597fc4..bda63a7a 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,8 +10,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 + use constants_mod, only: i_def, l_def, str_def, str_max_filename implicit none @@ -19,9 +19,9 @@ module jedi_run_mod type, public :: jedi_run_type private - character(str_def) :: jedi_run_name - type(namelist_collection_type) :: configuration - logical(kind=l_def) :: timers_finalised + character(str_def) :: jedi_run_name + type(config_type) :: config + logical(l_def) :: timers_finalised contains @@ -31,10 +31,11 @@ module jedi_run_mod !> LFRic initialiser. procedure, public :: initialise_infrastructure - !> 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 + !> Just finalise subroutine timing; to get useful timing statistics + !> from failed adjoint tests procedure, public :: finalise_timers !> Finalizer @@ -62,6 +63,7 @@ subroutine initialise( self, program_name, out_communicator ) class( jedi_run_type ), intent(inout) :: self character(len=*), intent(in) :: program_name integer(i_def), intent(out) :: out_communicator + ! Local type(lfric_comm_type) :: lfric_comm integer(i_def) :: world_communicator @@ -90,9 +92,7 @@ subroutine initialise_infrastructure( self, filename, model_communicator ) use driver_collections_mod, only: init_collections use driver_config_mod, only: init_config use driver_log_mod, only: init_logger - use namelist_mod, only: namelist_type use timing_mod, only: init_timing - use io_config_mod, only: timer_output_path use jedi_lfric_tests_mod, only: jedi_lfric_tests_required_namelists use lfric_mpi_mod, only: lfric_comm_type @@ -103,28 +103,31 @@ subroutine initialise_infrastructure( self, filename, model_communicator ) integer(i_def), intent(in) :: model_communicator type(lfric_comm_type) :: lfric_comm - type(namelist_type), pointer :: io_nml - logical :: lsubroutine_timers + + character(str_max_filename) :: timer_output_path + logical(l_def) :: subroutine_timers ! 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 ) + config=self%config ) ! Initialise the logger call lfric_comm%set_comm_mpi_val(model_communicator) call init_logger( lfric_comm, self%jedi_run_name ) ! Initialise timing wrapper - io_nml => self%configuration%get_namelist('io') - call io_nml%get_value('subroutine_timers', lsubroutine_timers) - call init_timing( lfric_comm, lsubroutine_timers, trim(self%jedi_run_name), timer_output_path ) + subroutine_timers = self%config%io%subroutine_timers() + timer_output_path = self%config%io%timer_output_path() + call init_timing( lfric_comm, subroutine_timers, & + trim(self%jedi_run_name), timer_output_path ) + self%timers_finalised = .false. ! Initialise collections @@ -132,19 +135,21 @@ subroutine initialise_infrastructure( self, filename, model_communicator ) end subroutine initialise_infrastructure -!> @brief Get pointer to the stored configuration +!> @brief Get pointer to the stored configuration (config_type) !> !> @return configuration A pointer to the configuration -function get_configuration(self) result(configuration) +function get_config(self) result(config) class( jedi_run_type ), target, intent(inout) :: self - type( namelist_collection_type ), pointer :: configuration - configuration => self%configuration + type( config_type ), pointer :: config + + config => self%config -end function get_configuration +end function get_config -!> @brief Just finalise subroutine timing; to get useful timing statistics from failed adjoint tests +!> @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-interface/jedi_state_mod.f90 b/applications/jedi_lfric_tests/source/jedi-interface/jedi_state_mod.f90 index 4b464f16..a69ecb39 100644 --- a/applications/jedi_lfric_tests/source/jedi-interface/jedi_state_mod.f90 +++ b/applications/jedi_lfric_tests/source/jedi-interface/jedi_state_mod.f90 @@ -17,6 +17,7 @@ module jedi_state_mod use, intrinsic :: iso_fortran_env, only : real64 use atlas_field_emulator_mod, only : atlas_field_emulator_type use atlas_field_interface_mod, only : atlas_field_interface_type + use config_mod, only : config_type use constants_mod, only : i_def, l_def, str_def use field_collection_mod, only : field_collection_type use driver_modeldb_mod, only : modeldb_type @@ -31,8 +32,6 @@ module jedi_state_mod LOG_LEVEL_INFO, & LOG_LEVEL_ERROR use model_clock_mod, only : model_clock_type - use namelist_collection_mod, only : namelist_collection_type - use namelist_mod, only : namelist_type implicit none @@ -132,9 +131,9 @@ module jedi_state_mod !> required information to construct a state and !> read a file to initialise the fields !> @param [in] modeldb_filename The location of the modeldb configuration file -subroutine state_initialiser_read( self, & +subroutine state_initialiser_read( self, & geometry, & - configuration, & + config, & modeldb_filename ) use jedi_lfric_nl_modeldb_driver_mod, only : initialise_modeldb @@ -143,20 +142,17 @@ subroutine state_initialiser_read( self, & class( jedi_state_type ), intent(inout) :: self type( jedi_geometry_type ), target, intent(in) :: geometry - type( namelist_collection_type ), intent(in) :: configuration + type( config_type ), intent(in) :: config character(len=*), optional, intent(in) :: modeldb_filename ! Local - type( namelist_type ), pointer :: jedi_state_config - logical( l_def ) :: use_pseudo_model + logical(l_def) :: use_pseudo_model - jedi_state_config => configuration%get_namelist('jedi_state') - - call self%state_initialiser( geometry, jedi_state_config ) + call self%state_initialiser( geometry, config ) ! Initialise the Atlas field emulators via the modeldb or the ! io_collection - call jedi_state_config%get_value( 'use_pseudo_model', use_pseudo_model ) + use_pseudo_model = config%jedi_state%use_pseudo_model() if ( use_pseudo_model ) then ! We are not running the non-linear model so read the model fields from @@ -194,7 +190,7 @@ subroutine state_initialiser( self, geometry, config ) class( jedi_state_type ), intent(inout) :: self type( jedi_geometry_type ), target, intent(in) :: geometry - type( namelist_type ), intent(in) :: config + type( config_type ), intent(in) :: config ! Local integer(i_def) :: n_horizontal @@ -208,10 +204,11 @@ subroutine state_initialiser( self, geometry, config ) character(str_def), allocatable :: variables(:) ! Setup - call config%get_value( 'state_time', state_time ) + state_time = config%jedi_state%state_time() + variables = config%jedi_state%variables() + call self%state_time%init( state_time ) - call config%get_value( 'variables', variables ) call setup_field_meta_data( self%field_meta_data, variables ) self%geometry => geometry diff --git a/applications/jedi_lfric_tests/source/jedi_forecast.f90 b/applications/jedi_lfric_tests/source/jedi_forecast.f90 index 00150b30..49634ca6 100644 --- a/applications/jedi_lfric_tests/source/jedi_forecast.f90 +++ b/applications/jedi_lfric_tests/source/jedi_forecast.f90 @@ -20,12 +20,11 @@ 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, & LOG_LEVEL_ALWAYS - use namelist_collection_mod, only : namelist_collection_type - use namelist_mod, only : namelist_type ! Jedi emulator objects use jedi_checksum_mod, only : output_checksum @@ -46,11 +45,12 @@ program jedi_forecast type( jedi_post_processor_empty_type ) :: jedi_pp_empty ! 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 - type( namelist_type ), pointer :: jedi_lfric_settings_config character( str_def ) :: forecast_length_str type( field_collection_type ), pointer :: depository => null() @@ -75,21 +75,20 @@ program jedi_forecast call log_event( log_scratch_space, LOG_LEVEL_ALWAYS ) ! 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') - call jedi_lfric_settings_config%get_value( 'forecast_length', forecast_length_str ) + forecast_length_str = config%jedi_lfric_settings%forecast_length() call forecast_length%init(forecast_length_str) ! Create geometry - call jedi_geometry%initialise( model_communicator, configuration ) + call jedi_geometry%initialise( model_communicator, config ) ! Create state (requires the configuration file name to setup the modeldb) - call jedi_state%initialise( jedi_geometry, configuration, filename ) + call jedi_state%initialise( jedi_geometry, config, filename ) ! Create non-linear model - call jedi_model%initialise( configuration ) + call jedi_model%initialise( config ) ! Run non-linear model forecast call jedi_model%forecast( jedi_state, forecast_length, jedi_pp_empty ) diff --git a/applications/jedi_lfric_tests/source/jedi_forecast_pseudo.f90 b/applications/jedi_lfric_tests/source/jedi_forecast_pseudo.f90 index cec71e9d..182e0373 100644 --- a/applications/jedi_lfric_tests/source/jedi_forecast_pseudo.f90 +++ b/applications/jedi_lfric_tests/source/jedi_forecast_pseudo.f90 @@ -20,12 +20,11 @@ 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, & LOG_LEVEL_ALWAYS - use namelist_collection_mod, only : namelist_collection_type - use namelist_mod, only : namelist_type ! Jedi emulator objects use jedi_checksum_mod, only : output_checksum @@ -46,12 +45,12 @@ program jedi_forecast_pseudo type( jedi_post_processor_empty_type ) :: jedi_pp_empty ! Local - type( namelist_collection_type ), pointer :: configuration - character(:), allocatable :: filename - integer(i_def) :: model_communicator - type( jedi_duration_type ) :: forecast_length - type( namelist_type ), pointer :: jedi_lfric_settings_config - character( str_def ) :: forecast_length_str + type( config_type ), pointer :: config + + character(:), allocatable :: filename + integer(i_def) :: model_communicator + type( jedi_duration_type ) :: forecast_length + character( str_def ) :: forecast_length_str character(*), parameter :: program_name = "jedi_forecast_pseudo" @@ -74,21 +73,20 @@ program jedi_forecast_pseudo call log_event( log_scratch_space, LOG_LEVEL_ALWAYS ) ! 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') - call jedi_lfric_settings_config%get_value( 'forecast_length', forecast_length_str ) + forecast_length_str = config%jedi_lfric_settings%forecast_length() call forecast_length%init(forecast_length_str) ! Create geometry - call jedi_geometry%initialise( model_communicator, configuration ) + call jedi_geometry%initialise( model_communicator, config ) ! Create state - call jedi_state%initialise( jedi_geometry, configuration ) + call jedi_state%initialise( jedi_geometry, config ) ! Model - call jedi_psuedo_model%initialise( configuration ) + call jedi_psuedo_model%initialise( config ) ! Run non-linear model forecast call jedi_psuedo_model%forecast( jedi_state, forecast_length, jedi_pp_empty ) 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 ed8b0db6..e21cb7de 100644 --- a/applications/jedi_lfric_tests/source/jedi_id_tlm_tests.f90 +++ b/applications/jedi_lfric_tests/source/jedi_id_tlm_tests.f90 @@ -47,13 +47,12 @@ 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, & LOG_LEVEL_ALWAYS, LOG_LEVEL_ERROR, & LOG_LEVEL_INFO - use namelist_collection_mod, only : namelist_collection_type - use namelist_mod, only : namelist_type ! Jedi emulator objects use jedi_lfric_duration_mod, only : jedi_duration_type @@ -80,11 +79,11 @@ program jedi_id_tlm_tests type( jedi_post_processor_traj_type ) :: pp_traj ! 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 - type( namelist_type ), pointer :: jedi_lfric_settings_config character( str_def ) :: forecast_length_str real( kind=r_def ) :: dot_product_1 real( kind=r_def ) :: dot_product_2 @@ -114,18 +113,17 @@ program jedi_id_tlm_tests call log_event( log_scratch_space, LOG_LEVEL_ALWAYS ) ! 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') - call jedi_lfric_settings_config%get_value( 'forecast_length', forecast_length_str ) + forecast_length_str = config%jedi_lfric_settings%forecast_length() call forecast_length%init(forecast_length_str) ! Create geometry - call geometry%initialise( model_communicator, configuration ) + call geometry%initialise( model_communicator, config ) ! Create state - call state%initialise( geometry, configuration ) + call state%initialise( geometry, config ) ! Create linear model call linear_model%initialise( geometry, filename ) @@ -136,7 +134,7 @@ program jedi_id_tlm_tests call pp_traj%initialise( linear_model ) ! Initialise non-linear model - call nonlinear_model%initialise( configuration ) + call nonlinear_model%initialise( config ) ! Run non-linear model forecast to populate the trajectory object call nonlinear_model%forecast( state, forecast_length, pp_traj ) @@ -144,7 +142,7 @@ program jedi_id_tlm_tests ! ---- Perform the adjoint test ! I11 (= y). Create I11 and randomise. - call increment_11%initialise( geometry, configuration ) + call increment_11%initialise( geometry, config ) call increment_11%random() ! Check the norm is not zero diff --git a/applications/jedi_lfric_tests/source/jedi_lfric_tests.f90 b/applications/jedi_lfric_tests/source/jedi_lfric_tests.f90 index 7bef53fb..7c7b8ae1 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 constants_mod, only : l_def, str_max_filename 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 @@ -28,26 +29,24 @@ program jedi_lfric_tests use log_mod, only : log_event, & log_level_trace, & log_scratch_space, LOG_LEVEL_WARNING - use namelist_mod, only: namelist_type use timing_mod, only: init_timing, final_timing - use io_config_mod, only: timer_output_path implicit none ! Model run working data set type (modeldb_type) :: modeldb - character(*), parameter :: application_name = "jedi_lfric_tests" - character(:), allocatable :: filename - type(namelist_type), pointer :: io_nml - logical :: lsubroutine_timers + character(*), parameter :: application_name = "jedi_lfric_tests" + character(:), allocatable :: filename + + character(str_max_filename) :: timer_output_path + logical(l_def) :: subroutine_timers call parse_command_line( filename ) 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 @@ -68,12 +67,15 @@ program jedi_lfric_tests call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), application_name ) - io_nml => modeldb%configuration%get_namelist('io') - call io_nml%get_value('subroutine_timers', lsubroutine_timers) - call init_timing( modeldb%mpi%get_comm(), lsubroutine_timers, application_name, timer_output_path ) - nullify( io_nml ) + + subroutine_timers = modeldb%config%io%subroutine_timers() + timer_output_path = modeldb%config%io%timer_output_path() + + call init_timing( modeldb%mpi%get_comm(), subroutine_timers, & + application_name, timer_output_path ) call init_collections() call init_time( modeldb ) deallocate( filename ) 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 b3c2aa00..c672fbf8 100644 --- a/applications/jedi_lfric_tests/source/jedi_tlm_forecast_tl.f90 +++ b/applications/jedi_lfric_tests/source/jedi_tlm_forecast_tl.f90 @@ -22,12 +22,11 @@ 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, & LOG_LEVEL_ALWAYS - use namelist_collection_mod, only : namelist_collection_type - use namelist_mod, only : namelist_type ! Jedi emulator objects use jedi_checksum_mod, only : output_linear_checksum @@ -52,12 +51,12 @@ program jedi_tlm_forecast_tl type( jedi_post_processor_traj_type ) :: pp_traj ! Local - type( namelist_collection_type ), pointer :: configuration - character(:), allocatable :: filename - integer( kind=i_def ) :: model_communicator - type( jedi_duration_type ) :: forecast_length - type( namelist_type ), pointer :: jedi_lfric_settings_config - character( str_def ) :: forecast_length_str + type( config_type ), pointer :: config + + character(:), allocatable :: filename + integer( kind=i_def ) :: model_communicator + type( jedi_duration_type ) :: forecast_length + character( str_def ) :: forecast_length_str character(*), parameter :: program_name = "jedi_tlm_forecast_tl" @@ -80,21 +79,20 @@ program jedi_tlm_forecast_tl call jedi_run%initialise_infrastructure( filename, model_communicator ) ! 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') - call jedi_lfric_settings_config%get_value( 'forecast_length', forecast_length_str ) + forecast_length_str = config%jedi_lfric_settings%forecast_length() call forecast_length%init(forecast_length_str) ! Create geometry - call jedi_geometry%initialise( model_communicator, configuration ) + call jedi_geometry%initialise( model_communicator, config ) ! Create state - call jedi_state%initialise( jedi_geometry, configuration ) + call jedi_state%initialise( jedi_geometry, config ) ! Create increment - call jedi_increment%initialise( jedi_geometry, configuration ) + call jedi_increment%initialise( jedi_geometry, config ) ! Create linear model call jedi_linear_model%initialise( jedi_geometry, filename ) @@ -103,7 +101,7 @@ program jedi_tlm_forecast_tl call pp_traj%initialise( jedi_linear_model ) ! Create non-linear model - call jedi_psuedo_model%initialise( configuration ) + call jedi_psuedo_model%initialise( config ) ! Run non-linear model forecast to populate the trajectory object call jedi_psuedo_model%forecast( jedi_state, forecast_length, pp_traj ) diff --git a/applications/jedi_lfric_tests/source/jedi_tlm_tests.f90 b/applications/jedi_lfric_tests/source/jedi_tlm_tests.f90 index da7f0342..ace63b4f 100644 --- a/applications/jedi_lfric_tests/source/jedi_tlm_tests.f90 +++ b/applications/jedi_lfric_tests/source/jedi_tlm_tests.f90 @@ -35,13 +35,12 @@ 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, & LOG_LEVEL_ALWAYS, LOG_LEVEL_ERROR, & LOG_LEVEL_INFO - use namelist_collection_mod, only : namelist_collection_type - use namelist_mod, only : namelist_type ! Jedi emulator objects use jedi_lfric_duration_mod, only : jedi_duration_type @@ -66,11 +65,12 @@ program jedi_tlm_tests type( jedi_post_processor_traj_type ) :: pp_traj ! 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 - type( namelist_type ), pointer :: jedi_lfric_settings_config character( str_def ) :: forecast_length_str real( kind=r_def ) :: dot_product_1 real( kind=r_def ) :: dot_product_2 @@ -100,18 +100,17 @@ program jedi_tlm_tests call log_event( log_scratch_space, LOG_LEVEL_ALWAYS ) ! 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') - call jedi_lfric_settings_config%get_value( 'forecast_length', forecast_length_str ) + forecast_length_str = config%jedi_lfric_settings%forecast_length() call forecast_length%init(forecast_length_str) ! Create geometry - call geometry%initialise( model_communicator, configuration ) + call geometry%initialise( model_communicator, config ) ! Create state - call state%initialise( geometry, configuration ) + call state%initialise( geometry, config ) ! Create linear model call linear_model%initialise( geometry, filename ) @@ -120,7 +119,7 @@ program jedi_tlm_tests call pp_traj%initialise( linear_model ) ! Create non-linear model - call pseudo_model%initialise( configuration ) + call pseudo_model%initialise( config ) ! Run non-linear model forecast to populate the trajectory object call pseudo_model%forecast( state, forecast_length, pp_traj ) @@ -128,7 +127,7 @@ program jedi_tlm_tests ! ---- Perform the adjoint test ! Create inc_initial and randomise - call inc_initial%initialise( geometry, configuration ) + call inc_initial%initialise( geometry, config ) call inc_initial%random() ! Check the norm is not zero diff --git a/applications/jules/source/jules.f90 b/applications/jules/source/jules.f90 index 457e85cc..867c2c42 100644 --- a/applications/jules/source/jules.f90 +++ b/applications/jules/source/jules.f90 @@ -17,6 +17,7 @@ program jules use cli_mod, only: parse_command_line + use constants_mod, only: l_def, str_max_filename 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 @@ -27,9 +28,7 @@ program jules 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, final_timing - use io_config_mod, only: timer_output_path implicit none @@ -38,15 +37,15 @@ program jules character(*), parameter :: application_name = "jules" character(:), allocatable :: filename - type(namelist_type), pointer :: io_nml - logical :: lsubroutine_timers + + character(str_max_filename) :: timer_output_path + logical(l_def) :: subroutine_timers call parse_command_line( filename ) 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 @@ -68,13 +67,18 @@ 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 ) + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), application_name ) - io_nml => modeldb%configuration%get_namelist('io') - call io_nml%get_value('subroutine_timers', lsubroutine_timers) - call init_timing( modeldb%mpi%get_comm(), lsubroutine_timers, application_name, timer_output_path ) - nullify( io_nml ) + + subroutine_timers = modeldb%config%io%subroutine_timers() + timer_output_path = modeldb%config%io%timer_output_path() + + call init_timing( modeldb%mpi%get_comm(), subroutine_timers, & + application_name, timer_output_path ) + call init_collections() call init_time( modeldb ) call init_counters( application_name ) diff --git a/applications/lfric2lfric/source/configuration/lfric2lfric_check_conf_mod.f90 b/applications/lfric2lfric/source/configuration/lfric2lfric_check_conf_mod.f90 index 7529664b..c0c81f3d 100644 --- a/applications/lfric2lfric/source/configuration/lfric2lfric_check_conf_mod.f90 +++ b/applications/lfric2lfric/source/configuration/lfric2lfric_check_conf_mod.f90 @@ -11,10 +11,11 @@ !! regridding method and the interpolation direction are supported. module lfric2lfric_check_conf_mod - use constants_mod, only : i_def - use log_mod, only : log_event, log_scratch_space, & - LOG_LEVEL_ERROR - use namelist_mod, only : namelist_type + use config_mod, only: config_type + use constants_mod, only: i_def + use log_mod, only: log_event, log_scratch_space, & + LOG_LEVEL_ERROR + ! Configuration modules use lfric2lfric_config_mod, only : ORIGIN_DOMAIN_LAM, & @@ -36,13 +37,12 @@ module lfric2lfric_check_conf_mod !> @details Currently uses a pointer to the lfric2lfric namelist to check !! the lfric2lfric configuration options for any invalid !! combinations of config options. - !> @param [in] lfric2lfricnml Pointer to the lfric2lfric namelist - !> configuration object. - subroutine lfric2lfric_check_configuration( lfric2lfric_nml ) + !> @param [in] config Application configuration object. + subroutine lfric2lfric_check_configuration( config ) implicit none - type(namelist_type), pointer, intent(in) :: lfric2lfric_nml + type(config_type), intent(in) :: config ! Namelist options are enumerated so become randomized integers integer(kind=i_def) :: origin_domain @@ -50,9 +50,9 @@ subroutine lfric2lfric_check_configuration( lfric2lfric_nml ) integer(kind=i_def) :: regrid_method ! Extract target and origin domains from config namelist - call lfric2lfric_nml%get_value( 'origin_domain', origin_domain ) - call lfric2lfric_nml%get_value( 'target_domain', target_domain ) - call lfric2lfric_nml%get_value( 'regrid_method', regrid_method ) + origin_domain = config%lfric2lfric%origin_domain() + target_domain = config%lfric2lfric%target_domain() + regrid_method = config%lfric2lfric%regrid_method() ! Check our origin and target domains are compatible, currently the ! interpolations NOT allowed are lam => lbc and lam => global diff --git a/applications/lfric2lfric/source/driver/lfric2lfric_driver_mod.F90 b/applications/lfric2lfric/source/driver/lfric2lfric_driver_mod.F90 index c38f37b3..6dea3142 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 108104c1..ef8dbf29 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 @@ -53,7 +54,6 @@ module lfric2lfric_infrastructure_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 orography_config_mod, only: orog_init_option, & orog_init_option_analytic, & orog_init_option_ancil, & @@ -153,17 +153,10 @@ contains class(extrusion_type), allocatable :: extrusion 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 +206,23 @@ 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 - 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) + call lfric2lfric_check_configuration( modeldb%config ) + + 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 @@ -316,7 +301,7 @@ contains ! Create the required meshes !----------------------------------------------------------------------- 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(), & mesh_names, extrusion, & diff --git a/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 b/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 index f1134fce..93346663 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 @@ -37,8 +38,6 @@ module lfric2lfric_init_mesh_mod log_level_info, & log_level_error, & log_level_debug - use namelist_collection_mod, only: namelist_collection_type - use namelist_mod, only: namelist_type use panel_decomposition_mod, only: panel_decomposition_type use partition_mod, only: partitioner_interface use runtime_partition_mod, only: mesh_cubedsphere, & @@ -67,31 +66,34 @@ module lfric2lfric_init_mesh_mod !=============================================================================== !> @brief Generates mesh(es) from mesh input file(s) on a given extrusion. !> -!> @param[in] configuration Application configuration object. -!> This configuration object should contain the -!> following defined namelist objects: -!> * partititioning -!> @param[in] local_rank The MPI rank of this process. -!> @param[in] total_ranks Total number of MPI ranks in this job. -!> @param[in] mesh_names Mesh names to load from the mesh input file(s). -!> @param[in] extrusion Extrusion object to be applied to meshes. -!> @param[in] stencil_depth Required stencil depth for the application. -!> @param[in] regrid_method Apply check for even partitions with the -!> configured partition strategy if the -!> regridding method is 'map'. -!> (unpartitioned mesh input only) +!> @param[in] config Application configuration object. +!> This configuration object should contain the +!> following defined namelist objects: +!> * partititioning +!> @param[in] local_rank The MPI rank of this process. +!> @param[in] total_ranks Total number of MPI ranks in this job. +!> @param[in] mesh_names Mesh names to load from the mesh input file(s). +!> @param[in] extrusion Extrusion object to be applied to meshes. +!> @param[in] stencil_depth Required stencil depth for the application. +!> @param[in] regrid_method Apply check for even partitions with the +!> configured partition strategy if the +!> regridding method is 'map'. +!> (unpartitioned mesh input only) !=============================================================================== -subroutine init_mesh( configuration, & +subroutine init_mesh( config, & 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(config_type), intent(in) :: config integer(kind=i_def), intent(in) :: local_rank integer(kind=i_def), intent(in) :: total_ranks @@ -107,9 +109,9 @@ subroutine init_mesh( configuration, & integer(kind=i_def), parameter :: src = 2 ! 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,38 +133,34 @@ 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') - - call lfric2lfric_nml%get_value( 'prepartitioned_meshes', & - prepartitioned ) - call lfric2lfric_nml%get_value( 'destination_meshfile_prefix', & - meshfile_prefix(dst) ) - call lfric2lfric_nml%get_value( 'destination_geometry', & - geometry(dst) ) - call lfric2lfric_nml%get_value( 'destination_topology', & - topology(dst) ) - call lfric2lfric_nml%get_value( 'source_meshfile_prefix', & - meshfile_prefix(src) ) - call lfric2lfric_nml%get_value( 'source_geometry', & - geometry(src) ) - call lfric2lfric_nml%get_value( 'source_topology', & - topology(src) ) + prepartitioned = config%lfric2lfric%prepartitioned_meshes() + meshfile_prefix(src) = config%lfric2lfric%source_meshfile_prefix() + meshfile_prefix(dst) = config%lfric2lfric%destination_meshfile_prefix() + geometry(src) = config%lfric2lfric%source_geometry() + geometry(dst) = config%lfric2lfric%destination_geometry() + topology(src) = config%lfric2lfric%source_topology() + topology(dst) = config%lfric2lfric%destination_topology() if ( regrid_method == regrid_method_map .and. & trim(meshfile_prefix(src)) /= trim(meshfile_prefix(dst)) ) then @@ -231,7 +229,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 c40c5cc3..c7c4ff8d 100644 --- a/applications/lfric2lfric/source/lfric2lfric.F90 +++ b/applications/lfric2lfric/source/lfric2lfric.F90 @@ -48,7 +48,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 +67,10 @@ 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 ) + 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 e77c16dd..1ccb377f 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, str_max_filename 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 @@ -27,30 +28,27 @@ 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, final_timing, & start_timing, stop_timing, & tik, LPROF - use io_config_mod, only: timer_output_path implicit none ! Model run working data set type(modeldb_type) :: modeldb - character(*), parameter :: application_name = "lfric_atm" - character(:), allocatable :: filename - integer(tik) :: id_setup - type(namelist_type), pointer :: io_nml + character(*), parameter :: application_name = "lfric_atm" + character(:), allocatable :: filename + integer(tik) :: id_setup - logical :: lsubroutine_timers + character(str_max_filename) :: timer_output_path + logical(l_def) :: subroutine_timers call parse_command_line( filename ) 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 @@ -74,26 +72,31 @@ program lfric_atm call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), application_name ) - io_nml => modeldb%configuration%get_namelist('io') - call io_nml%get_value('subroutine_timers', lsubroutine_timers) - call init_timing( modeldb%mpi%get_comm(), lsubroutine_timers, application_name, timer_output_path ) - nullify( io_nml ) - if ( LPROF ) call start_timing( id_setup, '__setup__' ) + subroutine_timers = modeldb%config%io%subroutine_timers() + timer_output_path = modeldb%config%io%timer_output_path() + + call init_timing( modeldb%mpi%get_comm(), subroutine_timers, & + application_name, timer_output_path ) + if ( LPROF ) call start_timing( id_setup, '__setup__ ') call init_collections() call init_time( modeldb ) call init_counters( application_name ) + call initialise( application_name, modeldb ) + deallocate( filename ) - call initialise( application_name, modeldb ) if ( LPROF ) call stop_timing( id_setup, '__setup__' ) + do while (modeldb%clock%tick()) call step( modeldb ) end do + call finalise( application_name, modeldb ) call final_counters( application_name ) diff --git a/applications/lfric_coupled/source/lfric_coupled.f90 b/applications/lfric_coupled/source/lfric_coupled.f90 index 2f22b8bc..25d6e1b6 100644 --- a/applications/lfric_coupled/source/lfric_coupled.f90 +++ b/applications/lfric_coupled/source/lfric_coupled.f90 @@ -17,6 +17,7 @@ program lfric_coupled use cli_mod, only : parse_command_line + use constants_mod, only : l_def, str_max_filename use coupler_mod, only : set_cpl_name use driver_collections_mod, only : init_collections, final_collections use driver_comm_mod, only : init_comm, final_comm @@ -27,27 +28,25 @@ program lfric_coupled use gungho_driver_mod, only : initialise, step, finalise use driver_modeldb_mod, only : modeldb_type use lfric_mpi_mod, only : global_mpi - use namelist_mod, only: namelist_type use timing_mod, only: init_timing, final_timing - use io_config_mod, only: timer_output_path implicit none ! Model run working data set type(modeldb_type) :: modeldb - character(*), parameter :: application_name = "lfric_coupled" - character(*), parameter :: cpl_component_name = "lfric" - character(:), allocatable :: filename - type(namelist_type), pointer :: io_nml - logical :: lsubroutine_timers + character(*), parameter :: application_name = "lfric_coupled" + character(*), parameter :: cpl_component_name = "lfric" + character(:), allocatable :: filename + + character(str_max_filename) :: timer_output_path + logical(l_def) :: subroutine_timers call parse_command_line( filename ) 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 @@ -71,12 +70,16 @@ program lfric_coupled call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), application_name ) - io_nml => modeldb%configuration%get_namelist('io') - call io_nml%get_value('subroutine_timers', lsubroutine_timers) - call init_timing( modeldb%mpi%get_comm(), lsubroutine_timers, application_name, timer_output_path ) - nullify( io_nml ) + + subroutine_timers = modeldb%config%io%subroutine_timers() + timer_output_path = modeldb%config%io%timer_output_path() + + call init_timing( modeldb%mpi%get_comm(), subroutine_timers, & + application_name, timer_output_path ) + 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 a0630d7b..770f9fae 100644 --- a/applications/lfricinputs/source/common/lfricinp_lfric_driver_mod.f90 +++ b/applications/lfricinputs/source/common/lfricinp_lfric_driver_mod.f90 @@ -12,6 +12,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 @@ -40,8 +41,6 @@ module lfricinp_lfric_driver_mod use linked_list_mod, only: linked_list_type 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 step_calendar_mod, only: step_calendar_type ! Interface to mpi @@ -115,12 +114,7 @@ subroutine lfricinp_initialise_lfric(program_name_arg, & class(event_actor_type), pointer :: event_actor_ptr procedure(event_action), pointer :: context_advance - -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 @@ -163,9 +157,10 @@ subroutine lfricinp_initialise_lfric(program_name_arg, & !Initialise halo functionality 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 ) + config=config ) ! Initialise logging system call init_logger( comm, program_name ) @@ -184,16 +179,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 @@ -234,7 +225,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,12 +271,12 @@ end subroutine lfricinp_initialise_lfric !------------------------------------------------------------------ subroutine load_configuration( lfric_nl, required_lfric_namelists, & - 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 +284,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 +295,7 @@ 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, 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 8ba21132..8462b66d 100644 --- a/applications/linear_model/source/linear_model.f90 +++ b/applications/linear_model/source/linear_model.f90 @@ -15,6 +15,7 @@ program linear_model use cli_mod, only : parse_command_line + use constants_mod, only : l_def, str_max_filename 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 @@ -27,26 +28,24 @@ program linear_model use log_mod, only : log_event, & log_level_trace, & log_scratch_space - use namelist_mod, only: namelist_type use timing_mod, only: init_timing, final_timing - use io_config_mod, only: timer_output_path implicit none ! Model run working data set type (modeldb_type) :: modeldb - character(*), parameter :: application_name = "linear_model" - character(:), allocatable :: filename - type(namelist_type), pointer :: io_nml - logical :: lsubroutine_timers + character(*), parameter :: application_name = "linear_model" + character(:), allocatable :: filename + + character(str_max_filename) :: timer_output_path + logical(l_def) :: subroutine_timers call parse_command_line( filename ) 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,12 +66,15 @@ program linear_model call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - modeldb%configuration ) + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), application_name ) - io_nml => modeldb%configuration%get_namelist('io') - call io_nml%get_value('subroutine_timers', lsubroutine_timers) - call init_timing( modeldb%mpi%get_comm(), lsubroutine_timers, application_name, timer_output_path ) - nullify( io_nml ) + + subroutine_timers = modeldb%config%io%subroutine_timers() + timer_output_path = modeldb%config%io%timer_output_path() + call init_timing( modeldb%mpi%get_comm(), subroutine_timers, & + application_name, timer_output_path ) + call init_collections() call init_time( modeldb ) deallocate( filename ) 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 60d5ae6c..07034982 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, & @@ -124,38 +123,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 @@ -240,11 +223,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/kernel/set_name_field_kernel_mod.F90 b/applications/name_transport/source/kernel/set_name_field_kernel_mod.F90 index b0a58ca5..453a1cc1 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/source/name_transport.f90 b/applications/name_transport/source/name_transport.f90 index c7e5343e..21bc1fa0 100644 --- a/applications/name_transport/source/name_transport.f90 +++ b/applications/name_transport/source/name_transport.f90 @@ -10,7 +10,7 @@ program name_transport use cli_mod, only: parse_command_line - use constants_mod, only: i_def, r_def + use constants_mod, only: i_def, r_def, l_def, str_max_filename 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 @@ -23,30 +23,31 @@ program name_transport log_level_info, & log_level_trace, & log_scratch_space - use namelist_collection_mod, only: namelist_collection_type - use name_transport_mod, only: name_transport_required_namelists use name_transport_driver_mod, only: initialise_name_transport, & step_name_transport, & finalise_name_transport - use namelist_mod, only: namelist_type use timing_mod, only: init_timing, final_timing - use io_config_mod, only: timer_output_path + implicit none type(modeldb_type) :: modeldb + character(*), parameter :: program_name = "name_transport" character(:), allocatable :: filename - type(namelist_type), pointer :: io_nml - logical :: lsubroutine_timers + + character(str_max_filename) :: timer_output_path + logical(l_def) :: subroutine_timers 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 ) + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), program_name ) call log_event( 'Miniapp will run with default precision set as:', & @@ -56,10 +57,12 @@ program name_transport write(log_scratch_space, '(" i_def kind = ", I0)') kind(1_i_def) call log_event( log_scratch_space , log_level_info ) - io_nml => modeldb%configuration%get_namelist('io') - call io_nml%get_value('subroutine_timers', lsubroutine_timers) - call init_timing( modeldb%mpi%get_comm(), lsubroutine_timers, program_name, timer_output_path ) - nullify( io_nml ) + subroutine_timers = modeldb%config%io%subroutine_timers() + timer_output_path = modeldb%config%io%timer_output_path() + + call init_timing( modeldb%mpi%get_comm(), subroutine_timers, & + program_name, timer_output_path ) + call init_collections() call init_time( modeldb ) deallocate( filename ) 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 9cd49a2b..3882ca46 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 7ae24e5d..2d78428c 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 @@ -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 29a1c761..e239659e 100644 --- a/applications/ngarch/source/ngarch.f90 +++ b/applications/ngarch/source/ngarch.f90 @@ -9,8 +9,8 @@ program ngarch use cli_mod, only : parse_command_line + use constants_mod, only : l_def, str_max_filename, precision_real use driver_collections_mod, only : init_collections, final_collections - use constants_mod, only : precision_real use driver_comm_mod, only : init_comm, final_comm use driver_config_mod, only : init_config, final_config use driver_log_mod, only : init_logger, final_logger @@ -20,9 +20,7 @@ program ngarch use log_mod, only : log_event, & log_level_trace, & log_scratch_space - use namelist_mod, only : namelist_type use timing_mod, only : init_timing, final_timing - use io_config_mod, only : timer_output_path use ngarch_mod, only : ngarch_required_namelists use gungho_driver_mod, only : initialise, finalise, step @@ -31,15 +29,17 @@ program ngarch implicit none ! The technical and scientific state - type( modeldb_type ) :: modeldb - character(*), parameter :: application_name = "ngarch" - character(:), allocatable :: filename - type(namelist_type), pointer :: io_nml - logical :: lsubroutine_timers + type( modeldb_type ) :: modeldb + + character(*), parameter :: application_name = "ngarch" + character(:), allocatable :: filename + + character(str_max_filename) :: timer_output_path + logical(l_def) :: subroutine_timers 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 @@ -60,19 +60,21 @@ program ngarch call modeldb%io_contexts%initialise(application_name, 100) - 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, & + config=modeldb%config ) deallocate( filename ) call init_logger( modeldb%mpi%get_comm(), application_name ) - io_nml => modeldb%configuration%get_namelist('io') - call io_nml%get_value('subroutine_timers', lsubroutine_timers) - call init_timing( modeldb%mpi%get_comm(), lsubroutine_timers, application_name, timer_output_path ) - nullify( io_nml ) + + subroutine_timers = modeldb%config%io%subroutine_timers() + timer_output_path = modeldb%config%io%timer_output_path() + + call init_timing( modeldb%mpi%get_comm(), subroutine_timers, & + application_name, timer_output_path ) + call init_collections() call init_time( modeldb ) 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 f2706ce9..ad59e139 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 @@ -181,7 +167,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/kernel/initial_swe_streamfunc_kernel_mod.F90 b/applications/shallow_water/source/kernel/initial_swe_streamfunc_kernel_mod.F90 index 26df19f6..b9221ca8 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 fbad6cef..6d93ab3d 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 4cb12608..f5a5b5c2 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,13 @@ 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 finite_element_config_mod, only: coord_system + use planet_config_mod, only: scaled_radius, scaled_omega implicit none @@ -165,7 +166,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/source/shallow_water.f90 b/applications/shallow_water/source/shallow_water.f90 index 05f686f7..7dffed65 100644 --- a/applications/shallow_water/source/shallow_water.f90 +++ b/applications/shallow_water/source/shallow_water.f90 @@ -30,9 +30,8 @@ program shallow_water use shallow_water_driver_mod, only: initialise, & step, & finalise - use namelist_mod, only: namelist_type use timing_mod, only: init_timing, final_timing - use io_config_mod, only: timer_output_path + use constants_mod, only: l_def, str_max_filename implicit none @@ -42,14 +41,14 @@ program shallow_water type(modeldb_type) :: modeldb character(:), allocatable :: filename - type(namelist_type), pointer :: io_nml - logical :: lsubroutine_timers + logical(l_def) :: subroutine_timers + character(str_max_filename) :: timer_output_path call parse_command_line( filename ) 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", & @@ -63,13 +62,17 @@ 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 ) + config=modeldb%config ) call init_logger( global_mpi%get_comm(), program_name ) - io_nml => modeldb%configuration%get_namelist('io') - call io_nml%get_value('subroutine_timers', lsubroutine_timers) - call init_timing( modeldb%mpi%get_comm(), lsubroutine_timers, program_name, timer_output_path ) - nullify( io_nml ) + + subroutine_timers = modeldb%config%io%subroutine_timers() + timer_output_path = modeldb%config%io%timer_output_path() + + call init_timing( modeldb%mpi%get_comm(), subroutine_timers, & + program_name, timer_output_path ) + call init_counters( program_name ) call init_collections() call init_time( modeldb ) 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 a985748e..b6ef9f97 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 3fe39d2b..ae0fc9ec 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 3a773ccf..be54919c 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 5e1740da..7bd513ee 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 20365147..3ee3b918 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 fe44262b..b91d12b3 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 @@ -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 3c69d79c..443b59ec 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 @@ -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 29103cf7..98c9162e 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 @@ -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 84610587..04fb51fa 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,15 +96,15 @@ 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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 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 aa6e2d9f..d848994a 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/shallow_water/unit-test/kernel/temp b/applications/shallow_water/unit-test/kernel/temp new file mode 100644 index 00000000..df4dd1ad --- /dev/null +++ b/applications/shallow_water/unit-test/kernel/temp @@ -0,0 +1,5 @@ +geometry_planar, topology_fully_periodic + +geometry_spherical, topology_non_periodic + +geometry_spherical, topology_fully_periodic diff --git a/applications/solver/source/solver.F90 b/applications/solver/source/solver.F90 index 9c06cb22..28fad170 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, & @@ -43,11 +44,8 @@ program solver LOG_LEVEL_INFO 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 !------------------------------------ @@ -59,7 +57,7 @@ program solver character(*), parameter :: program_name = '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 +78,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 @@ -116,10 +110,13 @@ program solver total_ranks = global_mpi%get_comm_size() 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 ) + config=config ) + call init_logger( comm, program_name ) + call init_collections() deallocate( filename ) @@ -132,24 +129,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 !======================================================================= @@ -185,9 +173,8 @@ program solver !----------------------------------------------------------------------- stencil_depth = 1 check_partitions = .false. - call init_mesh( configuration, & - local_rank, total_ranks, & - base_mesh_names, extrusion, & + call init_mesh( config, local_rank, total_ranks, & + base_mesh_names, extrusion, & stencil_depth, check_partitions ) allocate( twod_names, source=base_mesh_names ) diff --git a/applications/transport/source/driver/transport_driver_mod.f90 b/applications/transport/source/driver/transport_driver_mod.f90 index c21bb94b..053d7ef4 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 timing_mod, only: start_timing, stop_timing, & tik, LPROF @@ -143,58 +142,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 @@ -291,7 +265,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/kernel/set_tracer_field_kernel_mod.F90 b/applications/transport/source/kernel/set_tracer_field_kernel_mod.F90 index 7e06eaea..e6cd86ab 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/source/transport.f90 b/applications/transport/source/transport.f90 index 54369eee..d36db851 100644 --- a/applications/transport/source/transport.f90 +++ b/applications/transport/source/transport.f90 @@ -9,7 +9,7 @@ program transport use cli_mod, only: parse_command_line - use constants_mod, only: i_def, r_def + use constants_mod, only: i_def, r_def, l_def, str_max_filename 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 @@ -20,10 +20,7 @@ program transport use log_mod, only: log_event, & log_level_trace, & log_scratch_space - use namelist_collection_mod, only: namelist_collection_type - use namelist_mod, only: namelist_type use timing_mod, only: init_timing, final_timing - use io_config_mod, only: timer_output_path use transport_mod, only: transport_required_namelists use transport_driver_mod, only: initialise_transport, & step_transport, & @@ -34,16 +31,20 @@ program transport type(modeldb_type) :: modeldb character(*), parameter :: program_name = "transport" character(:), allocatable :: filename - type(namelist_type), pointer :: io_nml - logical :: lsubroutine_timers + + logical(l_def) :: subroutine_timers + character(str_max_filename) :: timer_output_path 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 ) + config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), program_name ) call log_event( 'Miniapp will run with default precision set as:', & @@ -53,10 +54,12 @@ program transport write(log_scratch_space, '(" i_def kind = ", I0)') kind(1_i_def) call log_event( log_scratch_space , log_level_trace ) - io_nml => modeldb%configuration%get_namelist('io') - call io_nml%get_value('subroutine_timers', lsubroutine_timers) - call init_timing( modeldb%mpi%get_comm(), lsubroutine_timers, program_name, timer_output_path ) - nullify( io_nml ) + subroutine_timers = modeldb%config%io%subroutine_timers() + timer_output_path = modeldb%config%io%timer_output_path() + + call init_timing( modeldb%mpi%get_comm(), subroutine_timers, & + program_name, timer_output_path ) + call init_collections() call init_time( modeldb ) deallocate( filename ) 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 9628fa39..2b000cb9 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 7fcd8dc1..308ac4df 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 @@ -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 04e00da1..100151ca 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 @@ -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/dependencies.yaml b/dependencies.yaml index 136ad863..e0fbfd8c 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: bbb3d8a69a2671df93859f617bbe336c6715476f + source: git@github.com:mo-rickywong/lfric_core.git + ref: IntermediateApiFullPurge 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 3f75a4c8..4fd52cb4 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,7 +10,8 @@ !! jedi_lfric_time_test.py. program jedi_lfric_time_test - use configuration_mod, only : final_configuration, & + use config_mod, only : config_type + use config_loader_mod, only : final_configuration, & read_configuration use constants_mod, only : i_def, r_def, l_def use halo_comms_mod, only : initialise_halo_comms, & @@ -39,7 +40,6 @@ program jedi_lfric_time_test finalise_logging, & LOG_LEVEL_ERROR, & LOG_LEVEL_INFO - use namelist_collection_mod, only : namelist_collection_type implicit none @@ -51,7 +51,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 @@ -171,8 +171,10 @@ program jedi_lfric_time_test end select ! 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, config=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 c7d2bb14..632fd322 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 @@ -68,7 +68,6 @@ module jedi_lfric_linear_modeldb_driver_mod use linear_step_mod, only : linear_step use mesh_mod, only : mesh_type use mesh_collection_mod, only : mesh_collection - use namelist_mod, only : namelist_type implicit none @@ -102,9 +101,6 @@ subroutine initialise_modeldb( modeldb_name, filename, mpi_obj, modeldb, atl_si_ type( mesh_type ), pointer :: twod_mesh 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( lfric_xios_context_type ), pointer :: io_context character( len=str_def ) :: prime_mesh_name character( len=str_def ) :: aerosol_mesh_name @@ -114,12 +110,10 @@ subroutine initialise_modeldb( modeldb_name, filename, mpi_obj, modeldb, atl_si_ character(len=*), parameter :: io_context_name = "gungho_atm" nullify( mesh, twod_mesh, aerosol_mesh, aerosol_twod_mesh ) - nullify( base_mesh_nml, multires_coupling_nml, initialization_nml ) ! 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 +133,7 @@ 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 ) + 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 ) @@ -156,24 +150,18 @@ subroutine initialise_modeldb( modeldb_name, filename, mpi_obj, modeldb, atl_si_ ! 3. Setup the required mesh's and create the modeldb fields ! 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 aerosol ancillary configuration logical - 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 ) + coarse_aerosol_ancil = modeldb%config%initialization%coarse_aerosol_ancil() + coarse_ozone_ancil = modeldb%config%initialization%coarse_ozone_ancil() + 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 => mesh_collection%get_mesh(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() @@ -208,7 +196,7 @@ subroutine initialise_modeldb( modeldb_name, filename, mpi_obj, modeldb, atl_si_ ! Close IO context and clock so that it is not linked to XIOS call modeldb%io_contexts%get_io_context(io_context_name, io_context) - call io_context%finalise_xios_context() + call io_context%finalise_xios_context() call final_time( modeldb ) call log_event( "end of initialise_modeldb: initialise_linear_model", & @@ -230,10 +218,9 @@ subroutine step_tl( modeldb ) logical( kind=l_def ) :: clock_running type( mesh_type ), pointer :: mesh type( mesh_type ), pointer :: twod_mesh - type( namelist_type ), pointer :: base_mesh_nml character( len=str_def ) :: prime_mesh_name - nullify(mesh, twod_mesh, base_mesh_nml) + nullify(mesh, twod_mesh) ! 1. Tick the clock and check its still running clock_running = modeldb%clock%tick() @@ -246,8 +233,7 @@ subroutine step_tl( 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) 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 6d1405ba..5d4df794 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 @@ -35,7 +35,6 @@ module jedi_lfric_nl_modeldb_driver_mod log_scratch_space, & LOG_LEVEL_TRACE, & LOG_LEVEL_ERROR - use namelist_mod, only : namelist_type implicit none @@ -66,8 +65,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 +87,7 @@ 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 ) + config=modeldb%config ) ! 3. Initialise the clock and calendar call init_time( modeldb ) diff --git a/interfaces/jedi_lfric_interface/source/io/jedi_lfric_io_setup_mod.F90 b/interfaces/jedi_lfric_interface/source/io/jedi_lfric_io_setup_mod.F90 index ec58daee..44784aa3 100644 --- a/interfaces/jedi_lfric_interface/source/io/jedi_lfric_io_setup_mod.F90 +++ b/interfaces/jedi_lfric_interface/source/io/jedi_lfric_io_setup_mod.F90 @@ -23,9 +23,6 @@ module jedi_lfric_io_setup_mod use mesh_mod, only: mesh_type use mesh_collection_mod, only: mesh_collection use model_clock_mod, only: model_clock_type - use namelist_collection_mod, only: namelist_collection_type - use namelist_mod, only: namelist_type - use jedi_lfric_file_meta_mod, only: jedi_lfric_file_meta_type use jedi_lfric_init_files_mod, only: jedi_lfric_init_files diff --git a/interfaces/jedi_lfric_interface/source/linear_model_interface_utilities/jedi_lfric_wind_fields_mod.f90 b/interfaces/jedi_lfric_interface/source/linear_model_interface_utilities/jedi_lfric_wind_fields_mod.f90 index 889d2784..b8eb37d8 100644 --- a/interfaces/jedi_lfric_interface/source/linear_model_interface_utilities/jedi_lfric_wind_fields_mod.f90 +++ b/interfaces/jedi_lfric_interface/source/linear_model_interface_utilities/jedi_lfric_wind_fields_mod.f90 @@ -25,7 +25,6 @@ module jedi_lfric_wind_fields_mod LOG_LEVEL_DEBUG use mesh_collection_mod, only : mesh_collection use mesh_mod, only : mesh_type - use namelist_mod, only : namelist_type use pure_abstract_field_mod, only : pure_abstract_field_type implicit none @@ -62,10 +61,11 @@ subroutine create_scalar_winds( modeldb, mesh ) type( field_collection_type ), pointer :: prognostic_fields type( function_space_type ), pointer :: w3_fs type( function_space_type ), pointer :: wtheta_fs - type( namelist_type ), pointer :: base_mesh_nml - character( len=str_def ) :: prime_mesh_name - integer( kind=i_def ), parameter :: element_order_h = 0_i_def - integer( kind=i_def ), parameter :: element_order_v = 0_i_def + + character(str_def) :: prime_mesh_name + + integer(i_def), parameter :: element_order_h = 0_i_def + integer(i_def), parameter :: element_order_v = 0_i_def ! Temporary fields to create prognostics type( field_type ) :: u_in_w3 @@ -76,14 +76,13 @@ subroutine create_scalar_winds( modeldb, mesh ) LOG_LEVEL_DEBUG ) nullify( mesh, field_ptr, tmp_ptr, depository, prognostic_fields ) - nullify( wtheta_fs, w3_fs, base_mesh_nml ) + nullify( wtheta_fs, w3_fs ) depository => modeldb%fields%get_field_collection("depository") prognostic_fields => modeldb%fields%get_field_collection("prognostic_fields") ! Get the 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) ! Create prognostic fields 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 24665d5b..1b7e51a2 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 @@ -21,8 +22,6 @@ module jedi_lfric_mesh_setup_mod use log_mod, only: log_event, & log_scratch_space, & LOG_LEVEL_ERROR - use namelist_collection_mod, only: namelist_collection_type - use namelist_mod, only: namelist_type implicit none @@ -35,24 +34,21 @@ module jedi_lfric_mesh_setup_mod !> @brief Initialise the mesh and store it in the global mesh collection !> !> @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, 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 character(len=*), optional, intent(in) :: alt_mesh_name ! Local - type(namelist_type), pointer :: base_mesh_nml - type(namelist_type), pointer :: extrusion_nml - type(namelist_type), pointer :: planet_nml class(extrusion_type), allocatable :: extrusion type(uniform_extrusion_type), allocatable :: extrusion_2d @@ -73,17 +69,12 @@ subroutine initialise_mesh( mesh_name, configuration, mpi_obj, alt_mesh_name ) !-------------------------------------- ! 0.0 Extract namelist variables !-------------------------------------- - nullify(base_mesh_nml, planet_nml, extrusion_nml) - 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( '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 = config%base_mesh%prime_mesh_name() + geometry = config%base_mesh%geometry() + domain_height = config%extrusion%domain_height() + extrusion_method = config%extrusion%method() + number_of_layers = config%extrusion%number_of_layers() + scaled_radius = config%planet%scaled_radius() !-------------------------------------- ! 1.0 Create the meshes @@ -124,7 +115,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/interfaces/jedi_lfric_interface/source/time/jedi_lfric_timestep_mod.f90 b/interfaces/jedi_lfric_interface/source/time/jedi_lfric_timestep_mod.f90 index b74f709d..691607b2 100644 --- a/interfaces/jedi_lfric_interface/source/time/jedi_lfric_timestep_mod.f90 +++ b/interfaces/jedi_lfric_interface/source/time/jedi_lfric_timestep_mod.f90 @@ -9,10 +9,9 @@ !> module jedi_lfric_timestep_mod + use config_mod, only : config_type use constants_mod, only : i_timestep, r_second use jedi_lfric_duration_mod, only : jedi_duration_type - use namelist_collection_mod, only : namelist_collection_type - use namelist_mod, only : namelist_type implicit none @@ -23,22 +22,20 @@ module jedi_lfric_timestep_mod !> @brief Get time step from the configuration object !> - !> @param [in] configuration The configuration to extract timestep from - function get_configuration_timestep( configuration ) result(timestep) + !> @param [in] config The configuration to extract timestep from + function get_configuration_timestep( config ) result(timestep) implicit none - type( namelist_collection_type ), intent(in) :: configuration + type( config_type ), intent(in) :: config type( jedi_duration_type ) :: timestep ! Local - type( namelist_type ), pointer :: timestepping_nml - real( kind=r_second ) :: dt + real( kind=r_second ) :: dt ! Get configuration time-step - timestepping_nml => configuration%get_namelist('timestepping') - call timestepping_nml%get_value( 'dt', dt ) + dt = config%timestepping%dt() call timestep%init( int(dt, i_timestep) ) end function get_configuration_timestep 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 c82ba1b0..78961208 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 b4564ee1..85bcc553 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,22 @@ -@@ -1,11 +1,12 @@ +@@ -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 +36,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 +46,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 9707453f..a8d45593 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 2e526c9d..20441d4e 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/adjoint/source/algorithm/timestepping/atl_si_timestep_alg_mod.x90 b/science/adjoint/source/algorithm/timestepping/atl_si_timestep_alg_mod.x90 index 66f9894d..7ea36087 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 @@ -330,8 +327,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() ) @@ -628,8 +624,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/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 86f1ffce..19010855 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 2797865d..4fa3d055 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 constants_mod, only : i_def, r_def, i_def, l_def, & - r_solver, pi, str_def + use config_mod, only : config_type + use constants_mod, only : i_def, r_def, i_def, l_def, & + r_solver, pi, str_def, imdi, & + str_max_filename use derived_config_mod, only : set_derived_config use extrusion_mod, only : extrusion_type, & uniform_extrusion_type, & @@ -40,7 +42,7 @@ program cma_test use function_space_mod, only : function_space_type use halo_comms_mod, only : initialise_halo_comms, & finalise_halo_comms - use configuration_mod, only : read_configuration, & + use config_loader_mod, only : read_configuration, & ensure_configuration use driver_collections_mod, only : init_collections, final_collections use driver_mesh_mod, only : init_mesh @@ -56,9 +58,6 @@ program cma_test LOG_LEVEL_INFO 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 @@ -124,14 +123,11 @@ program cma_test logical :: do_test_diag_dhmdht = .false. ! 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 @@ -231,7 +227,7 @@ program cma_test call log_event( "Unknown test", LOG_LEVEL_ERROR ) end select - call configuration%initialise( program_name, table_len=10 ) + call config%initialise( program_name ) deallocate(program_name) deallocate(test_flag) @@ -243,7 +239,7 @@ 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, config=config ) okay = ensure_configuration( required_configuration, success_map ) if (.not. okay) then @@ -262,19 +258,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 @@ -291,7 +283,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 ) @@ -307,7 +300,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/algorithm/limited_area/init_gungho_lbcs_alg_mod.x90 b/science/gungho/source/algorithm/limited_area/init_gungho_lbcs_alg_mod.x90 index 38ba5174..c1214460 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 @@ -7,6 +7,7 @@ !> @brief Initialisation of analytical LBC fields. module init_gungho_lbcs_alg_mod + use config_mod, only: config_type use constants_mod, only: i_def, r_def, str_def, l_def use driver_modeldb_mod, only: modeldb_type use field_mod, only: field_type @@ -30,8 +31,6 @@ module init_gungho_lbcs_alg_mod use lfric_xios_read_mod, only: read_state use mesh_mod, only: mesh_type use model_clock_mod, only: model_clock_type - use namelist_collection_mod, only: namelist_collection_type - use namelist_mod, only: namelist_type use variable_fields_mod, only: init_variable_fields, & update_variable_fields use linked_list_mod, only: linked_list_type @@ -92,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 ) @@ -155,23 +147,22 @@ module init_gungho_lbcs_alg_mod !> @brief Read the time-varying LBCs from a file. !> @details Initialise the LBCs, that are read in and updated using !! a time-axis. - !> @param[in] configuration The application configuration object + !> @param[in] config The application configuration object !> @param[in] lbc_times_list The LBC time axis list !> @param[in] clock Clock !> @param[in,out] lbc_fields The LBC field collection - subroutine init_lbcs_file_alg( configuration, lbc_times_list, clock, lbc_fields ) + subroutine init_lbcs_file_alg( config, lbc_times_list, clock, lbc_fields ) implicit none - type(namelist_collection_type), intent(in) :: configuration - type(field_collection_type), intent(inout) :: lbc_fields - type(linked_list_type), intent(in) :: lbc_times_list - class(model_clock_type), intent(in) :: clock - type(field_type), pointer :: lbc_v_u - integer(tik) :: id + type(config_type), intent(in) :: config + type(field_collection_type), intent(inout) :: lbc_fields + type(linked_list_type), intent(in) :: lbc_times_list + class(model_clock_type), intent(in) :: clock + type(field_type), pointer :: lbc_v_u + integer(tik) :: id - type(namelist_type), pointer :: initialization_nml - integer(i_def) :: lbc_option + integer(i_def) :: lbc_option if ( LPROF ) call start_timing( id, 'init_lbcs' ) @@ -183,8 +174,7 @@ module init_gungho_lbcs_alg_mod if ( clock%is_initialisation() ) then - initialization_nml => configuration%get_namelist('initialization') - call initialization_nml%get_value( 'lbc_option', lbc_option ) + lbc_option = config%initialization%lbc_option() ! Map to derived fields, e.g. winds in W2H and Wtheta to W2 select case( lbc_option ) @@ -195,14 +185,14 @@ module init_gungho_lbcs_alg_mod call lbc_fields%get_field( 'lbc_v_u', lbc_v_u ) call invoke( setval_c(lbc_v_u, 0.0_r_def) ) call combine_lbc_winds( lbc_fields, extensive=.false. ) - call map_lbc_inputs( configuration, lbc_fields ) + call map_lbc_inputs( config, lbc_fields ) case default call log_event('This lbc_option not available', LOG_LEVEL_INFO) end select ! Define boundary_u_driving - call define_boundary_u( configuration, lbc_fields ) + call define_boundary_u( config, lbc_fields ) end if @@ -214,23 +204,22 @@ module init_gungho_lbcs_alg_mod !> @brief Update the time-varying LBCs from a file. !> @details Update the LBCs, that are read in and updated using !! a time-axis - !> @param[in] configuration The application configuration object + !> @param[in] config The application configuration object !> @param[in] lbc_times_list The LBC time axis list !> @param[in] clock Clock !> @param[in,out] lbc_fields The LBC field collection - subroutine update_lbcs_file_alg( configuration, lbc_times_list, clock, lbc_fields ) + subroutine update_lbcs_file_alg( config, lbc_times_list, clock, lbc_fields ) implicit none - type(namelist_collection_type), intent(in) :: configuration - type(field_collection_type), intent(inout) :: lbc_fields - type(linked_list_type), intent(in) :: lbc_times_list - class(model_clock_type), intent(in) :: clock - type(field_type), pointer :: lbc_v_u - integer(tik) :: id + type(config_type), intent(in) :: config + type(field_collection_type), intent(inout) :: lbc_fields + type(linked_list_type), intent(in) :: lbc_times_list + class(model_clock_type), intent(in) :: clock + type(field_type), pointer :: lbc_v_u + integer(tik) :: id - type(namelist_type), pointer :: initialization_nml - integer(i_def) :: lbc_option + integer(i_def) :: lbc_option if ( LPROF ) call start_timing( id, 'update_lbcs' ) @@ -239,8 +228,7 @@ module init_gungho_lbcs_alg_mod call update_variable_fields( lbc_times_list, & clock,lbc_fields ) - initialization_nml => configuration%get_namelist('initialization') - call initialization_nml%get_value( 'lbc_option', lbc_option ) + lbc_option = config%initialization%lbc_option() ! Map to derived fields, e.g. winds in W2H and Wtheta to W2 select case( lbc_option ) @@ -251,14 +239,14 @@ module init_gungho_lbcs_alg_mod call lbc_fields%get_field( 'lbc_v_u', lbc_v_u ) call invoke( setval_c(lbc_v_u, 0.0_r_def) ) call combine_lbc_winds( lbc_fields, extensive=.false. ) - call map_lbc_inputs( configuration, lbc_fields ) + call map_lbc_inputs( config, lbc_fields ) case default call log_event('This lbc_option not available', LOG_LEVEL_INFO) end select ! Define boundary_u_driving - call define_boundary_u( configuration, lbc_fields ) + call define_boundary_u( config, lbc_fields ) if ( LPROF ) call stop_timing( id, 'update_lbcs' ) @@ -315,14 +303,15 @@ module init_gungho_lbcs_alg_mod !> @brief Define the LBC wind on the solver boundary !> @details Define boundary_u by applying the w2_boundary_mask !! to lbc_u - !> @param[in] configuration The application configuration object + !> @param[in] config The application configuration object !> @param[in,out] lbc_fields The collection of lbc fields - subroutine define_boundary_u( configuration, lbc_fields ) + subroutine define_boundary_u( config, lbc_fields ) implicit none - type(namelist_collection_type), intent(in) :: configuration - type( field_collection_type ), intent(inout) :: lbc_fields + type(config_type), intent(in) :: config + type(field_collection_type), intent(inout) :: lbc_fields + type( field_type ), pointer :: lbc_field type( field_type ), pointer :: boundary_u type( field_type ), pointer :: w2_boundary_mask @@ -330,11 +319,9 @@ module init_gungho_lbcs_alg_mod type( mesh_type ), pointer :: mesh - type(namelist_type), pointer :: base_mesh_nml - character(len=str_def) :: prime_mesh_name + character(len=str_def) :: prime_mesh_name - base_mesh_nml => configuration%get_namelist('base_mesh') - call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) + prime_mesh_name = config%base_mesh%prime_mesh_name() call lbc_fields%get_field( 'lbc_u', lbc_field ) call lbc_fields%get_field( 'boundary_u_driving', boundary_u ) @@ -366,7 +353,7 @@ module init_gungho_lbcs_alg_mod !> these accordingly. !> @param[in] configuration The application configuration object !> @param[in,out] lbc_fields The collection of lbc fields - subroutine map_lbc_inputs( configuration, lbc_fields ) + subroutine map_lbc_inputs( config, lbc_fields ) use map_fd_to_prognostics_alg_mod, only: hydrostatic_balance use map_um_lbc_inputs_alg_mod, only: map_um_lbc_inputs @@ -377,8 +364,8 @@ module init_gungho_lbcs_alg_mod implicit none - type(namelist_collection_type), intent(in) :: configuration - type( field_collection_type ), intent(inout) :: lbc_fields + type(config_type), intent(in) :: config + type(field_collection_type), intent(inout) :: lbc_fields type(field_type), pointer :: lbc_rho_r2 type(field_type), pointer :: lbc_rho @@ -410,20 +397,14 @@ module init_gungho_lbcs_alg_mod integer(i_def) :: lbc_eos_height - type(namelist_type), pointer :: boundaries_nml - type(namelist_type), pointer :: base_mesh_nml - character(len=str_def) :: prime_mesh_name - - base_mesh_nml => configuration%get_namelist('base_mesh') - call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) + character(len=str_def) :: prime_mesh_name nullify( lbc_rho_r2, lbc_rho, lbc_q, lbc_qcl, lbc_qcf, lbc_qrain, & lbc_m_v, lbc_m_cl, lbc_m_s, lbc_m_r, lbc_theta, lbc_exner, & lbc_u, mesh, w3_lbc_mask ) - boundaries_nml => configuration%get_namelist('boundaries') - call boundaries_nml%get_value( 'lbc_eos_height', lbc_eos_height ) - nullify( boundaries_nml ) + prime_mesh_name = config%base_mesh%prime_mesh_name() + lbc_eos_height = config%boundaries%lbc_eos_height() write(log_scratch_space,'(A)') & 'Recovering exner, and mixing ratios for LBCs.' diff --git a/science/gungho/source/algorithm/physics/map_fd_to_prognostics_alg_mod.x90 b/science/gungho/source/algorithm/physics/map_fd_to_prognostics_alg_mod.x90 index 172fd665..6c3a1a55 100644 --- a/science/gungho/source/algorithm/physics/map_fd_to_prognostics_alg_mod.x90 +++ b/science/gungho/source/algorithm/physics/map_fd_to_prognostics_alg_mod.x90 @@ -7,14 +7,13 @@ !> @brief Set prognostic fields from FD start dump module map_fd_to_prognostics_alg_mod + use config_mod, only: config_type use constants_mod, only: r_def, i_def, l_def use log_mod, only: log_event, & log_scratch_space, & LOG_LEVEL_INFO, & LOG_LEVEL_DEBUG, & LOG_LEVEL_TRACE - use namelist_collection_mod, only: namelist_collection_type - use namelist_mod, only: namelist_type ! Derived Types use field_mod, only: field_type @@ -73,23 +72,22 @@ module map_fd_to_prognostics_alg_mod contains !> @details Setting FE prognostic fields from FD fields - !> @param[in] configuration The application configuration object + !> @param[in] config The application configuration object !> @param[in,out] prognostic_fields Collection of prognostic fields !> @param[in,out] mr Array of moisture mixing ratios !> @param[in,out] fd_fields Collection of input Finite Difference !> fields - subroutine map_fd_to_prognostics(configuration, prognostic_fields, mr, & + subroutine map_fd_to_prognostics(config, prognostic_fields, mr, & moist_dyn, fd_fields) implicit none ! FE Prognostic fields - type(namelist_collection_type), intent(in) :: configuration - type(field_collection_type), intent( inout ) :: prognostic_fields - type(field_type), intent( inout ) :: mr(:) - type(field_type), intent( inout ) :: moist_dyn(num_moist_factors) - - type( field_collection_type), intent( inout ) :: fd_fields + type(config_type), intent( in ) :: config + type(field_collection_type), intent( inout ) :: prognostic_fields + type(field_type), intent( inout ) :: mr(:) + type(field_type), intent( inout ) :: moist_dyn(num_moist_factors) + type( field_collection_type), intent( inout ) :: fd_fields ! Local dereferenced fields type( field_type ), pointer :: theta @@ -114,14 +112,11 @@ contains type(integer_field_type), pointer :: face_selector_ew type(integer_field_type), pointer :: face_selector_ns - integer(i_def) :: model_eos_height - logical(l_def) :: read_w2h_wind - type(namelist_type), pointer :: initialization_nml + integer(i_def) :: model_eos_height + logical(l_def) :: read_w2h_wind - initialization_nml => configuration%get_namelist('initialization') - call initialization_nml%get_value( 'model_eos_height', model_eos_height ) - call initialization_nml%get_value( 'read_w2h_wind', read_w2h_wind ) - nullify( initialization_nml ) + model_eos_height = config%initialization%model_eos_height() + read_w2h_wind = config%initialization%read_w2h_wind() ! FD (source) fields if ( read_w2h_wind ) then 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 eb7dc2d0..962d75b1 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, & @@ -650,41 +649,31 @@ 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 - integer(tik) :: id + 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 + + integer(tik) :: id if ( LPROF ) call start_timing( id, 'semi_implicit_timestep' ) 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_driver_mod.F90 b/science/gungho/source/driver/gungho_driver_mod.F90 index 2c1e5a37..36180a97 100644 --- a/science/gungho/source/driver/gungho_driver_mod.F90 +++ b/science/gungho/source/driver/gungho_driver_mod.F90 @@ -384,7 +384,7 @@ subroutine step( modeldb ) if ( lbc_option == lbc_option_gungho_file .or. & lbc_option == lbc_option_um2lfric_file) then - call update_lbcs_file_alg( modeldb%configuration, & + call update_lbcs_file_alg( modeldb%config, & model_axes%lbc_times_list, & modeldb%clock, lbc_fields ) endif diff --git a/science/gungho/source/driver/gungho_init_fields_mod.X90 b/science/gungho/source/driver/gungho_init_fields_mod.X90 index db9e0d3d..be4551db 100644 --- a/science/gungho/source/driver/gungho_init_fields_mod.X90 +++ b/science/gungho/source/driver/gungho_init_fields_mod.X90 @@ -725,10 +725,10 @@ subroutine create_model_data( modeldb, & call init_fd_prognostics_dump( fd_fields ) ! Populate prognostics from input finite difference fields - call map_fd_to_prognostics( modeldb%configuration, & - prognostic_fields, & - mr_array%bundle, & - moist_dyn_array%bundle, & + call map_fd_to_prognostics( modeldb%config, & + prognostic_fields, & + mr_array%bundle, & + moist_dyn_array%bundle, & fd_fields ) ! Transform UM 2-bin dust to UKCA LFRIC 2-mode dust #ifdef UM_PHYSICS @@ -788,13 +788,13 @@ subroutine create_model_data( modeldb, & lbc_fields, modeldb ) case ( lbc_option_gungho_file ) - call init_lbcs_file_alg( modeldb%configuration, & + call init_lbcs_file_alg( modeldb%config, & model_axes%lbc_times_list, & modeldb%clock, & lbc_fields ) case ( lbc_option_um2lfric_file ) - call init_lbcs_file_alg( modeldb%configuration, & + call init_lbcs_file_alg( modeldb%config, & model_axes%lbc_times_list, & modeldb%clock, & lbc_fields ) diff --git a/science/gungho/source/driver/gungho_model_mod.F90 b/science/gungho/source/driver/gungho_model_mod.F90 index e91f0fbd..7d208909 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 @@ -673,7 +653,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/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 efca60c3..0dd45d4c 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,6 @@ 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 logical(l_def) :: use_xios_io @@ -81,17 +74,10 @@ 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() + 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/gungho/source/driver/iau_multifile_io/iau_multifile_io_mod.F90 b/science/gungho/source/driver/iau_multifile_io/iau_multifile_io_mod.F90 index f20db5bd..8b4c9e2e 100644 --- a/science/gungho/source/driver/iau_multifile_io/iau_multifile_io_mod.F90 +++ b/science/gungho/source/driver/iau_multifile_io/iau_multifile_io_mod.F90 @@ -11,7 +11,7 @@ module iau_multifile_io_mod use base_mesh_config_mod, only: prime_mesh_name use calendar_mod, only: calendar_type - use constants_mod, only: str_def, i_def + use constants_mod, only: str_def, str_max_filename, i_def use driver_modeldb_mod, only: modeldb_type use event_mod, only: event_action use event_actor_mod, only: event_actor_type @@ -26,6 +26,13 @@ module iau_multifile_io_mod iau_use_addinf, & iau_use_bcorr use iau_firstfile_io_mod, only: iau_incs_firstfile_io + + use iau_addinf_io_nml_iterator_mod, only: iau_addinf_io_nml_iterator_type + use iau_addinf_io_nml_mod, only: iau_addinf_io_nml_type + use iau_ainc_io_nml_iterator_mod, only: iau_ainc_io_nml_iterator_type + use iau_ainc_io_nml_mod, only: iau_ainc_io_nml_type + use iau_bcorr_io_nml_iterator_mod, only: iau_bcorr_io_nml_iterator_type + use iau_bcorr_io_nml_mod, only: iau_bcorr_io_nml_type #endif use iau_time_control_mod, only: calc_iau_ts_num use inventory_by_mesh_mod, only: inventory_by_mesh_type @@ -57,35 +64,77 @@ module iau_multifile_io_mod !> @param[in] io_context_name name of main context !> @param[inout] modeldb Modeldb object subroutine init_multifile_io(io_context_name, modeldb) + implicit none - character(*), intent(in) :: io_context_name + character(*), intent(in) :: io_context_name type(modeldb_type), intent(inout) :: modeldb #ifdef UM_PHYSICS + type(iau_addinf_io_nml_iterator_type) :: iter_addinf + type(iau_ainc_io_nml_iterator_type) :: iter_ainc + type(iau_bcorr_io_nml_iterator_type) :: iter_bcorr + + type(iau_addinf_io_nml_type), pointer :: iau_addinf_io_nml + type(iau_ainc_io_nml_type), pointer :: iau_ainc_io_nml + type(iau_bcorr_io_nml_type), pointer :: iau_bcorr_io_nml + + character(str_max_filename) :: filename + + character(str_def) :: iau_incs + integer(i_def) :: iau_time + if ( iau_use_addinf ) then - call iau_incs_firstfile_io ( io_context_name, & - modeldb, & - "iau_addinf_fields", & + iau_incs = 'iau_addinf_fields' + call iau_incs_firstfile_io ( io_context_name, & + modeldb, & + trim(iau_incs), & iau_addinf_path ) - call init_iau_incs_io( modeldb, & - "iau_addinf_fields", & - "iau_addinf_io" ) + + call iter_addinf%initialise(modeldb%config%iau_addinf_io) + do while (iter_addinf%has_next()) + iau_addinf_io_nml => iter_addinf%next() + filename = iau_addinf_io_nml%filename() + iau_time = iau_addinf_io_nml%start_time() + + call init_iau_incs_io( modeldb, trim(iau_incs), & + iau_time, filename ) + end do end if + + if ( iau_ainc_multifile ) then - call init_iau_incs_io( modeldb, & - "iau_fields", & - "iau_ainc_io" ) + iau_incs = 'iau_fields' + call iter_ainc%initialise(modeldb%config%iau_ainc_io) + do while (iter_ainc%has_next()) + iau_ainc_io_nml => iter_ainc%next() + filename = iau_ainc_io_nml%filename() + iau_time = iau_ainc_io_nml%start_time() + + call init_iau_incs_io( modeldb, trim(iau_incs), & + iau_time, filename ) + end do end if + + if ( iau_use_bcorr ) then - call iau_incs_firstfile_io ( io_context_name, & - modeldb, & - "iau_bcorr_fields", & + iau_incs = 'iau_bcorr_fields' + call iau_incs_firstfile_io ( io_context_name, & + modeldb, & + trim(iau_incs), & iau_bcorr_path ) - call init_iau_incs_io( modeldb, & - "iau_bcorr_fields", & - "iau_bcorr_io" ) + + call iter_bcorr%initialise(modeldb%config%iau_bcorr_io) + do while (iter_bcorr%has_next()) + iau_bcorr_io_nml => iter_bcorr%next() + filename = iau_bcorr_io_nml%filename() + iau_time = iau_bcorr_io_nml%start_time() + + call init_iau_incs_io( modeldb, trim(iau_incs), & + iau_time, filename ) + end do end if + #endif end subroutine init_multifile_io @@ -95,50 +144,38 @@ end subroutine init_multifile_io !> @param[inout] modeldb Modeldb object !> @param[in] iau_incs Type of IAU increment !> @param[in] nml_name Name of multifile namelist - subroutine init_iau_incs_io(modeldb, iau_incs, nml_name) + subroutine init_iau_incs_io(modeldb, iau_incs, iau_time, filename) implicit none type(modeldb_type), intent(inout), target :: modeldb - character(*), intent(in) :: iau_incs - character(*), intent(in) :: nml_name - type(lfric_xios_context_type), pointer :: io_context - type(namelist_type), pointer :: multifile_nml - type(linked_list_type), pointer :: file_list - class( model_clock_type ), pointer :: model_clock - integer(i_def) :: iau_time - integer(i_def) :: multifile_start_timestep - integer(i_def) :: multifile_stop_timestep - integer(i_def) :: i - character(str_def) :: context_name - character(str_def) :: filename - character(str_def), pointer :: multifile_io_profiles(:) + character(*), intent(in) :: iau_incs + integer(i_def), intent(in) :: iau_time + character(str_def), intent(in) :: filename - allocate(multifile_io_profiles, & - source=modeldb%configuration%get_namelist_profiles(nml_name)) - model_clock => modeldb % clock - do i=1, size(multifile_io_profiles) + type(lfric_xios_context_type), pointer :: io_context + type(linked_list_type), pointer :: file_list + class( model_clock_type ), pointer :: model_clock - multifile_nml => modeldb%configuration%get_namelist(trim(nml_name), & - profile_name=trim(multifile_io_profiles(i))) - call multifile_nml%get_value('filename', filename) - call multifile_nml%get_value('start_time', iau_time) - multifile_start_timestep = calc_iau_ts_num (model_clock, iau_time) - multifile_stop_timestep = multifile_start_timestep + 1_i_def + integer(i_def) :: multifile_start_timestep + integer(i_def) :: multifile_stop_timestep + + character(str_def) :: context_name - context_name = "multifile_context_" // trim(filename) - call context_init(modeldb, context_name, multifile_start_timestep, & - multifile_stop_timestep) + model_clock => modeldb % clock - call modeldb%io_contexts%get_io_context(context_name, io_context) + multifile_start_timestep = calc_iau_ts_num (model_clock, iau_time) + multifile_stop_timestep = multifile_start_timestep + 1_i_def - file_list => io_context%get_filelist() - call init_iau_inc_files(file_list, modeldb, iau_incs, filename) + context_name = "multifile_context_" // trim(filename) + call context_init(modeldb, context_name, multifile_start_timestep, & + multifile_stop_timestep) - end do + call modeldb%io_contexts%get_io_context(context_name, io_context) - deallocate(multifile_io_profiles) + file_list => io_context%get_filelist() + call init_iau_inc_files(file_list, modeldb, iau_incs, filename) end subroutine init_iau_incs_io @@ -146,28 +183,50 @@ end subroutine init_iau_incs_io !> !> @param[inout] modeldb Model database object subroutine setup_step_multifile_io( io_context_name, modeldb ) + implicit none - character(*), intent(in) :: io_context_name ! main context - type(modeldb_type), intent(inout) :: modeldb + character(*), intent(in) :: io_context_name ! main context + type(modeldb_type), intent(inout) :: modeldb #ifdef UM_PHYSICS + type(iau_addinf_io_nml_iterator_type) :: iter_addinf + type(iau_ainc_io_nml_iterator_type) :: iter_ainc + type(iau_bcorr_io_nml_iterator_type) :: iter_bcorr + + type(iau_addinf_io_nml_type), pointer :: iau_addinf_io_nml + type(iau_ainc_io_nml_type), pointer :: iau_ainc_io_nml + type(iau_bcorr_io_nml_type), pointer :: iau_bcorr_io_nml + + character(str_max_filename) :: filename + if ( iau_use_addinf ) then - call step_multifile_io( io_context_name, & - modeldb, & - "iau_addinf_io" ) + call iter_addinf%initialise(modeldb%config%iau_addinf_io) + do while (iter_addinf%has_next()) + iau_addinf_io_nml => iter_addinf%next() + filename = iau_addinf_io_nml%filename() + call step_multifile_io(io_context_name, modeldb, filename) + end do end if + if ( iau_ainc_multifile ) then - call step_multifile_io( io_context_name, & - modeldb, & - "iau_ainc_io" ) + call iter_ainc%initialise(modeldb%config%iau_ainc_io) + do while (iter_ainc%has_next()) + iau_ainc_io_nml => iter_ainc%next() + filename = iau_ainc_io_nml%filename() + call step_multifile_io(io_context_name, modeldb, filename) + end do end if + if ( iau_use_bcorr ) then - call step_multifile_io( io_context_name, & - modeldb, & - "iau_bcorr_io" ) + call iter_bcorr%initialise(modeldb%config%iau_bcorr_io) + do while (iter_bcorr%has_next()) + iau_bcorr_io_nml => iter_bcorr%next() + filename = iau_bcorr_io_nml%filename() + call step_multifile_io(io_context_name, modeldb, filename) + end do end if #endif @@ -177,12 +236,13 @@ end subroutine setup_step_multifile_io !> !> @param[in] io_context_name Name of main context !> @param[inout] modeldb Model database object - !> @param[in] nml_name Name of multifile namelist - subroutine step_multifile_io( io_context_name, modeldb, nml_name ) + !> @param[in] filename File associated with context + subroutine step_multifile_io( io_context_name, modeldb, filename ) + implicit none character(*), intent(in) :: io_context_name ! main context name - character(*), intent(in) :: nml_name + character(*), intent(in) :: filename type(modeldb_type), intent(inout) :: modeldb type(inventory_by_mesh_type), pointer :: chi_inventory @@ -192,74 +252,57 @@ subroutine step_multifile_io( io_context_name, modeldb, nml_name ) type(mesh_type), pointer :: mesh type(field_type), pointer :: chi(:) type(field_type), pointer :: panel_id - type(namelist_type), pointer :: multifile_nml - type(namelist_type), pointer :: time_nml class(calendar_type), allocatable :: tmp_calendar + character(str_def) :: context_name - character(str_def) :: filename character(str_def) :: time_origin character(str_def) :: time_start - character(str_def), pointer :: multifile_io_profiles(:) - integer(i_def) :: i + procedure(event_action), pointer :: context_advance procedure(callback_clock_arg), pointer :: before_close nullify(before_close) - chi_inventory => get_chi_inventory() + chi_inventory => get_chi_inventory() panel_id_inventory => get_panel_id_inventory() - allocate(multifile_io_profiles, & - source=modeldb%configuration%get_namelist_profiles(nml_name)) - - do i=1, size(multifile_io_profiles) - - multifile_nml => modeldb%configuration%get_namelist(nml_name, & - profile_name=trim(multifile_io_profiles(i))) - call multifile_nml%get_value('filename', filename) - - context_name = "multifile_context_" // trim(filename) - call modeldb%io_contexts%get_io_context(context_name, io_context) - - if (modeldb%clock%get_step() == io_context%get_stop_time()) then - ! Finalise XIOS context - call io_context%set_current() - call io_context%set_active(.false.) - call modeldb%clock%remove_event(context_name) - call io_context%finalise_xios_context() - - elseif (modeldb%clock%get_step() == io_context%get_start_time()) then - ! Initialise XIOS context - mesh => mesh_collection%get_mesh(prime_mesh_name) - call chi_inventory%get_field_array(mesh, chi) - call panel_id_inventory%get_field(mesh, panel_id) - - time_nml => modeldb%configuration%get_namelist('time') - - call time_nml%get_value('calendar_origin', time_origin) - call time_nml%get_value('calendar_start', time_start) - - allocate(tmp_calendar, source=step_calendar_type(time_origin, time_start)) - - call io_context%initialise_xios_context( modeldb%mpi%get_comm(), & - chi, panel_id, & - modeldb%clock, tmp_calendar, & - before_close, & - start_at_zero=.true. ) - - ! Attach context advancement to the model's clock - context_advance => advance_read_only - event_actor_ptr => io_context - call modeldb%clock%add_event( context_advance, event_actor_ptr ) - call io_context%set_active(.true.) - end if - end do + context_name = "multifile_context_" // trim(filename) + call modeldb%io_contexts%get_io_context(context_name, io_context) + + if (modeldb%clock%get_step() == io_context%get_stop_time()) then + ! Finalise XIOS context + call io_context%set_current() + call io_context%set_active(.false.) + call modeldb%clock%remove_event(context_name) + call io_context%finalise_xios_context() + + else if (modeldb%clock%get_step() == io_context%get_start_time()) then + ! Initialise XIOS context + mesh => mesh_collection%get_mesh(prime_mesh_name) + call chi_inventory%get_field_array(mesh, chi) + call panel_id_inventory%get_field(mesh, panel_id) + + time_origin = modeldb%config%time%calendar_origin() + time_start = modeldb%config%time%calendar_start() + + allocate(tmp_calendar, source=step_calendar_type(time_origin, time_start)) + + call io_context%initialise_xios_context( modeldb%mpi%get_comm(), & + chi, panel_id, & + modeldb%clock, tmp_calendar, & + before_close, & + start_at_zero=.true. ) + + ! Attach context advancement to the model's clock + context_advance => advance_read_only + event_actor_ptr => io_context + call modeldb%clock%add_event( context_advance, event_actor_ptr ) + call io_context%set_active(.true.) + end if call modeldb%io_contexts%get_io_context(io_context_name, io_context) call io_context%set_current() - deallocate(multifile_io_profiles) - nullify ( chi_inventory, panel_id_inventory, mesh, chi, panel_id ) end subroutine step_multifile_io 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 9ca14d53..408a5ac6 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 74064b04..e67efa12 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 dff2de0b..71785a9b 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 a692c28b..8022dbe0 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 af05571e..ffe8eb68 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 3c34582d..b380f84f 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 c0bcd137..108a1705 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 d70d25f2..ab31b0f5 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 121490e9..a7d49fa3 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 478eb467..89a92b82 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 57da7183..5327c8ce 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 cca143aa..786b4f2d 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,10 @@ 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 +172,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 781ce811..56b5c9cc 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 c44406bd..e6f53573 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 f154a060..ca19b15b 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 ebbde198..692fda7c 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 bc6f1bf3..90ec2182 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 acabd2c2..442002ce 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 e9714db8..474f6064 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 7116bbdb..29ae1b64 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 cb872859..8242d80d 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 cfb37ab1..6e882ff2 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 f9bfb5db..01d08c0d 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 658e676f..5f714217 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 348fb1ef..2b28dfd3 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 dc3e55e0..4077a238 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 aa9b4b51..a99a9cae 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 7dbe255e..395a7637 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 f08a05fd..2edd683f 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 47193101..6b83c0dc 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 f5751b76..3156c522 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 e9e92bf8..f8b18f06 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 6e4dd39b..14fe4aaa 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 63133246..b1985847 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 851d06eb..2ca6692f 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 4eae5a9b..6c6c6904 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 31f0bb9c..8f326b33 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 604ca931..776ae5fb 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 495c48df..8e27edc6 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 00640b1a..3f914a2a 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 17e485b6..27f8410d 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 @@ -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/held_suarez_kernel_mod_test.pf b/science/gungho/unit-test/kernel/external_forcing/held_suarez_kernel_mod_test.pf index d1e1f11e..18f0dc4a 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 854255e9..37975fbb 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 5971150f..0514ecec 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 @@ -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 e91b2770..576816e6 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 4c2b182e..4dea345c 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 4ff87745..6c55d449 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 dac91d1a..83fdb7af 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 96a0b0d1..c9ab77fb 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 4537740b..38f8a35a 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 e23ec357..7c55ee6d 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 e85a0bc8..a2a9f90c 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 bd34c90e..d6cbc6f1 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 fd105118..fd905afa 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 071d0379..bbc16aca 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 d2e8ae4e..76abb749 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 26c6a3be..e347ae2f 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 eec36089..d37ccb7c 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 bc210565..aad312e7 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 e45d1fd8..c5664738 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/integration-test/runge_kutta/runge_kutta.f90 b/science/linear/integration-test/runge_kutta/runge_kutta.f90 index f460201a..64c9ed6e 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 @@ -145,8 +145,10 @@ program runge_kutta call log_event( "Unknown test", LOG_LEVEL_ERROR ) 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, 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 af625729..2d3eddaf 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, & @@ -132,8 +131,10 @@ program semi_implicit call log_event( "Unknown test", LOG_LEVEL_ERROR ) 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, 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 bfb52ec0..3cc72abc 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 @@ -392,9 +391,9 @@ 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 - integer(tik) :: id + real(r_def) :: mixed_solver_a_tol + + integer(tik) :: id if ( LPROF ) call start_timing( id, 'tl_semi_implicit_timestep' ) @@ -802,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 662faea6..9b6d8028 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 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 87b4df84..2763b7bd 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 d2c9c819..fd814e93 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 ad726c20..ddb5f731 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 a2c4c107..009dc599 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 c3b98a7b..45a8e1ae 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 9a44a87a..d2da9c9d 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 e739d061..d0592e21 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,8 @@ 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 c80f072b..f8cae079 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 e1dc1c86..1d766770 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 9dea4bf3..32c18499 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 !===================================== 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 00000000..ea0c61ce --- /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