3#if (defined TANGENT || defined TL_IOMS) && defined FOUR_DVAR
30# ifdef ADJUST_BOUNDARY
33# if defined ADJUST_WSTRESS || defined ADJUST_STFLUX
43# if defined SEDIMENT_NOT_YET || defined BBL_MODEL_NOT_YET
49# ifdef ADJUST_BOUNDARY
54# ifdef ADJUST_BOUNDARY
64# if defined PIO_LIB && defined DISTRIBUTE
76 integer,
intent(in) :: ng, tile, tindex, outrec
80# ifdef ADJUST_BOUNDARY
83 integer :: lbi, ubi, lbj, ubj
85 character (len=*),
parameter :: myfile = &
92# ifdef ADJUST_BOUNDARY
101 SELECT CASE (
irp(ng)%IOtype)
104# ifdef ADJUST_BOUNDARY
107 & lbi, ubi, lbj, ubj)
109# if defined PIO_LIB && defined DISTRIBUTE
112# ifdef ADJUST_BOUNDARY
115 & lbi, ubi, lbj, ubj)
123 10
FORMAT (
' RP_WRT_INI - Illegal output file type, io_type = ',i0, &
124 & /,14x,
'Check KeyWord ''OUT_LIB'' in ''roms.in''.')
131# ifdef ADJUST_BOUNDARY
134 & LBi, UBi, LBj, UBj)
141 integer,
intent(in) :: ng, tile, tindex, outrec
142# ifdef ADJUST_BOUNDARY
143 integer,
intent(in) :: lbij, ubij
145 integer,
intent(in) :: lbi, ubi, lbj, ubj
149 integer :: gfactor, gtype, i, itrc, status, varid
151 real(dp) :: my_time, scale
153 character (len=15) :: string
155 character (len=*),
parameter :: myfile = &
156 & __FILE__//
", rp_wrt_ini_nf90"
169 IF (outrec.eq.2)
THEN
170 string=
'initial fields'
182# if defined WRITE_WATER && defined MASKING
195 & (/outrec/), (/1/), &
196 & ncid =
irp(ng)%ncid, &
207 & lbi, ubi, lbj, ubj, scale, &
209 &
grid(ng) % rmask, &
212 &
ocean(ng) % tl_zeta(:,:,tindex), &
213 & setfillval = .false.)
215 &
ocean(ng) % tl_zeta(:,:,tindex))
217 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
226# ifdef ADJUST_BOUNDARY
236 & lbij, ubij,
nbrec(ng), scale, &
237 &
boundary(ng) % tl_zeta_obc(lbij:,:,:, &
239 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
257 & lbi, ubi, lbj, ubj, scale, &
259 &
grid(ng) % umask_full, &
261 &
ocean(ng) % tl_ubar(:,:,tindex))
262 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
271# ifdef ADJUST_BOUNDARY
281 & lbij, ubij,
nbrec(ng), scale, &
282 &
boundary(ng) % tl_ubar_obc(lbij:,:,:, &
284 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
302 & lbi, ubi, lbj, ubj, scale, &
304 &
grid(ng) % vmask_full, &
306 &
ocean(ng) % tl_vbar(:,:,tindex))
307 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
316# ifdef ADJUST_BOUNDARY
326 & lbij, ubij,
nbrec(ng), scale, &
327 &
boundary(ng) % tl_vbar_obc(lbij:,:,:, &
329 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
340# ifdef ADJUST_WSTRESS
352 & lbi, ubi, lbj, ubj, 1,
nfrec(ng), scale, &
354 &
grid(ng) % umask, &
356 &
forces(ng) % tl_ustr(:,:,:,tindex))
357 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
374 & lbi, ubi, lbj, ubj, 1,
nfrec(ng), scale, &
376 &
grid(ng) % vmask, &
378 &
forces(ng) % tl_vstr(:,:,:,tindex))
379 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
398 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
400 &
grid(ng) % umask_full, &
402 &
ocean(ng) % tl_u(:,:,:,tindex))
403 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
412# ifdef ADJUST_BOUNDARY
422 & lbij, ubij, 1,
n(ng),
nbrec(ng), scale, &
423 &
boundary(ng) % tl_u_obc(lbij:,:,:,:, &
425 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
443 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
445 &
grid(ng) % vmask_full, &
447 &
ocean(ng) % tl_v(:,:,:,tindex))
448 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
457# ifdef ADJUST_BOUNDARY
467 & lbij, ubij, 1,
n(ng),
nbrec(ng), scale, &
468 &
boundary(ng) % tl_v_obc(lbij:,:,:,:, &
470 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
487 &
irp(ng)%Tid(itrc), &
489 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
491 &
grid(ng) % rmask, &
493 &
ocean(ng) % tl_t(:,:,:,tindex,itrc))
494 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
504# ifdef ADJUST_BOUNDARY
515 & lbij, ubij, 1,
n(ng),
nbrec(ng), &
517 &
boundary(ng) % tl_t_obc(lbij:,:,:,:, &
519 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
545 & lbi, ubi, lbj, ubj, 1,
nfrec(ng), scale, &
547 &
grid(ng) % rmask, &
549 &
forces(ng) % tl_tflux(:,:,:,tindex,itrc))
550 IF (
founderror(status, nf90_noerr, __line__, myfile))
THEN
572 10
FORMAT (2x,
'RP_WRT_INI_NF90 - writing ',a, &
573 &
' (Outer=',i2.2,
', Inner=',i3.3,
', Index=',i0, &
575 &
',',i0,
', Rec=',i0,
')')
579 20
FORMAT (/,
' RP_WRT_INI_NF90 - error while writing variable: ',a, &
580 & /,19x,
'into representers initial file for time record:', &
586# if defined PIO_LIB && defined DISTRIBUTE
590# ifdef ADJUST_BOUNDARY
593 & LBi, UBi, LBj, UBj)
600 integer,
intent(in) :: ng, tile, tindex, outrec
601# ifdef ADJUST_BOUNDARY
602 integer,
intent(in) :: lbij, ubij
604 integer,
intent(in) :: lbi, ubi, lbj, ubj
608 integer :: i, ifield, itrc, status, varid
610 real(dp) :: my_time, scale
612 character (len=15) :: string
614 character (len=*),
parameter :: myfile = &
615 & __FILE__//
", rp_wrt_ini_pio"
617 TYPE (io_desc_t),
pointer :: iodesc
630 IF (outrec.eq.2)
THEN
631 string=
'initial fields'
647 & (/outrec/), (/1/), &
648 & piofile =
irp(ng)%pioFile, &
655 IF (
irp(ng)%pioVar(
idfsur)%dkind.eq.pio_double)
THEN
664 & lbi, ubi, lbj, ubj, scale, &
666 &
grid(ng) % rmask, &
669 &
ocean(ng) % tl_zeta(:,:,tindex), &
670 & setfillval = .false.)
672 &
ocean(ng) % tl_zeta(:,:,tindex))
674 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
683# ifdef ADJUST_BOUNDARY
700 & lbij, ubij,
nbrec(ng), scale, &
701 &
boundary(ng) % tl_zeta_obc(lbij:,:,:, &
703 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
717 IF (
irp(ng)%pioVar(
idubar)%dkind.eq.pio_double)
THEN
726 & lbi, ubi, lbj, ubj, scale, &
728 &
grid(ng) % umask_full, &
730 &
ocean(ng) % tl_ubar(:,:,tindex))
731 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
740# ifdef ADJUST_BOUNDARY
757 & lbij, ubij,
nbrec(ng), scale, &
758 &
boundary(ng) % tl_ubar_obc(lbij:,:,:, &
760 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
774 IF (
irp(ng)%pioVar(
idvbar)%dkind.eq.pio_double)
THEN
783 & lbi, ubi, lbj, ubj, scale, &
785 &
grid(ng) % vmask_full, &
787 &
ocean(ng) % tl_vbar(:,:,tindex))
788 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
797# ifdef ADJUST_BOUNDARY
814 & lbij, ubij,
nbrec(ng), scale, &
815 &
boundary(ng) % tl_vbar_obc(lbij:,:,:, &
817 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
828# ifdef ADJUST_WSTRESS
836 IF (
irp(ng)%pioVar(
idusms)%dkind.eq.pio_double)
THEN
845 & lbi, ubi, lbj, ubj, 1,
nfrec(ng), scale, &
847 &
grid(ng) % umask, &
849 &
forces(ng) % tl_ustr(:,:,:,tindex))
850 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
863 IF (
irp(ng)%pioVar(
idvsms)%dkind.eq.pio_double)
THEN
872 & lbi, ubi, lbj, ubj, 1,
nfrec(ng), scale, &
874 &
grid(ng) % vmask, &
876 &
forces(ng) % tl_vstr(:,:,:,tindex))
877 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
892 IF (
irp(ng)%pioVar(
iduvel)%dkind.eq.pio_double)
THEN
901 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
903 &
grid(ng) % umask_full, &
905 &
ocean(ng) % tl_u(:,:,:,tindex))
906 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
915# ifdef ADJUST_BOUNDARY
932 & lbij, ubij, 1,
n(ng),
nbrec(ng), scale, &
933 &
boundary(ng) % tl_u_obc(lbij:,:,:,:, &
935 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
949 IF (
irp(ng)%pioVar(
idvvel)%dkind.eq.pio_double)
THEN
958 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
960 &
grid(ng) % vmask_full, &
962 &
ocean(ng) % tl_v(:,:,:,tindex))
963 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
972# ifdef ADJUST_BOUNDARY
989 & lbij, ubij, 1,
n(ng),
nbrec(ng), scale, &
990 &
boundary(ng) % tl_v_obc(lbij:,:,:,:, &
992 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
1007 IF (
irp(ng)%pioTrc(itrc)%dkind.eq.pio_double)
THEN
1014 &
irp(ng)%pioTrc(itrc), &
1016 & lbi, ubi, lbj, ubj, 1,
n(ng), scale, &
1018 &
grid(ng) % rmask, &
1020 &
ocean(ng) % tl_t(:,:,:,tindex,itrc))
1021 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
1031# ifdef ADJUST_BOUNDARY
1039 IF (
irp(ng)%pioVar(ifield)%dkind.eq.pio_double)
THEN
1046 &
irp(ng)%pioFile, &
1047 &
vname(1,ifield), &
1048 &
irp(ng)%pioVar(ifield), &
1050 & lbij, ubij, 1,
n(ng),
nbrec(ng), &
1052 &
boundary(ng) % tl_t_obc(lbij:,:,:,:, &
1054 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
1067# ifdef ADJUST_STFLUX
1076 IF (
irp(ng)%pioVar(
idtsur(itrc))%dkind.eq.pio_double)
THEN
1085 & lbi, ubi, lbj, ubj, 1,
nfrec(ng), scale, &
1087 &
grid(ng) % rmask, &
1089 &
forces(ng) % tl_tflux(:,:,:,tindex,itrc))
1090 IF (
founderror(status, pio_noerr, __line__, myfile))
THEN
1112 10
FORMAT (2x,
'RP_WRT_INI_PIO - writing ',a, &
1113 &
' (Outer=',i2.2,
', Inner=',i3.3,
', Index=',i0, &
1115 &
',',i0,
', Rec=',i0,
')')
1119 20
FORMAT (/,
' RP_WRT_INI_PIO - error while writing variable: ',a, &
1120 & /,18x,
'into representers initial file for time record:', &
type(t_boundary), dimension(:), allocatable boundary
type(t_forces), dimension(:), allocatable forces
type(t_grid), dimension(:), allocatable grid
type(t_io), dimension(:), allocatable irp
character(len=256) sourcefile
integer, parameter io_nf90
integer, dimension(:), allocatable idsbry
integer, parameter io_pio
integer, dimension(:), allocatable idtsur
integer, dimension(:), allocatable idtvar
integer, dimension(:), allocatable istvar
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, dimension(:), allocatable nt
integer, parameter r2dvar
integer, parameter v2dvar
integer, parameter v3dvar
type(io_desc_t), dimension(:), pointer iodesc_sp_v2dobc
type(io_desc_t), dimension(:), pointer iodesc_dp_r3dvar
type(io_desc_t), dimension(:), pointer iodesc_sp_u3dvar
type(io_desc_t), dimension(:), pointer iodesc_dp_v2dobc
type(io_desc_t), dimension(:), pointer iodesc_sp_u2dfrc
type(io_desc_t), dimension(:), pointer iodesc_dp_v3dobc
subroutine, public pio_netcdf_sync(ng, model, ncname, piofile)
type(io_desc_t), dimension(:), pointer iodesc_sp_u2dvar
type(io_desc_t), dimension(:), pointer iodesc_dp_u3dobc
type(io_desc_t), dimension(:), pointer iodesc_sp_r3dobc
type(io_desc_t), dimension(:), pointer iodesc_dp_u3dvar
type(io_desc_t), dimension(:), pointer iodesc_dp_u2dobc
type(io_desc_t), dimension(:), pointer iodesc_sp_r2dobc
type(io_desc_t), dimension(:), pointer iodesc_sp_r2dvar
type(io_desc_t), dimension(:), pointer iodesc_sp_u3dobc
type(io_desc_t), dimension(:), pointer iodesc_dp_u2dfrc
type(io_desc_t), dimension(:), pointer iodesc_dp_r2dobc
type(io_desc_t), dimension(:), pointer iodesc_sp_u2dobc
type(io_desc_t), dimension(:), pointer iodesc_dp_u2dvar
type(io_desc_t), dimension(:), pointer iodesc_dp_v2dfrc
type(io_desc_t), dimension(:), pointer iodesc_dp_v3dvar
type(io_desc_t), dimension(:), pointer iodesc_sp_v2dfrc
type(io_desc_t), dimension(:), pointer iodesc_dp_r2dfrc
type(io_desc_t), dimension(:), pointer iodesc_dp_v2dvar
type(io_desc_t), dimension(:), pointer iodesc_sp_v3dvar
type(io_desc_t), dimension(:), pointer iodesc_sp_r3dvar
type(io_desc_t), dimension(:), pointer iodesc_dp_r2dvar
type(io_desc_t), dimension(:), pointer iodesc_dp_r3dobc
type(io_desc_t), dimension(:), pointer iodesc_sp_v3dobc
type(io_desc_t), dimension(:), pointer iodesc_sp_v2dvar
type(io_desc_t), dimension(:), pointer iodesc_sp_r2dfrc
real(dp), parameter day2sec
logical, dimension(:,:,:), allocatable lobc
logical, dimension(:,:), allocatable lstflux
integer, dimension(:), allocatable nfrec
real(dp), dimension(:), allocatable tdays
integer, dimension(:), allocatable nbrec
subroutine, private rp_wrt_ini_pio(ng, tile, tindex, outrec, lbij, ubij, lbi, ubi, lbj, ubj)
subroutine, public rp_wrt_ini(ng, tile, tindex, outrec)
subroutine, private rp_wrt_ini_nf90(ng, tile, tindex, outrec, lbij, ubij, lbi, ubi, lbj, ubj)
logical function, public founderror(flag, noerr, line, routine)