Skip to content

Commit

Permalink
fix: data override updates and bugfixes (#67)
Browse files Browse the repository at this point in the history
Removes grid code and variables from SHiELD/coupler_main and fixes data_override_init
Removes outdated logic in simple/coupler_main for data_override_init parsing
bensonr authored Mar 31, 2022
1 parent 8763a10 commit de3e3cb
Showing 3 changed files with 17 additions and 33 deletions.
25 changes: 9 additions & 16 deletions SHiELD/coupler_main.F90
Original file line number Diff line number Diff line change
@@ -28,12 +28,12 @@ program coupler_main
!-----------------------------------------------------------------------

use FMS
use FMSconstants, only: constants_init
use atmos_model_mod, only: atmos_model_init, atmos_model_end, &
update_atmos_model_dynamics, &
update_atmos_radiation_physics, &
update_atmos_model_state, &
atmos_data_type, atmos_model_restart
use FMSconstants, only: fmsconstants_init
use atmos_model_mod, only: atmos_model_init, atmos_model_end, &
update_atmos_model_dynamics, &
update_atmos_radiation_physics, &
update_atmos_model_state, &
atmos_data_type, atmos_model_restart
!--- FMS old io
use fms_io_mod, only: fms_io_exit!< This can't be removed until fms_io is not used at all

@@ -122,7 +122,7 @@ program coupler_main

call fms_init()
call sat_vapor_pres_init()
call constants_init()
call fmsconstants_init()

initClock = mpp_clock_id( 'Initialization' )
call mpp_clock_begin (initClock) !nesting problem
@@ -201,18 +201,15 @@ subroutine coupler_init
! initialize all defined exchange grids and all boundary maps
!-----------------------------------------------------------------------
integer :: total_days, total_seconds, unit, ierr, io
integer :: n, gnlon, gnlat
integer :: n
integer :: date(6), flags
type (time_type) :: Run_length
character(len=9) :: month
logical :: use_namelist

character(len=:), dimension(:), allocatable :: restart_file !< Restart file saved as a string
integer :: time_stamp_unit !< Unif of the time_stamp file
integer :: ascii_unit !< Unit of a dummy ascii file

logical, allocatable, dimension(:,:) :: mask
real, allocatable, dimension(:,:) :: glon_bnd, glat_bnd
!-----------------------------------------------------------------------
!----- initialization timing identifiers ----

@@ -388,11 +385,7 @@ subroutine coupler_init

call print_memuse_stats('after atmos model init')

call mpp_get_global_domain(Atm%Domain, xsize=gnlon, ysize=gnlat)
allocate ( glon_bnd(gnlon+1,gnlat+1), glat_bnd(gnlon+1,gnlat+1) )
call mpp_global_field(Atm%Domain, Atm%lon_bnd, glon_bnd, position=CORNER)
call mpp_global_field(Atm%Domain, Atm%lat_bnd, glat_bnd, position=CORNER)

!------ initialize data_override -----
if (.NOT.Atm%bounded_domain) call data_override_init (Atm_domain_in = Atm%domain)

!-----------------------------------------------------------------------
5 changes: 4 additions & 1 deletion full/coupler_main.F90
Original file line number Diff line number Diff line change
@@ -1368,10 +1368,11 @@ subroutine coupler_init
!--- setting affinity
if (do_concurrent_radiation) then
!$ call fms_affinity_set('ATMOS', use_hyper_thread, atmos_nthreads + radiation_nthreads)
!$ call omp_set_num_threads(atmos_nthreads+radiation_nthreads)
else
!$ call fms_affinity_set('ATMOS', use_hyper_thread, atmos_nthreads)
!$ call omp_set_num_threads(atmos_nthreads)
endif
!$ call omp_set_num_threads(atmos_nthreads)
endif

!--- initialization clock
@@ -1732,8 +1733,10 @@ subroutine coupler_init
if (concurrent) then
call mpp_set_current_pelist( Ocean%pelist )
!$ call fms_affinity_set('OCEAN', use_hyper_thread, ocean_nthreads)
!$ call omp_set_num_threads(ocean_nthreads)
else
ocean_nthreads = atmos_nthreads
!--- omp_num_threads has already been set by the Atmos-pes, but set again to ensure
!$ call omp_set_num_threads(ocean_nthreads)
endif

20 changes: 4 additions & 16 deletions simple/coupler_main.F90
Original file line number Diff line number Diff line change
@@ -243,7 +243,6 @@ subroutine coupler_init
integer :: total_days, total_seconds, ierr, io
integer :: n, gnlon, gnlat
integer :: date(6), flags
integer :: dt_size
type (time_type) :: Run_length
character(len=9) :: month
logical :: use_namelist
@@ -443,18 +442,10 @@ subroutine coupler_init
call ice_model_init (Ice, Time_init, Time_atmos, Time_step_atmos, Time_step_ocean, &
glon_bnd, glat_bnd, atmos_domain=Atm%Domain)

if (file_exists('data_table')) then
inquire(file='data_table', size=dt_size)
if (dt_size > 0.) then
call data_override_init(Atm_domain_in = Atm%domain)
call data_override_init(Ice_domain_in = Ice%domain)
call data_override_init(Land_domain_in = Land%domain)
else
call error_mesg ('program coupler', 'empty data table, skipping data override init', WARNING)
endif
else
call error_mesg ('program coupler', 'no data table, skipping data override init', WARNING)
endif
!------ initialize data_override -----
call data_override_init(Atm_domain_in = Atm%domain)
call data_override_init(Ice_domain_in = Ice%domain)
call data_override_init(Land_domain_in = Land%domain)

!------------------------------------------------------------------------
!---- setup allocatable storage for fluxes exchanged between models ----
@@ -465,9 +456,6 @@ subroutine coupler_init
atmos_ice_boundary, &
land_ice_atmos_boundary )




!-----------------------------------------------------------------------
!---- open and close dummy file in restart dir to check if dir exists --
if ( mpp_pe().EQ.mpp_root_pe() ) then

0 comments on commit de3e3cb

Please sign in to comment.