Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add doxygen comments to chgres_cube. #239

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
46 changes: 20 additions & 26 deletions sorc/chgres_cube.fd/atmosphere.F90
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
module atmosphere
!> @file
!! @brief Process atmospheric fields
!!
!! @author gayno NCEP/EMC
!!
!! Process atmospheric fields: Horizontally interpolate input
!! fields to the target grid. Adjust surface pressure according to
!! terrain difference between input and target grids. Vertically
!! interpolate to target grid vertical levels. Processing based on
!! the spectral GFS version of CHGRES.
!!
!! Variables defined below. Here "b4adj" indicates fields on the target
!! grid before vertical adjustment. "target" indicates data on target
!! grid. "input" indicates data on input grid. "_s" indicates fields
!! on the 'south' edge of the grid box. "_w" indicate fields on the
!! 'west' edge of the grid box. Otherwise, fields are at the center
!! of the grid box.

!--------------------------------------------------------------------------
! Module atmosphere
!
! Abstract: Process atmospheric fields: Horizontally interpolate input
! fields to the target grid. Adjust surface pressure according to
! terrain difference between input and target grids. Vertically
! interpolate to target grid vertical levels. Processing based on
! the spectral GFS version of CHGRES.
!
! Public Subroutines:
! -------------------
! atmosphere driver Driver routine for processing atmospheric
! fields
!
! Public variables:
! -----------------
! Variables defined below. Here "b4adj" indicates fields on the target
! grid before vertical adjustment. "target" indicates data on target
! grid. "input" indicates data on input grid. "_s" indicates fields
! on the 'south' edge of the grid box. "_w" indicate fields on the
! 'west' edge of the grid box. Otherwise, fields are at the center
! of the grid box.
!
!--------------------------------------------------------------------------
module atmosphere

use esmf

Expand Down Expand Up @@ -139,7 +132,8 @@ module atmosphere
contains

!-----------------------------------------------------------------------------------
! Driver routine for atmospheric fields.
!> @brief
!! Driver routine for atmospheric fields.
!-----------------------------------------------------------------------------------

subroutine atmosphere_driver(localpet)
Expand Down
20 changes: 11 additions & 9 deletions sorc/chgres_cube.fd/chgres.F90
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
program chgres

!-------------------------------------------------------------------------
! Program CHGRES
!
! Abstract: Initialize an FV3 run using history or restart data from
! another FV3 run, or the NEMS version of the spectral GFS.
! Converts atmospheric, surface and nst data.
!
!> @file
!! @brief Initialize an FV3 model run.
!!
!! Program CHGRES_CUBE
!!
!! Initialize an FV3 run using history or restart data from
!! another FV3 run, the spectral GFS, and a few other models.
!! Converts atmospheric, surface and nst data.
!!
!-------------------------------------------------------------------------

program chgres

use mpi
use esmf

Expand Down
11 changes: 4 additions & 7 deletions sorc/chgres_cube.fd/grib2_util.F90
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
module grib2_util

!--------------------------------------------------------------------------
! Module: grib2_util
!
! Abstract: Utilities for use when reading grib2 data.
!
!> @file
!! @brief Utilities for use when reading grib2 data.
!--------------------------------------------------------------------------

module grib2_util

use esmf

use model_grid, only : i_input, j_input
Expand Down
63 changes: 36 additions & 27 deletions sorc/chgres_cube.fd/input_data.F90
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
module input_data

!--------------------------------------------------------------------------
! Module input_data
!
! Abstract: Read atmospheric, surface and nst data on the input grid.
! Supported formats include fv3 tiled 'restart' files, fv3 tiled
! 'history' files, fv3 gaussian history files, spectral gfs
! gaussian nemsio files, and spectral gfs sigio/sfcio files.
!
! Public Subroutines:
! -----------------
! read_input_atm_data Driver routine to read atmospheric data
! cleanup_input_atm_data Free up memory associated with atm data
! read_input_sfc_data Driver routine to read surface data
! cleanup_input_sfc_data Free up memory associated with sfc data
! read_input_nst_data Driver routine to read nst data
! cleanup_input_nst_data Free up memory associated with nst data
!
! Public variables:
! -----------------
! Defined below. "input" indicates field associated with the input grid.
!
!> @file
!! @brief Read input data
!! @author gayno NCEP/EMC
!!
!! Read atmospheric, surface and nst data on the input grid.
!! Supported formats include fv3 tiled 'restart' files, fv3 tiled
!! 'history' files, fv3 gaussian history files, spectral gfs
!! gaussian nemsio files, and spectral gfs sigio/sfcio files.
!!
!! Public variables are defined below: "input" indicates field
!! associated with the input grid.
!!
!--------------------------------------------------------------------------

