Skip to content

Commit 032488f

Browse files
committed
Inline Harmonic Analysis
Update 5: MOM_harmonic_analysis is now independent of MOM_tidal_forcing, providing more flexibility for performing harmonic analyses on tidal constituents not available in MOM_tidal_forcing (e.g., MK3, M4).
1 parent d2a33ee commit 032488f

File tree

6 files changed

+122
-63
lines changed

6 files changed

+122
-63
lines changed

src/core/MOM.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ subroutine step_MOM(forces_in, fluxes_in, sfc_state, Time_start, time_int_in, CS
10641064
ssh(i,j) = CS%ssh_rint(i,j)*I_wt_ssh
10651065
CS%ave_ssh_ibc(i,j) = ssh(i,j)
10661066
enddo ; enddo
1067-
if (associated(CS%HA_CSp)) call HA_accum('ssh', ssh, Time_local, G, CS%HA_CSp)
1067+
if (associated(CS%HA_CSp)) call HA_accum('ssh', ssh, Time_local, CS%HA_CSp)
10681068
if (do_dyn) then
10691069
call adjust_ssh_for_p_atm(CS%tv, G, GV, US, CS%ave_ssh_ibc, forces%p_surf_SSH, &
10701070
CS%calc_rho_for_sea_lev)

src/core/MOM_barotropic.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,8 +1935,8 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
19351935
! Accumulator is updated at the end of every baroclinic time step.
19361936
! Harmonic analysis will not be performed of a field that is not registered.
19371937
if (associated(CS%HA_CSp) .and. find_etaav) then
1938-
call HA_accum('ubt', ubt, CS%Time, G, CS%HA_CSp)
1939-
call HA_accum('vbt', vbt, CS%Time, G, CS%HA_CSp)
1938+
call HA_accum('ubt', ubt, CS%Time, CS%HA_CSp)
1939+
call HA_accum('vbt', vbt, CS%Time, CS%HA_CSp)
19401940
endif
19411941

19421942
if (id_clock_calc_post > 0) call cpu_clock_end(id_clock_calc_post)

src/core/MOM_dynamics_split_RK2.F90

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ module MOM_dynamics_split_RK2
5050
use MOM_debugging, only : check_redundant
5151
use MOM_energetic_PBL, only : energetic_PBL_get_MLD, energetic_PBL_CS
5252
use MOM_grid, only : ocean_grid_type
53-
use MOM_harmonic_analysis, only : harmonic_analysis_CS
53+
use MOM_harmonic_analysis, only : HA_init, harmonic_analysis_CS
5454
use MOM_hor_index, only : hor_index_type
5555
use MOM_hor_visc, only : horizontal_viscosity, hor_visc_CS, hor_visc_vel_stencil
5656
use MOM_hor_visc, only : hor_visc_init, hor_visc_end
@@ -1415,6 +1415,7 @@ subroutine initialize_dyn_split_RK2(u, v, h, tv, uh, vh, eta, Time, G, GV, US, p
14151415

14161416
integer :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz
14171417
integer :: IsdB, IedB, JsdB, JedB
1418+
integer :: nc ! Number of tidal constituents to be harmonically analyzed
14181419
is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec ; nz = GV%ke
14191420
isd = G%isd ; ied = G%ied ; jsd = G%jsd ; jed = G%jed
14201421
IsdB = G%IsdB ; IedB = G%IedB ; JsdB = G%JsdB ; JedB = G%JedB
@@ -1437,6 +1438,10 @@ subroutine initialize_dyn_split_RK2(u, v, h, tv, uh, vh, eta, Time, G, GV, US, p
14371438
"If true, calculate self-attraction and loading.", default=CS%use_tides)
14381439
call get_param(param_file, mdl, "USE_HA", CS%use_HA, &
14391440
"If true, perform inline harmonic analysis.", default=.false.)
1441+
call get_param(param_file, mdl, "HA_N_CONST", nc, &
1442+
"Number of tidal constituents to be harmonically analyzed.", &
1443+
default=0, do_not_log=.not.CS%use_HA)
1444+
if (nc<=0) CS%use_HA = .false.
14401445
call get_param(param_file, mdl, "BE", CS%be, &
14411446
"If SPLIT is true, BE determines the relative weighting "//&
14421447
"of a 2nd-order Runga-Kutta baroclinic time stepping "//&
@@ -1566,14 +1571,10 @@ subroutine initialize_dyn_split_RK2(u, v, h, tv, uh, vh, eta, Time, G, GV, US, p
15661571
cont_stencil = continuity_stencil(CS%continuity_CSp)
15671572
call CoriolisAdv_init(Time, G, GV, US, param_file, diag, CS%ADp, CS%CoriolisAdv)
15681573
if (CS%calculate_SAL) call SAL_init(h, tv, G, GV, US, param_file, CS%SAL_CSp, restart_CS)
1569-
if (CS%use_tides) then
1570-
if (CS%use_HA) then
1571-
call tidal_forcing_init(Time, G, US, param_file, CS%tides_CSp, CS%HA_CSp)
1572-
HA_CSp => CS%HA_CSp
1573-
else
1574-
call tidal_forcing_init(Time, G, US, param_file, CS%tides_CSp)
1575-
HA_CSp => NULL()
1576-
endif
1574+
if (CS%use_tides) call tidal_forcing_init(Time, G, US, param_file, CS%tides_CSp)
1575+
if (CS%use_HA) then
1576+
call HA_init(Time, G, US, param_file, nc, CS%HA_CSp)
1577+
HA_CSp => CS%HA_CSp
15771578
else
15781579
HA_CSp => NULL()
15791580
endif

src/core/MOM_dynamics_split_RK2b.F90

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module MOM_dynamics_split_RK2b
4949
use MOM_CoriolisAdv, only : CoriolisAdv_init, CoriolisAdv_end
5050
use MOM_debugging, only : check_redundant
5151
use MOM_grid, only : ocean_grid_type
52-
use MOM_harmonic_analysis, only : harmonic_analysis_CS
52+
use MOM_harmonic_analysis, only : HA_init, harmonic_analysis_CS
5353
use MOM_hor_index, only : hor_index_type
5454
use MOM_hor_visc, only : horizontal_viscosity, hor_visc_CS
5555
use MOM_hor_visc, only : hor_visc_init, hor_visc_end
@@ -1315,6 +1315,7 @@ subroutine initialize_dyn_split_RK2b(u, v, h, tv, uh, vh, eta, Time, G, GV, US,
13151315

13161316
integer :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz
13171317
integer :: IsdB, IedB, JsdB, JedB
1318+
integer :: nc ! Number of tidal constituents to be harmonically analyzed
13181319
is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec ; nz = GV%ke
13191320
isd = G%isd ; ied = G%ied ; jsd = G%jsd ; jed = G%jed
13201321
IsdB = G%IsdB ; IedB = G%IedB ; JsdB = G%JsdB ; JedB = G%JedB
@@ -1337,6 +1338,10 @@ subroutine initialize_dyn_split_RK2b(u, v, h, tv, uh, vh, eta, Time, G, GV, US,
13371338
"If true, calculate self-attraction and loading.", default=CS%use_tides)
13381339
call get_param(param_file, mdl, "USE_HA", CS%use_HA, &
13391340
"If true, perform inline harmonic analysis.", default=.false.)
1341+
call get_param(param_file, mdl, "HA_N_CONST", nc, &
1342+
"Number of tidal constituents to be harmonically analyzed.", &
1343+
default=0, do_not_log=.not.CS%use_HA)
1344+
if (nc<=0) CS%use_HA = .false.
13401345
call get_param(param_file, mdl, "BE", CS%be, &
13411346
"If SPLIT is true, BE determines the relative weighting "//&
13421347
"of a 2nd-order Runga-Kutta baroclinic time stepping "//&
@@ -1449,14 +1454,10 @@ subroutine initialize_dyn_split_RK2b(u, v, h, tv, uh, vh, eta, Time, G, GV, US,
14491454
cont_stencil = continuity_stencil(CS%continuity_CSp)
14501455
call CoriolisAdv_init(Time, G, GV, US, param_file, diag, CS%ADp, CS%CoriolisAdv)
14511456
if (CS%calculate_SAL) call SAL_init(h, tv, G, GV, US, param_file, CS%SAL_CSp, restart_CS)
1452-
if (CS%use_tides) then
1453-
if (CS%use_HA) then
1454-
call tidal_forcing_init(Time, G, US, param_file, CS%tides_CSp, CS%HA_CSp)
1455-
HA_CSp => CS%HA_CSp
1456-
else
1457-
call tidal_forcing_init(Time, G, US, param_file, CS%tides_CSp)
1458-
HA_CSp => NULL()
1459-
endif
1457+
if (CS%use_tides) call tidal_forcing_init(Time, G, US, param_file, CS%tides_CSp)
1458+
if (CS%use_HA) then
1459+
call HA_init(Time, G, US, param_file, nc, CS%HA_CSp)
1460+
HA_CSp => CS%HA_CSp
14601461
else
14611462
HA_CSp => NULL()
14621463
endif

0 commit comments

Comments
 (0)