Initializes the data related to the internal tide input module.
268 type(time_type),
intent(in) :: Time
269 type(ocean_grid_type),
intent(in) :: G
270 type(verticalGrid_type),
intent(in) :: GV
271 type(unit_scale_type),
intent(in) :: US
272 type(param_file_type),
intent(in) :: param_file
273 type(diag_ctrl),
target,
intent(inout) :: diag
274 type(int_tide_input_CS),
pointer :: CS
275 type(int_tide_input_type),
pointer :: itide
279 logical :: read_tideamp
281 #include "version_variable.h"
282 character(len=40) :: mdl =
"MOM_int_tide_input"
283 character(len=20) :: tmpstr
284 character(len=200) :: filename, tideamp_file, h2_file
287 real :: max_frac_rough
291 real :: kappa_h2_factor
293 real :: min_zbot_itides
296 integer :: i, j, is, ie, js, je, isd, ied, jsd, jed
298 if (
associated(cs))
then
299 call mom_error(warning,
"int_tide_input_init called with an associated "// &
300 "control structure.")
303 if (
associated(itide))
then
304 call mom_error(warning,
"int_tide_input_init called with an associated "// &
305 "internal tide input type.")
311 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
312 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
317 call log_version(param_file, mdl, version,
"")
319 call get_param(param_file, mdl,
"INPUTDIR", cs%inputdir, default=
".")
320 cs%inputdir = slasher(cs%inputdir)
322 call get_param(param_file, mdl,
"DEBUG", cs%debug, default=.false., do_not_log=.true.)
324 call get_param(param_file, mdl,
"MIN_ZBOT_ITIDES", min_zbot_itides, &
325 "Turn off internal tidal dissipation when the total "//&
326 "ocean depth is less than this value.", units=
"m", default=0.0, scale=us%m_to_Z)
327 call get_param(param_file, mdl,
"KD_SMOOTH", cs%kappa_fill, &
328 "A diapycnal diffusivity that is used to interpolate "//&
329 "more sensible values of T & S into thin layers.", &
330 default=1.0e-6, scale=us%m2_s_to_Z2_T)
332 call get_param(param_file, mdl,
"UTIDE", utide, &
333 "The constant tidal amplitude used with INT_TIDE_DISSIPATION.", &
334 units=
"m s-1", default=0.0)
336 allocate(itide%Nb(isd:ied,jsd:jed)) ; itide%Nb(:,:) = 0.0
337 allocate(itide%h2(isd:ied,jsd:jed)) ; itide%h2(:,:) = 0.0
338 allocate(itide%TKE_itidal_input(isd:ied,jsd:jed)) ; itide%TKE_itidal_input(:,:) = 0.0
339 allocate(itide%tideamp(isd:ied,jsd:jed)) ; itide%tideamp(:,:) = utide
340 allocate(cs%TKE_itidal_coef(isd:ied,jsd:jed)) ; cs%TKE_itidal_coef(:,:) = 0.0
342 call get_param(param_file, mdl,
"KAPPA_ITIDES", kappa_itides, &
343 "A topographic wavenumber used with INT_TIDE_DISSIPATION. "//&
344 "The default is 2pi/10 km, as in St.Laurent et al. 2002.", &
345 units=
"m-1", default=8.e-4*atan(1.0))
347 call get_param(param_file, mdl,
"KAPPA_H2_FACTOR", kappa_h2_factor, &
348 "A scaling factor for the roughness amplitude with n"//&
349 "INT_TIDE_DISSIPATION.", units=
"nondim", default=1.0)
350 call get_param(param_file, mdl,
"TKE_ITIDE_MAX", cs%TKE_itide_max, &
351 "The maximum internal tide energy source available to mix "//&
352 "above the bottom boundary layer with INT_TIDE_DISSIPATION.", &
353 units=
"W m-2", default=1.0e3)
355 call get_param(param_file, mdl,
"READ_TIDEAMP", read_tideamp, &
356 "If true, read a file (given by TIDEAMP_FILE) containing "//&
357 "the tidal amplitude with INT_TIDE_DISSIPATION.", default=.false.)
358 if (read_tideamp)
then
359 call get_param(param_file, mdl,
"TIDEAMP_FILE", tideamp_file, &
360 "The path to the file containing the spatially varying "//&
361 "tidal amplitudes with INT_TIDE_DISSIPATION.", default=
"tideamp.nc")
362 filename = trim(cs%inputdir) // trim(tideamp_file)
363 call log_param(param_file, mdl,
"INPUTDIR/TIDEAMP_FILE", filename)
364 call mom_read_data(filename,
'tideamp', itide%tideamp, g%domain, timelevel=1)
367 call get_param(param_file, mdl,
"H2_FILE", h2_file, &
368 "The path to the file containing the sub-grid-scale "//&
369 "topographic roughness amplitude with INT_TIDE_DISSIPATION.", &
370 fail_if_missing=.true.)
371 filename = trim(cs%inputdir) // trim(h2_file)
372 call log_param(param_file, mdl,
"INPUTDIR/H2_FILE", filename)
373 call mom_read_data(filename,
'h2', itide%h2, g%domain, timelevel=1, scale=us%m_to_Z**2)
375 call get_param(param_file, mdl,
"FRACTIONAL_ROUGHNESS_MAX", max_frac_rough, &
376 "The maximum topographic roughness amplitude as a fraction of the mean depth, "//&
377 "or a negative value for no limitations on roughness.", &
378 units=
"nondim", default=0.1)
381 call get_param(param_file, mdl,
"INTERNAL_TIDE_SOURCE_TEST", cs%int_tide_source_test, &
382 "If true, apply an arbitrary generation site for internal tide testing", &
384 if (cs%int_tide_source_test)
then
385 call get_param(param_file, mdl,
"INTERNAL_TIDE_SOURCE_X", cs%int_tide_source_x, &
386 "X Location of generation site for internal tide", default=1.)
387 call get_param(param_file, mdl,
"INTERNAL_TIDE_SOURCE_Y", cs%int_tide_source_y, &
388 "Y Location of generation site for internal tide", default=1.)
389 call get_param(param_file, mdl,
"INTERNAL_TIDE_SOURCE_TLEN_DAYS", tlen_days, &
390 "Time interval from start of experiment for adding wave source", &
391 units=
"days", default=0)
392 cs%time_max_source = time + set_time(0, days=tlen_days)
395 do j=js,je ;
do i=is,ie
397 if (g%bathyT(i,j) < min_zbot_itides) mask_itidal = 0.0
399 itide%tideamp(i,j) = itide%tideamp(i,j) * mask_itidal * g%mask2dT(i,j)
402 if (max_frac_rough >= 0.0) &
403 itide%h2(i,j) = min((max_frac_rough*g%bathyT(i,j))**2, itide%h2(i,j))
406 cs%TKE_itidal_coef(i,j) = 0.5*kappa_h2_factor*gv%Rho0*&
407 kappa_itides * us%Z_to_m**2*itide%h2(i,j) * itide%tideamp(i,j)**2
411 cs%id_TKE_itidal = register_diag_field(
'ocean_model',
'TKE_itidal_itide',diag%axesT1,time, &
412 'Internal Tide Driven Turbulent Kinetic Energy',
'W m-2')
414 cs%id_Nb = register_diag_field(
'ocean_model',
'Nb_itide',diag%axesT1,time, &
415 'Bottom Buoyancy Frequency',
's-1')
417 cs%id_N2_bot = register_diag_field(
'ocean_model',
'N2_b_itide',diag%axesT1,time, &
418 'Bottom Buoyancy frequency squared',
's-2', conversion=us%s_to_T**2)