Skip to content

Commit

Permalink
Merging 2021.02 into land_lad2
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Stofferahn authored and Eric Stofferahn committed Jul 29, 2021
2 parents 2f0e98c + 8370d4b commit c03c4f6
Show file tree
Hide file tree
Showing 37 changed files with 1,912 additions and 5,904 deletions.
30 changes: 6 additions & 24 deletions canopy_air/canopy_air.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,9 @@ module canopy_air_mod

#include "../shared/debug.inc"

#ifdef INTERNAL_FILE_NML
use fms_mod, only : error_mesg, FATAL, NOTE, &
check_nml_error, mpp_pe, mpp_root_pe, stdlog, string
use mpp_mod, only: input_nml_file
#else
use fms_mod, only: open_namelist_file
#endif

use fms_mod, only : error_mesg, FATAL, NOTE, file_exist, &
close_file, check_nml_error, mpp_pe, mpp_root_pe, stdlog, string
use constants_mod, only : VONKARM
use sphum_mod, only : qscomp
use field_manager_mod, only : parse, MODEL_ATMOS, MODEL_LAND
Expand Down Expand Up @@ -102,21 +97,8 @@ subroutine read_cana_namelist()

call log_version(version, module_name, &
__FILE__)
#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=cana_nml, iostat=io)
ierr = check_nml_error(io, 'cana_nml')
#else
if (file_exist('input.nml')) then
unit = open_namelist_file()
ierr = 1;
do while (ierr /= 0)
read (unit, nml=cana_nml, iostat=io, end=10)
ierr = check_nml_error (io, 'cana_nml')
enddo
10 continue
call close_file (unit)
endif
#endif
read (input_nml_file, nml=cana_nml, iostat=io)
ierr = check_nml_error(io, 'cana_nml')
if (mpp_pe() == mpp_root_pe()) then
unit = stdlog()
write (unit, nml=cana_nml)
Expand All @@ -130,7 +112,7 @@ subroutine cana_init()
! ---- local vars ----------------------------------------------------------
type(land_tile_enum_type) :: ce ! tile list enumerator
type(land_tile_type), pointer :: tile ! pointer to current tile
character(*), parameter :: restart_file_name='INPUT/cana.res.nc'
character(*), parameter :: restart_file_name='INPUT/cana.nc'
type(land_restart_type) :: restart
logical :: restart_exists

Expand Down Expand Up @@ -237,7 +219,7 @@ subroutine save_cana_restart (tile_dim_length, timestamp)

call error_mesg('cana_end','writing NetCDF restart',NOTE)
! Note that filename is updated for tile & rank numbers during file creation
filename = trim(timestamp)//'cana.res.nc'
filename = 'RESTART/'//trim(timestamp)//'cana.nc'
call init_land_restart(restart, filename, cana_tile_exists, tile_dim_length)

! write temperature
Expand Down
24 changes: 3 additions & 21 deletions glacier/glac_tile.F90
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,8 @@
module glac_tile_mod
#include <fms_platform.h>

#ifdef INTERNAL_FILE_NML
use fms_mod, only : check_nml_error, stdlog
use mpp_mod, only: input_nml_file
#else
use fms_mod, only: open_namelist_file
#endif

use fms_mod, only : file_exist, check_nml_error, close_file, stdlog
use constants_mod, only : pi, tfreeze, hlf
use land_constants_mod, only : NBANDS
use land_io_mod, only : init_cover_field
Expand Down Expand Up @@ -231,21 +226,8 @@ subroutine read_glac_data_namelist(glac_n_lev, glac_dz)

call log_version(version, module_name, &
__FILE__)
#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=glac_data_nml, iostat=io)
ierr = check_nml_error(io, 'glac_data_nml')
#else
if (file_exist('input.nml')) then
unit = open_namelist_file()
ierr = 1;
do while (ierr /= 0)
read (unit, nml=glac_data_nml, iostat=io, end=10)
ierr = check_nml_error (io, 'glac_data_nml')
enddo
10 continue
call close_file (unit)
endif
#endif
read (input_nml_file, nml=glac_data_nml, iostat=io)
ierr = check_nml_error(io, 'glac_data_nml')
unit=stdlog()
write (unit, nml=glac_data_nml)