module input_data

use esmf
use netcdf
use nemsio_module
Expand Down Expand Up @@ -52,7 +43,7 @@ module input_data
num_tiles_input_grid, &
latitude_input_grid, &
longitude_input_grid, &
inv_file!, the_file_hrrr
inv_file

implicit none

Expand Down Expand Up @@ -144,7 +135,8 @@ module input_data
contains

!---------------------------------------------------------------------------
! Read input grid atmospheric data driver
!> @brief
!! Read input grid atmospheric data driver
!---------------------------------------------------------------------------

subroutine read_input_atm_data(localpet)
Expand Down Expand Up @@ -214,7 +206,8 @@ subroutine read_input_atm_data(localpet)
end subroutine read_input_atm_data

!---------------------------------------------------------------------------
! Read input grid nst data driver
!> @brief
!! Driver to read input grid nst data.
!---------------------------------------------------------------------------

subroutine read_input_nst_data(localpet)
Expand Down Expand Up @@ -376,7 +369,8 @@ subroutine read_input_nst_data(localpet)
end subroutine read_input_nst_data

!---------------------------------------------------------------------------
! Read input grid surface data driver.
!> @brief
!! Driver to read input grid surface data.
!---------------------------------------------------------------------------

subroutine read_input_sfc_data(localpet)
Expand Down Expand Up @@ -6428,6 +6422,11 @@ subroutine read_grib_soil(the_file,inv_file,vname,vname_file,dummy3d,rc)

end subroutine read_grib_soil

!---------------------------------------------------------------------------
!> @brief
!! Free up memory associated with atm data
!---------------------------------------------------------------------------

subroutine cleanup_input_atm_data

implicit none
Expand All @@ -6450,6 +6449,11 @@ subroutine cleanup_input_atm_data

end subroutine cleanup_input_atm_data

!---------------------------------------------------------------------------
!> @brief
!! Free up memory associated with nst data
!---------------------------------------------------------------------------

subroutine cleanup_input_nst_data

implicit none
Expand Down Expand Up @@ -6480,6 +6484,11 @@ subroutine cleanup_input_nst_data

end subroutine cleanup_input_nst_data

!---------------------------------------------------------------------
!> @brief
!! Free up memory associated with sfc data
!---------------------------------------------------------------------

subroutine cleanup_input_sfc_data

implicit none
Expand Down
127 changes: 65 additions & 62 deletions sorc/chgres_cube.fd/model_grid.F90
Original file line number Diff line number Diff line change
@@ -1,60 +1,54 @@
module model_grid

