1 |
C $Header: /u/gcmpack/MITgcm/pkg/atm2d/fixed_flux_add.F,v 1.4 2010/06/16 21:04:22 jscott Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "ctrparam.h" |
5 |
#include "ATM2D_OPTIONS.h" |
6 |
|
7 |
C !INTERFACE: |
8 |
SUBROUTINE FIXED_FLUX_ADD( inMonth, wght0, wght1, |
9 |
& intime0, intime1, iftime, myIter, myThid) |
10 |
C *==========================================================* |
11 |
C | Add fixed flux files to the surface forcing fields. These| |
12 |
c | can be OBS fields or derived fields for anomaly coupling.| |
13 |
C *==========================================================* |
14 |
IMPLICIT NONE |
15 |
|
16 |
C === Global Atmos/Ocean/Seaice Interface Variables === |
17 |
#include "ATMSIZE.h" |
18 |
#include "SIZE.h" |
19 |
#include "GRID.h" |
20 |
#include "EEPARAMS.h" |
21 |
#include "THSICE_VARS.h" |
22 |
#include "ATM2D_VARS.h" |
23 |
|
24 |
C !INPUT/OUTPUT PARAMETERS: |
25 |
C === Routine arguments === |
26 |
C inMonth - current month |
27 |
C wght0, wght1 - weight of first and second month, respectively |
28 |
C intime0,intime1- month id # for first and second months |
29 |
C iftime - true -> prompts a reloading of data from disk |
30 |
C myIter - Ocean iteration number |
31 |
C myThid - Thread no. that called this routine. |
32 |
INTEGER inMonth |
33 |
_RL wght0 |
34 |
_RL wght1 |
35 |
INTEGER intime0 |
36 |
INTEGER intime1 |
37 |
LOGICAL iftime |
38 |
INTEGER myIter |
39 |
INTEGER myThid |
40 |
|
41 |
C LOCAL VARIABLES: |
42 |
_RL qfadj ! temp variable for qflux adjustment |
43 |
INTEGER i,j ! loop counters |
44 |
C save below in common block so continual reloading isn't necessary |
45 |
COMMON /OCEANMEAN/ |
46 |
& tau0, tau1, tav0, tav1, |
47 |
& wind0, wind1, qnet0, qnet1, |
48 |
& evap0, precip0, runoff0 |
49 |
C & evap0, evap1, |
50 |
C & precip0, precip1, |
51 |
C & runoff0, runoff1 |
52 |
|
53 |
_RS tau0(1-Olx:sNx+Olx,1-Oly:sNy+Oly,1,1) |
54 |
_RS tau1(1-Olx:sNx+Olx,1-Oly:sNy+Oly,1,1) |
55 |
_RS tav0(1-Olx:sNx+Olx,1-Oly:sNy+Oly,1,1) |
56 |
_RS tav1(1-Olx:sNx+Olx,1-Oly:sNy+Oly,1,1) |
57 |
_RS wind0(1-Olx:sNx+Olx,1-Oly:sNy+Oly,1,1) |
58 |
_RS wind1(1-Olx:sNx+Olx,1-Oly:sNy+Oly,1,1) |
59 |
_RS qnet0(1-Olx:sNx+Olx,1-Oly:sNy+Oly,1,1) |
60 |
_RS qnet1(1-Olx:sNx+Olx,1-Oly:sNy+Oly,1,1) |
61 |
_RS evap0(1-Olx:sNx+Olx,1-Oly:sNy+Oly,1,1) |
62 |
C _RS evap1(1-Olx:sNx+Olx,1-Oly:sNy+Oly,1,1) |
63 |
_RS precip0(1-Olx:sNx+Olx,1-Oly:sNy+Oly,1,1) |
64 |
C _RS precip1(1-Olx:sNx+Olx,1-Oly:sNy+Oly,1,1) |
65 |
_RS runoff0(1-Olx:sNx+Olx,1-Oly:sNy+Oly,1,1) |
66 |
C _RS runoff1(1-Olx:sNx+Olx,1-Oly:sNy+Oly,1,1) |
67 |
|
68 |
IF (ifTime) THEN |
69 |
|
70 |
C If the above condition is met then we need to read in |
71 |
C data for the period ahead and the period behind current time. |
72 |
|
73 |
WRITE(*,*) 'S/R FIXED_FLUX_ADD: Reading new data' |
74 |
IF ( tauuFile .NE. ' ' ) THEN |
75 |
CALL READ_REC_XY_RS( tauuFile,tau0,intime0, |
76 |
& myIter,myThid ) |
77 |
CALL READ_REC_XY_RS( tauuFile,tau1,intime1, |
78 |
& myIter,myThid ) |
79 |
ENDIF |
80 |
IF ( tauvFile .NE. ' ' ) THEN |
81 |
CALL READ_REC_XY_RS( tauvFile,tav0,intime0, |
82 |
& myIter,myThid ) |
83 |
CALL READ_REC_XY_RS( tauvFile,tav1,intime1, |
84 |
& myIter,myThid ) |
85 |
ENDIF |
86 |
IF ( windFile .NE. ' ' ) THEN |
87 |
CALL READ_REC_XY_RS( windFile,wind0,intime0, |
88 |
& myIter,myThid ) |
89 |
CALL READ_REC_XY_RS( windFile,wind1,intime1, |
90 |
& myIter,myThid ) |
91 |
ENDIF |
92 |
IF ( qnetFile .NE. ' ' ) THEN |
93 |
CALL READ_REC_XY_RS( qnetFile,qnet0,intime0, |
94 |
& myIter,myThid ) |
95 |
CALL READ_REC_XY_RS( qnetFile,qnet1,intime1, |
96 |
& myIter,myThid ) |
97 |
ENDIF |
98 |
ENDIF |
99 |
|
100 |
IF (new_mon) THEN |
101 |
WRITE(*,*) 'S/R FIXED_FLUX_ADD: Reading new EmPmR files' |
102 |
IF ( evapFile .NE. ' ' ) THEN |
103 |
CALL READ_REC_XY_RS( evapFile,evap0,inMonth, |
104 |
& myIter,myThid ) |
105 |
C CALL READ_REC_XY_RS( evapFile,evap1,intime1, |
106 |
C & myIter,myThid ) |
107 |
ENDIF |
108 |
IF ( precipFile .NE. ' ' ) THEN |
109 |
CALL READ_REC_XY_RS( precipFile,precip0,inMonth, |
110 |
& myIter,myThid ) |
111 |
C CALL READ_REC_XY_RS( precipFile,precip1,intime1, |
112 |
C & myIter,myThid ) |
113 |
ENDIF |
114 |
IF ( runoffFile .NE. ' ' ) THEN |
115 |
CALL READ_REC_XY_RS( runoffFile,runoff0,inMonth, |
116 |
& myIter,myThid ) |
117 |
C CALL READ_REC_XY_RS( runoffFile,runoff1,intime1, |
118 |
C & myIter,myThid ) |
119 |
ENDIF |
120 |
new_mon = .FALSE. |
121 |
ENDIF |
122 |
|
123 |
|
124 |
C-- Interpolate and add to anomaly |
125 |
DO j=1,sNy |
126 |
DO i=1,sNx |
127 |
IF (maskC(i,j,1,1,1).EQ.1.) THEN |
128 |
|
129 |
fu_2D(i,j)= fu_2D(i,j) + |
130 |
& (wght0*tau0(i,j,1,1) + wght1*tau1(i,j,1,1)) |
131 |
fv_2D(i,j)= fv_2D(i,j) + |
132 |
& (wght0*tav0(i,j,1,1) + wght1*tav1(i,j,1,1)) |
133 |
wspeed_2D(i,j)= wspeed_2D(i,j) + |
134 |
& (wght0*wind0(i,j,1,1) + wght1*wind1(i,j,1,1)) |
135 |
|
136 |
qfadj = (wght0*qnet0(i,j,1,1) + wght1*qnet1(i,j,1,1)) |
137 |
IF ( (qfadj .NE. 0. _d 0) .AND. |
138 |
& (iceMask(i,j,1,1) .LT. 0.999 _d 0)) THEN |
139 |
qneto_2D(i,j)= qneto_2D(i,j) + qfadj |
140 |
& / (1. _d 0 - iceMask(i,j,1,1)) |
141 |
ENDIF |
142 |
|
143 |
C 9/08/06 assume evap is + in file, thus subtract |
144 |
IF (useObsEmP) THEN |
145 |
evapo_2D(i,j)= -evap0(i,j,1,1) |
146 |
precipo_2D(i,j)= precip0(i,j,1,1) |
147 |
IF (iceMask(i,j,1,1) .NE. 0. _d 0) THEN |
148 |
evapi_2D(i,j)= -evap0(i,j,1,1) |
149 |
precipi_2D(i,j)= precip0(i,j,1,1) |
150 |
ENDIF |
151 |
ELSE |
152 |
evapo_2D(i,j)= evapo_2D(i,j) - |
153 |
& evap0(i,j,1,1) |
154 |
precipo_2D(i,j)= precipo_2D(i,j) + |
155 |
& precip0(i,j,1,1) |
156 |
IF (iceMask(i,j,1,1) .NE. 0. _d 0) THEN |
157 |
evapi_2D(i,j)= evapi_2D(i,j) - |
158 |
& evap0(i,j,1,1) |
159 |
precipi_2D(i,j)= precipi_2D(i,j) + |
160 |
& precip0(i,j,1,1) |
161 |
ENDIF |
162 |
ENDIF |
163 |
|
164 |
IF (useObsRunoff) THEN |
165 |
runoff_2D(i,j)= runoff0(i,j,1,1) |
166 |
ELSE |
167 |
runoff_2D(i,j)= runoff_2D(i,j) + |
168 |
& runoff0(i,j,1,1) |
169 |
ENDIF |
170 |
ENDIF |
171 |
ENDDO |
172 |
ENDDO |
173 |
|
174 |
RETURN |
175 |
END |
176 |
|