32# ifdef ADJUST_BOUNDARY
53 & gtype, ncvname, tindex, &
57 & start, total, Npts, Bwrk)
92 integer,
intent(in) :: ng, model, tile
93 integer,
intent(in) :: gtype, tindex
94 integer,
intent(in) :: extract_flag
95 integer,
intent(in) :: lbij, ubij, nrec
96 integer,
intent(in) :: npts
97 integer,
intent(out) :: start(:), total(:)
99 real(dp),
intent(in) :: bscl
102 real(r8),
intent(in) :: bdat(lbij:,:,:)
104 real(r8),
intent(in) :: bdat(lbij:lbij,4,nrec)
106 real(r8),
intent(out) :: bwrk(:)
108 character (len=*),
intent(in) :: ncvname
112 logical,
dimension(4) :: bounded
114 integer :: bc, i, ib, ic, ir, j, rc
115 integer :: iorj, imin, imax, jmin, jmax
117 real(r8),
parameter :: bspv = 0.0_r8
119 character (len=*),
parameter :: myfile = &
120 & __FILE__//
", pack_boundary2d"
136 imin=
bounds(ng)%Istr (tile)
137 imax=
bounds(ng)%Iend (tile)
138 jmin=
bounds(ng)%Jstr (tile)
139 jmax=
bounds(ng)%Jend (tile)
145 imin=
bounds(ng)%IstrR(tile)
146 imax=
bounds(ng)%IendR(tile)
147 jmin=
bounds(ng)%JstrR(tile)
148 jmax=
bounds(ng)%JendR(tile)
154 imin=
bounds(ng)%Istr (tile)
155 imax=
bounds(ng)%IendR(tile)
156 jmin=
bounds(ng)%JstrR(tile)
157 jmax=
bounds(ng)%JendR(tile)
163 imin=
bounds(ng)%IstrR(tile)
164 imax=
bounds(ng)%IendR(tile)
165 jmin=
bounds(ng)%Jstr (tile)
166 jmax=
bounds(ng)%JendR(tile)
172 imin=
bounds(ng)%IstrR(tile)
173 imax=
bounds(ng)%IendR(tile)
174 jmin=
bounds(ng)%JstrR(tile)
175 jmax=
bounds(ng)%JendR(tile)
202 IF (bounded(ib))
THEN
207 bwrk(ic)=bdat(j,ib,ir)*bscl
209 IF (abs(bwrk(ic)).eq.0.0_r8)
THEN
217 bwrk(ic)=bdat(i,ib,ir)*bscl
219 IF (abs(bwrk(ic)).eq.0.0_r8)
THEN
242 IF (extract_flag.le.0)
THEN
258 ELSE IF (extract_flag.ge.1)
THEN
259 CALL extract_boundary (ng, model, tile, &
260 & gtype, ncvname, tindex, &
262 & imin, imax, jmin, jmax, nrec, &
272 & gtype, ncvname, tindex, &
274 & LBij, UBij, LBk, UBk, Nrec, &
276 & start, total, Npts, Bwrk)
313 integer,
intent(in) :: ng, model, tile
314 integer,
intent(in) :: gtype, tindex
315 integer,
intent(in) :: extract_flag
316 integer,
intent(in) :: lbij, ubij, lbk, ubk, nrec
317 integer,
intent(in) :: npts
318 integer,
intent(out) :: start(:), total(:)
320 real(dp),
intent(in) :: bscl
323 real(r8),
intent(in) :: bdat(lbij:,lbk:,:,:)
325 real(r8),
intent(in) :: bdat(lbij:lbij,lbk:ubk,4,nrec)
327 real(r8),
intent(out) :: bwrk(:)
329 character (len=*),
intent(in) :: ncvname
333 logical,
dimension(4) :: bounded
335 integer :: imin, imax, jmin, jmax
336 integer :: iorj, ijklen, klen
337 integer :: bc, i, ib, ic, ir, j, k, kc, rc
339 real(r8),
parameter :: bspv = 0.0_r8
341 character (len=*),
parameter :: myfile = &
342 & __FILE__//
", pack_boundary3d"
358 imin=
bounds(ng)%Istr (tile)
359 imax=
bounds(ng)%Iend (tile)
360 jmin=
bounds(ng)%Jstr (tile)
361 jmax=
bounds(ng)%Jend (tile)
367 imin=
bounds(ng)%IstrR(tile)
368 imax=
bounds(ng)%IendR(tile)
369 jmin=
bounds(ng)%JstrR(tile)
370 jmax=
bounds(ng)%JendR(tile)
376 imin=
bounds(ng)%Istr (tile)
377 imax=
bounds(ng)%IendR(tile)
378 jmin=
bounds(ng)%JstrR(tile)
379 jmax=
bounds(ng)%JendR(tile)
385 imin=
bounds(ng)%IstrR(tile)
386 imax=
bounds(ng)%IendR(tile)
387 jmin=
bounds(ng)%Jstr (tile)
388 jmax=
bounds(ng)%JendR(tile)
394 imin=
bounds(ng)%IstrR(tile)
395 imax=
bounds(ng)%IendR(tile)
396 jmin=
bounds(ng)%JstrR(tile)
397 jmax=
bounds(ng)%JendR(tile)
426 IF (bounded(ib))
THEN
433 bwrk(ic)=bdat(j,k,ib,ir)*bscl
435 IF (abs(bwrk(ic)).eq.0.0_r8)
THEN
446 bwrk(ic)=bdat(i,k,ib,ir)*bscl
448 IF (abs(bwrk(ic)).eq.0.0_r8)
THEN
472 IF (extract_flag.le.0)
THEN
490 ELSE IF (extract_flag.ge.1)
THEN
491 CALL extract_boundary (ng, model, tile, &
492 & gtype, ncvname, tindex, &
494 & imin, imax, jmin, jmax, lbk, ubk, nrec, &
505 & gtype, ifield, tindex, &
506 & LandFill, Extract_Flag, &
507 & LBi, UBi, LBj, UBj, &
512 & start, total, Npts, Awrk)
552 logical,
intent(in) :: landfill
554 integer,
intent(in) :: ng, model, tile
555 integer,
intent(in) :: gtype, ifield, tindex
556 integer,
intent(in) :: extract_flag
557 integer,
intent(in) :: lbi, ubi, lbj, ubj
558 integer,
intent(out) :: npts
559 integer,
intent(out) :: start(:), total(:)
561 real(dp),
intent(in) :: ascl
565 real(r8),
intent(in) :: amask(lbi:,lbj:)
567 real(r8),
intent(in) :: adat(lbi:,lbj:)
570 real(r8),
intent(in) :: amask(lbi:ubi,lbj:ubj)
572 real(r8),
intent(in) :: adat(lbi:ubi,lbj:ubj)
574 real(r8),
intent(out) :: awrk(:)
579 integer :: imin, imax, jmin, jmax
580 integer :: isize, jsize, ijsize, mytype
582 character (len=*),
parameter :: myfile = &
583 & __FILE__//
", pack_field2d"
600 SELECT CASE (abs(mytype))
606 IF (extract_flag.ge.0)
THEN
613 imin=xtr_iobounds(ng)%ILB_psi
614 imax=xtr_iobounds(ng)%IUB_psi
615 jmin=xtr_iobounds(ng)%JLB_psi
616 jmax=xtr_iobounds(ng)%JUB_psi
624 IF (extract_flag.ge.0)
THEN
631 imin=xtr_iobounds(ng)%ILB_rho
632 imax=xtr_iobounds(ng)%IUB_rho
633 jmin=xtr_iobounds(ng)%JLB_rho
634 jmax=xtr_iobounds(ng)%JUB_rho
642 IF (extract_flag.ge.0)
THEN
649 imin=xtr_iobounds(ng)%ILB_u
650 imax=xtr_iobounds(ng)%IUB_u
651 jmin=xtr_iobounds(ng)%JLB_u
652 jmax=xtr_iobounds(ng)%JUB_u
660 IF (extract_flag.ge.0)
THEN
667 imin=xtr_iobounds(ng)%ILB_v
668 imax=xtr_iobounds(ng)%IUB_v
669 jmin=xtr_iobounds(ng)%JLB_v
670 jmax=xtr_iobounds(ng)%JUB_v
678 IF (extract_flag.ge.0)
THEN
685 imin=xtr_iobounds(ng)%ILB_rho
686 imax=xtr_iobounds(ng)%IUB_rho
687 jmin=xtr_iobounds(ng)%JLB_rho
688 jmax=xtr_iobounds(ng)%JUB_rho
712 IF (extract_flag.ge.0)
THEN
714 & tindex, gtype, ascl, &
718 & adat, npts, awrk, landfill)
721 CALL mp_gather2d_xtr (ng, model, lbi, ubi, lbj, ubj, &
722 & tindex, gtype, ascl, &
726 & adat, npts, awrk, landfill)
749 awrk(ic)=adat(i,j)*ascl
751 IF ((amask(i,j).eq.0.0_r8).and.landfill)
THEN
763 IF (amask(i,j).gt.0.0_r8)
THEN
765 awrk(ic)=adat(i,j)*ascl
779 IF (extract_flag.le.0)
THEN
802 ELSE IF (extract_flag.ge.1)
THEN
803 CALL extract_field (ng, model, tile, &
804 & gtype, ifield, tindex, &
806 & imin, imax, jmin, jmax, &
816 & gtype, ifield, tindex, &
817 & LandFill, Extract_Flag, &
818 & LBi, UBi, LBj, UBj, LBk, UBk, &
823 & start, total, Npts, Awrk)
865 logical,
intent(in) :: landfill
867 integer,
intent(in) :: ng, model, tile
868 integer,
intent(in) :: gtype, ifield, tindex
869 integer,
intent(in) :: extract_flag
870 integer,
intent(in) :: lbi, ubi, lbj, ubj, lbk, ubk
871 integer,
intent(out) :: npts
872 integer,
intent(out) :: start(:), total(:)
874 real(dp),
intent(in) :: ascl
878 real(r8),
intent(in) :: amask(lbi:,lbj:)
880 real(r8),
intent(in) :: adat(lbi:,lbj:,lbk:)
883 real(r8),
intent(in) :: amask(lbi:ubi,lbj:ubj)
885 real(r8),
intent(in) :: adat(lbi:ubi,lbj:ubj,lbk:ubk)
887 real(r8),
intent(out) :: awrk(:)
891 integer :: i, j, k, ic
892 integer :: imin, imax, jmin, jmax, koff
893 integer :: isize, jsize, ksize, ijsize, mytype
895 character (len=*),
parameter :: myfile = &
896 & __FILE__//
", pack_field3d"
907 SELECT CASE (abs(mytype))
981 CALL mp_gather3d (ng, model, lbi, ubi, lbj, ubj, lbk, ubk, &
982 & tindex, gtype, ascl, &
986 & adat, npts, awrk, landfill)
1001 IF (gtype.gt.0)
THEN
1007 awrk(ic)=adat(i,j,k)*ascl
1009 IF ((amask(i,j).eq.0.0_r8).and.landfill)
THEN
1023 IF (amask(i,j).gt.0.0_r8)
THEN
1025 awrk(ic)=adat(i,j,k)*ascl
1040 IF (extract_flag.le.0)
THEN
1041 IF (gtype.gt.0)
THEN
1065 ELSE IF (extract_flag.ge.1)
THEN
1066 CALL extract_field (ng, model, tile, &
1067 & gtype, ifield, tindex, &
1069 & imin, imax, jmin, jmax, lbk, ubk, &
1084 IF (abs(awrk(ic)).eq.0.0_r8)
THEN
1094 & gtype, ifield, tindex, &
1095 & LandFill, Extract_Flag, &
1096 & LBi, UBi, LBj, UBj, LBk, UBk, LBt, UBt, &
1102 & start, total, Npts, Awrk)
1148 logical,
intent(in) :: landfill
1150 integer,
intent(in) :: ng, model, tile
1151 integer,
intent(in) :: gtype, ifield, tindex
1152 integer,
intent(in) :: extract_flag
1153 integer,
intent(in) :: lbi, ubi, lbj, ubj, lbk, ubk, lbt, ubt
1154 integer,
intent(in) :: fourth
1155 integer,
intent(out) :: npts
1156 integer,
intent(out) :: start(:), total(:)
1158 real(dp),
intent(in) :: ascl
1162 real(r8),
intent(in) :: amask(lbi:,lbj:)
1164 real(r8),
intent(in) :: adat(lbi:,lbj:,lbk:,lbt:)
1167 real(r8),
intent(in) :: amask(lbi:ubi,lbj:ubj)
1169 real(r8),
intent(in) :: adat(lbi:ubi,lbj:ubj,lbk:ubk,lbt:ubt)
1171 real(r8),
intent(out) :: awrk(:)
1175 integer :: i, j, k, ic
1176 integer :: imin, imax, jmin, jmax, kmin, kmax, koff, loff
1177 integer :: isize, jsize, ksize, ijsize, mytype
1179 character (len=*),
parameter :: myfile = &
1180 & __FILE__//
", pack_field4d"
1191 SELECT CASE (abs(mytype))
1273 CALL mp_gather3d (ng, model, lbi, ubi, lbj, ubj, lbk, ubk, &
1274 & tindex, gtype, ascl, &
1278 & adat(:,:,:,fourth), npts, awrk, landfill)
1295 IF (gtype.gt.0)
THEN
1302 awrk(ic)=adat(i,j,k,fourth)*ascl
1304 IF ((amask(i,j).eq.0.0_r8).and.landfill)
THEN
1317 IF (amask(i,j).gt.0.0_r8)
THEN
1319 awrk(npts)=adat(i,j,k,fourth)*ascl
1333 IF (extract_flag.le.0)
THEN
1334 IF (gtype.gt.0)
THEN
1341 start(4)=fourth+loff
1347 start(1)=1+(fourth+loff-1)*npts
1360 ELSE IF (extract_flag.ge.1)
THEN
1361 CALL extract_field (ng, model, tile, &
1362 & gtype, ifield, tindex, &
1364 & imin, imax, jmin, jmax, lbk, ubk, &
1379 IF (abs(awrk(ic)).eq.0.0_r8)
THEN
subroutine mp_gather3d(ng, model, lbi, ubi, lbj, ubj, lbk, ubk, tindex, gtype, ascl, amask, a, npts, awrk, setfillval)
subroutine mp_gather2d(ng, model, lbi, ubi, lbj, ubj, tindex, gtype, ascl, amask, a, npts, awrk, setfillval)
type(t_bounds), dimension(:), allocatable bounds
integer, parameter r3dvar
type(t_iobounds), dimension(:), allocatable iobounds
integer, parameter u3dvar
type(t_domain), dimension(:), allocatable domain
integer, parameter u2dvar
integer, parameter p2dvar
integer, parameter r2dvar
integer, parameter v2dvar
integer, parameter p3dvar
integer, parameter v3dvar
real(dp), parameter spval
integer, parameter isouth
integer, parameter inorth
subroutine, public pack_boundary2d(ng, model, tile, gtype, ncvname, tindex, extract_flag, lbij, ubij, nrec, bscl, bdat, start, total, npts, bwrk)
subroutine, public pack_field3d(ng, model, tile, gtype, ifield, tindex, landfill, extract_flag, lbi, ubi, lbj, ubj, lbk, ubk, amask, ascl, adat, start, total, npts, awrk)
subroutine, public pack_field2d(ng, model, tile, gtype, ifield, tindex, landfill, extract_flag, lbi, ubi, lbj, ubj, amask, ascl, adat, start, total, npts, awrk)
subroutine, public pack_boundary3d(ng, model, tile, gtype, ncvname, tindex, extract_flag, lbij, ubij, lbk, ubk, nrec, bscl, bdat, start, total, npts, bwrk)
subroutine, public pack_field4d(ng, model, tile, gtype, ifield, tindex, landfill, extract_flag, lbi, ubi, lbj, ubj, lbk, ubk, lbt, ubt, fourth, amask, ascl, adat, start, total, npts, awrk)