Skip to content

Commit

Permalink
Merge pull request mom-ocean#14 from jskenigson/stoch_eos_ncar_fix_diag
Browse files Browse the repository at this point in the history
Don't register stanley diagnostics if scheme is off
  • Loading branch information
jskenigson authored Jul 6, 2021
2 parents d3f1c15 + f33e34b commit 810efe3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
14 changes: 4 additions & 10 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ module MOM
integer :: id_u = -1, id_v = -1, id_h = -1
!>@}
!> 2-d state field diagnotic ID
integer :: id_ssh_inst = -1, id_stoch_eos = -1, id_stoch_phi = -1, id_tvar_sgs=-1
integer :: id_ssh_inst = -1
end type MOM_diag_IDs

!> Control structure for the MOM module, including the variables that describe
Expand Down Expand Up @@ -1151,9 +1151,9 @@ subroutine step_MOM_dynamics(forces, p_surf_begin, p_surf_end, dt, dt_thermo, &
if (IDs%id_u > 0) call post_data(IDs%id_u, u, CS%diag)
if (IDs%id_v > 0) call post_data(IDs%id_v, v, CS%diag)
if (IDs%id_h > 0) call post_data(IDs%id_h, h, CS%diag)
if (IDs%id_stoch_eos > 0) call post_data(IDs%id_stoch_eos, CS%stoch_eos_CS%pattern, CS%diag)!, mask=G%mask2dT)
if (IDs%id_stoch_phi > 0) call post_data(IDs%id_stoch_phi, CS%stoch_eos_CS%phi, CS%diag)!, mask=G%mask2dT)
if (IDs%id_tvar_sgs > 0) call post_data(IDs%id_tvar_sgs, CS%tv%varT, CS%diag)!, mask=G%mask2dT)
if (CS%stoch_eos_CS%id_stoch_eos > 0) call post_data(CS%stoch_eos_CS%id_stoch_eos, CS%stoch_eos_CS%pattern, CS%diag)
if (CS%stoch_eos_CS%id_stoch_phi > 0) call post_data(CS%stoch_eos_CS%id_stoch_phi, CS%stoch_eos_CS%phi, CS%diag)
if (CS%stoch_eos_CS%id_tvar_sgs > 0) call post_data(CS%stoch_eos_CS%id_tvar_sgs, CS%tv%varT, CS%diag)
call disable_averaging(CS%diag)
call cpu_clock_end(id_clock_diagnostics) ; call cpu_clock_end(id_clock_other)

Expand Down Expand Up @@ -2904,12 +2904,6 @@ subroutine register_diags(Time, G, GV, US, IDs, diag)
v_extensive=.true., conversion=H_convert)
IDs%id_ssh_inst = register_diag_field('ocean_model', 'SSH_inst', diag%axesT1, &
Time, 'Instantaneous Sea Surface Height', 'm')
IDs%id_stoch_eos = register_diag_field('ocean_model', 'stoch_eos', diag%axesT1, Time, &
'random pattern for EOS', 'None')
IDs%id_stoch_phi = register_diag_field('ocean_model', 'stoch_phi', diag%axesT1, Time, &
'phi for EOS', 'None')
IDs%id_tvar_sgs = register_diag_field('ocean_model', 'tvar_sgs', diag%axesTL, Time, &
'Parameterized SGS Temperature Variance ', 'None')

end subroutine register_diags

Expand Down
17 changes: 10 additions & 7 deletions src/core/MOM_stoch_eos.F90
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module MOM_stoch_eos
real :: stanley_coeff !< Coefficient correlating the temperature gradient
!and SGS T variance; if <0, turn off scheme in all codes
real :: stanley_a !a in exp(aX) in stochastic coefficient
! integer :: id_stoch_eos = -1, id_stoch_phi = -1
integer :: id_stoch_eos = -1, id_stoch_phi = -1, id_tvar_sgs = -1
end type MOM_stoch_eos_CS


Expand Down Expand Up @@ -96,12 +96,15 @@ subroutine MOM_stoch_eos_init(G,Time,param_file,stoch_eos_CS,restart_CS,diag)
enddo
endif

!stoch_eos_CS%id_stoch_eos = register_diag_field('ocean_model', 'stoch_eos', diag%axesT1, Time, &
! 'random pattern for EOS', 'None')
!stoch_eos_CS%id_stoch_phi = register_diag_field('ocean_model', 'stoch_phi', diag%axesT1, Time, &
! 'phi for EOS', 'None')
!print*,'PJP registered output',stoch_eos_CS%id_stoch_eos,stoch_eos_CS%id_stoch_phi

!register diagnostics
stoch_eos_CS%id_tvar_sgs = register_diag_field('ocean_model', 'tvar_sgs', diag%axesTL, Time, &
'Parameterized SGS Temperature Variance ', 'None')
if (stoch_eos_CS%use_stoch_eos) then
stoch_eos_CS%id_stoch_eos = register_diag_field('ocean_model', 'stoch_eos', diag%axesT1, Time, &
'random pattern for EOS', 'None')
stoch_eos_CS%id_stoch_phi = register_diag_field('ocean_model', 'stoch_phi', diag%axesT1, Time, &
'phi for EOS', 'None')
endif
endif

end subroutine MOM_stoch_eos_init
Expand Down

0 comments on commit 810efe3

Please sign in to comment.