/[MITgcm]/MITgcm/pkg/aim_v23/aim_do_co2.F
ViewVC logotype

Diff of /MITgcm/pkg/aim_v23/aim_do_co2.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.10 by jmc, Fri Mar 24 23:31:41 2017 UTC revision 1.11 by jmc, Thu Jan 11 01:55:54 2018 UTC
# Line 24  C     == Global data == Line 24  C     == Global data ==
24  #include "RESTART.h"  #include "RESTART.h"
25  #include "GRID.h"  #include "GRID.h"
26    
27    #include "AIM_PARAMS.h"
28  #include "AIM_CO2.h"  #include "AIM_CO2.h"
29  C-- Coupled to the Ocean :  C-- Coupled to the Ocean :
30  #ifdef COMPONENT_MODULE  #ifdef COMPONENT_MODULE
# Line 76  C     i,j    - loop counters Line 77  C     i,j    - loop counters
77        ENDIF        ENDIF
78  #endif /* COMPONENT_MODULE */  #endif /* COMPONENT_MODULE */
79    
80        IF ( Aim_CO2_Flag .EQ. 1 .AND. myTime .EQ. startTime ) THEN        IF ( aim_select_pCO2 .GE. 2 ) THEN
         _BEGIN_MASTER(myThid)  
         atm_pCO2 = atmpCO2init  
         _END_MASTER(myThid)  
         _BARRIER  
   
       ELSEIF ( Aim_CO2_Flag .EQ. 2 ) THEN  
81    
82  C- First compute global mole flux at air-sea interface  C- First compute global mole flux at air-sea interface
83          DO bj=myByLo(myThid),myByHi(myThid)          DO bj=myByLo(myThid),myByHi(myThid)
# Line 102  C- First compute global mole flux at air Line 97  C- First compute global mole flux at air
97          _BEGIN_MASTER(myThid)          _BEGIN_MASTER(myThid)
98          IF ( myIter.EQ.0 ) THEN          IF ( myIter.EQ.0 ) THEN
99  C- If  first iteration, use atmpCO2init as initial condition  C- If  first iteration, use atmpCO2init as initial condition
100            atm_pCO2 = atmpCO2init            atm_CO2_Moles = atm_pCO2 * total_atmos_moles
           Atm_CO2_Moles = atm_pCO2 * total_atmos_moles  
101    
102          ELSEIF ( myIter.EQ.nIter0 ) THEN          ELSEIF ( myIter.EQ.nIter0 ) THEN
103  C- If restart, read moles number from pickup  C- If restart, read moles number from pickup
# Line 121  C- If restart, read moles number from pi Line 115  C- If restart, read moles number from pi
115            CALL MDS_READVEC_LOC(  fn, precFloat64, iUnit, 'RL', 2,            CALL MDS_READVEC_LOC(  fn, precFloat64, iUnit, 'RL', 2,
116       O                           tmpco2, dummyRS,       O                           tmpco2, dummyRS,
117       I                           0, 0, 1, myThid )       I                           0, 0, 1, myThid )
118            Atm_CO2_Moles = tmpco2(1)            atm_CO2_Moles = tmpco2(1)
119            atpco2_check  = tmpco2(2)            atpco2_check  = tmpco2(2)
120            atm_pCO2 = Atm_CO2_Moles / total_atmos_moles            atm_pCO2 = atm_CO2_Moles / total_atmos_moles
121    
122            iUnit = standardMessageUnit            iUnit = standardMessageUnit
123            iLo = IFNBLNK(fn)            iLo = IFNBLNK(fn)
# Line 138  C- If restart, read moles number from pi Line 132  C- If restart, read moles number from pi
132            CALL WRITE_0D_RL( atpco2_check, INDEX_NONE, 'atpco2_check =',            CALL WRITE_0D_RL( atpco2_check, INDEX_NONE, 'atpco2_check =',
133       &                     ' /* pCo2 from pickup file */')       &                     ' /* pCo2 from pickup file */')
134            CALL WRITE_0D_RL( atm_pCO2, INDEX_NONE, 'atm_pCO2 =',            CALL WRITE_0D_RL( atm_pCO2, INDEX_NONE, 'atm_pCO2 =',
135       &                     ' /* pCo2 from Atm_CO2_Moles */')       &                     ' /* pCo2 from atm_CO2_Moles */')
   
 c        ELSE  
 c          WRITE(msgBuf,'(A)') 'AIM_DO_CO2: How did you end up here?'  
 c          CALL PRINT_ERROR( msgBuf , myThid)  
 c          STOP 'ABNORMAL END: S/R AIM_DO_CO2'  
