Skip to content

Commit

Permalink
clean up of code for MOM6 coding standards
Browse files Browse the repository at this point in the history
  • Loading branch information
pjpegion committed Feb 2, 2021
1 parent 6e3ea1b commit eb88219
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
8 changes: 4 additions & 4 deletions config_src/nuopc_driver/mom_ocean_model_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,10 @@ subroutine ocean_model_init(Ocean_sfc, OS, Time_init, Time_in, gas_fields_ocn, i
return
endif

if (OS%do_sppt) allocate(OS%stochastics%sppt_wts(OS%grid%isd:OS%grid%ied,OS%grid%jsd:OS%grid%jed))
if (OS%do_sppt) allocate(OS%stochastics%sppt_wts(OS%grid%isd:OS%grid%ied, OS%grid%jsd:OS%grid%jed))
if (OS%pert_epbl) then
allocate(OS%stochastics%t_rp1(OS%grid%isd:OS%grid%ied,OS%grid%jsd:OS%grid%jed))
allocate(OS%stochastics%t_rp2(OS%grid%isd:OS%grid%ied,OS%grid%jsd:OS%grid%jed))
allocate(OS%stochastics%t_rp1(OS%grid%isd:OS%grid%ied, OS%grid%jsd:OS%grid%jed))
allocate(OS%stochastics%t_rp2(OS%grid%isd:OS%grid%ied, OS%grid%jsd:OS%grid%jed))
endif
endif
call close_param_file(param_file)
Expand Down Expand Up @@ -632,7 +632,7 @@ subroutine update_ocean_model(Ice_ocean_boundary, OS, Ocean_sfc, &

! update stochastic physics patterns before running next time-step
if (OS%do_sppt .OR. OS%pert_epbl ) then
call run_stochastic_physics_ocn(OS%stochastics%sppt_wts,OS%stochastics%t_rp1,OS%stochastics%t_rp2)
call run_stochastic_physics_ocn(OS%stochastics%sppt_wts, OS%stochastics%t_rp1, OS%stochastics%t_rp2)
endif

if (OS%offline_tracer_mode) then
Expand Down
2 changes: 1 addition & 1 deletion src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ module MOM
use MOM_variables, only : surface, allocate_surface_state, deallocate_surface_state
use MOM_variables, only : thermo_var_ptrs, vertvisc_type
use MOM_variables, only : accel_diag_ptrs, cont_diag_ptrs, ocean_internal_state
use MOM_variables, only : rotate_surface_state,stochastic_pattern
use MOM_variables, only : rotate_surface_state, stochastic_pattern
use MOM_verticalGrid, only : verticalGrid_type, verticalGridInit, verticalGridEnd
use MOM_verticalGrid, only : fix_restart_scaling
use MOM_verticalGrid, only : get_thickness_units, get_flux_units, get_tr_flux_units
Expand Down
27 changes: 14 additions & 13 deletions src/parameterizations/vertical/MOM_diabatic_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,9 @@ subroutine diabatic(u, v, h, tv, Hml, fluxes, visc, ADp, CDp, dt, Time_end, &

! save copy of the date for SPPT
if (CS%do_sppt) then
h_in=h
t_in=tv%T
s_in=tv%S
h_in(:,:,:)=h(:,:,:)
t_in(:,:,:)=tv%T(:,:,:)
s_in(:,:,:)=tv%S(:,:,:)

if (CS%id_sppt_wts > 0) then
call post_data(CS%id_sppt_wts, stochastics%sppt_wts, CS%diag)
Expand Down Expand Up @@ -456,23 +456,24 @@ subroutine diabatic(u, v, h, tv, Hml, fluxes, visc, ADp, CDp, dt, Time_end, &
if (CS%debugConservation) call MOM_state_stats('leaving diabatic', u, v, h, tv%T, tv%S, G, GV, US)

if (CS%do_sppt) then
! perturb diabatic tendecies
do k=1,nz
do j=js,je
do i=is,ie
h_tend = (h(i,j,k)-h_in(i,j,k))*stochastics%sppt_wts(i,j)
t_tend = (tv%T(i,j,k)-t_in(i,j,k))*stochastics%sppt_wts(i,j)
s_tend = (tv%S(i,j,k)-s_in(i,j,k))*stochastics%sppt_wts(i,j)
h_pert=h_tend+h_in(i,j,k)
t_pert=t_tend+t_in(i,j,k)
s_pert=s_tend+s_in(i,j,k)
h_tend = (h(i,j,k) - h_in(i,j,k)) * stochastics%sppt_wts(i,j)
t_tend = (tv%T(i,j,k) - t_in(i,j,k)) * stochastics%sppt_wts(i,j)
s_tend = (tv%S(i,j,k) - s_in(i,j,k)) * stochastics%sppt_wts(i,j)
h_pert = h_tend + h_in(i,j,k)
t_pert = t_tend + t_in(i,j,k)
s_pert = s_tend + s_in(i,j,k)
if (h_pert > GV%Angstrom_H) then
h(i,j,k)=h_pert
h(i,j,k) = h_pert
else
h(i,j,k)=GV%Angstrom_H
h(i,j,k) = GV%Angstrom_H
endif
tv%T(i,j,k)=t_pert
tv%T(i,j,k) = t_pert
if (s_pert > 0.0) then
tv%S(i,j,k)=s_pert
tv%S(i,j,k) = s_pert
endif
enddo
enddo
Expand Down
10 changes: 5 additions & 5 deletions src/parameterizations/vertical/MOM_energetic_PBL.F90
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ module MOM_energetic_PBL
integer :: id_TKE_mech_decay = -1, id_TKE_conv_decay = -1
integer :: id_Mixing_Length = -1, id_Velocity_Scale = -1
integer :: id_MSTAR_mix = -1, id_LA_mod = -1, id_LA = -1, id_MSTAR_LT = -1
integer :: id_t_rp1=-1,id_t_rp2=-1
integer :: id_t_rp1=-1, id_t_rp2=-1
!>@}
end type energetic_PBL_CS

Expand Down Expand Up @@ -539,8 +539,8 @@ subroutine energetic_PBL(h_3d, u_3d, v_3d, tv, fluxes, dt, Kd_int, G, GV, US, CS
! only write random patterns if running with stochastic physics, otherwise the
! array is unallocated and will give an error
if (CS%pert_epbl) then
if (CS%id_t_rp1 > 0) call post_data(CS%id_t_rp1, stochastics%t_rp1, CS%diag)
if (CS%id_t_rp2 > 0) call post_data(CS%id_t_rp2, stochastics%t_rp2, CS%diag)
if (CS%id_t_rp1 > 0) call post_data(CS%id_t_rp1, stochastics%t_rp1, CS%diag)
if (CS%id_t_rp2 > 0) call post_data(CS%id_t_rp2, stochastics%t_rp2, CS%diag)
endif
endif

Expand Down Expand Up @@ -895,7 +895,7 @@ subroutine ePBL_column(h, u, v, T0, S0, dSV_dT, dSV_dS, TKE_forcing, B_flux, abs
mech_TKE = MSTAR_total * (dt*GV%Rho0* u_star**3)
endif
! stochastically pertrub mech_TKE in the UFS
if (CS%pert_epbl) mech_TKE=mech_TKE*stochastics%t_rp1(i,j)
if (CS%pert_epbl) mech_TKE = mech_TKE * stochastics%t_rp1(i,j)

if (CS%TKE_diagnostics) then
eCD%dTKE_conv = 0.0 ; eCD%dTKE_mixing = 0.0
Expand Down Expand Up @@ -978,7 +978,7 @@ subroutine ePBL_column(h, u, v, T0, S0, dSV_dT, dSV_dS, TKE_forcing, B_flux, abs
if (Idecay_len_TKE > 0.0) exp_kh = exp(-h(k-1)*Idecay_len_TKE)
if (CS%TKE_diagnostics) &
eCD%dTKE_mech_decay = eCD%dTKE_mech_decay + (exp_kh-1.0) * mech_TKE * I_dtdiag
if (CS%pert_epbl) then ! perturb the TKE destruction
if (CS%pert_epbl) then ! perturb the TKE dissipation
mech_TKE = mech_TKE * (1+(exp_kh-1) * stochastics%t_rp2(i,j))
else
mech_TKE = mech_TKE * exp_kh
Expand Down

0 comments on commit eb88219

Please sign in to comment.