1 |
jmc |
1.6 |
C $Header: /u/gcmpack/MITgcm/verification/tutorial_held_suarez_cs/code/external_forcing.F,v 1.1 2005/07/15 21:25:20 jmc Exp $ |
2 |
adcroft |
1.3 |
C $Name: $ |
3 |
adcroft |
1.2 |
|
4 |
|
|
#include "CPP_OPTIONS.h" |
5 |
|
|
|
6 |
jmc |
1.6 |
CBOP |
7 |
|
|
C !ROUTINE: EXTERNAL_FORCING_U |
8 |
|
|
C !INTERFACE: |
9 |
adcroft |
1.2 |
SUBROUTINE EXTERNAL_FORCING_U( |
10 |
jmc |
1.6 |
I iMin,iMax, jMin,jMax, bi,bj, kLev, |
11 |
|
|
I myTime, myThid ) |
12 |
|
|
C !DESCRIPTION: \bv |
13 |
|
|
C *==========================================================* |
14 |
|
|
C | S/R EXTERNAL_FORCING_U |
15 |
|
|
C | o Contains problem specific forcing for zonal velocity. |
16 |
|
|
C *==========================================================* |
17 |
|
|
C | Adds terms to gU for forcing by external sources |
18 |
|
|
C | e.g. wind stress, bottom friction etc ... |
19 |
|
|
C *==========================================================* |
20 |
|
|
C \ev |
21 |
|
|
|
22 |
|
|
C !USES: |
23 |
adcroft |
1.2 |
IMPLICIT NONE |
24 |
|
|
C == Global data == |
25 |
|
|
#include "SIZE.h" |
26 |
|
|
#include "EEPARAMS.h" |
27 |
|
|
#include "PARAMS.h" |
28 |
|
|
#include "GRID.h" |
29 |
|
|
#include "DYNVARS.h" |
30 |
|
|
#include "FFIELDS.h" |
31 |
|
|
|
32 |
jmc |
1.6 |
C !INPUT/OUTPUT PARAMETERS: |
33 |
adcroft |
1.2 |
C == Routine arguments == |
34 |
jmc |
1.6 |
C iMin,iMax :: Working range of x-index for applying forcing. |
35 |
|
|
C jMin,jMax :: Working range of y-index for applying forcing. |
36 |
|
|
C bi,bj :: Current tile indices |
37 |
|
|
C kLev :: Current vertical level index |
38 |
|
|
C myTime :: Current time in simulation |
39 |
|
|
C myThid :: Thread Id number |
40 |
adcroft |
1.2 |
INTEGER iMin, iMax, jMin, jMax, kLev, bi, bj |
41 |
jmc |
1.6 |
_RL myTime |
42 |
adcroft |
1.2 |
INTEGER myThid |
43 |
|
|
|
44 |
jmc |
1.6 |
C !LOCAL VARIABLES: |
45 |
adcroft |
1.2 |
C == Local variables == |
46 |
jmc |
1.6 |
C i,j :: Loop counters |
47 |
|
|
INTEGER i, j |
48 |
|
|
CEOP |
49 |
|
|
_RL recip_P0g, termP, kV, kF, sigma_b |
50 |
adcroft |
1.2 |
|
51 |
|
|
C-- Forcing term(s) |
52 |
adcroft |
1.3 |
kF=1. _d 0/86400. _d 0 |
53 |
jmc |
1.5 |
sigma_b = 0.7 _d 0 |
54 |
jmc |
1.6 |
c DO j=1,sNy |
55 |
|
|
C-jmc: Without CD-scheme, this is OK ; but with CD-scheme, needs to cover [0:sNy+1] |
56 |
|
|
DO j=0,sNy+1 |
57 |
|
|
DO i=1,sNx+1 |
58 |
jmc |
1.5 |
IF ( hFacW(i,j,kLev,bi,bj) .GT. 0. ) THEN |
59 |
jmc |
1.6 |
recip_P0g=MAX(recip_Rcol(i,j,bi,bj),recip_Rcol(i-1,j,bi,bj)) |
60 |
jmc |
1.5 |
termP=0.5 _d 0*( MIN(rF(kLev)*recip_P0g,1. _d 0) |
61 |
|
|
& +rF(kLev+1)*recip_P0g ) |
62 |
|
|
c termP=0.5 _d 0*( rF(kLev) + rF(kLev+1) )*recip_P0g |
63 |
|
|
kV=kF*MAX( 0. _d 0, (termP-sigma_b)/(1. _d 0-sigma_b) ) |
64 |
adcroft |
1.2 |
gU(i,j,kLev,bi,bj)=gU(i,j,kLev,bi,bj) |
65 |
jmc |
1.6 |
& -kV*uVel(i,j,kLev,bi,bj) |
66 |
adcroft |
1.2 |
ENDIF |
67 |
|
|
ENDDO |
68 |
|
|
ENDDO |
69 |
|
|
|
70 |
|
|
RETURN |
71 |
|
|
END |
72 |
jmc |
1.6 |
|
73 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
74 |
|
|
CBOP |
75 |
|
|
C !ROUTINE: EXTERNAL_FORCING_V |
76 |
|
|
C !INTERFACE: |
77 |
adcroft |
1.2 |
SUBROUTINE EXTERNAL_FORCING_V( |
78 |
jmc |
1.6 |
I iMin,iMax, jMin,jMax, bi,bj, kLev, |
79 |
|
|
I myTime, myThid ) |
80 |
|
|
C !DESCRIPTION: \bv |
81 |
|
|
C *==========================================================* |
82 |
|
|
C | S/R EXTERNAL_FORCING_V |
83 |
|
|
C | o Contains problem specific forcing for merid velocity. |
84 |
|
|
C *==========================================================* |
85 |
|
|
C | Adds terms to gV for forcing by external sources |
86 |
|
|
C | e.g. wind stress, bottom friction etc ... |
87 |
|
|
C *==========================================================* |
88 |
|
|
C \ev |
89 |
|
|
|
90 |
|
|
C !USES: |
91 |
adcroft |
1.2 |
IMPLICIT NONE |
92 |
|
|
C == Global data == |
93 |
|
|
#include "SIZE.h" |
94 |
|
|
#include "EEPARAMS.h" |
95 |
|
|
#include "PARAMS.h" |
96 |
|
|
#include "GRID.h" |
97 |
|
|
#include "DYNVARS.h" |
98 |
|
|
#include "FFIELDS.h" |
99 |
|
|
|
100 |
jmc |
1.6 |
C !INPUT/OUTPUT PARAMETERS: |
101 |
adcroft |
1.2 |
C == Routine arguments == |
102 |
jmc |
1.6 |
C iMin,iMax :: Working range of x-index for applying forcing. |
103 |
|
|
C jMin,jMax :: Working range of y-index for applying forcing. |
104 |
|
|
C bi,bj :: Current tile indices |
105 |
|
|
C kLev :: Current vertical level index |
106 |
|
|
C myTime :: Current time in simulation |
107 |
|
|
C myThid :: Thread Id number |
108 |
adcroft |
1.2 |
INTEGER iMin, iMax, jMin, jMax, kLev, bi, bj |
109 |
jmc |
1.6 |
_RL myTime |
110 |
adcroft |
1.2 |
INTEGER myThid |
111 |
jmc |
1.6 |
|
112 |
|
|
C !LOCAL VARIABLES: |
113 |
adcroft |
1.2 |
C == Local variables == |
114 |
jmc |
1.6 |
C i,j :: Loop counters |
115 |
|
|
INTEGER i, j |
116 |
|
|
CEOP |
117 |
|
|
_RL recip_P0g, termP, kV, kF, sigma_b |
118 |
adcroft |
1.2 |
|
119 |
|
|
C-- Forcing term(s) |
120 |
adcroft |
1.3 |
kF=1. _d 0/86400. _d 0 |
121 |
jmc |
1.5 |
sigma_b = 0.7 _d 0 |
122 |
jmc |
1.6 |
DO j=1,sNy+1 |
123 |
|
|
c DO i=1,sNx |
124 |
|
|
C-jmc: Without CD-scheme, this is OK ; but with CD-scheme, needs to cover [0:sNx+1] |
125 |
|
|
DO i=0,sNx+1 |
126 |
jmc |
1.5 |
IF ( hFacS(i,j,kLev,bi,bj) .GT. 0. ) THEN |
127 |
jmc |
1.6 |
recip_P0g=MAX(recip_Rcol(i,j,bi,bj),recip_Rcol(i,j-1,bi,bj)) |
128 |
jmc |
1.5 |
termP=0.5 _d 0*( MIN(rF(kLev)*recip_P0g,1. _d 0) |
129 |
|
|
& +rF(kLev+1)*recip_P0g ) |
130 |
|
|
c termP=0.5 _d 0*( rF(kLev) + rF(kLev+1) )*recip_P0g |
131 |
|
|
kV=kF*MAX( 0. _d 0, (termP-sigma_b)/(1. _d 0-sigma_b) ) |
132 |
adcroft |
1.2 |
gV(i,j,kLev,bi,bj)=gV(i,j,kLev,bi,bj) |
133 |
|
|
& -kV*vVel(i,j,kLev,bi,bj) |
134 |
|
|
ENDIF |
135 |
|
|
ENDDO |
136 |
|
|
ENDDO |
137 |
|
|
|
138 |
|
|
RETURN |
139 |
|
|
END |
140 |
jmc |
1.6 |
|
141 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
142 |
|
|
CBOP |
143 |
|
|
C !ROUTINE: EXTERNAL_FORCING_T |
144 |
|
|
C !INTERFACE: |
145 |
adcroft |
1.2 |
SUBROUTINE EXTERNAL_FORCING_T( |
146 |
jmc |
1.6 |
I iMin,iMax, jMin,jMax, bi,bj, kLev, |
147 |
|
|
I myTime, myThid ) |
148 |
|
|
C !DESCRIPTION: \bv |
149 |
|
|
C *==========================================================* |
150 |
|
|
C | S/R EXTERNAL_FORCING_T |
151 |
|
|
C | o Contains problem specific forcing for temperature. |
152 |
|
|
C *==========================================================* |
153 |
|
|
C | Adds terms to gT for forcing by external sources |
154 |
|
|
C | e.g. heat flux, climatalogical relaxation, etc ... |
155 |
|
|
C *==========================================================* |
156 |
|
|
C \ev |
157 |
|
|
|
158 |
|
|
C !USES: |
159 |
adcroft |
1.2 |
IMPLICIT NONE |
160 |
|
|
C == Global data == |
161 |
|
|
#include "SIZE.h" |
162 |
|
|
#include "EEPARAMS.h" |
163 |
|
|
#include "PARAMS.h" |
164 |
|
|
#include "GRID.h" |
165 |
|
|
#include "DYNVARS.h" |
166 |
|
|
#include "FFIELDS.h" |
167 |
|
|
|
168 |
jmc |
1.6 |
C !INPUT/OUTPUT PARAMETERS: |
169 |
adcroft |
1.2 |
C == Routine arguments == |
170 |
jmc |
1.6 |
C iMin,iMax :: Working range of x-index for applying forcing. |
171 |
|
|
C jMin,jMax :: Working range of y-index for applying forcing. |
172 |
|
|
C bi,bj :: Current tile indices |
173 |
|
|
C kLev :: Current vertical level index |
174 |
|
|
C myTime :: Current time in simulation |
175 |
|
|
C myThid :: Thread Id number |
176 |
adcroft |
1.2 |
INTEGER iMin, iMax, jMin, jMax, kLev, bi, bj |
177 |
jmc |
1.6 |
_RL myTime |
178 |
adcroft |
1.2 |
INTEGER myThid |
179 |
|
|
|
180 |
jmc |
1.6 |
C !LOCAL VARIABLES: |
181 |
adcroft |
1.2 |
C == Local variables == |
182 |
jmc |
1.6 |
C i,j :: Loop counters |
183 |
|
|
INTEGER i, j |
184 |
|
|
CEOP |
185 |
jmc |
1.5 |
_RL thetaLim,kT,ka,ks,sigma_b,term1,term2,thetaEq,termP |
186 |
adcroft |
1.2 |
|
187 |
|
|
C-- Forcing term(s) |
188 |
adcroft |
1.3 |
ka=1. _d 0/(40. _d 0*86400. _d 0) |
189 |
|
|
ks=1. _d 0/(4. _d 0 *86400. _d 0) |
190 |
jmc |
1.5 |
sigma_b = 0.7 _d 0 |
191 |
jmc |
1.6 |
DO j=1,sNy |
192 |
|
|
DO i=1,sNx |
193 |
|
|
term1=60. _d 0*(SIN(yC(i,j,bi,bj)*deg2rad)**2) |
194 |
jmc |
1.5 |
termP=0.5 _d 0*( rF(kLev) + rF(kLev+1) ) |
195 |
jmc |
1.6 |
term2=10. _d 0*LOG(termP/atm_po) |
196 |
|
|
& *(COS(yC(i,j,bi,bj)*deg2rad)**2) |
197 |
jmc |
1.5 |
thetaLim = 200. _d 0/ ((termP/atm_po)**atm_kappa) |
198 |
|
|
thetaEq=315. _d 0-term1-term2 |
199 |
|
|
thetaEq=MAX(thetaLim,thetaEq) |
200 |
jmc |
1.6 |
termP=0.5 _d 0*( MIN(rF(kLev),Ro_surf(i,j,bi,bj))+rF(kLev+1) ) |
201 |
jmc |
1.5 |
kT=ka+(ks-ka) |
202 |
|
|
& *MAX(0. _d 0, |
203 |
jmc |
1.6 |
& (termP*recip_Rcol(i,j,bi,bj)-sigma_b)/(1. _d 0-sigma_b) ) |
204 |
|
|
& *COS((yC(i,j,bi,bj)*deg2rad))**4 |
205 |
adcroft |
1.2 |
gT(i,j,kLev,bi,bj)=gT(i,j,kLev,bi,bj) |
206 |
jmc |
1.6 |
& - kT*( theta(i,j,kLev,bi,bj)-thetaEq ) |
207 |
adcroft |
1.2 |
& *maskC(i,j,kLev,bi,bj) |
208 |
|
|
ENDDO |
209 |
|
|
ENDDO |
210 |
|
|
|
211 |
|
|
RETURN |
212 |
|
|
END |
213 |
jmc |
1.6 |
|
214 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
215 |
|
|
CBOP |
216 |
|
|
C !ROUTINE: EXTERNAL_FORCING_S |
217 |
|
|
C !INTERFACE: |
218 |
adcroft |
1.2 |
SUBROUTINE EXTERNAL_FORCING_S( |
219 |
jmc |
1.6 |
I iMin,iMax, jMin,jMax, bi,bj, kLev, |
220 |
|
|
I myTime, myThid ) |
221 |
|
|
|
222 |
|
|
C !DESCRIPTION: \bv |
223 |
|
|
C *==========================================================* |
224 |
|
|
C | S/R EXTERNAL_FORCING_S |
225 |
|
|
C | o Contains problem specific forcing for merid velocity. |
226 |
|
|
C *==========================================================* |
227 |
|
|
C | Adds terms to gS for forcing by external sources |
228 |
|
|
C | e.g. fresh-water flux, climatalogical relaxation, etc ... |
229 |
|
|
C *==========================================================* |
230 |
|
|
C \ev |
231 |
|
|
|
232 |
|
|
C !USES: |
233 |
adcroft |
1.2 |
IMPLICIT NONE |
234 |
|
|
C == Global data == |
235 |
|
|
#include "SIZE.h" |
236 |
|
|
#include "EEPARAMS.h" |
237 |
|
|
#include "PARAMS.h" |
238 |
|
|
#include "GRID.h" |
239 |
|
|
#include "DYNVARS.h" |
240 |
|
|
#include "FFIELDS.h" |
241 |
|
|
|
242 |
jmc |
1.6 |
C !INPUT/OUTPUT PARAMETERS: |
243 |
adcroft |
1.2 |
C == Routine arguments == |
244 |
jmc |
1.6 |
C iMin,iMax :: Working range of x-index for applying forcing. |
245 |
|
|
C jMin,jMax :: Working range of y-index for applying forcing. |
246 |
|
|
C bi,bj :: Current tile indices |
247 |
|
|
C kLev :: Current vertical level index |
248 |
|
|
C myTime :: Current time in simulation |
249 |
|
|
C myThid :: Thread Id number |
250 |
adcroft |
1.2 |
INTEGER iMin, iMax, jMin, jMax, kLev, bi, bj |
251 |
jmc |
1.6 |
_RL myTime |
252 |
adcroft |
1.2 |
INTEGER myThid |
253 |
|
|
|
254 |
jmc |
1.6 |
C !LOCAL VARIABLES: |
255 |
adcroft |
1.2 |
C == Local variables == |
256 |
jmc |
1.6 |
C i,j :: Loop counters |
257 |
|
|
c INTEGER i, j |
258 |
|
|
CEOP |
259 |
adcroft |
1.2 |
|
260 |
|
|
C-- Forcing term(s) |
261 |
|
|
|
262 |
|
|
RETURN |
263 |
|
|
END |