3 |
#include "EXF_CPPOPTIONS.h" |
#include "EXF_CPPOPTIONS.h" |
4 |
|
|
5 |
|
|
6 |
subroutine exf_MapFields( |
subroutine exf_mapfields( mythid ) |
|
I mythid |
|
|
& ) |
|
7 |
|
|
8 |
c ================================================================== |
c ================================================================== |
9 |
c SUBROUTINE exf_MapFields |
c SUBROUTINE exf_mapfields |
10 |
c ================================================================== |
c ================================================================== |
11 |
c |
c |
12 |
c o Map the external forcing fields on the ocean model arrays. This |
c o Map the external forcing fields on the ocean model arrays. This |
50 |
c scaling factors scal_ust, scal_vst |
c scaling factors scal_ust, scal_vst |
51 |
c |
c |
52 |
c ================================================================== |
c ================================================================== |
53 |
c SUBROUTINE exf_MapFields |
c SUBROUTINE exf_mapfields |
54 |
c ================================================================== |
c ================================================================== |
55 |
|
|
56 |
implicit none |
implicit none |
60 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
61 |
#include "SIZE.h" |
#include "SIZE.h" |
62 |
#include "FFIELDS.h" |
#include "FFIELDS.h" |
63 |
|
#include "exf_param.h" |
64 |
#include "exf_constants.h" |
#include "exf_constants.h" |
65 |
#include "exf_fields.h" |
#include "exf_fields.h" |
66 |
#include "exf_clim_fields.h" |
#include "exf_clim_fields.h" |
67 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
68 |
|
# include "tamc.h" |
69 |
|
# include "tamc_keys.h" |
70 |
|
#endif |
71 |
c == routine arguments == |
c == routine arguments == |
72 |
|
|
73 |
c mythid - thread number for this instance of the routine. |
c mythid - thread number for this instance of the routine. |
86 |
integer jmax |
integer jmax |
87 |
integer imin |
integer imin |
88 |
integer imax |
integer imax |
|
_RL scal_hfl |
|
|
_RL scal_ust |
|
|
_RL scal_vst |
|
|
_RL scal_swf |
|
|
_RL scal_sst |
|
|
_RL scal_sss |
|
|
#if (defined (ALLOW_BULKFORMULAE) && defined (ALLOW_ATM_TEMP)) |
|
|
_RL scal_prc |
|
|
#else |
|
|
_RL scal_sfl |
|
|
#endif |
|
89 |
|
|
90 |
c == end of interface == |
c == end of interface == |
91 |
|
|
98 |
imin = 1-olx |
imin = 1-olx |
99 |
imax = snx+olx |
imax = snx+olx |
100 |
|
|
|
scal_hfl = 1. _d 0 |
|
|
scal_ust = -1. _d 0 |
|
|
scal_vst = -1. _d 0 |
|
|
scal_swf = 1. _d 0 |
|
|
scal_sst = 1. _d 0 |
|
|
scal_sss = 1. _d 0 |
|
|
#if (defined (ALLOW_BULKFORMULAE) && defined (ALLOW_ATM_TEMP)) |
|
|
scal_prc = 1. _d 0 |
|
|
#else |
|
|
scal_sfl = 1. _d 0 |
|
|
#endif |
|
|
|
|
101 |
do bj = jtlo,jthi |
do bj = jtlo,jthi |
102 |
do bi = itlo,ithi |
do bi = itlo,ithi |
103 |
|
|
104 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
105 |
|
act1 = bi - myBxLo(myThid) |
106 |
|
max1 = myBxHi(myThid) - myBxLo(myThid) + 1 |
107 |
|
act2 = bj - myByLo(myThid) |
108 |
|
max2 = myByHi(myThid) - myByLo(myThid) + 1 |
109 |
|
act3 = myThid - 1 |
110 |
|
max3 = nTx*nTy |
111 |
|
act4 = ikey_dynamics - 1 |
112 |
|
ikey = (act1 + 1) + act2*max1 |
113 |
|
& + act3*max1*max2 |
114 |
|
& + act4*max1*max2*max3 |
115 |
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
116 |
|
|
117 |
do j = jmin,jmax |
do j = jmin,jmax |
118 |
do i = imin,imax |
do i = imin,imax |
|
|
|
119 |
c Heat flux. |
c Heat flux. |
120 |
qnet(i,j,bi,bj) = scal_hfl*hflux(i,j,bi,bj) |
qnet(i,j,bi,bj) = scal_hfl*hflux(i,j,bi,bj) |
121 |
|
enddo |
122 |
|
enddo |
123 |
|
|
124 |
|
|
125 |
|
do j = jmin,jmax |
126 |
|
do i = imin,imax |
127 |
c Salt flux. |
c Salt flux. |
128 |
#if (defined (ALLOW_BULKFORMULAE) && defined (ALLOW_ATM_TEMP)) |
#if (defined (ALLOW_BULKFORMULAE) && defined (ALLOW_ATM_TEMP)) |
129 |
empmr(i,j,bi,bj) = scal_prc*precip(i,j,bi,bj) |
empmr(i,j,bi,bj) = scal_prc*precip(i,j,bi,bj) |
130 |
#else |
#else |
131 |
empmr(i,j,bi,bj) = scal_sfl*sflux(i,j,bi,bj) |
empmr(i,j,bi,bj) = scal_sfl*sflux(i,j,bi,bj) |
132 |
#endif |
#endif |
133 |
|
enddo |
134 |
|
enddo |
135 |
|
|
136 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
137 |
|
CADJ STORE ustress(:,:,bi,bj) = comlev1_bibj, key=ikey, byte=isbyte |
138 |
|
#endif |
139 |
|
do j = jmin,jmax |
140 |
|
do i = imin,imax |
141 |
c Zonal wind stress. |
c Zonal wind stress. |
142 |
|
if (ustress(i,j,bi,bj).gt.2.0D0) then |
143 |
|
ustress(i,j,bi,bj)=2.0D0 |
144 |
|
endif |
145 |
|
enddo |
146 |
|
enddo |
147 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
148 |
|
CADJ STORE ustress(:,:,bi,bj) = comlev1_bibj, key=ikey, byte=isbyte |
149 |
|
#endif |
150 |
|
do j = jmin,jmax |
151 |
|
do i = imin,imax |
152 |
|
if (ustress(i,j,bi,bj).lt.-2.0D0) then |
153 |
|
ustress(i,j,bi,bj)=-2.0D0 |
154 |
|
endif |
155 |
|
enddo |
156 |
|
enddo |
157 |
|
do j = jmin,jmax |
158 |
|
do i = imin,imax |
159 |
fu(i,j,bi,bj) = scal_ust*ustress(i,j,bi,bj) |
fu(i,j,bi,bj) = scal_ust*ustress(i,j,bi,bj) |
160 |
|
enddo |
161 |
|
enddo |
162 |
|
|
163 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
164 |
|
CADJ STORE vstress(:,:,bi,bj) = comlev1_bibj, key=ikey, byte=isbyte |
165 |
|
#endif |
166 |
|
do j = jmin,jmax |
167 |
|
do i = imin,imax |
168 |
c Meridional wind stress. |
c Meridional wind stress. |
169 |
|
if (vstress(i,j,bi,bj).gt.2.0D0) then |
170 |
|
vstress(i,j,bi,bj)=2.0D0 |
171 |
|
endif |
172 |
|
enddo |
173 |
|
enddo |
174 |
|
#ifdef ALLOW_AUTODIFF_TAMC |
175 |
|
CADJ STORE vstress(:,:,bi,bj) = comlev1_bibj, key=ikey, byte=isbyte |
176 |
|
#endif |
177 |
|
do j = jmin,jmax |
178 |
|
do i = imin,imax |
179 |
|
if (vstress(i,j,bi,bj).lt.-2.0D0) then |
180 |
|
vstress(i,j,bi,bj)=-2.0D0 |
181 |
|
endif |
182 |
|
enddo |
183 |
|
enddo |
184 |
|
do j = jmin,jmax |
185 |
|
do i = imin,imax |
186 |
fv(i,j,bi,bj) = scal_vst*vstress(i,j,bi,bj) |
fv(i,j,bi,bj) = scal_vst*vstress(i,j,bi,bj) |
187 |
|
enddo |
188 |
|
enddo |
189 |
|
|
190 |
#ifdef ALLOW_KPP || (defined (ALLOW_BULKFORMULAE) && defined (ALLOW_ATM_TEMP))) |
#ifdef ALLOW_KPP || \ |
191 |
|
(defined (ALLOW_BULKFORMULAE) && defined (ALLOW_ATM_TEMP))) |
192 |
c Short wave radiative flux. |
c Short wave radiative flux. |
193 |
|
do j = jmin,jmax |
194 |
|
do i = imin,imax |
195 |
qsw(i,j,bi,bj) = scal_swf*swflux(i,j,bi,bj) |
qsw(i,j,bi,bj) = scal_swf*swflux(i,j,bi,bj) |
196 |
|
enddo |
197 |
|
enddo |
198 |
#endif |
#endif |
199 |
|
|
200 |
#ifdef ALLOW_CLIMSST_RELAXATION |
#ifdef ALLOW_CLIMSST_RELAXATION |
201 |
|
do j = jmin,jmax |
202 |
|
do i = imin,imax |
203 |
sst(i,j,bi,bj) = scal_sst*climsst(i,j,bi,bj) |
sst(i,j,bi,bj) = scal_sst*climsst(i,j,bi,bj) |
204 |
|
enddo |
205 |
|
enddo |
206 |
#endif |
#endif |
207 |
|
|
208 |
#ifdef ALLOW_CLIMSSS_RELAXATION |
#ifdef ALLOW_CLIMSSS_RELAXATION |
209 |
|
do j = jmin,jmax |
210 |
|
do i = imin,imax |
211 |
sss(i,j,bi,bj) = scal_sss*climsss(i,j,bi,bj) |
sss(i,j,bi,bj) = scal_sss*climsss(i,j,bi,bj) |
212 |
|
enddo |
213 |
|
enddo |
214 |
#endif |
#endif |
215 |
|
|
216 |
|
#ifdef ATMOSPHERIC_LOADING |
217 |
|
do j = jmin,jmax |
218 |
|
do i = imin,imax |
219 |
|
pload(i,j,bi,bj) = scal_apressure*apressure(i,j,bi,bj) |
220 |
enddo |
enddo |
221 |
enddo |
enddo |
222 |
|
#endif |
223 |
|
|
224 |
|
|
225 |
enddo |
enddo |
226 |
enddo |
enddo |
227 |
|
|
240 |
#ifdef ALLOW_CLIMSSS_RELAXATION |
#ifdef ALLOW_CLIMSSS_RELAXATION |
241 |
_EXCH_XY_R4( sss, mythid ) |
_EXCH_XY_R4( sss, mythid ) |
242 |
#endif |
#endif |
243 |
|
#ifdef ATMOSPHERIC_LOADING |
244 |
|
_EXCH_XY_R4( pload, mythid ) |
245 |
|
#endif |
246 |
|
|
247 |
end |
end |