@@ -26,6 +26,8 @@ module MOM_barotropic
26
26
use MOM_restart, only : query_initialized, MOM_restart_CS
27
27
use MOM_self_attr_load, only : scalar_SAL_sensitivity
28
28
use MOM_self_attr_load, only : SAL_CS
29
+ use MOM_streaming_filter, only : Filt_register, Filt_accum, Filter_CS
30
+ use MOM_tidal_forcing, only : tidal_frequency
29
31
use MOM_time_manager, only : time_type, real_to_time, operator (+ ), operator (- )
30
32
use MOM_unit_scaling, only : unit_scale_type
31
33
use MOM_variables, only : BT_cont_type, alloc_bt_cont_type
@@ -248,6 +250,10 @@ module MOM_barotropic
248
250
logical :: linearized_BT_PV ! < If true, the PV and interface thicknesses used
249
251
! ! in the barotropic Coriolis calculation is time
250
252
! ! invariant and linearized.
253
+ logical :: use_filter_m2 ! < If true, apply streaming band-pass filter for detecting
254
+ ! ! instantaneous tidal signals.
255
+ logical :: use_filter_k1 ! < If true, apply streaming band-pass filter for detecting
256
+ ! ! instantaneous tidal signals.
251
257
logical :: use_wide_halos ! < If true, use wide halos and march in during the
252
258
! ! barotropic time stepping for efficiency.
253
259
logical :: clip_velocity ! < If true, limit any velocity components that are
@@ -291,6 +297,10 @@ module MOM_barotropic
291
297
type (hor_index_type), pointer :: debug_BT_HI = > NULL () ! < debugging copy of horizontal index_type
292
298
type (SAL_CS), pointer :: SAL_CSp = > NULL () ! < Control structure for SAL
293
299
type (harmonic_analysis_CS), pointer :: HA_CSp = > NULL () ! < Control structure for harmonic analysis
300
+ type (Filter_CS) :: Filt_CS_um2, & ! < Control structures for the M2 streaming filter
301
+ Filt_CS_vm2, & ! < Control structures for the M2 streaming filter
302
+ Filt_CS_uk1, & ! < Control structures for the K1 streaming filter
303
+ Filt_CS_vk1 ! < Control structures for the K1 streaming filter
294
304
logical :: module_is_initialized = .false. ! < If true, module has been initialized
295
305
296
306
integer :: isdw ! < The lower i-memory limit for the wide halo arrays.
@@ -598,6 +608,8 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
598
608
DCor_v, & ! An averaged total thickness at v points [H ~> m or kg m-2].
599
609
Datv ! Basin depth at v-velocity grid points times the x-grid
600
610
! spacing [H L ~> m2 or kg m-1].
611
+ real , dimension (:,:), pointer :: um2, uk1, vm2, vk1
612
+ ! M2 and K1 velocities from the output of streaming filters [m s-1]
601
613
real , target , dimension (SZIW_(CS),SZJW_(CS)) :: &
602
614
eta, & ! The barotropic free surface height anomaly or column mass
603
615
! anomaly [H ~> m or kg m-2]
@@ -1586,6 +1598,17 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
1586
1598
endif ; enddo ; enddo
1587
1599
endif
1588
1600
1601
+ ! Here is an example of how the filter equations are time stepped to determine the M2 and K1 velocities.
1602
+ ! The filters are initialized and registered in subroutine barotropic_init.
1603
+ if (CS% use_filter_m2) then
1604
+ call Filt_accum(ubt, um2, CS% Time, US, CS% Filt_CS_um2)
1605
+ call Filt_accum(vbt, vm2, CS% Time, US, CS% Filt_CS_vm2)
1606
+ endif
1607
+ if (CS% use_filter_k1) then
1608
+ call Filt_accum(ubt, uk1, CS% Time, US, CS% Filt_CS_uk1)
1609
+ call Filt_accum(vbt, vk1, CS% Time, US, CS% Filt_CS_vk1)
1610
+ endif
1611
+
1589
1612
! Zero out the arrays for various time-averaged quantities.
1590
1613
if (find_etaav) then
1591
1614
! $OMP do
@@ -5247,6 +5270,8 @@ subroutine register_barotropic_restarts(HI, GV, US, param_file, CS, restart_CS)
5247
5270
type (vardesc) :: vd(3 )
5248
5271
character (len= 40 ) :: mdl = " MOM_barotropic" ! This module's name.
5249
5272
integer :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB
5273
+ real :: am2, ak1 ! < Bandwidth parameters of the M2 and K1 streaming filters [nondim]
5274
+ real :: om2, ok1 ! < Target frequencies of the M2 and K1 streaming filters [T-1 ~> s-1]
5250
5275
5251
5276
isd = HI% isd ; ied = HI% ied ; jsd = HI% jsd ; jed = HI% jed
5252
5277
IsdB = HI% IsdB ; IedB = HI% IedB ; JsdB = HI% JsdB ; JedB = HI% JedB
@@ -5259,6 +5284,33 @@ subroutine register_barotropic_restarts(HI, GV, US, param_file, CS, restart_CS)
5259
5284
" sum(u dh_dt) while also correcting for truncation errors." , &
5260
5285
default= .false. , do_not_log= .true. )
5261
5286
5287
+ call get_param(param_file, mdl, " STREAMING_FILTER_M2" , CS% use_filter_m2, &
5288
+ " If true, turn on streaming band-pass filter for detecting " // &
5289
+ " instantaneous tidal signals." , default= .false. )
5290
+ call get_param(param_file, mdl, " STREAMING_FILTER_K1" , CS% use_filter_k1, &
5291
+ " If true, turn on streaming band-pass filter for detecting " // &
5292
+ " instantaneous tidal signals." , default= .false. )
5293
+ call get_param(param_file, mdl, " FILTER_ALPHA_M2" , am2, &
5294
+ " Bandwidth parameter of the streaming filter targeting the M2 frequency. " // &
5295
+ " Must be positive. To turn off filtering, set FILTER_ALPHA_M2 <= 0.0." , &
5296
+ default= 0.0 , units= " nondim" , do_not_log= .not. CS% use_filter_m2)
5297
+ call get_param(param_file, mdl, " FILTER_ALPHA_K1" , ak1, &
5298
+ " Bandwidth parameter of the streaming filter targeting the K1 frequency. " // &
5299
+ " Must be positive. To turn off filtering, set FILTER_ALPHA_K1 <= 0.0." , &
5300
+ default= 0.0 , units= " nondim" , do_not_log= .not. CS% use_filter_k1)
5301
+ call get_param(param_file, mdl, " TIDE_M2_FREQ" , om2, &
5302
+ " Frequency of the M2 tidal constituent. " // &
5303
+ " This is only used if TIDES and TIDE_M2" // &
5304
+ " are true, or if OBC_TIDE_N_CONSTITUENTS > 0 and M2" // &
5305
+ " is in OBC_TIDE_CONSTITUENTS." , units= " s-1" , default= tidal_frequency(" M2" ), &
5306
+ scale= US% T_to_s, do_not_log= .true. )
5307
+ call get_param(param_file, mdl, " TIDE_K1_FREQ" , ok1, &
5308
+ " Frequency of the K1 tidal constituent. " // &
5309
+ " This is only used if TIDES and TIDE_K1" // &
5310
+ " are true, or if OBC_TIDE_N_CONSTITUENTS > 0 and K1" // &
5311
+ " is in OBC_TIDE_CONSTITUENTS." , units= " s-1" , default= tidal_frequency(" K1" ), &
5312
+ scale= US% T_to_s, do_not_log= .true. )
5313
+
5262
5314
ALLOC_(CS% ubtav(IsdB:IedB,jsd:jed)) ; CS% ubtav(:,:) = 0.0
5263
5315
ALLOC_(CS% vbtav(isd:ied,JsdB:JedB)) ; CS% vbtav(:,:) = 0.0
5264
5316
if (CS% gradual_BT_ICs) then
@@ -5287,6 +5339,24 @@ subroutine register_barotropic_restarts(HI, GV, US, param_file, CS, restart_CS)
5287
5339
call register_restart_field(CS% dtbt, " DTBT" , .false. , restart_CS, &
5288
5340
longname= " Barotropic timestep" , units= " seconds" , conversion= US% T_to_s)
5289
5341
5342
+ ! Initialize and register streaming filters
5343
+ if (CS% use_filter_m2) then
5344
+ if (am2 > 0.0 .and. om2 > 0.0 ) then
5345
+ call Filt_register(am2, om2, ' u' , HI, CS% Filt_CS_um2)
5346
+ call Filt_register(am2, om2, ' v' , HI, CS% Filt_CS_vm2)
5347
+ else
5348
+ CS% use_filter_m2 = .false.
5349
+ endif
5350
+ endif
5351
+ if (CS% use_filter_k1) then
5352
+ if (ak1 > 0.0 .and. ok1 > 0.0 ) then
5353
+ call Filt_register(ak1, ok1, ' u' , HI, CS% Filt_CS_uk1)
5354
+ call Filt_register(ak1, ok1, ' v' , HI, CS% Filt_CS_vk1)
5355
+ else
5356
+ CS% use_filter_k1 = .false.
5357
+ endif
5358
+ endif
5359
+
5290
5360
end subroutine register_barotropic_restarts
5291
5361
5292
5362
! > \namespace mom_barotropic
0 commit comments