Skip to content

Commit

Permalink
Merge remote-tracking branch 'fms/main' into coupler_fast_slow_ice
Browse files Browse the repository at this point in the history
  • Loading branch information
mlee03 committed May 31, 2024
2 parents cddc633 + 80def09 commit e5638d9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 28 deletions.
5 changes: 2 additions & 3 deletions full/coupler_main.F90
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ program coupler_main
character(len=32) :: timestamp

type(coupler_clock_type) :: coupler_clocks

integer :: outunit
character(len=80) :: text
integer, allocatable :: ensemble_pelist(:, :)
Expand Down Expand Up @@ -443,8 +443,6 @@ program coupler_main
coupler_clocks, init_stocks=.True.)

do nc = 1, num_cpld_calls
if (do_chksum) call coupler_chksum('top_of_coupled_loop+', nc, Atm, Land, Ice)
call fms_mpp_set_current_pelist()

if (do_chksum) then
call coupler_chksum('top_of_coupled_loop+', nc, Atm, Land, Ice)
Expand Down Expand Up @@ -838,6 +836,7 @@ program coupler_main
coupler_clocks, finish_stocks=.True.)

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

call fms_mpp_set_current_pelist()
call fms_mpp_clock_end(coupler_clocks%main)
call fms_mpp_clock_begin(coupler_clocks%termination)
Expand Down
2 changes: 1 addition & 1 deletion full/flux_exchange.F90
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ end subroutine flux_exchange_init
!! component.

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
Expand Down
47 changes: 23 additions & 24 deletions full/full_coupler_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,17 @@ module full_coupler_mod
public :: coupler_chksum, atmos_ice_land_chksum, slow_ice_chksum, ocean_chksum

public :: coupler_atmos_ice_land_ocean_chksum

public :: coupler_flux_init_finish_stocks, coupler_flux_check_stocks
public :: coupler_flux_ocean_to_ice, coupler_flux_ice_to_ocean

public :: coupler_unpack_ocean_ice_boundary, coupler_exchange_slow_to_fast_ice, &
coupler_exchange_fast_to_slow_ice, coupler_set_ice_surface_fields

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

public :: coupler_clock_type

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

#include <file_version.fh>

!> namelist interface
Expand Down Expand Up @@ -237,7 +235,7 @@ module full_coupler_mod