Expand Down
39 changes: 10 additions & 29 deletions glacier/glacier.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,9 @@
! ============================================================================
module glacier_mod

#ifdef INTERNAL_FILE_NML
use mpp_mod, only: input_nml_file
#else
use fms_mod, only: open_namelist_file
#endif

use fms_mod, only : error_mesg, file_exist, check_nml_error, stdlog, close_file, &
use fms_mod, only : error_mesg, check_nml_error, stdlog, &
mpp_pe, mpp_root_pe, FATAL, NOTE

use mpp_mod, only: input_nml_file
use time_manager_mod, only: time_type_to_real
use diag_manager_mod, only: diag_axis_init
use constants_mod, only: tfreeze, hlv, hlf, dens_h2o
Expand Down Expand Up @@ -107,21 +101,8 @@ subroutine read_glac_namelist()

call log_version(version, module_name, &
__FILE__)
#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml=glac_nml, iostat=io)
ierr = check_nml_error(io, 'glac_nml')
#else
if (file_exist('input.nml')) then
unit = open_namelist_file()
ierr = 1;
do while (ierr /= 0)
read (unit, nml=glac_nml, iostat=io, end=10)
ierr = check_nml_error (io, 'glac_nml')
enddo
10 continue
call close_file (unit)
endif
#endif
read (input_nml_file, nml=glac_nml, iostat=io)
ierr = check_nml_error(io, 'glac_nml')
if (mpp_pe() == mpp_root_pe()) then
unit = stdlog()
write (unit, nml=glac_nml)
Expand All @@ -147,7 +128,7 @@ subroutine glac_init (id_ug)
type(land_tile_type), pointer :: tile ! pointer to current tile
type(land_restart_type) :: restart
logical :: restart_exists
character(*), parameter :: restart_file_name='INPUT/glac.res.nc'
character(*), parameter :: restart_file_name='INPUT/glac.nc'

module_is_initialized = .TRUE.
delta_time = time_type_to_real(lnd%dt_fast)
Expand Down Expand Up @@ -222,14 +203,14 @@ subroutine save_glac_restart (tile_dim_length, timestamp)
call error_mesg('glac_end','writing NetCDF restart',NOTE)
! must set domain so that io_domain is available
! Note that filename is updated for tile & rank numbers during file creation
filename = trim(timestamp)//'glac.res.nc'
filename = 'RESTART/'//trim(timestamp)//'glac.nc'
call init_land_restart(restart, filename, glac_tile_exists, tile_dim_length)
call add_restart_axis(restart,'zfull',zfull(1:num_l),'Z','m','full level',sense=-1)
call add_restart_axis(restart,'zfull',zfull(1:num_l),.false.,"Z",'m','full level')

! Output data provides signature
call add_tile_data(restart,'temp', 'zfull', glac_temp_ptr, longname='glacier temperature', units='degrees_K')
call add_tile_data(restart,'wl', 'zfull', glac_wl_ptr, longname='liquid water content', units='kg/m2')
call add_tile_data(restart,'ws', 'zfull', glac_ws_ptr, longname='solid water content', units='kg/m2')
call add_tile_data(restart,'temp', 'zfull ', glac_temp_ptr, longname='glacier temperature', units='degrees_K')
call add_tile_data(restart,'wl', 'zfull ', glac_wl_ptr, longname='liquid water content', units='kg/m2')
call add_tile_data(restart,'ws', 'zfull ', glac_ws_ptr, longname='solid water content', units='kg/m2')

! save performs io domain aggregation through mpp_io as with regular domain data
call save_land_restart(restart)
Expand Down
Loading

0 comments on commit c03c4f6

Please sign in to comment.