From 61875852b52951f6c6215603a19c826b952fc534 Mon Sep 17 00:00:00 2001 From: Jun Wang <37633869+junwang-noaa@users.noreply.github.com> Date: Tue, 17 Nov 2020 15:16:55 -0500 Subject: [PATCH] add GFSv16 dzmin change and changes for Dev/jcsda (#44) * add GFSv16 dzmin change * Add code changes in external_ic.F90 and fv_grid_tools.F90 for dev/jcsda, dycore PR #35 Co-authored-by: Jun Wang Co-authored-by: Dan Holdaway --- model/nh_utils.F90 | 22 +++++++++++----------- tools/external_ic.F90 | 13 +++++-------- tools/fv_grid_tools.F90 | 8 ++++---- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/model/nh_utils.F90 b/model/nh_utils.F90 index c6ada26c0..893a8725c 100644 --- a/model/nh_utils.F90 +++ b/model/nh_utils.F90 @@ -66,7 +66,7 @@ module nh_utils_mod public sim3p0_solver, rim_2d public Riem_Solver_c - real, parameter:: dz_min = 2. + real, parameter:: dz_min = 6. real, parameter:: r3 = 1./3. CONTAINS @@ -198,14 +198,14 @@ subroutine update_dz_c(is, ie, js, je, km, ng, dt, dp0, zs, area, ut, vt, gz, ws ! Enforce monotonicity of height to prevent blowup !$OMP parallel do default(none) shared(is1,ie1,js1,je1,ws,zs,gz,rdt,km) do j=js1, je1 - do i=is1, ie1 - ws(i,j) = ( zs(i,j) - gz(i,j,km+1) ) * rdt - enddo - do k=km, 1, -1 + do k=2, km+1 do i=is1, ie1 - gz(i,j,k) = max( gz(i,j,k), gz(i,j,k+1) + dz_min ) + gz(i,j,k) = min( gz(i,j,k), gz(i,j,k-1) - dz_min ) enddo enddo + do i=is1, ie1 + ws(i,j) = ( zs(i,j) - gz(i,j,km+1) ) * rdt + enddo enddo end subroutine update_dz_c @@ -312,15 +312,15 @@ subroutine update_dz_d(ndif, damp, hord, is, ie, js, je, km, ng, npx, npy, area, !$OMP parallel do default(none) shared(is,ie,js,je,km,ws,zs,zh,rdt) do j=js, je - do i=is,ie - ws(i,j) = ( zs(i,j) - zh(i,j,km+1) ) * rdt - enddo - do k=km, 1, -1 + do k=2, km+1 do i=is, ie ! Enforce monotonicity of height to prevent blowup - zh(i,j,k) = max( zh(i,j,k), zh(i,j,k+1) + dz_min ) + zh(i,j,k) = min( zh(i,j,k), zh(i,j,k-1) - dz_min ) enddo enddo + do i=is,ie + ws(i,j) = ( zs(i,j) - zh(i,j,km+1) ) * rdt + enddo enddo end subroutine update_dz_d diff --git a/tools/external_ic.F90 b/tools/external_ic.F90 index 44f76c22e..69ef847bc 100644 --- a/tools/external_ic.F90 +++ b/tools/external_ic.F90 @@ -148,7 +148,7 @@ module external_ic_mod use external_sst_mod, only: i_sst, j_sst, sst_ncep use fms_mod, only: file_exist, read_data, field_exist, write_version_number use fms_mod, only: open_namelist_file, check_nml_error, close_file - use fms_mod, only: get_mosaic_tile_file, read_data, error_mesg + use fms_mod, only: get_mosaic_tile_file, error_mesg use fms_io_mod, only: get_tile_string, field_size, free_restart_type use fms_io_mod, only: restart_file_type, register_restart_field use fms_io_mod, only: save_restart, restore_state, set_filename_appendix, get_global_att_value @@ -197,10 +197,11 @@ module external_ic_mod real, parameter:: zvir = rvgas/rdgas - 1. real(kind=R_GRID), parameter :: cnst_0p20=0.20d0 - real :: deg2rad - character (len = 80) :: source ! This tells what the input source was for the data + real, parameter :: deg2rad = pi/180. + character (len = 80),public :: source ! This tells what the input source was for the data character(len=27), parameter :: source_fv3gfs = 'FV3GFS GAUSSIAN NEMSIO FILE' - public get_external_ic, get_cubed_sphere_terrain + public get_external_ic, get_cubed_sphere_terrain + public remap_scalar, remap_dwinds ! version number of this module ! Include variable "version" to be written to log file. @@ -999,8 +1000,6 @@ subroutine get_ncep_ic( Atm, fv_domain, nq ) jsd = Atm%bd%jsd jed = Atm%bd%jed - deg2rad = pi/180. - npz = Atm%npz call get_number_tracers(MODEL_ATMOS, num_tracers=ntracers, num_prog=ntprog) if(is_master()) write(*,*) 'ntracers = ', ntracers, 'ntprog = ',ntprog @@ -1564,8 +1563,6 @@ subroutine get_ecmwf_ic( Atm, fv_domain ) jsd = Atm%bd%jsd jed = Atm%bd%jed - deg2rad = pi/180. - npz = Atm%npz call get_number_tracers(MODEL_ATMOS, num_tracers=ntracers, num_prog=ntprog) if(is_master()) write(*,*) 'ntracers = ', ntracers, 'ntprog = ',ntprog diff --git a/tools/fv_grid_tools.F90 b/tools/fv_grid_tools.F90 index 5a3a964a4..45914aa17 100644 --- a/tools/fv_grid_tools.F90 +++ b/tools/fv_grid_tools.F90 @@ -629,7 +629,7 @@ subroutine init_grid(Atm, grid_name, grid_file, npx, npy, npz, ndims, nregions, if (Atm%neststruct%nested .or. ANY(Atm%neststruct%child_grids)) then grid_global => Atm%grid_global - else if( trim(grid_file) .NE. 'INPUT/grid_spec.nc') then + else if( trim(grid_file) .EQ. 'Inline') then allocate(grid_global(1-ng:npx +ng,1-ng:npy +ng,ndims,1:nregions)) endif @@ -683,7 +683,7 @@ subroutine init_grid(Atm, grid_name, grid_file, npx, npy, npz, ndims, nregions, ! still need to set up call setup_aligned_nest(Atm) else - if(trim(grid_file) == 'INPUT/grid_spec.nc') then + if(trim(grid_file) .NE. 'Inline') then call read_grid(Atm, grid_file, ndims, nregions, ng) else if (Atm%flagstruct%grid_type>=0) call gnomonic_grids(Atm%flagstruct%grid_type, npx-1, xs, ys) @@ -1180,8 +1180,8 @@ subroutine init_grid(Atm, grid_name, grid_file, npx, npy, npz, ndims, nregions, enddo if (Atm%neststruct%nested .or. ANY(Atm%neststruct%child_grids)) then - nullify(grid_global) - else if( trim(grid_file) .NE. 'INPUT/grid_spec.nc') then + nullify(grid_global) + else if( trim(grid_file) .EQ. 'Inline') then deallocate(grid_global) endif