Skip to content

Commit

Permalink
Merge branch 'dev/gfdl' into fix_homogenize_forcing
Browse files Browse the repository at this point in the history
  • Loading branch information
Hallberg-NOAA authored Mar 10, 2022
2 parents fa2832c + ab50f0e commit d7b6f4f
Show file tree
Hide file tree
Showing 11 changed files with 413 additions and 296 deletions.
31 changes: 31 additions & 0 deletions config_src/infra/FMS1/MOM_coms_infra.F90
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module MOM_coms_infra

public :: PE_here, root_PE, num_PEs, set_rootPE, Set_PElist, Get_PElist
public :: broadcast, sum_across_PEs, min_across_PEs, max_across_PEs
public :: any_across_PEs, all_across_PEs
public :: field_chksum, MOM_infra_init, MOM_infra_end

! This module provides interfaces to the non-domain-oriented communication
Expand Down Expand Up @@ -438,6 +439,36 @@ subroutine min_across_PEs_real_1d(field, length, pelist)
call mpp_min(field, length, pelist)
end subroutine min_across_PEs_real_1d

!> Implementation of any() intrinsic across PEs
function any_across_PEs(field, pelist)
logical, intent(in) :: field !< Local PE value
integer, optional, intent(in) :: pelist(:) !< List of PEs to work with
logical :: any_across_PEs

integer :: field_flag

! FMS1 does not support logical collectives, so integer flags are used.
field_flag = 0
if (field) field_flag = 1
call max_across_PEs(field_flag, pelist)
any_across_PEs = (field_flag > 0)
end function any_across_PEs

!> Implementation of all() intrinsic across PEs
function all_across_PEs(field, pelist)
logical, intent(in) :: field !< Local PE value
integer, optional, intent(in) :: pelist(:) !< List of PEs to work with
logical :: all_across_PEs

integer :: field_flag

! FMS1 does not support logical collectives, so integer flags are used.
field_flag = 0
if (field) field_flag = 1
call min_across_PEs(field_flag, pelist)
all_across_PEs = (field_flag > 0)
end function all_across_PEs

!> Initialize the model framework, including PE communication over a designated communicator.
!! If no communicator ID is provided, the framework's default communicator is used.
subroutine MOM_infra_init(localcomm)
Expand Down
31 changes: 31 additions & 0 deletions config_src/infra/FMS2/MOM_coms_infra.F90
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module MOM_coms_infra

public :: PE_here, root_PE, num_PEs, set_rootPE, Set_PElist, Get_PElist
public :: broadcast, sum_across_PEs, min_across_PEs, max_across_PEs
public :: any_across_PEs, all_across_PEs
public :: field_chksum, MOM_infra_init, MOM_infra_end

! This module provides interfaces to the non-domain-oriented communication
Expand Down Expand Up @@ -438,6 +439,36 @@ subroutine min_across_PEs_real_1d(field, length, pelist)
call mpp_min(field, length, pelist)
end subroutine min_across_PEs_real_1d

!> Implementation of any() intrinsic across PEs
function any_across_PEs(field, pelist)
logical, intent(in) :: field !< Local PE value
integer, optional, intent(in) :: pelist(:) !< List of PEs to work with
logical :: any_across_PEs

integer :: field_flag

! FMS1 does not support logical collectives, so integer flags are used.
field_flag = 0
if (field) field_flag = 1
call max_across_PEs(field_flag, pelist)
any_across_PEs = (field_flag > 0)
end function any_across_PEs

!> Implementation of all() intrinsic across PEs
function all_across_PEs(field, pelist)
logical, intent(in) :: field !< Local PE value
integer, optional, intent(in) :: pelist(:) !< List of PEs to work with
logical :: all_across_PEs

integer :: field_flag

! FMS1 does not support logical collectives, so integer flags are used.
field_flag = 0
if (field) field_flag = 1
call min_across_PEs(field_flag, pelist)
all_across_PEs = (field_flag > 0)
end function all_across_PEs