!> coupler_clock_type derived type consist of all clock ids that will be set and used
!! in full coupler_main.
type coupler_clock_type
type coupler_clock_type
integer :: initialization
integer :: main
integer :: generate_sfc_xgrid
Expand Down Expand Up @@ -1103,8 +1101,7 @@ subroutine coupler_init(Atm, Ocean, Land, Ice, Ocean_state, Atmos_land_boundary,
call slow_ice_chksum('coupler_init+', 0, Ice, Ocean_ice_boundary)
end if
end if

call fms_mpp_set_current_pelist()

call fms_memutils_print_memuse_stats('coupler_init')

if (fms_mpp_pe().EQ.fms_mpp_root_pe()) then
Expand Down Expand Up @@ -1139,9 +1136,8 @@ subroutine coupler_end(Atm, Land, Ice, Ocean, Ocean_state, Land_ice_atmos_bounda
integer :: num_ice_bc_restart, num_ocn_bc_restart

if ( do_endpoint_chksum ) then
call coupler_atmos_ice_land_ocean_chksum('coupler_end', 0, Atm, Land, Ice, &
Land_ice_atmos_boundary, Atmos_ice_boundary, Atmos_land_boundary, Ocean, &
Ice_ocean_boundary)
call coupler_atmos_ice_land_ocean_chksum('coupler_end', 0, Atm, Land, Ice, &
Land_ice_atmos_boundary, Atmos_ice_boundary, Atmos_land_boundary, Ocean, Ice_ocean_boundary)
if (Ice%slow_ice_PE) then
call fms_mpp_set_current_pelist(Ice%slow_pelist)
call slow_ice_chksum('coupler_end', 0, Ice, Ocean_ice_boundary)
Expand Down Expand Up @@ -1557,11 +1553,11 @@ subroutine coupler_set_clock_ids(coupler_clocks, Atm, Land, Ice, Ocean, ensemble
endif
call fms_mpp_set_current_pelist(ensemble_pelist(ensemble_id,:))
coupler_clocks%flux_exchange_init = fms_mpp_clock_id( ' Init: flux_exchange_init' )

call fms_mpp_set_current_pelist()
coupler_clocks%main = fms_mpp_clock_id( 'Main loop' )
coupler_clocks%termination = fms_mpp_clock_id( 'Termination' )

If(Atm%pe) then
call fms_mpp_set_current_pelist(Atm%pelist)
coupler_clocks%generate_sfc_xgrid = fms_mpp_clock_id( 'generate_sfc_xgrid' )
Expand Down Expand Up @@ -1604,17 +1600,17 @@ subroutine coupler_set_clock_ids(coupler_clocks, Atm, Land, Ice, Ocean, ensemble
coupler_clocks%set_ice_surface_slow = fms_mpp_clock_id( ' Ice: set_ice_surface slow' )
coupler_clocks%update_ice_model_slow_slow = fms_mpp_clock_id( ' Ice: update_ice_model_slow slow' )
coupler_clocks%flux_ice_to_ocean_stocks = fms_mpp_clock_id( ' Ice: flux_ice_to_ocean_stocks' )

call fms_mpp_set_current_pelist(Ice%pelist)
coupler_clocks%set_ice_surface_exchange = fms_mpp_clock_id( ' Ice: set_ice_surface exchange' )
coupler_clocks%update_ice_model_slow_exchange = fms_mpp_clock_id( ' Ice: update_ice_model_slow exchange' )

endif
if (Ocean%is_ocean_pe) then
call fms_mpp_set_current_pelist(Ocean%pelist)
coupler_clocks%ocean = fms_mpp_clock_id( 'OCN' )
endif

call fms_mpp_set_current_pelist()
coupler_clocks%flux_check_stocks = fms_mpp_clock_id( 'flux_check_stocks' )
coupler_clocks%intermediate_restart = fms_mpp_clock_id( 'intermediate restart' )
Expand All @@ -1627,7 +1623,7 @@ subroutine coupler_atmos_ice_land_ocean_chksum(id, timestep, Atm, Land, Ice, Lan
Atmos_ice_boundary, Atmos_land_boundary, Ocean, Ice_ocean_boundary, Ocean_ice_boundary)

implicit none

character(len=*), intent(in) :: id !< ID labelling the set of checksums
integer , intent(in) :: timestep !< timestep
type(atmos_data_type), intent(in) :: Atm !< Atm
Expand Down Expand Up @@ -1659,7 +1655,7 @@ subroutine coupler_flux_init_finish_stocks(Time, Atm, Land, Ice, Ocean_state, &
coupler_clocks, init_stocks, finish_stocks)

implicit none

type(FmsTime_type), intent(in) :: Time !< current Time
type(atmos_data_type), intent(inout) :: Atm !< Atm
type(land_data_type), intent(inout) :: Land !< Land
Expand All @@ -1669,7 +1665,10 @@ subroutine coupler_flux_init_finish_stocks(Time, Atm, Land, Ice, Ocean_state, &
logical, optional, intent(in) :: init_stocks, finish_stocks !< control flags to either call flux_init_stocks or
!! the final flux_check_stocks

logical :: init, finish
logical :: init, finish !< control flags set to False. by default and takes on the value of init_stocks and
!! finish_stocks if these optional arguments are provided.
!! If true, either flux_init_stocks or
!! final flux_check_stocks will be called.

init=.False. ; if(present(init_stocks)) init=init_stocks
finish=.False. ; if(present(finish_stocks)) finish=finish_stocks
Expand Down Expand Up @@ -1698,12 +1697,12 @@ subroutine coupler_flux_check_stocks(nc, Time, Atm, Land, Ice, Ocean_state, coup

integer, intent(in) :: nc !< current outerloop timestep
type(FmsTime_type), intent(in) :: Time !< Time
type(atmos_data_type), intent(inout) :: Atm !< Atm
type(atmos_data_type), intent(inout) :: Atm !< Atm
type(land_data_type), intent(inout) :: Land !< Land
type(ice_data_type), intent(inout) :: Ice !< Ice
type(ocean_state_type), pointer, intent(inout) :: Ocean_state !< Ocean_state
type(coupler_clock_type), intent(inout) :: coupler_clocks !< coupler_clocks

call fms_mpp_clock_begin(coupler_clocks%flux_check_stocks)
if (check_stocks*((nc-1)/check_stocks) == nc-1 .AND. nc > 1) then
call fms_mpp_set_current_pelist()
Expand Down Expand Up @@ -1749,8 +1748,8 @@ subroutine coupler_flux_ice_to_ocean(Ice, Ocean, Ice_ocean_boundary, coupler_clo
type(coupler_clock_type), intent(inout) :: coupler_clocks !< coupler_clocks
integer, dimension(:), optional, intent(in) :: slow_ice_ocean_pelist !< slow_ice_ocean_pelist
!> if true, will call mpp_set_current_pelist(slow_ice_ocean_pelist)
logical, optional, intent(in) :: set_current_slow_ice_ocean_pelist
logical, optional, intent(in) :: set_current_slow_ice_ocean_pelist

logical :: set_current_slow_ice_ocean_pelist_in !< .F. by default; set to equal set_current_slow_ice_ocean_pelist

!> mpp_set_current_pelist(slow_ice_ocean_pelist) is not required if coupler_flux_ice_to_ocean is being called after
Expand Down Expand Up @@ -1846,5 +1845,5 @@ subroutine coupler_set_ice_surface_fields(Ice, coupler_clocks)
call fms_mpp_clock_end(coupler_clocks%set_ice_surface_fast)

end subroutine coupler_set_ice_surface_fields

end module full_coupler_mod

0 comments on commit e5638d9

Please sign in to comment.