diff --git a/src/core/MOM_CoriolisAdv.F90 b/src/core/MOM_CoriolisAdv.F90 index fd015b3262..c32352acb1 100644 --- a/src/core/MOM_CoriolisAdv.F90 +++ b/src/core/MOM_CoriolisAdv.F90 @@ -224,6 +224,27 @@ subroutine CorAdCalc(u, v, h, uh, vh, CAu, CAv, OBC, AD, G, GV, CS) do j=Jsq-1,Jeq+2 ; do I=Isq-1,Ieq+2 Area_h(i,j) = G%mask2dT(i,j) * G%areaT(i,j) enddo ; enddo + if (associated(OBC)) then ; do n=1,OBC%number_of_segments + if (.not. OBC%segment(n)%on_pe) cycle + I = OBC%segment(n)%HI%IsdB ; J = OBC%segment(n)%HI%JsdB + if (OBC%segment(n)%is_N_or_S .and. (J >= Jsq-1) .and. (J <= Jeq+1)) then + do i = max(Isq-1,OBC%segment(n)%HI%isd), min(Ieq+2,OBC%segment(n)%HI%ied) + if (OBC%segment(n)%direction == OBC_DIRECTION_N) then + Area_h(i,j+1) = Area_h(i,j) + else ! (OBC%segment(n)%direction == OBC_DIRECTION_S) + Area_h(i,j) = Area_h(i,j+1) + endif + enddo + elseif (OBC%segment(n)%is_E_or_W .and. (I >= Isq-1) .and. (I <= Ieq+1)) then + do j = max(Jsq-1,OBC%segment(n)%HI%jsd), min(Jeq+2,OBC%segment(n)%HI%jed) + if (OBC%segment(n)%direction == OBC_DIRECTION_E) then + Area_h(i+1,j) = Area_h(i,j) + else ! (OBC%segment(n)%direction == OBC_DIRECTION_W) + Area_h(i,j) = Area_h(i+1,j) + endif + enddo + endif + enddo ; endif !$OMP parallel do default(private) shared(Isq,Ieq,Jsq,Jeq,G,Area_h,Area_q) do J=Jsq-1,Jeq+1 ; do I=Isq-1,Ieq+1 Area_q(i,j) = (Area_h(i,j) + Area_h(i+1,j+1)) + & diff --git a/src/core/MOM_open_boundary.F90 b/src/core/MOM_open_boundary.F90 index 9f06838d4d..153b901a42 100644 --- a/src/core/MOM_open_boundary.F90 +++ b/src/core/MOM_open_boundary.F90 @@ -1116,7 +1116,7 @@ end subroutine open_boundary_impose_normal_slope !! Also adjust u- and v-point cell area on specified open boundaries. subroutine open_boundary_impose_land_mask(OBC, G, areaCu, areaCv) type(ocean_OBC_type), pointer :: OBC !< Open boundary control structure - type(dyn_horgrid_type), intent(in) :: G !< Ocean grid structure + type(dyn_horgrid_type), intent(inout) :: G !< Ocean grid structure real, dimension(SZIB_(G),SZJ_(G)), intent(inout) :: areaCu !< Area of a u-cell (m2) real, dimension(SZI_(G),SZJB_(G)), intent(inout) :: areaCv !< Area of a u-cell (m2) ! Local variables @@ -1134,12 +1134,22 @@ subroutine open_boundary_impose_land_mask(OBC, G, areaCu, areaCv) I=segment%HI%IsdB do j=segment%HI%jsd,segment%HI%jed if (G%mask2dCu(I,j) == 0) OBC%segnum_u(I,j) = OBC_NONE + if (segment%direction == OBC_DIRECTION_W) then + G%mask2dT(i,j) = 0 + else + G%mask2dT(i+1,j) = 0 + endif enddo else ! Sweep along v-segments and delete the OBC for blocked points. J=segment%HI%JsdB do i=segment%HI%isd,segment%HI%ied if (G%mask2dCv(i,J) == 0) OBC%segnum_v(i,J) = OBC_NONE + if (segment%direction == OBC_DIRECTION_S) then + G%mask2dT(i,j) = 0 + else + G%mask2dT(i,j+1) = 0 + endif enddo endif enddo @@ -1633,32 +1643,32 @@ subroutine set_tracer_data(OBC, tv, h, G, PF, tracer_Reg) enddo endif - do n=1,OBC%number_of_segments - segment => OBC%segment(n) - if (.not. segment%on_pe) cycle - - if (segment%direction == OBC_DIRECTION_E) then - I=segment%HI%IsdB - do k=1,G%ke ; do j=segment%HI%jsd,segment%HI%jed - h(i+1,j,k) = h(i,j,k) - enddo; enddo - elseif (segment%direction == OBC_DIRECTION_W) then - I=segment%HI%IsdB - do k=1,G%ke ; do j=segment%HI%jsd,segment%HI%jed - h(i,j,k) = h(i+1,j,k) - enddo; enddo - elseif (segment%direction == OBC_DIRECTION_N) then - J=segment%HI%JsdB - do k=1,G%ke ; do i=segment%HI%isd,segment%HI%ied - h(i,j+1,k) = h(i,j,k) - enddo; enddo - elseif (segment%direction == OBC_DIRECTION_S) then - J=segment%HI%JsdB - do k=1,G%ke ; do i=segment%HI%isd,segment%HI%ied - h(i,j,k) = h(i,j+1,k) - enddo; enddo - endif - enddo +! do n=1,OBC%number_of_segments +! segment => OBC%segment(n) +! if (.not. segment%on_pe) cycle + +! if (segment%direction == OBC_DIRECTION_E) then +! I=segment%HI%IsdB +! do k=1,G%ke ; do j=segment%HI%jsd,segment%HI%jed +! h(i+1,j,k) = h(i,j,k) +! enddo; enddo +! elseif (segment%direction == OBC_DIRECTION_W) then +! I=segment%HI%IsdB +! do k=1,G%ke ; do j=segment%HI%jsd,segment%HI%jed +! h(i,j,k) = h(i+1,j,k) +! enddo; enddo +! elseif (segment%direction == OBC_DIRECTION_N) then +! J=segment%HI%JsdB +! do k=1,G%ke ; do i=segment%HI%isd,segment%HI%ied +! h(i,j+1,k) = h(i,j,k) +! enddo; enddo +! elseif (segment%direction == OBC_DIRECTION_S) then +! J=segment%HI%JsdB +! do k=1,G%ke ; do i=segment%HI%isd,segment%HI%ied +! h(i,j,k) = h(i,j+1,k) +! enddo; enddo +! endif +! enddo end subroutine set_tracer_data diff --git a/src/initialization/MOM_state_initialization.F90 b/src/initialization/MOM_state_initialization.F90 index 3d77e1a0c4..696f612e28 100644 --- a/src/initialization/MOM_state_initialization.F90 +++ b/src/initialization/MOM_state_initialization.F90 @@ -1629,9 +1629,10 @@ subroutine initialize_sponges_file(G, GV, use_temperature, tv, param_file, CSp, type(param_file_type), intent(in) :: param_file !< A structure to parse for run-time parameters. type(sponge_CS), pointer :: CSp !< A pointer that is set to point to the control !! structure for this module (in layered mode). - type(ALE_sponge_CS), pointer :: ALE_CSp !< A pointer that is set to point to the control - !! structure for this module (in ALE mode). - type(time_type), intent(in) :: Time + type(ALE_sponge_CS), pointer :: ALE_CSp !< A pointer that is set to point to the control + !! structure for this module (in ALE mode). + type(time_type), intent(in) :: Time !< Time at the start of the run segment. Time_in + !! overrides any value set for Time. ! Local variables real, allocatable, dimension(:,:,:) :: eta ! The target interface heights, in m. diff --git a/src/tracer/MOM_generic_tracer.F90 b/src/tracer/MOM_generic_tracer.F90 index 891f29dbbd..d905f3f307 100644 --- a/src/tracer/MOM_generic_tracer.F90 +++ b/src/tracer/MOM_generic_tracer.F90 @@ -2,18 +2,6 @@ module MOM_generic_tracer ! This file is part of MOM6. See LICENSE.md for the license. -!---------------------------------------------------------------- -! Niki Zadeh -! -! -! William Cooke -! -! -! -! This module drives the generic version of tracers TOPAZ and CFC -! -!---------------------------------------------------------------- - #include #ifdef _USE_GENERIC_TRACER @@ -99,41 +87,20 @@ module MOM_generic_tracer contains - ! - ! - ! Initialize phase I: Add the generic tracers - ! - ! - ! This subroutine: - ! Initializes the generic tracer packages and adds their tracers to the list - ! Adds the tracers in the list of generic tracers to the set of MOM tracers (i.e., MOM-register them) - ! Register these tracers for restart - ! - ! - ! - + !> Initializes the generic tracer packages and adds their tracers to the list + !! Adds the tracers in the list of generic tracers to the set of MOM tracers (i.e., MOM-register them) + !! Register these tracers for restart function register_MOM_generic_tracer(HI, GV, param_file, CS, tr_Reg, restart_CS) - type(hor_index_type), intent(in) :: HI - type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure + type(hor_index_type), intent(in) :: HI !< Horizontal index ranges + type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure type(param_file_type), intent(in) :: param_file !< A structure to parse for run-time parameters - type(MOM_generic_tracer_CS), pointer :: CS - type(tracer_registry_type), pointer :: tr_Reg - type(MOM_restart_CS), pointer :: restart_CS - ! This subroutine is used to register tracer fields and subroutines - ! to be used with MOM. - ! Arguments: G - The ocean's grid structure. - ! (in) param_file - A structure indicating the open file to parse for - ! model parameter values. - ! (in/out) CS - A pointer that is set to point to the control structure - ! for this module - ! (in) diag - A structure that is used to regulate diagnostic output. - ! (in/out) tr_Reg - A pointer that is set to point to the control structure - ! for the tracer advection and diffusion module. - ! (in) restart_CS - A pointer to the restart control structure. - logical :: register_MOM_generic_tracer + type(MOM_generic_tracer_CS), pointer :: CS !< Pointer to the control structure for this module + type(tracer_registry_type), pointer :: tr_Reg !< Pointer to the control structure for the tracer + !! advection and diffusion module. + type(MOM_restart_CS), pointer :: restart_CS !< Pointer to the restart control structure. +! Local variables + logical :: register_MOM_generic_tracer character(len=fm_string_len), parameter :: sub_name = 'register_MOM_generic_tracer' character(len=200) :: inputdir ! The directory where NetCDF input files are. @@ -254,53 +221,33 @@ function register_MOM_generic_tracer(HI, GV, param_file, CS, tr_Reg, restart_CS) register_MOM_generic_tracer = .true. end function register_MOM_generic_tracer - ! - ! - ! Initialize phase II: Initialize required variables for generic tracers - ! - ! - ! There are some steps of initialization that cannot be done in register_MOM_generic_tracer - ! This is the place and time to do them: - ! Set the grid mask and initial time for all generic tracers. - ! Diag_register them. - ! Z_diag_register them. - ! - !