Ignore:
Timestamp:
Dec 10, 2009, 10:02:56 AM (15 years ago)
Author:
Laurent Fairhead
Message:

Merged LMDZ4-dev branch changes r1241:1278 into the trunk
Running trunk and LMDZ4-dev in LMDZOR configuration on local
machine (sequential) and SX8 (4-proc) yields identical results
(restart and restartphy are identical binarily)
Log history from r1241 to r1278 is available by switching to
source:LMDZ4/branches/LMDZ4-dev-20091210

Location:
LMDZ4/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LMDZ4/trunk

  • LMDZ4/trunk/libf/phylmd/cpl_mod.F90

    r1146 r1279  
    3939!*************************************************************************************
    4040! variable for coupling period
    41   INTEGER, SAVE                             :: nexca
     41  INTEGER, SAVE :: nexca
    4242  !$OMP THREADPRIVATE(nexca)
    4343
     
    4747  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_snow, cpl_evap, cpl_tsol
    4848  !$OMP THREADPRIVATE(cpl_snow,cpl_evap,cpl_tsol)
    49   REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_fder, cpl_albe, cpl_taux
    50   !$OMP THREADPRIVATE(cpl_fder,cpl_albe,cpl_taux)
     49  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_fder, cpl_albe, cpl_taux, cpl_tauy
     50  !$OMP THREADPRIVATE(cpl_fder,cpl_albe,cpl_taux,cpl_tauy)
    5151  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_windsp
    5252  !$OMP THREADPRIVATE(cpl_windsp)
    53   REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_tauy
    54   !$OMP THREADPRIVATE(cpl_tauy)
     53  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_taumod
     54  !$OMP THREADPRIVATE(cpl_taumod)
     55  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_atm_co2
     56  !$OMP THREADPRIVATE(cpl_atm_co2)
    5557  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_rriv2D, cpl_rcoa2D, cpl_rlic2D
    5658  !$OMP THREADPRIVATE(cpl_rriv2D,cpl_rcoa2D,cpl_rlic2D)
     
    6769  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: read_u0, read_v0 ! ocean surface current
    6870  !$OMP THREADPRIVATE(read_u0,read_v0)
    69  
     71  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: read_co2     ! ocean co2 flux
     72  !$OMP THREADPRIVATE(read_co2)
    7073  INTEGER, ALLOCATABLE, DIMENSION(:), SAVE  :: unity
    7174  !$OMP THREADPRIVATE(unity)
     
    8285  REAL, ALLOCATABLE, DIMENSION(:,:,:), SAVE :: cpl_taux2D, cpl_tauy2D
    8386  !$OMP THREADPRIVATE(cpl_taux2D, cpl_tauy2D)
     87  REAL, ALLOCATABLE, DIMENSION(:,:,:), SAVE :: cpl_taumod2D
     88  !$OMP THREADPRIVATE(cpl_taumod2D)
    8489  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_windsp2D
    8590  !$OMP THREADPRIVATE(cpl_windsp2D)
    86  
    87 ! variable for OPENMP parallelisation
    88 
    89   INTEGER,ALLOCATABLE,DIMENSION(:),SAVE :: knon_omp
    90   REAL,ALLOCATABLE,DIMENSION(:,:),SAVE ::  buffer_omp
    91  
     91  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_atm_co22D
     92  !$OMP THREADPRIVATE(cpl_atm_co22D)
     93
    9294CONTAINS
    9395!
     
    9597!
    9698  SUBROUTINE cpl_init(dtime, rlon, rlat)
     99    USE carbon_cycle_mod, ONLY : carbon_cycle_cpl, fco2_ocn_day
    97100
    98101    INCLUDE "dimensions.h"
     
    160163    ALLOCATE(cpl_taux(klon,2), stat = error)
    161164    sum_error = sum_error + error
     165    ALLOCATE(cpl_tauy(klon,2), stat = error)
     166    sum_error = sum_error + error
    162167    ALLOCATE(cpl_windsp(klon,2), stat = error)
    163168    sum_error = sum_error + error
    164     ALLOCATE(cpl_tauy(klon,2), stat = error)
     169    ALLOCATE(cpl_taumod(klon,2), stat = error)
    165170    sum_error = sum_error + error
    166171    ALLOCATE(cpl_rriv2D(iim,jj_nb), stat=error)
     
    178183    ALLOCATE(read_alb_sic(iim, jj_nb), stat = error)
    179184    sum_error = sum_error + error
    180 
    181185    ALLOCATE(read_u0(iim, jj_nb), stat = error)
    182186    sum_error = sum_error + error
    183187    ALLOCATE(read_v0(iim, jj_nb), stat = error)
    184188    sum_error = sum_error + error
     189
     190    IF (carbon_cycle_cpl) THEN
     191       ALLOCATE(read_co2(iim, jj_nb), stat = error)
     192       sum_error = sum_error + error
     193       ALLOCATE(cpl_atm_co2(klon,2), stat = error)
     194       sum_error = sum_error + error
     195
     196! Allocate variable in carbon_cycle_mod
     197       ALLOCATE(fco2_ocn_day(klon), stat = error)
     198       sum_error = sum_error + error
     199    END IF
    185200
    186201    IF (sum_error /= 0) THEN
     
    196211    ENDDO
    197212
    198 !    cpl_sols = 0.   ; cpl_nsol = 0.  ; cpl_rain = 0.   ; cpl_snow = 0.
    199 !    cpl_evap = 0.   ; cpl_tsol = 0.  ; cpl_fder = 0.   ; cpl_albe = 0.
    200 !    cpl_taux = 0.   ; cpl_tauy = 0.  ; cpl_rriv2D = 0. ; cpl_rcoa2D = 0.
    201 !    cpl_rlic2D = 0. ; cpl_windsp = 0.
    202 
    203213!*************************************************************************************
    204214! Initialize coupling
     
    207217    idtime = INT(dtime)
    208218#ifdef CPP_COUPLE
    209 !$OMP MASTER   
    210219    CALL inicma
    211 !$OMP END MASTER
    212220#endif
    213221
     
    237245       CALL histdef(nidct, 'tmp_lat','tmp_lat', &
    238246            "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime)
    239        DO jf=1,jpflda2o1 + jpflda2o2
    240           CALL histdef(nidct, cl_writ(jf),cl_writ(jf), &
    241                "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime)
     247       DO jf=1,maxsend
     248         IF (infosend(i)%action) THEN
     249             CALL histdef(nidct, infosend(i)%name ,infosend(i)%name , &
     250                "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime)
     251         ENDIF
    242252       END DO
    243253       CALL histend(nidct)
     
    248258            0,zjulian,dtime,nhoridcs,nidcs)
    249259! no vertical axis
    250        DO jf=1,jpfldo2a
    251           CALL histdef(nidcs, cl_read(jf),cl_read(jf), &
    252                "-",iim, jjm+1, nhoridcs, 1, 1, 1, -99, 32, "inst", dtime,dtime)
     260       DO jf=1,maxrecv
     261         IF (inforecv(i)%action) THEN
     262             CALL histdef(nidcs,inforecv(i)%name ,inforecv(i)%name , &
     263                "-",iim, jjm+1, nhoridcs, 1, 1, 1, -99, 32, "inst", dtime,dtime)
     264         ENDIF
    253265       END DO
    254266       CALL histend(nidcs)
     
    256268
    257269    ENDIF    ! is_sequential
    258    
    259 ! OPENMP Initialization
    260 
    261 !$OMP MASTER
    262   ALLOCATE(knon_omp(0:omp_size-1))
    263   ALLOCATE(buffer_omp(klon_mpi,0:omp_size-1))       
    264 !$OMP END MASTER
    265 !$OMP BARRIER
    266270   
    267271  END SUBROUTINE cpl_init
     
    278282    USE surface_data
    279283    USE phys_state_var_mod, ONLY : rlon, rlat
    280 
     284    USE carbon_cycle_mod, ONLY : carbon_cycle_cpl
     285   
    281286    INCLUDE "indicesol.h"
    282287    INCLUDE "temps.h"
     
    300305    CHARACTER(len = 80)                     :: abort_message
    301306    REAL, DIMENSION(klon)                   :: read_sic1D
    302     REAL, DIMENSION(iim,jj_nb,jpfldo2a)     :: tab_read_flds
     307    REAL, DIMENSION(iim,jj_nb,maxrecv)      :: tab_read_flds
    303308    REAL, DIMENSION(klon,nbsrf)             :: pctsrf_old
    304309    REAL, DIMENSION(klon_mpi)               :: rlon_mpi, rlat_mpi
     
    314319    is_modified=.FALSE.
    315320
    316 ! Check if right moment to recevie from coupler
     321! Check if right moment to receive from coupler
    317322    IF (MOD(itime, nexca) == 1) THEN
    318323       is_modified=.TRUE.
     
    329334          ndexcs(:) = 0
    330335          itau_w = itau_phy + itime
    331           DO i = 1, jpfldo2a
    332              CALL histwrite(nidcs,cl_read(i),itau_w,tab_read_flds(:,:,i),iim*(jjm+1),ndexcs)
     336          DO i = 1, maxrecv
     337            IF (inforecv(i)%action) THEN
     338                CALL histwrite(nidcs,inforecv(i)%name,itau_w,tab_read_flds(:,:,i),iim*(jjm+1),ndexcs)
     339            ENDIF
    333340          END DO
    334341       ENDIF
     
    337344! Save each field in a 2D array.
    338345!$OMP MASTER
    339        read_sst(:,:)     = tab_read_flds(:,:,1)  ! Sea surface temperature
    340        read_sic(:,:)     = tab_read_flds(:,:,2)  ! Sea ice concentration
    341        read_alb_sic(:,:) = tab_read_flds(:,:,3)  ! Albedo at sea ice
    342        read_sit(:,:)     = tab_read_flds(:,:,4)  ! Sea ice temperature
     346       read_sst(:,:)     = tab_read_flds(:,:,idr_sisutw)  ! Sea surface temperature
     347       read_sic(:,:)     = tab_read_flds(:,:,idr_icecov)  ! Sea ice concentration
     348       read_alb_sic(:,:) = tab_read_flds(:,:,idr_icealw)  ! Albedo at sea ice
     349       read_sit(:,:)     = tab_read_flds(:,:,idr_icetem)  ! Sea ice temperature
    343350!$OMP END MASTER
    344351
     
    354361! Transform the currents from cartesian to spheric coordinates
    355362! tmp_r0 should be zero
    356           CALL geo2atm(iim, jj_nb, tab_read_flds(:,:,5), tab_read_flds(:,:,6), tab_read_flds(:,:,7), &
     363          CALL geo2atm(iim, jj_nb, tab_read_flds(:,:,idr_curenx), &
     364             tab_read_flds(:,:,idr_cureny), tab_read_flds(:,:,idr_curenz), &
    357365               tmp_lon, tmp_lat, &
    358366               read_u0(:,:), read_v0(:,:), tmp_r0(:,:))
    359367!$OMP END MASTER
    360368
    361        ELSE
     369      ELSE
    362370          read_u0(:,:) = 0.
    363371          read_v0(:,:) = 0.
     372      ENDIF
     373
     374       IF (carbon_cycle_cpl) THEN
     375!$OMP MASTER
     376           read_co2(:,:) = tab_read_flds(:,:,idr_oceco2) ! CO2 flux
     377!$OMP END MASTER
    364378       ENDIF
    365379
     
    374388       DO i = 1, klon
    375389          ! treatment only of points with ocean and/or seaice
     390          ! old land-ocean mask can not be changed
    376391          IF (pctsrf_old(i,is_oce) + pctsrf_old(i,is_sic) > 0.) THEN
    377392             pctsrf(i,is_sic) = (pctsrf_old(i,is_oce) + pctsrf_old(i,is_sic)) &
     
    396411! The temperature is transformed into 1D array with valid points from index 1 to knon.
    397412!
     413    USE carbon_cycle_mod, ONLY : carbon_cycle_cpl, fco2_ocn_day
    398414    INCLUDE "indicesol.h"
    399415
     
    411427! Local variables
    412428!*************************************************************************************
    413     INTEGER               :: i
    414     REAL, DIMENSION(klon) :: sic_new
     429    INTEGER                  :: i
     430    INTEGER, DIMENSION(klon) :: index
     431    REAL, DIMENSION(klon)    :: sic_new
    415432
    416433!*************************************************************************************
     
    422439    CALL cpl2gath(read_u0, u0_new, knon, knindex)
    423440    CALL cpl2gath(read_v0, v0_new, knon, knindex)
     441
     442!*************************************************************************************
     443! Transform read_co2 into uncompressed 1D variable fco2_ocn_day added directly in
     444! the module carbon_cycle_mod
     445!
     446!*************************************************************************************
     447    IF (carbon_cycle_cpl) THEN
     448       DO i=1,klon
     449          index(i)=i
     450       END DO
     451       CALL cpl2gath(read_co2, fco2_ocn_day, klon, index)
     452    END IF
    424453
    425454!*************************************************************************************
     
    499528! (it is done in cpl_send_seaice_fields).
    500529!
     530    USE carbon_cycle_mod, ONLY : carbon_cycle_cpl, co2_send
    501531    INCLUDE "indicesol.h"
    502532    INCLUDE "dimensions.h"
     
    543573       cpl_tauy(1:knon,cpl_index) = 0.0
    544574       cpl_windsp(1:knon,cpl_index) = 0.0
     575       cpl_taumod(1:knon,cpl_index) = 0.0
     576       IF (carbon_cycle_cpl) cpl_atm_co2(1:knon,cpl_index) = 0.0
    545577    ENDIF
    546578       
     
    571603            tauy(ig)        / FLOAT(nexca)     
    572604       cpl_windsp(ig,cpl_index) = cpl_windsp(ig,cpl_index) + &
    573             windsp(ig)      / FLOAT(nexca)
    574     ENDDO
     605            windsp(ig)      / FLOAT(nexca)
     606       cpl_taumod(ig,cpl_index) =   cpl_taumod(ig,cpl_index) + &
     607          SQRT ( taux(ig)*taux(ig)+tauy(ig)*tauy(ig) ) / FLOAT (nexca)
     608
     609       IF (carbon_cycle_cpl) THEN
     610          cpl_atm_co2(ig,cpl_index) = cpl_atm_co2(ig,cpl_index) + &
     611               co2_send(knindex(ig))/ FLOAT(nexca)
     612       END IF
     613     ENDDO
    575614
    576615!*************************************************************************************
     
    606645          ALLOCATE(cpl_windsp2D(iim,jj_nb), stat=error)
    607646          sum_error = sum_error + error
     647          ALLOCATE(cpl_taumod2D(iim,jj_nb,2), stat=error)
     648          sum_error = sum_error + error
    608649         
     650          IF (carbon_cycle_cpl) THEN
     651             ALLOCATE(cpl_atm_co22D(iim,jj_nb), stat=error)
     652             sum_error = sum_error + error
     653          END IF
     654
    609655          IF (sum_error /= 0) THEN
    610656             abort_message='Pb allocation variables couplees pour l''ecriture'
     
    650696            knon, knindex)
    651697
    652     ENDIF
     698       CALL gath2cpl(cpl_taumod(:,cpl_index), cpl_taumod2D(:,:,cpl_index), &
     699            knon, knindex)
     700
     701       IF (carbon_cycle_cpl) &
     702            CALL gath2cpl(cpl_atm_co2(:,cpl_index), cpl_atm_co22D(:,:), knon, knindex)
     703   ENDIF
    653704
    654705  END SUBROUTINE cpl_send_ocean_fields
     
    668719! the coupler.
    669720!
     721    USE carbon_cycle_mod, ONLY : carbon_cycle_cpl
    670722    INCLUDE "indicesol.h"
    671723    INCLUDE "dimensions.h"
     
    716768       cpl_taux(1:knon,cpl_index) = 0.0
    717769       cpl_tauy(1:knon,cpl_index) = 0.0
     770       cpl_taumod(1:knon,cpl_index) = 0.0
    718771    ENDIF
    719772       
     
    742795            taux(ig)        / FLOAT(nexca)
    743796       cpl_tauy(ig,cpl_index) = cpl_tauy(ig,cpl_index) + &
    744             tauy(ig)        / FLOAT(nexca)     
     797            tauy(ig)        / FLOAT(nexca)     
     798       cpl_taumod(ig,cpl_index) = cpl_taumod(ig,cpl_index) + &
     799            SQRT ( taux(ig)*taux(ig)+tauy(ig)*tauy(ig) ) / FLOAT(nexca)
    745800    ENDDO
    746801
     
    775830          ALLOCATE(cpl_windsp2D(iim,jj_nb), stat=error)
    776831          sum_error = sum_error + error
    777          
     832          ALLOCATE(cpl_taumod2D(iim,jj_nb,2), stat=error)
     833          sum_error = sum_error + error
     834
     835          IF (carbon_cycle_cpl) THEN
     836             ALLOCATE(cpl_atm_co22D(iim,jj_nb), stat=error)
     837             sum_error = sum_error + error
     838          END IF
     839
    778840          IF (sum_error /= 0) THEN
    779841             abort_message='Pb allocation variables couplees pour l''ecriture'
     
    819881            knon, knindex)
    820882
     883       CALL gath2cpl(cpl_taumod(:,cpl_index), cpl_taumod2D(:,:,cpl_index), &
     884            knon, knindex)
     885
    821886       ! Send all fields
    822887       CALL cpl_send_all(itime, dtime, pctsrf, lafin, rlon, rlat)
     
    894959! will be done in cpl_send_seaice_fields.
    895960!
     961
    896962    INCLUDE "dimensions.h"
    897963
     
    9471013!   
    9481014    USE surface_data
     1015    USE carbon_cycle_mod, ONLY : carbon_cycle_cpl
    9491016! Some includes
    9501017!*************************************************************************************
     
    9791046    REAL, DIMENSION(iim, jj_nb)                          :: tmp_calv
    9801047! Table with all fields to send to coupler
    981     REAL, DIMENSION(iim, jj_nb, jpflda2o1+jpflda2o2)     :: tab_flds
     1048    REAL, DIMENSION(iim, jj_nb, maxsend)                 :: tab_flds
    9821049    REAL, DIMENSION(klon_mpi)                            :: rlon_mpi, rlat_mpi
    9831050
     
    9981065!*************************************************************************************
    9991066!$OMP MASTER
    1000     tab_flds(:,:,7) = cpl_windsp2D(:,:)
    1001     tab_flds(:,:,8) = cpl_sols2D(:,:,2)
    1002     tab_flds(:,:,10) = cpl_nsol2D(:,:,2)
    1003     tab_flds(:,:,12) = cpl_fder2D(:,:,2)
     1067    tab_flds(:,:,ids_windsp) = cpl_windsp2D(:,:)
     1068    tab_flds(:,:,ids_shfice) = cpl_sols2D(:,:,2)
     1069    tab_flds(:,:,ids_nsfice) = cpl_nsol2D(:,:,2)
     1070    tab_flds(:,:,ids_dflxdt) = cpl_fder2D(:,:,2)
    10041071   
    10051072    IF (version_ocean=='nemo') THEN
    1006        tab_flds(:,:,18) = cpl_rriv2D(:,:) + cpl_rcoa2D(:,:)
     1073       tab_flds(:,:,ids_liqrun) = cpl_rriv2D(:,:) + cpl_rcoa2D(:,:)
     1074       IF (carbon_cycle_cpl) tab_flds(:,:,ids_atmco2)=cpl_atm_co22D(:,:)
    10071075    ELSE IF (version_ocean=='opa8') THEN
    1008        tab_flds(:,:,9) = cpl_sols2D(:,:,1)
    1009        tab_flds(:,:,11) = cpl_nsol2D(:,:,1)
    1010        tab_flds(:,:,13) = cpl_evap2D(:,:,2)
    1011        tab_flds(:,:,14) = cpl_evap2D(:,:,1)
    1012        tab_flds(:,:,17) = cpl_rcoa2D(:,:)
    1013        tab_flds(:,:,18) = cpl_rriv2D(:,:)
     1076       tab_flds(:,:,ids_shfoce) = cpl_sols2D(:,:,1)
     1077       tab_flds(:,:,ids_nsfoce) = cpl_nsol2D(:,:,1)
     1078       tab_flds(:,:,ids_icevap) = cpl_evap2D(:,:,2)
     1079       tab_flds(:,:,ids_ocevap) = cpl_evap2D(:,:,1)
     1080       tab_flds(:,:,ids_runcoa) = cpl_rcoa2D(:,:)
     1081       tab_flds(:,:,ids_rivflu) = cpl_rriv2D(:,:)
    10141082    END IF
    10151083
     
    10631131      ENDIF
    10641132     
    1065       IF (version_ocean=='nemo') THEN
    1066          tab_flds(:,:,17) = tmp_calv(:,:)
    1067       ELSE IF (version_ocean=='opa8') THEN
    1068          tab_flds(:,:,19) = tmp_calv(:,:)
    1069       END IF
     1133      tab_flds(:,:,ids_calvin) = tmp_calv(:,:)
    10701134
    10711135!*************************************************************************************
     
    10781142
    10791143       IF (version_ocean=='nemo') THEN
    1080           tab_flds(:,:,9)  = 0.0
    1081           tab_flds(:,:,11) = 0.0
    1082           tab_flds(:,:,13) = 0.0
    1083           tab_flds(:,:,14) = 0.0
    1084           tab_flds(:,:,15) = 0.0
     1144          tab_flds(:,:,ids_shftot)  = 0.0
     1145          tab_flds(:,:,ids_nsftot) = 0.0
     1146          tab_flds(:,:,ids_totrai) = 0.0
     1147          tab_flds(:,:,ids_totsno) = 0.0
     1148          tab_flds(:,:,ids_toteva) = 0.0
     1149          tab_flds(:,:,ids_taumod) = 0.0
    10851150 
    10861151          tmp_taux(:,:)    = 0.0
     
    10921157             tmp_tauy = cpl_tauy2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
    10931158                  cpl_tauy2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
     1159
     1160             tab_flds(:,:,ids_shftot) = cpl_sols2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
     1161                  cpl_sols2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
     1162             tab_flds(:,:,ids_nsftot) = cpl_nsol2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
     1163                  cpl_nsol2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
     1164             tab_flds(:,:,ids_totrai) = cpl_rain2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
     1165                  cpl_rain2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
     1166             tab_flds(:,:,ids_totsno) = cpl_snow2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
     1167                  cpl_snow2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
     1168             tab_flds(:,:,ids_toteva) = cpl_evap2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
     1169                  cpl_evap2D(:,:,2)  * pctsrf2D(:,:,is_sic) / deno(:,:)
     1170             tab_flds(:,:,ids_taumod) = cpl_taumod2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
     1171                  cpl_taumod2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
    10941172             
    1095              tab_flds(:,:,9) = cpl_sols2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
    1096                   cpl_sols2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
    1097              tab_flds(:,:,11) = cpl_nsol2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
    1098                   cpl_nsol2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
    1099              tab_flds(:,:,13) = cpl_rain2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
    1100                   cpl_rain2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
    1101              tab_flds(:,:,14) = cpl_snow2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
    1102                   cpl_snow2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
    1103              tab_flds(:,:,15) = cpl_evap2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
    1104                   cpl_evap2D(:,:,2)  * pctsrf2D(:,:,is_sic) / deno(:,:)
    11051173         ENDWHERE
    11061174
    1107           tab_flds(:,:,16) = cpl_evap2D(:,:,2)
     1175          tab_flds(:,:,ids_icevap) = cpl_evap2D(:,:,2)
    11081176         
    11091177       ELSE IF (version_ocean=='opa8') THEN
    11101178          ! Store fields for rain and snow in tab_flds(:,:,15) and tab_flds(:,:,16)
    1111           tab_flds(:,:,15) = 0.0
    1112           tab_flds(:,:,16) = 0.0
     1179          tab_flds(:,:,ids_totrai) = 0.0
     1180          tab_flds(:,:,ids_totsno) = 0.0
    11131181          tmp_taux(:,:)    = 0.0
    11141182          tmp_tauy(:,:)    = 0.0
    11151183          ! For all valid grid cells containing some fraction of ocean or sea-ice
    11161184          WHERE ( deno(:,:) /= 0 )
    1117              tab_flds(:,:,15) = cpl_rain2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
     1185             tab_flds(:,:,ids_totrai) = cpl_rain2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
    11181186                  cpl_rain2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
    1119              tab_flds(:,:,16) = cpl_snow2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
     1187             tab_flds(:,:,ids_totsno) = cpl_snow2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
    11201188                  cpl_snow2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
    11211189             
     
    11631231!$OMP MASTER
    11641232    CALL atm2geo (iim, jj_nb, tmp_taux, tmp_tauy, tmp_lon, tmp_lat, &
    1165          tab_flds(:,:,1), tab_flds(:,:,2), tab_flds(:,:,3) )
    1166    
    1167     tab_flds(:,:,4)  = tab_flds(:,:,1)
    1168     tab_flds(:,:,5)  = tab_flds(:,:,2)
    1169     tab_flds(:,:,6)  = tab_flds(:,:,3)
     1233         tab_flds(:,:,ids_tauxxu), tab_flds(:,:,ids_tauyyu), tab_flds(:,:,ids_tauzzu) )
     1234   
     1235    tab_flds(:,:,ids_tauxxv)  = tab_flds(:,:,ids_tauxxu)
     1236    tab_flds(:,:,ids_tauyyv)  = tab_flds(:,:,ids_tauyyu)
     1237    tab_flds(:,:,ids_tauzzv)  = tab_flds(:,:,ids_tauzzu)
    11701238!$OMP END MASTER
    11711239
     
    11751243!*************************************************************************************
    11761244    IF (is_sequential) THEN
    1177        CALL histwrite(nidct,cl_writ(8), itau_w,tab_flds(:,:,8), iim*(jjm+1),ndexct)
    1178        CALL histwrite(nidct,cl_writ(9), itau_w,tab_flds(:,:,9), iim*(jjm+1),ndexct)
    1179        CALL histwrite(nidct,cl_writ(10),itau_w,tab_flds(:,:,10),iim*(jjm+1),ndexct)
    1180        CALL histwrite(nidct,cl_writ(11),itau_w,tab_flds(:,:,11),iim*(jjm+1),ndexct)
    1181        CALL histwrite(nidct,cl_writ(12),itau_w,tab_flds(:,:,12),iim*(jjm+1),ndexct)
    1182        CALL histwrite(nidct,cl_writ(13),itau_w,tab_flds(:,:,13),iim*(jjm+1),ndexct)
    1183        CALL histwrite(nidct,cl_writ(14),itau_w,tab_flds(:,:,14),iim*(jjm+1),ndexct)
    1184        CALL histwrite(nidct,cl_writ(15),itau_w,tab_flds(:,:,15),iim*(jjm+1),ndexct)
    1185        CALL histwrite(nidct,cl_writ(16),itau_w,tab_flds(:,:,16),iim*(jjm+1),ndexct)
    1186        CALL histwrite(nidct,cl_writ(17),itau_w,tab_flds(:,:,17),iim*(jjm+1),ndexct)
    1187        CALL histwrite(nidct,cl_writ(18),itau_w,tab_flds(:,:,18),iim*(jjm+1),ndexct)
    1188        CALL histwrite(nidct,cl_writ(19),itau_w,tab_flds(:,:,19),iim*(jjm+1),ndexct)
    1189        CALL histwrite(nidct,cl_writ(1), itau_w,tab_flds(:,:,1), iim*(jjm+1),ndexct)
    1190        CALL histwrite(nidct,cl_writ(2), itau_w,tab_flds(:,:,2), iim*(jjm+1),ndexct)
    1191        CALL histwrite(nidct,cl_writ(3), itau_w,tab_flds(:,:,3), iim*(jjm+1),ndexct)
    1192        CALL histwrite(nidct,cl_writ(4), itau_w,tab_flds(:,:,4), iim*(jjm+1),ndexct)
    1193        CALL histwrite(nidct,cl_writ(5), itau_w,tab_flds(:,:,5), iim*(jjm+1),ndexct)
    1194        CALL histwrite(nidct,cl_writ(6), itau_w,tab_flds(:,:,6), iim*(jjm+1),ndexct)
    1195        CALL histwrite(nidct,cl_writ(7), itau_w,tab_flds(:,:,7), iim*(jjm+1),ndexct)
    1196        CALL histsync(nidct)
     1245        DO j=1,maxsend
     1246          IF (infosend(j)%action) CALL histwrite(nidct,infosend(j)%name, itau_w, &
     1247             tab_flds(:,:,j),iim*(jjm+1),ndexct)
     1248        ENDDO
    11971249    ENDIF
    1198 
    1199 
    12001250!*************************************************************************************
    12011251! Send the table of all fields
     
    12181268    DEALLOCATE(cpl_evap2D, cpl_tsol2D, cpl_fder2D, cpl_albe2D, stat=error )
    12191269    sum_error = sum_error + error
    1220     DEALLOCATE(cpl_taux2D, cpl_tauy2D, cpl_windsp2D, stat=error )
    1221     sum_error = sum_error + error
     1270    DEALLOCATE(cpl_taux2D, cpl_tauy2D, cpl_windsp2D, cpl_taumod2D, stat=error )
     1271    sum_error = sum_error + error
     1272   
     1273    IF (carbon_cycle_cpl) THEN
     1274       DEALLOCATE(cpl_atm_co22D, stat=error )
     1275       sum_error = sum_error + error
     1276    END IF
     1277
    12221278    IF (sum_error /= 0) THEN
    12231279       abort_message='Pb in deallocation of cpl_xxxx2D coupling variables'
     
    12311287  SUBROUTINE cpl2gath(champ_in, champ_out, knon, knindex)
    12321288  USE mod_phys_lmdz_para
    1233 ! Cette routine ecrit un champ 'gathered' sur la grille 2D pour le passer
    1234 ! au coupleur.
     1289! Cette routine transforme un champs de la grille 2D recu du coupleur sur la grille
     1290! 'gathered' (la grille physiq comprime).
    12351291!
    12361292!
    12371293! input:         
    1238 !   champ_in     champ sur la grille gathere       
     1294!   champ_in     champ sur la grille 2D
    12391295!   knon         nombre de points dans le domaine a traiter
    12401296!   knindex      index des points de la surface a traiter
    12411297!
    12421298! output:
    1243 !   champ_out    champ sur la grille 2D
     1299!   champ_out    champ sur la grille 'gatherd'
    12441300!
    12451301    INCLUDE "dimensions.h"
Note: See TracChangeset for help on using the changeset viewer.