1 |
#include "CPP_OPTIONS.h" |
2 |
#include "GCHEM_OPTIONS.h" |
3 |
|
4 |
CStartOfInterFace |
5 |
SUBROUTINE DIC_FIELDS_LOAD ( |
6 |
I myIter,myTime,myThid) |
7 |
|
8 |
C /==========================================================\ |
9 |
C | SUBROUTINE DIC_FIELDS_LOAD i | |
10 |
C | o Read in fields needed for CO2 fluxterms | |
11 |
C |==========================================================| |
12 |
IMPLICIT NONE |
13 |
|
14 |
C == GLobal variables == |
15 |
#include "SIZE.h" |
16 |
#include "DYNVARS.h" |
17 |
#include "EEPARAMS.h" |
18 |
#include "PARAMS.h" |
19 |
#include "GRID.h" |
20 |
#include "PTRACERS.h" |
21 |
#include "GCHEM.h" |
22 |
#include "DIC_ABIOTIC.h" |
23 |
#ifdef DIC_BIOTIC |
24 |
#include "DIC_BIOTIC.h" |
25 |
#endif |
26 |
#ifdef ALLOW_SEAICE |
27 |
#include "ICE.h" |
28 |
#endif |
29 |
|
30 |
C == Routine arguments == |
31 |
INTEGER myIter |
32 |
_RL myTime |
33 |
INTEGER myThid |
34 |
|
35 |
#ifdef ALLOW_PTRACERS |
36 |
C == Local variables == |
37 |
_RS wspeed0 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
38 |
_RS wspeed1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
39 |
_RS wind (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
40 |
_RS ice0 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
41 |
_RS ice1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
42 |
_RS atmosp0 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
43 |
_RS atmosp1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
44 |
#ifdef DIC_BIOTIC |
45 |
_RS feinput0 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
46 |
_RS feinput1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
47 |
#endif |
48 |
INTEGER bi,bj,i,j,intime0,intime1 |
49 |
_RL aWght,bWght,rdt |
50 |
INTEGER nForcingPeriods,Imytm,Ifprd,Ifcyc,Iftm |
51 |
c |
52 |
c |
53 |
IF ( periodicExternalForcing ) THEN |
54 |
|
55 |
|
56 |
C First call requires that we initialize everything to zero for safety |
57 |
cQQQ need to check timing |
58 |
IF ( myIter .EQ. nIter0+1 ) THEN |
59 |
CALL LEF_ZERO( wspeed0,myThid ) |
60 |
CALL LEF_ZERO( wspeed1,myThid ) |
61 |
CALL LEF_ZERO( atmosp0,myThid ) |
62 |
CALL LEF_ZERO( atmosp1,myThid ) |
63 |
CALL LEF_ZERO( ice0,myThid ) |
64 |
CALL LEF_ZERO( ice1,myThid ) |
65 |
#ifdef DIC_BIOTIC |
66 |
CALL LEF_ZERO( feinput0,myThid ) |
67 |
CALL LEF_ZERO( feinput1,myThid ) |
68 |
#endif |
69 |
ENDIF |
70 |
|
71 |
|
72 |
C Now calculate whether it is time to update the forcing arrays |
73 |
rdt=1. _d 0 / deltaTclock |
74 |
nForcingPeriods= |
75 |
& int(externForcingCycle/externForcingPeriod+0.5) |
76 |
cswd QQ change for placement of chem forcing (ie. after timestep) |
77 |
Imytm=int((myTime-deltaTclock)*rdt+0.5) |
78 |
Ifprd=int(externForcingPeriod*rdt+0.5) |
79 |
Ifcyc=int(externForcingCycle*rdt+0.5) |
80 |
Iftm=mod( Imytm+Ifcyc-Ifprd/2 ,Ifcyc) |
81 |
|
82 |
|
83 |
intime0=int(Iftm/Ifprd) |
84 |
intime1=mod(intime0+1,nForcingPeriods) |
85 |
aWght=float( Iftm-Ifprd*intime0 )/float( Ifprd ) |
86 |
bWght=1.-aWght |
87 |
|
88 |
intime0=intime0+1 |
89 |
intime1=intime1+1 |
90 |
|
91 |
|
92 |
cswd QQ need nIter0+1 since chem forcing after time step |
93 |
IF ( |
94 |
& Iftm-Ifprd*(intime0-1).EQ. 0 |
95 |
& .OR. myIter .EQ. nIter0+1 |
96 |
& ) THEN |
97 |
|
98 |
|
99 |
_BEGIN_MASTER(myThid) |
100 |
|
101 |
C If the above condition is met then we need to read in |
102 |
C data for the period ahead and the period behind myTime. |
103 |
WRITE(*,*) |
104 |
& 'S/R EXTERNAL_FIELDS_LOAD: Reading new dic data', |
105 |
& myTime,myIter |
106 |
|
107 |
IF ( WindFile .NE. ' ' ) THEN |
108 |
CALL READ_REC_XY_RS( WindFile,wspeed0,intime0, |
109 |
& myIter,myThid ) |
110 |
CALL READ_REC_XY_RS( WindFile,wspeed1,intime1, |
111 |
& myIter,myThid ) |
112 |
ENDIF |
113 |
IF ( AtmospFile .NE. ' ' ) THEN |
114 |
CALL READ_REC_XY_RS( AtmospFile,atmosp0,intime0, |
115 |
& myIter,myThid ) |
116 |
CALL READ_REC_XY_RS( AtmospFile,atmosp1,intime1, |
117 |
& myIter,myThid ) |
118 |
ENDIF |
119 |
#ifndef ALLOW_SEAICE |
120 |
IF ( IceFile .NE. ' ' ) THEN |
121 |
CALL READ_REC_XY_RS( IceFile,ice0,intime0, |
122 |
& myIter,myThid ) |
123 |
CALL READ_REC_XY_RS( IceFile,ice1,intime1, |
124 |
& myIter,myThid ) |
125 |
ENDIF |
126 |
#endif |
127 |
#ifdef DIC_BIOTIC |
128 |
IF ( IronFile .NE. ' ' ) THEN |
129 |
CALL READ_REC_XY_RS( IronFile,feinput0,intime0, |
130 |
& myIter,myThid ) |
131 |
CALL READ_REC_XY_RS( IronFile,feinput1,intime1, |
132 |
& myIter,myThid ) |
133 |
ENDIF |
134 |
#endif |
135 |
|
136 |
|
137 |
_END_MASTER(myThid) |
138 |
C |
139 |
_EXCH_XY_R4(wspeed0, myThid ) |
140 |
_EXCH_XY_R4(wspeed1, myThid ) |
141 |
_EXCH_XY_R4(atmosp0, myThid ) |
142 |
_EXCH_XY_R4(atmosp1, myThid ) |
143 |
#ifndef ALLOW_SEAICE |
144 |
_EXCH_XY_R4(ice0, myThid ) |
145 |
_EXCH_XY_R4(ice1, myThid ) |
146 |
#endif |
147 |
#ifdef DIC_BIOTIC |
148 |
_EXCH_XY_R4(feinput0, myThid ) |
149 |
_EXCH_XY_R4(feinput1, myThid ) |
150 |
#endif |
151 |
|
152 |
C |
153 |
ENDIF |
154 |
|
155 |
DO bj = myByLo(myThid), myByHi(myThid) |
156 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
157 |
DO j=1-Oly,sNy+Oly |
158 |
DO i=1-Olx,sNx+Olx |
159 |
IF ( WindFile .NE. ' ' ) THEN |
160 |
WIND(i,j,bi,bj) = bWght*wspeed0(i,j,bi,bj) |
161 |
& +aWght*wspeed1(i,j,bi,bj) |
162 |
ELSE |
163 |
WIND(i,j,bi,bj) = 5.d0*maskC(i,j,1,bi,bj) |
164 |
ENDIF |
165 |
c calculate piston velocity |
166 |
c QQ: note - we should have wind speed variance in here |
167 |
c QQ also need to check units, and conversion factors |
168 |
pisvel(i,j,bi,bj) =0.337*wind(i,j,bi,bj)**2/3.6d5 !QQQQ |
169 |
IF ( AtmospFile .NE. ' ' ) THEN |
170 |
ATMOSP(i,j,bi,bj) = bWght*atmosp0(i,j,bi,bj) |
171 |
& +aWght*atmosp1(i,j,bi,bj) |
172 |
ELSE |
173 |
ATMOSP(i,j,bi,bj) =1.d0*maskC(i,j,1,bi,bj) |
174 |
ENDIF |
175 |
#ifndef ALLOW_SEAICE |
176 |
IF ( IceFile .NE. ' ' ) THEN |
177 |
FIce(i,j,bi,bj) = bWght*ice0(i,j,bi,bj) |
178 |
& +aWght*ice1(i,j,bi,bj) |
179 |
ELSE |
180 |
FIce(i,j,bi,bj) =0.d0 |
181 |
ENDIF |
182 |
#else |
183 |
FIce(i,j,bi,bj) = IceMask(i,j,bi,bj) |
184 |
#endif |
185 |
if (FIce(i,j,bi,bj).lt.1d-2) then |
186 |
FIce(i,j,bi,bj) = 0.d0 |
187 |
endif |
188 |
#ifdef DIC_BIOTIC |
189 |
IF ( IronFile .NE. ' ' ) THEN |
190 |
InputFe(i,j,bi,bj) = bWght*feinput0(i,j,bi,bj) |
191 |
& +aWght*feinput1(i,j,bi,bj) |
192 |
ELSE |
193 |
InputFe(i,j,bi,bj) = 0.d0*maskC(i,j,1,bi,bj) |
194 |
ENDIF |
195 |
#endif |
196 |
ENDDO |
197 |
ENDDO |
198 |
ENDDO |
199 |
ENDDO |
200 |
|
201 |
C endif for periodicForcing |
202 |
ENDIF |
203 |
|
204 |
#endif |
205 |
RETURN |
206 |
END |