Skip to content

Commit

Permalink
Inline harmonic analysis
Browse files Browse the repository at this point in the history
Set default HAready = False

Also made additional adjustment to ensure harmonic analysis is not
activated if tide is not used in the model.
  • Loading branch information
c2xu authored and marshallward committed Sep 6, 2024
1 parent 1eccd28 commit 91eee52
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/core/MOM_barotropic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4504,9 +4504,6 @@ subroutine barotropic_init(u, v, h, eta, Time, G, GV, US, param_file, diag, CS,
if (present(SAL_CSp)) then
CS%SAL_CSp => SAL_CSp
endif
if (present(HA_CSp)) then
CS%HA_CSp => HA_CSp
endif

! Read all relevant parameters and write them to the model log.
call get_param(param_file, mdl, "SPLIT", CS%split, default=.true., do_not_log=.true.)
Expand Down Expand Up @@ -4639,6 +4636,7 @@ subroutine barotropic_init(u, v, h, eta, Time, G, GV, US, param_file, diag, CS,
default=.not.visc_rem_bug)
call get_param(param_file, mdl, "TIDES", use_tides, &
"If true, apply tidal momentum forcing.", default=.false.)
if (use_tides .and. present(HA_CSp)) CS%HA_CSp => HA_CSp
call get_param(param_file, mdl, "CALCULATE_SAL", CS%calculate_SAL, &
"If true, calculate self-attraction and loading.", default=use_tides)
det_de = 0.0
Expand Down
2 changes: 1 addition & 1 deletion src/core/MOM_dynamics_split_RK2.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,7 @@ subroutine initialize_dyn_split_RK2(u, v, h, tv, uh, vh, eta, Time, G, GV, US, p
do j=js,je ; do i=is,ie ; eta(i,j) = CS%eta(i,j) ; enddo ; enddo

call barotropic_init(u, v, h, CS%eta, Time, G, GV, US, param_file, diag, &
CS%barotropic_CSp, restart_CS, calc_dtbt, CS%BT_cont, CS%SAL_CSp, CS%HA_CSp)
CS%barotropic_CSp, restart_CS, calc_dtbt, CS%BT_cont, CS%SAL_CSp, HA_CSp)

if (.not. query_initialized(CS%diffu, "diffu", restart_CS) .or. &
.not. query_initialized(CS%diffv, "diffv", restart_CS)) then
Expand Down
2 changes: 1 addition & 1 deletion src/core/MOM_dynamics_split_RK2b.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ subroutine initialize_dyn_split_RK2b(u, v, h, tv, uh, vh, eta, Time, G, GV, US,

call barotropic_init(u, v, h, CS%eta, Time, G, GV, US, param_file, diag, &
CS%barotropic_CSp, restart_CS, calc_dtbt, CS%BT_cont, &
CS%SAL_CSp, CS%HA_CSp)
CS%SAL_CSp, HA_CSp)

flux_units = get_flux_units(GV)
thickness_units = get_thickness_units(GV)
Expand Down
4 changes: 3 additions & 1 deletion src/diagnostics/MOM_harmonic_analysis.F90
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module MOM_harmonic_analysis

!> The public control structure of the MOM_harmonic_analysis module
type, public :: harmonic_analysis_CS ; private
logical :: HAready = .true. !< If true, perform harmonic analysis
logical :: HAready = .false. !< If true, perform harmonic analysis
type(time_type) :: &
time_start, & !< Start time of harmonic analysis
time_end, & !< End time of harmonic analysis
Expand Down Expand Up @@ -107,6 +107,8 @@ subroutine HA_init(Time, US, param_file, time_ref, nc, freq, phase0, const_name,
CS%HAready = .false. ; return
endif

CS%HAready = .true.

if (HA_start_time < 0.0) then
HA_start_time = HA_end_time + HA_start_time
if (HA_start_time <= 0.0) HA_start_time = 0.0
Expand Down

0 comments on commit 91eee52

Please sign in to comment.