136          ENDIF          ENDIF
137    
138  C- Calculate new atmos pCO2  C- Calculate new atmos pCO2
139          Atm_CO2_Moles = Atm_CO2_Moles - total_flux          atm_CO2_Moles = atm_CO2_Moles - total_flux
140          atm_pCO2 = Atm_CO2_Moles / total_atmos_moles          atm_pCO2 = atm_CO2_Moles / total_atmos_moles
141    
142    C- Set pCO2 for AIM Radiation:
143            IF ( aim_select_pCO2 .EQ. 3 ) THEN
144              aim_pCO2 = atm_pCO2
145            ENDIF
146    
147  C- Write out if time for a new pickup  C- Write out if time for a new pickup
148          modelEnd = (myTime+deltaTClock).EQ.endTime          modelEnd = (myTime+deltaTClock).EQ.endTime
# Line 161  C- Write out if time for a new pickup Line 155  C- Write out if time for a new pickup
155       &    DIFFERENT_MULTIPLE( chkptFreq,myTime+deltaTClock,deltaTClock)       &    DIFFERENT_MULTIPLE( chkptFreq,myTime+deltaTClock,deltaTClock)
156          IF ( (modelEnd.AND.writePickupAtEnd)          IF ( (modelEnd.AND.writePickupAtEnd)
157       &       .OR. permPickup .OR. tempPickup ) THEN       &       .OR. permPickup .OR. tempPickup ) THEN
   
158            IF ( permPickup ) THEN            IF ( permPickup ) THEN
159              IF ( rwSuffixType.EQ.0 ) THEN              IF ( rwSuffixType.EQ.0 ) THEN
160                WRITE(fn,'(A,I10.10)') 'pickup_aimCo2.', myIter+1                WRITE(fn,'(A,I10.10)') 'pickup_aimCo2.', myIter+1
# Line 174  C- Write out if time for a new pickup Line 167  C- Write out if time for a new pickup
167              WRITE(fn,'(A,A)') 'pickup_aimCo2.', checkPtSuff(nCheckLev)              WRITE(fn,'(A,A)') 'pickup_aimCo2.', checkPtSuff(nCheckLev)
168            ENDIF            ENDIF
169  C- write values to new pickup  C- write values to new pickup
170            tmpco2(1)= Atm_CO2_Moles            tmpco2(1)= atm_CO2_Moles
171            tmpco2(2)= atm_pCO2            tmpco2(2)= atm_pCO2
172            iUnit = 0            iUnit = 0
173            CALL MDS_WRITEVEC_LOC( fn, precFloat64, iUnit, 'RL', 2,            CALL MDS_WRITEVEC_LOC( fn, precFloat64, iUnit, 'RL', 2,
# Line 184  C- write values to new pickup Line 177  C- write values to new pickup
177          _END_MASTER(myThid)          _END_MASTER(myThid)
178          _BARRIER          _BARRIER
179    
180  C--- end of Aim_CO2_Flag IF.  C--- end if aim_select_pCO2 >= 2
181        ENDIF        ENDIF
182    
183  #endif /* ALLOW_AIM_CO2 */  #endif /* ALLOW_AIM_CO2 */

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.22