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