From 51869650fa8b331ac758dfe743e746f2cb191464 Mon Sep 17 00:00:00 2001 From: "Shan.Sun" Date: Mon, 26 Oct 2020 03:13:02 +0000 Subject: [PATCH 1/3] From Ning Wang: this commit expands lake fraction and depth calculation to both global and regional domain (gtype=regional_gfdl). The resulting lake fraction and depth are added to oro data. --- driver_scripts/driver_grid.hera.sh | 12 +- sorc/orog_mask_tools.fd/inland.fd/inland.F90 | 241 ++++++++++++++++--- sorc/orog_mask_tools.fd/inland.fd/nb.F90 | 84 ++++++- sorc/orog_mask_tools.fd/lake.fd/lakefrac.F90 | 69 +++--- ush/fv3gfs_driver_grid.sh | 19 +- ush/fv3gfs_make_lake.sh | 38 ++- 6 files changed, 369 insertions(+), 94 deletions(-) diff --git a/driver_scripts/driver_grid.hera.sh b/driver_scripts/driver_grid.hera.sh index 96479d27e..9c48ec3ce 100755 --- a/driver_scripts/driver_grid.hera.sh +++ b/driver_scripts/driver_grid.hera.sh @@ -83,14 +83,16 @@ elif [ $gtype = stretch ]; then export target_lat=35.5 # Center latitude of the highest resolution tile elif [ $gtype = nest ] || [ $gtype = regional_gfdl ]; then export res=96 + export add_lake=true # Add lake frac and depth to orography data. + export res=768 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile - export target_lat=35.5 # Center latitude of the highest resolution tile + export target_lat=38.5 # Center latitude of the highest resolution tile export refine_ratio=3 # The refinement ratio - export istart_nest=27 # Starting i-direction index of nest grid in parent tile supergrid - export jstart_nest=37 # Starting j-direction index of nest grid in parent tile supergrid - export iend_nest=166 # Ending i-direction index of nest grid in parent tile supergrid - export jend_nest=164 # Ending j-direction index of nest grid in parent tile supergrid + export istart_nest=123 # Starting i-direction index of nest grid in parent tile supergrid + export jstart_nest=331 # Starting j-direction index of nest grid in parent tile supergrid + export iend_nest=1402 # Ending i-direction index of nest grid in parent tile supergrid + export jend_nest=1194 # Ending j-direction index of nest grid in parent tile supergrid export halo=3 # Lateral boundary halo elif [ $gtype = regional_esg ] ; then export res=-999 # equivalent res is computed. diff --git a/sorc/orog_mask_tools.fd/inland.fd/inland.F90 b/sorc/orog_mask_tools.fd/inland.fd/inland.F90 index cdeb5a303..a22190d28 100644 --- a/sorc/orog_mask_tools.fd/inland.fd/inland.F90 +++ b/sorc/orog_mask_tools.fd/inland.fd/inland.F90 @@ -14,19 +14,21 @@ PROGRAM inland_mask REAL, ALLOCATABLE :: inland(:,:,:) REAL, ALLOCATABLE :: land_frac(:,:,:) INTEGER :: i_ctr, j_ctr, tile_beg, tile_end - INTEGER :: cs_res + INTEGER :: cs_res, x_res, y_res CHARACTER(len=32) :: arg INTEGER :: stat INTEGER :: max_rd REAL :: cutoff + CHARACTER(len=1) :: reg LOGICAL, ALLOCATABLE :: done(:,:,:) -! CALL getarg(0, arg) ! get the program name -! IF (iargc() /= 3) THEN -! PRINT*, 'Usage: ', trim(arg), ' [resolution (48,96, ...)] [non-land cutoff] [max recursive depth]' -! STOP -! ENDIF + CALL getarg(0, arg) ! get the program name + IF (iargc() /= 3 .AND. iargc() /= 4) THEN + PRINT*, 'Usage: ' + PRINT*, trim(arg), ' [cres(48,96, ...)][nonland cutoff][max recursive depth][regional(r),global(g)]' + STOP + ENDIF CALL getarg(1, arg) READ(arg,*,iostat=stat) cs_res @@ -34,44 +36,86 @@ PROGRAM inland_mask READ(arg,*,iostat=stat) cutoff CALL getarg(3, arg) READ(arg,*,iostat=stat) max_rd + CALL getarg(4, reg) - ALLOCATE(done(cs_res,cs_res,6)) - ALLOCATE(inland(cs_res,cs_res,6)) - ALLOCATE(land_frac(cs_res,cs_res,6)) - - tile_beg = 1; tile_end = 6 + IF (reg /= 'r') THEN + tile_beg = 1; tile_end = 6 +! read in orography data (land_frac) + CALL read_orog(cs_res) ! init inter-panel neighbor index - CALL idx_init(cs_res) + CALL idx_init(cs_res) + +! create a inland mask + CALL mark_global_inland(cs_res) -! read in orography data - CALL read_orog(cs_res) +! write back to the orography data files + CALL write_inland(cs_res) + ELSE +! read in orography data (land_frac) for the SAR domain + CALL read_orog_reg(cs_res) + +! init inter-panel neighbor index + CALL idx_init_reg(x_res, y_res) ! create a inland mask - CALL mark_global_inland(cs_res) + CALL mark_inland_reg(cs_res) ! write back to the orography data files - CALL write_inland(cs_res) + CALL write_inland_reg(cs_res) + ENDIF + + CALL free_mem() CONTAINS SUBROUTINE mark_global_inland(cs_res) INTEGER, INTENT(IN) :: cs_res + ALLOCATE(done(cs_res,cs_res,6)) + ALLOCATE(inland(cs_res,cs_res,6)) done = .false. inland = 1.0 i_ctr = cs_res/2; j_ctr = cs_res/2 CALL mark_global_inland_rec_d(i_ctr, j_ctr, 2, 0) + + DEALLOCATE(done) END SUBROUTINE mark_global_inland +SUBROUTINE mark_inland_reg(cs_res) + INTEGER, INTENT(IN) :: cs_res + INTEGER :: i_seed, j_seed + + ALLOCATE(done(x_res,y_res,1)) + ALLOCATE(inland(x_res,y_res,1)) + + done = .false. + inland = 1.0 + +! set up three seeds, for the current domain + i_seed = 1; j_seed = y_res/2 + CALL mark_regional_inland_rec_d(i_seed, j_seed, 1, 0) + + i_seed = x_res; j_seed = y_res/2 + CALL mark_regional_inland_rec_d(i_seed, j_seed, 1, 0) + + i_seed = x_res/3; j_seed = 1 + CALL mark_regional_inland_rec_d(i_seed, j_seed, 1, 0) + + DEALLOCATE(done) + +END SUBROUTINE mark_inland_reg + RECURSIVE SUBROUTINE mark_global_inland_rec_d(i, j, t, rd) INTEGER, INTENT(IN) :: i, j, t, rd TYPE(nb_gp_idx) :: nbs INTEGER :: k, nrd + IF (t == 0) RETURN + IF (land_frac(i,j,t) <= 0.15) THEN nrd = 1 ELSE @@ -93,41 +137,52 @@ RECURSIVE SUBROUTINE mark_global_inland_rec_d(i, j, t, rd) END SUBROUTINE mark_global_inland_rec_d -RECURSIVE SUBROUTINE mark_global_inland_rec(i, j, t) - INTEGER, INTENT(IN) :: i, j, t +RECURSIVE SUBROUTINE mark_regional_inland_rec_d(i, j, t, rd) + INTEGER, INTENT(IN) :: i, j, t, rd TYPE(nb_gp_idx) :: nbs - INTEGER :: k + INTEGER :: k, nrd + + IF (t == 0) RETURN + + IF (land_frac(i,j,t) <= 0.15) THEN + nrd = 1 + ELSE + nrd = rd + 1 + ENDIF + + IF (nrd > max_rd) RETURN IF (done(i,j,t)) RETURN - IF (land_frac(i,j,t) < 0.9) THEN + IF (land_frac(i,j,t) < cutoff) THEN done(i,j,t) = .true. inland(i,j,t) = 0.0 - CALL neighbors(t, i, j, nbs) + CALL neighbors_reg(i, j, nbs) ! recursively go through k neighbors DO k = 1, 4 - CALL mark_global_inland_rec(nbs%ijt(1,k), nbs%ijt(2,k), nbs%ijt(3,k)) + CALL mark_regional_inland_rec_d(nbs%ijt(1,k),nbs%ijt(2,k),nbs%ijt(3,k),nrd) ENDDO ENDIF -END SUBROUTINE mark_global_inland_rec +END SUBROUTINE mark_regional_inland_rec_d SUBROUTINE read_orog(cs_res) USE netcdf INTEGER, INTENT(IN) :: cs_res INTEGER :: tile_sz, tile_num - INTEGER :: stat, ncid, x_dimid, y_dimid, varid + INTEGER :: stat, ncid, varid INTEGER :: land_frac_id, slmsk_id, geolon_id, geolat_id CHARACTER(len=256) :: filename,string CHARACTER(len=1) :: ich CHARACTER(len=4) res_ch + CHARACTER(len=8) dimname INTEGER :: i, j REAL, ALLOCATABLE :: var_tmp(:,:) - tile_sz = cs_res*cs_res ALLOCATE(var_tmp(cs_res,cs_res)) + ALLOCATE(land_frac(cs_res,cs_res,6)) WRITE(res_ch,'(I4)') cs_res DO tile_num = tile_beg, tile_end @@ -136,6 +191,7 @@ SUBROUTINE read_orog(cs_res) print *,'Read, update, and write ',trim(filename) stat = nf90_open(filename, NF90_NOWRITE, ncid) CALL nc_opchk(stat, "nf90_open oro_data.nc") + ! original orodata netcdf file uses (y, x) order, so we made change to match it. stat = nf90_inq_varid(ncid, "land_frac", land_frac_id) CALL nc_opchk(stat, "nf90_inq_varid: land_frac") @@ -151,6 +207,53 @@ SUBROUTINE read_orog(cs_res) END SUBROUTINE read_orog +SUBROUTINE read_orog_reg(cs_res) + USE netcdf + INTEGER, INTENT(IN) :: cs_res + + INTEGER :: tile_num + INTEGER :: stat, ncid, x_dimid, y_dimid, varid + INTEGER :: land_frac_id, slmsk_id, geolon_id, geolat_id + CHARACTER(len=256) :: filename,string + CHARACTER(len=1) :: ich + CHARACTER(len=4) res_ch + CHARACTER(len=8) dimname + + INTEGER :: i, j + REAL, ALLOCATABLE :: var_tmp(:,:) + + WRITE(res_ch,'(I4)') cs_res + tile_num = 7 + WRITE(ich, '(I1)') tile_num + filename = "oro.C" // trim(adjustl(res_ch)) // ".tile" // ich // ".nc" + print *,'Read, update, and write ',trim(filename) + stat = nf90_open(filename, NF90_NOWRITE, ncid) + CALL nc_opchk(stat, "nf90_open oro_data.nc") + stat = nf90_inq_dimid(ncid, "lon", x_dimid) + CALL nc_opchk(stat, "nf90_inq_dim: x") + stat = nf90_inq_dimid(ncid, "lat", y_dimid) + CALL nc_opchk(stat, "nf90_inq_dim: y") + stat = nf90_inquire_dimension(ncid,x_dimid,dimname,len=x_res) + CALL nc_opchk(stat,'nf90_inquire_dimension: lon') + stat = nf90_inquire_dimension(ncid,y_dimid,dimname,len=y_res) + CALL nc_opchk(stat,'nf90_inquire_dimension: lon') + +! original orodata netcdf file uses (y, x) order, so we made change to match it. + ALLOCATE(var_tmp(x_res,y_res)) + ALLOCATE(land_frac(x_res,y_res,1)) + stat = nf90_inq_varid(ncid, "land_frac", land_frac_id) + CALL nc_opchk(stat, "nf90_inq_varid: land_frac") + stat = nf90_get_var(ncid, land_frac_id, var_tmp, & + start = (/ 1, 1 /), count = (/ x_res, y_res /) ) + CALL nc_opchk(stat, "nf90_get_var: land_frac") + land_frac(:,:,1) = var_tmp(:,:) + stat = nf90_close(ncid) + CALL nc_opchk(stat, "nf90_close oro_data.nc") + + DEALLOCATE(var_tmp) + +END SUBROUTINE read_orog_reg + SUBROUTINE write_inland(cs_res) USE netcdf INTEGER, INTENT(IN) :: cs_res @@ -181,6 +284,70 @@ SUBROUTINE write_inland(cs_res) dimids = (/ x_dimid, y_dimid /) ! define a new variables + stat = nf90_inq_varid(ncid,"inland",inland_id) !safeguard if "inland" exists + IF (stat /= nf90_noerr) THEN + stat = nf90_redef(ncid) + CALL nc_opchk(stat, "nf90_redef") + stat = nf90_def_var(ncid,"inland",NF90_FLOAT,dimids,inland_id) + CALL nc_opchk(stat, "nf90_def_var: inland") + stat = nf90_put_att(ncid, inland_id,'coordinates','geolon geolat') + CALL nc_opchk(stat, "nf90_put_att: inland:coordinates") + stat = nf90_put_att(ncid, inland_id,'description', & + 'inland = 1 indicates grid cells away from coast') + CALL nc_opchk(stat, "nf90_put_att: inland:description") + stat = nf90_enddef(ncid) + CALL nc_opchk(stat, "nf90_enddef") + ENDIF + + var_tmp(:,:) = inland(:,:,tile_num) + stat = nf90_put_var(ncid, inland_id, var_tmp, & + start = (/ 1, 1 /), count = (/ cs_res, cs_res /) ) + CALL nc_opchk(stat, "nf90_put_var: inland") + + stat = nf90_close(ncid) + CALL nc_opchk(stat, "nf90_close oro_data.nc") + ENDDO + DEALLOCATE(var_tmp) + +END SUBROUTINE write_inland + +SUBROUTINE write_inland_reg(cs_res) + USE netcdf + INTEGER, INTENT(IN) :: cs_res + + CHARACTER(len=256) :: filename + CHARACTER(len=1) :: ich + CHARACTER(len=4) res_ch + + INTEGER :: tile_num + INTEGER :: stat, ncid, x_dimid, y_dimid, inland_id, dimids(2) + REAL, ALLOCATABLE :: var_tmp(:,:) + CHARACTER(len=8) dimname + + ALLOCATE(var_tmp(x_res,y_res)) + + WRITE(res_ch,'(I4)') cs_res + tile_num = 7 + WRITE(ich, '(I1)') tile_num + filename = "oro.C" // trim(adjustl(res_ch)) // ".tile" // ich // ".nc" + PRINT*,'write inland to ',trim(filename) + stat = nf90_open(filename, NF90_WRITE, ncid) + CALL nc_opchk(stat, "nf90_open oro_data.nc") + stat = nf90_inq_dimid(ncid, "lon", x_dimid) + CALL nc_opchk(stat, "nf90_inq_dim: x") + stat = nf90_inq_dimid(ncid, "lat", y_dimid) + CALL nc_opchk(stat, "nf90_inq_dim: y") + stat = nf90_inquire_dimension(ncid,x_dimid,dimname,len=x_res) + CALL nc_opchk(stat,'nf90_inquire_dimension: lon') + stat = nf90_inquire_dimension(ncid,y_dimid,dimname,len=y_res) + CALL nc_opchk(stat,'nf90_inquire_dimension: lon') + +! original orodata netcdf file uses (y, x) order, so we made change to match it. + dimids = (/ x_dimid, y_dimid /) + +! define a new variables + stat = nf90_inq_varid(ncid,"inland",inland_id) !safeguard if "inland" exists + IF (stat /= nf90_noerr) THEN stat = nf90_redef(ncid) CALL nc_opchk(stat, "nf90_redef") stat = nf90_def_var(ncid,"inland",NF90_FLOAT,dimids,inland_id) @@ -190,21 +357,27 @@ SUBROUTINE write_inland(cs_res) stat = nf90_put_att(ncid, inland_id,'description', & 'inland = 1 indicates grid cells away from coast') CALL nc_opchk(stat, "nf90_put_att: inland:description") - stat = nf90_enddef(ncid) CALL nc_opchk(stat, "nf90_enddef") + ENDIF - var_tmp(:,:) = inland(:,:,tile_num) - stat = nf90_put_var(ncid, inland_id, var_tmp, & - start = (/ 1, 1 /), count = (/ cs_res, cs_res /) ) - CALL nc_opchk(stat, "nf90_put_var: inland") + var_tmp(:,:) = inland(:,:,1) + stat = nf90_put_var(ncid, inland_id, var_tmp, & + start = (/ 1, 1 /), count = (/ x_res, y_res /) ) + CALL nc_opchk(stat, "nf90_put_var: inland") + + stat = nf90_close(ncid) + CALL nc_opchk(stat, "nf90_close oro_data.nc") - stat = nf90_close(ncid) - CALL nc_opchk(stat, "nf90_close oro_data.nc") - ENDDO DEALLOCATE(var_tmp) -END SUBROUTINE write_inland +END SUBROUTINE write_inland_reg + +SUBROUTINE free_mem() + + DEALLOCATE(inland, land_frac) + +END SUBROUTINE free_mem SUBROUTINE nc_opchk(stat,opname) USE netcdf diff --git a/sorc/orog_mask_tools.fd/inland.fd/nb.F90 b/sorc/orog_mask_tools.fd/inland.fd/nb.F90 index 32b77abdf..79e93b505 100644 --- a/sorc/orog_mask_tools.fd/inland.fd/nb.F90 +++ b/sorc/orog_mask_tools.fd/inland.fd/nb.F90 @@ -22,9 +22,8 @@ MODULE cs_nb TYPE(nb_tile_idx):: nb_tile(4,6) TYPE(nb_gp_idx):: nb_index - INTEGER :: cres + INTEGER :: cres, xres, yres - CONTAINS ! _______1_______ @@ -75,6 +74,14 @@ SUBROUTINE idx_init(cres_in) END SUBROUTINE idx_init + SUBROUTINE idx_init_reg(xres_in, yres_in) + INTEGER, INTENT(IN) :: xres_in, yres_in + + xres = xres_in + yres = yres_in + + END SUBROUTINE idx_init_reg + INTEGER FUNCTION bndry(i, j) INTEGER :: i,j @@ -102,6 +109,32 @@ INTEGER FUNCTION bndry(i, j) END FUNCTION bndry + INTEGER FUNCTION bndry_reg(i, j) + INTEGER :: i,j + + bndry_reg = 0 ! no boundary + + IF (j == yres) THEN ! upper boundary + bndry_reg = 1 + IF (i == 1) THEN + bndry_reg = 13 + ELSE IF (i == xres) THEN + bndry_reg = 14 + ENDIF + ELSE IF (j == 1) THEN ! bottom boundary + bndry_reg = 2 + IF (i == 1) THEN + bndry_reg = 23 + ELSE IF (i == xres) THEN + bndry_reg = 24 + ENDIF + ELSE IF (i == 1) THEN ! left boundary + bndry_reg = 3 + ELSE IF (i == xres) THEN ! right boundary + bndry_reg = 4 + ENDIF + + END FUNCTION bndry_reg ! ______________ ! | | | | ________ ! | 5 | 1 | 6 | /\ 1 \ 6 \ @@ -231,7 +264,7 @@ SUBROUTINE neighbors(tile, i, j, nb) nb%ijt(1,3) = i+1; nb%ijt(2,3) = j; nb%ijt(3,3) = tile nb%ijt(1,4) = i; nb%ijt(2,4) = j-1; nb%ijt(3,4) = tile nb%ijt(1,8) = i+1; nb%ijt(2,8) = j-1; nb%ijt(3,8) = tile - ELSEIF (nb%gp_type == 14) THEN ! upper left coner + ELSEIF (nb%gp_type == 14) THEN ! upper right coner bd = 1 nb_t_num = nb_tile(bd,tile)%nb_tile_num nb%ijt(3,1)=nb_t_num; nb%ijt(3,5)=nb_t_num @@ -256,7 +289,7 @@ SUBROUTINE neighbors(tile, i, j, nb) nb%ijt(1,2) = i-1; nb%ijt(2,2) = j; nb%ijt(3,2) = tile nb%ijt(1,4) = i; nb%ijt(2,4) = j-1; nb%ijt(3,4) = tile nb%ijt(1,7) = i-1; nb%ijt(2,7) = j-1; nb%ijt(3,7) = tile - ELSEIF (nb%gp_type == 23) THEN ! upper left coner + ELSEIF (nb%gp_type == 23) THEN ! lower left coner bd = 2 nb_t_num = nb_tile(bd,tile)%nb_tile_num nb%ijt(3,4)=nb_t_num; nb%ijt(3,8)=nb_t_num @@ -281,7 +314,7 @@ SUBROUTINE neighbors(tile, i, j, nb) nb%ijt(1,1) = i; nb%ijt(2,1) = j+1; nb%ijt(3,1) = tile nb%ijt(1,3) = i+1; nb%ijt(2,3) = j; nb%ijt(3,3) = tile nb%ijt(1,6) = i+1; nb%ijt(2,6) = j+1; nb%ijt(3,6) = tile - ELSEIF (nb%gp_type == 24) THEN ! upper left coner + ELSEIF (nb%gp_type == 24) THEN ! lower right coner bd = 2 nb_t_num = nb_tile(bd,tile)%nb_tile_num nb%ijt(3,4)=nb_t_num; nb%ijt(3,7)=nb_t_num @@ -309,6 +342,47 @@ SUBROUTINE neighbors(tile, i, j, nb) ENDIF END SUBROUTINE neighbors + + SUBROUTINE neighbors_reg(i, j, nb) + INTEGER :: i, j + TYPE(nb_gp_idx) :: nb + +! assign the standard interior cell neighbors as default values + ! top, bottom, left, and right + nb%ijt(1,1) = i; nb%ijt(2,1) = j+1; nb%ijt(3,1) = 1 + nb%ijt(1,2) = i-1; nb%ijt(2,2) = j; nb%ijt(3,2) = 1 + nb%ijt(1,3) = i+1; nb%ijt(2,3) = j; nb%ijt(3,3) = 1 + nb%ijt(1,4) = i; nb%ijt(2,4) = j-1; nb%ijt(3,4) = 1 + ! top left, top right, bottom left, and bottom right + nb%ijt(1,5) = i-1; nb%ijt(2,5) = j+1; nb%ijt(3,5) = 1 + nb%ijt(1,6) = i+1; nb%ijt(2,6) = j+1; nb%ijt(3,6) = 1 + nb%ijt(1,7) = i-1; nb%ijt(2,7) = j-1; nb%ijt(3,7) = 1 + nb%ijt(1,8) = i+1; nb%ijt(2,8) = j-1; nb%ijt(3,8) = 1 + + nb%gp_type = bndry_reg(i,j) + IF (nb%gp_type == 1) THEN !top boundary cell + nb%ijt(3,1) = 0; nb%ijt(3,5) = 0; nb%ijt(3,6) = 0 + ELSEIF (nb%gp_type == 2) THEN !bottom boundary cell + nb%ijt(3,4) = 0; nb%ijt(3,7) = 0; nb%ijt(3,8) = 0 + ELSEIF (nb%gp_type == 3) THEN !left boundary cell + nb%ijt(3,2) = 0; nb%ijt(3,5) = 0; nb%ijt(3,7) = 0 + ELSEIF (nb%gp_type == 4) THEN !right boundary cell + nb%ijt(3,3) = 0; nb%ijt(3,6) = 0; nb%ijt(3,8) = 0 + ELSEIF (nb%gp_type == 13) THEN ! upper left coner + nb%ijt(3,1) = 0; nb%ijt(3,5) = 0; nb%ijt(3,6) = 0; + nb%ijt(3,2) = 0; nb%ijt(3,7) = 0 + ELSEIF (nb%gp_type == 14) THEN ! upper right coner + nb%ijt(3,1) = 0; nb%ijt(3,5) = 0; nb%ijt(3,6) = 0; + nb%ijt(3,3) = 0; nb%ijt(3,8) = 0 + ELSEIF (nb%gp_type == 23) THEN ! lower left coner + nb%ijt(3,4) = 0; nb%ijt(3,7) = 0; nb%ijt(3,8) = 0 + nb%ijt(3,2) = 0; nb%ijt(3,5) = 0; + ELSEIF (nb%gp_type == 24) THEN ! lower right coner + nb%ijt(3,4) = 0; nb%ijt(3,7) = 0; nb%ijt(3,8) = 0 + nb%ijt(3,3) = 0; nb%ijt(3,6) = 0; + ENDIF + + END SUBROUTINE neighbors_reg END MODULE cs_nb diff --git a/sorc/orog_mask_tools.fd/lake.fd/lakefrac.F90 b/sorc/orog_mask_tools.fd/lake.fd/lakefrac.F90 index 2c243078b..f963d26b4 100644 --- a/sorc/orog_mask_tools.fd/lake.fd/lakefrac.F90 +++ b/sorc/orog_mask_tools.fd/lake.fd/lakefrac.F90 @@ -75,8 +75,6 @@ PROGRAM lake_frac PRINT*, 'Process regional tile (tile', tile_req, ') at resolution C',cs_res ENDIF -! cs_res = 96 ! tile_beg = 3; tile_end = 3 - ! read in grid spec data for each tile and concatenate them together ncsmp = (2*cs_res+1)*(2*cs_res+1)*6 @@ -127,6 +125,8 @@ PROGRAM lake_frac DEALLOCATE(cs_lakestatus,cs_lakedepth) DEALLOCATE(cs_grid) DEALLOCATE(lakestatus,lakedepth) + DEALLOCATE(src_grid_lat, src_grid_lon) + STOP CONTAINS @@ -426,9 +426,7 @@ SUBROUTINE read_cubed_sphere_reg_grid(res, grid, halo_depth, res_x, res_y) CHARACTER(len=4) res_ch CHARACTER(len=8) dimname - WRITE(res_ch,'(I4)') res -! gridfile_path = '/scratch4/BMC/fim/fv3data/fix/reg/' gridfile_path = './' gridfile = trim(gridfile_path)//"C"//trim(adjustl(res_ch))//"_grid.tile7.nc" @@ -447,8 +445,6 @@ SUBROUTINE read_cubed_sphere_reg_grid(res, grid, halo_depth, res_x, res_y) stat = nf90_inquire_dimension(ncid,dimid,dimname,len=nyp) CALL nc_opchk(stat,'nf90_inquire_dimension: nyp') -! sidex_sz = nxp-2*halo_depth -! sidey_sz = nyp-2*halo_depth sidex_sz = nxp sidey_sz = nyp tile_sz = sidex_sz*sidey_sz @@ -699,13 +695,13 @@ SUBROUTINE write_reg_lakedata_to_orodata(cs_res, tile_x_dim, tile_y_dim, cs_lake INTEGER :: tile_sz, tile_num INTEGER :: stat, ncid, x_dimid, y_dimid, varid, dimids(2) INTEGER :: lake_frac_id, lake_depth_id - INTEGER :: land_frac_id, slmsk_id, geolon_id, geolat_id + INTEGER :: land_frac_id, slmsk_id, geolon_id, geolat_id, inland_id CHARACTER(len=256) :: filename,string CHARACTER(len=1) :: ich CHARACTER(len=4) res_ch REAL, ALLOCATABLE :: lake_frac(:), lake_depth(:), geolon(:), geolat(:) - REAL, ALLOCATABLE :: land_frac(:), slmsk(:) + REAL, ALLOCATABLE :: land_frac(:), slmsk(:), inland(:) real, parameter :: epsil=1.e-6 ! numerical min for lake_frac/land_frac real :: land_cutoff=1.e-6 ! land_frac=0 if it is < land_cutoff @@ -717,7 +713,7 @@ SUBROUTINE write_reg_lakedata_to_orodata(cs_res, tile_x_dim, tile_y_dim, cs_lake ALLOCATE(lake_frac(tile_sz), lake_depth(tile_sz)) ALLOCATE(geolon(tile_sz), geolat(tile_sz)) - ALLOCATE(land_frac(tile_sz), slmsk(tile_sz)) + ALLOCATE(land_frac(tile_sz), slmsk(tile_sz), inland(tile_sz)) WRITE(res_ch,'(I4)') cs_res tile_num = 7 @@ -774,9 +770,9 @@ SUBROUTINE write_reg_lakedata_to_orodata(cs_res, tile_x_dim, tile_y_dim, cs_lake CALL nc_opchk(stat, "nf90_put_att: lake_depth:description") #endif ENDIF - write(string,'(a,es8.1)') 'land_frac is adjusted to 1-lake_frac where lake_frac>0 but lefti '// & - 'unchanged where lake_frac=0. This could lead to land_frac+lake_frac<1 '// & - 'at some inland points; land_frac cutoff is',land_cutoff + write(string,'(a,es8.1)') 'land_frac and lake_frac are adjusted '// & + 'such that their sum is 1 at points where inland=1; land_frac '// & + 'cutoff is ',land_cutoff stat = nf90_put_att(ncid, land_frac_id,'description',trim(string)) CALL nc_opchk(stat, "nf90_put_att: land_frac:description") @@ -796,6 +792,8 @@ SUBROUTINE write_reg_lakedata_to_orodata(cs_res, tile_x_dim, tile_y_dim, cs_lake CALL nc_opchk(stat, "nf90_inq_varid: land_frac") stat = nf90_inq_varid(ncid, "slmsk", slmsk_id) CALL nc_opchk(stat, "nf90_inq_varid: slmsk") + stat = nf90_inq_varid(ncid, "inland", inland_id) + CALL nc_opchk(stat, "nf90_inq_varid: inland") stat = nf90_get_var(ncid, geolon_id, geolon, & start = (/ 1, 1 /), count = (/ tile_x_dim, tile_y_dim /) ) @@ -809,30 +807,38 @@ SUBROUTINE write_reg_lakedata_to_orodata(cs_res, tile_x_dim, tile_y_dim, cs_lake stat = nf90_get_var(ncid, slmsk_id, slmsk, & start = (/ 1, 1 /), count = (/ tile_x_dim, tile_y_dim /) ) CALL nc_opchk(stat, "nf90_get_var: slmsk") + stat = nf90_get_var(ncid, inland_id, inland, & + start = (/ 1, 1 /), count = (/ tile_x_dim, tile_y_dim /) ) + CALL nc_opchk(stat, "nf90_get_var: inland") tile_num = 1 lake_frac(:) = cs_lakestat((tile_num-1)*tile_sz+1:tile_num*tile_sz) lake_depth(:) = cs_lakedepth((tile_num-1)*tile_sz+1:tile_num*tile_sz) ! add Caspian Sea and Aral Sea to lake_frac and lake_depth - IF (tile_num == 2 .or. tile_num == 3) THEN - DO i = 1, tile_sz - IF (land_frac(i) < 0.9 .AND. lake_frac(i) < 0.1) THEN - IF (geolat(i) > 35.0 .AND. geolat(i) <= 50.0 .AND. & - geolon(i) > 45.0 .AND. geolon(i) <= 55.0) THEN - lake_frac(i) = 1.-land_frac(i) - lake_depth(i) = 211.0 - ENDIF - IF (geolat(i) > 35.0 .AND. geolat(i) <= 50.0 .AND. & - geolon(i) > 57.0 .AND. geolon(i) <= 63.0) THEN - lake_frac(i) = 1.-land_frac(i) - lake_depth(i) = 10.0 - ENDIF + DO i = 1, tile_sz + IF (land_frac(i) < 0.9 .AND. lake_frac(i) < 0.1) THEN + IF (geolat(i) > 35.0 .AND. geolat(i) <= 50.0 .AND. & + geolon(i) > 45.0 .AND. geolon(i) <= 55.0) THEN + lake_frac(i) = 1.-land_frac(i) + lake_depth(i) = 211.0 ENDIF - ENDDO - ENDIF + IF (geolat(i) > 35.0 .AND. geolat(i) <= 50.0 .AND. & + geolon(i) > 57.0 .AND. geolon(i) <= 63.0) THEN + lake_frac(i) = 1.-land_frac(i) + lake_depth(i) = 10.0 + ENDIF + ENDIF + ENDDO +! adjust land_frac and lake_frac, and make sure land_frac+lake_frac=1 at inland points DO i = 1, tile_sz + if (lake_frac(i) >= lake_cutoff) then ! non-zero lake_frac dominates over land_frac + land_frac(i) = max(0., min(1., 1.-lake_frac(i))) + elseif (inland(i) == 1.) then ! land_frac dominates over lake_frac at inland points + lake_frac(i) = max(0., min(1., 1.-land_frac(i))) + end if + ! epsil is "numerical" nonzero min for lake_frac/land_frac ! lake_cutoff/land_cutoff is practical min for lake_frac/land_frac if (min(lake_cutoff,land_cutoff) < epsil) then @@ -843,13 +849,10 @@ SUBROUTINE write_reg_lakedata_to_orodata(cs_res, tile_x_dim, tile_y_dim, cs_lake if (lake_frac(i)< lake_cutoff) lake_frac(i)=0. if (lake_frac(i)>1.-lake_cutoff) lake_frac(i)=1. + if (inland(i) == 1.) land_frac(i) = 1.-lake_frac(i) if (land_frac(i)< land_cutoff) land_frac(i)=0. if (land_frac(i)>1.-land_cutoff) land_frac(i)=1. - if (lake_frac(i) >= lake_cutoff) then ! non-zero lake_frac dominates over land_frac - land_frac(i) = max(0., min(1., 1.-lake_frac(i))) - end if - if (lake_frac(i) < lake_cutoff) then lake_depth(i)=0. elseif (lake_frac(i) >= lake_cutoff .and. lake_depth(i)==0.) then @@ -879,6 +882,10 @@ SUBROUTINE write_reg_lakedata_to_orodata(cs_res, tile_x_dim, tile_y_dim, cs_lake stat = nf90_close(ncid) CALL nc_opchk(stat, "nf90_close") + DEALLOCATE(lake_frac, lake_depth) + DEALLOCATE(geolon, geolat) + DEALLOCATE(land_frac, slmsk) + END SUBROUTINE write_reg_lakedata_to_orodata SUBROUTINE nc_opchk(stat,opname) diff --git a/ush/fv3gfs_driver_grid.sh b/ush/fv3gfs_driver_grid.sh index c522516eb..209f8de05 100755 --- a/ush/fv3gfs_driver_grid.sh +++ b/ush/fv3gfs_driver_grid.sh @@ -92,15 +92,6 @@ else exit 9 fi -if [ $add_lake = true ]; then - if [ $gtype != uniform ]; then - set +x - echo "Adding lake data to orography data is only available" - echo "for uniform grids." - exit 1 - fi -fi - export TEMP_DIR=${TEMP_DIR:?} export out_dir=${out_dir:?} @@ -381,6 +372,16 @@ elif [ $gtype = regional_gfdl ] || [ $gtype = regional_esg ]; then fi fi +# add lake data to the orography file, if $add_lake is true + + if [ $add_lake = true ]; then + $script_dir/fv3gfs_make_lake.sh + err=$? + if [ $err != 0 ]; then + exit $err + fi + fi + echo "Grid and orography files are now prepared." set +x diff --git a/ush/fv3gfs_make_lake.sh b/ush/fv3gfs_make_lake.sh index 69013168f..05c5ab23e 100755 --- a/ush/fv3gfs_make_lake.sh +++ b/ush/fv3gfs_make_lake.sh @@ -9,9 +9,9 @@ set -eux outdir=$orog_dir indir=$topo -if [ $gtype != uniform ]; then - echo "lake_frac has not been implemented for FV3 stand-alone Regional (SAR) model" - exit 1 +if [ $gtype != uniform ] && [ $gtype != regional_gfdl ]; then + echo "lakefrac has only been implemented for 'uniform' and 'regional_gfdl'." + exit 0 fi exe_add_lake=$exec_dir/lakefrac @@ -40,22 +40,40 @@ cd $workdir # link all required files to the current work directory -tile_beg=1 -tile_end=6 -tile=$tile_beg -while [ $tile -le $tile_end ]; do + +if [ $gtype == uniform ]; then + tile_beg=1 + tile_end=6 + tile=$tile_beg + while [ $tile -le $tile_end ]; do + outfile=oro.C${res}.tile${tile}.nc + ln -s $outdir/$outfile . + outgrid="C${res}_grid.tile${tile}.nc" + ln -s $grid_dir/$outgrid . + tile=$(( $tile + 1 )) + done +fi + +if [ $gtype == regional_gfdl ]; then + tile_beg=7 + tile_end=7 + tile=7 outfile=oro.C${res}.tile${tile}.nc ln -s $outdir/$outfile . outgrid="C${res}_grid.tile${tile}.nc" ln -s $grid_dir/$outgrid . - tile=$(( $tile + 1 )) -done +fi # create inland mask and save it to the orography files cutoff=0.99 rd=7 -$APRUN $exe_inland $res $cutoff $rd +if [ $gtype == uniform ]; then + $APRUN $exe_inland $res $cutoff $rd g +fi +if [ $gtype == regional_gfdl ]; then + $APRUN $exe_inland $res $cutoff $rd r +fi err=$? if [ $err != 0 ]; then set +x From 67be759878df83f396c3acc05d376e1d10b4792e Mon Sep 17 00:00:00 2001 From: "Shan.Sun" Date: Mon, 26 Oct 2020 16:42:55 +0000 Subject: [PATCH 2/3] From Ning Wang: this commit expands lake fraction and depth calculation to both global and regional domain (gtype=regional_gfdl). The resulting lake fraction and depth are added to oro data. --- driver_scripts/driver_grid.cray.sh | 26 ++++++++++----------- driver_scripts/driver_grid.dell.sh | 30 ++++++++++++------------ driver_scripts/driver_grid.hera.sh | 30 +++++++++++------------- driver_scripts/driver_grid.jet.sh | 32 ++++++++++++------------- driver_scripts/driver_grid.orion.sh | 36 ++++++++++++++--------------- 5 files changed, 76 insertions(+), 78 deletions(-) diff --git a/driver_scripts/driver_grid.cray.sh b/driver_scripts/driver_grid.cray.sh index 323d93835..ec17dd817 100755 --- a/driver_scripts/driver_grid.cray.sh +++ b/driver_scripts/driver_grid.cray.sh @@ -65,32 +65,32 @@ module list # Set grid specs here. #----------------------------------------------------------------------- -export gtype=uniform # 'uniform', 'stretch', 'nest' - # 'regional_gfdl', 'regional_esg' +export gtype=uniform # 'uniform', 'stretch', 'nest', + # 'regional_gfdl', 'regional_esg' +export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T if [ $gtype = uniform ]; then export res=96 - export add_lake=false # Add lake frac and depth to orography data. - # Uniform grids only. - export lake_cutoff=0.20 # lake frac less than lake_cutoff is ignored + export add_lake=false # Add lake frac and depth to orography data. elif [ $gtype = stretch ]; then export res=96 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile export target_lat=35.5 # Center latitude of the highest resolution tile elif [ $gtype = nest ] || [ $gtype = regional_gfdl ]; then - export res=96 + export add_lake=false # Add lake frac and depth to orography data. + export res=768 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile - export target_lat=35.5 # Center latitude of the highest resolution tile + export target_lat=38.5 # Center latitude of the highest resolution tile export refine_ratio=3 # The refinement ratio - export istart_nest=27 # Starting i-direction index of nest grid in parent tile supergrid - export jstart_nest=37 # Starting j-direction index of nest grid in parent tile supergrid - export iend_nest=166 # Ending i-direction index of nest grid in parent tile supergrid - export jend_nest=164 # Ending j-direction index of nest grid in parent tile supergrid - export halo=3 + export istart_nest=123 # Starting i-direction index of nest grid in parent tile supergrid + export jstart_nest=331 # Starting j-direction index of nest grid in parent tile supergrid + export iend_nest=1402 # Ending i-direction index of nest grid in parent tile supergrid + export jend_nest=1194 # Ending j-direction index of nest grid in parent tile supergrid + export halo=3 # Lateral boundary halo elif [ $gtype = regional_esg ] ; then - export res=-999 # equivalent res is computed. + export res=-999 # equivalent resolution is computed export target_lon=-97.5 # Center longitude of grid export target_lat=35.5 # Center latitude of grid export idim=301 # Dimension of grid in 'i' direction diff --git a/driver_scripts/driver_grid.dell.sh b/driver_scripts/driver_grid.dell.sh index e871ffcbd..7ab9df9c3 100755 --- a/driver_scripts/driver_grid.dell.sh +++ b/driver_scripts/driver_grid.dell.sh @@ -49,7 +49,7 @@ # 6) For "regional_gfdl" grids, set the "halo". Default is three # rows/columns. # 7) For "regional_esg" grids, set center lat/lon of grid, -# - "target_lat/lon" - the i/j dimensions - "i/jdim", the +# - "target_lat/lon" - the i/j dimensions - "i/jdim", the # x/y grid spacing - "delx/y", and halo. # 8) Set working directory - TEMP_DIR - and path to the repository # clone - home_dir. @@ -67,32 +67,32 @@ module list # Set grid specs here. #----------------------------------------------------------------------- -export gtype=uniform # 'uniform', 'stretch', 'nest', - # 'regional_gfdl', 'regional_esg' +export gtype=uniform # 'uniform', 'stretch', 'nest', + # 'regional_gfdl', 'regional_esg' +export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T if [ $gtype = uniform ]; then export res=96 - export add_lake=false # Add lake frac and depth to orography data. - # Uniform grids only. - export lake_cutoff=0.20 # lake frac less than lake_cutoff is ignored + export add_lake=false # Add lake frac and depth to orography data. elif [ $gtype = stretch ]; then export res=96 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile export target_lat=35.5 # Center latitude of the highest resolution tile elif [ $gtype = nest ] || [ $gtype = regional_gfdl ]; then - export res=96 + export add_lake=false # Add lake frac and depth to orography data. + export res=768 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile - export target_lat=35.5 # Center latitude of the highest resolution tile + export target_lat=38.5 # Center latitude of the highest resolution tile export refine_ratio=3 # The refinement ratio - export istart_nest=27 # Starting i-direction index of nest grid in parent tile supergrid - export jstart_nest=37 # Starting j-direction index of nest grid in parent tile supergrid - export iend_nest=166 # Ending i-direction index of nest grid in parent tile supergrid - export jend_nest=164 # Ending j-direction index of nest grid in parent tile supergrid - export halo=3 + export istart_nest=123 # Starting i-direction index of nest grid in parent tile supergrid + export jstart_nest=331 # Starting j-direction index of nest grid in parent tile supergrid + export iend_nest=1402 # Ending i-direction index of nest grid in parent tile supergrid + export jend_nest=1194 # Ending j-direction index of nest grid in parent tile supergrid + export halo=3 # Lateral boundary halo elif [ $gtype = regional_esg ] ; then - export res=-999 # equivalent res is computed. + export res=-999 # equivalent resolution is computed export target_lon=-97.5 # Center longitude of grid export target_lat=35.5 # Center latitude of grid export idim=301 # Dimension of grid in 'i' direction @@ -109,7 +109,7 @@ fi #----------------------------------------------------------------------- # Check paths. # home_dir - location of repository. -# TEMP_DIR - working directory. +# TEMP_DIR - working directory. # out_dir - where files will be placed upon completion. #----------------------------------------------------------------------- diff --git a/driver_scripts/driver_grid.hera.sh b/driver_scripts/driver_grid.hera.sh index 9c48ec3ce..2f175f980 100755 --- a/driver_scripts/driver_grid.hera.sh +++ b/driver_scripts/driver_grid.hera.sh @@ -23,7 +23,7 @@ # Note: The sfc_climo_gen program only runs with an # mpi task count that is a multiple of six. This is # an ESMF library requirement. Large grids may require -# tasks spread across multiple nodes. The orography code +# tasks spread across multiple nodes. The orography code # benefits from threads. # # To run, do the following: @@ -68,34 +68,32 @@ module list # Set grid specs here. #----------------------------------------------------------------------- -export gtype=uniform # 'uniform', 'stretch', 'nest' - # 'regional_gfdl', 'regional_esg' +export gtype=uniform # 'uniform', 'stretch', 'nest', + # 'regional_gfdl', 'regional_esg' +export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T if [ $gtype = uniform ]; then export res=96 - export add_lake=false # Add lake frac and depth to orography data. - # Uniform grids only. - export lake_cutoff=0.20 # lake frac less than lake_cutoff is ignored + export add_lake=false # Add lake frac and depth to orography data. elif [ $gtype = stretch ]; then export res=96 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile export target_lat=35.5 # Center latitude of the highest resolution tile elif [ $gtype = nest ] || [ $gtype = regional_gfdl ]; then - export res=96 - export add_lake=true # Add lake frac and depth to orography data. + export add_lake=false # Add lake frac and depth to orography data. export res=768 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile export target_lat=38.5 # Center latitude of the highest resolution tile export refine_ratio=3 # The refinement ratio - export istart_nest=123 # Starting i-direction index of nest grid in parent tile supergrid - export jstart_nest=331 # Starting j-direction index of nest grid in parent tile supergrid - export iend_nest=1402 # Ending i-direction index of nest grid in parent tile supergrid - export jend_nest=1194 # Ending j-direction index of nest grid in parent tile supergrid + export istart_nest=123 # Starting i-direction index of nest grid in parent tile supergrid + export jstart_nest=331 # Starting j-direction index of nest grid in parent tile supergrid + export iend_nest=1402 # Ending i-direction index of nest grid in parent tile supergrid + export jend_nest=1194 # Ending j-direction index of nest grid in parent tile supergrid export halo=3 # Lateral boundary halo elif [ $gtype = regional_esg ] ; then - export res=-999 # equivalent res is computed. + export res=-999 # equivalent resolution is computed export target_lon=-97.5 # Center longitude of grid export target_lat=35.5 # Center latitude of grid export idim=301 # Dimension of grid in 'i' direction @@ -110,10 +108,10 @@ elif [ $gtype = regional_esg ] ; then fi #----------------------------------------------------------------------- -# Check paths. +# Check paths. # home_dir - location of repository. -# TEMP_DIR - working directory. -# out_dir - where files will be placed upon completion. +# TEMP_DIR - working directory. +# out_dir - where files will be placed upon completion. #----------------------------------------------------------------------- export home_dir=$SLURM_SUBMIT_DIR/.. diff --git a/driver_scripts/driver_grid.jet.sh b/driver_scripts/driver_grid.jet.sh index 0358a3d71..8c3e35447 100755 --- a/driver_scripts/driver_grid.jet.sh +++ b/driver_scripts/driver_grid.jet.sh @@ -24,8 +24,8 @@ # Note: The sfc_climo_gen program only runs with an # mpi task count that is a multiple of six. This is # an ESMF library requirement. Large grids may require -# tasks spread across multiple nodes. The orography -# code benefits from threads. +# tasks spread across multiple nodes. The orography code +# benefits from threads. # # To run, do the following: # @@ -68,29 +68,29 @@ module list # Set grid specs here. #----------------------------------------------------------------------- -export gtype=uniform # 'uniform', 'stretch', 'nest' - # 'regional_gfdl', 'regional_esg' +export gtype=uniform # 'uniform', 'stretch', 'nest', + # 'regional_gfdl', 'regional_esg' +export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T if [ $gtype = uniform ]; then export res=96 - export add_lake=false # Add lake frac and depth to orography data. - # Uniform grids only. - export lake_cutoff=0.20 # lake frac less than lake_cutoff is ignored + export add_lake=false # Add lake frac and depth to orography data. elif [ $gtype = stretch ]; then export res=96 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile export target_lat=35.5 # Center latitude of the highest resolution tile elif [ $gtype = nest ] || [ $gtype = regional_gfdl ]; then - export res=96 + export add_lake=false # Add lake frac and depth to orography data. + export res=768 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile - export target_lat=35.5 # Center latitude of the highest resolution tile + export target_lat=38.5 # Center latitude of the highest resolution tile export refine_ratio=3 # The refinement ratio - export istart_nest=27 # Starting i-direction index of nest grid in parent tile supergrid - export jstart_nest=37 # Starting j-direction index of nest grid in parent tile supergrid - export iend_nest=166 # Ending i-direction index of nest grid in parent tile supergrid - export jend_nest=164 # Ending j-direction index of nest grid in parent tile supergrid + export istart_nest=123 # Starting i-direction index of nest grid in parent tile supergrid + export jstart_nest=331 # Starting j-direction index of nest grid in parent tile supergrid + export iend_nest=1402 # Ending i-direction index of nest grid in parent tile supergrid + export jend_nest=1194 # Ending j-direction index of nest grid in parent tile supergrid export halo=3 # Lateral boundary halo elif [ $gtype = regional_esg ] ; then export res=-999 # equivalent resolution is computed @@ -108,10 +108,10 @@ elif [ $gtype = regional_esg ] ; then fi #----------------------------------------------------------------------- -# Check paths. +# Check paths. # home_dir - location of repository. -# TEMP_DIR - working directory. -# out_dir - where files will be placed upon completion. +# TEMP_DIR - working directory. +# out_dir - where files will be placed upon completion. #----------------------------------------------------------------------- export home_dir=$SLURM_SUBMIT_DIR/.. diff --git a/driver_scripts/driver_grid.orion.sh b/driver_scripts/driver_grid.orion.sh index c08a2ffc2..9afcc02af 100755 --- a/driver_scripts/driver_grid.orion.sh +++ b/driver_scripts/driver_grid.orion.sh @@ -23,7 +23,7 @@ # Note: The sfc_climo_gen program only runs with an # mpi task count that is a multiple of six. This is # an ESMF library requirement. Large grids may require -# tasks spread across multiple nodes. The orography code +# tasks spread across multiple nodes. The orography code # benefits from threads. # # To run, do the following: @@ -34,8 +34,8 @@ # "stretch" - global stretched grid # "nest" - global stretched grid with nest # "regional_gfdl" - stand-alone gfdl regional grid -# "regional_esg" - stand-alone extended Schmidt -# gnomonic (esg) regional grid +# "regional_esg" - stand-alone extended Schmidt gnomonic +# (esg) regional grid # 3) For "uniform" grids - to include lake fraction and # depth, set "add_lake" to true, and the "lake_cutoff" value. # 4) For "stretch" and "nest" grids, set the stretching factor - @@ -67,32 +67,32 @@ module list # Set grid specs here. #----------------------------------------------------------------------- -export gtype=uniform # 'uniform', 'stretch', 'nest', - # 'regional_gfdl', 'regional_esg' +export gtype=uniform # 'uniform', 'stretch', 'nest', + # 'regional_gfdl', 'regional_esg' +export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T if [ $gtype = uniform ]; then export res=96 - export add_lake=false # Add lake frac and depth to orography data. - # Uniform grids only. - export lake_cutoff=0.20 # lake frac less than lake_cutoff is ignored + export add_lake=false # Add lake frac and depth to orography data. elif [ $gtype = stretch ]; then export res=96 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile export target_lat=35.5 # Center latitude of the highest resolution tile elif [ $gtype = nest ] || [ $gtype = regional_gfdl ]; then - export res=96 + export add_lake=false # Add lake frac and depth to orography data. + export res=768 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile - export target_lat=35.5 # Center latitude of the highest resolution tile + export target_lat=38.5 # Center latitude of the highest resolution tile export refine_ratio=3 # The refinement ratio - export istart_nest=27 # Starting i-direction index of nest grid in parent tile supergrid - export jstart_nest=37 # Starting j-direction index of nest grid in parent tile supergrid - export iend_nest=166 # Ending i-direction index of nest grid in parent tile supergrid - export jend_nest=164 # Ending j-direction index of nest grid in parent tile supergrid + export istart_nest=123 # Starting i-direction index of nest grid in parent tile supergrid + export jstart_nest=331 # Starting j-direction index of nest grid in parent tile supergrid + export iend_nest=1402 # Ending i-direction index of nest grid in parent tile supergrid + export jend_nest=1194 # Ending j-direction index of nest grid in parent tile supergrid export halo=3 # Lateral boundary halo elif [ $gtype = regional_esg ] ; then - export res=-999 # equivalent res is computed. + export res=-999 # equivalent resolution is computed export target_lon=-97.5 # Center longitude of grid export target_lat=35.5 # Center latitude of grid export idim=301 # Dimension of grid in 'i' direction @@ -107,10 +107,10 @@ elif [ $gtype = regional_esg ] ; then fi #----------------------------------------------------------------------- -# Check paths. +# Check paths. # home_dir - location of repository. -# TEMP_DIR - working directory. -# out_dir - where files will be placed upon completion. +# TEMP_DIR - working directory. +# out_dir - where files will be placed upon completion. #----------------------------------------------------------------------- export home_dir=$SLURM_SUBMIT_DIR/.. From aca0d7974ab5555653998d94471b28235198a3aa Mon Sep 17 00:00:00 2001 From: "Shan.Sun" Date: Mon, 26 Oct 2020 17:11:14 +0000 Subject: [PATCH 3/3] From Ning Wang: this commit expands lake fraction and depth calculation to both global and regional domain (gtype=regional_gfdl). The resulting lake fraction and depth are added to oro data. add_lake is set to false by default. --- driver_scripts/driver_grid.cray.sh | 13 +++++++------ driver_scripts/driver_grid.dell.sh | 13 +++++++------ driver_scripts/driver_grid.hera.sh | 13 +++++++------ driver_scripts/driver_grid.jet.sh | 13 +++++++------ driver_scripts/driver_grid.orion.sh | 13 +++++++------ 5 files changed, 35 insertions(+), 30 deletions(-) diff --git a/driver_scripts/driver_grid.cray.sh b/driver_scripts/driver_grid.cray.sh index ec17dd817..1631bba73 100755 --- a/driver_scripts/driver_grid.cray.sh +++ b/driver_scripts/driver_grid.cray.sh @@ -36,8 +36,9 @@ # "regional_gfdl" - stand-alone gfdl regional grid # "regional_esg" - stand-alone extended Schmidt gnomonic # (esg) regional grid -# 3) For "uniform" grids - to include lake fraction and -# depth, set "add_lake" to true, and the "lake_cutoff" value. +# 3) For "uniform" and "regional_gfdl" grids - to include lake +# fraction and depth, set "add_lake" to true, and the +# "lake_cutoff" value. # 4) For "stretch" and "nest" grids, set the stretching factor - # "stretch_fac", and center lat/lon of highest resolution # tile - "target_lat" and "target_lon". @@ -65,13 +66,12 @@ module list # Set grid specs here. #----------------------------------------------------------------------- -export gtype=uniform # 'uniform', 'stretch', 'nest', - # 'regional_gfdl', 'regional_esg' -export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T - +export gtype=uniform # 'uniform', 'stretch', 'nest', + # 'regional_gfdl', 'regional_esg' if [ $gtype = uniform ]; then export res=96 export add_lake=false # Add lake frac and depth to orography data. + export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T elif [ $gtype = stretch ]; then export res=96 export stretch_fac=1.5 # Stretching factor for the grid @@ -79,6 +79,7 @@ elif [ $gtype = stretch ]; then export target_lat=35.5 # Center latitude of the highest resolution tile elif [ $gtype = nest ] || [ $gtype = regional_gfdl ]; then export add_lake=false # Add lake frac and depth to orography data. + export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T export res=768 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile diff --git a/driver_scripts/driver_grid.dell.sh b/driver_scripts/driver_grid.dell.sh index 7ab9df9c3..308a9ec06 100755 --- a/driver_scripts/driver_grid.dell.sh +++ b/driver_scripts/driver_grid.dell.sh @@ -38,8 +38,9 @@ # "regional_gfdl" - stand-alone gfdl regional grid # "regional_esg" - stand-alone extended Schmidt gnomonic # (esg) regional grid -# 3) For "uniform" grids - to include lake fraction and -# depth, set "add_lake" to true, and the "lake_cutoff" value. +# 3) For "uniform" and "regional_gfdl" grids - to include lake +# fraction and depth, set "add_lake" to true, and the +# "lake_cutoff" value. # 4) For "stretch" and "nest" grids, set the stretching factor - # "stretch_fac", and center lat/lon of highest resolution # tile - "target_lat" and "target_lon". @@ -67,13 +68,12 @@ module list # Set grid specs here. #----------------------------------------------------------------------- -export gtype=uniform # 'uniform', 'stretch', 'nest', - # 'regional_gfdl', 'regional_esg' -export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T - +export gtype=uniform # 'uniform', 'stretch', 'nest', + # 'regional_gfdl', 'regional_esg' if [ $gtype = uniform ]; then export res=96 export add_lake=false # Add lake frac and depth to orography data. + export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T elif [ $gtype = stretch ]; then export res=96 export stretch_fac=1.5 # Stretching factor for the grid @@ -81,6 +81,7 @@ elif [ $gtype = stretch ]; then export target_lat=35.5 # Center latitude of the highest resolution tile elif [ $gtype = nest ] || [ $gtype = regional_gfdl ]; then export add_lake=false # Add lake frac and depth to orography data. + export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T export res=768 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile diff --git a/driver_scripts/driver_grid.hera.sh b/driver_scripts/driver_grid.hera.sh index 2f175f980..529f14b07 100755 --- a/driver_scripts/driver_grid.hera.sh +++ b/driver_scripts/driver_grid.hera.sh @@ -36,8 +36,9 @@ # "regional_gfdl" - stand-alone gfdl regional grid # "regional_esg" - stand-alone extended Schmidt gnomonic # (esg) regional grid -# 3) For "uniform" grids - to include lake fraction and -# depth, set "add_lake" to true, and the "lake_cutoff" value. +# 3) For "uniform" and "regional_gfdl" grids - to include lake +# fraction and depth, set "add_lake" to true, and the +# "lake_cutoff" value. # 4) For "stretch" and "nest" grids, set the stretching factor - # "stretch_fac", and center lat/lon of highest resolution # tile - "target_lat" and "target_lon". @@ -68,13 +69,12 @@ module list # Set grid specs here. #----------------------------------------------------------------------- -export gtype=uniform # 'uniform', 'stretch', 'nest', - # 'regional_gfdl', 'regional_esg' -export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T - +export gtype=uniform # 'uniform', 'stretch', 'nest', + # 'regional_gfdl', 'regional_esg' if [ $gtype = uniform ]; then export res=96 export add_lake=false # Add lake frac and depth to orography data. + export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T elif [ $gtype = stretch ]; then export res=96 export stretch_fac=1.5 # Stretching factor for the grid @@ -82,6 +82,7 @@ elif [ $gtype = stretch ]; then export target_lat=35.5 # Center latitude of the highest resolution tile elif [ $gtype = nest ] || [ $gtype = regional_gfdl ]; then export add_lake=false # Add lake frac and depth to orography data. + export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T export res=768 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile diff --git a/driver_scripts/driver_grid.jet.sh b/driver_scripts/driver_grid.jet.sh index 8c3e35447..a250b0cd6 100755 --- a/driver_scripts/driver_grid.jet.sh +++ b/driver_scripts/driver_grid.jet.sh @@ -37,8 +37,9 @@ # "regional_gfdl" - stand-alone gfdl regional grid # "regional_esg" - stand-alone extended Schmidt gnomonic # (esg) regional grid -# 3) For "uniform" grids - to include lake fraction and -# depth, set "add_lake" to true, and the "lake_cutoff" value. +# 3) For "uniform" and "regional_gfdl" grids - to include lake +# fraction and depth, set "add_lake" to true, and the +# "lake_cutoff" value. # 4) For "stretch" and "nest" grids, set the stretching factor - # "stretch_fac", and center lat/lon of highest resolution # tile - "target_lat" and "target_lon". @@ -68,13 +69,12 @@ module list # Set grid specs here. #----------------------------------------------------------------------- -export gtype=uniform # 'uniform', 'stretch', 'nest', - # 'regional_gfdl', 'regional_esg' -export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T - +export gtype=uniform # 'uniform', 'stretch', 'nest', + # 'regional_gfdl', 'regional_esg' if [ $gtype = uniform ]; then export res=96 export add_lake=false # Add lake frac and depth to orography data. + export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T elif [ $gtype = stretch ]; then export res=96 export stretch_fac=1.5 # Stretching factor for the grid @@ -82,6 +82,7 @@ elif [ $gtype = stretch ]; then export target_lat=35.5 # Center latitude of the highest resolution tile elif [ $gtype = nest ] || [ $gtype = regional_gfdl ]; then export add_lake=false # Add lake frac and depth to orography data. + export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T export res=768 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile diff --git a/driver_scripts/driver_grid.orion.sh b/driver_scripts/driver_grid.orion.sh index 9afcc02af..f4ac50a39 100755 --- a/driver_scripts/driver_grid.orion.sh +++ b/driver_scripts/driver_grid.orion.sh @@ -36,8 +36,9 @@ # "regional_gfdl" - stand-alone gfdl regional grid # "regional_esg" - stand-alone extended Schmidt gnomonic # (esg) regional grid -# 3) For "uniform" grids - to include lake fraction and -# depth, set "add_lake" to true, and the "lake_cutoff" value. +# 3) For "uniform" and "regional_gfdl" grids - to include lake +# fraction and depth, set "add_lake" to true, and the +# "lake_cutoff" value. # 4) For "stretch" and "nest" grids, set the stretching factor - # "stretch_fac", and center lat/lon of highest resolution # tile - "target_lat" and "target_lon". @@ -67,13 +68,12 @@ module list # Set grid specs here. #----------------------------------------------------------------------- -export gtype=uniform # 'uniform', 'stretch', 'nest', - # 'regional_gfdl', 'regional_esg' -export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T - +export gtype=uniform # 'uniform', 'stretch', 'nest', + # 'regional_gfdl', 'regional_esg' if [ $gtype = uniform ]; then export res=96 export add_lake=false # Add lake frac and depth to orography data. + export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T elif [ $gtype = stretch ]; then export res=96 export stretch_fac=1.5 # Stretching factor for the grid @@ -81,6 +81,7 @@ elif [ $gtype = stretch ]; then export target_lat=35.5 # Center latitude of the highest resolution tile elif [ $gtype = nest ] || [ $gtype = regional_gfdl ]; then export add_lake=false # Add lake frac and depth to orography data. + export lake_cutoff=0.20 # lake frac < lake_cutoff ignored when add_lake=T export res=768 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile