Skip to content

Commit

Permalink
Merge pull request #16 from adcroft/ncar-cherry-picked-fixes
Browse files Browse the repository at this point in the history
Cherry picked fixes from dev/gfdl
  • Loading branch information
gustavo-marques authored Jul 28, 2017
2 parents f42c970 + be46fee commit 17d4586
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
37 changes: 35 additions & 2 deletions src/initialization/MOM_coord_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ subroutine MOM_initialize_coord(GV, PF, write_geom, output_dir, tv, max_depth)
! Set-up the layer densities, GV%Rlay, and reduced gravities, GV%g_prime.
call get_param(PF, mod, "COORD_CONFIG", config, &
"This specifies how layers are to be defined: \n"//&
" \t ALE or none - used to avoid defining layers in ALE mode \n"//&
" \t file - read coordinate information from the file \n"//&
" \t\t specified by (COORD_FILE).\n"//&
" \t BFB - Custom coords for buoyancy-forced basin case \n"//&
Expand Down Expand Up @@ -93,7 +94,8 @@ subroutine MOM_initialize_coord(GV, PF, write_geom, output_dir, tv, max_depth)
call user_set_coord(GV%Rlay, GV%g_prime, GV, PF, eos)
case ("BFB")
call BFB_set_coord(GV%Rlay, GV%g_prime, GV, PF, eos)
case ("none")
case ("none", "ALE")
call set_coord_to_none(GV%Rlay, GV%g_prime, GV, PF)
case default ; call MOM_error(FATAL,"MOM_initialize_coord: "// &
"Unrecognized coordinate setup"//trim(config))
end select
Expand Down Expand Up @@ -493,7 +495,38 @@ subroutine set_coord_linear(Rlay, g_prime, GV, param_file)
call callTree_leave(trim(mod)//'()')
end subroutine set_coord_linear

! -----------------------------------------------------------------------------
!> Sets Rlay to Rho0 and g_prime to zero except for the free surface.
!! This is for use only in ALE mode where Rlay should not be used and g_prime(1) alone
!! might be used.
subroutine set_coord_to_none(Rlay, g_prime, GV, param_file)
real, dimension(:), intent(out) :: Rlay !< The layers' target coordinate values
!! (potential density).
real, dimension(:), intent(out) :: g_prime !< A structure indicating the open file to
!! parse for model parameter values.
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
real :: g_fs ! Reduced gravity across the free surface, in m s-2.
character(len=40) :: mdl = "set_coord_to_none" ! This subroutine's name.
integer :: k, nz
nz = GV%ke

call callTree_enter(trim(mdl)//"(), MOM_coord_initialization.F90")

call get_param(param_file, mdl, "GFS" , g_fs, &
"The reduced gravity at the free surface.", units="m s-2", &
default=GV%g_Earth)

g_prime(1) = g_fs
do k=2,nz ; g_prime(k) = 0. ; enddo
Rlay(1) = GV%Rho0
do k=2,nz ; Rlay(k) = Rlay(k-1) + g_prime(k)*(GV%Rho0/GV%g_Earth) ; enddo

call callTree_leave(trim(mdl)//'()')

end subroutine set_coord_to_none

!> This subroutine writes out a file containing any available data related
!! to the vertical grid used by the MOM ocean model.
subroutine write_vertgrid_file(GV, param_file, directory)
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
Expand Down
4 changes: 2 additions & 2 deletions src/parameterizations/lateral/MOM_hor_visc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ subroutine horizontal_viscosity(u, v, h, diffu, diffv, MEKE, VarMix, G, GV, CS,
v0(i,J) = CS%IDXDY2v(i,J)*(CS%DY2q(I,J)*sh_xy(I,J) - CS%DY2q(I-1,J)*sh_xy(I-1,J)) - &
CS%IDX2dyCv(i,J)*(CS%DX2h(i,j+1)*sh_xx(i,j+1) - CS%DX2h(i,j)*sh_xx(i,j))
enddo ; enddo
if (apply_OBC .and. OBC%zero_biharmonic) then
if (apply_OBC) then; if (OBC%zero_biharmonic) then
do n=1,OBC%number_of_segments
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
Expand All @@ -542,7 +542,7 @@ subroutine horizontal_viscosity(u, v, h, diffu, diffv, MEKE, VarMix, G, GV, CS,
enddo
endif
enddo
endif
endif; endif
endif

do j=Jsq,Jeq+1 ; do i=Isq,Ieq+1
Expand Down

0 comments on commit 17d4586

Please sign in to comment.