7 use mom_cpu_clock,
only : cpu_clock_id, cpu_clock_begin, cpu_clock_end, clock_routine
29 implicit none ;
private
31 #include <MOM_memory.h>
33 public call_obc_register, obc_register_end
34 public update_obc_data
38 logical :: use_files = .false.
39 logical :: use_kelvin = .false.
40 logical :: use_tidal_bay = .false.
41 logical :: use_shelfwave = .false.
42 logical :: use_dyed_channel = .false.
52 integer :: id_clock_pass
61 subroutine call_obc_register(param_file, CS, OBC)
67 character(len=40) :: mdl =
"MOM_boundary_update"
69 # include "version_variable.h"
70 if (
associated(cs))
then
71 call mom_error(warning,
"call_OBC_register called with an associated "// &
74 else ;
allocate(cs) ;
endif
78 call get_param(param_file, mdl,
"USE_FILE_OBC", cs%use_files, &
79 "If true, use external files for the open boundary.", &
81 call get_param(param_file, mdl,
"USE_TIDAL_BAY_OBC", cs%use_tidal_bay, &
82 "If true, use the tidal_bay open boundary.", &
84 call get_param(param_file, mdl,
"USE_KELVIN_WAVE_OBC", cs%use_Kelvin, &
85 "If true, use the Kelvin wave open boundary.", &
87 call get_param(param_file, mdl,
"USE_SHELFWAVE_OBC", cs%use_shelfwave, &
88 "If true, use the shelfwave open boundary.", &
90 call get_param(param_file, mdl,
"USE_DYED_CHANNEL_OBC", cs%use_dyed_channel, &
91 "If true, use the dyed channel open boundary.", &
94 if (cs%use_files) cs%use_files = &
95 register_file_obc(param_file, cs%file_OBC_CSp, &
97 if (cs%use_tidal_bay) cs%use_tidal_bay = &
98 register_tidal_bay_obc(param_file, cs%tidal_bay_OBC_CSp, &
100 if (cs%use_Kelvin) cs%use_Kelvin = &
101 register_kelvin_obc(param_file, cs%Kelvin_OBC_CSp, &
103 if (cs%use_shelfwave) cs%use_shelfwave = &
104 register_shelfwave_obc(param_file, cs%shelfwave_OBC_CSp, &
106 if (cs%use_dyed_channel) cs%use_dyed_channel = &
107 register_dyed_channel_obc(param_file, cs%dyed_channel_OBC_CSp, &
110 end subroutine call_obc_register
113 subroutine update_obc_data(OBC, G, GV, US, tv, h, CS, Time)
118 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)),
intent(inout) :: h
121 type(time_type),
intent(in) :: time
124 logical :: read_obc_eta = .false.
125 logical :: read_obc_uv = .false.
126 logical :: read_obc_ts = .false.
127 integer :: i, j, k, itt, is, ie, js, je, isd, ied, jsd, jed, nz
128 integer :: isd_off, jsd_off
129 integer :: isdb, iedb, jsdb, jedb
130 character(len=40) :: mdl =
"update_OBC_data"
131 character(len=200) :: filename, obc_file, inputdir
133 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
134 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
135 isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
140 if (cs%use_tidal_bay) &
141 call tidal_bay_set_obc_data(obc, cs%tidal_bay_OBC_CSp, g, h, time)
143 call kelvin_set_obc_data(obc, cs%Kelvin_OBC_CSp, g, gv, us, h, time)
144 if (cs%use_shelfwave) &
145 call shelfwave_set_obc_data(obc, cs%shelfwave_OBC_CSp, g, h, time)
146 if (cs%use_dyed_channel) &
147 call dyed_channel_update_flow(obc, cs%dyed_channel_OBC_CSp, g, time)
148 if (obc%needs_IO_for_data) &
149 call update_obc_segment_data(g, gv, us, obc, tv, h, time)
151 end subroutine update_obc_data
154 subroutine obc_register_end(CS)
157 if (cs%use_files)
call file_obc_end(cs%file_OBC_CSp)
158 if (cs%use_tidal_bay)
call tidal_bay_obc_end(cs%tidal_bay_OBC_CSp)
159 if (cs%use_Kelvin)
call kelvin_obc_end(cs%Kelvin_OBC_CSp)
161 if (
associated(cs))
deallocate(cs)
162 end subroutine obc_register_end