25
26
32
34#ifdef DISTRIBUTE
36#endif
37
38
39
40 logical, intent(in), optional :: SetBC
41
42 logical, intent(out) :: update
43
44 integer, intent(in) :: ng, tile, model, ifield
45 integer, intent(in) :: LBi, UBi, LBj, UBj
46
47#ifdef ASSUMED_SHAPE
48 real(r8), intent(in) :: Finp(LBi:,LBj:,:)
49 real(r8), intent(out) :: Fout(LBi:,LBj:)
50#else
51 real(r8), intent(in) :: Finp(LBi:UBi,LBj:UBj,2)
52 real(r8), intent(out) :: Fout(LBi:UBi,LBj:UBj)
53#endif
54
55
56
57 logical :: LapplyBC, Lgrided, Lonerec
58
59 integer :: Tindex, gtype, i, it1, it2, j
60
61 real(dp) :: SecScale, fac, fac1, fac2
62 real(r8) :: Fval
63
64#include "set_bounds.h"
65
66
67
68
69
70
71
72 IF (PRESENT(setbc)) THEN
73 lapplybc=setbc
74 ELSE
75 lapplybc=.true.
76 END IF
77
78
79
80 lgrided=
linfo(1,ifield,ng)
81 lonerec=
linfo(3,ifield,ng)
82 gtype =
iinfo(1,ifield,ng)
83 tindex =
iinfo(8,ifield,ng)
84 update=.true.
85
86
87
88
89
90 secscale=1000.0_dp
91 it1=3-tindex
92 it2=tindex
93 fac1=anint((
tintrp(it2,ifield,ng)-
time(ng))*secscale,dp)
94 fac2=anint((
time(ng)-
tintrp(it1,ifield,ng))*secscale,dp)
95
96
97
98 IF (lonerec) THEN
99 IF (lgrided) THEN
100 DO j=jstrr,jendr
101 DO i=istrr,iendr
102 fout(i,j)=finp(i,j,tindex)
103 END DO
104 END DO
105 ELSE
106 fval=
fpoint(tindex,ifield,ng)
107 DO j=jstrr,jendr
108 DO i=istrr,iendr
109 fout(i,j)=fval
110 END DO
111 END DO
112 END IF
113
114
115
116 ELSE IF (((fac1*fac2).ge.0.0_dp).and. &
117 & ((fac1+fac2).gt.0.0_dp)) THEN
118 fac=1.0_dp/(fac1+fac2)
119 fac1=fac*fac1
120 fac2=fac*fac2
121 IF (lgrided) THEN
122 DO j=jstrr,jendr
123 DO i=istrr,iendr
124 fout(i,j)=fac1*finp(i,j,it1)+fac2*finp(i,j,it2)
125 END DO
126 END DO
127 ELSE
128 fval=fac1*
fpoint(it1,ifield,ng)+fac2*
fpoint(it2,ifield,ng)
129 DO j=jstrr,jendr
130 DO i=istrr,iendr
131 fout(i,j)=fval
132 END DO
133 END DO
134 END IF
135
136
137
138
141 END IF
142
143
144
145 ELSE
146 IF (
domain(ng)%SouthWest_Test(tile))
THEN
155 END IF
156 10 FORMAT (/,' SET_2DFLD - current model time', &
157 & ' exceeds ending value for variable: ',a, &
158 & /,14x,'TDAYS = ',f15.4, &
159 & /,14x,'Data Tmin = ',f15.4,2x,'Data Tmax = ',f15.4, &
160 & /,14x,'Data Tstr = ',f15.4,2x,'Data Tend = ',f15.4, &
161 & /,14x,'TINTRP1 = ',f15.4,2x,'TINTRP2 = ',f15.4, &
162 & /,14x,'FAC1 = ',f15.4,2x,'FAC2 = ',f15.4)
164 update=.false.
165 END IF
166 END IF
167
168
169
170 IF (update) THEN
174 & lbi, ubi, lbj, ubj, &
175 & fout)
176 ELSE IF (gtype.eq.
u2dvar)
THEN
178 & lbi, ubi, lbj, ubj, &
179 & fout)
180 ELSE IF (gtype.eq.
v2dvar)
THEN
182 & lbi, ubi, lbj, ubj, &
183 & fout)
184 END IF
185 END IF
186
187#ifdef DISTRIBUTE
188 IF (.not.lapplybc) THEN
190 & lbi, ubi, lbj, ubj, &
192 & .false., .false., &
193 & fout)
194 ELSE
196 & lbi, ubi, lbj, ubj, &
199 & fout)
200 END IF
201#endif
202 END IF
203
204 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)