diff --git a/io/fv3atm_rrfs_sd_io.F90 b/io/fv3atm_rrfs_sd_io.F90 index 0e515e4fc..c99275302 100644 --- a/io/fv3atm_rrfs_sd_io.F90 +++ b/io/fv3atm_rrfs_sd_io.F90 @@ -1,7 +1,14 @@ -!> \file fv3atm_rrfs_sd_io.F90 -!! This file contains derived types and subroutines for RRFS-SD scheme I/O. -!! They read and write restart files, and read emissions data. - +!> @file +!> @brief Derived types and subroutines for RRFS-SD scheme I/O. +!> +!> @author Samuel Trahan @date Jun 20, 2023 + +!> @brief Derived types and subroutines for RRFS-SD scheme I/O. +!> +!> These subroutines read and write restart files, and read emissions +!> data. +!> +!> @author Samuel Trahan @date Jun 20, 2023 module fv3atm_rrfs_sd_io use block_control_mod, only: block_control_type use fms2_io_mod, only: FmsNetcdfDomainFile_t, write_data, & @@ -26,13 +33,10 @@ module fv3atm_rrfs_sd_io rrfs_sd_emissions_register_emi, rrfs_sd_emissions_copy_emi, & rrfs_sd_emissions_register_fire, rrfs_sd_emissions_copy_fire - !>\defgroup fv3atm_rrfs_sd_io module - !> @{ - - !>@ Temporary data storage for reading and writing restart data for the RRFS-SD scheme. + !> Temporary data storage for reading and writing restart data for + !> the RRFS-SD scheme. The rrfs_sd_state_type stores temporary + !> arrays used to read or write RRFS-SD restart and axis variables. type rrfs_sd_state_type - ! The rrfs_sd_state_type stores temporary arrays used to read or - ! write RRFS-SD restart and axis variables. real(kind_phys), pointer, private, dimension(:,:) :: & ! i,j variables emdust=>null(), emseas=>null(), emanoc=>null(), fhist=>null(), coef_bb_dc=>null() @@ -58,21 +62,29 @@ module fv3atm_rrfs_sd_io ! -------------------------------------------------------------------- - !>@ Temporary data storage for reading RRFS-SD emissions data + !> Temporary data storage for reading RRFS-SD emissions data. type rrfs_sd_emissions_type integer, private :: nvar_dust12m = 5 integer, private :: nvar_emi = 1 integer, private :: nvar_fire = 2 integer, private :: nvar_fire2d = 5 + !> ??? character(len=32), pointer, dimension(:), private :: dust12m_name => null() + !> ??? character(len=32), pointer, dimension(:), private :: emi_name => null() + !> ??? character(len=32), pointer, dimension(:), private :: fire_name => null() + !> ??? character(len=32), pointer, dimension(:), private :: fire_name2d => null() + !> ??? real(kind=kind_phys), pointer, dimension(:,:,:,:), private :: dust12m_var => null() + !> ??? real(kind=kind_phys), pointer, dimension(:,:,:,:), private :: emi_var => null() + !> ??? real(kind=kind_phys), pointer, dimension(:,:,:,:), private :: fire_var => null() + !> ??? real(kind=kind_phys), pointer, dimension(:,:,: ), private :: fire_var2d => null() contains @@ -98,7 +110,13 @@ module fv3atm_rrfs_sd_io ! -- RRFS_SD_STATE IMPLEMENTATION ------------------------------------ ! -------------------------------------------------------------------- - !>@ Registers the fire_aux_data_levels axis for restart I/O + !> Registers the fire_aux_data_levels axis for restart I/O. + !> + !> @param data ??? + !> @param[in] Model ??? + !> @param Sfc_restart ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine rrfs_sd_state_register_axis(data,Model,Sfc_restart) implicit none class(rrfs_sd_state_type) :: data @@ -110,7 +128,13 @@ end subroutine rrfs_sd_state_register_axis ! -------------------------------------------------------------------- - !>@ Registers and writes the axis indices for the fire_aux_data_levels axis + !> Registers and writes the axis indices for the fire_aux_data_levels axis. + !> + !> @param data ??? + !> @param[in] Model ??? + !> @param Sfc_restart ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine rrfs_sd_state_write_axis(data,Model,Sfc_restart) implicit none class(rrfs_sd_state_type) :: data @@ -124,7 +148,13 @@ end subroutine rrfs_sd_state_write_axis ! -------------------------------------------------------------------- - !>@ Allocates temporary arrays for RRFS-SD scheme I/O and stores fire_aux_data_levels axis indices + !> Allocates temporary arrays for RRFS-SD scheme I/O and stores + !> fire_aux_data_levels axis indices. + !> + !> @param data ??? + !> @param[in] Model ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine rrfs_sd_state_allocate_data(data,Model) implicit none class(rrfs_sd_state_type) :: data @@ -152,10 +182,17 @@ end subroutine rrfs_sd_state_allocate_data ! -------------------------------------------------------------------- - !>@brief Fills RRFS-SD temporary arrays with reasonable defaults. - !> \section rrfs_sd_state_type%fill_data() procedure - !! Fills all temporary variables with default values. - !! Terrible things will happen if you don't call data%allocate_data first. + !> Fills RRFS-SD temporary arrays with reasonable defaults. + !> + !> Fills all temporary variables with default values. + !> Terrible things will happen if you don't call data%allocate_data first. + !> + !> @param data ??? + !> @param[in] Model ??? + !> @param[in] Atm_block ??? + !> @param Sfcprop ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine rrfs_sd_state_fill_data(data, Model, Atm_block, Sfcprop) implicit none class(rrfs_sd_state_type) :: data @@ -187,11 +224,16 @@ end subroutine rrfs_sd_state_fill_data ! -------------------------------------------------------------------- - !>@brief Registers RRFS-SD restart variables (for read or write) - !> \section rrfs_sd_state_type%register_fields() procedure - !! Registers all restart fields needed by the RRFS-SD - !! Terrible things will happen if you don't call data%allocate_data - !! and data%register_axes first. + !> Registers RRFS-SD restart variables (for read or write). + !> + !> Registers all restart fields needed by the RRFS-SD + !> Terrible things will happen if you don't call data%allocate_data + !> and data%register_axes first. + !> + !> @param data ??? + !> @param Sfc_restart ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine rrfs_sd_state_register_fields(data,Sfc_restart) implicit none class(rrfs_sd_state_type) :: data @@ -226,11 +268,20 @@ end subroutine rrfs_sd_state_register_fields ! -------------------------------------------------------------------- - !>@brief Creates ESMF bundles for writing RRFS-SD restarts via the write component (quilt) - !> \section rrfs_sd_state_type%bundle_fields() procedure - !! Registers all restart fields needed by the RRFS-SD - !! Terrible things will happen if you don't call data%allocate_data - !! and data%register_axes first. + !> Creates ESMF bundles for writing RRFS-SD restarts via the write + !> component (quilt). + !> + !> Registers all restart fields needed by the RRFS-SD + !> Terrible things will happen if you don't call data%allocate_data + !> and data%register_axes first. + !> + !> @param data ??? + !> @param bundle ??? + !> @param grid ??? + !> @param[in] Model ??? + !> @param[in] outputfile ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine rrfs_sd_bundle_fields(data, bundle, grid, Model, outputfile) use esmf use GFS_typedefs, only: GFS_control_type @@ -255,12 +306,16 @@ end subroutine rrfs_sd_bundle_fields ! -------------------------------------------------------------------- - !>@brief Destructor for the rrfs_sd_state_type - !> \section rrfs_sd_state_type destructor() procedure - !! Final routine for rrfs_sd_state_type, called automatically when - !! an object of that type goes out of scope. This is a wrapper - !! around data%deallocate_data() with necessary syntactic - !! differences. + !> Destructor for the rrfs_sd_state_type. + !> + !> Final routine for rrfs_sd_state_type, called automatically when + !> an object of that type goes out of scope. This is a wrapper + !> around data%deallocate_data() with necessary syntactic + !> differences. + !> + !> @param data ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine rrfs_sd_state_final(data) implicit none type(rrfs_sd_state_type) :: data @@ -269,16 +324,20 @@ end subroutine rrfs_sd_state_final ! -------------------------------------------------------------------- - !>@brief Deallocates internal arrays in an rrfs_sd_state_type - !> \section rrfs_sd_state_type%deallocate_data() procedure - !! Deallocates all data used, and nullifies the pointers. The data - !! object can safely be used again after this call. This is also - !! the implementation of the rrfs_sd_state_deallocate_data final routine. + !> Deallocates internal arrays in an rrfs_sd_state_type. + !> + !> Deallocates all data used, and nullifies the pointers. The data + !> object can safely be used again after this call. This is also + !> the implementation of the rrfs_sd_state_deallocate_data final routine. + !> + !> @param data ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine rrfs_sd_state_deallocate_data(data) implicit none class(rrfs_sd_state_type) :: data - ! This #define reduces code length by a lot + !> This #define reduces code length by a lot #define IF_ASSOC_DEALLOC_NULL(var) \ if(associated(data%var)) then ; \ deallocate(data%var) ; \ @@ -299,10 +358,17 @@ end subroutine rrfs_sd_state_deallocate_data ! -------------------------------------------------------------------- - !>@brief Copies from rrfs_sd_state_type internal arrays to the model grid. - !> \section rrfs_sd_state_type%copy_to_grid() procedure - !! This procedure is called after reading a restart, to copy restart data - !! from the rrfs_sd_state_type to the model grid. + !> Copies from rrfs_sd_state_type internal arrays to the model grid. + !> + !> This procedure is called after reading a restart, to copy restart data + !> from the rrfs_sd_state_type to the model grid. + !> + !> @param data ??? + !> @param[in] Model ??? + !> @param[in] Atm_block ??? + !> @param[in] Sfcprop ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine rrfs_sd_state_copy_to_grid(data, Model, Atm_block, Sfcprop) implicit none class(rrfs_sd_state_type) :: data @@ -332,11 +398,18 @@ end subroutine rrfs_sd_state_copy_to_grid ! -------------------------------------------------------------------- - !>@brief Copies from the model grid to rrfs_sd_state_type internal arrays - !> \section rrfs_sd_state_type%copy_from_grid() procedure - !! This procedure is called before writing the restart, to copy data from - !! the model grid to rrfs_sd_state_type internal arrays. The ESMF or FMS - !! restart code will write data from those arrays, not the model grid. + !> Copies from the model grid to rrfs_sd_state_type internal arrays. + !> + !> This procedure is called before writing the restart, to copy data from + !> the model grid to rrfs_sd_state_type internal arrays. The ESMF or FMS + !> restart code will write data from those arrays, not the model grid. + !> + !> @param data ??? + !> @param[in] Model ??? + !> @param[in] Atm_block ??? + !> @param[in] Sfcprop ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine rrfs_sd_state_copy_from_grid(data, Model, Atm_block, Sfcprop) implicit none class(rrfs_sd_state_type) :: data @@ -368,7 +441,14 @@ end subroutine rrfs_sd_state_copy_from_grid ! -- RRFS_SD_EMISSIONS IMPLEMENTATION -------------------------------- ! -------------------------------------------------------------------- - !>@ Allocates temporary arrays and registers variables for reading the dust12m file. + !> Allocates temporary arrays and registers variables for reading + !> the dust12m file. + !> + !> @param data ??? + !> @param Sfc_restart ??? + !> @param[in] Atm_block ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine rrfs_sd_emissions_register_dust12m(data, restart, Atm_block) implicit none class(rrfs_sd_emissions_type) :: data @@ -413,8 +493,15 @@ end subroutine rrfs_sd_emissions_register_dust12m ! -------------------------------------------------------------------- - !>@ Called after register_dust12m() to copy data from internal arrays to the model grid and deallocate arrays - subroutine rrfs_sd_emissions_copy_dust12m(data, Model, Sfcprop, Atm_block) + !> Called after register_dust12m() to copy data from internal arrays + !> to the model grid and deallocate arrays. + !> + !> @param data ??? + !> @param[inout] Sfcprop ??? + !> @param[in] Atm_block ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 + subroutine rrfs_sd_emissions_copy_dust12m(data, Sfcprop, Atm_block) implicit none type(GFS_control_type), intent(in) :: Model type(GFS_sfcprop_type), intent(inout) :: Sfcprop @@ -453,7 +540,14 @@ end subroutine rrfs_sd_emissions_copy_dust12m ! -------------------------------------------------------------------- - !>@ Allocates temporary arrays and registers variables for reading the emissions file. + !> Allocates temporary arrays and registers variables for reading + !> the emissions file. + !> + !> @param data ??? + !> @param restart ??? + !> @param[in] Atm_block ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine rrfs_sd_emissions_register_emi(data, restart, Atm_block) implicit none class(rrfs_sd_emissions_type) :: data @@ -528,7 +622,15 @@ end subroutine rrfs_sd_emissions_copy_emi ! -------------------------------------------------------------------- - !>@ Allocates temporary arrays and registers variables for reading the fire data file. + !> Allocates temporary arrays and registers variables for reading + !> the fire data file. + !> + !> @param data ??? + !> @param[in] Model ??? + !> @param restart ??? + !> @param[in] Atm_block ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine rrfs_sd_emissions_register_fire(data, Model, restart, Atm_block) implicit none class(rrfs_sd_emissions_type) :: data @@ -607,7 +709,15 @@ end subroutine rrfs_sd_emissions_register_fire ! -------------------------------------------------------------------- - !>@ Called after register_fire() to copy data from internal arrays to the model grid and deallocate arrays + !> Called after register_fire() to copy data from internal arrays to + !> the model grid and deallocate arrays. + !> + !> @param data ??? + !> @param[in] Model ??? + !> @param[inout] Sfcprop ??? + !> @param[in] Atm_block ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine rrfs_sd_emissions_copy_fire(data, Model, Sfcprop, Atm_block) implicit none class(rrfs_sd_emissions_type) :: data @@ -646,12 +756,16 @@ subroutine rrfs_sd_emissions_copy_fire(data, Model, Sfcprop, Atm_block) enddo end subroutine rrfs_sd_emissions_copy_fire - !>@ Destructor for rrfs_sd_emissions_type + !> Destructor for rrfs_sd_emissions_type. + !> + !> @param data ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine rrfs_sd_emissions_final(data) implicit none type(rrfs_sd_emissions_type) :: data - ! This #define reduces code length by a lot + !> This #define reduces code length by a lot. #define IF_ASSOC_DEALLOC_NULL(var) \ if(associated(data%var)) then ; \ deallocate(data%var) ; \ @@ -670,5 +784,3 @@ subroutine rrfs_sd_emissions_final(data) end subroutine rrfs_sd_emissions_final end module fv3atm_rrfs_sd_io - -!> @} diff --git a/io/fv3atm_sfc_io.F90 b/io/fv3atm_sfc_io.F90 index 0d1e1193a..b43f514de 100644 --- a/io/fv3atm_sfc_io.F90 +++ b/io/fv3atm_sfc_io.F90 @@ -1,8 +1,18 @@ -!> \file fv3atm_sfc_io.F90 -!! This file contains a derived type and subroutines to read and write restart files for -!! most FV3ATM surface fields. It works both for quilt (via ESMF) and non-quilt (via FMS) -!! restarts. Certain fields are handled by other files: fv3atm_oro_io.F90, fv3atm_rrfs_sd_io.F90, -!! and fv3atm_clm_lake_io.F90. +!> @file +!> @brief Derived type and subroutines to read and write restart files +!> for most FV3ATM surface fields. +!> +!> @author Samuel Trahan @date Jun 20, 2023 + +!> @brief Derived type and subroutines to read and write restart files +!> for most FV3ATM surface fields. +!> +!> This module works both for quilt (via ESMF) and non-quilt (via FMS) +!> restarts. Certain fields are handled by other files: +!> fv3atm_oro_io.F90, fv3atm_rrfs_sd_io.F90, and +!> fv3atm_clm_lake_io.F90. +!> +!> @author Samuel Trahan @date Jun 20, 2023 module fv3atm_sfc_io use block_control_mod, only: block_control_type @@ -27,10 +37,7 @@ module fv3atm_sfc_io Sfc_io_register_3d_fields, Sfc_io_copy_to_grid, Sfc_io_copy_from_grid, & Sfc_io_apply_safeguards, Sfc_io_transfer, Sfc_io_final - !> \defgroup fv3atm_sfc_io module - !> @{ - - !>@ Minimum temperature allowed for snow/ice + !> Minimum temperature allowed for snow/ice. real(kind=kind_phys), parameter :: timin = 173.0_kind_phys real(kind_phys), parameter:: min_lake_orog = 200.0_kind_phys @@ -38,16 +45,16 @@ module fv3atm_sfc_io !> Internal data storage type for reading and writing surface restart files type Sfc_io_data_type - integer, public :: nvar2o = 0 - integer, public :: nvar3 = 0 - integer, public :: nvar2r = 0 - integer, public :: nvar2mp = 0 - integer, public :: nvar3mp = 0 - integer, public :: nvar2l = 0 - integer, public :: nvar2m = 0 - integer, public :: nvar_before_lake = 0 - - ! The lsoil flag is only meaningful when reading:; + integer, public :: nvar2o = 0 !< ??? + integer, public :: nvar3 = 0 !< ??? + integer, public :: nvar2r = 0 !< ??? + integer, public :: nvar2mp = 0 !< ??? + integer, public :: nvar3mp = 0 !< ??? + integer, public :: nvar2l = 0 !< ??? + integer, public :: nvar2m = 0 !< ??? + integer, public :: nvar_before_lake = 0 !< ??? + + !> The lsoil flag is only meaningful when reading:; logical, public :: is_lsoil = .false. logical, public :: is_v2_file = .false. @@ -62,14 +69,22 @@ module fv3atm_sfc_io ! - nvar2mp = nvar_s2mp ! - nvar3mp = nvar_s3mp + !> ??? real(kind=kind_phys), pointer, dimension(:,:,:), public :: var2 => null() + !> ??? real(kind=kind_phys), pointer, dimension(:,:,:), public :: var3ice => null() + !> ??? real(kind=kind_phys), pointer, dimension(:,:,:,:), public :: var3 => null() + !> ??? real(kind=kind_phys), pointer, dimension(:,:,:,:), public :: var3sn => null() + !> ??? real(kind=kind_phys), pointer, dimension(:,:,:,:), public :: var3eq => null() + !> ??? real(kind=kind_phys), pointer, dimension(:,:,:,:), public :: var3zn => null() + !> ??? character(len=32), pointer, dimension(:), public :: name2 => null() + !> ??? character(len=32), pointer, dimension(:), public :: name3 => null() contains @@ -97,11 +112,19 @@ module fv3atm_sfc_io contains - !>@brief Calculates all nvar indices in the Sfc_io_data_type - !> \section Sfc_io_data_type%calculate_indices() procedure - !! Calculates all nvar counts, which record the number of fields - !! of various types. These determine array sizes. - !! Returns .true. if any nvar counts changed, or .false. otherwise. + !> Calculates all nvar indices in the Sfc_io_data_type. + !> + !> Calculates all nvar counts, which record the number of fields + !> of various types. These determine array sizes. + !> + !> @param sfc ??? + !> @param[in] Model ??? + !> @param[in] reading ??? + !> @param[in] warm_start ??? + !> + !> @return .true. if any nvar counts changed, or .false. otherwise. + !> + !> @author Samuel Trahan @date Jun 20, 2023 function Sfc_io_calculate_indices(sfc, Model, reading, warm_start) implicit none class(Sfc_io_data_type) :: sfc @@ -181,10 +204,10 @@ end function Sfc_io_calculate_indices !>@brief Allocates internal Sfc_io_data_type arrays if array sizes should change. !> \section Sfc_io_data_type%allocate_arrays() procedure - !! Calls calculate_arrays() to determine if any nvar counts have changed, based - !! on the new arguments. If they have changed, then arrays are reallocated. - !! The arrays will need to be filled with new data at that point, as the contents - !! will be unknown. Returns .true. if arrays were reallocated, and .false. otherwise. + !> Calls calculate_arrays() to determine if any nvar counts have changed, based + !> on the new arguments. If they have changed, then arrays are reallocated. + !> The arrays will need to be filled with new data at that point, as the contents + !> will be unknown. Returns .true. if arrays were reallocated, and .false. otherwise. function Sfc_io_allocate_arrays(sfc, Model, Atm_block, reading, warm_start) implicit none class(Sfc_io_data_type) :: sfc @@ -246,7 +269,15 @@ function Sfc_io_allocate_arrays(sfc, Model, Atm_block, reading, warm_start) endif end function Sfc_io_allocate_arrays - !>@ Registers all axes for reading or writing restarts using FMS (non-quilt) + !> Registers all axes for reading or writing restarts using FMS (non-quilt). + !> + !> @param sfc ??? + !> @param[in] Model ??? + !> @param Sfc_restart ??? + !> @param[in] reading ??? + !> @param[in] warm_start ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine Sfc_io_register_axes(sfc, Model, Sfc_restart, reading, warm_start) implicit none class(Sfc_io_data_type) :: sfc @@ -302,7 +333,14 @@ subroutine Sfc_io_register_axes(sfc, Model, Sfc_restart, reading, warm_start) endif end subroutine Sfc_io_register_axes - !>@ Writes axis index variables and related metadata for all axes when writing FMS (non-quilt) restarts + !> Writes axis index variables and related metadata for all axes + !> when writing FMS (non-quilt) restarts. + !> + !> @param sfc ??? + !> @param[in] Model ??? + !> @param[in] Sfc_restart ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine Sfc_io_write_axes(sfc, Model, Sfc_restart) implicit none class(Sfc_io_data_type) :: sfc @@ -369,7 +407,13 @@ subroutine Sfc_io_write_axes(sfc, Model, Sfc_restart) call write_data( Sfc_restart, 'Time', 1) end subroutine Sfc_io_write_axes - !>@ Fills the name3d array with all surface 3D field names. + !> Fills the name3d array with all surface 3D field names. + !> + !> @param sfc ??? + !> @param[in] Model ??? + !> @param[in] warm_start ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine Sfc_io_fill_3d_names(sfc,Model,warm_start) implicit none class(Sfc_io_data_type) :: sfc @@ -401,7 +445,14 @@ subroutine Sfc_io_fill_3d_names(sfc,Model,warm_start) sfc%name3(0) = 'tiice' end subroutine Sfc_io_fill_3d_names - !>@ Fills the name2d array with all surface 2D field names. Updates nvar2m if needed. + !> Fills the name2d array with all surface 2D field names. Updates + !> nvar2m if needed. + !> + !> @param sfc ??? + !> @param[in] Model ??? + !> @param[in] warm_start ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine Sfc_io_fill_2d_names(sfc,Model,warm_start) implicit none class(Sfc_io_data_type) :: sfc @@ -872,7 +923,16 @@ subroutine Sfc_io_register_2d_fields(sfc,Model,Sfc_restart,reading,warm_start) end subroutine Sfc_io_register_2d_fields - !>@ Registers 3D fields with FMS for reading or writing non-quilt restart files + !> Registers 3D fields with FMS for reading or writing non-quilt + !> restart files. + !> + !> @param sfc ??? + !> @param[in] Model ??? + !> @param Sfc_restart ??? + !> @param[in] reading ??? + !> @param[in] warm_start ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine Sfc_io_register_3d_fields(sfc,Model,Sfc_restart,reading,warm_start) implicit none class(Sfc_io_data_type) :: sfc @@ -968,14 +1028,25 @@ subroutine Sfc_io_init_fields(sfc,Model) endif end subroutine Sfc_io_init_fields - !>@ Copies data to the model grid (reading=true) or from the model grid (reading=false) - !> \section Sfc_io_data_type%transfer - !! Called to transfer data between the model grid and Sfc_io_data_type temporary arrays. - !! The FMS and ESMF restarts use the temporary arrays, not the model grid arrays. This - !! transfer routine copies to the model grid if reading=.true. or from the model grid - !! if reading=.false. This is mostly loops around GFS_data_transfer() interface calls. - !! - !! In addition, if override_frac_grid is provided, it will be set to Model%frac_grid. + !> Copies data to the model grid (reading=true) or from the model + !> grid (reading=false). + !> + !> Called to transfer data between the model grid and Sfc_io_data_type temporary arrays. + !> The FMS and ESMF restarts use the temporary arrays, not the model grid arrays. This + !> transfer routine copies to the model grid if reading=.true. or from the model grid + !> if reading=.false. This is mostly loops around GFS_data_transfer() interface calls. + !> + !> In addition, if override_frac_grid is provided, it will be set to Model%frac_grid. + !> + !> @param sfc ??? + !> @param[in] reading ??? + !> @param[in] Model ??? + !> @param[in] Atm_block ??? + !> @param Sfcprop ??? + !> @param[in] warm_start ??? + !> @param[in] override_frac_grid ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine Sfc_io_transfer(sfc, reading, Model, Atm_block, Sfcprop, warm_start, override_frac_grid) !--- interface variable definitions implicit none @@ -1450,7 +1521,17 @@ subroutine Sfc_io_transfer(sfc, reading, Model, Atm_block, Sfcprop, warm_start, end do block_loop end subroutine Sfc_io_transfer - !>@ Copies from Sfc_io_data_type internal arrays to the model grid by calling transfer() with reading=.true. + !> Copies from Sfc_io_data_type internal arrays to the model grid by + !> calling transfer() with reading=.true. + !> + !> @param sfc ??? + !> @param[in] Model ??? + !> @param[in] Atm_block ??? + !> @param Sfcprop ??? + !> @param[in] warm_start ??? + !> @param[in] override_frac_grid ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine Sfc_io_copy_to_grid(sfc, Model, Atm_block, Sfcprop, warm_start, override_frac_grid) !--- interface variable definitions implicit none @@ -1466,7 +1547,15 @@ subroutine Sfc_io_copy_to_grid(sfc, Model, Atm_block, Sfcprop, warm_start, overr end subroutine Sfc_io_copy_to_grid - !>@ Copies from the model grid to Sfc_io_data_type internal arrays by calling transfer() with reading=.false. + !> Copies from the model grid to Sfc_io_data_type internal arrays by + !> calling transfer() with reading=.false. + !> + !> @param sfc ??? + !> @param[in] Model ??? + !> @param[in] Atm_block ??? + !> @param Sfcprop ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine Sfc_io_copy_from_grid(sfc, Model, Atm_block, Sfcprop) !--- interface variable definitions implicit none @@ -1480,7 +1569,14 @@ subroutine Sfc_io_copy_from_grid(sfc, Model, Atm_block, Sfcprop) end subroutine Sfc_io_copy_from_grid - !>@ Calculates values and applies safeguards after reading restart data. + !> Calculates values and applies safeguards after reading restart data. + !> + !> @param sfc ??? + !> @param[in] Model ??? + !> @param[in] Atm_block ??? + !> @param Sfcprop ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine Sfc_io_apply_safeguards(sfc, Model, Atm_block, Sfcprop) !--- interface variable definitions implicit none @@ -1905,7 +2001,11 @@ subroutine Sfc_io_apply_safeguards(sfc, Model, Atm_block, Sfcprop) end subroutine Sfc_io_apply_safeguards - !>@ destructor for Sfc_io_data_type + !> Destructor for Sfc_io_data_type. + !> + !> @param sfc ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine Sfc_io_final(sfc) implicit none type(Sfc_io_data_type) :: sfc @@ -1921,7 +2021,7 @@ subroutine Sfc_io_final(sfc) sfc%nvar_before_lake=0 sfc%is_lsoil=.false. - ! This #define reduces code length by a lot + !> This #define reduces code length by a lot #define IF_ASSOC_DEALLOC_NULL(var) \ if(associated(sfc%var)) then ; \ deallocate(sfc%var) ; \ @@ -1941,7 +2041,16 @@ subroutine Sfc_io_final(sfc) end subroutine Sfc_io_final - !>@ Creates ESMF bundles for 2D fields, for writing surface restart files using the write component (quilt) + !> Creates ESMF bundles for 2D fields, for writing surface restart + !> files using the write component (quilt). + !> + !> @param sfc ??? + !> @param[inout] bundle ??? + !> @param[inout] grid ??? + !> @param[in] Model ??? + !> @param[in] outputfile ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine Sfc_io_bundle_2d_fields(sfc, bundle, grid, Model, outputfile) use esmf use GFS_typedefs, only: GFS_control_type @@ -1989,7 +2098,16 @@ subroutine Sfc_io_bundle_2d_fields(sfc, bundle, grid, Model, outputfile) endif end subroutine Sfc_io_bundle_2d_fields - !>@ Creates ESMF bundles for 3D fields, for writing surface restart files using the write component (quilt) + !> Creates ESMF bundles for 3D fields, for writing surface restart + !> files using the write component (quilt). + !> + !> @param sfc ??? + !> @param[inout] bundle ??? + !> @param[inout] grid ??? + !> @param[in] Model ??? + !> @param[in] outputfile ??? + !> + !> @author Samuel Trahan @date Jun 20, 2023 subroutine Sfc_io_bundle_3d_fields(sfc, bundle, grid, Model, outputfile) use esmf use GFS_typedefs, only: GFS_control_type @@ -2054,4 +2172,4 @@ subroutine Sfc_io_bundle_3d_fields(sfc, bundle, grid, Model, outputfile) end subroutine Sfc_io_bundle_3d_fields end module fv3atm_sfc_io -!> @} + diff --git a/io/module_write_internal_state.F90 b/io/module_write_internal_state.F90 index 919a7bcb4..87c39ca57 100644 --- a/io/module_write_internal_state.F90 +++ b/io/module_write_internal_state.F90 @@ -12,7 +12,8 @@ module write_internal_state implicit none ! !----------------------------------------------------------------------- -! + + !> Output grid information. type output_grid_info integer :: im !< Output grid global I dimension size. integer :: jm !< Output grid global J dimension size. @@ -37,6 +38,7 @@ module write_internal_state real :: lonlast !< Output grid last longitude. end type output_grid_info + !> Internal state. type wrt_internal_state !--------------------------------