Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for MASK_OUTSIDE_OBCS with MASKING_DEPTH #752

Open
wants to merge 22 commits into
base: dev/gfdl
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a7f99af
Fix for MASK_OUTSIDE_OBCS with MASKING_DEPTH
kshedstrom Oct 30, 2024
ef18f5a
Fix the tracer advection outside of interior OBCs.
kshedstrom Nov 7, 2024
01b0dc4
A more correct fix to tracer advection
kshedstrom Nov 8, 2024
4add0e4
Better fix to eta outside of OBCs issue
kshedstrom Nov 8, 2024
9003d00
Merge remote-tracking branch 'gfdl/dev/gfdl' into fix_obc_maskingdepth
kshedstrom Nov 8, 2024
ba1d178
Merge remote-tracking branch 'gfdl/dev/gfdl' into fix_obc_maskingdepth
kshedstrom Nov 17, 2024
52605fb
More tinkering with OBC_in vs CS%OBC
kshedstrom Nov 21, 2024
677baba
Another OBC fix, this for the barotropic mode.
kshedstrom Nov 22, 2024
d60d2ea
More OBC rotation foxes. Still not out of the woods.
kshedstrom Nov 23, 2024
58e7fb6
Fixing case on tr_Reg.
kshedstrom Nov 28, 2024
c28b41c
Merge remote-tracking branch 'gfdl/dev/gfdl' into fix_obc_maskingdepth
kshedstrom Nov 28, 2024
8ffb6f8
Looks good for the first few steps, then not so much.
kshedstrom Nov 28, 2024
86e0260
Making barotropic fix look symmetric.
kshedstrom Dec 4, 2024
37fbbbf
Making barotropic fix look symmetric.
kshedstrom Dec 4, 2024
381a69f
Bug fix for write_energy with short dt (#749)
herrwang0 Nov 30, 2024
4f50442
Remove extra copy of compute_global_grid_integrals
Hallberg-NOAA Nov 30, 2024
f32ff09
Make REMAPPING_USE_OM4_SUBCELLS the default
awallcraft Nov 22, 2024
88a2e4f
Removed default for mandatory time scale in OBCs
adcroft Dec 2, 2024
a892587
Adds a vector of default values to get_param_real_array()
adcroft Nov 26, 2024
822257e
FMS API: Convert real kind of constants
marshallward Dec 8, 2024
8834f68
Inline harmonic analysis (#744)
c2xu Dec 9, 2024
ee42fdb
Tidal angular frequency has units [rad s-1] (#764)
awallcraft Dec 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions config_src/infra/FMS1/MOM_constants.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ module MOM_constants

! This file is part of MOM6. See LICENSE.md for the license.

use constants_mod, only : HLV, HLF
use constants_mod, only : FMS_HLV => HLV
use constants_mod, only : FMS_HLF => HLF

implicit none ; private

!> The constant offset for converting temperatures in Kelvin to Celsius
real, public, parameter :: CELSIUS_KELVIN_OFFSET = 273.15
public :: HLV, HLF
!< The constant offset for converting temperatures in Kelvin to Celsius [K]
real, public, parameter :: HLV = real(FMS_HLV, kind=kind(1.0))
!< Latent heat of vaporization [J kg-1]
real, public, parameter :: HLF = real(FMS_HLF, kind=kind(1.0))
!< Latent heat of fusion [J kg-1]

end module MOM_constants
10 changes: 7 additions & 3 deletions config_src/infra/FMS2/MOM_constants.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ module MOM_constants

! This file is part of MOM6. See LICENSE.md for the license.

use constants_mod, only : HLV, HLF
use constants_mod, only : FMS_HLV => HLV
use constants_mod, only : FMS_HLF => HLF

implicit none ; private

!> The constant offset for converting temperatures in Kelvin to Celsius
real, public, parameter :: CELSIUS_KELVIN_OFFSET = 273.15
public :: HLV, HLF
!< The constant offset for converting temperatures in Kelvin to Celsius [K]
real, public, parameter :: HLV = real(FMS_HLV, kind=kind(1.0))
!< Latent heat of vaporization [J kg-1]
real, public, parameter :: HLF = real(FMS_HLF, kind=kind(1.0))
!< Latent heat of fusion [J kg-1]

end module MOM_constants
20 changes: 20 additions & 0 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2883,6 +2883,26 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, &
! reservoirs are used.
call open_boundary_register_restarts(HI, GV, US, CS%OBC, CS%tracer_Reg, &
param_file, restart_CSp, use_temperature)
if (turns /= 0) then
if (CS%OBC%radiation_BCs_exist_globally) then
OBC_in%rx_normal => CS%OBC%rx_normal
OBC_in%ry_normal => CS%OBC%ry_normal
endif
if (CS%OBC%oblique_BCs_exist_globally) then
OBC_in%rx_oblique_u => CS%OBC%rx_oblique_u
OBC_in%ry_oblique_u => CS%OBC%ry_oblique_u
OBC_in%rx_oblique_v => CS%OBC%rx_oblique_v
OBC_in%ry_oblique_v => CS%OBC%ry_oblique_v
OBC_in%cff_normal_u => CS%OBC%cff_normal_u
OBC_in%cff_normal_v => CS%OBC%cff_normal_v
endif
if (any(CS%OBC%tracer_x_reservoirs_used)) then
OBC_in%tres_x => CS%OBC%tres_x
endif
if (any(CS%OBC%tracer_y_reservoirs_used)) then
OBC_in%tres_y => CS%OBC%tres_y
endif
endif
endif

if (present(waves_CSp)) then
Expand Down
63 changes: 58 additions & 5 deletions src/core/MOM_barotropic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
integer :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB
integer :: ioff, joff
integer :: l_seg
real :: factor(SZI_(G),SZJ_(G)) ! If non-zero, work on given points.

if (.not.CS%module_is_initialized) call MOM_error(FATAL, &
"btstep: Module MOM_barotropic must be initialized before it is used.")
Expand Down Expand Up @@ -2457,17 +2458,69 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
haloshift=iev-ie, unscale=US%L_to_m**2*GV%H_to_m)
endif

do j=jsv,jev
do i=isv,iev
factor(i,j) = CS%IareaT(i,j)
enddo
enddo

! Update factor so that nothing changes outside of the OBC (problem for interior OBCs only)
if (associated(OBC)) then ; if (OBC%OBC_pe) then
! do j=jsv,jev
! if (OBC%specified_u_BCs_exist_globally .or. OBC%open_u_BCs_exist_globally) then
! do i=isv,iev-1 ; if (OBC%segnum_u(I,j) /= OBC_NONE) then
! if (OBC%segment(OBC%segnum_u(I,j))%direction == OBC_DIRECTION_E) then
! factor(i+1,j) = 0.0
! elseif (OBC%segment(OBC%segnum_u(I,j))%direction == OBC_DIRECTION_W) then
! factor(i,j) = 0.0
! endif
! endif ; enddo
! endif
do i=isv,iev
if (OBC%specified_u_BCs_exist_globally .or. OBC%open_u_BCs_exist_globally) then
do j=jsv,jev
if (OBC%segnum_u(I-1,j) /= OBC_NONE) then
if (OBC%segment(OBC%segnum_u(I-1,j))%direction == OBC_DIRECTION_E) then
factor(i,j) = 0.0
endif
endif
if (OBC%segnum_u(I,j) /= OBC_NONE) then
if (OBC%segment(OBC%segnum_u(I,j))%direction == OBC_DIRECTION_W) then
factor(i,j) = 0.0
endif
endif
enddo
endif
enddo
do j=jsv,jev
if (OBC%specified_v_BCs_exist_globally .or. OBC%open_v_BCs_exist_globally) then
do i=isv,iev
if (OBC%segnum_v(i,J-1) /= OBC_NONE) then
if (OBC%segment(OBC%segnum_v(i,J-1))%direction == OBC_DIRECTION_N) then
factor(i,j) = 0.0
endif
endif
if (OBC%segnum_v(i,J) /= OBC_NONE) then
if (OBC%segment(OBC%segnum_v(i,J))%direction == OBC_DIRECTION_S) then
factor(i,j) = 0.0
endif
endif
enddo
endif
enddo
endif ; endif

if (integral_BT_cont) then
!$OMP do
do j=jsv,jev ; do i=isv,iev
eta(i,j) = (eta_IC(i,j) + n*eta_src(i,j)) + CS%IareaT(i,j) * &
eta(i,j) = (eta_IC(i,j) + n*eta_src(i,j)) + factor(i,j) * &
((uhbt_int(I-1,j) - uhbt_int(I,j)) + (vhbt_int(i,J-1) - vhbt_int(i,J)))
eta_wtd(i,j) = eta_wtd(i,j) + eta(i,j) * wt_eta(n)
enddo ; enddo
else
!$OMP do
do j=jsv,jev ; do i=isv,iev
eta(i,j) = (eta(i,j) + eta_src(i,j)) + (dtbt * CS%IareaT(i,j)) * &
eta(i,j) = (eta(i,j) + eta_src(i,j)) + (dtbt * factor(i,j)) * &
((uhbt(I-1,j) - uhbt(I,j)) + (vhbt(i,J-1) - vhbt(i,J)))
eta_wtd(i,j) = eta_wtd(i,j) + eta(i,j) * wt_eta(n)
enddo ; enddo
Expand Down Expand Up @@ -5270,7 +5323,7 @@ subroutine register_barotropic_restarts(HI, GV, US, param_file, CS, restart_CS)
character(len=40) :: mdl = "MOM_barotropic" ! This module's name.
integer :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB
real :: am2, ak1 !< Bandwidth parameters of the M2 and K1 streaming filters [nondim]
real :: om2, ok1 !< Target frequencies of the M2 and K1 streaming filters [T-1 ~> s-1]
real :: om2, ok1 !< Target frequencies of the M2 and K1 streaming filters [rad T-1 ~> rad s-1]

isd = HI%isd ; ied = HI%ied ; jsd = HI%jsd ; jed = HI%jed
IsdB = HI%IsdB ; IedB = HI%IedB ; JsdB = HI%JsdB ; JedB = HI%JedB
Expand Down Expand Up @@ -5301,13 +5354,13 @@ subroutine register_barotropic_restarts(HI, GV, US, param_file, CS, restart_CS)
"Frequency of the M2 tidal constituent. "//&
"This is only used if TIDES and TIDE_M2"// &
" are true, or if OBC_TIDE_N_CONSTITUENTS > 0 and M2"// &
" is in OBC_TIDE_CONSTITUENTS.", units="s-1", default=tidal_frequency("M2"), &
" is in OBC_TIDE_CONSTITUENTS.", units="rad s-1", default=tidal_frequency("M2"), &
scale=US%T_to_s, do_not_log=.true.)
call get_param(param_file, mdl, "TIDE_K1_FREQ", ok1, &
"Frequency of the K1 tidal constituent. "//&
"This is only used if TIDES and TIDE_K1"// &
" are true, or if OBC_TIDE_N_CONSTITUENTS > 0 and K1"// &
" is in OBC_TIDE_CONSTITUENTS.", units="s-1", default=tidal_frequency("K1"), &
" is in OBC_TIDE_CONSTITUENTS.", units="rad s-1", default=tidal_frequency("K1"), &
scale=US%T_to_s, do_not_log=.true.)

ALLOC_(CS%ubtav(IsdB:IedB,jsd:jed)) ; CS%ubtav(:,:) = 0.0
Expand Down
Loading
Loading