26
27
33
35# ifdef DISTRIBUTE
37# endif
38
39
40
41 logical, intent(in), optional :: SetBC
42
43 logical, intent(out) :: update
44
45 integer, intent(in) :: ng, tile, model, ifield
46 integer, intent(in) :: LBi, UBi, LBj, UBj
47
48# ifdef ASSUMED_SHAPE
49 real(r8), intent(in) :: Finp(LBi:,LBj:,:)
50 real(r8), intent(out) :: Fout(LBi:,LBj:)
51# else
52 real(r8), intent(in) :: Finp(LBi:UBi,LBj:UBj,2)
53 real(r8), intent(out) :: Fout(LBi:UBi,LBj:UBj)
54# endif
55
56
57
58 logical :: LapplyBC, Lgrided, Lonerec
59
60 integer :: Tindex, gtype, i, it1, it2, j
61
62 real(dp) :: SecScale, fac, fac1, fac2
63 real(r8) :: Fval
64
65# include "set_bounds.h"
66
67
68
69
70
71
72
73 IF (PRESENT(setbc)) THEN
74 lapplybc=setbc
75 ELSE
76 lapplybc=.true.
77 END IF
78
79
80
81 lgrided=
linfo(1,ifield,ng)
82 lonerec=
linfo(3,ifield,ng)
83 gtype =
iinfo(1,ifield,ng)
84 tindex =
iinfo(8,ifield,ng)
85 update=.true.
86
87
88
89
90
91 secscale=1000.0_dp
92 it1=3-tindex
93 it2=tindex
94 fac1=anint((
time(ng)-
tintrp(it2,ifield,ng))*secscale,dp)
95 fac2=anint((
tintrp(it1,ifield,ng)-
time(ng))*secscale,dp)
96
97
98
99 IF (lonerec) THEN
100 IF (lgrided) THEN
101 DO j=jstrr,jendr
102 DO i=istrr,iendr
103 fout(i,j)=finp(i,j,tindex)
104 END DO
105 END DO
106 ELSE
107 fval=
fpoint(tindex,ifield,ng)
108 DO j=jstrr,jendr
109 DO i=istrr,iendr
110 fout(i,j)=fval
111 END DO
112 END DO
113 END IF
114
115
116
117 ELSE IF (((fac1*fac2).ge.0.0_dp).and. &
118 & ((fac1+fac2).gt.0.0_dp)) THEN
119 fac=1.0_dp/(fac1+fac2)
120 fac1=fac*fac1
121 fac2=fac*fac2
122 IF (lgrided) THEN
123 DO j=jstrr,jendr
124 DO i=istrr,iendr
125 fout(i,j)=fac1*finp(i,j,it1)+fac2*finp(i,j,it2)
126 END DO
127 END DO
128 ELSE
129 fval=fac1*
fpoint(it1,ifield,ng)+fac2*
fpoint(it2,ifield,ng)
130 DO j=jstrr,jendr
131 DO i=istrr,iendr
132 fout(i,j)=fval
133 END DO
134 END DO
135 END IF
136
137
138
139
142 END IF
143
144
145
146 ELSE
147 IF (
domain(ng)%SouthWest_Test(tile))
THEN
156 END IF
157 10 FORMAT (/,' SET_2DFLDR - current model time', &
158 & ' exceeds ending value for variable: ',a, &
159 & /,14x,'TDAYS = ',f15.4, &
160 & /,14x,'Data Tmin = ',f15.4,2x,'Data Tmax = ',f15.4, &
161 & /,14x,'Data Tstr = ',f15.4,2x,'Data Tend = ',f15.4, &
162 & /,14x,'TINTRP1 = ',f15.4,2x,'TINTRP2 = ',f15.4, &
163 & /,14x,'FAC1 = ',f15.4,2x,'FAC2 = ',f15.4)
165 update=.false.
166 END IF
167 END IF
168
169
170
171 IF (update) THEN
175 & lbi, ubi, lbj, ubj, &
176 & fout)
177 ELSE IF (gtype.eq.
u2dvar)
THEN
179 & lbi, ubi, lbj, ubj, &
180 & fout)
181 ELSE IF (gtype.eq.
v2dvar)
THEN
183 & lbi, ubi, lbj, ubj, &
184 & fout)
185 END IF
186 END IF
187
188# ifdef DISTRIBUTE
189 IF (.not.lapplybc) THEN
191 & lbi, ubi, lbj, ubj, &
193 & .false., .false., &
194 & fout)
195 ELSE
197 & lbi, ubi, lbj, ubj, &
200 & fout)
201 END IF
202# endif
203 END IF
204
205 RETURN
subroutine exchange_r2d_tile(ng, tile, lbi, ubi, lbj, ubj, a)
subroutine exchange_u2d_tile(ng, tile, lbi, ubi, lbj, ubj, a)
subroutine exchange_v2d_tile(ng, tile, lbi, ubi, lbj, ubj, a)
logical, dimension(:,:,:), allocatable linfo
real(dp), dimension(:,:,:), allocatable tintrp
real(dp), dimension(:,:,:), allocatable fpoint
real(dp), dimension(:,:,:), allocatable finfo
character(len=maxlen), dimension(6, 0:nv) vname
integer, dimension(:,:,:), allocatable iinfo
type(t_domain), dimension(:), allocatable domain
integer, parameter u2dvar
integer, parameter r2dvar
integer, parameter v2dvar
real(dp), dimension(:), allocatable dt
logical, dimension(:), allocatable ewperiodic
logical, dimension(:), allocatable nsperiodic
logical, dimension(:), allocatable synchro_flag
real(dp), dimension(:), allocatable tdays
real(dp), parameter sec2day
real(dp), dimension(:), allocatable time
subroutine mp_exchange2d(ng, tile, model, nvar, lbi, ubi, lbj, ubj, nghost, ew_periodic, ns_periodic, a, b, c, d)