18 use mom_io,
only : open_file
19 use mom_io,
only : append_file, ascii_file, multiple, single_file
20 use mom_time_manager,
only : time_type, get_time, get_date, set_date,
operator(-)
25 implicit none ;
private
27 #include <MOM_memory.h>
33 character(len=200) :: u_trunc_file
35 character(len=200) :: v_trunc_file
39 integer :: cols_written
43 type(time_type),
pointer :: time => null()
49 real,
pointer,
dimension(:,:,:) :: &
56 u_accel_bt => null(), &
58 real,
pointer,
dimension(:,:,:) :: pbce => null()
68 subroutine write_u_accel(I, j, um, hin, ADp, CDp, dt_in_T, G, GV, US, CS, vel_rpt, str, a, hv)
69 integer,
intent(in) :: i
70 integer,
intent(in) :: j
74 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
76 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
82 real,
intent(in) :: dt_in_t
85 real,
intent(in) :: vel_rpt
86 real,
optional,
intent(in) :: str
88 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
89 optional,
intent(in) :: a
90 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
91 optional,
intent(in) :: hv
98 real :: inorm(szk_(g))
100 real :: h_scale, uh_scale
101 integer :: yr, mo, day, hr, minute, sec, yearday
104 logical :: do_k(szk_(g)+1)
105 logical :: prev_avail
108 angstrom = gv%Angstrom_H + gv%H_subroundoff
109 dt = us%T_to_s*dt_in_t
110 h_scale = gv%H_to_m ; uh_scale = gv%H_to_m*us%L_T_to_m_s
114 if (cs%cols_written < cs%max_writes)
then
115 cs%cols_written = cs%cols_written + 1
121 if (cs%u_file < 0)
then
122 if (len_trim(cs%u_trunc_file) < 1)
return
123 call open_file(cs%u_file, trim(cs%u_trunc_file), action=append_file, &
124 form=ascii_file, threading=multiple, fileset=single_file)
125 if (cs%u_file < 0)
then
126 call mom_error(note,
'Unable to open file '//trim(cs%u_trunc_file)//
'.')
132 prev_avail = (
associated(cs%u_prev) .and.
associated(cs%v_prev))
136 if (((max(cs%u_av(i,j,k),um(i,j,k)) >= vel_rpt) .or. &
137 (min(cs%u_av(i,j,k),um(i,j,k)) <= -vel_rpt)) .and. &
138 ((hin(i,j,k) + hin(i+1,j,k)) > 3.0*angstrom))
exit
142 if (((max(cs%u_av(i,j,k), um(i,j,k)) >= vel_rpt) .or. &
143 (min(cs%u_av(i,j,k), um(i,j,k)) <= -vel_rpt)) .and. &
144 ((hin(i,j,k) + hin(i+1,j,k)) > 3.0*angstrom))
exit
148 ks = 1; ke = nz;
write(file,
'("U: Unable to set ks & ke.")')
151 call get_date(cs%Time, yr, mo, day, hr, minute, sec)
152 call get_time((cs%Time - set_date(yr, 1, 1, 0, 0, 0)), sec, yearday)
153 write (file,
'(/,"--------------------------")')
154 write (file,
'(/,"Time ",i5,i4,F6.2," U-velocity violation at ",I4,": ",2(I3), &
155 & " (",F7.2," E "F7.2," N) Layers ",I3," to ",I3,". dt = ",1PG10.4)') &
156 yr, yearday, (real(sec)/3600.0), pe_here(), i, j, &
157 g%geoLonCu(i,j), g%geoLatCu(i,j), ks, ke, dt
159 if (ks <= gv%nk_rho_varies) ks = 1
161 if ((hin(i,j,k) + hin(i+1,j,k)) > 3.0*angstrom) do_k(k) = .true.
164 write(file,
'(/,"Layers:",$)')
165 do k=ks,ke ;
if (do_k(k))
write(file,
'(I10," ",$)') (k);
enddo
166 write(file,
'(/,"u(m): ",$)')
167 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (us%L_T_to_m_s*um(i,j,k));
enddo
169 write(file,
'(/,"u(mp): ",$)')
170 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (us%L_T_to_m_s*cs%u_prev(i,j,k));
enddo
172 write(file,
'(/,"u(3): ",$)')
173 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (us%L_T_to_m_s*cs%u_av(i,j,k));
enddo
175 write(file,
'(/,"CFL u: ",$)')
176 do k=ks,ke ;
if (do_k(k))
then
177 cfl = abs(um(i,j,k)) * us%s_to_T*dt * g%dy_Cu(i,j)
178 if (um(i,j,k) < 0.0)
then ; cfl = cfl * g%IareaT(i+1,j)
179 else ; cfl = cfl * g%IareaT(i,j) ;
endif
180 write(file,
'(ES10.3," ",$)') cfl
182 write(file,
'(/,"CFL0 u:",$)')
183 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
184 abs(um(i,j,k)) * us%s_to_T*dt * g%IdxCu(i,j) ;
enddo
187 write(file,
'(/,"du: ",$)')
188 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
189 (us%L_T_to_m_s*(um(i,j,k)-cs%u_prev(i,j,k)));
enddo
191 write(file,
'(/,"CAu: ",$)')
192 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (dt*us%L_T2_to_m_s2*adp%CAu(i,j,k));
enddo
193 write(file,
'(/,"PFu: ",$)')
194 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (dt*us%L_T2_to_m_s2*adp%PFu(i,j,k));
enddo
195 write(file,
'(/,"diffu: ",$)')
196 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (dt*us%L_T2_to_m_s2*adp%diffu(i,j,k));
enddo
198 if (
associated(adp%gradKEu))
then
199 write(file,
'(/,"KEu: ",$)')
200 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
201 (dt*us%L_T2_to_m_s2*adp%gradKEu(i,j,k));
enddo
203 if (
associated(adp%rv_x_v))
then
204 write(file,
'(/,"Coru: ",$)')
205 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
206 dt*us%L_T2_to_m_s2*(adp%CAu(i,j,k)-adp%rv_x_v(i,j,k));
enddo
208 if (
associated(adp%du_dt_visc))
then
209 write(file,
'(/,"ubv: ",$)')
210 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
211 us%L_T_to_m_s*(um(i,j,k) - us%s_to_T*dt*adp%du_dt_visc(i,j,k));
enddo
212 write(file,
'(/,"duv: ",$)')
213 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
214 (dt*us%L_T2_to_m_s2*adp%du_dt_visc(i,j,k));
enddo
216 if (
associated(adp%du_other))
then
217 write(file,
'(/,"du_other: ",$)')
218 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
219 (us%L_T_to_m_s*adp%du_other(i,j,k));
enddo
222 write(file,
'(/,"a: ",$)')
223 do k=ks,ke+1 ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') a(i,j,k)*us%Z_to_m*dt;
enddo
225 if (
present(hv))
then
226 write(file,
'(/,"hvel: ",$)')
227 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') hv(i,j,k);
enddo
229 write(file,
'(/,"Stress: ",ES10.3)') str
231 if (
associated(cs%u_accel_bt))
then
232 write(file,
'("dubt: ",$)')
233 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
234 (dt*us%L_T2_to_m_s2*cs%u_accel_bt(i,j,k)) ;
enddo
238 write(file,
'(/,"h--: ",$)')
239 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (h_scale*hin(i,j-1,k));
enddo
240 write(file,
'(/,"h+-: ",$)')
241 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (h_scale*hin(i+1,j-1,k));
enddo
242 write(file,
'(/,"h-0: ",$)')
243 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (h_scale*hin(i,j,k));
enddo
244 write(file,
'(/,"h+0: ",$)')
245 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (h_scale*hin(i+1,j,k));
enddo
246 write(file,
'(/,"h-+: ",$)')
247 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (h_scale*hin(i,j+1,k));
enddo
248 write(file,
'(/,"h++: ",$)')
249 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (h_scale*hin(i+1,j+1,k));
enddo
252 e(nz+1) = -us%Z_to_m*g%bathyT(i,j)
253 do k=nz,1,-1 ; e(k) = e(k+1) + h_scale*hin(i,j,k) ;
enddo
254 write(file,
'(/,"e-: ",$)')
255 write(file,
'(ES10.3," ",$)') e(ks)
256 do k=ks+1,ke+1 ;
if (do_k(k-1))
write(file,
'(ES10.3," ",$)') e(k);
enddo
258 e(nz+1) = -us%Z_to_m*g%bathyT(i+1,j)
259 do k=nz,1,-1 ; e(k) = e(k+1) + h_scale*hin(i+1,j,k) ;
enddo
260 write(file,
'(/,"e+: ",$)')
261 write(file,
'(ES10.3," ",$)') e(ks)
262 do k=ks+1,ke+1 ;
if (do_k(k-1))
write(file,
'(ES10.3," ",$)') e(k) ;
enddo
263 if (
associated(cs%T))
then
264 write(file,
'(/,"T-: ",$)')
265 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') cs%T(i,j,k);
enddo
266 write(file,
'(/,"T+: ",$)')
267 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') cs%T(i+1,j,k);
enddo
269 if (
associated(cs%S))
then
270 write(file,
'(/,"S-: ",$)')
271 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') cs%S(i,j,k);
enddo
272 write(file,
'(/,"S+: ",$)')
273 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') cs%S(i+1,j,k);
enddo
277 write(file,
'(/,"v--: ",$)')
278 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (cs%v_prev(i,j-1,k));
enddo
279 write(file,
'(/,"v-+: ",$)')
280 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (cs%v_prev(i,j,k));
enddo
281 write(file,
'(/,"v+-: ",$)')
282 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (cs%v_prev(i+1,j-1,k));
enddo
283 write(file,
'(/,"v++: ",$)')
284 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (cs%v_prev(i+1,j,k));
enddo
287 write(file,
'(/,"vh--: ",$)')
288 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
289 (uh_scale*cdp%vh(i,j-1,k)*g%IdxCv(i,j-1));
enddo
290 write(file,
'(/," vhC--:",$)')
291 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
292 (0.5*us%L_T_to_m_s*cs%v_av(i,j-1,k)*h_scale*(hin(i,j-1,k) + hin(i,j,k)));
enddo
294 write(file,
'(/," vhCp--:",$)')
295 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
296 (0.5*cs%v_prev(i,j-1,k)*h_scale*(hin(i,j-1,k) + hin(i,j,k)));
enddo
299 write(file,
'(/,"vh-+: ",$)')
300 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
301 (uh_scale*cdp%vh(i,j,k)*g%IdxCv(i,j));
enddo
302 write(file,
'(/," vhC-+:",$)')
303 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
304 (0.5*us%L_T_to_m_s*cs%v_av(i,j,k)*h_scale*(hin(i,j,k) + hin(i,j+1,k)));
enddo
306 write(file,
'(/," vhCp-+:",$)')
307 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
308 (0.5*cs%v_prev(i,j,k)*h_scale*(hin(i,j,k) + hin(i,j+1,k)));
enddo
311 write(file,
'(/,"vh+-: ",$)')
312 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
313 (uh_scale*cdp%vh(i+1,j-1,k)*g%IdxCv(i+1,j-1));
enddo
314 write(file,
'(/," vhC+-:",$)')
315 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
316 (0.5*us%L_T_to_m_s*cs%v_av(i+1,j-1,k)*h_scale*(hin(i+1,j-1,k) + hin(i+1,j,k)));
enddo
318 write(file,
'(/," vhCp+-:",$)')
319 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
320 (0.5*cs%v_prev(i+1,j-1,k)*h_scale*(hin(i+1,j-1,k) + hin(i+1,j,k)));
enddo
323 write(file,
'(/,"vh++: ",$)')
324 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
325 (uh_scale*cdp%vh(i+1,j,k)*g%IdxCv(i+1,j));
enddo
326 write(file,
'(/," vhC++:",$)')
327 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
328 (0.5*us%L_T_to_m_s*cs%v_av(i+1,j,k)*h_scale*(hin(i+1,j,k) + hin(i+1,j+1,k)));
enddo
330 write(file,
'(/," vhCp++:",$)')
331 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
332 (0.5*us%L_T_to_m_s*cs%v_av(i+1,j,k)*h_scale*(hin(i+1,j,k) + hin(i+1,j+1,k)));
enddo
335 write(file,
'(/,"D: ",2(ES10.3))') us%Z_to_m*g%bathyT(i,j),us%Z_to_m*g%bathyT(i+1,j)
340 du = us%L_T_to_m_s*(um(i,j,k) - cs%u_prev(i,j,k))
341 if (abs(du) < 1.0e-6) du = 1.0e-6
345 write(file,
'(2/,"Norm: ",$)')
346 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') (1.0/inorm(k));
enddo
348 write(file,
'(/,"du: ",$)')
349 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') &
350 (us%L_T_to_m_s*(um(i,j,k)-cs%u_prev(i,j,k))*inorm(k));
enddo
352 write(file,
'(/,"CAu: ",$)')
353 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') &
354 (dt*us%L_T2_to_m_s2*adp%CAu(i,j,k)*inorm(k));
enddo
356 write(file,
'(/,"PFu: ",$)')
357 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') &
358 (dt*us%L_T2_to_m_s2*adp%PFu(i,j,k)*inorm(k));
enddo
360 write(file,
'(/,"diffu: ",$)')
361 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') &
362 (dt*us%L_T2_to_m_s2*adp%diffu(i,j,k)*inorm(k));
enddo
364 if (
associated(adp%gradKEu))
then
365 write(file,
'(/,"KEu: ",$)')
366 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') &
367 (dt*us%L_T2_to_m_s2*adp%gradKEu(i,j,k)*inorm(k));
enddo
369 if (
associated(adp%rv_x_v))
then
370 write(file,
'(/,"Coru: ",$)')
371 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') &
372 dt*us%L_T2_to_m_s2*(adp%CAu(i,j,k)-adp%rv_x_v(i,j,k))*inorm(k);
enddo
374 if (
associated(adp%du_dt_visc))
then
375 write(file,
'(/,"duv: ",$)')
376 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') &
377 (dt*us%L_T2_to_m_s2*adp%du_dt_visc(i,j,k))*inorm(k);
enddo
379 if (
associated(adp%du_other))
then
380 write(file,
'(/,"du_other: ",$)')
381 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') &
382 (us%L_T_to_m_s*adp%du_other(i,j,k))*inorm(k);
enddo
384 if (
associated(cs%u_accel_bt))
then
385 write(file,
'(/,"dubt: ",$)')
386 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') &
387 (dt*us%L_T2_to_m_s2*cs%u_accel_bt(i,j,k)*inorm(k)) ;
enddo
401 subroutine write_v_accel(i, J, vm, hin, ADp, CDp, dt_in_T, G, GV, US, CS, vel_rpt, str, a, hv)
402 integer,
intent(in) :: i
403 integer,
intent(in) :: j
407 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)), &
409 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
415 real,
intent(in) :: dt_in_t
418 real,
intent(in) :: vel_rpt
419 real,
optional,
intent(in) :: str
421 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)), &
422 optional,
intent(in) :: a
423 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)), &
424 optional,
intent(in) :: hv
431 real :: inorm(szk_(g))
433 real :: h_scale, uh_scale
434 integer :: yr, mo, day, hr, minute, sec, yearday
437 logical :: do_k(szk_(g)+1)
438 logical :: prev_avail
441 angstrom = gv%Angstrom_H + gv%H_subroundoff
442 dt = us%T_to_s*dt_in_t
443 h_scale = gv%H_to_m ; uh_scale = gv%H_to_m*us%L_T_to_m_s
447 if (cs%cols_written < cs%max_writes)
then
448 cs%cols_written = cs%cols_written + 1
454 if (cs%v_file < 0)
then
455 if (len_trim(cs%v_trunc_file) < 1)
return
456 call open_file(cs%v_file, trim(cs%v_trunc_file), action=append_file, &
457 form=ascii_file, threading=multiple, fileset=single_file)
458 if (cs%v_file < 0)
then
459 call mom_error(note,
'Unable to open file '//trim(cs%v_trunc_file)//
'.')
465 prev_avail = (
associated(cs%u_prev) .and.
associated(cs%v_prev))
468 if (((max(cs%v_av(i,j,k), vm(i,j,k)) >= vel_rpt) .or. &
469 (min(cs%v_av(i,j,k), vm(i,j,k)) <= -vel_rpt)) .and. &
470 ((hin(i,j,k) + hin(i,j+1,k)) > 3.0*angstrom))
exit
474 if (((max(cs%v_av(i,j,k), vm(i,j,k)) >= vel_rpt) .or. &
475 (min(cs%v_av(i,j,k), vm(i,j,k)) <= -vel_rpt)) .and. &
476 ((hin(i,j,k) + hin(i,j+1,k)) > 3.0*angstrom))
exit
480 ks = 1; ke = nz;
write(file,
'("V: Unable to set ks & ke.")')
483 call get_date(cs%Time, yr, mo, day, hr, minute, sec)
484 call get_time((cs%Time - set_date(yr, 1, 1, 0, 0, 0)), sec, yearday)
485 write (file,
'(/,"--------------------------")')
486 write (file,
'(/,"Time ",i5,i4,F6.2," V-velocity violation at ",I4,": ",2(I3), &
487 & " (",F7.2," E ",F7.2," N) Layers ",I3," to ",I3,". dt = ",1PG10.4)') &
488 yr, yearday, (real(sec)/3600.0), pe_here(), i, j, &
489 g%geoLonCv(i,j), g%geoLatCv(i,j), ks, ke, dt
491 if (ks <= gv%nk_rho_varies) ks = 1
493 if ((hin(i,j,k) + hin(i,j+1,k)) > 3.0*angstrom) do_k(k) = .true.
496 write(file,
'(/,"Layers:",$)')
497 do k=ks,ke ;
if (do_k(k))
write(file,
'(I10," ",$)') (k);
enddo
498 write(file,
'(/,"v(m): ",$)')
499 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (us%L_T_to_m_s*vm(i,j,k));
enddo
502 write(file,
'(/,"v(mp): ",$)')
503 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (us%L_T_to_m_s*cs%v_prev(i,j,k));
enddo
506 write(file,
'(/,"v(3): ",$)')
507 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (us%L_T_to_m_s*cs%v_av(i,j,k));
enddo
508 write(file,
'(/,"CFL v: ",$)')
509 do k=ks,ke ;
if (do_k(k))
then
510 cfl = abs(vm(i,j,k)) * us%s_to_T*dt * g%dx_Cv(i,j)
511 if (vm(i,j,k) < 0.0)
then ; cfl = cfl * g%IareaT(i,j+1)
512 else ; cfl = cfl * g%IareaT(i,j) ;
endif
513 write(file,
'(ES10.3," ",$)') cfl
515 write(file,
'(/,"CFL0 v:",$)')
516 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
517 abs(vm(i,j,k)) * us%s_to_T*dt * g%IdyCv(i,j) ;
enddo
520 write(file,
'(/,"dv: ",$)')
521 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
522 (us%L_T_to_m_s*(vm(i,j,k)-cs%v_prev(i,j,k)));
enddo
525 write(file,
'(/,"CAv: ",$)')
526 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (dt*us%L_T2_to_m_s2*adp%CAv(i,j,k));
enddo
528 write(file,
'(/,"PFv: ",$)')
529 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (dt*us%L_T2_to_m_s2*adp%PFv(i,j,k));
enddo
531 write(file,
'(/,"diffv: ",$)')
532 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') (dt*us%L_T2_to_m_s2*adp%diffv(i,j,k));
enddo
534 if (
associated(adp%gradKEv))
then
535 write(file,
'(/,"KEv: ",$)')
536 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
537 (dt*us%L_T2_to_m_s2*adp%gradKEv(i,j,k));
enddo
539 if (
associated(adp%rv_x_u))
then
540 write(file,
'(/,"Corv: ",$)')
541 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
542 dt*us%L_T2_to_m_s2*(adp%CAv(i,j,k)-adp%rv_x_u(i,j,k));
enddo
544 if (
associated(adp%dv_dt_visc))
then
545 write(file,
'(/,"vbv: ",$)')
546 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
547 us%L_T_to_m_s*(vm(i,j,k) - us%s_to_T*dt*adp%dv_dt_visc(i,j,k));
enddo
549 write(file,
'(/,"dvv: ",$)')
550 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
551 (dt*us%L_T2_to_m_s2*adp%dv_dt_visc(i,j,k));
enddo
553 if (
associated(adp%dv_other))
then
554 write(file,
'(/,"dv_other: ",$)')
555 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
556 (us%L_T_to_m_s*adp%dv_other(i,j,k));
enddo
559 write(file,
'(/,"a: ",$)')
560 do k=ks,ke+1 ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') a(i,j,k)*us%Z_to_m*dt;
enddo
562 if (
present(hv))
then
563 write(file,
'(/,"hvel: ",$)')
564 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') hv(i,j,k);
enddo
566 write(file,
'(/,"Stress: ",ES10.3)') str
568 if (
associated(cs%v_accel_bt))
then
569 write(file,
'("dvbt: ",$)')
570 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
571 (dt*us%L_T2_to_m_s2*cs%v_accel_bt(i,j,k)) ;
enddo
575 write(file,
'("h--: ",$)')
576 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') h_scale*hin(i-1,j,k);
enddo
577 write(file,
'(/,"h0-: ",$)')
578 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') h_scale*hin(i,j,k);
enddo
579 write(file,
'(/,"h+-: ",$)')
580 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') h_scale*hin(i+1,j,k);
enddo
581 write(file,
'(/,"h-+: ",$)')
582 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') h_scale*hin(i-1,j+1,k);
enddo
583 write(file,
'(/,"h0+: ",$)')
584 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') h_scale*hin(i,j+1,k);
enddo
585 write(file,
'(/,"h++: ",$)')
586 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') h_scale*hin(i+1,j+1,k);
enddo
588 e(nz+1) = -us%Z_to_m*g%bathyT(i,j)
589 do k=nz,1,-1 ; e(k) = e(k+1) + h_scale*hin(i,j,k);
enddo
590 write(file,
'(/,"e-: ",$)')
591 write(file,
'(ES10.3," ",$)') e(ks)
592 do k=ks+1,ke+1 ;
if (do_k(k-1))
write(file,
'(ES10.3," ",$)') e(k);
enddo
594 e(nz+1) = -us%Z_to_m*g%bathyT(i,j+1)
595 do k=nz,1,-1 ; e(k) = e(k+1) + h_scale*hin(i,j+1,k) ;
enddo
596 write(file,
'(/,"e+: ",$)')
597 write(file,
'(ES10.3," ",$)') e(ks)
598 do k=ks+1,ke+1 ;
if (do_k(k-1))
write(file,
'(ES10.3," ",$)') e(k);
enddo
599 if (
associated(cs%T))
then
600 write(file,
'(/,"T-: ",$)')
601 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') cs%T(i,j,k);
enddo
602 write(file,
'(/,"T+: ",$)')
603 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') cs%T(i,j+1,k);
enddo
605 if (
associated(cs%S))
then
606 write(file,
'(/,"S-: ",$)')
607 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') cs%S(i,j,k);
enddo
608 write(file,
'(/,"S+: ",$)')
609 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') cs%S(i,j+1,k);
enddo
613 write(file,
'(/,"u--: ",$)')
614 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') cs%u_prev(i-1,j,k);
enddo
615 write(file,
'(/,"u-+: ",$)')
616 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') cs%u_prev(i-1,j+1,k);
enddo
617 write(file,
'(/,"u+-: ",$)')
618 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') cs%u_prev(i,j,k);
enddo
619 write(file,
'(/,"u++: ",$)')
620 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') cs%u_prev(i,j+1,k);
enddo
623 write(file,
'(/,"uh--: ",$)')
624 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
625 (uh_scale*cdp%uh(i-1,j,k)*g%IdyCu(i-1,j));
enddo
626 write(file,
'(/," uhC--: ",$)')
627 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
628 (us%L_T_to_m_s*cs%u_av(i-1,j,k) * h_scale*0.5*(hin(i-1,j,k) + hin(i,j,k)));
enddo
630 write(file,
'(/," uhCp--:",$)')
631 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
632 (cs%u_prev(i-1,j,k) * h_scale*0.5*(hin(i-1,j,k) + hin(i,j,k)));
enddo
635 write(file,
'(/,"uh-+: ",$)')
636 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
637 (uh_scale*cdp%uh(i-1,j+1,k)*g%IdyCu(i-1,j+1));
enddo
638 write(file,
'(/," uhC-+: ",$)')
639 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
640 (us%L_T_to_m_s*cs%u_av(i-1,j+1,k) * h_scale*0.5*(hin(i-1,j+1,k) + hin(i,j+1,k)));
enddo
642 write(file,
'(/," uhCp-+:",$)')
643 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
644 (cs%u_prev(i-1,j+1,k) * h_scale*0.5*(hin(i-1,j+1,k) + hin(i,j+1,k)));
enddo
647 write(file,
'(/,"uh+-: ",$)')
648 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
649 (uh_scale*cdp%uh(i,j,k)*g%IdyCu(i,j));
enddo
650 write(file,
'(/," uhC+-: ",$)')
651 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
652 (us%L_T_to_m_s*cs%u_av(i,j,k) * h_scale*0.5*(hin(i,j,k) + hin(i+1,j,k)));
enddo
654 write(file,
'(/," uhCp+-:",$)')
655 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
656 (cs%u_prev(i,j,k) * h_scale*0.5*(hin(i,j,k) + hin(i+1,j,k)));
enddo
659 write(file,
'(/,"uh++: ",$)')
660 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
661 (uh_scale*cdp%uh(i,j+1,k)*g%IdyCu(i,j+1));
enddo
662 write(file,
'(/," uhC++: ",$)')
663 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
664 (us%L_T_to_m_s*cs%u_av(i,j+1,k) * 0.5*h_scale*(hin(i,j+1,k) + hin(i+1,j+1,k)));
enddo
666 write(file,
'(/," uhCp++:",$)')
667 do k=ks,ke ;
if (do_k(k))
write(file,
'(ES10.3," ",$)') &
668 (cs%u_prev(i,j+1,k) * h_scale*0.5*(hin(i,j+1,k) + hin(i+1,j+1,k)));
enddo
671 write(file,
'(/,"D: ",2(ES10.3))') us%Z_to_m*g%bathyT(i,j),us%Z_to_m*g%bathyT(i,j+1)
676 dv = us%L_T_to_m_s*(vm(i,j,k)-cs%v_prev(i,j,k))
677 if (abs(dv) < 1.0e-6) dv = 1.0e-6
681 write(file,
'(2/,"Norm: ",$)')
682 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') (1.0/inorm(k));
enddo
683 write(file,
'(/,"dv: ",$)')
684 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') &
685 (us%L_T_to_m_s*(vm(i,j,k)-cs%v_prev(i,j,k))*inorm(k));
enddo
686 write(file,
'(/,"CAv: ",$)')
687 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') &
688 (dt*us%L_T2_to_m_s2*adp%CAv(i,j,k)*inorm(k));
enddo
689 write(file,
'(/,"PFv: ",$)')
690 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') &
691 (dt*us%L_T2_to_m_s2*adp%PFv(i,j,k)*inorm(k));
enddo
692 write(file,
'(/,"diffv: ",$)')
693 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') &
694 (dt*us%L_T2_to_m_s2*adp%diffv(i,j,k)*inorm(k));
enddo
696 if (
associated(adp%gradKEu))
then
697 write(file,
'(/,"KEv: ",$)')
698 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') &
699 (dt*us%L_T2_to_m_s2*adp%gradKEv(i,j,k)*inorm(k));
enddo
701 if (
associated(adp%rv_x_u))
then
702 write(file,
'(/,"Corv: ",$)')
703 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') &
704 dt*us%L_T2_to_m_s2*(adp%CAv(i,j,k)-adp%rv_x_u(i,j,k))*inorm(k);
enddo
706 if (
associated(adp%dv_dt_visc))
then
707 write(file,
'(/,"dvv: ",$)')
708 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') &
709 (dt*us%L_T2_to_m_s2*adp%dv_dt_visc(i,j,k)*inorm(k));
enddo
711 if (
associated(adp%dv_other))
then
712 write(file,
'(/,"dv_other: ",$)')
713 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') &
714 (us%L_T_to_m_s*adp%dv_other(i,j,k)*inorm(k));
enddo
716 if (
associated(cs%v_accel_bt))
then
717 write(file,
'(/,"dvbt: ",$)')
718 do k=ks,ke ;
if (do_k(k))
write(file,
'(F10.6," ",$)') &
719 (dt*us%L_T2_to_m_s2*cs%v_accel_bt(i,j,k)*inorm(k)) ;
enddo
733 target,
intent(in) :: mis
736 type(time_type),
target,
intent(in) :: time
740 type(
diag_ctrl),
target,
intent(inout) :: diag
747 #include "version_variable.h"
748 character(len=40) :: mdl =
"MOM_PointAccel"
750 if (
associated(cs))
return
753 cs%diag => diag ; cs%Time => time
755 cs%T => mis%T ; cs%S => mis%S ; cs%pbce => mis%pbce
756 cs%u_accel_bt => mis%u_accel_bt ; cs%v_accel_bt => mis%v_accel_bt
757 cs%u_prev => mis%u_prev ; cs%v_prev => mis%v_prev
758 cs%u_av => mis%u_av;
if (.not.
associated(mis%u_av)) cs%u_av => mis%u(:,:,:)
759 cs%v_av => mis%v_av;
if (.not.
associated(mis%v_av)) cs%v_av => mis%v(:,:,:)
763 call get_param(param_file, mdl,
"U_TRUNC_FILE", cs%u_trunc_file, &
764 "The absolute path to the file where the accelerations "//&
765 "leading to zonal velocity truncations are written. \n"//&
766 "Leave this empty for efficiency if this diagnostic is "//&
767 "not needed.", default=
"", debuggingparam=.true.)
768 call get_param(param_file, mdl,
"V_TRUNC_FILE", cs%v_trunc_file, &
769 "The absolute path to the file where the accelerations "//&
770 "leading to meridional velocity truncations are written. \n"//&
771 "Leave this empty for efficiency if this diagnostic is "//&
772 "not needed.", default=
"", debuggingparam=.true.)
773 call get_param(param_file, mdl,
"MAX_TRUNC_FILE_SIZE_PER_PE", cs%max_writes, &
774 "The maximum number of colums of truncations that any PE "//&
775 "will write out during a run.", default=50, debuggingparam=.true.)
777 if (len_trim(dirs%output_directory) > 0)
then
778 if (len_trim(cs%u_trunc_file) > 0) &
779 cs%u_trunc_file = trim(dirs%output_directory)//trim(cs%u_trunc_file)
780 if (len_trim(cs%v_trunc_file) > 0) &
781 cs%v_trunc_file = trim(dirs%output_directory)//trim(cs%v_trunc_file)
782 call log_param(param_file, mdl,
"output_dir/U_TRUNC_FILE", cs%u_trunc_file)
783 call log_param(param_file, mdl,
"output_dir/V_TRUNC_FILE", cs%v_trunc_file)
785 cs%u_file = -1 ; cs%v_file = -1 ; cs%cols_written = 0