Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/create_clocks' into remove_flux_…
Browse files Browse the repository at this point in the history
…exchange_clocks
  • Loading branch information
mlee03 committed May 9, 2024
2 parents d3ad3e2 + cb7721b commit 43c175f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 35 deletions.
22 changes: 7 additions & 15 deletions full/coupler_main.F90
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@
!! This error should probably not occur because of checks done at initialization time.
program coupler_main

!--- F90 module for OpenMP
use omp_lib
use FMS
use full_coupler_mod
Expand Down Expand Up @@ -369,15 +370,8 @@ program coupler_main
type(FmsTime_type) :: Time_restart_current
character(len=32) :: timestamp

integer :: initClock, mainClock, termClock
integer :: newClock0, newClock1, newClock2, newClock3, newClock4, newClock5, newClock7
integer :: newClock6f, newClock6s, newClock6e, newClock10f, newClock10s, newClock10e
integer :: newClock8, newClock9, newClock11, newClock12, newClock13, newClock14, newClocka
integer :: newClockb, newClockc, newClockd, newClocke, newClockf, newClockg, newClockh, newClocki
integer :: newClockj, newClockk, newClockl
integer :: id_atmos_model_init, id_land_model_init, id_ice_model_init
integer :: id_ocean_model_init, id_flux_exchange_init

type(coupler_clock_type) :: coupler_clocks

integer :: outunit
character(len=80) :: text
integer, allocatable :: ensemble_pelist(:, :)
Expand Down Expand Up @@ -421,21 +415,19 @@ program coupler_main

call fms_mpp_init()

!this clock is on the global pelist
coupler_clocks%initialization = fms_mpp_clock_id( 'Initialization' )
call fms_mpp_clock_begin(coupler_clocks%initialization)

call fms_init
call fmsconstants_init
call fms_affinity_init


call coupler_init(Atm, Ocean, Land, Ice, Ocean_state, Atmos_land_boundary, Atmos_ice_boundary, &
Ocean_ice_boundary, Ice_ocean_boundary, Land_ice_atmos_boundary, Land_ice_boundary, &
Ocean_ice_boundary, Ice_ocean_boundary, Land_ice_atmos_boundary, Land_ice_boundary, &
Ice_ocean_driver_CS, Ice_bc_restart, Ocn_bc_restart, ensemble_pelist, slow_ice_ocean_pelist, &
conc_nthreads, id_atmos_model_init, id_land_model_init, &
id_ice_model_init, id_ocean_model_init, id_flux_exchange_init, mainClock, termClock, &
Time_step_cpld, Time_step_atmos, Time_atmos, Time_ocean, num_cpld_calls, num_atmos_calls, &
Time, Time_start, Time_end, Time_restart, Time_restart_current)
conc_nthreads, coupler_clocks, Time_step_cpld, Time_step_atmos, Time_atmos, Time_ocean, &
num_cpld_calls, num_atmos_calls, Time, Time_start, Time_end, Time_restart, Time_restart_current)

if (do_chksum) call coupler_chksum('coupler_init+', 0, Atm, Land, Ice)

Expand Down
10 changes: 5 additions & 5 deletions full/flux_exchange.F90
Original file line number Diff line number Diff line change
Expand Up @@ -780,11 +780,11 @@ end subroutine flux_exchange_init

subroutine flux_check_stocks(Time, Atm, Lnd, Ice, Ocn_state)

type(FmsTime_type), intent(in) :: Time
type(atmos_data_type), intent(inout), optional :: Atm
type(land_data_type), intent(inout), optional :: Lnd
type(ice_data_type), intent(inout), optional :: Ice
type(ocean_state_type), intent(inout), optional, pointer :: Ocn_state
type(FmsTime_type) :: Time
type(atmos_data_type), optional :: Atm
type(land_data_type), optional :: Lnd
type(ice_data_type), optional :: Ice
type(ocean_state_type), optional, pointer :: Ocn_state

real :: ref_value
integer :: i
Expand Down
30 changes: 15 additions & 15 deletions full/full_coupler_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ module full_coupler_mod
public :: coupler_init, coupler_end, coupler_restart
public :: coupler_chksum, atmos_ice_land_chksum, slow_ice_chksum, ocean_chksum

public :: coupler_clock_type

!-----------------------------------------------------------------------

character(len=128), public :: version = '$Id$'
Expand Down Expand Up @@ -226,8 +228,7 @@ module full_coupler_mod
use_hyper_thread, concurrent_ice, slow_ice_with_ocean, &
do_endpoint_chksum, combined_ice_and_ocean

public :: coupler_clock_type
type coupler_clock_type
type coupler_clock_type
integer :: initialization
integer :: main
integer :: generate_sfc_xgrid
Expand Down Expand Up @@ -269,8 +270,6 @@ module full_coupler_mod
integer :: flux_exchange_init
end type coupler_clock_type

