@@ -45,6 +45,9 @@ module Kelvin_initialization
45
45
real :: wave_period ! < Period of the mode-0 waves [T ~> s]
46
46
real :: ssh_amp ! < Amplitude of the sea surface height forcing for mode-0 waves [Z ~> m]
47
47
real :: inflow_amp ! < Amplitude of the boundary velocity forcing for internal waves [L T-1 ~> m s-1]
48
+ real :: OBC_nudging_time ! < The timescale with which the inflowing open boundary velocities are nudged toward
49
+ ! ! their intended values with the Kelvin wave test case [T ~> s], or a negative
50
+ ! ! value to retain the value that is set when the OBC segments are initialized.
48
51
end type Kelvin_OBC_CS
49
52
50
53
! This include declares and sets the variable "version".
@@ -114,10 +117,21 @@ function register_Kelvin_OBC(param_file, CS, US, OBC_Reg)
114
117
" at the open boundaries." , units= " m s-1" , default= 1.0 , scale= US% m_s_to_L_T)
115
118
endif
116
119
120
+ call get_param(param_file, mdl, " KELVIN_WAVE_VEL_NUDGING_TIMESCALE" , CS% OBC_nudging_time, &
121
+ " The timescale with which the inflowing open boundary velocities are nudged toward " // &
122
+ " their intended values with the Kelvin wave test case, or a negative value to keep " // &
123
+ " the value that is set when the OBC segments are initialized." , &
124
+ units= " s" , default= 1.0 / (0.3 * 86400 .), scale= US% s_to_T)
125
+ ! ### Change the default nudging timescale to -1. or another value?
126
+
117
127
! Register the Kelvin open boundary.
118
128
call register_OBC(casename, param_file, OBC_Reg)
119
129
register_Kelvin_OBC = .true.
120
130
131
+ if (CS% mode > 0 ) call MOM_error(WARNING, &
132
+ " register_Kelvin_OBC: The Kelvin_initialization code is not yet working properly unless KELVIN_WAVE_MODE = 0." )
133
+ ! TODO: Revisit and correct the internal Kelvin wave test case.
134
+
121
135
end function register_Kelvin_OBC
122
136
123
137
! > Clean up the Kelvin wave OBC from registry.
@@ -193,7 +207,7 @@ subroutine Kelvin_set_OBC_data(OBC, CS, G, GV, US, h, Time)
193
207
real :: time_sec ! The time in the run [T ~> s]
194
208
real :: cff ! The wave speed [L T-1 ~> m s-1]
195
209
real :: N0 ! Brunt-Vaisala frequency times a rescaling of slopes [L Z-1 T-1 ~> s-1]
196
- real :: lambda ! Offshore decay scale [L-1 ~> m-1]
210
+ real :: lambda ! Offshore decay scale, i.e. the inverse of the deformation radius of a mode [L-1 ~> m-1]
197
211
real :: omega ! Wave frequency [T-1 ~> s-1]
198
212
real :: PI ! The ratio of the circumference of a circle to its diameter [nondim]
199
213
real :: depth_tot(SZI_(G),SZJ_(G)) ! The total depth of the ocean [Z ~> m]
@@ -233,13 +247,17 @@ subroutine Kelvin_set_OBC_data(OBC, CS, G, GV, US, h, Time)
233
247
omega = 2.0 * PI / CS% wave_period
234
248
val1 = sin (omega * time_sec)
235
249
else
250
+ ! This is supposed to be a linear internal Kelvin wave case, so I do not understand the purpose
251
+ ! of the squared velocity here. -RWH
236
252
mag_int = CS% inflow_amp** 2
237
253
N0 = sqrt ((CS% rho_range / CS% rho_0) * (GV% g_Earth / CS% H0))
238
254
lambda = PI * CS% mode * CS% F_0 / (CS% H0 * N0)
239
255
! Two wavelengths in domain
240
- omega = (4.0 * CS% H0 * N0) / (CS% mode * US% m_to_L* G% len_lon)
241
- ! ### There is a bug here when len_lon is in km. This should be
242
- ! omega = (4.0 * CS%H0 * N0) / (CS%mode * G%grid_unit_to_L*G%len_lon)
256
+ ! The reason for the factor of 0.001 is unclear, but it is needed to recreate the previous answers. -RWH
257
+ omega = (4.0 * CS% H0 * N0) / (CS% mode * (0.001 * G% grid_unit_to_L)* G% len_lon)
258
+ ! If the modal wave speed were calculated via wave_speeds(), we should have
259
+ ! lambda = CS%F_0 / CS%cg_mode
260
+ ! omega = (4.0 * PI / (G%grid_unit_to_L*G%len_lon)) * CS%cg_mode
243
261
endif
244
262
245
263
sina = sin (CS% coast_angle)
@@ -251,9 +269,9 @@ subroutine Kelvin_set_OBC_data(OBC, CS, G, GV, US, h, Time)
251
269
if (segment% direction == OBC_DIRECTION_E) cycle
252
270
if (segment% direction == OBC_DIRECTION_N) cycle
253
271
254
- ! This should be somewhere else...
255
- ! ### This is supposed to be a timescale [T ~> s] but appears to be a rate in [s-1] .
256
- segment % Velocity_nudging_timescale_in = US % s_to_T * 1.0 / ( 0.3 * 86400 )
272
+ ! If OBC_nudging_time is negative, the value of Velocity_nudging_timescale_in that was set
273
+ ! when the segments are initialized is retained .
274
+ if (CS % OBC_nudging_time > = 0.0 ) segment % Velocity_nudging_timescale_in = CS % OBC_nudging_time
257
275
258
276
if (segment% direction == OBC_DIRECTION_W) then
259
277
IsdB = segment% HI% IsdB ; IedB = segment% HI% IedB
@@ -281,11 +299,22 @@ subroutine Kelvin_set_OBC_data(OBC, CS, G, GV, US, h, Time)
281
299
enddo
282
300
endif
283
301
else
284
- ! Baroclinic, not rotated yet
302
+ ! Baroclinic, not rotated yet (and apparently not working as intended yet).
285
303
segment% SSH(I,j) = 0.0
286
304
segment% normal_vel_bt(I,j) = 0.0
305
+ ! I suspect that the velocities in both of the following loops should instead be
306
+ ! normal_vel(I,j,k) = CS%inflow_amp * CS%u_struct(k) * exp(-lambda * y) * cos(omega * time_sec)
307
+ ! In addition, there should be a specification of the interface-height anomalies at the
308
+ ! open boundaries that are specified as something like
309
+ ! eta_anom(I,j,K) = (CS%inflow_amp*depth_tot/CS%cg_mode) * CS%w_struct(K) * &
310
+ ! exp(-lambda * y) * cos(omega * time_sec)
311
+ ! In these expressions CS%u_struct and CS%w_struct could be returned from the subroutine wave_speeds
312
+ ! in MOM_wave_speed() based on the horizontally uniform initial state.
287
313
if (segment% nudged) then
288
314
do k= 1 ,nz
315
+ ! Note that mag_int is the square of the specified inflow amplitude, in [L2 T-2 ~> m2 s-2].
316
+ ! The following expression is dimensionally correct, but I do not understand why the
317
+ ! normal velocities should scale with the square of their amplitude. -RWH
289
318
segment% nudged_normal_vel(I,j,k) = mag_int * lambda / CS% F_0 * &
290
319
exp (- lambda * y) * cos (PI * CS% mode * (k - 0.5 ) / nz) * &
291
320
cos (omega * time_sec)
@@ -339,7 +368,7 @@ subroutine Kelvin_set_OBC_data(OBC, CS, G, GV, US, h, Time)
339
368
enddo
340
369
endif
341
370
else
342
- ! Not rotated yet
371
+ ! Not rotated yet (also see the notes above on how this case might be improved)
343
372
segment% SSH(i,J) = 0.0
344
373
segment% normal_vel_bt(i,J) = 0.0
345
374
if (segment% nudged) then
0 commit comments