!> Initialize the model framework, including PE communication over a designated communicator.
!! If no communicator ID is provided, the framework's default communicator is used.
subroutine MOM_infra_init(localcomm)
Expand Down
348 changes: 239 additions & 109 deletions src/ALE/MOM_ALE.F90

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/core/MOM_verticalGrid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ subroutine verticalGridInit( param_file, GV, US )
! Here NK_ is a macro, while nk is a variable.
call get_param(param_file, mdl, "NK", nk, &
"The number of model layers.", units="nondim", &
static_value=NK_)
default=NK_)
if (nk /= NK_) call MOM_error(FATAL, "verticalGridInit: " // &
"Mismatched number of layers NK_ between MOM_memory.h and param_file")

Expand Down
2 changes: 2 additions & 0 deletions src/framework/MOM_coms.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ module MOM_coms
use MOM_coms_infra, only : PE_here, root_PE, num_PEs, set_rootPE, Set_PElist, Get_PElist
use MOM_coms_infra, only : broadcast, field_chksum, MOM_infra_init, MOM_infra_end
use MOM_coms_infra, only : sum_across_PEs, max_across_PEs, min_across_PEs
use MOM_coms_infra, only : all_across_PEs, any_across_PEs
use MOM_error_handler, only : MOM_error, MOM_mesg, FATAL, WARNING

implicit none ; private

public :: PE_here, root_PE, num_PEs, MOM_infra_init, MOM_infra_end
public :: broadcast, sum_across_PEs, min_across_PEs, max_across_PEs, field_chksum
public :: all_across_PEs, any_across_PEs
public :: set_PElist, Get_PElist, Set_rootPE
public :: reproducing_sum, reproducing_sum_EFP, EFP_sum_across_PEs, EFP_list_sum_across_PEs
public :: EFP_plus, EFP_minus, EFP_to_real, real_to_EFP, EFP_real_diff
Expand Down
8 changes: 4 additions & 4 deletions src/framework/MOM_domains.F90
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,11 @@ subroutine MOM_domains_init(MOM_dom, param_file, symmetric, static_memory, &
call get_param(param_file, mdl, "NIGLOBAL", n_global(1), &
"The total number of thickness grid points in the x-direction in the physical "//&
"domain. With STATIC_MEMORY_ this is set in "//trim(inc_nm)//" at compile time.", &
static_value=NIGLOBAL)
default=NIGLOBAL)
call get_param(param_file, mdl, "NJGLOBAL", n_global(2), &
"The total number of thickness grid points in the y-direction in the physical "//&
"domain. With STATIC_MEMORY_ this is set in "//trim(inc_nm)//" at compile time.", &
static_value=NJGLOBAL)
default=NJGLOBAL)
if (n_global(1) /= NIGLOBAL) call MOM_error(FATAL,"MOM_domains_init: " // &
"static mismatch for NIGLOBAL_ domain size. Header file does not match input namelist")
if (n_global(2) /= NJGLOBAL) call MOM_error(FATAL,"MOM_domains_init: " // &
Expand Down Expand Up @@ -256,11 +256,11 @@ subroutine MOM_domains_init(MOM_dom, param_file, symmetric, static_memory, &
call get_param(param_file, mdl, trim(nihalo_nm), n_halo(1), &
"The number of halo points on each side in the x-direction. How this is set "//&
"varies with the calling component and static or dynamic memory configuration.", &
default=nihalo_dflt, static_value=nihalo_dflt)
default=nihalo_dflt)
call get_param(param_file, mdl, trim(njhalo_nm), n_halo(2), &
"The number of halo points on each side in the y-direction. How this is set "//&
"varies with the calling component and static or dynamic memory configuration.", &
default=njhalo_dflt, static_value=njhalo_dflt)
default=njhalo_dflt)
if (present(min_halo)) then
n_halo(1) = max(n_halo(1), min_halo(1))
min_halo(1) = n_halo(1)
Expand Down
Loading

0 comments on commit d7b6f4f

Please sign in to comment.