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

Update MOM_diabatic_driver.F90 #11

Closed
Closed
Changes from all commits
Commits
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
44 changes: 23 additions & 21 deletions src/parameterizations/vertical/MOM_diabatic_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -453,31 +453,33 @@ subroutine diabatic(u, v, h, tv, Hml, fluxes, visc, ADp, CDp, dt, Time_end, &
! perturb diabatic tendencies.
! These stochastic perturbations do not conserve heat, salt or mass.
do k=1,nz; do j=js,je; do i=is,ie
h(i,j,k) = max(h_in(i,j,k) + (h(i,j,k)-h_in(i,j,k)) * stoch_CS%sppt_wts(i,j), GV%Angstrom_H)
tv%S(i,j,k) = max(s_in(i,j,k) + (tv%S(i,j,k)-s_in(i,j,k)) * stoch_CS%sppt_wts(i,j), 0.0)
h(i,j,k) = max(h_in(i,j,k) + (h(i,j,k)-h_in(i,j,k)) * stoch_CS%sppt_wts(i,j), GV%Angstrom_H)
tv%S(i,j,k) = max(s_in(i,j,k) + (tv%S(i,j,k)-s_in(i,j,k)) * stoch_CS%sppt_wts(i,j), 0.0)
enddo; enddo; enddo
! now that we have updated thickness and salinity, calculate freeing point
H_to_RL2_T2 = GV%H_to_RZ * GV%g_Earth
do j=js,je
ps(:) = 0.0
if (associated(fluxes%p_surf)) then ; do i=is,ie
ps(i) = fluxes%p_surf(i,j)
enddo ; endif

do i=is,ie
pressure(i,1) = ps(i) + (0.5*H_to_RL2_T2)*h(i,j,1)
enddo
do k=2,nz ; do i=is,ie
pressure(i,k) = pressure(i,k-1) + &
(0.5*H_to_RL2_T2) * (h(i,j,k) + h(i,j,k-1))
enddo ; enddo
do k=1,nz
call calculate_TFreeze(tv%S(is:ie,j,k), pressure(is:ie,k), T_freeze(is:ie), &
tv%eqn_of_state)
do i=is,ie
tv%T(i,j,k) = max(t_in(i,j,k) + (tv%T(i,j,k)-t_in(i,j,k)) * stoch_CS%sppt_wts(i,j), T_freeze(i))
enddo
enddo
ps(:) = 0.0
if (associated(fluxes%p_surf)) then
do i=is,ie
ps(i) = fluxes%p_surf(i,j)
enddo
endif

do i=is,ie
pressure(i,1) = ps(i) + (0.5*H_to_RL2_T2)*h(i,j,1)
enddo
do k=2,nz ; do i=is,ie
pressure(i,k) = pressure(i,k-1) + &
(0.5*H_to_RL2_T2) * (h(i,j,k) + h(i,j,k-1))
enddo ; enddo
do k=1,nz
call calculate_TFreeze(tv%S(is:ie,j,k), pressure(is:ie,k), T_freeze(is:ie), &
tv%eqn_of_state)
do i=is,ie
tv%T(i,j,k) = max(t_in(i,j,k) + (tv%T(i,j,k)-t_in(i,j,k)) * stoch_CS%sppt_wts(i,j), T_freeze(i))
enddo
enddo
enddo

deallocate(h_in, t_in, s_in)
Expand Down