!--------------------------------------------------------------------------
! Module model_grid
!
! Abstract: Specify input and target model grids
!
! Public Subroutines:
! -------------------
! define_target_grid Setup the esmf grid object for the
! target grid.
! define_input_grid Setup the esmf grid object for the
! input grid.
! cleanup_input_target_grid_data Deallocate all esmf grid objects.
!
! Public variables:
! -----------------
! i/j_input i/j dimension of each cube of the
! input grid.
! ip1/jp1_input i/j dimension plus 1 of input grid.
! i/j_target i/j dimension of each cube or of
! a nest, target grid.
! ip1/jp1_target i/j dimension plus 1 of input grid.
! input_grid input grid esmf grid object
! landmask_target_grid land mask target grid - '1' land;
! '0' non-land
! latitude_input_grid latitude of grid center, input grid
! latitude_target_grid latitude of grid center, target grid
! latitude_s_input_grid latitude of 'south' edge of grid
! box, input grid
! latitude_s_target_grid latitude of 'south' edge of grid
! box, target grid
! latitude_w_input_grid latitude of 'west' edge of grid
! box, input grid
! latitude_w_target_grid latitude of 'west' edge of grid
! box, target grid
! longitude_input_grid longitude of grid center, input grid
! longitude_target_grid longitude of grid center, target grid
! longitude_s_input_grid longitude of 'south' edge of grid
! box, input grid
! longitude_s_target_grid longitude of 'south' edge of grid
! box, target grid
! longitude_w_input_grid longitude of 'west' edge of grid
! box, input grid
! longitude_w_target_grid longitude of 'west' edge of grid
! box, target grid
! lsoil_target Number of soil layers, target grid.
! num_tiles_input_grid Number of tiles, input grid
! num_tiles_target_grid Number of tiles, target grid
! seamask_target_grid sea mask target grid - '1' non-land;
! '0' land
! target_grid target grid esmf grid object.
! terrain_target_grid terrain height target grid
! tiles_target_grid Tile names of target grid.
!
!> @file
!! @brief Specify input and target model grids
!!
!! @author gayno NCEP/EMC
!!
!! Specify input and target model grids via ESMF grid objects.
!!
!! Public variables:
!!
!! - i/j_input - i/j dimension of each cube of the
!! input grid.
!! - ip1/jp1_input - i/j dimension plus 1 of input grid.
!! - i/j_target - i/j dimension of each cube or of
!! a nest, target grid.
!! - ip1/jp1_target - i/j dimension plus 1 of input grid.
!! - input_grid - input grid esmf grid object
!! - landmask_target_grid - land mask target grid - '1' land;
!! '0' non-land
!! - latitude_input_grid - latitude of grid center, input grid
!! - latitude_target_grid - latitude of grid center, target grid
!! - latitude_s_input_grid - latitude of 'south' edge of grid
!! box, input grid
!! - latitude_s_target_grid - latitude of 'south' edge of grid
!! box, target grid
!! - latitude_w_input_grid - latitude of 'west' edge of grid
!! box, input grid
!! - latitude_w_target_grid - latitude of 'west' edge of grid
!! box, target grid
!! - longitude_input_grid - longitude of grid center, input grid
!! - longitude_target_grid - longitude of grid center, target grid
!! - longitude_s_input_grid - longitude of 'south' edge of grid
!! box, input grid
!! - longitude_s_target_grid - longitude of 'south' edge of grid
!! box, target grid
!! - longitude_w_input_grid - longitude of 'west' edge of grid
!! box, input grid
!! - longitude_w_target_grid - longitude of 'west' edge of grid
!! box, target grid
!! - lsoil_target - Number of soil layers, target grid.
!! - num_tiles_input_grid - Number of tiles, input grid
!! - num_tiles_target_grid - Number of tiles, target grid
!! - seamask_target_grid - sea mask target grid - '1' non-land;
!! '0' land
!! - target_grid - target grid esmf grid object.
!! - terrain_target_grid - terrain height target grid
!! - tiles_target_grid - Tile names of target grid.
!!
!--------------------------------------------------------------------------

module model_grid

use esmf
use ESMF_LogPublicMod

Expand All @@ -65,7 +59,6 @@ module model_grid
character(len=5), allocatable, public :: tiles_target_grid(:)
character(len=10), public :: inv_file = "chgres.inv"
character(len=50), public :: input_grid_type = "latlon"
!character(len=100), public :: the_file_hrrr = "./HRRR_adj_rad.grib2"

! Made lsoil_target non-parameter to allow for RAP land surface initiation
integer, public :: lsoil_target = 4 ! # soil layers
Expand Down Expand Up @@ -104,12 +97,13 @@ module model_grid
contains

!--------------------------------------------------------------------------
! Set up the esmf grid object for the input grid. If the input
! source is tiled fv3 restart or history data, the grid is created
! by reading the mosaic and grid files. If the input source is
! fv3 global gaussian nemsio, spectral gfs global gaussian nemsio, or
! spectral gfs global gaussian sigio/sfcio, the grid is setup by
! computing lat/lons using the sp library.
!> @brief Setup the esmf grid object for the input grid.
!!
!! If the input source is tiled fv3 restart or history data, the grid is
!! created by reading the mosaic and grid files. If the input source is
!! fv3 global gaussian nemsio, spectral gfs global gaussian nemsio, or
!! spectral gfs global gaussian sigio/sfcio, the grid is setup by
!! computing lat/lons using the sp library.
!--------------------------------------------------------------------------

subroutine define_input_grid(localpet, npets)
Expand Down Expand Up @@ -1081,6 +1075,11 @@ subroutine define_input_grid_grib2(localpet, npets)

end subroutine define_input_grid_grib2

!------------------------------------------------------------------------
!> @brief
!! Setup the esmf grid object for the target grid.
!------------------------------------------------------------------------

subroutine define_target_grid(localpet, npets)

use netcdf
Expand Down Expand Up @@ -1643,6 +1642,10 @@ subroutine get_model_mask_terrain(orog_file, idim, jdim, mask, terrain)

end subroutine get_model_mask_terrain

!----------------------------------------------------------------------
!> @brief Deallocate all esmf grid objects.
!----------------------------------------------------------------------

subroutine cleanup_input_target_grid_data

implicit none
Expand Down
Loading