type(coupler_clock_type), public :: coupler_clocks

character(len=80) :: text
character(len=48), parameter :: mod_name = 'coupler_main_mod'

Expand All @@ -285,11 +284,10 @@ module full_coupler_mod

!> \brief Initialize all defined exchange grids and all boundary maps
subroutine coupler_init(Atm, Ocean, Land, Ice, Ocean_state, Atmos_land_boundary, Atmos_ice_boundary, &
Ocean_ice_boundary, Ice_ocean_boundary, Land_ice_atmos_boundary, Land_ice_boundary, &
Ice_ocean_driver_CS, Ice_bc_restart, Ocn_bc_restart, ensemble_pelist, slow_ice_ocean_pelist, conc_nthreads, &
id_atmos_model_init, id_land_model_init, id_ice_model_init, id_ocean_model_init, &
id_flux_exchange_init, mainClock, termClock, Time_step_cpld, Time_step_atmos, Time_atmos, Time_ocean, &
num_cpld_calls, num_atmos_calls, Time, Time_start, Time_end, Time_restart, Time_restart_current)
Ocean_ice_boundary, Ice_ocean_boundary, Land_ice_atmos_boundary, Land_ice_boundary, &
Ice_ocean_driver_CS, Ice_bc_restart, Ocn_bc_restart, ensemble_pelist, slow_ice_ocean_pelist, conc_nthreads, &
coupler_clocks, Time_step_cpld, Time_step_atmos, Time_atmos, Time_ocean, &
num_cpld_calls, num_atmos_calls, Time, Time_start, Time_end, Time_restart, Time_restart_current)

implicit none

Expand All @@ -310,9 +308,7 @@ subroutine coupler_init(Atm, Ocean, Land, Ice, Ocean_state, Atmos_land_boundary,
integer, intent(inout) :: conc_nthreads
integer, allocatable, dimension(:,:), intent(inout) :: ensemble_pelist
integer, allocatable, dimension(:), intent(inout) :: slow_ice_ocean_pelist
integer, intent(inout) :: id_atmos_model_init, id_land_model_init
integer, intent(inout) :: id_ocean_model_init, id_flux_exchange_init, id_ice_model_init
integer, intent(inout) :: mainClock, termClock
type(coupler_clock_type) :: coupler_clocks
type(FMSTime_type), intent(inout) :: Time_step_cpld, Time_step_atmos, Time_atmos, Time_ocean
type(FMSTime_type), intent(inout) :: Time, Time_start, Time_end, Time_restart, Time_restart_current

Expand Down Expand Up @@ -611,7 +607,8 @@ subroutine coupler_init(Atm, Ocean, Land, Ice, Ocean_state, Atmos_land_boundary,
endif

!> The pelists need to be set before initializing the clocks
call coupler_set_clock_ids(Atm, Land, Ice, Ocean, ensemble_pelist, slow_ice_ocean_pelist, ensemble_id, clock_set='model_init_clocks')
call coupler_set_clock_ids(coupler_clocks, Atm, Land, Ice, Ocean, ensemble_pelist, &
slow_ice_ocean_pelist, ensemble_id, clock_set='model_init_clocks')

!Write out messages on root PEs
if (fms_mpp_pe().EQ.fms_mpp_root_pe()) then
Expand Down Expand Up @@ -989,7 +986,8 @@ subroutine coupler_init(Atm, Ocean, Land, Ice, Ocean_state, Atmos_land_boundary,

endif ! end of Ocean%is_ocean_pe

call coupler_set_clock_ids(Atm, Land, Ice, Ocean, ensemble_pelist, slow_ice_ocean_pelist, ensemble_id, clock_set='coupler_clocks')
call coupler_set_clock_ids(coupler_clocks, Atm, Land, Ice, Ocean, ensemble_pelist, &
slow_ice_ocean_pelist, ensemble_id, clock_set='coupler_clocks')

!---------------------------------------------
if (fms_mpp_pe().EQ.fms_mpp_root_pe()) then
Expand Down Expand Up @@ -1522,10 +1520,12 @@ subroutine ocean_chksum(id, timestep, Ocean, Ice_ocean_boundary)
end subroutine ocean_chksum

!> \brief This subroutine sets the ID for clocks used in coupler_main
subroutine coupler_set_clock_ids(Atm, Land, Ice, Ocean, ensemble_pelist, slow_ice_ocean_pelist, ensemble_id, clock_set)
subroutine coupler_set_clock_ids(coupler_clocks, Atm, Land, Ice, Ocean, ensemble_pelist,&
slow_ice_ocean_pelist, ensemble_id, clock_set)

implicit none

type(coupler_clock_type), intent(inout) :: coupler_clocks
type(atmos_data_type), intent(in) :: Atm
type(land_data_type), intent(in) :: Land
type(ocean_public_type), intent(in) :: Ocean
Expand Down

0 comments on commit 43c175f

Please sign in to comment.