41# ifdef ADJUST_BOUNDARY
55# if defined SEDIMENT || defined BBL_MODEL
61# if (defined BBL_MODEL || defined WAVES_OUTPUT) && defined SOLVE3D
63# if defined PIO_LIB && defined DISTRIBUTE
68# if defined ICE_MODEL && defined SOLVE3D
70# if defined PIO_LIB && defined DISTRIBUTE
75# ifdef ADJUST_BOUNDARY
80# ifdef ADJUST_BOUNDARY
85# if defined SEDIMENT && defined SOLVE3D
87# if defined PIO_LIB && defined DISTRIBUTE
96# if defined WEC_VF && defined SOLVE3D
97 USE wec_output_mod,
ONLY : wec_wrt_nf90
98# if defined PIO_LIB && defined DISTRIBUTE
99 USE wec_output_mod,
ONLY : wec_wrt_pio
105 PUBLIC :: wrt_extract
106 PRIVATE :: wrt_extract_nf90
107# if defined PIO_LIB && defined DISTRIBUTE
108 PRIVATE :: wrt_extract_pio
114 SUBROUTINE wrt_extract (ng, tile)
119 integer,
intent(in) :: ng, tile
123# ifdef ADJUST_BOUNDARY
124 integer :: LBij, UBij
126 integer :: LBi, UBi, LBj, UBj
127 integer :: iLB, iUB, jLB, jUB
129 character (len=*),
parameter :: MyFile = &
136# ifdef ADJUST_BOUNDARY
145 ilb=xtr_bounds(ng)%LBi(tile)
146 iub=xtr_bounds(ng)%UBi(tile)
147 jlb=xtr_bounds(ng)%LBj(tile)
148 jub=xtr_bounds(ng)%UBj(tile)
150 SELECT CASE (
xtr(ng)%IOtype)
152 CALL wrt_extract_nf90 (ng,
inlm, tile, &
153# ifdef ADJUST_BOUNDARY
156 & lbi, ubi, lbj, ubj, &
157 & ilb, iub, jlb, jub)
159# if defined PIO_LIB && defined DISTRIBUTE
161 CALL wrt_extract_pio (ng,
inlm, tile, &
162# ifdef ADJUST_BOUNDARY
165 & lbi, ubi, lbj, ubj, &
166 & ilb, iub, jlb, jub)
174 10
FORMAT (
' WRT_EXTRACT - Illegal output file type, io_type = ',i0, &
175 & /,15x,
'Check KeyWord ''OUT_LIB'' in ''roms.in''.')
178 END SUBROUTINE wrt_extract
181 SUBROUTINE wrt_extract_nf90 (ng, model, tile, &
182# ifdef ADJUST_BOUNDARY
185 & LBi, UBi, LBj, UBj, &
186 & iLB, iUB, jLB, jUB)
193 integer,
intent(in) :: ng, model, tile
194# ifdef ADJUST_BOUNDARY
195 integer,
intent(in) :: LBij, UBij
197 integer,
intent(in) :: LBi, UBi, LBj, UBj
198 integer,
intent(in) :: iLB, iUB, jLB, jUB
202 integer :: Fcount, gfactor, gtype, ifield, status
204 integer :: i, itrc, j, k
209 real(r8),
allocatable :: Ur2d(:,:)
210 real(r8),
allocatable :: Vr2d(:,:)
212 real(r8),
allocatable :: Ur3d(:,:,:)
213 real(r8),
allocatable :: Vr3d(:,:,:)
214 real(r8),
allocatable :: Wr3d(:,:,:)
217 character (len=*),
parameter :: MyFile = &
218 & __FILE__//
", wrt_extract_nf90"
220# include "set_bounds.h"
233# if defined WRITE_WATER && defined MASKING
241 xtr(ng)%Rindex=
xtr(ng)%Rindex+1
243 xtr(ng)%Nrec(fcount)=
xtr(ng)%Nrec(fcount)+1
265 & (/
xtr(ng)%Rindex/), (/1/), &
266 & ncid =
xtr(ng)%ncid, &
278 &
xtr(ng)%Rindex, gtype, &
279 & lbi, ubi, lbj, ubj, scale, &
281 & extract(ng) % pmask, &
283 & extract(ng) % pmask_wet, &
284 & setfillval = .false.)
285 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
300 &
xtr(ng)%Rindex, gtype, &
301 & lbi, ubi, lbj, ubj, scale, &
303 & extract(ng) % rmask, &
305 & extract(ng) % rmask_wet, &
306 & setfillval = .false.)
307 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
322 &
xtr(ng)%Rindex, gtype, &
323 & lbi, ubi, lbj, ubj, scale, &
325 & extract(ng) % umask, &
327 & extract(ng) % umask_wet, &
328 & setfillval = .false.)
329 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
344 &
xtr(ng)%Rindex, gtype, &
345 & lbi, ubi, lbj, ubj, scale, &
347 & extract(ng) % vmask, &
349 & extract(ng) % vmask_wet, &
350 & setfillval = .false.)
351 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
369 &
xtr(ng)%Rindex, gtype, &
370 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
372 & extract(ng) % rmask, &
374 & extract(ng) % z_r, &
375 & setfillval = .false.)
376 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
394 extract(ng)%z_v(i,j,k)=0.5_r8* &
395 & (extract(ng)%z_r(i-1,j,k)+ &
396 & extract(ng)%z_r(i ,j,k))
402 &
xtr(ng)%Rindex, gtype, &
403 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
405 & extract(ng) % umask, &
407 & extract(ng) % z_v, &
408 & setfillval = .false.)
409 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
427 extract(ng)%z_v(i,j,k)=0.5_r8*(extract(ng)%z_r(i,j-1,k)+ &
428 & extract(ng)%z_r(i,j ,k))
434 &
xtr(ng)%Rindex, gtype, &
435 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
437 & extract(ng) % vmask, &
439 & extract(ng) % z_v, &
440 & setfillval = .false.)
441 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
458 &
xtr(ng)%Rindex, gtype, &
459 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
461 & extract(ng) % rmask, &
463 & extract(ng) % z_w, &
464 & setfillval = .false.)
465 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
483 &
xtr(ng)%Rindex, gtype, &
484 & lbi, ubi, lbj, ubj, scale, &
486 &
grid(ng) % rmask, &
488 &
ocean(ng) % zeta(:,:,kout), &
489 & setfillval = .false., &
491 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
500# if defined FORWARD_WRITE && defined FORWARD_RHS
504 &
xtr(ng)%Rindex, gtype, &
505 & lbi, ubi, lbj, ubj, scale, &
507 &
grid(ng) % rmask, &
509 &
ocean(ng) % rzeta(:,:,kout), &
510 & setfillval = .false., &
512 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
523# ifdef ADJUST_BOUNDARY
533 & lbij, ubij,
nbrec(ng), scale, &
534 &
boundary(ng) % zeta_obc(lbij:,:,:, &
537 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
556 &
xtr(ng)%Rindex, gtype, &
557 & lbi, ubi, lbj, ubj, scale, &
559 &
grid(ng) % umask_full, &
561 &
ocean(ng) % ubar(:,:,kout), &
562 & setfillval = .false., &
564 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
578 &
xtr(ng)%Rindex, gtype, &
579 & lbi, ubi, lbj, ubj, scale, &
581 &
grid(ng) % umask_full, &
583 &
ocean(ng) % rubar(:,:,kout), &
584 & setfillval = .false., &
586 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
600 &
xtr(ng)%Rindex, gtype, &
601 & lbi, ubi, lbj, ubj, scale, &
603 &
grid(ng) % umask_full, &
606 & setfillval = .false., &
608 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
618 IF (.not.
allocated(ur2d))
THEN
619 allocate (ur2d(lbi:ubi,lbj:ubj))
620 ur2d(lbi:ubi,lbj:ubj)=0.0_r8
625 &
xtr(ng)%Rindex, gtype, &
626 & lbi, ubi, lbj, ubj, scale, &
628 &
grid(ng) % umask_full, &
631 & setfillval = .false., &
633 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
642 ur2d(lbi:ubi,lbj:ubj)=0.0_r8
646 &
xtr(ng)%Rindex, gtype, &
647 & lbi, ubi, lbj, ubj, scale, &
649 &
grid(ng) % umask_full, &
652 & setfillval = .false., &
654 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
667# ifdef ADJUST_BOUNDARY
677 & lbij, ubij,
nbrec(ng), scale, &
678 &
boundary(ng) % ubar_obc(lbij:,:,:, &
681 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
700 &
xtr(ng)%Rindex, gtype, &
701 & lbi, ubi, lbj, ubj, scale, &
703 &
grid(ng) % vmask_full, &
705 &
ocean(ng) % vbar(:,:,kout), &
706 & setfillval = .false., &
708 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
722 &
xtr(ng)%Rindex, gtype, &
723 & lbi, ubi, lbj, ubj, scale, &
725 &
grid(ng) % vmask_full, &
727 &
ocean(ng) % rvbar(:,:,kout), &
728 & setfillval = .false., &
730 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
744 &
xtr(ng)%Rindex, gtype, &
745 & lbi, ubi, lbj, ubj, scale, &
747 &
grid(ng) % vmask_full, &
750 & setfillval = .false., &
752 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
762 IF (.not.
allocated(vr2d))
THEN
763 allocate (vr2d(lbi:ubi,lbj:ubj))
764 vr2d(lbi:ubi,lbj:ubj)=0.0_r8
769 &
xtr(ng)%Rindex, gtype, &
770 & lbi, ubi, lbj, ubj, scale, &
772 &
grid(ng) % vmask_full, &
775 & setfillval = .false., &
777 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
786 vr2d(lbi:ubi,lbj:ubj)=0.0_r8
790 &
xtr(ng)%Rindex, gtype, &
791 & lbi, ubi, lbj, ubj, scale, &
793 &
grid(ng) % vmask_full, &
796 & setfillval = .false., &
798 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
811# ifdef ADJUST_BOUNDARY
821 & lbij, ubij,
nbrec(ng), scale, &
822 &
boundary(ng) % vbar_obc(lbij:,:,:, &
825 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
841 IF (.not.
allocated(ur2d))
THEN
842 allocate (ur2d(lbi:ubi,lbj:ubj))
843 ur2d(lbi:ubi,lbj:ubj)=0.0_r8
845 IF (.not.
allocated(vr2d))
THEN
846 allocate (vr2d(lbi:ubi,lbj:ubj))
847 vr2d(lbi:ubi,lbj:ubj)=0.0_r8
850 & lbi, ubi, lbj, ubj, &
851 &
grid(ng) % CosAngler, &
852 &
grid(ng) % SinAngler, &
854 &
grid(ng) % rmask_full, &
856 &
ocean(ng) % ubar(:,:,kout), &
857 &
ocean(ng) % vbar(:,:,kout), &
864 &
xtr(ng)%Rindex, gtype, &
865 & lbi, ubi, lbj, ubj, scale, &
867 &
grid(ng) % rmask_full, &
870 & setfillval = .false., &
872 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
883 &
xtr(ng)%Rindex, gtype, &
884 & lbi, ubi, lbj, ubj, scale, &
886 &
grid(ng) % rmask_full, &
889 & setfillval = .false., &
891 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
912 &
xtr(ng)%Rindex, gtype, &
913 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
915 &
grid(ng) % umask_full, &
917 &
ocean(ng) % u(:,:,:,nout), &
918 & setfillval = .false., &
920 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
929# if defined FORWARD_WRITE && defined FORWARD_RHS
933 &
xtr(ng)%Rindex, gtype, &
934 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
936 &
grid(ng) % umask_full, &
938 &
ocean(ng) % ru(:,:,:,nout), &
939 & setfillval = .false., &
941 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
952# ifdef ADJUST_BOUNDARY
962 & lbij, ubij, 1,
n(ng),
nbrec(ng), scale, &
963 &
boundary(ng) % u_obc(lbij:,:,:,:, &
966 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
985 &
xtr(ng)%Rindex, gtype, &
986 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
988 &
grid(ng) % vmask_full, &
990 &
ocean(ng) % v(:,:,:,nout), &
991 & setfillval = .false., &
993 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1002# if defined FORWARD_WRITE && defined FORWARD_RHS
1006 &
xtr(ng)%Rindex, gtype, &
1007 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
1009 &
grid(ng) % vmask_full, &
1011 &
ocean(ng) % rv(:,:,:,nout), &
1012 & setfillval = .false., &
1014 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1025# ifdef ADJUST_BOUNDARY
1035 & lbij, ubij, 1,
n(ng),
nbrec(ng), scale, &
1036 &
boundary(ng) % v_obc(lbij:,:,:,:, &
1039 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1055 IF (.not.
allocated(ur3d))
THEN
1056 allocate (ur3d(lbi:ubi,lbj:ubj,
n(ng)))
1057 ur3d(lbi:ubi,lbj:ubj,1:
n(ng))=0.0_r8
1059 IF (.not.
allocated(vr3d))
THEN
1060 allocate (vr3d(lbi:ubi,lbj:ubj,
n(ng)))
1061 vr3d(lbi:ubi,lbj:ubj,1:
n(ng))=0.0_r8
1064 & lbi, ubi, lbj, ubj, 1,
n(ng), &
1065 &
grid(ng) % CosAngler, &
1066 &
grid(ng) % SinAngler, &
1068 &
grid(ng) % rmask_full, &
1070 &
ocean(ng) % u(:,:,:,nout), &
1071 &
ocean(ng) % v(:,:,:,nout), &
1078 &
xtr(ng)%Rindex, gtype, &
1079 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
1081 &
grid(ng) % rmask_full, &
1084 & setfillval = .false., &
1086 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1097 &
xtr(ng)%Rindex, gtype, &
1098 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
1100 &
grid(ng) % rmask_full, &
1103 & setfillval = .false., &
1105 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1120 IF (.not.
allocated(wr3d))
THEN
1121 allocate (wr3d(lbi:ubi,lbj:ubj,0:
n(ng)))
1122 wr3d(lbi:ubi,lbj:ubj,0:
n(ng))=0.0_r8
1126 CALL scale_omega (ng, tile, lbi, ubi, lbj, ubj, 0,
n(ng), &
1133 &
xtr(ng)%Rindex, gtype, &
1134 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
1136 &
grid(ng) % rmask, &
1139 & setfillval = .false., &
1141 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1152# ifdef OMEGA_IMPLICIT
1157 IF (.not.
allocated(wr3d))
THEN
1158 allocate (wr3d(lbi:ubi,lbj:ubj,0:
n(ng)))
1159 wr3d(lbi:ubi,lbj:ubj,0:
n(ng))=0.0_r8
1163 CALL scale_omega (ng, tile, lbi, ubi, lbj, ubj, 0,
n(ng), &
1170 &
xtr(ng)%Rindex, gtype, &
1171 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
1173 &
grid(ng) % rmask, &
1176 & setfillval = .false., &
1178 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1197 &
xtr(ng)%Rindex, gtype, &
1198 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
1200 &
grid(ng) % rmask, &
1202 &
ocean(ng) % wvel, &
1203 & setfillval = .false., &
1205 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1222 &
xtr(ng)%Tid(itrc), &
1223 &
xtr(ng)%Rindex, gtype, &
1224 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
1226 &
grid(ng) % rmask, &
1228 &
ocean(ng) % t(:,:,:,nout,itrc), &
1229 & setfillval = .false., &
1231 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1243# ifdef ADJUST_BOUNDARY
1252 &
vname(1,ifield), &
1253 &
xtr(ng)%Vid(ifield), &
1255 & lbij, ubij, 1,
n(ng),
nbrec(ng), &
1257 &
boundary(ng) % t_obc(lbij:,:,:,:, &
1258 &
lbout(ng),itrc), &
1260 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1279 &
xtr(ng)%Rindex, gtype, &
1280 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
1282 &
grid(ng) % rmask, &
1284 &
ocean(ng) % rho, &
1285 & setfillval = .false., &
1287 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1306 &
xtr(ng)%Rindex, gtype, &
1307 & lbi, ubi, lbj, ubj, scale, &
1309 &
grid(ng) % rmask, &
1312 & setfillval = .false., &
1314 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1333 &
xtr(ng)%Rindex, gtype, &
1334 & lbi, ubi, lbj, ubj, scale, &
1336 &
grid(ng) % rmask, &
1339 & setfillval = .false., &
1341 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1351# if defined FORWARD_WRITE && defined LMD_NONLOCAL
1361 &
xtr(ng)%Rindex, gtype, &
1362 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
1364 &
grid(ng) % rmask, &
1366 &
mixing(ng) % ghats(:,:,:,i), &
1367 & setfillval = .false., &
1369 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1388 &
xtr(ng)%Rindex, gtype, &
1389 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
1391 &
grid(ng) % rmask, &
1394 & setfillval = .false., &
1396 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1413 &
xtr(ng)%Rindex, gtype, &
1414 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
1416 &
grid(ng) % rmask, &
1419 & setfillval = .false., &
1421 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1440 &
xtr(ng)%Rindex, gtype, &
1441 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
1443 &
grid(ng) % rmask, &
1446 & setfillval = .false., &
1448 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1458# if defined GLS_MIXING || defined MY25_MIXING
1467 &
xtr(ng)%Rindex, gtype, &
1468 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
1470 &
grid(ng) % rmask, &
1472 &
mixing(ng) % tke(:,:,:,nout), &
1473 & setfillval = .false., &
1475 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1484# ifdef FORWARD_WRITE
1490 &
xtr(ng)%Rindex, gtype, &
1491 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
1493 &
grid(ng) % rmask, &
1496 & setfillval = .false., &
1498 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1516 &
xtr(ng)%Rindex, gtype, &
1517 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
1519 &
grid(ng) % rmask, &
1521 &
mixing(ng) % gls(:,:,:,nout), &
1522 & setfillval = .false., &
1524 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1533# ifdef FORWARD_WRITE
1539 &
xtr(ng)%Rindex, gtype, &
1540 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
1542 &
grid(ng) % rmask, &
1545 & setfillval = .false., &
1547 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1556# if defined FORWARD_WRITE && defined GLS_MIXING
1562 &
xtr(ng)%Rindex, gtype, &
1563 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
1565 &
grid(ng) % rmask, &
1568 & setfillval = .false., &
1570 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1581# if defined BULK_FLUXES || defined ECOSIM || defined ATM_PRESS
1590 &
xtr(ng)%Rindex, gtype, &
1591 & lbi, ubi, lbj, ubj, scale, &
1593 &
grid(ng) % rmask, &
1596 & setfillval = .false., &
1598 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1608# if defined BULK_FLUXES
1617 &
xtr(ng)%Rindex, gtype, &
1618 & lbi, ubi, lbj, ubj, scale, &
1620 &
grid(ng) % rmask, &
1623 & setfillval = .false., &
1625 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1635# if defined BULK_FLUXES || defined ECOSIM
1644 &
xtr(ng)%Rindex, gtype, &
1645 & lbi, ubi, lbj, ubj, scale, &
1647 &
grid(ng) % rmask, &
1650 & setfillval = .false., &
1652 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1667 &
xtr(ng)%Rindex, gtype, &
1668 & lbi, ubi, lbj, ubj, scale, &
1670 &
grid(ng) % rmask, &
1673 & setfillval = .false., &
1675 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1688 IF (.not.
allocated(ur2d))
THEN
1689 allocate (ur2d(lbi:ubi,lbj:ubj))
1690 ur2d(lbi:ubi,lbj:ubj)=0.0_r8
1692 IF (.not.
allocated(vr2d))
THEN
1693 allocate (vr2d(lbi:ubi,lbj:ubj))
1694 vr2d(lbi:ubi,lbj:ubj)=0.0_r8
1697 & lbi, ubi, lbj, ubj, &
1698 &
grid(ng) % CosAngler, &
1699 &
grid(ng) % SinAngler, &
1701 &
grid(ng) % rmask_full, &
1711 &
xtr(ng)%Rindex, gtype, &
1712 & lbi, ubi, lbj, ubj, scale, &
1714 &
grid(ng) % rmask, &
1717 & setfillval = .false., &
1719 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1732 &
xtr(ng)%Rindex, gtype, &
1733 & lbi, ubi, lbj, ubj, scale, &
1735 &
grid(ng) % rmask, &
1738 & setfillval = .false., &
1740 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1757 IF (itrc.eq.
itemp)
THEN
1763 ELSE IF (itrc.eq.
isalt)
THEN
1769 &
xtr(ng)%Rindex, gtype, &
1770 & lbi, ubi, lbj, ubj, scale, &
1772 &
grid(ng) % rmask, &
1774 &
forces(ng) % stflx(:,:,itrc), &
1775 & setfillval = .false., &
1777 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1789# if defined BULK_FLUXES || defined FRC_COUPLING
1798 &
xtr(ng)%Rindex, gtype, &
1799 & lbi, ubi, lbj, ubj, scale, &
1801 &
grid(ng) % rmask, &
1804 & setfillval = .false., &
1806 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1823 &
xtr(ng)%Rindex, gtype, &
1824 & lbi, ubi, lbj, ubj, scale, &
1826 &
grid(ng) % rmask, &
1829 & setfillval = .false., &
1831 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1848 &
xtr(ng)%Rindex, gtype, &
1849 & lbi, ubi, lbj, ubj, scale, &
1851 &
grid(ng) % rmask, &
1854 & setfillval = .false., &
1856 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1877 &
xtr(ng)%Rindex, gtype, &
1878 & lbi, ubi, lbj, ubj, scale, &
1880 &
grid(ng) % rmask, &
1883 & setfillval = .false., &
1885 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1902 &
xtr(ng)%Rindex, gtype, &
1903 & lbi, ubi, lbj, ubj, scale, &
1905 &
grid(ng) % rmask, &
1908 & setfillval = .false., &
1910 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1929 &
xtr(ng)%Rindex, gtype, &
1930 & lbi, ubi, lbj, ubj, scale, &
1932 &
grid(ng) % rmask, &
1935 & setfillval = .false., &
1937 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1956 &
xtr(ng)%Rindex, gtype, &
1957 & lbi, ubi, lbj, ubj, scale, &
1959 &
grid(ng) % rmask, &
1962 & setfillval = .false., &
1964 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1987 &
xtr(ng)%Rindex, gtype, &
1988 & lbi, ubi, lbj, ubj, scale, &
1990 &
grid(ng) % umask, &
1993 & setfillval = .false., &
1995 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2016 &
xtr(ng)%Rindex, gtype, &
2017 & lbi, ubi, lbj, ubj, scale, &
2019 &
grid(ng) % vmask, &
2022 & setfillval = .false., &
2024 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2041 &
xtr(ng)%Rindex, gtype, &
2042 & lbi, ubi, lbj, ubj, scale, &
2044 &
grid(ng) % umask, &
2047 & setfillval = .false., &
2049 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2066 &
xtr(ng)%Rindex, gtype, &
2067 & lbi, ubi, lbj, ubj, scale, &
2069 &
grid(ng) % vmask, &
2072 & setfillval = .false., &
2074 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2084# if (defined BBL_MODEL || defined WAVES_OUTPUT) && defined SOLVE3D
2091 & lbi, ubi, lbj, ubj, &
2096# if defined ICE_MODEL && defined SOLVE3D
2102 CALL ice_wrt_nf90 (ng, model, tile, &
2103 & lbi, ubi, lbj, ubj, &
2108# if defined SEDIMENT && defined SOLVE3D
2115 & lbi, ubi, lbj, ubj, &
2120# if defined WEC_VF && defined SOLVE3D
2126 CALL wec_wrt_nf90 (ng, model, tile, &
2127 & lbi, ubi, lbj, ubj, &
2140 10
FORMAT (2x,
'WRT_EXTRACT_NF90 - writing decimate', t42, &
2143 &
'fields (Index=',i1,
',',i1,
') in record = ',i0,t92,i2.2)
2145 &
'fields (Index=',i1,
',',i1,
') in record = ',i0)
2149 &
'fields (Index=',i1,
') in record = ',i0,t92,i2.2)
2151 &
'fields (Index=',i1,
') in record = ',i0)
2154 20
FORMAT (/,
' WRT_EXTRACT_NF90 - error while writing variable: ',a, &
2155 & /,20x,
'into decimate NetCDF file for time record: ',i0)
2158 END SUBROUTINE wrt_extract_nf90
2160# if defined PIO_LIB && defined DISTRIBUTE
2163 SUBROUTINE wrt_extract_pio (ng, model, tile, &
2164# ifdef ADJUST_BOUNDARY
2169 & LBi, UBi, LBj, UBj, &
2170 & iLB, iUB, jLB, jUB)
2177 integer,
intent(in) :: ng, model, tile
2178# ifdef ADJUST_BOUNDARY
2179 integer,
intent(in) :: LBij, UBij
2180 integer,
intent(in) :: ijLB, ijUB
2182 integer,
intent(in) :: LBi, UBi, LBj, UBj
2183 integer,
intent(in) :: iLB, iUB, jLB, jUB
2187 integer :: Fcount, ifield, status
2189 integer :: i, itrc, j, k
2194 real(r8),
allocatable :: Ur2d(:,:)
2195 real(r8),
allocatable :: Vr2d(:,:)
2197 real(r8),
allocatable :: Ur3d(:,:,:)
2198 real(r8),
allocatable :: Vr3d(:,:,:)
2199 real(r8),
allocatable :: Wr3d(:,:,:)
2202 character (len=*),
parameter :: MyFile = &
2203 & __FILE__//
", wrt_extract_pio"
2205 TYPE (IO_desc_t),
pointer :: ioDesX
2207# include "set_bounds.h"
2219 xtr(ng)%Rindex=
xtr(ng)%Rindex+1
2221 xtr(ng)%Nrec(fcount)=
xtr(ng)%Nrec(fcount)+1
2243 & (/
xtr(ng)%Rindex/), (/1/), &
2244 & piofile =
xtr(ng)%pioFile, &
2253 IF (
xtr(ng)%pioVar(
idpwet)%dkind.eq.pio_double)
THEN
2254 iodesx => iodesx_dp_p2dvar(ng)
2256 iodesx => iodesx_sp_p2dvar(ng)
2262 & ilb, iub, jlb, jub, scale, &
2264 & extract(ng) % pmask, &
2266 & extract(ng) % pmask_wet, &
2267 & setfillval = .false.)
2268 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2280 IF (
xtr(ng)%pioVar(
idrwet)%dkind.eq.pio_double)
THEN
2281 iodesx => iodesx_dp_r2dvar(ng)
2283 iodesx => iodesx_sp_r2dvar(ng)
2289 & ilb, iub, jlb, jub, scale, &
2291 & extract(ng) % rmask, &
2293 & extract(ng) % rmask_wet, &
2294 & setfillval = .false.)
2295 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2307 IF (
xtr(ng)%pioVar(
iduwet)%dkind.eq.pio_double)
THEN
2308 iodesx => iodesx_dp_u2dvar(ng)
2310 iodesx => iodesx_sp_u2dvar(ng)
2316 & ilb, iub, jlb, jub, scale, &
2318 & extract(ng) % umask, &
2320 & extract(ng) % umask_wet, &
2321 & setfillval = .false.)
2322 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2334 IF (
xtr(ng)%pioVar(
idvwet)%dkind.eq.pio_double)
THEN
2335 iodesx => iodesx_dp_v2dvar(ng)
2337 iodesx => iodesx_sp_v2dvar(ng)
2343 & ilb, iub, jlb, jub, scale, &
2345 & extract(ng) % vmask, &
2347 & extract(ng) % vmask_wet, &
2348 & setfillval = .false.)
2349 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2364 IF (
xtr(ng)%pioVar(
idpthr)%dkind.eq.pio_double)
THEN
2365 iodesx => iodesx_dp_r3dvar(ng)
2367 iodesx => iodesx_sp_r3dvar(ng)
2373 & ilb, iub, jlb, jub, 1,
n(ng), scale, &
2375 & extract(ng) % rmask, &
2377 & extract(ng) % z_r, &
2378 & setfillval = .false.)
2379 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2396 extract(ng)%z_v(i,j,k)=0.5_r8* &
2397 & (extract(ng)%z_r(i-1,j,k)+ &
2398 & extract(ng)%z_r(i ,j,k))
2402 IF (
xtr(ng)%pioVar(
idpthu)%dkind.eq.pio_double)
THEN
2403 iodesx => iodesx_dp_u3dvar(ng)
2405 iodesx => iodesx_sp_u3dvar(ng)
2411 & ilb, iub, jlb, jub, 1,
n(ng), scale, &
2413 & extract(ng) % umask, &
2415 & extract(ng) % z_v, &
2416 & setfillval = .false.)
2417 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2434 extract(ng)%z_v(i,j,k)=0.5_r8* &
2435 & (extract(ng)%z_r(i,j-1,k)+ &
2436 & extract(ng)%z_r(i,j ,k))
2440 IF (
xtr(ng)%pioVar(
idpthv)%dkind.eq.pio_double)
THEN
2441 iodesx => iodesx_dp_v3dvar(ng)
2443 iodesx => iodesx_sp_v3dvar(ng)
2449 & ilb, iub, jlb, jub, 1,
n(ng), scale, &
2451 & extract(ng) % vmask, &
2453 & extract(ng) % z_v, &
2454 & setfillval = .false.)
2455 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2469 IF (
xtr(ng)%pioVar(
idpthw)%dkind.eq.pio_double)
THEN
2470 iodesx => iodesx_dp_w3dvar(ng)
2472 iodesx => iodesx_sp_w3dvar(ng)
2478 & ilb, iub, jlb, jub, 0,
n(ng), scale, &
2480 & extract(ng) % rmask, &
2482 & extract(ng) % z_w, &
2483 & setfillval = .false.)
2484 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2499 IF (
xtr(ng)%pioVar(
idfsur)%dkind.eq.pio_double)
THEN
2500 iodesx => iodesx_dp_r2dvar(ng)
2502 iodesx => iodesx_sp_r2dvar(ng)
2508 & lbi, ubi, lbj, ubj, scale, &
2510 &
grid(ng) % rmask, &
2512 &
ocean(ng) % zeta(:,:,kout), &
2513 & setfillval = .false., &
2515 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2524# if defined FORWARD_WRITE && defined FORWARD_RHS
2526 IF (
xtr(ng)%pioVar(
idrzet)%dkind.eq.pio_double)
THEN
2527 iodesx => iodesx_dp_r2dvar(ng)
2529 iodesx => iodesx_sp_r2dvar(ng)
2535 & lbi, ubi, lbj, ubj, scale, &
2537 &
grid(ng) % rmask, &
2539 &
ocean(ng) % rzeta(:,:,kout), &
2540 & setfillval = .false., &
2542 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2553# ifdef ADJUST_BOUNDARY
2560 iodesx => iodesx_dp_r2dobc(ng)
2562 iodesx => iodesx_sp_r2dobc(ng)
2565 &
xtr(ng)%pioFile, &
2570 & lbij, ubij,
nbrec(ng), scale, &
2571 &
boundary(ng) % zeta_obc(lbij:,:,:, &
2574 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2590 IF (
xtr(ng)%pioVar(
idubar)%dkind.eq.pio_double)
THEN
2591 iodesx => iodesx_dp_u2dvar(ng)
2593 iodesx => iodesx_sp_u2dvar(ng)
2599 & lbi, ubi, lbj, ubj, scale, &
2601 &
grid(ng) % umask_full, &
2603 &
ocean(ng) % ubar(:,:,kout), &
2604 & setfillval = .false., &
2606 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2615# ifdef FORWARD_WRITE
2618 IF (
xtr(ng)%pioVar(
idru2d)%dkind.eq.pio_double)
THEN
2619 iodesx => iodesx_dp_u2dvar(ng)
2621 iodesx => iodesx_sp_u2dvar(ng)
2627 & lbi, ubi, lbj, ubj, scale, &
2629 &
grid(ng) % umask_full, &
2631 &
ocean(ng) % rubar(:,:,kout), &
2632 & setfillval = .false., &
2634 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2646 IF (
xtr(ng)%pioVar(
idruct)%dkind.eq.pio_double)
THEN
2647 iodesx => iodesx_dp_u2dvar(ng)
2649 iodesx => iodesx_sp_u2dvar(ng)
2655 & lbi, ubi, lbj, ubj, scale, &
2657 &
grid(ng) % umask_full, &
2660 & setfillval = .false., &
2662 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2672 IF (
xtr(ng)%pioVar(
idufx1)%dkind.eq.pio_double)
THEN
2673 iodesx => iodesx_dp_u2dvar(ng)
2675 iodesx => iodesx_sp_u2dvar(ng)
2677 IF (.not.
allocated(ur2d))
THEN
2678 allocate (ur2d(lbi:ubi,lbj:ubj))
2679 ur2d(lbi:ubi,lbj:ubj)=0.0_r8
2686 & lbi, ubi, lbj, ubj, scale, &
2688 &
grid(ng) % umask_full, &
2691 & setfillval = .false., &
2693 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2702 IF (
xtr(ng)%pioVar(
idufx2)%dkind.eq.pio_double)
THEN
2703 iodesx => iodesx_dp_u2dvar(ng)
2705 iodesx => iodesx_sp_u2dvar(ng)
2707 ur2d(lbi:ubi,lbj:ubj)=0.0_r8
2713 & lbi, ubi, lbj, ubj, scale, &
2715 &
grid(ng) % umask_full, &
2718 & setfillval = .false., &
2720 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2733# ifdef ADJUST_BOUNDARY
2740 iodesx => iodesx_dp_u2dobc(ng)
2742 iodesx => iodesx_sp_u2dobc(ng)
2745 &
xtr(ng)%pioFile, &
2750 & lbij, ubij,
nbrec(ng), scale, &
2751 &
boundary(ng) % ubar_obc(lbij:,:,:, &
2754 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2770 IF (
xtr(ng)%pioVar(
idvbar)%dkind.eq.pio_double)
THEN
2771 iodesx => iodesx_dp_v2dvar(ng)
2773 iodesx => iodesx_sp_v2dvar(ng)
2779 & lbi, ubi, lbj, ubj, scale, &
2781 &
grid(ng) % vmask_full, &
2783 &
ocean(ng) % vbar(:,:,kout), &
2784 & setfillval = .false., &
2786 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2795# ifdef FORWARD_WRITE
2798 IF (
xtr(ng)%pioVar(
idrv2d)%dkind.eq.pio_double)
THEN
2799 iodesx => iodesx_dp_v2dvar(ng)
2801 iodesx => iodesx_sp_v2dvar(ng)
2807 & lbi, ubi, lbj, ubj, scale, &
2809 &
grid(ng) % vmask_full, &
2811 &
ocean(ng) % rvbar(:,:,kout), &
2812 & setfillval = .false., &
2814 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2826 IF (
xtr(ng)%pioVar(
idrvct)%dkind.eq.pio_double)
THEN
2827 iodesx => iodesx_dp_v2dvar(ng)
2829 iodesx => iodesx_sp_v2dvar(ng)
2835 & lbi, ubi, lbj, ubj, scale, &
2837 &
grid(ng) % vmask_full, &
2840 & setfillval = .false., &
2842 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2852 IF (
xtr(ng)%pioVar(
idvfx1)%dkind.eq.pio_double)
THEN
2853 iodesx => iodesx_dp_v2dvar(ng)
2855 iodesx => iodesx_sp_v2dvar(ng)
2857 IF (.not.
allocated(vr2d))
THEN
2858 allocate (vr2d(lbi:ubi,lbj:ubj))
2859 vr2d(lbi:ubi,lbj:ubj)=0.0_r8
2866 & lbi, ubi, lbj, ubj, scale, &
2868 &
grid(ng) % vmask_full, &
2871 & setfillval = .false., &
2873 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2882 IF (
xtr(ng)%pioVar(
idvfx2)%dkind.eq.pio_double)
THEN
2883 iodesx => iodesx_dp_v2dvar(ng)
2886 iodesx => iodesx_sp_v2dvar(ng)
2888 vr2d(lbi:ubi,lbj:ubj)=0.0_r8
2894 & lbi, ubi, lbj, ubj, scale, &
2896 &
grid(ng) % vmask_full, &
2899 & setfillval = .false., &
2901 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2914# ifdef ADJUST_BOUNDARY
2921 iodesx => iodesx_dp_v2dobc(ng)
2923 iodesx => iodesx_sp_v2dobc(ng)
2926 &
xtr(ng)%pioFile, &
2931 & lbij, ubij,
nbrec(ng), scale, &
2932 &
boundary(ng) % vbar_obc(lbij:,:,:, &
2935 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2951 IF (.not.
allocated(ur2d))
THEN
2952 allocate (ur2d(lbi:ubi,lbj:ubj))
2953 ur2d(lbi:ubi,lbj:ubj)=0.0_r8
2955 IF (.not.
allocated(vr2d))
THEN
2956 allocate (vr2d(lbi:ubi,lbj:ubj))
2957 vr2d(lbi:ubi,lbj:ubj)=0.0_r8
2960 & lbi, ubi, lbj, ubj, &
2961 &
grid(ng) % CosAngler, &
2962 &
grid(ng) % SinAngler, &
2964 &
grid(ng) % rmask_full, &
2966 &
ocean(ng) % ubar(:,:,kout), &
2967 &
ocean(ng) % vbar(:,:,kout), &
2971 IF (
xtr(ng)%pioVar(
idu2de)%dkind.eq.pio_double)
THEN
2972 iodesx => iodesx_dp_r2dvar(ng)
2974 iodesx => iodesx_sp_r2dvar(ng)
2980 & lbi, ubi, lbj, ubj, scale, &
2982 &
grid(ng) % rmask_full, &
2985 & setfillval = .false., &
2987 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
2996 IF (
xtr(ng)%pioVar(
idv2dn)%dkind.eq.pio_double)
THEN
2997 iodesx => iodesx_dp_r2dvar(ng)
2999 iodesx => iodesx_sp_r2dvar(ng)
3005 & lbi, ubi, lbj, ubj, scale, &
3007 &
grid(ng) % rmask_full, &
3010 & setfillval = .false., &
3012 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3030 IF (
xtr(ng)%pioVar(
iduvel)%dkind.eq.pio_double)
THEN
3031 iodesx => iodesx_dp_u3dvar(ng)
3033 iodesx => iodesx_sp_u3dvar(ng)
3039 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
3041 &
grid(ng) % umask_full, &
3043 &
ocean(ng) % u(:,:,:,nout), &
3044 & setfillval = .false., &
3046 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3055# if defined FORWARD_WRITE && defined FORWARD_RHS
3057 IF (
xtr(ng)%pioVar(
idru3d)%dkind.eq.pio_double)
THEN
3058 iodesx => iodesx_dp_u3dvar(ng)
3060 iodesx => iodesx_sp_u3dvar(ng)
3066 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
3068 &
grid(ng) % umask_full, &
3070 &
ocean(ng) % ru(:,:,:,nout), &
3071 & setfillval = .false., &
3073 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3084# ifdef ADJUST_BOUNDARY
3091 iodesx => iodesx_dp_u3dobc(ng)
3093 iodesx => iodesx_sp_u3dobc(ng)
3096 &
xtr(ng)%pioFile, &
3101 & lbij, ubij, 1,
n(ng),
nbrec(ng), scale, &
3102 &
boundary(ng) % u_obc(lbij:,:,:,:, &
3105 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3121 IF (
xtr(ng)%pioVar(
idvvel)%dkind.eq.pio_double)
THEN
3122 iodesx => iodesx_dp_v3dvar(ng)
3124 iodesx => iodesx_sp_v3dvar(ng)
3130 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
3132 &
grid(ng) % vmask_full, &
3134 &
ocean(ng) % v(:,:,:,nout), &
3135 & setfillval = .false., &
3137 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3146# if defined FORWARD_WRITE && defined FORWARD_RHS
3148 IF (
xtr(ng)%pioVar(
idrv3d)%dkind.eq.pio_double)
THEN
3149 iodesx => iodesx_dp_v3dvar(ng)
3151 iodesx => iodesx_sp_v3dvar(ng)
3157 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
3159 &
grid(ng) % vmask_full, &
3161 &
ocean(ng) % rv(:,:,:,nout), &
3162 & setfillval = .false., &
3164 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3175# ifdef ADJUST_BOUNDARY
3182 iodesx => iodesx_dp_v3dobc(ng)
3184 iodesx => iodesx_sp_v3dobc(ng)
3187 &
xtr(ng)%pioFile, &
3192 & lbij, ubij, 1,
n(ng),
nbrec(ng), scale, &
3193 &
boundary(ng) % v_obc(lbij:,:,:,:, &
3196 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3212 IF (.not.
allocated(ur3d))
THEN
3213 allocate (ur3d(lbi:ubi,lbj:ubj,
n(ng)))
3214 ur3d(lbi:ubi,lbj:ubj,1:
n(ng))=0.0_r8
3216 IF (.not.
allocated(vr3d))
THEN
3217 allocate (vr3d(lbi:ubi,lbj:ubj,
n(ng)))
3218 vr3d(lbi:ubi,lbj:ubj,1:
n(ng))=0.0_r8
3221 & lbi, ubi, lbj, ubj, 1,
n(ng), &
3222 &
grid(ng) % CosAngler, &
3223 &
grid(ng) % SinAngler, &
3225 &
grid(ng) % rmask_full, &
3227 &
ocean(ng) % u(:,:,:,nout), &
3228 &
ocean(ng) % v(:,:,:,nout), &
3232 IF (
xtr(ng)%pioVar(
idu3de)%dkind.eq.pio_double)
THEN
3233 iodesx => iodesx_dp_r3dvar(ng)
3235 iodesx => iodesx_sp_r3dvar(ng)
3241 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
3243 &
grid(ng) % rmask_full, &
3246 & setfillval = .false., &
3248 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3257 IF (
xtr(ng)%pioVar(
idv3dn)%dkind.eq.pio_double)
THEN
3258 iodesx => iodesx_dp_r3dvar(ng)
3260 iodesx => iodesx_sp_r3dvar(ng)
3266 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
3268 &
grid(ng) % rmask_full, &
3271 & setfillval = .false., &
3273 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3288 IF (.not.
allocated(wr3d))
THEN
3289 allocate (wr3d(lbi:ubi,lbj:ubj,0:
n(ng)))
3290 wr3d(lbi:ubi,lbj:ubj,0:
n(ng))=0.0_r8
3293 CALL scale_omega (ng, tile, lbi, ubi, lbj, ubj, 0,
n(ng), &
3299 IF (
xtr(ng)%pioVar(
idovel)%dkind.eq.pio_double)
THEN
3300 iodesx => iodesx_dp_w3dvar(ng)
3302 iodesx => iodesx_sp_w3dvar(ng)
3308 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
3310 &
grid(ng) % rmask, &
3313 & setfillval = .false., &
3315 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3326# ifdef OMEGA_IMPLICIT
3331 IF (.not.
allocated(wr3d))
THEN
3332 allocate (wr3d(lbi:ubi,lbj:ubj,0:
n(ng)))
3333 wr3d(lbi:ubi,lbj:ubj,0:
n(ng))=0.0_r8
3336 CALL scale_omega (ng, tile, lbi, ubi, lbj, ubj, 0,
n(ng), &
3342 IF (
xtr(ng)%pioVar(
idovil)%dkind.eq.pio_double)
THEN
3343 iodesx => iodesx_dp_w3dvar(ng)
3345 iodesx => iodesx_sp_w3dvar(ng)
3351 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
3353 &
grid(ng) % rmask, &
3356 & setfillval = .false., &
3358 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3374 IF (
xtr(ng)%pioVar(
idwvel)%dkind.eq.pio_double)
THEN
3375 iodesx => iodesx_dp_w3dvar(ng)
3377 iodesx => iodesx_sp_w3dvar(ng)
3383 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
3385 &
grid(ng) % rmask, &
3387 &
ocean(ng) % wvel, &
3388 & setfillval = .false., &
3390 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3405 IF (
xtr(ng)%pioTrc(itrc)%dkind.eq.pio_double)
THEN
3406 iodesx => iodesx_dp_r3dvar(ng)
3408 iodesx => iodesx_sp_r3dvar(ng)
3411 &
xtr(ng)%pioTrc(itrc), &
3414 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
3416 &
grid(ng) % rmask, &
3418 &
ocean(ng) % t(:,:,:,nout,itrc), &
3419 & setfillval = .false., &
3421 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3433# ifdef ADJUST_BOUNDARY
3441 IF (
xtr(ng)%pioVar(ifield)%dkind.eq.pio_double)
THEN
3442 iodesx => iodesx_dp_r3dobc(ng)
3444 iodesx => iodesx_sp_r3dobc(ng)
3447 &
xtr(ng)%pioFile, &
3448 &
vname(1,ifield), &
3449 &
xtr(ng)%pioVar(ifield), &
3452 & lbij, ubij, 1,
n(ng),
nbrec(ng), &
3454 &
boundary(ng) % t_obc(lbij:,:,:,:, &
3455 &
lbout(ng),itrc), &
3457 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3473 IF (
xtr(ng)%pioVar(
iddano)%dkind.eq.pio_double)
THEN
3474 iodesx => iodesx_dp_r3dvar(ng)
3476 iodesx => iodesx_sp_r3dvar(ng)
3482 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
3484 &
grid(ng) % rmask, &
3486 &
ocean(ng) % rho, &
3487 & setfillval = .false., &
3489 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3505 IF (
xtr(ng)%pioVar(
idhsbl)%dkind.eq.pio_double)
THEN
3506 iodesx => iodesx_dp_r2dvar(ng)
3508 iodesx => iodesx_sp_r2dvar(ng)
3514 & lbi, ubi, lbj, ubj, scale, &
3516 &
grid(ng) % rmask, &
3519 & setfillval = .false., &
3521 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3537 IF (
xtr(ng)%pioVar(
idhbbl)%dkind.eq.pio_double)
THEN
3538 iodesx => iodesx_dp_r2dvar(ng)
3540 iodesx => iodesx_sp_r2dvar(ng)
3546 & lbi, ubi, lbj, ubj, scale, &
3548 &
grid(ng) % rmask, &
3551 & setfillval = .false., &
3553 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3563# if defined FORWARD_WRITE && defined LMD_NONLOCAL
3570 IF (
xtr(ng)%pioVar(
idghat(i))%dkind.eq.pio_double)
THEN
3571 iodesx => iodesx_dp_w3dvar(ng)
3573 iodesx => iodesx_sp_w3dvar(ng)
3579 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
3581 &
grid(ng) % rmask, &
3583 &
mixing(ng) % ghats(:,:,:,i), &
3584 & setfillval = .false., &
3586 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3602 IF (
xtr(ng)%pioVar(
idvvis)%dkind.eq.pio_double)
THEN
3603 iodesx => iodesx_dp_w3dvar(ng)
3605 iodesx => iodesx_sp_w3dvar(ng)
3611 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
3613 &
grid(ng) % rmask, &
3616 & setfillval = .false., &
3618 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3632 IF (
xtr(ng)%pioVar(
idtdif)%dkind.eq.pio_double)
THEN
3633 iodesx => iodesx_dp_w3dvar(ng)
3635 iodesx => iodesx_sp_w3dvar(ng)
3641 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
3643 &
grid(ng) % rmask, &
3646 & setfillval = .false., &
3648 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3664 IF (
xtr(ng)%pioVar(
idsdif)%dkind.eq.pio_double)
THEN
3665 iodesx => iodesx_dp_w3dvar(ng)
3667 iodesx => iodesx_sp_w3dvar(ng)
3673 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
3675 &
grid(ng) % rmask, &
3678 & setfillval = .false., &
3680 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3690# if defined GLS_MIXING || defined MY25_MIXING
3696 IF (
xtr(ng)%pioVar(
idmtke)%dkind.eq.pio_double)
THEN
3697 iodesx => iodesx_dp_w3dvar(ng)
3699 iodesx => iodesx_sp_w3dvar(ng)
3705 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
3707 &
grid(ng) % rmask, &
3709 &
mixing(ng) % tke(:,:,:,nout), &
3710 & setfillval = .false., &
3712 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3721# ifdef FORWARD_WRITE
3724 IF (
xtr(ng)%pioVar(
idvmkk)%dkind.eq.pio_double)
THEN
3725 iodesx => iodesx_dp_w3dvar(ng)
3727 iodesx => iodesx_sp_w3dvar(ng)
3733 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
3735 &
grid(ng) % rmask, &
3738 & setfillval = .false., &
3740 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3755 IF (
xtr(ng)%pioVar(
idmtls)%dkind.eq.pio_double)
THEN
3756 iodesx => iodesx_dp_w3dvar(ng)
3758 iodesx => iodesx_sp_w3dvar(ng)
3764 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
3766 &
grid(ng) % rmask, &
3768 &
mixing(ng) % gls(:,:,:,nout), &
3769 & setfillval = .false., &
3771 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3780# ifdef FORWARD_WRITE
3782 IF (
xtr(ng)%pioVar(
idvmls)%dkind.eq.pio_double)
THEN
3783 iodesx => iodesx_dp_w3dvar(ng)
3785 iodesx => iodesx_sp_w3dvar(ng)
3792 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
3794 &
grid(ng) % rmask, &
3797 & setfillval = .false., &
3799 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3808# if defined FORWARD_WRITE && defined GLS_MIXING
3811 IF (
xtr(ng)%pioVar(
idvmkp)%dkind.eq.pio_double)
THEN
3812 iodesx => iodesx_dp_w3dvar(ng)
3814 iodesx => iodesx_sp_w3dvar(ng)
3820 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
3822 &
grid(ng) % rmask, &
3825 & setfillval = .false., &
3827 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3838# if defined BULK_FLUXES || defined ECOSIM || defined ATM_PRESS
3844 IF (
xtr(ng)%pioVar(
idpair)%dkind.eq.pio_double)
THEN
3845 iodesx => iodesx_dp_r2dvar(ng)
3847 iodesx => iodesx_sp_r2dvar(ng)
3853 & lbi, ubi, lbj, ubj, scale, &
3855 &
grid(ng) % rmask, &
3858 & setfillval = .false., &
3860 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3870# if defined BULK_FLUXES
3876 IF (
xtr(ng)%pioVar(
idtair)%dkind.eq.pio_double)
THEN
3877 iodesx => iodesx_dp_r2dvar(ng)
3879 iodesx => iodesx_sp_r2dvar(ng)
3885 & lbi, ubi, lbj, ubj, scale, &
3887 &
grid(ng) % rmask, &
3890 & setfillval = .false., &
3892 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3902# if defined BULK_FLUXES || defined ECOSIM
3908 IF (
xtr(ng)%pioVar(
iduair)%dkind.eq.pio_double)
THEN
3909 iodesx => iodesx_dp_r2dvar(ng)
3911 iodesx => iodesx_sp_r2dvar(ng)
3917 & lbi, ubi, lbj, ubj, scale, &
3919 &
grid(ng) % rmask, &
3922 & setfillval = .false., &
3924 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3936 IF (
xtr(ng)%pioVar(
idvair)%dkind.eq.pio_double)
THEN
3937 iodesx => iodesx_dp_r2dvar(ng)
3939 iodesx => iodesx_sp_r2dvar(ng)
3945 & lbi, ubi, lbj, ubj, scale, &
3947 &
grid(ng) % rmask, &
3950 & setfillval = .false., &
3952 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
3965 IF (.not.
allocated(ur2d))
THEN
3966 allocate (ur2d(lbi:ubi,lbj:ubj))
3967 ur2d(lbi:ubi,lbj:ubj)=0.0_r8
3969 IF (.not.
allocated(vr2d))
THEN
3970 allocate (vr2d(lbi:ubi,lbj:ubj))
3971 vr2d(lbi:ubi,lbj:ubj)=0.0_r8
3974 & lbi, ubi, lbj, ubj, &
3975 &
grid(ng) % CosAngler, &
3976 &
grid(ng) % SinAngler, &
3978 &
grid(ng) % rmask_full, &
3985 IF (
xtr(ng)%pioVar(
iduaie)%dkind.eq.pio_double)
THEN
3986 iodesx => iodesx_dp_r2dvar(ng)
3988 iodesx => iodesx_sp_r2dvar(ng)
3994 & lbi, ubi, lbj, ubj, scale, &
3996 &
grid(ng) % rmask, &
3999 & setfillval = .false., &
4001 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
4011 IF (
xtr(ng)%pioVar(
idvain)%dkind.eq.pio_double)
THEN
4012 iodesx => iodesx_dp_r2dvar(ng)
4014 iodesx => iodesx_sp_r2dvar(ng)
4020 & lbi, ubi, lbj, ubj, scale, &
4022 &
grid(ng) % rmask, &
4025 & setfillval = .false., &
4027 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
4044 IF (itrc.eq.
itemp)
THEN
4050 ELSE IF (itrc.eq.
isalt)
THEN
4053 IF (
xtr(ng)%pioVar(
idtsur(itrc))%dkind.eq.pio_double)
THEN
4054 iodesx => iodesx_dp_r2dvar(ng)
4056 iodesx => iodesx_sp_r2dvar(ng)
4062 & lbi, ubi, lbj, ubj, scale, &
4064 &
grid(ng) % rmask, &
4066 &
forces(ng) % stflx(:,:,itrc), &
4067 & setfillval = .false., &
4069 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
4081# if defined BULK_FLUXES || defined FRC_COUPLING
4087 IF (
xtr(ng)%pioVar(
idlhea)%dkind.eq.pio_double)
THEN
4088 iodesx => iodesx_dp_r2dvar(ng)
4090 iodesx => iodesx_sp_r2dvar(ng)
4096 & lbi, ubi, lbj, ubj, scale, &
4098 &
grid(ng) % rmask, &
4101 & setfillval = .false., &
4103 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
4117 IF (
xtr(ng)%pioVar(
idshea)%dkind.eq.pio_double)
THEN
4118 iodesx => iodesx_dp_r2dvar(ng)
4120 iodesx => iodesx_sp_r2dvar(ng)
4126 & lbi, ubi, lbj, ubj, scale, &
4128 &
grid(ng) % rmask, &
4131 & setfillval = .false., &
4133 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
4147 IF (
xtr(ng)%pioVar(
idlrad)%dkind.eq.pio_double)
THEN
4148 iodesx => iodesx_dp_r2dvar(ng)
4150 iodesx => iodesx_sp_r2dvar(ng)
4156 & lbi, ubi, lbj, ubj, scale, &
4158 &
grid(ng) % rmask, &
4161 & setfillval = .false., &
4163 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
4181 IF (
xtr(ng)%pioVar(
idevap)%dkind.eq.pio_double)
THEN
4182 iodesx => iodesx_dp_r2dvar(ng)
4184 iodesx => iodesx_sp_r2dvar(ng)
4190 & lbi, ubi, lbj, ubj, scale, &
4192 &
grid(ng) % rmask, &
4195 & setfillval = .false., &
4197 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
4211 IF (
xtr(ng)%pioVar(
idrain)%dkind.eq.pio_double)
THEN
4212 iodesx => iodesx_dp_r2dvar(ng)
4214 iodesx => iodesx_sp_r2dvar(ng)
4220 & lbi, ubi, lbj, ubj, scale, &
4222 &
grid(ng) % rmask, &
4225 & setfillval = .false., &
4227 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
4243 IF (
xtr(ng)%pioVar(
idempf)%dkind.eq.pio_double)
THEN
4244 iodesx => iodesx_dp_r2dvar(ng)
4246 iodesx => iodesx_sp_r2dvar(ng)
4252 & lbi, ubi, lbj, ubj, scale, &
4254 &
grid(ng) % rmask, &
4257 & setfillval = .false., &
4259 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
4275 IF (
xtr(ng)%pioVar(
idsrad)%dkind.eq.pio_double)
THEN
4276 iodesx => iodesx_dp_r2dvar(ng)
4278 iodesx => iodesx_sp_r2dvar(ng)
4284 & lbi, ubi, lbj, ubj, scale, &
4286 &
grid(ng) % rmask, &
4289 & setfillval = .false., &
4291 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
4311 IF (
xtr(ng)%pioVar(
idusms)%dkind.eq.pio_double)
THEN
4312 iodesx => iodesx_dp_u2dvar(ng)
4314 iodesx => iodesx_sp_u2dvar(ng)
4320 & lbi, ubi, lbj, ubj, scale, &
4322 &
grid(ng) % umask, &
4325 & setfillval = .false., &
4327 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
4345 IF (
xtr(ng)%pioVar(
idvsms)%dkind.eq.pio_double)
THEN
4346 iodesx => iodesx_dp_v2dvar(ng)
4348 iodesx => iodesx_sp_v2dvar(ng)
4354 & lbi, ubi, lbj, ubj, scale, &
4356 &
grid(ng) % vmask, &
4359 & setfillval = .false., &
4361 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
4375 IF (
xtr(ng)%pioVar(
idubms)%dkind.eq.pio_double)
THEN
4376 iodesx => iodesx_dp_u2dvar(ng)
4378 iodesx => iodesx_sp_u2dvar(ng)
4384 & lbi, ubi, lbj, ubj, scale, &
4386 &
grid(ng) % umask, &
4389 & setfillval = .false., &
4391 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
4405 IF (
xtr(ng)%pioVar(
idvbms)%dkind.eq.pio_double)
THEN
4406 iodesx => iodesx_dp_v2dvar(ng)
4408 iodesx => iodesx_sp_v2dvar(ng)
4414 & lbi, ubi, lbj, ubj, scale, &
4416 &
grid(ng) % vmask, &
4419 & setfillval = .false., &
4421 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
4431# if (defined BBL_MODEL || defined WAVES_OUTPUT) && defined SOLVE3D
4438 & lbi, ubi, lbj, ubj, &
4443# if defined ICE_MODEL && defined SOLVE3D
4449 CALL ice_wrt_pio (ng, model, tile, &
4450 & lbi, ubi, lbj, ubj, &
4455# if defined SEDIMENT && defined SOLVE3D
4462 & lbi, ubi, lbj, ubj, &
4467# if defined WEC_VF && defined SOLVE3D
4473 CALL wec_wrt_pio (ng, model, tile, &
4474 & lbi, ubi, lbj, ubj, &
4487 10
FORMAT (2x,
'WRT_EXTRACT_PIO - writing extract', t42, &
4490 &
'fields (Index=',i1,
',',i1,
') in record = ',i0,t92,i2.2)
4492 &
'fields (Index=',i1,
',',i1,
') in record = ',i0)
4496 &
'fields (Index=',i1,
') in record = ',i0,t92,i2.2)
4498 &
'fields (Index=',i1,
') in record = ',i0)
4501 20
FORMAT (/,
' WRT_EXTRACT_PIO - error while writing variable: ',a, &
4502 & /,19x,
'into decimate NetCDF file for time record: ',i0)
4505 END SUBROUTINE wrt_extract_pio
subroutine, public bbl_wrt_pio(ng, model, tile, lbi, ubi, lbj, ubj, varout, s)
subroutine, public bbl_wrt_nf90(ng, model, tile, lbi, ubi, lbj, ubj, varout, s)
type(t_boundary), dimension(:), allocatable boundary
type(t_coupling), dimension(:), allocatable coupling
type(t_forces), dimension(:), allocatable forces
type(t_grid), dimension(:), allocatable grid
type(t_io), dimension(:), allocatable xtr
character(len=256) sourcefile
type(t_mixing), dimension(:), allocatable mixing
logical, dimension(:,:), allocatable hout
integer, parameter io_nf90
integer, dimension(:), allocatable idsbry
integer, parameter io_pio
integer, dimension(:), allocatable idtsur
integer, dimension(:), allocatable idtvar
integer, dimension(:), allocatable istvar
integer, dimension(2) idghat
character(len=maxlen), dimension(6, 0:nv) vname
subroutine, public netcdf_sync(ng, model, ncname, ncid)
type(t_ocean), dimension(:), allocatable ocean
integer, dimension(:), allocatable n
type(t_bounds), dimension(:), allocatable bounds
integer, parameter r3dvar
integer, parameter u3dvar
integer, parameter u2dvar
integer, parameter w3dvar
integer, parameter p2dvar
integer, dimension(:), allocatable nt
integer, parameter r2dvar
integer, parameter v2dvar
integer, parameter v3dvar
subroutine, public pio_netcdf_sync(ng, model, ncname, piofile)
logical, dimension(:,:,:), allocatable lobc
integer, dimension(:), allocatable extractflag
real(dp), dimension(:), allocatable time
integer, dimension(:), allocatable nbrec
integer, dimension(:), allocatable lbout
subroutine, public scale_omega(ng, tile, lbi, ubi, lbj, ubj, lbk, ubk, pm, pn, w, wscl)
subroutine, public sediment_wrt_nf90(ng, model, tile, lbi, ubi, lbj, ubj, varout, s)
subroutine, public sediment_wrt_pio(ng, model, tile, lbi, ubi, lbj, ubj, varout, s)
logical function, public founderror(flag, noerr, line, routine)
subroutine, public uv_rotate3d(ng, tile, add, lboundary, lbi, ubi, lbj, ubj, lbk, ubk, cosangler, sinangler, rmask_full, uinp, vinp, uout, vout)
subroutine, public uv_rotate2d(ng, tile, add, lboundary, lbi, ubi, lbj, ubj, cosangler, sinangler, rmask_full, uinp, vinp, uout, vout)