Check for consistency between the duplicated points of a 2-D B-grid vector.
325 character(len=*),
intent(in) :: mesg
326 type(ocean_grid_type),
intent(inout) :: G
327 real,
dimension(G%IsdB:,G%JsdB:),
intent(in) :: u_comp
329 real,
dimension(G%IsdB:,G%JsdB:),
intent(in) :: v_comp
331 integer,
optional,
intent(in) :: is
332 integer,
optional,
intent(in) :: ie
333 integer,
optional,
intent(in) :: js
334 integer,
optional,
intent(in) :: je
335 integer,
optional,
intent(in) :: direction
338 real :: u_nonsym(G%isd:G%ied,G%jsd:G%jed)
339 real :: v_nonsym(G%isd:G%ied,G%jsd:G%jed)
340 real :: u_resym(G%IsdB:G%IedB,G%JsdB:G%JedB)
341 real :: v_resym(G%IsdB:G%IedB,G%JsdB:G%JedB)
342 character(len=128) :: mesg2
343 integer :: i, j, is_ch, ie_ch, js_ch, je_ch
344 integer :: Isq, Ieq, Jsq, Jeq, isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB
346 isq = g%IscB ; ieq = g%IecB ; jsq = g%JscB ; jeq = g%JecB
347 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
348 isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
350 if (.not.(
present(is) .or.
present(ie) .or.
present(js) .or.
present(je)))
then
352 if ((isd == isdb) .and. (jsd == jsdb))
return
355 do i=isd,ied ;
do j=jsd,jed
356 u_nonsym(i,j) = u_comp(i,j) ; v_nonsym(i,j) = v_comp(i,j)
359 if (.not.
associated(g%Domain_aux))
call mom_error(fatal,
" check_redundant"//&
360 " called with a non-associated auxiliary domain the grid type.")
361 call pass_vector(u_nonsym, v_nonsym, g%Domain_aux, direction, stagger=bgrid_ne)
363 do i=isdb,iedb ;
do j=jsdb,jedb
364 u_resym(i,j) = u_comp(i,j) ; v_resym(i,j) = v_comp(i,j)
366 do i=isd,ied ;
do j=jsd,jed
367 u_resym(i,j) = u_nonsym(i,j) ; v_resym(i,j) = v_nonsym(i,j)
369 call pass_vector(u_resym, v_resym, g%Domain, direction, stagger=bgrid_ne)
371 is_ch = isq ; ie_ch = ieq ; js_ch = jsq ; je_ch = jeq
372 if (
present(is)) is_ch = is ;
if (
present(ie)) ie_ch = ie
373 if (
present(js)) js_ch = js ;
if (
present(js)) je_ch = je
375 do i=is_ch,ie_ch ;
do j=js_ch,je_ch
376 if (u_resym(i,j) /= u_comp(i,j) .and. &
377 redundant_prints(2) < max_redundant_prints)
then
378 write(mesg2,
'(" redundant u-components",2(1pe12.4)," differ by ", &
379 & 1pe12.4," at i,j = ",2i4," on pe ",i4)') &
380 u_comp(i,j), u_resym(i,j),u_comp(i,j)-u_resym(i,j),i,j,pe_here()
381 write(0,
'(A130)') trim(mesg)//trim(mesg2)
382 redundant_prints(2) = redundant_prints(2) + 1
385 do i=is_ch,ie_ch ;
do j=js_ch,je_ch
386 if (v_resym(i,j) /= v_comp(i,j) .and. &
387 redundant_prints(2) < max_redundant_prints)
then
388 write(mesg2,
'(" redundant v-comps",2(1pe12.4)," differ by ", &
389 & 1pe12.4," at i,j = ",2i4," x,y = ",2(1pe12.4)" on pe ",i4)') &
390 v_comp(i,j), v_resym(i,j),v_comp(i,j)-v_resym(i,j),i,j, &
391 g%geoLonBu(i,j), g%geoLatBu(i,j), pe_here()
392 write(0,
'(A155)') trim(mesg)//trim(mesg2)
393 redundant_prints(2) = redundant_prints(2) + 1