| 1 |
mmazloff |
1.1 |
C $Header: $ |
| 2 |
|
|
C $Name: $ |
| 3 |
|
|
|
| 4 |
|
|
#include "BLING_OPTIONS.h" |
| 5 |
|
|
|
| 6 |
|
|
CBOP |
| 7 |
|
|
subroutine BLING_FIELDS_LOAD ( |
| 8 |
|
|
I myIter,myTime,myThid) |
| 9 |
|
|
|
| 10 |
|
|
C ========================================================== |
| 11 |
|
|
C | subroutine bling_fields_load |
| 12 |
|
|
C | o Read in fields needed for CO2, O2 flux terms, silica |
| 13 |
|
|
C | for pH calculation |
| 14 |
|
|
C ========================================================== |
| 15 |
|
|
|
| 16 |
|
|
implicit none |
| 17 |
|
|
|
| 18 |
|
|
C === Global variables === |
| 19 |
|
|
#include "SIZE.h" |
| 20 |
|
|
#include "EEPARAMS.h" |
| 21 |
|
|
#include "PARAMS.h" |
| 22 |
|
|
#include "GRID.h" |
| 23 |
|
|
#include "BLING_VARS.h" |
| 24 |
|
|
#include "BLING_LOAD.h" |
| 25 |
|
|
#ifdef ALLOW_THSICE |
| 26 |
|
|
# include "THSICE_VARS.h" |
| 27 |
|
|
#endif |
| 28 |
|
|
#ifdef ALLOW_SEAICE |
| 29 |
|
|
# include "SEAICE_SIZE.h" |
| 30 |
|
|
# include "SEAICE.h" |
| 31 |
|
|
#endif |
| 32 |
|
|
|
| 33 |
|
|
C !INPUT PARAMETERS: =================================================== |
| 34 |
|
|
C myThid :: thread number |
| 35 |
|
|
C myIter :: current timestep |
| 36 |
|
|
C myTime :: current time |
| 37 |
|
|
INTEGER myIter |
| 38 |
|
|
_RL myTime |
| 39 |
|
|
INTEGER myThid |
| 40 |
|
|
|
| 41 |
|
|
#ifdef ALLOW_BLING |
| 42 |
|
|
|
| 43 |
|
|
c !LOCAL VARIABLES: =================================================== |
| 44 |
|
|
INTEGER bi, bj, i, j |
| 45 |
|
|
INTEGER intimeP, intime0, intime1 |
| 46 |
|
|
_RL aWght,bWght |
| 47 |
|
|
CEOP |
| 48 |
|
|
|
| 49 |
|
|
IF ( BLING_forcingCycle.gt.0. _d 0 ) THEN |
| 50 |
|
|
|
| 51 |
|
|
C-- Now calculate whether it is time to update the forcing arrays |
| 52 |
|
|
CALL GET_PERIODIC_INTERVAL( |
| 53 |
|
|
O intimeP, intime0, intime1, bWght, aWght, |
| 54 |
|
|
I BLING_forcingCycle, BLING_forcingPeriod, |
| 55 |
|
|
I deltaTclock, myTime, myThid ) |
| 56 |
|
|
|
| 57 |
|
|
bi = myBxLo(myThid) |
| 58 |
|
|
bj = myByLo(myThid) |
| 59 |
|
|
#ifdef ALLOW_DEBUG |
| 60 |
|
|
IF ( debugLevel.GE.debLevB ) THEN |
| 61 |
|
|
_BEGIN_MASTER(myThid) |
| 62 |
|
|
WRITE(standardMessageUnit,'(A,I10,A,4I5,A,2F14.10)') |
| 63 |
|
|
& ' BLING_FIELDS_LOAD,', myIter, |
| 64 |
|
|
& ' : iP,iLd,i0,i1=', intimeP,BLING_ldRec(bi,bj), intime0, |
| 65 |
|
|
& intime1, |
| 66 |
|
|
& ' ; Wght=', bWght, aWght |
| 67 |
|
|
_END_MASTER(myThid) |
| 68 |
|
|
ENDIF |
| 69 |
|
|
#endif /* ALLOW_DEBUG */ |
| 70 |
|
|
|
| 71 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
| 72 |
|
|
C- assuming that we call S/R BLING_FIELDS_LOAD at each time-step and |
| 73 |
|
|
C with increasing time, this will catch when we need to load new records; |
| 74 |
|
|
C But with Adjoint run, this is not always the case => might end-up using |
| 75 |
|
|
C the wrong time-records |
| 76 |
|
|
IF ( intime0.NE.intimeP .OR. myIter.EQ.nIter0 ) THEN |
| 77 |
|
|
#else /* ALLOW_AUTODIFF_TAMC */ |
| 78 |
|
|
C- Make no assumption on sequence of calls to BLING_FIELDS_LOAD ; |
| 79 |
|
|
C This is the correct formulation (works in Adjoint run). |
| 80 |
|
|
C Unfortunatly, produces many recomputations <== not used until it is fixed |
| 81 |
|
|
IF ( intime1.NE.BLING_ldRec(bi,bj) ) THEN |
| 82 |
|
|
#endif /* ALLOW_AUTODIFF_TAMC */ |
| 83 |
|
|
|
| 84 |
|
|
C-- If the above condition is met then we need to read in |
| 85 |
|
|
C data for the period ahead and the period behind myTime. |
| 86 |
|
|
IF ( debugLevel.GE.debLevZero ) THEN |
| 87 |
|
|
_BEGIN_MASTER(myThid) |
| 88 |
|
|
WRITE(standardMessageUnit,'(A,I10,A,2(2I5,A))') |
| 89 |
|
|
& ' BLING_FIELDS_LOAD, it=', myIter, |
| 90 |
|
|
& ' : Reading new data, i0,i1=', intime0, intime1, |
| 91 |
|
|
& ' (prev=', intimeP, BLING_ldRec(bi,bj), ' )' |
| 92 |
|
|
_END_MASTER(myThid) |
| 93 |
|
|
ENDIF |
| 94 |
|
|
|
| 95 |
|
|
_BARRIER |
| 96 |
|
|
|
| 97 |
|
|
IF ( BLING_windFile .NE. ' ' ) THEN |
| 98 |
|
|
CALL READ_REC_XY_RS( BLING_windFile,dicwind0,intime0, |
| 99 |
|
|
& myIter,myThid ) |
| 100 |
|
|
CALL READ_REC_XY_RS( BLING_windFile,dicwind1,intime1, |
| 101 |
|
|
& myIter,myThid ) |
| 102 |
|
|
ENDIF |
| 103 |
|
|
IF ( BLING_atmospFile .NE. ' ' ) THEN |
| 104 |
|
|
CALL READ_REC_XY_RS( BLING_atmospFile,atmosp0,intime0, |
| 105 |
|
|
& myIter,myThid ) |
| 106 |
|
|
CALL READ_REC_XY_RS( BLING_atmospFile,atmosp1,intime1, |
| 107 |
|
|
& myIter,myThid ) |
| 108 |
|
|
ENDIF |
| 109 |
|
|
IF ( BLING_silicaFile .NE. ' ' ) THEN |
| 110 |
|
|
CALL READ_REC_XY_RS( BLING_silicaFile,silica0,intime0, |
| 111 |
|
|
& myIter,myThid ) |
| 112 |
|
|
CALL READ_REC_XY_RS( BLING_silicaFile,silica1,intime1, |
| 113 |
|
|
& myIter,myThid ) |
| 114 |
|
|
ENDIF |
| 115 |
|
|
IF ( BLING_iceFile .NE. ' ' ) THEN |
| 116 |
|
|
CALL READ_REC_XY_RS( BLING_iceFile,ice0,intime0, |
| 117 |
|
|
& myIter,myThid ) |
| 118 |
|
|
CALL READ_REC_XY_RS( BLING_iceFile,ice1,intime1, |
| 119 |
|
|
& myIter,myThid ) |
| 120 |
|
|
ENDIF |
| 121 |
|
|
IF ( BLING_ironFile .NE. ' ' ) THEN |
| 122 |
|
|
CALL READ_REC_XY_RS( BLING_ironFile,feinput0,intime0, |
| 123 |
|
|
& myIter,myThid ) |
| 124 |
|
|
CALL READ_REC_XY_RS( BLING_ironFile,feinput1,intime1, |
| 125 |
|
|
& myIter,myThid ) |
| 126 |
|
|
ENDIF |
| 127 |
|
|
|
| 128 |
|
|
C-- fill-in overlap after loading temp arrays: |
| 129 |
|
|
_EXCH_XY_RS(dicwind0, myThid ) |
| 130 |
|
|
_EXCH_XY_RS(dicwind1, myThid ) |
| 131 |
|
|
_EXCH_XY_RS(atmosp0, myThid ) |
| 132 |
|
|
_EXCH_XY_RS(atmosp1, myThid ) |
| 133 |
|
|
_EXCH_XY_RS(silica0, myThid ) |
| 134 |
|
|
_EXCH_XY_RS(silica1, myThid ) |
| 135 |
|
|
_EXCH_XY_RS(ice0, myThid ) |
| 136 |
|
|
_EXCH_XY_RS(ice1, myThid ) |
| 137 |
|
|
_EXCH_XY_RS(feinput0, myThid ) |
| 138 |
|
|
_EXCH_XY_RS(feinput1, myThid ) |
| 139 |
|
|
|
| 140 |
|
|
C- save newly loaded time-record |
| 141 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
| 142 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
| 143 |
|
|
BLING_ldRec(bi,bj) = intime1 |
| 144 |
|
|
ENDDO |
| 145 |
|
|
ENDDO |
| 146 |
|
|
|
| 147 |
|
|
C- end if-bloc (time to load new fields) |
| 148 |
|
|
ENDIF |
| 149 |
|
|
|
| 150 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
| 151 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
| 152 |
|
|
IF ( BLING_windFile .NE. ' ' ) THEN |
| 153 |
|
|
DO j=1-OLy,sNy+OLy |
| 154 |
|
|
DO i=1-OLx,sNx+OLx |
| 155 |
|
|
WIND(i,j,bi,bj) = bWght*dicwind0(i,j,bi,bj) |
| 156 |
|
|
& + aWght*dicwind1(i,j,bi,bj) |
| 157 |
|
|
ENDDO |
| 158 |
|
|
ENDDO |
| 159 |
|
|
ENDIF |
| 160 |
|
|
#ifndef USE_PLOAD |
| 161 |
|
|
IF ( BLING_atmospFile .NE. ' ' ) THEN |
| 162 |
|
|
DO j=1-OLy,sNy+OLy |
| 163 |
|
|
DO i=1-OLx,sNx+OLx |
| 164 |
|
|
AtmosP(i,j,bi,bj) = bWght*atmosp0(i,j,bi,bj) |
| 165 |
|
|
& + aWght*atmosp1(i,j,bi,bj) |
| 166 |
|
|
ENDDO |
| 167 |
|
|
ENDDO |
| 168 |
|
|
ENDIF |
| 169 |
|
|
#endif |
| 170 |
|
|
IF ( BLING_silicaFile .NE. ' ' ) THEN |
| 171 |
|
|
DO j=1-OLy,sNy+OLy |
| 172 |
|
|
DO i=1-OLx,sNx+OLx |
| 173 |
|
|
SILICA(i,j,bi,bj) = bWght*silica0(i,j,bi,bj) |
| 174 |
|
|
& + aWght*silica1(i,j,bi,bj) |
| 175 |
|
|
ENDDO |
| 176 |
|
|
ENDDO |
| 177 |
|
|
ENDIF |
| 178 |
|
|
IF ( BLING_iceFile .NE. ' ' ) THEN |
| 179 |
|
|
DO j=1-OLy,sNy+OLy |
| 180 |
|
|
DO i=1-OLx,sNx+OLx |
| 181 |
|
|
FIce(i,j,bi,bj) = bWght*ice0(i,j,bi,bj) |
| 182 |
|
|
& + aWght*ice1(i,j,bi,bj) |
| 183 |
|
|
ENDDO |
| 184 |
|
|
ENDDO |
| 185 |
|
|
ENDIF |
| 186 |
|
|
|
| 187 |
|
|
IF ( BLING_ironFile .NE. ' ' ) THEN |
| 188 |
|
|
DO j=1-OLy,sNy+OLy |
| 189 |
|
|
DO i=1-OLx,sNx+OLx |
| 190 |
|
|
InputFe(i,j,bi,bj) = bWght*feinput0(i,j,bi,bj) |
| 191 |
|
|
& + aWght*feinput1(i,j,bi,bj) |
| 192 |
|
|
ENDDO |
| 193 |
|
|
ENDDO |
| 194 |
|
|
ENDIF |
| 195 |
|
|
ENDDO |
| 196 |
|
|
ENDDO |
| 197 |
|
|
|
| 198 |
|
|
C endif for BLING_forcingCycle |
| 199 |
|
|
ENDIF |
| 200 |
|
|
|
| 201 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
| 202 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
| 203 |
|
|
#ifdef ALLOW_SEAICE |
| 204 |
|
|
IF ( useSEAICE ) THEN |
| 205 |
|
|
DO j=1-OLy,sNy+OLy |
| 206 |
|
|
DO i=1-OLx,sNx+OLx |
| 207 |
|
|
FIce(i,j,bi,bj) = AREA(i,j,bi,bj) |
| 208 |
|
|
ENDDO |
| 209 |
|
|
ENDDO |
| 210 |
|
|
ENDIF |
| 211 |
|
|
#endif |
| 212 |
|
|
#ifdef ALLOW_THSICE |
| 213 |
|
|
IF ( useThSIce ) THEN |
| 214 |
|
|
DO j=1-OLy,sNy+OLy |
| 215 |
|
|
DO i=1-OLx,sNx+OLx |
| 216 |
|
|
FIce(i,j,bi,bj) = iceMask(i,j,bi,bj) |
| 217 |
|
|
ENDDO |
| 218 |
|
|
ENDDO |
| 219 |
|
|
ENDIF |
| 220 |
|
|
#endif |
| 221 |
|
|
ENDDO |
| 222 |
|
|
ENDDO |
| 223 |
|
|
|
| 224 |
|
|
#endif /* ALLOW_BLING */ |
| 225 |
|
|
RETURN |
| 226 |
|
|
END |