1 |
edhill |
1.4 |
#include "DIC_OPTIONS.h" |
2 |
stephd |
1.1 |
#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 |
stephd |
1.3 |
#include "DIC_LOAD.h" |
26 |
stephd |
1.1 |
#endif |
27 |
|
|
|
28 |
|
|
C == Routine arguments == |
29 |
|
|
INTEGER myIter |
30 |
|
|
_RL myTime |
31 |
|
|
INTEGER myThid |
32 |
|
|
|
33 |
|
|
#ifdef ALLOW_PTRACERS |
34 |
|
|
C == Local variables == |
35 |
|
|
INTEGER bi,bj,i,j,intime0,intime1 |
36 |
|
|
_RL aWght,bWght,rdt |
37 |
|
|
INTEGER nForcingPeriods,Imytm,Ifprd,Ifcyc,Iftm |
38 |
|
|
c |
39 |
|
|
C First call requires that we initialize everything to zero for safety |
40 |
stephd |
1.3 |
IF (myIter .EQ. nIter0) THEN |
41 |
stephd |
1.1 |
CALL LEF_ZERO( wspeed0,myThid ) |
42 |
|
|
CALL LEF_ZERO( wspeed1,myThid ) |
43 |
|
|
CALL LEF_ZERO( atmosp0,myThid ) |
44 |
|
|
CALL LEF_ZERO( atmosp1,myThid ) |
45 |
stephd |
1.2 |
CALL LEF_ZERO( silica0,myThid ) |
46 |
|
|
CALL LEF_ZERO( silica1,myThid ) |
47 |
stephd |
1.1 |
CALL LEF_ZERO( ice0,myThid ) |
48 |
|
|
CALL LEF_ZERO( ice1,myThid ) |
49 |
stephd |
1.3 |
#ifdef ALLOW_FE |
50 |
stephd |
1.1 |
CALL LEF_ZERO( feinput0,myThid ) |
51 |
|
|
CALL LEF_ZERO( feinput1,myThid ) |
52 |
|
|
#endif |
53 |
|
|
ENDIF |
54 |
stephd |
1.3 |
c |
55 |
|
|
IF ( periodicExternalForcing ) THEN |
56 |
stephd |
1.1 |
|
57 |
|
|
|
58 |
|
|
C Now calculate whether it is time to update the forcing arrays |
59 |
|
|
rdt=1. _d 0 / deltaTclock |
60 |
|
|
nForcingPeriods= |
61 |
|
|
& int(externForcingCycle/externForcingPeriod+0.5) |
62 |
|
|
cswd QQ change for placement of chem forcing (ie. after timestep) |
63 |
stephd |
1.5 |
Imytm=int(myTime*rdt+0.5) |
64 |
stephd |
1.1 |
Ifprd=int(externForcingPeriod*rdt+0.5) |
65 |
|
|
Ifcyc=int(externForcingCycle*rdt+0.5) |
66 |
|
|
Iftm=mod( Imytm+Ifcyc-Ifprd/2 ,Ifcyc) |
67 |
|
|
|
68 |
|
|
|
69 |
|
|
intime0=int(Iftm/Ifprd) |
70 |
|
|
intime1=mod(intime0+1,nForcingPeriods) |
71 |
|
|
aWght=float( Iftm-Ifprd*intime0 )/float( Ifprd ) |
72 |
|
|
bWght=1.-aWght |
73 |
|
|
|
74 |
|
|
intime0=intime0+1 |
75 |
|
|
intime1=intime1+1 |
76 |
|
|
|
77 |
|
|
|
78 |
|
|
IF ( |
79 |
|
|
& Iftm-Ifprd*(intime0-1).EQ. 0 |
80 |
stephd |
1.3 |
& .OR. myIter .EQ. nIter0 |
81 |
stephd |
1.1 |
& ) THEN |
82 |
|
|
|
83 |
|
|
|
84 |
|
|
_BEGIN_MASTER(myThid) |
85 |
|
|
|
86 |
|
|
C If the above condition is met then we need to read in |
87 |
|
|
C data for the period ahead and the period behind myTime. |
88 |
|
|
WRITE(*,*) |
89 |
|
|
& 'S/R EXTERNAL_FIELDS_LOAD: Reading new dic data', |
90 |
|
|
& myTime,myIter |
91 |
|
|
|
92 |
|
|
IF ( WindFile .NE. ' ' ) THEN |
93 |
|
|
CALL READ_REC_XY_RS( WindFile,wspeed0,intime0, |
94 |
|
|
& myIter,myThid ) |
95 |
|
|
CALL READ_REC_XY_RS( WindFile,wspeed1,intime1, |
96 |
|
|
& myIter,myThid ) |
97 |
|
|
ENDIF |
98 |
|
|
IF ( AtmospFile .NE. ' ' ) THEN |
99 |
|
|
CALL READ_REC_XY_RS( AtmospFile,atmosp0,intime0, |
100 |
|
|
& myIter,myThid ) |
101 |
|
|
CALL READ_REC_XY_RS( AtmospFile,atmosp1,intime1, |
102 |
|
|
& myIter,myThid ) |
103 |
|
|
ENDIF |
104 |
stephd |
1.2 |
IF ( SilicaFile .NE. ' ' ) THEN |
105 |
|
|
CALL READ_REC_XY_RS( SilicaFile,silica0,intime0, |
106 |
|
|
& myIter,myThid ) |
107 |
|
|
CALL READ_REC_XY_RS( SilicaFile,silica1,intime1, |
108 |
|
|
& myIter,myThid ) |
109 |
|
|
ENDIF |
110 |
stephd |
1.1 |
IF ( IceFile .NE. ' ' ) THEN |
111 |
|
|
CALL READ_REC_XY_RS( IceFile,ice0,intime0, |
112 |
|
|
& myIter,myThid ) |
113 |
|
|
CALL READ_REC_XY_RS( IceFile,ice1,intime1, |
114 |
|
|
& myIter,myThid ) |
115 |
|
|
ENDIF |
116 |
stephd |
1.3 |
#ifdef ALLOW_FE |
117 |
stephd |
1.1 |
IF ( IronFile .NE. ' ' ) THEN |
118 |
|
|
CALL READ_REC_XY_RS( IronFile,feinput0,intime0, |
119 |
|
|
& myIter,myThid ) |
120 |
|
|
CALL READ_REC_XY_RS( IronFile,feinput1,intime1, |
121 |
|
|
& myIter,myThid ) |
122 |
|
|
ENDIF |
123 |
|
|
#endif |
124 |
|
|
|
125 |
|
|
|
126 |
|
|
_END_MASTER(myThid) |
127 |
|
|
C |
128 |
|
|
_EXCH_XY_R4(wspeed0, myThid ) |
129 |
|
|
_EXCH_XY_R4(wspeed1, myThid ) |
130 |
|
|
_EXCH_XY_R4(atmosp0, myThid ) |
131 |
|
|
_EXCH_XY_R4(atmosp1, myThid ) |
132 |
stephd |
1.2 |
_EXCH_XY_R4(silica0, myThid ) |
133 |
|
|
_EXCH_XY_R4(silica1, myThid ) |
134 |
stephd |
1.1 |
_EXCH_XY_R4(ice0, myThid ) |
135 |
|
|
_EXCH_XY_R4(ice1, myThid ) |
136 |
stephd |
1.3 |
#ifdef ALLOW_FE |
137 |
stephd |
1.1 |
_EXCH_XY_R4(feinput0, myThid ) |
138 |
|
|
_EXCH_XY_R4(feinput1, myThid ) |
139 |
|
|
#endif |
140 |
|
|
|
141 |
|
|
C |
142 |
|
|
ENDIF |
143 |
|
|
|
144 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
145 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
146 |
|
|
DO j=1-Oly,sNy+Oly |
147 |
|
|
DO i=1-Olx,sNx+Olx |
148 |
|
|
IF ( WindFile .NE. ' ' ) THEN |
149 |
|
|
WIND(i,j,bi,bj) = bWght*wspeed0(i,j,bi,bj) |
150 |
|
|
& +aWght*wspeed1(i,j,bi,bj) |
151 |
|
|
ELSE |
152 |
|
|
WIND(i,j,bi,bj) = 5.d0*maskC(i,j,1,bi,bj) |
153 |
|
|
ENDIF |
154 |
|
|
c calculate piston velocity |
155 |
|
|
c QQ: note - we should have wind speed variance in here |
156 |
|
|
c QQ also need to check units, and conversion factors |
157 |
|
|
pisvel(i,j,bi,bj) =0.337*wind(i,j,bi,bj)**2/3.6d5 !QQQQ |
158 |
|
|
IF ( AtmospFile .NE. ' ' ) THEN |
159 |
|
|
ATMOSP(i,j,bi,bj) = bWght*atmosp0(i,j,bi,bj) |
160 |
|
|
& +aWght*atmosp1(i,j,bi,bj) |
161 |
|
|
ELSE |
162 |
|
|
ATMOSP(i,j,bi,bj) =1.d0*maskC(i,j,1,bi,bj) |
163 |
stephd |
1.2 |
ENDIF |
164 |
|
|
IF ( SilicaFile .NE. ' ' ) THEN |
165 |
|
|
SILICA(i,j,bi,bj) = bWght*silica0(i,j,bi,bj) |
166 |
|
|
& +aWght*silica1(i,j,bi,bj) |
167 |
|
|
ELSE |
168 |
|
|
SILICA(i,j,bi,bj) =7.6838e-3*maskC(i,j,1,bi,bj) |
169 |
stephd |
1.1 |
ENDIF |
170 |
|
|
IF ( IceFile .NE. ' ' ) THEN |
171 |
|
|
FIce(i,j,bi,bj) = bWght*ice0(i,j,bi,bj) |
172 |
|
|
& +aWght*ice1(i,j,bi,bj) |
173 |
|
|
ELSE |
174 |
|
|
FIce(i,j,bi,bj) =0.d0 |
175 |
|
|
ENDIF |
176 |
|
|
if (FIce(i,j,bi,bj).lt.1d-2) then |
177 |
|
|
FIce(i,j,bi,bj) = 0.d0 |
178 |
|
|
endif |
179 |
stephd |
1.3 |
#ifdef ALLOW_FE |
180 |
stephd |
1.1 |
IF ( IronFile .NE. ' ' ) THEN |
181 |
|
|
InputFe(i,j,bi,bj) = bWght*feinput0(i,j,bi,bj) |
182 |
|
|
& +aWght*feinput1(i,j,bi,bj) |
183 |
|
|
ELSE |
184 |
|
|
InputFe(i,j,bi,bj) = 0.d0*maskC(i,j,1,bi,bj) |
185 |
|
|
ENDIF |
186 |
|
|
#endif |
187 |
|
|
ENDDO |
188 |
|
|
ENDDO |
189 |
|
|
ENDDO |
190 |
|
|
ENDDO |
191 |
|
|
|
192 |
|
|
C endif for periodicForcing |
193 |
|
|
ENDIF |
194 |
|
|
|
195 |
|
|
#endif |
196 |
|
|
RETURN |
197 |
|
|
END |