1 |
C $Header: /u/gcmpack/MITgcm/pkg/ocn_compon_interf/ocn_apply_import.F,v 1.6 2008/04/04 21:43:57 dfer Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_OPTIONS.h" |
6 |
|
7 |
CBOP |
8 |
C !ROUTINE: OCN_APPLY_IMPORT |
9 |
C !INTERFACE: |
10 |
SUBROUTINE OCN_APPLY_IMPORT( |
11 |
I apply2AllFields, myTime, myIter, myThid ) |
12 |
C !DESCRIPTION: \bv |
13 |
C *==========================================================* |
14 |
C | SUBROUTINE OCN_APPLY_IMPORT |
15 |
C | o Apply imported coupling data to forcing fields |
16 |
C *==========================================================* |
17 |
C *==========================================================* |
18 |
C \ev |
19 |
|
20 |
C !USES: |
21 |
IMPLICIT NONE |
22 |
C === Global variables === |
23 |
#include "SIZE.h" |
24 |
#include "EEPARAMS.h" |
25 |
#include "PARAMS.h" |
26 |
#include "CPL_PARAMS.h" |
27 |
#include "OCNIDS.h" |
28 |
#include "OCNCPL.h" |
29 |
#include "FFIELDS.h" |
30 |
#include "SURFACE.h" |
31 |
c #include "GRID.h" |
32 |
c #include "DYNVARS.h" |
33 |
#ifdef ALLOW_DIC |
34 |
# include "DIC_VARS.h" |
35 |
#endif |
36 |
|
37 |
C !INPUT/OUTPUT PARAMETERS: |
38 |
C === Routine arguments === |
39 |
C apply2AllFields - flag: T= apply import to all coupling fields |
40 |
C F= only forcing fields relevant for eta variations |
41 |
C myTime - Simulation time |
42 |
C myIter - Simulation timestep number |
43 |
C myThid - Thread no. that called this routine. |
44 |
LOGICAL apply2AllFields |
45 |
_RL myTime |
46 |
INTEGER myIter |
47 |
INTEGER myThid |
48 |
|
49 |
C !LOCAL VARIABLES: |
50 |
C === Local arrays === |
51 |
INTEGER bi,bj,i,j |
52 |
CEOP |
53 |
|
54 |
C-- Use imported coupling data in place of input files data: |
55 |
DO bj = myByLo(myThid), myByHi(myThid) |
56 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
57 |
|
58 |
C-- Aplly import to all coupling fields (standard way) |
59 |
IF ( apply2AllFields ) THEN |
60 |
|
61 |
C- Dynamical forcing |
62 |
IF ( useImportTau ) THEN |
63 |
DO j=1-Oly,sNy+Oly |
64 |
DO i=1-Olx,sNx+Olx |
65 |
fu(i,j,bi,bj) = tauX(i,j,bi,bj) |
66 |
fv(i,j,bi,bj) = tauY(i,j,bi,bj) |
67 |
ENDDO |
68 |
ENDDO |
69 |
ENDIF |
70 |
IF ( useImportSLP ) THEN |
71 |
DO j=1-Oly,sNy+Oly |
72 |
DO i=1-Olx,sNx+Olx |
73 |
pLoad(i,j,bi,bj) = atmSLPr(i,j,bi,bj) |
74 |
ENDDO |
75 |
ENDDO |
76 |
ENDIF |
77 |
IF ( useImportSIce ) THEN |
78 |
DO j=1-Oly,sNy+Oly |
79 |
DO i=1-Olx,sNx+Olx |
80 |
sIceLoad(i,j,bi,bj) = seaIceMass(i,j,bi,bj) |
81 |
ENDDO |
82 |
ENDDO |
83 |
ENDIF |
84 |
|
85 |
C- Fresh-Water & Salinity forcing |
86 |
IF ( useImportFW ) THEN |
87 |
DO j=1-Oly,sNy+Oly |
88 |
DO i=1-Olx,sNx+Olx |
89 |
EmPmR(i,j,bi,bj) = FWFlux (i,j,bi,bj) |
90 |
ENDDO |
91 |
ENDDO |
92 |
ENDIF |
93 |
IF ( useImportFW ) THEN |
94 |
DO j=1-Oly,sNy+Oly |
95 |
DO i=1-Olx,sNx+Olx |
96 |
saltFlux(i,j,bi,bj)= iceSaltFlx(i,j,bi,bj) |
97 |
ENDDO |
98 |
ENDDO |
99 |
ENDIF |
100 |
|
101 |
C- Heat Flux forcing |
102 |
IF ( useImportHFlx ) THEN |
103 |
DO j=1-Oly,sNy+Oly |
104 |
DO i=1-Olx,sNx+Olx |
105 |
Qnet(i,j,bi,bj)= HeatFlux (i,j,bi,bj) |
106 |
ENDDO |
107 |
ENDDO |
108 |
#ifdef SHORTWAVE_HEATING |
109 |
DO j=1-Oly,sNy+Oly |
110 |
DO i=1-Olx,sNx+Olx |
111 |
Qsw(i,j,bi,bj) = qShortWave(i,j,bi,bj) |
112 |
ENDDO |
113 |
ENDDO |
114 |
#endif |
115 |
ENDIF |
116 |
|
117 |
#ifdef ALLOW_DIC |
118 |
C- Carbon/DIC exchanges |
119 |
IF ( useImportFice ) THEN |
120 |
DO j=1-Oly,sNy+Oly |
121 |
DO i=1-Olx,sNx+Olx |
122 |
fice(i,j,bi,bj)= fracIce(i,j,bi,bj) |
123 |
ENDDO |
124 |
ENDDO |
125 |
ENDIF |
126 |
IF ( useImportCO2 ) THEN |
127 |
DO j=1-Oly,sNy+Oly |
128 |
DO i=1-Olx,sNx+Olx |
129 |
AtmospCO2(i,j,bi,bj)= airCO2(i,j,bi,bj) |
130 |
ENDDO |
131 |
ENDDO |
132 |
ENDIF |
133 |
IF ( useImportWSpd ) THEN |
134 |
DO j=1-Oly,sNy+Oly |
135 |
DO i=1-Olx,sNx+Olx |
136 |
wind(i,j,bi,bj)= surfWSpeed(i,j,bi,bj) |
137 |
ENDDO |
138 |
ENDDO |
139 |
ENDIF |
140 |
#endif /* ALLOW_DIC */ |
141 |
|
142 |
C-- Apply only to forcings relevant for eta/surf.press variations |
143 |
ELSE |
144 |
|
145 |
IF ( useImportSIce .AND. useImportSLP ) THEN |
146 |
DO j=1-Oly,sNy+Oly |
147 |
DO i=1-Olx,sNx+Olx |
148 |
phi0surf(i,j,bi,bj) = atmSLPr(i,j,bi,bj)*recip_rhoConst |
149 |
& + gravity*seaIceMass(i,j,bi,bj)*recip_rhoConst |
150 |
ENDDO |
151 |
ENDDO |
152 |
ELSEIF ( useImportSIce ) THEN |
153 |
DO j=1-Oly,sNy+Oly |
154 |
DO i=1-Olx,sNx+Olx |
155 |
phi0surf(i,j,bi,bj) = pLoad(i,j,bi,bj)*recip_rhoConst |
156 |
& + gravity*seaIceMass(i,j,bi,bj)*recip_rhoConst |
157 |
ENDDO |
158 |
ENDDO |
159 |
ELSEIF ( useImportSLP ) THEN |
160 |
DO j=1-Oly,sNy+Oly |
161 |
DO i=1-Olx,sNx+Olx |
162 |
phi0surf(i,j,bi,bj) = atmSLPr(i,j,bi,bj)*recip_rhoConst |
163 |
ENDDO |
164 |
ENDDO |
165 |
ENDIF |
166 |
|
167 |
IF ( useImportFW ) THEN |
168 |
DO j=1-Oly,sNy+Oly |
169 |
DO i=1-Olx,sNx+Olx |
170 |
EmPmR(i,j,bi,bj) = FWFlux (i,j,bi,bj) |
171 |
ENDDO |
172 |
ENDDO |
173 |
ENDIF |
174 |
|
175 |
C-- end if apply2AllFields / else blocks |
176 |
ENDIF |
177 |
|
178 |
C-- end bi,bj loop |
179 |
ENDDO |
180 |
ENDDO |
181 |
|
182 |
C-- Fill in Halo region with valid values |
183 |
|
184 |
#ifdef ATMOSPHERIC_LOADING |
185 |
IF ( useImportSLP . AND. |
186 |
& ( ocnCpl_exchange_DIC .OR. apply2AllFields ) ) |
187 |
& _EXCH_XY_RS( pLoad, myThid ) |
188 |
IF ( apply2AllFields ) THEN |
189 |
IF ( useImportSIce) _EXCH_XY_RS( sIceLoad, myThid ) |
190 |
ELSEIF ( useImportSLP .OR. useImportSIce ) THEN |
191 |
_EXCH_XY_RS( phi0surf, myThid ) |
192 |
ENDIF |
193 |
#else |
194 |
IF ( useImportSLP . AND. ocnCpl_exchange_DIC) |
195 |
& _EXCH_XY_RS( pLoad, myThid ) |
196 |
#endif |
197 |
|
198 |
IF ( useImportFW ) _EXCH_XY_RS(EmPmR, myThid ) |
199 |
IF ( apply2AllFields ) THEN |
200 |
IF (useImportTau ) CALL EXCH_UV_XY_RS(fu,fv,.TRUE.,myThid) |
201 |
IF (useImportFW ) _EXCH_XY_RS(saltFlux, myThid ) |
202 |
IF (useImportHFlx) _EXCH_XY_RS(Qnet , myThid ) |
203 |
#ifdef SHORTWAVE_HEATING |
204 |
IF (useImportHFlx) _EXCH_XY_RS(Qsw , myThid ) |
205 |
#endif |
206 |
#ifdef ALLOW_DIC |
207 |
IF ( useImportFice ) _EXCH_XY_RL(fice , myThid ) |
208 |
IF ( useImportCO2 ) _EXCH_XY_RL(AtmospCO2 , myThid ) |
209 |
IF ( useImportWSpd ) _EXCH_XY_RL(wind , myThid ) |
210 |
#endif |
211 |
ENDIF |
212 |
|
213 |
RETURN |
214 |
END |