1 |
C $Header: /usr/local/gcmpack/MITgcm/model/src/external_forcing_surf.F,v 1.18 2004/03/03 05:17:44 dimitri Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_OPTIONS.h" |
6 |
|
7 |
CBOP |
8 |
C !ROUTINE: EXTERNAL_FORCING_SURF |
9 |
C !INTERFACE: |
10 |
SUBROUTINE EXTERNAL_FORCING_SURF( |
11 |
I bi, bj, iMin, iMax, jMin, jMax, |
12 |
I myTime, myIter, myThid ) |
13 |
C !DESCRIPTION: \bv |
14 |
C *==========================================================* |
15 |
C | SUBROUTINE EXTERNAL_FORCING_SURF |
16 |
C | o Determines forcing terms based on external fields |
17 |
C | relaxation terms etc. |
18 |
C *==========================================================* |
19 |
C \ev |
20 |
|
21 |
C !USES: |
22 |
IMPLICIT NONE |
23 |
C === Global variables === |
24 |
#include "SIZE.h" |
25 |
#include "EEPARAMS.h" |
26 |
#include "PARAMS.h" |
27 |
#include "FFIELDS.h" |
28 |
#include "DYNVARS.h" |
29 |
#include "GRID.h" |
30 |
#include "SURFACE.h" |
31 |
#ifdef ALLOW_SEAICE |
32 |
#include "SEAICE.h" |
33 |
#endif /* ALLOW_SEAICE */ |
34 |
|
35 |
C !INPUT/OUTPUT PARAMETERS: |
36 |
C === Routine arguments === |
37 |
C myTime - Current time in simulation |
38 |
C myIter - Current iteration number in simulation |
39 |
C myThid :: Thread no. that called this routine. |
40 |
_RL myTime |
41 |
INTEGER myIter |
42 |
INTEGER myThid |
43 |
INTEGER bi,bj |
44 |
INTEGER iMin, iMax |
45 |
INTEGER jMin, jMax |
46 |
|
47 |
C !LOCAL VARIABLES: |
48 |
C === Local variables === |
49 |
INTEGER i,j |
50 |
C number of surface interface layer |
51 |
INTEGER kSurface |
52 |
CEOP |
53 |
|
54 |
if ( buoyancyRelation .eq. 'OCEANICP' ) then |
55 |
kSurface = Nr |
56 |
else |
57 |
kSurface = 1 |
58 |
endif |
59 |
|
60 |
C-- Surface Fluxes : |
61 |
|
62 |
DO j = jMin, jMax |
63 |
DO i = iMin, iMax |
64 |
|
65 |
c Zonal wind stress fu: |
66 |
surfaceTendencyU(i,j,bi,bj) = |
67 |
& fu(i,j,bi,bj)*horiVertRatio*recip_rhoConst |
68 |
& *recip_drF(kSurface)*recip_hFacW(i,j,kSurface,bi,bj) |
69 |
c Meridional wind stress fv: |
70 |
surfaceTendencyV(i,j,bi,bj) = |
71 |
& fv(i,j,bi,bj)*horiVertRatio*recip_rhoConst |
72 |
& *recip_drF(kSurface)*recip_hFacS(i,j,kSurface,bi,bj) |
73 |
c Net heat flux Qnet: |
74 |
surfaceTendencyT(i,j,bi,bj) = |
75 |
& -Qnet(i,j,bi,bj)*recip_Cp*horiVertRatio*recip_rhoConst |
76 |
& *recip_drF(kSurface)*recip_hFacC(i,j,kSurface,bi,bj) |
77 |
C Net Salt Flux : |
78 |
surfaceTendencyS(i,j,bi,bj) = |
79 |
& -saltFlux(i,j,bi,bj)*horiVertRatio*recip_rhoConst |
80 |
& *recip_drF(kSurface)*recip_hFacC(i,j,kSurface,bi,bj) |
81 |
|
82 |
#ifdef ALLOW_PASSIVE_TRACER |
83 |
c *** define the tracer surface tendency here *** |
84 |
#endif /* ALLOW_PASSIVE_TRACER */ |
85 |
|
86 |
ENDDO |
87 |
ENDDO |
88 |
|
89 |
C-- Surface restoring term : |
90 |
|
91 |
IF ( doThetaClimRelax .OR. doSaltClimRelax ) THEN |
92 |
DO j = jMin, jMax |
93 |
DO i = iMin, iMax |
94 |
#ifdef ALLOW_SEAICE |
95 |
C Don't restore under sea-ice |
96 |
C Heat Flux (restoring term) : |
97 |
surfaceTendencyT(i,j,bi,bj) = surfaceTendencyT(i,j,bi,bj) |
98 |
& -lambdaThetaClimRelax * (1-AREA(i,j,1,bi,bj)) |
99 |
& *(theta(i,j,kSurface,bi,bj)-SST(i,j,bi,bj)) |
100 |
C Salt Flux (restoring term) : |
101 |
surfaceTendencyS(i,j,bi,bj) = surfaceTendencyS(i,j,bi,bj) |
102 |
& -lambdaSaltClimRelax * (1-AREA(i,j,1,bi,bj)) |
103 |
& *(salt(i,j,kSurface,bi,bj)-SSS(i,j,bi,bj)) |
104 |
#else /* ifndef ALLOW_SEAICE */ |
105 |
C Heat Flux (restoring term) : |
106 |
IF ( abs(yC(i,j,bi,bj)).LE.latBandClimRelax ) THEN |
107 |
surfaceTendencyT(i,j,bi,bj) = surfaceTendencyT(i,j,bi,bj) |
108 |
& -lambdaThetaClimRelax |
109 |
& *(theta(i,j,kSurface,bi,bj)-SST(i,j,bi,bj)) |
110 |
C Salt Flux (restoring term) : |
111 |
surfaceTendencyS(i,j,bi,bj) = surfaceTendencyS(i,j,bi,bj) |
112 |
& -lambdaSaltClimRelax |
113 |
& *(salt(i,j,kSurface,bi,bj)-SSS(i,j,bi,bj)) |
114 |
ENDIF |
115 |
#endif /* ALLOW_SEAICE */ |
116 |
ENDDO |
117 |
ENDDO |
118 |
ENDIF |
119 |
|
120 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
121 |
C-- Fresh-water flux |
122 |
|
123 |
#ifdef NONLIN_FRSURF |
124 |
IF ( (nonlinFreeSurf.GT.0 .OR. buoyancyRelation.EQ.'OCEANICP') |
125 |
& .AND. useRealFreshWaterFlux ) THEN |
126 |
|
127 |
c- NonLin_FrSurf and RealFreshWaterFlux : PmEpR effectively changes |
128 |
c the water column height ; temp., salt, (tracer) flux associated |
129 |
c with this input/output of water is added here to the surface tendency. |
130 |
c |
131 |
c NB: PmEpR lag 1 time step behind EmPmR ( PmEpR_n = - EmPmR_n-1 ) to stay |
132 |
c consitent with volume change (=d/dt etaN). |
133 |
|
134 |
IF (temp_EvPrRn.NE.UNSET_RL) THEN |
135 |
DO j = jMin, jMax |
136 |
DO i = iMin, iMax |
137 |
surfaceTendencyT(i,j,bi,bj) = surfaceTendencyT(i,j,bi,bj) |
138 |
& + PmEpR(i,j,bi,bj) |
139 |
& *( temp_EvPrRn - theta(i,j,kSurface,bi,bj) ) |
140 |
& *recip_drF(kSurface)*recip_hFacC(i,j,kSurface,bi,bj) |
141 |
& *convertEmP2rUnit |
142 |
ENDDO |
143 |
ENDDO |
144 |
ENDIF |
145 |
|
146 |
IF (salt_EvPrRn.NE.UNSET_RL) THEN |
147 |
DO j = jMin, jMax |
148 |
DO i = iMin, iMax |
149 |
surfaceTendencyS(i,j,bi,bj) = surfaceTendencyS(i,j,bi,bj) |
150 |
& + PmEpR(i,j,bi,bj) |
151 |
& *( salt_EvPrRn - salt(i,j,kSurface,bi,bj) ) |
152 |
& *recip_drF(kSurface)*recip_hFacC(i,j,kSurface,bi,bj) |
153 |
& *convertEmP2rUnit |
154 |
ENDDO |
155 |
ENDDO |
156 |
ENDIF |
157 |
|
158 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
159 |
ELSE |
160 |
#else /* NONLIN_FRSURF */ |
161 |
IF (.TRUE.) THEN |
162 |
#endif /* NONLIN_FRSURF */ |
163 |
|
164 |
c- EmPmR does not really affect the water column height (for tracer budget) |
165 |
c and is converted to a salt tendency. |
166 |
|
167 |
IF (convertFW2Salt .EQ. -1.) THEN |
168 |
c- converts EmPmR to salinity tendency using surface local salinity |
169 |
DO j = jMin, jMax |
170 |
DO i = iMin, iMax |
171 |
surfaceTendencyS(i,j,bi,bj) = surfaceTendencyS(i,j,bi,bj) |
172 |
& + EmPmR(i,j,bi,bj)*salt(i,j,kSurface,bi,bj) |
173 |
& *recip_drF(kSurface)*recip_hFacC(i,j,kSurface,bi,bj) |
174 |
& *convertEmP2rUnit |
175 |
ENDDO |
176 |
ENDDO |
177 |
ELSE |
178 |
c- converts EmPmR to virtual salt flux using uniform salinity (default=35) |
179 |
DO j = jMin, jMax |
180 |
DO i = iMin, iMax |
181 |
surfaceTendencyS(i,j,bi,bj) = surfaceTendencyS(i,j,bi,bj) |
182 |
& + EmPmR(i,j,bi,bj)*convertFW2Salt |
183 |
& *recip_drF(kSurface)*recip_hFacC(i,j,kSurface,bi,bj) |
184 |
& *convertEmP2rUnit |
185 |
ENDDO |
186 |
ENDDO |
187 |
ENDIF |
188 |
|
189 |
ENDIF |
190 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
191 |
#ifdef ALLOW_PTRACERS |
192 |
IF ( usePTRACERS ) THEN |
193 |
CALL PTRACERS_FORCING_SURF( |
194 |
I bi, bj, iMin, iMax, jMin, jMax, |
195 |
I myTime,myIter,myThid ) |
196 |
ENDIF |
197 |
#endif /* ALLOW_PTRACERS */ |
198 |
|
199 |
#ifdef ATMOSPHERIC_LOADING |
200 |
|
201 |
C-- Atmospheric surface Pressure loading : |
202 |
|
203 |
IF (buoyancyRelation .eq. 'OCEANIC' ) THEN |
204 |
DO j = jMin, jMax |
205 |
DO i = iMin, iMax |
206 |
phi0surf(i,j,bi,bj) = pload(i,j,bi,bj)*recip_rhoConst |
207 |
ENDDO |
208 |
ENDDO |
209 |
ELSEIF ( buoyancyRelation .eq. 'OCEANICP' ) THEN |
210 |
C-- This is a hack used to read phi0surf from a file (ploadFile) |
211 |
C instead of computing it from bathymetry & density ref. profile. |
212 |
C The true atmospheric P-loading is not yet implemented for P-coord |
213 |
C (requires time varying dP(Nr) like dP(k-bottom) with NonLin FS). |
214 |
DO j = jMin, jMax |
215 |
DO i = iMin, iMax |
216 |
phi0surf(i,j,bi,bj) = pload(i,j,bi,bj) |
217 |
ENDDO |
218 |
ENDDO |
219 |
ENDIF |
220 |
|
221 |
#endif /* ATMOSPHERIC_LOADING */ |
222 |
|
223 |
#ifdef ALLOW_TIMEAVE |
224 |
IF ( taveFreq .NE. 0. _d 0 ) THEN |
225 |
CALL TIMEAVE_SURF_FLUX( bi, bj, myTime, myIter, myThid) |
226 |
ENDIF |
227 |
#endif /* ALLOW_TIMEAVE */ |
228 |
|
229 |
RETURN |
230 |
END |