109 & LBi, UBi, LBj, UBj)
116 integer,
intent(in) :: ng, model, tile
117 integer,
intent(in) :: lbi, ubi, lbj, ubj
121 integer :: fcount, gfactor, gtype, i, itrc, status
122# if defined PERFECT_RESTART || defined SOLVE3D
128 character (len=*),
parameter :: myfile = &
129 & __FILE__//
", wrt_rst_nf90"
142#if !defined PERFECT_RESTART && \
143 (defined write_water && defined masking)
151 rst(ng)%Rindex=
rst(ng)%Rindex+1
152 fcount=
rst(ng)%Fcount
153 rst(ng)%Nrec(fcount)=
rst(ng)%Nrec(fcount)+1
175 rst(ng)%Rindex=mod(
rst(ng)%Rindex-1,2)+1
178#ifdef PERFECT_RESTART
185 & ntmp, (/
rst(ng)%Rindex/), (/1/), &
186 & ncid =
rst(ng)%ncid)
190 & ntmp, (/
rst(ng)%Rindex/), (/1/), &
191 & ncid =
rst(ng)%ncid)
196 & ntmp, (/
rst(ng)%Rindex/), (/1/), &
197 & ncid =
rst(ng)%ncid)
201 &
kstp(ng:), (/
rst(ng)%Rindex/), (/1/), &
202 & ncid =
rst(ng)%ncid)
206 &
krhs(ng:), (/
rst(ng)%Rindex/), (/1/), &
207 & ncid =
rst(ng)%ncid)
211 &
knew(ng:), (/
rst(ng)%Rindex/), (/1/), &
212 & ncid =
rst(ng)%ncid)
220 & (/
rst(ng)%Rindex/), (/1/), &
221 & ncid =
rst(ng)%ncid, &
225#if defined SEDIMENT && defined SED_MORPH
234 &
rst(ng)%Rindex, gtype, &
235 & lbi, ubi, lbj, ubj, scale, &
237 &
grid(ng) % rmask, &
240 & setfillval = .false.)
241 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
259 &
rst(ng)%Rindex, gtype, &
260 & lbi, ubi, lbj, ubj, scale, &
262 &
grid(ng) % pmask, &
264 &
grid(ng) % pmask_wet, &
265 & setfillval = .false.)
266 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
281 &
rst(ng)%Rindex, gtype, &
282 & lbi, ubi, lbj, ubj, scale, &
284 &
grid(ng) % rmask, &
286 &
grid(ng) % rmask_wet, &
287 & setfillval = .false.)
288 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
303 &
rst(ng)%Rindex, gtype, &
304 & lbi, ubi, lbj, ubj, scale, &
306 &
grid(ng) % umask, &
308 &
grid(ng) % umask_wet, &
309 & setfillval = .false.)
310 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
325 &
rst(ng)%Rindex, gtype, &
326 & lbi, ubi, lbj, ubj, scale, &
328 &
grid(ng) % vmask, &
330 &
grid(ng) % vmask_wet, &
331 & setfillval = .false.)
332 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
345#ifdef PERFECT_RESTART
349 &
rst(ng)%Rindex, gtype, &
350 & lbi, ubi, lbj, ubj, 1, 3, scale, &
352 &
grid(ng) % rmask, &
355 &
ocean(ng) % zeta, &
356 & setfillval = .false.)
364 &
rst(ng)%Rindex, gtype, &
365 & lbi, ubi, lbj, ubj, scale, &
367 &
grid(ng) % rmask, &
370 &
ocean(ng) % zeta(:,:,kout), &
371 & setfillval = .false.)
373 &
ocean(ng) % zeta(:,:,kout))
376 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
384#ifdef PERFECT_RESTART
392 &
rst(ng)%Rindex, gtype, &
393 & lbi, ubi, lbj, ubj, 1, 2, scale, &
395 &
grid(ng) % rmask, &
398 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
411#ifdef PERFECT_RESTART
415 &
rst(ng)%Rindex, gtype, &
416 & lbi, ubi, lbj, ubj, 1, 3, scale, &
418 &
grid(ng) % umask, &
420 &
ocean(ng) % ubar, &
421 & setfillval = .false.)
427 &
rst(ng)%Rindex, gtype, &
428 & lbi, ubi, lbj, ubj, scale, &
430 &
grid(ng) % umask_full, &
432 &
ocean(ng) % ubar(:,:,kout))
434 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
442#ifdef PERFECT_RESTART
450 &
rst(ng)%Rindex, gtype, &
451 & lbi, ubi, lbj, ubj, 1, 2, scale, &
453 &
grid(ng) % umask, &
455 &
ocean(ng) % rubar, &
456 & setfillval = .false.)
457 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
470#ifdef PERFECT_RESTART
474 &
rst(ng)%Rindex, gtype, &
475 & lbi, ubi, lbj, ubj, 1, 3, scale, &
477 &
grid(ng) % vmask, &
479 &
ocean(ng) % vbar, &
480 & setfillval = .false.)
485 &
rst(ng)%Rindex, gtype, &
486 & lbi, ubi, lbj, ubj, scale, &
488 &
grid(ng) % vmask_full, &
490 &
ocean(ng) % vbar(:,:,kout))
492 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
501#ifdef PERFECT_RESTART
509 &
rst(ng)%Rindex, gtype, &
510 & lbi, ubi, lbj, ubj, 1, 2, scale, &
512 &
grid(ng) % vmask, &
514 &
ocean(ng) % rvbar, &
515 & setfillval = .false.)
516 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
531# ifdef PERFECT_RESTART
534 &
rst(ng)%Rindex, gtype, &
535 & lbi, ubi, lbj, ubj, 1,
n(ng), 1, 2, scale, &
537 &
grid(ng) % umask, &
540 & setfillval = .false.)
544 &
rst(ng)%Rindex, gtype, &
545 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
547 &
grid(ng) % umask_full, &
549 &
ocean(ng) % u(:,:,:,nout))
551 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
560# ifdef PERFECT_RESTART
568 &
rst(ng)%Rindex, gtype, &
569 & lbi, ubi, lbj, ubj, 0,
n(ng), 1, 2, scale, &
571 &
grid(ng) % umask, &
574 & setfillval = .false.)
575 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
589# ifdef PERFECT_RESTART
592 &
rst(ng)%Rindex, gtype, &
593 & lbi, ubi, lbj, ubj, 1,
n(ng), 1, 2, scale, &
595 &
grid(ng) % vmask, &
598 & setfillval = .false.)
602 &
rst(ng)%Rindex, gtype, &
603 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
605 &
grid(ng) % vmask_full, &
607 &
ocean(ng) % v(:,:,:,nout))
609 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
618# ifdef PERFECT_RESTART
626 &
rst(ng)%Rindex, gtype, &
627 & lbi, ubi, lbj, ubj, 0,
n(ng), 1, 2, scale, &
629 &
grid(ng) % vmask, &
632 & setfillval = .false.)
633 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
648# ifdef PERFECT_RESTART
650 &
rst(ng)%Tid(itrc), &
651 &
rst(ng)%Rindex, gtype, &
652 & lbi, ubi, lbj, ubj, 1,
n(ng), 1, 2, scale, &
654 &
grid(ng) % rmask, &
656 &
ocean(ng) % t(:,:,:,:,itrc))
659 &
rst(ng)%Tid(itrc), &
660 &
rst(ng)%Rindex, gtype, &
661 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
663 &
grid(ng) % rmask, &
665 &
ocean(ng) % t(:,:,:,nout,itrc))
667 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
684 &
rst(ng)%Rindex, gtype, &
685 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
687 &
grid(ng) % rmask, &
690 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
707 &
rst(ng)%Rindex, gtype, &
708 & lbi, ubi, lbj, ubj, scale, &
710 &
grid(ng) % rmask, &
713 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
730 &
rst(ng)%Rindex, gtype, &
731 & lbi, ubi, lbj, ubj, scale, &
733 &
grid(ng) % rmask, &
736 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
745# if defined PERFECT_RESTART && defined LMD_NONLOCAL
754 &
rst(ng)%Rindex, gtype, &
755 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
757 &
grid(ng) % rmask, &
759 &
mixing(ng) % ghats(:,:,:,i))
760 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
770# if defined BVF_MIXING || defined GLS_MIXING || \
771 defined my25_mixing || defined lmd_mixing
779 &
rst(ng)%Rindex, gtype, &
780 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
782 &
grid(ng) % rmask, &
785 & setfillval = .false.)
786 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
801 &
rst(ng)%Rindex, gtype, &
802 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
804 &
grid(ng) % rmask, &
807 & setfillval = .false.)
809 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
826 &
rst(ng)%Rindex, gtype, &
827 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
829 &
grid(ng) % rmask, &
832 & setfillval = .false.)
833 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
843# if defined PERFECT_RESTART && \
844 (defined gls_mixing || defined my25_mixing)
852 &
rst(ng)%Rindex, gtype, &
853 & lbi, ubi, lbj, ubj, 0,
n(ng), 1, 2, scale, &
855 &
grid(ng) % rmask, &
858 & setfillval = .false.)
859 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
874 &
rst(ng)%Rindex, gtype, &
875 & lbi, ubi, lbj, ubj, 0,
n(ng), 1, 2, scale, &
877 &
grid(ng) % rmask, &
880 & setfillval = .false.)
881 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
896 &
rst(ng)%Rindex, gtype, &
897 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
899 &
grid(ng) % rmask, &
902 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
917 &
rst(ng)%Rindex, gtype, &
918 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
920 &
grid(ng) % rmask, &
923 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
939 &
rst(ng)%Rindex, gtype, &
940 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
942 &
grid(ng) % rmask, &
945 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
965 &
rst(ng)%Rindex, gtype, &
966 & lbi, ubi, lbj, ubj, scale, &
968 &
grid(ng) % umask, &
970 &
sedbed(ng) % bedldu(:,:,i))
971 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
988 &
rst(ng)%Rindex, gtype, &
989 & lbi, ubi, lbj, ubj, scale, &
991 &
grid(ng) % vmask, &
993 &
sedbed(ng) % bedldv(:,:,i))
994 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1012 &
rst(ng)%Rindex, gtype, &
1013 & lbi, ubi, lbj, ubj, 1,
nbed, scale, &
1015 &
grid(ng) % rmask, &
1017 &
sedbed(ng) % bed_frac(:,:,:,i), &
1018 & setfillval = .false.)
1019 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1036 &
rst(ng)%Rindex, gtype, &
1037 & lbi, ubi, lbj, ubj, 1,
nbed, scale, &
1039 &
grid(ng) % rmask, &
1041 &
sedbed(ng) % bed_mass(:,:,:,nout,i), &
1042 & setfillval = .false.)
1043 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1056 IF (i.eq.
itauc)
THEN
1064 &
rst(ng)%Rindex, gtype, &
1065 & lbi, ubi, lbj, ubj, 1,
nbed, scale, &
1067 &
grid(ng) % rmask, &
1069 &
sedbed(ng) % bed(:,:,:,i), &
1070 & setfillval = .false.)
1071 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1081# if defined SEDIMENT || defined BBL_MODEL
1093 &
rst(ng)%Rindex, gtype, &
1094 & lbi, ubi, lbj, ubj, scale, &
1096 &
grid(ng) % rmask, &
1098 &
sedbed(ng) % bottom(:,:,i))
1099 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1118 &
rst(ng)%Rindex, gtype, &
1119 & lbi, ubi, lbj, ubj, scale, &
1121 &
grid(ng) % umask, &
1123 &
ocean(ng) % ubar_stokes)
1124 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1138 &
rst(ng)%Rindex, gtype, &
1139 & lbi, ubi, lbj, ubj, scale, &
1141 &
grid(ng) % vmask, &
1143 &
ocean(ng) % vbar_stokes)
1144 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1160 &
rst(ng)%Rindex, gtype, &
1161 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
1163 &
grid(ng) % umask, &
1165 &
ocean(ng) % u_stokes)
1166 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1180 &
rst(ng)%Rindex, gtype, &
1181 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
1183 &
grid(ng) % vmask, &
1185 &
ocean(ng) % v_stokes)
1186 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1201 CALL ice_wrt_nf90 (ng, model, tile, &
1202 & lbi, ubi, lbj, ubj, &
1214 10
FORMAT (2x,
'WRT_RST_NF90 - writing re-start', t42, &
1217 &
'fields (Index=',i1,
',',i1,
') in record = ',i0,t92,i2.2)
1219 &
'fields (Index=',i1,
',',i1,
') in record = ',i0)
1223 &
'fields (Index=',i1,
') in record = ',i0,t92,i2.2)
1225 &
'fields (Index=',i1,
') in record = ',i0)
1228 20
FORMAT (/,
' WRT_RST_NF90 - error while writing variable: ',a, &
1229 & /,16x,
'into restart NetCDF file for time record: ',i0)
1238 & LBi, UBi, LBj, UBj)
1245 integer,
intent(in) :: ng, model, tile
1246 integer,
intent(in) :: lbi, ubi, lbj, ubj
1250 integer :: fcount, i, itrc, status
1251# if defined PERFECT_RESTART || defined SOLVE3D
1257 character (len=*),
parameter :: myfile = &
1258 & __FILE__//
", wrt_rst_pio"
1260 TYPE (io_desc_t),
pointer :: iodesc
1272 rst(ng)%Rindex=
rst(ng)%Rindex+1
1273 fcount=
rst(ng)%Fcount
1274 rst(ng)%Nrec(fcount)=
rst(ng)%Nrec(fcount)+1
1296 rst(ng)%Rindex=mod(
rst(ng)%Rindex-1,2)+1
1299# ifdef PERFECT_RESTART
1306 & ntmp, (/
rst(ng)%Rindex/), (/1/), &
1307 & piofile =
rst(ng)%pioFile)
1311 & ntmp, (/
rst(ng)%Rindex/), (/1/), &
1312 & piofile =
rst(ng)%pioFile)
1317 & ntmp, (/
rst(ng)%Rindex/), (/1/), &
1318 & piofile =
rst(ng)%pioFile)
1322 &
kstp(ng:), (/
rst(ng)%Rindex/), (/1/), &
1323 & piofile =
rst(ng)%pioFile)
1327 &
krhs(ng:), (/
rst(ng)%Rindex/), (/1/), &
1328 & piofile =
rst(ng)%pioFile)
1332 &
knew(ng:), (/
rst(ng)%Rindex/), (/1/), &
1333 & piofile =
rst(ng)%pioFile)
1341 & (/
rst(ng)%Rindex/), (/1/), &
1342 & piofile =
rst(ng)%pioFile, &
1346# if defined SEDIMENT && defined SED_MORPH
1352 IF (
rst(ng)%pioVar(
idbath)%dkind.eq.pio_double)
THEN
1361 & lbi, ubi, lbj, ubj, scale, &
1363 &
grid(ng) % rmask, &
1366 & setfillval = .false.)
1367 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1382 IF (
rst(ng)%pioVar(
idpwet)%dkind.eq.pio_double)
THEN
1391 & lbi, ubi, lbj, ubj, scale, &
1393 &
grid(ng) % pmask, &
1395 &
grid(ng) % pmask_wet, &
1396 & setfillval = .false.)
1397 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1409 IF (
rst(ng)%pioVar(
idrwet)%dkind.eq.pio_double)
THEN
1418 & lbi, ubi, lbj, ubj, scale, &
1420 &
grid(ng) % rmask, &
1422 &
grid(ng) % rmask_wet, &
1423 & setfillval = .false.)
1424 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1436 IF (
rst(ng)%pioVar(
iduwet)%dkind.eq.pio_double)
THEN
1445 & lbi, ubi, lbj, ubj, scale, &
1447 &
grid(ng) % umask, &
1449 &
grid(ng) % umask_wet, &
1450 & setfillval = .false.)
1451 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1463 IF (
rst(ng)%pioVar(
idvwet)%dkind.eq.pio_double)
THEN
1472 & lbi, ubi, lbj, ubj, scale, &
1474 &
grid(ng) % vmask, &
1476 &
grid(ng) % vmask_wet, &
1477 & setfillval = .false.)
1478 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1491# ifdef PERFECT_RESTART
1492 IF (
rst(ng)%pioVar(
idfsur)%dkind.eq.pio_double)
THEN
1501 & lbi, ubi, lbj, ubj, 1, 3, scale, &
1503 &
grid(ng) % rmask, &
1506 &
ocean(ng) % zeta, &
1507 & setfillval = .false.)
1512 IF (
rst(ng)%pioVar(
idfsur)%dkind.eq.pio_double)
THEN
1521 & lbi, ubi, lbj, ubj, scale, &
1523 &
grid(ng) % rmask, &
1526 &
ocean(ng) % zeta(:,:,kout), &
1527 & setfillval = .false.)
1529 &
ocean(ng) % zeta(:,:,kout))
1532 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1541# ifdef PERFECT_RESTART
1546 IF (
rst(ng)%pioVar(
idrzet)%dkind.eq.pio_double)
THEN
1555 & lbi, ubi, lbj, ubj, 1, 2, scale, &
1557 &
grid(ng) % rmask, &
1559 &
ocean(ng) % rzeta)
1560 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1573# ifdef PERFECT_RESTART
1574 IF (
rst(ng)%pioVar(
idubar)%dkind.eq.pio_double)
THEN
1583 & lbi, ubi, lbj, ubj, 1, 3, scale, &
1585 &
grid(ng) % umask, &
1587 &
ocean(ng) % ubar, &
1588 & setfillval = .false.)
1591 IF (
rst(ng)%pioVar(
idubar)%dkind.eq.pio_double)
THEN
1600 & lbi, ubi, lbj, ubj, scale, &
1602 &
grid(ng) % umask_full, &
1604 &
ocean(ng) % ubar(:,:,kout))
1606 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1615# ifdef PERFECT_RESTART
1620 IF (
rst(ng)%pioVar(
idru2d)%dkind.eq.pio_double)
THEN
1629 & lbi, ubi, lbj, ubj, 1, 2, scale, &
1631 &
grid(ng) % umask, &
1633 &
ocean(ng) % rubar, &
1634 & setfillval = .false.)
1635 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1648# ifdef PERFECT_RESTART
1649 IF (
rst(ng)%pioVar(
idvbar)%dkind.eq.pio_double)
THEN
1658 & lbi, ubi, lbj, ubj, 1, 3, scale, &
1660 &
grid(ng) % vmask, &
1662 &
ocean(ng) % vbar, &
1663 & setfillval = .false.)
1665 IF (
rst(ng)%pioVar(
idvbar)%dkind.eq.pio_double)
THEN
1674 & lbi, ubi, lbj, ubj, scale, &
1676 &
grid(ng) % vmask_full, &
1678 &
ocean(ng) % vbar(:,:,kout))
1680 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1689# ifdef PERFECT_RESTART
1694 IF (
rst(ng)%pioVar(
idrv2d)%dkind.eq.pio_double)
THEN
1703 & lbi, ubi, lbj, ubj, 1, 2, scale, &
1705 &
grid(ng) % vmask, &
1707 &
ocean(ng) % rvbar, &
1708 & setfillval = .false.)
1709 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1723# ifdef PERFECT_RESTART
1724 IF (
rst(ng)%pioVar(
iduvel)%dkind.eq.pio_double)
THEN
1733 & lbi, ubi, lbj, ubj, 1,
n(ng), 1, 2, scale, &
1735 &
grid(ng) % umask, &
1738 & setfillval = .false.)
1740 IF (
rst(ng)%pioVar(
iduvel)%dkind.eq.pio_double)
THEN
1749 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
1751 &
grid(ng) % umask_full, &
1753 &
ocean(ng) % u(:,:,:,nout))
1755 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1764# ifdef PERFECT_RESTART
1769 IF (
rst(ng)%pioVar(
idru3d)%dkind.eq.pio_double)
THEN
1778 & lbi, ubi, lbj, ubj, 0,
n(ng), 1, 2, scale, &
1780 &
grid(ng) % umask, &
1783 & setfillval = .false.)
1784 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1797# ifdef PERFECT_RESTART
1798 IF (
rst(ng)%pioVar(
idvvel)%dkind.eq.pio_double)
THEN
1807 & lbi, ubi, lbj, ubj, 1,
n(ng), 1, 2, scale, &
1809 &
grid(ng) % vmask, &
1812 & setfillval = .false.)
1814 IF (
rst(ng)%pioVar(
idvvel)%dkind.eq.pio_double)
THEN
1823 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
1825 &
grid(ng) % vmask_full, &
1827 &
ocean(ng) % v(:,:,:,nout))
1829 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1838# ifdef PERFECT_RESTART
1843 IF (
rst(ng)%pioVar(
idrv3d)%dkind.eq.pio_double)
THEN
1852 & lbi, ubi, lbj, ubj, 0,
n(ng), 1, 2, scale, &
1854 &
grid(ng) % vmask, &
1857 & setfillval = .false.)
1858 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1872# ifdef PERFECT_RESTART
1873 IF (
rst(ng)%pioTrc(itrc)%dkind.eq.pio_double)
THEN
1879 &
rst(ng)%pioTrc(itrc), &
1882 & lbi, ubi, lbj, ubj, 1,
n(ng), 1, 2, scale, &
1884 &
grid(ng) % rmask, &
1886 &
ocean(ng) % t(:,:,:,:,itrc))
1888 IF (
rst(ng)%pioTrc(itrc)%dkind.eq.pio_double)
THEN
1894 &
rst(ng)%pioTrc(itrc), &
1897 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
1899 &
grid(ng) % rmask, &
1901 &
ocean(ng) % t(:,:,:,nout,itrc))
1903 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1916 IF (
rst(ng)%pioVar(
iddano)%dkind.eq.pio_double)
THEN
1925 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
1927 &
grid(ng) % rmask, &
1930 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1944 IF (
rst(ng)%pioVar(
idhsbl)%dkind.eq.pio_double)
THEN
1953 & lbi, ubi, lbj, ubj, scale, &
1955 &
grid(ng) % rmask, &
1958 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1972 IF (
rst(ng)%pioVar(
idhbbl)%dkind.eq.pio_double)
THEN
1981 & lbi, ubi, lbj, ubj, scale, &
1983 &
grid(ng) % rmask, &
1986 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
1995# if defined PERFECT_RESTART && defined LMD_NONLOCAL
2001 IF (
rst(ng)%pioVar(
idghat(i))%dkind.eq.pio_double)
THEN
2010 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
2012 &
grid(ng) % rmask, &
2014 &
mixing(ng) % ghats(:,:,:,i))
2015 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2025# if defined BVF_MIXING || defined GLS_MIXING || \
2026 defined my25_mixing || defined lmd_mixing
2031 IF (
rst(ng)%pioVar(
idvvis)%dkind.eq.pio_double)
THEN
2040 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
2042 &
grid(ng) % rmask, &
2045 & setfillval = .false.)
2046 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2058 IF (
rst(ng)%pioVar(
idtdif)%dkind.eq.pio_double)
THEN
2067 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
2069 &
grid(ng) % rmask, &
2072 & setfillval = .false.)
2074 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2088 IF (
rst(ng)%pioVar(
idsdif)%dkind.eq.pio_double)
THEN
2097 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
2099 &
grid(ng) % rmask, &
2102 & setfillval = .false.)
2103 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2113# if defined PERFECT_RESTART && \
2114 (defined gls_mixing || defined my25_mixing)
2119 IF (
rst(ng)%pioVar(
idmtke)%dkind.eq.pio_double)
THEN
2128 & lbi, ubi, lbj, ubj, 0,
n(ng), 1, 2, scale, &
2130 &
grid(ng) % rmask, &
2133 & setfillval = .false.)
2134 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2146 IF (
rst(ng)%pioVar(
idmtls)%dkind.eq.pio_double)
THEN
2155 & lbi, ubi, lbj, ubj, 0,
n(ng), 1, 2, scale, &
2157 &
grid(ng) % rmask, &
2160 & setfillval = .false.)
2161 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2173 IF (
rst(ng)%pioVar(
idvmls)%dkind.eq.pio_double)
THEN
2182 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
2184 &
grid(ng) % rmask, &
2187 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2199 IF (
rst(ng)%pioVar(
idvmkk)%dkind.eq.pio_double)
THEN
2208 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
2210 &
grid(ng) % rmask, &
2213 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2227 IF (
rst(ng)%pioVar(
idvmkp)%dkind.eq.pio_double)
THEN
2236 & lbi, ubi, lbj, ubj, 0,
n(ng), scale, &
2238 &
grid(ng) % rmask, &
2241 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2258 IF (
rst(ng)%pioVar(
idubld(i))%dkind.eq.pio_double)
THEN
2267 & lbi, ubi, lbj, ubj, scale, &
2269 &
grid(ng) % umask, &
2271 &
sedbed(ng) % bedldu(:,:,i))
2272 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2286 IF (
rst(ng)%pioVar(
idvbld(i))%dkind.eq.pio_double)
THEN
2295 & lbi, ubi, lbj, ubj, scale, &
2297 &
grid(ng) % vmask, &
2299 &
sedbed(ng) % bedldv(:,:,i))
2300 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2315 IF (
rst(ng)%pioVar(
idfrac(i))%dkind.eq.pio_double)
THEN
2324 & lbi, ubi, lbj, ubj, 1,
nbed, scale, &
2326 &
grid(ng) % rmask, &
2328 &
sedbed(ng) % bed_frac(:,:,:,i), &
2329 & setfillval = .false.)
2330 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2344 IF (
rst(ng)%pioVar(
idbmas(i))%dkind.eq.pio_double)
THEN
2353 & lbi, ubi, lbj, ubj, 1,
nbed, scale, &
2355 &
grid(ng) % rmask, &
2357 &
sedbed(ng) % bed_mass(:,:,:,nout,i), &
2358 & setfillval = .false.)
2359 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2372 IF (i.eq.
itauc)
THEN
2377 IF (
rst(ng)%pioVar(
idsbed(i))%dkind.eq.pio_double)
THEN
2386 & lbi, ubi, lbj, ubj, 1,
nbed, scale, &
2388 &
grid(ng) % rmask, &
2390 &
sedbed(ng) % bed(:,:,:,i), &
2391 & setfillval = .false.)
2392 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2402# if defined SEDIMENT || defined BBL_MODEL
2411 IF (
rst(ng)%pioVar(
idbott(i))%dkind.eq.pio_double)
THEN
2420 & lbi, ubi, lbj, ubj, scale, &
2422 &
grid(ng) % rmask, &
2424 &
sedbed(ng) % bottom(:,:,i))
2425 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2441 IF (
rst(ng)%pioVar(
idu2sd)%dkind.eq.pio_double)
THEN
2450 & lbi, ubi, lbj, ubj, scale, &
2452 &
grid(ng) % umask, &
2454 &
ocean(ng) % ubar_stokes)
2455 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2466 IF (
rst(ng)%pioVar(
idv2sd)%dkind.eq.pio_double)
THEN
2475 & lbi, ubi, lbj, ubj, scale, &
2477 &
grid(ng) % vmask, &
2479 &
ocean(ng) % vbar_stokes)
2480 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2493 IF (
rst(ng)%pioVar(
idu3sd)%dkind.eq.pio_double)
THEN
2502 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
2504 &
grid(ng) % umask, &
2506 &
ocean(ng) % u_stokes)
2507 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2518 IF (
rst(ng)%pioVar(
idv3sd)%dkind.eq.pio_double)
THEN
2527& & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
2529 &
grid(ng) % vmask, &
2531 &
ocean(ng) % v_stokes)
2532 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
2547 CALL ice_wrt_pio (ng, model, tile, &
2548 & lbi, ubi, lbj, ubj, &
2560 10
FORMAT (2x,
'WRT_RST_PIO - writing re-start', t42, &
2563 &
'fields (Index=',i1,
',',i1,
') in record = ',i0,t92,i2.2)
2565 &
'fields (Index=',i1,
',',i1,
') in record = ',i0)
2569 &
'fields (Index=',i1,
') in record = ',i0,t92,i2.2)
2571 &
'fields (Index=',i1,
') in record = ',i0)
2574 20
FORMAT (/,
' WRT_RST_PIO - error while writing variable: ',a, &
2575 & /,16x,
'into restart NetCDF file for time record: ',i0)