Initialize various model grids (e.g., dynamics, physics) in terms of dynamics decomposition. Additionally, MPAS framework initialization and reading time-invariant (e.g., grid/mesh) variables are also being completed in this subroutine. (KCW, 2024-03-29)
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(file_desc_t), | private, | pointer | :: | pio_file | |||
character(len=*), | private, | parameter | :: | subname | = | 'dyn_grid::model_grid_init' |
subroutine model_grid_init() ! Module(s) from CAM-SIMA. use cam_abortutils, only: endrun use cam_constituents, only: num_advected use cam_initfiles, only: initial_file_get_id use cam_logfile, only: debugout_debug, debugout_info, debugout_verbose use dyn_comp, only: dyn_debug_print, dyn_inquire_mesh_dimensions, mpas_dynamical_core, nvertlevels use dynconst, only: dynconst_init use string_utils, only: stringify use vert_coord, only: pver, vert_coord_init ! Module(s) from external libraries. use pio, only: file_desc_t character(*), parameter :: subname = 'dyn_grid::model_grid_init' type(file_desc_t), pointer :: pio_file call dyn_debug_print(debugout_debug, subname // ' entered') nullify(pio_file) ! Initialize mathematical and physical constants for dynamics. call dynconst_init() call dyn_debug_print(debugout_info, 'Initializing vertical coordinate indexes') ! Initialize vertical coordinate indexes. ! `pver` comes from CAM-SIMA namelist. ! `pverp` is set only after this call. Call it as soon as possible. call vert_coord_init(1, pver) ! Get PIO file descriptor for initial file. pio_file => initial_file_get_id() call dyn_debug_print(debugout_info, 'Initializing MPAS dynamical core (Phase 3/4)') ! Finish MPAS framework initialization, including ! the allocation of all blocks and fields managed by MPAS. call mpas_dynamical_core % init_phase3(num_advected, pio_file) call dyn_debug_print(debugout_info, 'Initializing MPAS mesh variables') ! Read time-invariant (e.g., grid/mesh) variables. call mpas_dynamical_core % read_write_stream(pio_file, 'r', 'invariant') nullify(pio_file) ! Compute local east, north and edge-normal unit vectors whenever time-invariant (e.g., grid/mesh) variables are read. call mpas_dynamical_core % compute_unit_vector() ! Inquire local and global mesh dimensions. call dyn_inquire_mesh_dimensions() ! Check for consistency in numbers of vertical layers. if (nvertlevels /= pver) then call dyn_debug_print(debugout_verbose, 'Number of vertical layers in CAM-SIMA namelist, pver = ' // & stringify([pver])) call dyn_debug_print(debugout_verbose, 'Number of vertical layers in initial file, nvertlevels = ' // & stringify([nvertlevels])) call endrun('Numbers of vertical layers mismatch', subname, __LINE__) end if call dyn_debug_print(debugout_info, 'Initializing reference pressure') ! Initialize reference pressure for use by physics. call init_reference_pressure() call dyn_debug_print(debugout_info, 'Initializing physics grid') ! Initialize physics grid. call init_physics_grid() call dyn_debug_print(debugout_info, 'Registering dynamics grid with CAM-SIMA') ! Register dynamics grid with CAM-SIMA. call define_cam_grid() call dyn_debug_print(debugout_debug, subname // ' completed') end subroutine model_grid_init