Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ module lfric2lfric_infrastructure_mod
get_panel_id_inventory
use init_altitude_mod, only: init_altitude
use inventory_by_mesh_mod, only: inventory_by_mesh_type
use io_context_mod, only: callback_clock_arg
use linked_list_mod, only: linked_list_type
use lfric_xios_context_mod, only: lfric_xios_context_type
use lfric_xios_action_mod, only: advance
Expand Down Expand Up @@ -197,7 +196,6 @@ contains
!------------------------
! Pointer for subroutines used in init_io
procedure(filelist_populator), pointer :: files_init_ptr
procedure(callback_clock_arg), pointer :: before_close

! Source context pointer and temporary context for setup
type(lfric_xios_context_type) :: tmp_io_context_src
Expand Down Expand Up @@ -426,13 +424,12 @@ contains
call panel_id_inventory%get_field(mesh_src, panel_id)

! Using correct chi and panel_id, initialise xios context for source mesh
nullify( before_close )
call io_context_src%initialise_xios_context( modeldb%mpi%get_comm(), &
chi, &
panel_id, &
modeldb%clock, &
modeldb%calendar, &
before_close )
modeldb%calendar )
call io_context_src%close_context_definition()

!=======================================================================
! Initialise source orography
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ module lfricinp_lfric_driver_mod
use gungho_extrusion_mod, only: create_extrusion
use halo_comms_mod, only: initialise_halo_comms
use inventory_by_mesh_mod, only: inventory_by_mesh_type
use io_context_mod, only: callback_clock_arg
use lfric_xios_context_mod, only: lfric_xios_context_type
use lfric_xios_action_mod, only: advance
use lfric_xios_driver_mod, only: lfric_xios_initialise, &
Expand Down Expand Up @@ -110,7 +109,6 @@ subroutine lfricinp_initialise_lfric(program_name_arg, &
type(field_type), pointer :: panel_id => null()
type(inventory_by_mesh_type), pointer :: chi_inventory => null()
type(inventory_by_mesh_type), pointer :: panel_id_inventory => null()
procedure(callback_clock_arg), pointer :: before_close => null()
class(event_actor_type), pointer :: event_actor_ptr
procedure(event_action), pointer :: context_advance

Expand Down Expand Up @@ -255,7 +253,7 @@ subroutine lfricinp_initialise_lfric(program_name_arg, &
call io_config%init_lfricinp_files(file_list)
call io_context%initialise( xios_ctx )
call io_context%initialise_xios_context( comm, chi, panel_id, &
model_clock, model_calendar, before_close )
model_clock, model_calendar )
! Attach context advancement to the model's clock
context_advance => advance
event_actor_ptr => io_context
Expand Down
4 changes: 2 additions & 2 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ lfric_apps:
ref:

lfric_core:
source: git@github.com:MetOffice/lfric_core.git
ref: bf236737858c4ed29957124a2f64fd0e4f4fd7be
source: git@github.com:EdHone/lfric_core.git
ref: 291-context-definition

moci:
source: git@github.com:MetOffice/moci.git
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,43 +256,45 @@ Simplified call tree for setting up I/O in LFRic_atm
│ │
│ └─init_io (components/driver/driver_io_mod.F90)
│ │
│ └─init_xios_io_context (components/driver/driver_io_mod.F90)
│ │
│ ├─populate_filelist (=> init_gungho_files) (gungho/driver/gungho_setup_io_mod.F90)
│ │
│ └─io_context%initialise_xios_context (components/lfric_xios/lfric_xios_context_mod.f90)
│ │
│ ├─xios_context_initialise xios
│ │
│ ├─xios_get_handle xios
│ │
│ ├─xios_set_current_context xios
│ │
│ ├─init_xios_calendar (components/lfric_xios/lfric_xios_setup_mod.x90)
│ │
│ ├─init_xios_dimensions (components/lfric_xios/lfric_xios_setup_mod.x90)
│ │
│ ├─setup_xios_files (components/lfric_xios/lfric_xios_setup_mod.x90)
│ │
│ ├─before_close (=> before_context_close) (gungho/driver/gungho_model_mod.F90)
│ │ │
│ │ ├─persistor%init (gungho/driver/gungho_model_mod.F90)
│ │ │
│ │ ├─process_gungho_prognostics(persistor) (gungho/driver/create_gungho_prognostics_mod.F90)
│ │ │ │
│ │ │ └─persistor%apply(makespec()) (gungho/driver/gungho_model_mod.F90)
│ │ │ │
│ │ │ └─add_field (components/lfric-xios/lfric_xios_metafile_mod.F90)
│ │ │ │
│ │ │ ├─(various xios calls...) xios
│ │ │ │
│ │ │ └─handle_legacy_field (components/lfric-xios/lfric_xios_metafile_mod.F90)
│ │ │
│ │ └─process_physics_prognostics(persistor) (gungho/driver/create_physics_prognostics_mod.F90)
│ │ │
│ │ └─(…)
│ ├─init_xios_io_context (components/driver/driver_io_mod.F90)
│ │ │
│ │ ├─populate_filelist (=> init_gungho_files) (gungho/driver/gungho_setup_io_mod.F90)
│ │ │
│ │ └─io_context%initialise_xios_context (components/lfric_xios/lfric_xios_context_mod.f90)
│ │ │
│ │ ├─xios_context_initialise xios
│ │ │
│ │ ├─xios_get_handle xios
│ │ │
│ │ ├─xios_set_current_context xios
│ │ │
│ │ ├─init_xios_calendar (components/lfric_xios/lfric_xios_setup_mod.x90)
│ │ │
│ │ ├─init_xios_dimensions (components/lfric_xios/lfric_xios_setup_mod.x90)
│ │ │
│ │ └─setup_xios_files (components/lfric_xios/lfric_xios_setup_mod.x90)
│ │
│ ├─before_close (=> before_context_close) (gungho/driver/gungho_model_mod.F90)
│ │ │
│ │ ├─persistor%init (gungho/driver/gungho_model_mod.F90)
│ │ │
│ │ ├─process_gungho_prognostics(persistor) (gungho/driver/create_gungho_prognostics_mod.F90)
│ │ │ │
│ │ │ └─persistor%apply(makespec()) (gungho/driver/gungho_model_mod.F90)
│ │ │ │
│ │ │ └─add_field (components/lfric-xios/lfric_xios_metafile_mod.F90)
│ │ │ │
│ │ │ ├─(various xios calls...) xios
│ │ │ │
│ │ │ └─handle_legacy_field (components/lfric-xios/lfric_xios_metafile_mod.F90)
│ │ │
│ │ └─process_physics_prognostics(persistor) (gungho/driver/create_physics_prognostics_mod.F90)
│ │ │
│ │ └─(…)
│ │
│ └─io_context%close_context_definition (components/lfric_xios/lfric_xios_context_mod.f90)
│ │
│ └─xios_close_context_definitions xios
│ └─xios_close_context_definition xios
└─create_model_data (gungho/driver/gungho_init_fields_mod.X90)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module jedi_lfric_io_setup_mod
use jedi_lfric_init_files_mod, only: jedi_lfric_init_files

#ifdef USE_XIOS
use io_context_mod, only: io_context_type, callback_clock_arg
use io_context_mod, only: io_context_type
use lfric_xios_context_mod, only: lfric_xios_context_type
use lfric_xios_action_mod, only: advance
#endif
Expand Down Expand Up @@ -111,17 +111,14 @@ end subroutine initialise_io
!> @param[in] chi The model's coordinate fields
!> @param[in] panel_id The model's panel ID fields
!> @param[in] model_clock The model clock
!> @param[in] before_close Optional routine to be called before
!> context closes
subroutine init_io( context_name, &
communicator, &
file_meta, &
calendar, &
io_context, &
chi, &
panel_id, &
model_clock, &
before_close )
model_clock )

