18 implicit none ;
private
20 #include <MOM_memory.h>
22 public tidal_bay_set_obc_data, tidal_bay_obc_end
23 public register_tidal_bay_obc
27 real :: tide_flow = 3.0e6
33 function register_tidal_bay_obc(param_file, CS, OBC_Reg)
37 logical :: register_tidal_bay_obc
38 character(len=32) :: casename =
"tidal bay"
40 if (
associated(cs))
then
41 call mom_error(warning,
"register_tidal_bay_OBC called with an "// &
42 "associated control structure.")
48 call register_obc(casename, param_file, obc_reg)
49 register_tidal_bay_obc = .true.
51 end function register_tidal_bay_obc
54 subroutine tidal_bay_obc_end(CS)
57 if (
associated(cs))
then
60 end subroutine tidal_bay_obc_end
63 subroutine tidal_bay_set_obc_data(OBC, CS, G, h, Time)
69 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)),
intent(in) :: h
70 type(time_type),
intent(in) :: time
74 real :: my_flux, total_area
76 real,
allocatable :: my_area(:,:)
77 character(len=40) :: mdl =
"tidal_bay_set_OBC_data"
78 integer :: i, j, k, itt, is, ie, js, je, isd, ied, jsd, jed, nz, n
79 integer :: isdb, iedb, jsdb, jedb
82 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
83 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
84 isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
88 if (.not.
associated(obc))
return
90 allocate(my_area(1:1,js:je))
92 time_sec = time_type_to_real(time)
93 cff = 0.1*sin(2.0*pi*time_sec/(12.0*3600.0))
96 segment => obc%segment(1)
98 do j=segment%HI%jsc,segment%HI%jec ;
do i=segment%HI%IscB,segment%HI%IecB
99 if (obc%segnum_u(i,j) /= obc_none)
then
101 my_area(1,j) = my_area(1,j) + h(i,j,k)*g%dyCu(i,j)
106 my_flux = - cs%tide_flow*sin(2.0*pi*time_sec/(12.0*3600.0))
108 do n = 1, obc%number_of_segments
109 segment => obc%segment(n)
111 if (.not. segment%on_pe) cycle
113 segment%normal_vel_bt(:,:) = my_flux/total_area
114 segment%eta(:,:) = cff
118 end subroutine tidal_bay_set_obc_data