File indexing completed on 2018-03-02 18:39:12 UTC
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
3f33260b4d Jean*0001 #include "DIC_OPTIONS.h"
0002 #include "PTRACERS_OPTIONS.h"
0003
0004
0005
0006
0007
0008 SUBROUTINE DIC_INI_ATMOS( myTime, myIter, myThid )
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 IMPLICIT NONE
0020 #include "SIZE.h"
0021 #include "EEPARAMS.h"
0022 #include "PARAMS.h"
0023 #include "GRID.h"
0024 #include "DIC_VARS.h"
0025 #include "PTRACERS_SIZE.h"
0026 #include "PTRACERS_PARAMS.h"
0027 #include "PTRACERS_FIELDS.h"
0028 #include "DIC_ATMOS.h"
0029
0030
0031
0032
0033
0034 _RL myTime
0035 INTEGER myIter, myThid
0036
0037 #ifdef ALLOW_DIC
0038
0039
0040 LOGICAL DIFFERENT_MULTIPLE
0041 EXTERNAL DIFFERENT_MULTIPLE
0042
0043
0044
0045 _RL total_atmos_moles
0046 INTEGER bi, bj, i,j,k
0047 INTEGER ntim
0048
0049 _RL tile_carbon(nSx,nSy)
0050 _RL total_carbon
0051
0052
0053 INTEGER ioUnit
0054 _RL total_ocean_carbon_old
0055 _RL total_atmos_carbon_old
0056 _RL total_carbon_old, carbon_diff
0057
0058 _RL aWght, bWght
0059 _RL atm_pCO2
0060
0061
0062
0063
0064 ioUnit = standardMessageUnit
0065
0066
0067
0068
0069
0070
0071 IF ( dic_int1.EQ.0 .OR. dic_int1.EQ.1 ) THEN
0072
0073 atm_pCO2 = dic_pCO2
0074
0075 ELSEIF (dic_int1.EQ.2) THEN
0076
0077
0078
0079
0080
0081 ntim=int((myIter-dic_int3)/dic_int4)+1
0082 aWght = FLOAT(myIter-dic_int3)
0083 bWght = FLOAT(dic_int4)
0084 aWght = 0.5 _d 0 + aWght/bWght - FLOAT(ntim-1)
0085 IF (aWght.GT.1. _d 0) THEN
0086 ntim=ntim+1
0087 aWght=aWght-1. _d 0
0088 ENDIF
0089 bWght = 1. _d 0 - aWght
0090 atm_pCO2 = co2atmos(ntim)*bWght + co2atmos(ntim+1)*aWght
0091 WRITE(ioUnit,*) 'weights',ntim, aWght, bWght, atm_pCO2
0092
0093 ELSEIF (dic_int1.EQ.3) THEN
0094
0095
0096
0097
0098
0099 total_atmos_moles = 1.77 _d 20
0100
0101
0102 DO bj=myByLo(myThid),myByHi(myThid)
0103 DO bi=myBxLo(myThid),myBxHi(myThid)
0104 tile_carbon(bi,bj) = 0.
0105 DO k=1,Nr
0106 DO j=1,sNy
0107 DO i=1,sNx
0108 tile_carbon(bi,bj) = tile_carbon(bi,bj)
0109 & + ( pTracer(i,j,k,bi,bj,1)
0110 #ifdef DIC_BIOTIC
0111 & +R_cp*pTracer(i,j,k,bi,bj,4)
0112 #endif
0113 & ) * rA(i,j,bi,bj)
0114 & *drF(k)*hFacC(i,j,k,bi,bj)
0115 ENDDO
0116 ENDDO
0117 ENDDO
0118 ENDDO
0119 ENDDO
0120
0121 CALL GLOBAL_SUM_TILE_RL( tile_carbon, total_carbon, myThid )
0122
0123
0124 _BEGIN_MASTER(myThid)
0125 atpco2 = dic_pCO2
0126 total_atmos_carbon = total_atmos_moles*dic_pCO2
0127 _END_MASTER(myThid)
0128
0129 IF ( nIter0.GT.PTRACERS_Iter0 .OR.
0130 & (nIter0.EQ.PTRACERS_Iter0 .AND. pickupSuff.NE.' ')
0131 & ) THEN
0132 CALL DIC_READ_CO2_PICKUP( nIter0, myThid )
0133 ENDIF
0134
0135 _BEGIN_MASTER(myThid)
0136
0137 total_ocean_carbon = total_carbon
0138 atpco2 = total_atmos_carbon/total_atmos_moles
0139
0140
0141 total_ocean_carbon_start = total_carbon
0142 total_atmos_carbon_start = total_atmos_carbon
0143 total_ocean_carbon_old = total_carbon
0144 total_atmos_carbon_old = total_atmos_carbon
0145 total_ocean_carbon_year = total_carbon
0146 total_atmos_carbon_year = total_atmos_carbon
0147
0148
0149 WRITE(ioUnit,*) 'QQ atmos C, total, pCo2',
0150 & total_atmos_carbon, atpco2
0151 total_carbon = total_atmos_carbon + total_ocean_carbon
0152 total_carbon_old = total_carbon
0153 carbon_diff = 0.
0154 WRITE(ioUnit,*) 'QQ total C, current, old, diff',
0155 & total_carbon, total_carbon_old, carbon_diff
0156 carbon_diff = 0.
0157 WRITE(ioUnit,*) 'QQ ocean C, current, old, diff',
0158 & total_ocean_carbon, total_ocean_carbon_old, carbon_diff
0159 WRITE(ioUnit,*) 'QQ air-sea flux, addition diff',
64d6173181 Jean*0160 & carbon_diff, carbon_diff
3f33260b4d Jean*0161
0162 _END_MASTER(myThid)
0163 _BARRIER
0164
0165 atm_pCO2 = atpco2
0166 ELSE
0167 atm_pCO2 = dic_pCO2
0168
0169 ENDIF
0170
64d6173181 Jean*0171
3f33260b4d Jean*0172 DO bj=myByLo(myThid),myByHi(myThid)
0173 DO bi=myBxLo(myThid),myBxHi(myThid)
0174 DO j=1-OLy,sNy+OLy
0175 DO i=1-OLx,sNx+OLx
0176 AtmospCO2(i,j,bi,bj) = atm_pCO2
0177 ENDDO
0178 ENDDO
0179 ENDDO
0180 ENDDO
0181
0182 #endif /* ALLOW_DIC */
0183
0184 RETURN
0185 END