diff --git a/applications/adjoint_tests/source/adjoint_tests.f90 b/applications/adjoint_tests/source/adjoint_tests.f90 index c21ce008c..75de561c6 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,20 +26,17 @@ 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 integer, allocatable :: seed(:) integer :: seed_size @@ -51,9 +49,9 @@ program adjoint_tests call random_seed(put = seed) 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) @@ -76,15 +74,15 @@ program adjoint_tests call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - configuration=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 59b1a432d..72af6c3c7 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') + if ( LPROF ) call start_timing( id, 'gravity_wave_alg') - ! Obtain namelist parameters - call timestepping_nml%get_value( 'dt', dt ) - call initial_temperature_nml%get_value( 'bvf_square', bvf_square ) + dt = modeldb%config%timestepping%dt() + bvf_square = modeldb%config%initial_temperature%bvf_square() + limited_area = modeldb%config%boundaries%limited_area() !=== 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 a4345245a..89c3dd6a9 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 f5d8d9fe2..362641c57 100644 --- a/applications/gravity_wave/source/driver/gravity_wave_infrastructure_mod.f90 +++ b/applications/gravity_wave/source/driver/gravity_wave_infrastructure_mod.f90 @@ -29,7 +29,6 @@ module gravity_wave_infrastructure_mod LOG_LEVEL_ALWAYS, & LOG_LEVEL_ERROR use mesh_collection_mod, only : mesh_collection - use namelist_mod, only : namelist_type use field_mod, only : field_type use driver_fem_mod, only : init_fem, init_function_space_chains use driver_io_mod, only : init_io, final_io @@ -89,43 +88,24 @@ subroutine initialise_infrastructure( program_name, & real(r_def) :: domain_height real(r_def) :: scaled_radius - type(namelist_type), pointer :: base_mesh_nml => null() - type(namelist_type), pointer :: formulation_nml => null() - type(namelist_type), pointer :: extrusion_nml => null() - type(namelist_type), pointer :: planet_nml => null() - type(namelist_type), pointer :: multigrid_nml => null() - integer(i_def) :: i integer(i_def), parameter :: one_layer = 1_i_def !======================================================================= ! 0.0 Extract configuration variables !======================================================================= - base_mesh_nml => modeldb%configuration%get_namelist('base_mesh') - formulation_nml => modeldb%configuration%get_namelist('formulation') - extrusion_nml => modeldb%configuration%get_namelist('extrusion') - planet_nml => modeldb%configuration%get_namelist('planet') - - call formulation_nml%get_value( 'l_multigrid', l_multigrid ) - + l_multigrid = modeldb%config%formulation%l_multigrid() if (l_multigrid) then - multigrid_nml => modeldb%configuration%get_namelist('multigrid') - call multigrid_nml%get_value( 'chain_mesh_tags', chain_mesh_tags ) - multigrid_nml => null() + chain_mesh_tags = modeldb%config%multigrid%chain_mesh_tags() end if - call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) - call base_mesh_nml%get_value( 'geometry', geometry ) - call base_mesh_nml%get_value( 'prepartitioned', prepartitioned ) - call extrusion_nml%get_value( 'method', method ) - call extrusion_nml%get_value( 'domain_height', domain_height ) - call extrusion_nml%get_value( 'number_of_layers', number_of_layers ) - call planet_nml%get_value( 'scaled_radius', scaled_radius ) - - base_mesh_nml => null() - extrusion_nml => null() - formulation_nml => null() - planet_nml => null() + prime_mesh_name = modeldb%config%base_mesh%prime_mesh_name() + geometry = modeldb%config%base_mesh%geometry() + prepartitioned = modeldb%config%base_mesh%prepartitioned() + method = modeldb%config%extrusion%method() + domain_height = modeldb%config%extrusion%domain_height() + number_of_layers = modeldb%config%extrusion%number_of_layers() + scaled_radius = modeldb%config%planet%scaled_radius() !------------------------------------------------------------------------- ! Initialise infrastructure diff --git a/applications/gravity_wave/source/gravity_wave.f90 b/applications/gravity_wave/source/gravity_wave.f90 index 596ef3579..7c3928fea 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,36 +25,38 @@ 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, & - configuration=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/gungho_model/source/gungho_model.f90 b/applications/gungho_model/source/gungho_model.f90 index 37bf9a6eb..aacdb0d21 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,23 @@ 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 ) @@ -76,13 +73,16 @@ program gungho_model call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - configuration=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 7517efd1a..278a94ff0 100644 --- a/applications/jedi_lfric_tests/integration-test/algorithm/algorithm_test.f90 +++ b/applications/jedi_lfric_tests/integration-test/algorithm/algorithm_test.f90 @@ -36,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 @@ -52,8 +50,7 @@ program algorithm_test character(:), allocatable :: filename - type(namelist_collection_type), save :: configuration - type(config_type), save :: config + type(config_type), save :: config ! Variables used for parsing command line arguments integer :: length, status, nargs @@ -78,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 @@ -146,31 +139,19 @@ program algorithm_test end select ! Setup configuration, mesh, and fem - call configuration%initialise( program_name, table_len=10 ) call config%initialise( program_name ) - call read_configuration( filename, & - configuration=configuration, & - config=config ) - + 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 @@ -204,10 +185,8 @@ program algorithm_test !------------------------------------------------------------------------- stencil_depth = 1 apply_partition_check = .false. - call init_mesh( config, & - 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) @@ -245,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 b5c3faf9f..f383262a3 100644 --- a/applications/jedi_lfric_tests/source/jedi-interface/jedi_checksum_mod.f90 +++ b/applications/jedi_lfric_tests/source/jedi-interface/jedi_checksum_mod.f90 @@ -58,7 +58,6 @@ subroutine output_linear_checksum( program_name, modeldb ) use constants_mod, only: i_def use formulation_config_mod, only: moisture_formulation_dry - use namelist_mod, only: namelist_type implicit none @@ -73,11 +72,11 @@ subroutine output_linear_checksum( program_name, modeldb ) type(field_type), pointer :: theta type(field_type), pointer :: u type(field_type), pointer :: rho - type(namelist_type), pointer :: formulation_nml - integer(kind=i_def) :: moisture_formulation + + integer(i_def) :: moisture_formulation nullify(moisture_fields, prognostic_fields, mr_array) - nullify(mr, theta, u, rho, formulation_nml) + nullify(mr, theta, u, rho) ! Get the fields to checksum prognostic_fields => modeldb%fields%get_field_collection("prognostic_fields") @@ -90,8 +89,7 @@ subroutine output_linear_checksum( program_name, modeldb ) mr => mr_array%bundle ! Get configuration to inform if moisture is output - formulation_nml => modeldb%configuration%get_namelist('formulation') - call formulation_nml%get_value( 'moisture_formulation', moisture_formulation ) + moisture_formulation = modeldb%config%formulation%moisture_formulation() ! Write checksums to file if (moisture_formulation /= moisture_formulation_dry) then diff --git a/applications/jedi_lfric_tests/source/jedi-interface/jedi_geometry_mod.f90 b/applications/jedi_lfric_tests/source/jedi-interface/jedi_geometry_mod.f90 index 5e5dc3761..7c441b791 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 @@ -38,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 @@ -93,23 +91,20 @@ module jedi_geometry_mod !> @brief Initialiser for jedi_geometry_type !> -subroutine initialise( self, mpi_comm, configuration, config ) +subroutine initialise( self, mpi_comm, config ) + ! Access config directly until modeldb ready - 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 @@ -122,11 +117,10 @@ subroutine initialise( self, mpi_comm, configuration, config ) ! Setup mesh mpi_obj = self%get_mpi_comm() - call initialise_mesh( self%mesh_name, configuration, config, 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 @@ -310,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 @@ -334,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(:) @@ -341,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) @@ -354,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 @@ -366,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" @@ -378,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" @@ -392,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 2cc8af089..380299ade 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 @@ -43,7 +43,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, & @@ -123,8 +122,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 @@ -145,8 +142,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 @@ -155,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 43f9aa241..8a866bace 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 ) 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 797201121..1d676c207 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 @@ -49,7 +49,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 @@ -121,8 +120,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 @@ -143,8 +140,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 @@ -153,16 +153,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 752286602..f6d9b608b 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 9166db293..d5add768d 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 e5d8177d0..bda63a7a4 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,9 +10,8 @@ ! module jedi_run_mod - use config_mod, only : config_type - 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 @@ -20,10 +19,9 @@ module jedi_run_mod type, public :: jedi_run_type private - character(str_def) :: jedi_run_name - type(namelist_collection_type) :: configuration - type(config_type) :: config - logical(kind=l_def) :: timers_finalised + character(str_def) :: jedi_run_name + type(config_type) :: config + logical(l_def) :: timers_finalised contains @@ -33,13 +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 + !> 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 @@ -67,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 @@ -95,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 @@ -108,12 +103,12 @@ 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 @@ -121,7 +116,6 @@ subroutine initialise_infrastructure( self, filename, model_communicator ) ! Setup the config which is curently global call init_config( filename, jedi_lfric_tests_required_namelists, & - configuration=self%configuration, & config=self%config ) ! Initialise the logger @@ -129,9 +123,11 @@ subroutine initialise_infrastructure( self, filename, 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 @@ -139,21 +135,9 @@ 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) - - class( jedi_run_type ), target, intent(inout) :: self - type( namelist_collection_type ), pointer :: configuration - - configuration => self%configuration - -end function get_configuration - -!> @brief Get pointer to the stored configuration -!> -!> @return config A pointer to the configuration function get_config(self) result(config) class( jedi_run_type ), target, intent(inout) :: self @@ -164,7 +148,8 @@ function get_config(self) result(config) 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 4b464f16e..04025c9a3 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 fcf48de84..267d3516d 100644 --- a/applications/jedi_lfric_tests/source/jedi_forecast.f90 +++ b/applications/jedi_lfric_tests/source/jedi_forecast.f90 @@ -25,8 +25,6 @@ program jedi_forecast 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 @@ -47,12 +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 + + 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() @@ -77,22 +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, config ) + 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 eb30c92c3..f94b94345 100644 --- a/applications/jedi_lfric_tests/source/jedi_forecast_pseudo.f90 +++ b/applications/jedi_lfric_tests/source/jedi_forecast_pseudo.f90 @@ -25,8 +25,6 @@ program jedi_forecast_pseudo 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 @@ -47,14 +45,12 @@ program jedi_forecast_pseudo type( jedi_post_processor_empty_type ) :: jedi_pp_empty ! Local - type( namelist_collection_type ), pointer :: configuration - type( config_type ), pointer :: config + 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 + 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" @@ -77,22 +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, config ) + 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 b72380ea3..8991e04f6 100644 --- a/applications/jedi_lfric_tests/source/jedi_id_tlm_tests.f90 +++ b/applications/jedi_lfric_tests/source/jedi_id_tlm_tests.f90 @@ -53,8 +53,6 @@ program jedi_id_tlm_tests 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 @@ -81,13 +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 + 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 @@ -117,19 +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() + 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, config ) + 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 ) @@ -140,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 ) @@ -148,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 2da8faf95..7c7b8ae1f 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,27 +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 @@ -69,14 +67,15 @@ program jedi_lfric_tests call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - configuration=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 728b3e04f..9139e5afd 100644 --- a/applications/jedi_lfric_tests/source/jedi_tlm_forecast_tl.f90 +++ b/applications/jedi_lfric_tests/source/jedi_tlm_forecast_tl.f90 @@ -27,8 +27,6 @@ program jedi_tlm_forecast_tl 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 @@ -53,14 +51,12 @@ program jedi_tlm_forecast_tl type( jedi_post_processor_traj_type ) :: pp_traj ! Local - type( namelist_collection_type ), pointer :: configuration - type( config_type ), pointer :: config + 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 + 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" @@ -83,22 +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() + 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, config ) + 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 ) @@ -107,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 d5767d159..6439b5d79 100644 --- a/applications/jedi_lfric_tests/source/jedi_tlm_tests.f90 +++ b/applications/jedi_lfric_tests/source/jedi_tlm_tests.f90 @@ -36,13 +36,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, l_def + use constants_mod, only : PRECISION_REAL, i_def, str_def, & + r_def, l_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 @@ -67,13 +66,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 + + 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 - type( namelist_type ), pointer :: jedi_increment_config logical( kind=l_def ) :: real_increment character( str_def ) :: forecast_length_str real( kind=r_def ) :: dot_product_1 @@ -104,25 +102,22 @@ program jedi_tlm_tests call log_event( log_scratch_space, LOG_LEVEL_ALWAYS ) ! Get the configuration - configuration => run%get_configuration() - config => run%get_config() + 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, config ) + call geometry%initialise( model_communicator, config ) ! Create inc_initial, either from file or random - call inc_initial%initialise( geometry, configuration ) - jedi_increment_config => configuration%get_namelist('jedi_increment') - call jedi_increment_config%get_value( 'initialise_via_read', real_increment ) + call inc_initial%initialise( geometry, config ) + real_increment = config%jedi_increment%initialise_via_read() if (.not. real_increment) call inc_initial%random() ! Create state - call state%initialise( geometry, configuration ) + call state%initialise( geometry, config ) ! Create linear model call linear_model%initialise( geometry, filename ) @@ -131,7 +126,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 ) @@ -172,7 +167,7 @@ program jedi_tlm_tests absolute_diff = abs( dot_product_1 - dot_product_2 ) machine_tolerance = spacing( max( abs( dot_product_1 ), abs( dot_product_2 ) ) ) relative_diff = absolute_diff / machine_tolerance - call jedi_lfric_settings_config%get_value( 'adjoint_test_tolerance', absolute_tolerance ) + absolute_tolerance = config%jedi_lfric_settings%adjoint_test_tolerance() if (absolute_diff > absolute_tolerance ) then call run%finalise_timers() ! We still want timing info even if the test fails write( log_scratch_space, * ) "Adjoint test FAILED", & diff --git a/applications/jules/source/jules.f90 b/applications/jules/source/jules.f90 index 339328f54..867c2c424 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,14 @@ 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 ) @@ -69,15 +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, & - configuration=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 7529664b8..fd521a80b 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 1dfee92a5..a5ac9addd 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 @@ -20,7 +21,6 @@ module lfric2lfric_driver_mod log_event, & log_level_info use model_clock_mod, only: model_clock_type - use namelist_mod, only: namelist_type use sci_checksum_alg_mod, only: checksum_alg use xios, only: xios_date, xios_get_current_date, & xios_date_convert_to_string @@ -82,14 +82,13 @@ subroutine run( modeldb, oasis_clock ) 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) :: mode - integer(kind=i_def) :: regrid_method + character(len=str_max_filename) :: start_dump_filename + character(len=str_max_filename) :: checkpoint_stem_name + + integer(kind=i_def) :: mode + integer(kind=i_def) :: regrid_method ! Local parameters - type(namelist_type), pointer :: files_nml - type(namelist_type), pointer :: lfric2lfric_nml integer(kind=i_def) :: step, time_steps logical(kind=l_def) :: is_running @@ -102,15 +101,12 @@ subroutine run( modeldb, oasis_clock ) type(lfric_xios_context_type), pointer :: io_context - ! 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( 'mode', mode ) - 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() + + mode = modeldb%config%lfric2lfric%mode() + 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_file_init_mod.f90 b/applications/lfric2lfric/source/initialisation/lfric2lfric_file_init_mod.f90 index 10adc1eb6..e76f224c8 100644 --- a/applications/lfric2lfric/source/initialisation/lfric2lfric_file_init_mod.f90 +++ b/applications/lfric2lfric/source/initialisation/lfric2lfric_file_init_mod.f90 @@ -26,7 +26,6 @@ module lfric2lfric_file_init_mod src_orography_mean_ancil_path, & mode_ics, mode_lbc use linked_list_mod, only: linked_list_type - use namelist_mod, only: namelist_type use orography_config_mod, only: orog_init_option, & orog_init_option_ancil @@ -50,22 +49,18 @@ subroutine init_lfric2lfric_src_files( files_list, modeldb ) type(linked_list_type), intent(out) :: files_list type(modeldb_type), optional, intent(inout) :: modeldb - type(namelist_type), pointer :: lfric2lfric_nml - type(namelist_type), pointer :: files_nml - integer(kind=i_def) :: mode character(len=str_max_filename) :: start_dump_filename character(len=str_max_filename) :: source_file_lbc character(len=str_max_filename) :: src_ancil_fname - if( use_xios_io ) then + if ( use_xios_io ) then - lfric2lfric_nml => modeldb%configuration%get_namelist('lfric2lfric') - call lfric2lfric_nml%get_value( 'mode', mode ) + mode = modeldb%config%lfric2lfric%mode() - files_nml => modeldb%configuration%get_namelist('files') if (mode == mode_ics) then - call files_nml%get_value( 'start_dump_filename', start_dump_filename ) + + start_dump_filename = modeldb%config%files%start_dump_filename() ! Setup checkpoint reading context information call files_list%insert_item( & @@ -74,7 +69,8 @@ subroutine init_lfric2lfric_src_files( files_list, modeldb ) io_mode=FILE_MODE_READ ) ) else if (mode == mode_lbc) then - call lfric2lfric_nml%get_value( 'source_file_lbc', source_file_lbc ) + + source_file_lbc = modeldb%config%lfric2lfric%source_file_lbc() ! Setup lbc source reading context information call files_list%insert_item( & @@ -83,7 +79,7 @@ subroutine init_lfric2lfric_src_files( files_list, modeldb ) io_mode=FILE_MODE_READ, & operation=OPERATION_TIMESERIES, & freq=diagnostic_frequency) ) - endif + end if ! Setup orography ancillary file if ( orog_init_option == orog_init_option_ancil ) then @@ -96,7 +92,7 @@ subroutine init_lfric2lfric_src_files( files_list, modeldb ) io_mode=FILE_MODE_READ ) ) end if - endif + end if end subroutine init_lfric2lfric_src_files @@ -113,8 +109,6 @@ subroutine init_lfric2lfric_dst_files( files_list, modeldb ) type(modeldb_type), optional, intent(inout) :: modeldb ! Local variables - type(namelist_type), pointer :: lfric2lfric_nml - type(namelist_type), pointer :: files_nml integer(kind=i_def), parameter :: checkpoint_frequency = 1_i_def integer(kind=i_def) :: mode @@ -122,15 +116,14 @@ subroutine init_lfric2lfric_dst_files( files_list, modeldb ) character(len=str_max_filename) :: checkpoint_stem_name character(len=str_max_filename) :: diag_stem_name - if( use_xios_io ) then + if ( use_xios_io ) then - lfric2lfric_nml => modeldb%configuration%get_namelist('lfric2lfric') - call lfric2lfric_nml%get_value( 'mode', mode ) + mode = modeldb%config%lfric2lfric%mode() - files_nml => modeldb%configuration%get_namelist('files') ! Set up diagnostic writing info - if( write_diag ) then - call files_nml%get_value( 'diag_stem_name', diag_stem_name ) + if ( write_diag ) then + + diag_stem_name = modeldb%config%files%diag_stem_name() ! Setup diagnostic output file call files_list%insert_item( & @@ -138,12 +131,14 @@ subroutine init_lfric2lfric_dst_files( files_list, modeldb ) xios_id="lfric_diag", & io_mode=FILE_MODE_WRITE, & freq=diagnostic_frequency) ) - endif + end if if (mode == mode_ics) then + ! Setup checkpoint writing context information if ( checkpoint_write ) then - call files_nml%get_value( 'checkpoint_stem_name', checkpoint_stem_name ) + + checkpoint_stem_name = modeldb%config%files%checkpoint_stem_name() call files_list%insert_item( & lfric_xios_file_type( trim( checkpoint_stem_name ), & @@ -152,6 +147,7 @@ subroutine init_lfric2lfric_dst_files( files_list, modeldb ) freq=checkpoint_frequency ) ) end if else if (mode == mode_lbc) then + ! Setup lbc writing context information call files_list%insert_item( & lfric_xios_file_type( "lfric2lfric_lbc", & @@ -159,20 +155,21 @@ subroutine init_lfric2lfric_dst_files( files_list, modeldb ) io_mode=FILE_MODE_WRITE, & operation=OPERATION_TIMESERIES, & freq=diagnostic_frequency ) ) - endif + end if ! Setup orography ancillary file if ( orog_init_option == orog_init_option_ancil ) then + ! Set orography ancil filename from namelist write(dst_ancil_fname,'(A)') trim(dst_ancil_directory)//'/'// & trim(dst_orography_mean_ancil_path) - call files_list%insert_item( lfric_xios_file_type( & - trim(dst_ancil_fname), & - xios_id="dst_orography_mean_ancil", & - io_mode=FILE_MODE_READ ) ) + call files_list%insert_item( lfric_xios_file_type( & + trim(dst_ancil_fname), & + xios_id="dst_orography_mean_ancil", & + io_mode=FILE_MODE_READ ) ) end if - endif + end if end subroutine init_lfric2lfric_dst_files diff --git a/applications/lfric2lfric/source/initialisation/lfric2lfric_infrastructure_mod.X90 b/applications/lfric2lfric/source/initialisation/lfric2lfric_infrastructure_mod.X90 index c567f69bb..aed2ca7f1 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 @@ -52,7 +53,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, & @@ -157,18 +157,12 @@ 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(len=str_def) :: source_file_lbc + character(len=str_def) :: mesh_names(2) + character(len=str_def), allocatable :: twod_names(:) + + character(len=str_max_filename) :: start_dump_filename + character(len=str_max_filename) :: source_file_lbc ! lfric2lfric namelist parameters integer(kind=i_def) :: stencil_depth(1) @@ -215,30 +209,26 @@ 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( 'mode', mode ) - call lfric2lfric_nml%get_value( 'regrid_method', regrid_method ) - call lfric2lfric_nml%get_value( 'destination_mesh_name', & - mesh_names(dst) ) - call lfric2lfric_nml%get_value( 'source_mesh_name', & - mesh_names(src) ) - 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() + + mode = modeldb%config%lfric2lfric%mode() + 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() + source_file_lbc = modeldb%config%lfric2lfric%source_file_lbc() + 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 @@ -318,7 +308,6 @@ contains !----------------------------------------------------------------------- stencil_depth = 2 call init_mesh( modeldb%config, & - modeldb%configuration, & modeldb%mpi%get_comm_rank(), & modeldb%mpi%get_comm_size(), & mesh_names, extrusion, & @@ -473,7 +462,6 @@ contains source_collection_name, mesh_src, twod_mesh_src, & target_collection_name, mesh_dst, twod_mesh_dst ) else if (mode == mode_lbc) then - call lfric2lfric_nml%get_value( 'source_file_lbc', source_file_lbc ) call init_lfric2lfric( modeldb, context_src, context_dst, & source_file_lbc, mode, & source_collection_name, mesh_src, twod_mesh_src, & diff --git a/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 b/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 index 231e141f5..086d78128 100644 --- a/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 +++ b/applications/lfric2lfric/source/initialisation/lfric2lfric_init_mesh.f90 @@ -38,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, & @@ -68,22 +66,22 @@ 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_depths_in Required stencil depth for the application -!! for each mesh. -!> @param[in] regrid_method Apply check for even partitions with the -!> configured partition strategy if the -!> regridding method is 'map'. -!> (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_depths_in Required stencil depth for the application +!! for each mesh. +!> @param[in] regrid_method Apply check for even partitions with the +!> configured partition strategy if the +!> regridding method is 'map'. +!> (unpartitioned mesh input only) !=============================================================================== -subroutine init_mesh( config, configuration, & +subroutine init_mesh( config, & local_rank, total_ranks, & mesh_names, & extrusion, & @@ -96,8 +94,7 @@ subroutine init_mesh( config, configuration, & implicit none ! Arguments - type(namelist_collection_type), intent(in) :: configuration - type(config_type), intent(in) :: config + type(config_type), intent(in) :: config integer(kind=i_def), intent(in) :: local_rank integer(kind=i_def), intent(in) :: total_ranks @@ -113,8 +110,6 @@ subroutine init_mesh( config, configuration, & integer(kind=i_def), parameter :: src = 2 ! Namelist variables - type(namelist_type), pointer :: lfric2lfric_nml => null() - type(partitioning_nml_type), pointer :: partitioning type(partitioning_nml_type), pointer :: src_partitioning_nml type(partitioning_nml_type), pointer :: dst_partitioning_nml @@ -173,22 +168,13 @@ subroutine init_mesh( config, configuration, & 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 diff --git a/applications/lfric2lfric/source/lfric2lfric.F90 b/applications/lfric2lfric/source/lfric2lfric.F90 index c00688655..676f7e2b4 100644 --- a/applications/lfric2lfric/source/lfric2lfric.F90 +++ b/applications/lfric2lfric/source/lfric2lfric.F90 @@ -50,7 +50,6 @@ 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)') & @@ -70,8 +69,8 @@ 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, & - configuration=modeldb%configuration, & config=modeldb%config ) call init_logger( modeldb%mpi%get_comm(), program_name ) diff --git a/applications/lfric_atm/source/lfric_atm.f90 b/applications/lfric_atm/source/lfric_atm.f90 index 41c33aadb..ec60fa9d7 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,26 @@ 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 ) @@ -75,27 +72,31 @@ program lfric_atm call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - configuration=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 8043826da..0a89fba83 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,26 +28,24 @@ 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 ) @@ -71,14 +70,16 @@ program lfric_coupled call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - configuration=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 059bca0e2..a7e19db87 100644 --- a/applications/lfricinputs/source/common/lfricinp_lfric_driver_mod.f90 +++ b/applications/lfricinputs/source/common/lfricinp_lfric_driver_mod.f90 @@ -41,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 @@ -116,14 +114,8 @@ 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(config_type), save :: config -type(namelist_type), pointer :: base_mesh_nml -type(namelist_type), pointer :: planet_nml -type(namelist_type), pointer :: extrusion_nml - class(extrusion_type), allocatable :: extrusion type(uniform_extrusion_type), allocatable :: extrusion_2d character(str_def), allocatable :: base_mesh_names(:) @@ -165,12 +157,9 @@ 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=configuration, & - config=config ) +call load_configuration( lfric_nl_fname, required_lfric_namelists, config ) ! Initialise logging system call init_logger( comm, program_name ) @@ -189,16 +178,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 @@ -284,8 +269,7 @@ end subroutine lfricinp_initialise_lfric !------------------------------------------------------------------ -subroutine load_configuration( lfric_nl, required_lfric_namelists, & - configuration, config ) +subroutine load_configuration( lfric_nl, required_lfric_namelists, config ) ! Description: ! Reads lfric namelists and checks that all required namelists are present @@ -298,8 +282,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 +type(config_type), intent(inout) :: config logical :: okay logical, allocatable :: success_map(:) @@ -310,9 +293,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=configuration, & - config=config ) +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 bfab8a34c..8462b66d8 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,25 +28,23 @@ 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) @@ -67,14 +66,15 @@ program linear_model call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - configuration=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 a5783624a..a524fcfd6 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 @@ -238,9 +221,9 @@ subroutine initialise_name_transport( program_name, modeldb ) ! 1.3a Initialise prime/2d meshes ! --------------------------------------------------------- allocate(stencil_depths(num_base_meshes)) - call get_required_stencil_depth( & - stencil_depths, base_mesh_names, modeldb%configuration & - ) + call get_required_stencil_depth( stencil_depths, & + base_mesh_names, & + modeldb%config ) apply_partition_check = .false. diff --git a/applications/name_transport/source/name_transport.f90 b/applications/name_transport/source/name_transport.f90 index 2f2f4f8b3..21bc1fa0a 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,32 +23,29 @@ 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, & - configuration=modeldb%configuration, & config=modeldb%config ) call init_logger( modeldb%mpi%get_comm(), program_name ) @@ -60,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/ngarch/source/ngarch.f90 b/applications/ngarch/source/ngarch.f90 index 8e0c2fe46..ab6e11299 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,17 +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 @@ -62,21 +60,22 @@ 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, & - configuration=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 004f1ebf9..1180262d5 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 @@ -88,10 +86,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) :: geometry @@ -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 @@ -183,7 +169,7 @@ subroutine initialise_infrastructure( program_name, modeldb) allocate(stencil_depths(size(base_mesh_names))) call get_required_stencil_depth( stencil_depths, & base_mesh_names, & - modeldb%configuration ) + modeldb%config ) call init_mesh( modeldb%config, & modeldb%mpi%get_comm_rank(), & diff --git a/applications/shallow_water/source/shallow_water.f90 b/applications/shallow_water/source/shallow_water.f90 index a58581a5f..7dffed65f 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,13 @@ 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 @@ -64,14 +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, & - configuration=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/solver/source/solver.F90 b/applications/solver/source/solver.F90 index b4fff6c25..d21e212a6 100644 --- a/applications/solver/source/solver.F90 +++ b/applications/solver/source/solver.F90 @@ -13,6 +13,7 @@ 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 @@ -35,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 config_loader_mod, only: final_configuration use solver_miniapp_mod, only: solver_required_namelists use log_mod, only: log_event, & log_scratch_space, & @@ -44,8 +44,6 @@ 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 !------------------------------------ @@ -59,8 +57,7 @@ program solver character(*), parameter :: program_name = 'solver' character(:), allocatable :: filename - type(namelist_collection_type), SAVE :: configuration - type(config_type), SAVE :: config + type(config_type), save :: config integer(i_def) :: total_ranks, local_rank type(lfric_comm_type) :: comm @@ -81,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(1) @@ -117,12 +110,11 @@ 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=configuration, & config=config ) + call init_logger( comm, program_name ) call init_collections() @@ -137,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 !======================================================================= @@ -190,9 +173,8 @@ program solver !----------------------------------------------------------------------- stencil_depth = 1 check_partitions = .false. - call init_mesh( config, & - 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 edeb1f2ed..743d6ca6f 100644 --- a/applications/transport/source/driver/transport_driver_mod.f90 +++ b/applications/transport/source/driver/transport_driver_mod.f90 @@ -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 @@ -285,9 +259,9 @@ subroutine initialise_transport( program_name, modeldb ) ! 1.3a Initialise prime/2d meshes ! --------------------------------------------------------- allocate(stencil_depths(num_base_meshes)) - call get_required_stencil_depth( & - stencil_depths, base_mesh_names, modeldb%configuration & - ) + call get_required_stencil_depth( stencil_depths, & + base_mesh_names, & + modeldb%config ) apply_partition_check = .false. if ( .not. prepartitioned .and. & diff --git a/applications/transport/source/transport.f90 b/applications/transport/source/transport.f90 index 5e2bbd560..6432a4be3 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,8 +31,9 @@ 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 ) @@ -43,12 +41,11 @@ program transport call init_comm( program_name, modeldb ) - call modeldb%configuration%initialise( program_name, table_len=10 ) call modeldb%config%initialise( program_name ) call init_config( filename, transport_required_namelists, & - configuration=modeldb%configuration, & config=modeldb%config ) + call init_logger( modeldb%mpi%get_comm(), program_name ) call log_event( 'Miniapp will run with default precision set as:', & @@ -58,10 +55,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/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 6d11ad2c5..4fd52cb43 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 @@ -40,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 @@ -52,8 +51,7 @@ program jedi_lfric_time_test character(:), allocatable :: filename - type(namelist_collection_type), save :: configuration - type(config_type), save :: config + type(config_type), save :: config ! Variables used for parsing command line arguments integer(i_def) :: length, status, nargs @@ -173,12 +171,9 @@ program jedi_lfric_time_test end select ! Setup configuration, and initialise tests - call configuration%initialise( program_name, table_len=10 ) call config%initialise( program_name ) - call read_configuration( filename, & - configuration=configuration, & - config=config ) + call read_configuration( filename, config=config ) call test_jedi_interface_init() 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 a4a287444..0c11fcdc2 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,13 +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 @@ -140,7 +133,6 @@ 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, & - configuration=modeldb%configuration, & config=modeldb%config ) ! 2. Setup some model modeldb%values and initialise infrastructure @@ -158,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() @@ -210,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", & @@ -232,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() @@ -248,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 75152c9a4..5d4df794c 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,9 +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 @@ -90,7 +87,6 @@ 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, & - configuration=modeldb%configuration, & config=modeldb%config ) ! 3. Initialise the clock and calendar 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 ec58daee2..44784aa3f 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 889d2784d..b8eb37d82 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 4e8e1b566..9823c30c5 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 @@ -23,8 +23,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 @@ -37,17 +35,14 @@ 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, config, 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 @@ -55,9 +50,6 @@ subroutine initialise_mesh( mesh_name, configuration, config, 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 @@ -78,17 +70,12 @@ subroutine initialise_mesh( mesh_name, configuration, config, mpi_obj, & !-------------------------------------- ! 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 @@ -131,7 +118,7 @@ subroutine initialise_mesh( mesh_name, configuration, config, mpi_obj, & allocate(stencil_depths(size(base_mesh_names))) call get_required_stencil_depth( stencil_depths, & base_mesh_names, & - configuration ) + config ) apply_partition_check = .false. call init_mesh( config, & 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 b74f709d5..691607b2b 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/source/algorithm/timestepping/atl_si_timestep_alg_mod.x90 b/science/adjoint/source/algorithm/timestepping/atl_si_timestep_alg_mod.x90 index 679e30c38..7502c4078 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, & @@ -330,8 +329,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 @@ -346,8 +343,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() ) @@ -645,8 +641,7 @@ contains ! Solve adjoint of semi-implicit system: A * inc = rhs !----------------------------------------------------------------------- - mixed_solver_nml => modeldb%configuration%get_namelist('mixed_solver') - call mixed_solver_nml%get_value( 'mixed_solver_a_tol', mixed_solver_a_tol ) + mixed_solver_a_tol = modeldb%config%mixed_solver%mixed_solver_a_tol() ! If self%state is zero, there is no need to call the SI solver if (.not. bundle_is_zero( mixed_solver_a_tol, self%state, bundle_size )) then diff --git a/science/gungho/integration-test/cma_test/cma_test.f90 b/science/gungho/integration-test/cma_test/cma_test.f90 index 00fe7f7e2..a12a7f67f 100644 --- a/science/gungho/integration-test/cma_test/cma_test.f90 +++ b/science/gungho/integration-test/cma_test/cma_test.f90 @@ -30,7 +30,8 @@ program cma_test test_cma_diag_DhMDhT use config_mod, only : config_type use constants_mod, only : i_def, r_def, i_def, l_def, imdi, & - r_solver, pi, str_def + r_solver, pi, str_def, & + str_max_filename use derived_config_mod, only : set_derived_config use extrusion_mod, only : extrusion_type, & uniform_extrusion_type, & @@ -56,9 +57,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,15 +122,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(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(1) - character(str_def) :: file_prefix character(str_def) :: prime_mesh_name real(r_def) :: radius real(r_def) :: scaled_radius @@ -232,7 +226,6 @@ 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) @@ -245,9 +238,7 @@ program cma_test call log_event( log_scratch_space, LOG_LEVEL_INFO ) allocate( success_map(size(required_configuration)) ) - call read_configuration( filename, & - configuration=configuration, & - config=config ) + call read_configuration( filename, config=config ) okay = ensure_configuration( required_configuration, success_map ) if (.not. okay) then @@ -266,19 +257,15 @@ program cma_test call init_collections() - extrusion_nml => configuration%get_namelist('extrusion') - base_mesh_nml => configuration%get_namelist('base_mesh') - planet_nml => configuration%get_namelist('planet') - - call extrusion_nml%get_value( 'method', extrusion_method ) - call extrusion_nml%get_value( 'planet_radius', radius ) - call extrusion_nml%get_value( 'number_of_layers', number_of_layers ) - call extrusion_nml%get_value( 'domain_height', domain_height ) - call base_mesh_nml%get_value( 'file_prefix', file_prefix ) - call base_mesh_nml%get_value( 'prepartitioned', prepartitioned ) - call base_mesh_nml%get_value( 'geometry', geometry ) - call base_mesh_nml%get_value( 'prime_mesh_name', prime_mesh_name ) - call planet_nml%get_value( 'scaled_radius', scaled_radius ) + extrusion_method = config%extrusion%method() + radius = config%extrusion%planet_radius() + number_of_layers = config%extrusion%number_of_layers() + domain_height = config%extrusion%domain_height() + file_prefix = config%base_mesh%file_prefix() + prepartitioned = config%base_mesh%prepartitioned() + geometry = config%base_mesh%geometry() + prime_mesh_name = config%base_mesh%prime_mesh_name() + scaled_radius = config%planet%scaled_radius() !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Initialise diff --git a/science/gungho/source/algorithm/limited_area/init_gungho_lbcs_alg_mod.x90 b/science/gungho/source/algorithm/limited_area/init_gungho_lbcs_alg_mod.x90 index 38ba51747..b44382fce 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 8f81cc672..42d036507 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 eb7dc2d09..962d75b13 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/configuration/check_configuration_mod.F90 b/science/gungho/source/configuration/check_configuration_mod.F90 index e2a1e8e6e..7d8e49900 100644 --- a/science/gungho/source/configuration/check_configuration_mod.F90 +++ b/science/gungho/source/configuration/check_configuration_mod.F90 @@ -6,7 +6,9 @@ module check_configuration_mod - use constants_mod, only: i_def, l_def, str_def + use constants_mod, only: i_def, l_def, str_def + use config_mod, only: config_type + use mixing_config_mod, only: viscosity, & viscosity_mu use transport_config_mod, only: operators, & @@ -71,9 +73,6 @@ module check_configuration_mod monotone_qm_pos, & ffsl_splitting_swift, & ffsl_splitting_cosmic - use namelist_collection_mod, & - only : namelist_collection_type - use namelist_mod, only : namelist_type implicit none @@ -622,16 +621,15 @@ end subroutine check_configuration !> returns required stencil depth that needs to be supported. !> @param[in,out] stencil_depths Array of stencil depths for each base mesh !> @param[in] base_mesh_names Array of base mesh names - !> @param[in] configuration The configuration object + !> @param[in] config The configuration object !=========================================================================== - subroutine get_required_stencil_depth(stencil_depths, base_mesh_names, configuration) + subroutine get_required_stencil_depth(stencil_depths, base_mesh_names, config) implicit none - integer(kind=i_def), intent(inout) :: stencil_depths(:) - character(len=str_def), intent(in) :: base_mesh_names(:) - type(namelist_collection_type), intent(in) :: configuration - + integer(kind=i_def), intent(inout) :: stencil_depths(:) + character(len=str_def), intent(in) :: base_mesh_names(:) + type(config_type), intent(in) :: config integer(kind=i_def) :: i integer(kind=i_def) :: transport_depth, sl_depth @@ -639,43 +637,35 @@ subroutine get_required_stencil_depth(stencil_depths, base_mesh_names, configura logical(kind=l_def) :: any_horz_dep_pts ! Configuration variables - type(namelist_type), pointer :: base_mesh_nml - type(namelist_type), pointer :: formulation_nml - type(namelist_type), pointer :: multires_coupling_nml - type(namelist_type), pointer :: transport_nml - character(len=str_def) :: prime_mesh_name - character(len=str_def) :: aerosol_mesh_name - logical(kind=l_def) :: use_multires_coupling - logical(kind=l_def) :: coarse_aerosol_transport - integer(kind=i_def) :: operators - integer(kind=i_def) :: fv_horizontal_order - integer(kind=i_def) :: panel_edge_treatment - logical(kind=l_def) :: panel_edge_high_order - integer(kind=i_def) :: dep_pt_stencil_extent - integer(kind=i_def) :: ffsl_inner_order - integer(kind=i_def) :: ffsl_outer_order + character(len=str_def) :: prime_mesh_name + character(len=str_def) :: aerosol_mesh_name + logical(kind=l_def) :: use_multires_coupling + logical(kind=l_def) :: coarse_aerosol_transport + integer(kind=i_def) :: operators + integer(kind=i_def) :: fv_horizontal_order + integer(kind=i_def) :: panel_edge_treatment + logical(kind=l_def) :: panel_edge_high_order + integer(kind=i_def) :: dep_pt_stencil_extent + integer(kind=i_def) :: ffsl_inner_order + integer(kind=i_def) :: ffsl_outer_order ! ------------------------------------------------------------------------ ! ! Get configuration variables ! ------------------------------------------------------------------------ ! + prime_mesh_name = config%base_mesh%prime_mesh_name() + + operators = config%transport%operators() + fv_horizontal_order = config%transport%fv_horizontal_order() + panel_edge_treatment = config%transport%panel_edge_treatment() + panel_edge_high_order = config%transport%panel_edge_high_order() + dep_pt_stencil_extent = config%transport%dep_pt_stencil_extent() + ffsl_inner_order = config%transport%ffsl_inner_order() + ffsl_outer_order = config%transport%ffsl_outer_order() - base_mesh_nml => configuration%get_namelist('base_mesh') - formulation_nml => configuration%get_namelist('formulation') - transport_nml => configuration%get_namelist('transport') - - call base_mesh_nml%get_value('prime_mesh_name', prime_mesh_name) - call formulation_nml%get_value('use_multires_coupling', use_multires_coupling) - call transport_nml%get_value('operators', operators) - call transport_nml%get_value('fv_horizontal_order', fv_horizontal_order) - call transport_nml%get_value('panel_edge_treatment', panel_edge_treatment) - call transport_nml%get_value('panel_edge_high_order', panel_edge_high_order) - call transport_nml%get_value('dep_pt_stencil_extent', dep_pt_stencil_extent) - call transport_nml%get_value('ffsl_inner_order', ffsl_inner_order) - call transport_nml%get_value('ffsl_outer_order', ffsl_outer_order) + use_multires_coupling = config%formulation%use_multires_coupling() if (use_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('coarse_aerosol_transport', coarse_aerosol_transport) + aerosol_mesh_name = config%multires_coupling%aerosol_mesh_name() + coarse_aerosol_transport = config%multires_coupling%coarse_aerosol_transport() end if ! ------------------------------------------------------------------------ ! diff --git a/science/gungho/source/driver/gungho_driver_mod.F90 b/science/gungho/source/driver/gungho_driver_mod.F90 index 2c1e5a37a..36180a970 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 db9e0d3db..be4551dbd 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 fe12c91ae..a544f263c 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 @@ -675,7 +655,7 @@ subroutine initialise_infrastructure( io_context_name, modeldb ) allocate(stencil_depths(size(base_mesh_names))) call get_required_stencil_depth( stencil_depths, & base_mesh_names, & - modeldb%configuration ) + modeldb%config ) call init_mesh( modeldb%config, & modeldb%mpi%get_comm_rank(), & diff --git a/science/gungho/source/driver/iau_multifile_io/iau_firstfile_io_mod.F90 b/science/gungho/source/driver/iau_multifile_io/iau_firstfile_io_mod.F90 index efca60c32..6d91dd069 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 @@ -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) @@ -105,7 +91,7 @@ subroutine iau_incs_firstfile_io ( io_context_name, modeldb, & !set up file list file_list => io_context%get_filelist() - multifile_fields => modeldb%fields%get_field_collection(iau_incs) + multifile_fields => modeldb%fields%get_field_collection(iau_incs) if ( use_xios_io) then 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 f20db5bd3..54478a949 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 @@ -47,6 +54,7 @@ module iau_multifile_io_mod public :: setup_step_multifile_io public :: step_multifile_io public :: finalise_multifile_io + private :: init_iau_incs_io private :: context_init @@ -57,35 +65,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 +145,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 +184,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 +237,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 +253,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/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 799b81afd..6989c56f2 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(geometry_planar, topology_fully_periodic ) + call init_chi_transforms(geometry_planar, topology_fully_periodic) end subroutine set_up diff --git a/science/linear/integration-test/nwp_gal9/nwp_gal9.f90 b/science/linear/integration-test/nwp_gal9/nwp_gal9.f90 index 7c3aeb90b..5d2e0ee75 100644 --- a/science/linear/integration-test/nwp_gal9/nwp_gal9.f90 +++ b/science/linear/integration-test/nwp_gal9/nwp_gal9.f90 @@ -50,7 +50,6 @@ program nwp_gal9 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) @@ -116,7 +115,6 @@ program nwp_gal9 call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - configuration=modeldb%configuration, & config=modeldb%config ) call init_logger( modeldb%mpi%get_comm(), application_name ) call init_collections() diff --git a/science/linear/integration-test/runge_kutta/runge_kutta.f90 b/science/linear/integration-test/runge_kutta/runge_kutta.f90 index 7de15a664..fee8f8dff 100644 --- a/science/linear/integration-test/runge_kutta/runge_kutta.f90 +++ b/science/linear/integration-test/runge_kutta/runge_kutta.f90 @@ -60,7 +60,6 @@ program runge_kutta 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) @@ -140,7 +139,6 @@ program runge_kutta call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - configuration=modeldb%configuration, & config=modeldb%config ) call init_logger( modeldb%mpi%get_comm(), application_name ) 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 d02b8fde2..c80fbb4d7 100644 --- a/science/linear/integration-test/semi_implicit/semi_implicit.f90 +++ b/science/linear/integration-test/semi_implicit/semi_implicit.f90 @@ -44,7 +44,6 @@ program semi_implicit 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) @@ -104,7 +103,6 @@ program semi_implicit call init_comm( application_name, modeldb ) call init_config( filename, gungho_required_namelists, & - configuration=modeldb%configuration, & config=modeldb%config ) call init_logger( modeldb%mpi%get_comm(), application_name ) 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 d912604f0..727a634da 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 @@ -400,9 +399,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' ) @@ -848,9 +847,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 c7ac56319..c754329a8 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/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 cb8b0f1b9..87286eeda 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 @@ -85,7 +85,6 @@ contains pert_centre=pert_centre, & profile_heights=profile_heights ) - call init_chi_transforms(geometry_planar, topology_fully_periodic) call feign_planet_config( gravity=10.0_r_def, &