implicit none

Expand All @@ -133,22 +130,15 @@ subroutine init_io( context_name, &
type(field_type), intent(in) :: chi(:)
type(field_type), intent(in) :: panel_id
type(model_clock_type), intent(inout) :: model_clock
procedure(callback_clock_arg), optional :: before_close


! Local
procedure(callback_clock_arg), pointer :: before_close_ptr => null()
integer(i_def) :: rc
type(linked_list_type), pointer :: file_list
class(event_actor_type), pointer :: event_actor_ptr
procedure(event_action), pointer :: context_advance
type(lfric_comm_type) :: lfric_comm

! Allocate XIOS IO context types
if (present(before_close)) then
before_close_ptr => before_close
end if

allocate( lfric_xios_context_type::io_context, stat=rc )
if (rc /= 0) then
call log_event( "Unable to allocate LFRic-XIOS context object", &
Expand All @@ -168,12 +158,16 @@ subroutine init_io( context_name, &
call lfric_comm%set_comm_mpi_val(communicator)
call io_context%initialise_xios_context( lfric_comm, &
chi, panel_id, &
model_clock, calendar, &
before_close_ptr )
model_clock, calendar )

! Attach context advancement to the model's clock
context_advance => advance
event_actor_ptr => io_context
call model_clock%add_event( context_advance, event_actor_ptr )

! Close definition of I/O context
call io_context%close_context_definition()

end select

end subroutine init_io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module iau_firstfile_io_mod
use field_mod, only: field_type
use file_mod, only: FILE_MODE_READ
use inventory_by_mesh_mod, only: inventory_by_mesh_type
use io_context_mod, only: callback_clock_arg
use lfric_string_mod, only: split_string
use lfric_xios_context_mod, only: lfric_xios_context_type
use lfric_xios_file_mod, only: lfric_xios_file_type, &
Expand Down Expand Up @@ -70,10 +69,6 @@ subroutine iau_incs_firstfile_io ( io_context_name, modeldb, &

logical(l_def) :: use_xios_io

procedure(callback_clock_arg), pointer :: before_close

nullify(before_close)

chi_inventory => get_chi_inventory()
panel_id_inventory => get_panel_id_inventory()

Expand Down Expand Up @@ -121,7 +116,6 @@ subroutine iau_incs_firstfile_io ( io_context_name, modeldb, &
call io_context%initialise_xios_context( modeldb%mpi%get_comm(), &
chi, panel_id, &
modeldb%clock, tmp_calendar, &
before_close, &
start_at_zero=.true. )
! Finalise XIOS context
call io_context%finalise_xios_context()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ module iau_multifile_io_mod
#endif
use iau_time_control_mod, only: calc_iau_ts_num
use inventory_by_mesh_mod, only: inventory_by_mesh_type
use io_context_mod, only: callback_clock_arg
use lfric_xios_context_mod, only: lfric_xios_context_type
use linked_list_mod, only: linked_list_type
use lfric_xios_action_mod, only: advance_read_only
Expand Down Expand Up @@ -266,9 +265,6 @@ subroutine step_multifile_io( io_context_name, modeldb, name )
character(str_def) :: time_start

procedure(event_action), pointer :: context_advance
procedure(callback_clock_arg), pointer :: before_close

nullify(before_close)

chi_inventory => get_chi_inventory()
panel_id_inventory => get_panel_id_inventory()
Expand Down Expand Up @@ -297,7 +293,6 @@ subroutine step_multifile_io( io_context_name, modeldb, name )
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
Expand Down
Loading