Changeset 1152


Ignore:
Timestamp:
Apr 29, 2009, 5:00:54 PM (16 years ago)
Author:
jghattas
Message:
  • Amelioration dans l'interface de couplage pour faciliter des champs de couplages optionels.
  • Ajout de couplage de flux co2 : uniquement dans l'interface de couplage, pas encore de transport.
Location:
LMDZ4/branches/LMDZ4-dev/libf/phylmd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LMDZ4/branches/LMDZ4-dev/libf/phylmd/cpl_mod.F90

    r1133 r1152  
    5151  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_windsp
    5252  !$OMP THREADPRIVATE(cpl_windsp)
     53  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_atm_co2
     54  !$OMP THREADPRIVATE(cpl_atm_co2)
    5355  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_tauy
    5456  !$OMP THREADPRIVATE(cpl_tauy)
     
    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)
     
    8487  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_windsp2D
    8588  !$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  
     89  REAL, ALLOCATABLE, DIMENSION(:,:), SAVE   :: cpl_atm_co22D
     90  !$OMP THREADPRIVATE(cpl_atm_co22D)
     91
    9292CONTAINS
    9393!
     
    178178    ALLOCATE(read_alb_sic(iim, jj_nb), stat = error)
    179179    sum_error = sum_error + error
    180 
    181180    ALLOCATE(read_u0(iim, jj_nb), stat = error)
    182181    sum_error = sum_error + error
    183182    ALLOCATE(read_v0(iim, jj_nb), stat = error)
    184183    sum_error = sum_error + error
     184
     185    IF (cpl_carbon_cycle) THEN
     186       ALLOCATE(read_co2(iim, jj_nb), stat = error)
     187       sum_error = sum_error + error
     188       ALLOCATE(cpl_atm_co2(klon,2), stat = error)
     189       sum_error = sum_error + error
     190    END IF
    185191
    186192    IF (sum_error /= 0) THEN
     
    195201       unity(ig) = ig
    196202    ENDDO
    197 
    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.
    202203
    203204!*************************************************************************************
     
    237238       CALL histdef(nidct, 'tmp_lat','tmp_lat', &
    238239            "-",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)
     240       DO jf=1,maxsend
     241         IF (infosend(i)%action) THEN
     242             CALL histdef(nidct, infosend(i)%name ,infosend(i)%name , &
     243                "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime)
     244         ENDIF
    242245       END DO
    243246       CALL histend(nidct)
     
    248251            0,zjulian,dtime,nhoridcs,nidcs)
    249252! 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)
     253       DO jf=1,maxrecv
     254         IF (inforecv(i)%action) THEN
     255             CALL histdef(nidcs,inforecv(i)%name ,inforecv(i)%name , &
     256                "-",iim, jjm+1, nhoridcs, 1, 1, 1, -99, 32, "inst", dtime,dtime)
     257         ENDIF
    253258       END DO
    254259       CALL histend(nidcs)
     
    256261
    257262    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
    266263   
    267264  END SUBROUTINE cpl_init
     
    300297    CHARACTER(len = 80)                     :: abort_message
    301298    REAL, DIMENSION(klon)                   :: read_sic1D
    302     REAL, DIMENSION(iim,jj_nb,jpfldo2a)     :: tab_read_flds
     299    REAL, DIMENSION(iim,jj_nb,maxrecv)      :: tab_read_flds
    303300    REAL, DIMENSION(klon,nbsrf)             :: pctsrf_old
    304301    REAL, DIMENSION(klon_mpi)               :: rlon_mpi, rlat_mpi
     
    329326          ndexcs(:) = 0
    330327          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)
     328          DO i = 1, maxrecv
     329            IF (inforecv(i)%action) THEN
     330                CALL histwrite(nidcs,inforecv(i)%name,itau_w,tab_read_flds(:,:,i),iim*(jjm+1),ndexcs)
     331            ENDIF
    333332          END DO
    334333       ENDIF
     
    337336! Save each field in a 2D array.
    338337!$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
     338       read_sst(:,:)     = tab_read_flds(:,:,idr_sisutw)  ! Sea surface temperature
     339       read_sic(:,:)     = tab_read_flds(:,:,idr_icecov)  ! Sea ice concentration
     340       read_alb_sic(:,:) = tab_read_flds(:,:,idr_icealw)  ! Albedo at sea ice
     341       read_sit(:,:)     = tab_read_flds(:,:,idr_icetem)  ! Sea ice temperature
    343342!$OMP END MASTER
    344343
     
    354353! Transform the currents from cartesian to spheric coordinates
    355354! tmp_r0 should be zero
    356           CALL geo2atm(iim, jj_nb, tab_read_flds(:,:,5), tab_read_flds(:,:,6), tab_read_flds(:,:,7), &
     355          CALL geo2atm(iim, jj_nb, tab_read_flds(:,:,idr_curenx), &
     356             tab_read_flds(:,:,idr_cureny), tab_read_flds(:,:,idr_curenz), &
    357357               tmp_lon, tmp_lat, &
    358358               read_u0(:,:), read_v0(:,:), tmp_r0(:,:))
    359359!$OMP END MASTER
    360360
    361        ELSE
     361      ELSE
    362362          read_u0(:,:) = 0.
    363363          read_v0(:,:) = 0.
     364      ENDIF
     365
     366       IF (cpl_carbon_cycle) THEN
     367!$OMP MASTER
     368           read_co2(:,:) = tab_read_flds(:,:,idr_oceco2) ! CO2 flux
     369!$OMP END MASTER
    364370       ENDIF
    365371
     
    374380       DO i = 1, klon
    375381          ! treatment only of points with ocean and/or seaice
     382          ! old land-ocean mask can not be changed
    376383          IF (pctsrf_old(i,is_oce) + pctsrf_old(i,is_sic) > 0.) THEN
    377384             pctsrf(i,is_sic) = (pctsrf_old(i,is_oce) + pctsrf_old(i,is_sic)) &
     
    423430    CALL cpl2gath(read_v0, v0_new, knon, knindex)
    424431
     432    IF (cpl_carbon_cycle) THEN
     433       WRITE(*,*) 'cpl_carbon_cycle TO BE DONE!!'
     434       !!    var_co2 will be a intent(out) argument
     435       !!    CALL cpl2gath(read_co2, var_co2, knon, knindex)
     436    END IF
    425437!*************************************************************************************
    426438! The fields received from the coupler have to be weighted with the fraction of ocean
     
    519531    CHARACTER(len = 25)                     :: modname = 'cpl_send_ocean_fields'
    520532    CHARACTER(len = 80)                     :: abort_message
     533    REAL, DIMENSION(klon)                   :: atm_co2    ! JG: to be an INTENT(IN) if cpl_carbon_cycle
    521534
    522535!*************************************************************************************
     
    543556       cpl_tauy(1:knon,cpl_index) = 0.0
    544557       cpl_windsp(1:knon,cpl_index) = 0.0
     558       IF (cpl_carbon_cycle) cpl_atm_co2(1:knon,cpl_index) = 0.0
    545559    ENDIF
    546560       
     
    572586       cpl_windsp(ig,cpl_index) = cpl_windsp(ig,cpl_index) + &
    573587            windsp(ig)      / FLOAT(nexca)
    574     ENDDO
     588
     589       IF (cpl_carbon_cycle) THEN
     590          atm_co2=286.
     591          cpl_atm_co2(ig,cpl_index) = cpl_atm_co2(ig,cpl_index) + &
     592               atm_co2(ig)/ FLOAT(nexca)
     593       END IF
     594     ENDDO
    575595
    576596!*************************************************************************************
     
    607627          sum_error = sum_error + error
    608628         
     629          IF (cpl_carbon_cycle) THEN
     630             ALLOCATE(cpl_atm_co22D(iim,jj_nb), stat=error)
     631             sum_error = sum_error + error
     632          END IF
     633
    609634          IF (sum_error /= 0) THEN
    610635             abort_message='Pb allocation variables couplees pour l''ecriture'
     
    650675            knon, knindex)
    651676
    652     ENDIF
     677       IF (cpl_carbon_cycle) &
     678            CALL gath2cpl(cpl_atm_co2(:,cpl_index), cpl_atm_co22D(:,:), knon, knindex)
     679   ENDIF
    653680
    654681  END SUBROUTINE cpl_send_ocean_fields
     
    775802          ALLOCATE(cpl_windsp2D(iim,jj_nb), stat=error)
    776803          sum_error = sum_error + error
    777          
     804
     805          IF (cpl_carbon_cycle) THEN
     806             ALLOCATE(cpl_atm_co22D(iim,jj_nb), stat=error)
     807             sum_error = sum_error + error
     808          END IF
     809
    778810          IF (sum_error /= 0) THEN
    779811             abort_message='Pb allocation variables couplees pour l''ecriture'
     
    9791011    REAL, DIMENSION(iim, jj_nb)                          :: tmp_calv
    9801012! Table with all fields to send to coupler
    981     REAL, DIMENSION(iim, jj_nb, jpflda2o1+jpflda2o2)     :: tab_flds
     1013    REAL, DIMENSION(iim, jj_nb, maxsend)                 :: tab_flds
    9821014    REAL, DIMENSION(klon_mpi)                            :: rlon_mpi, rlat_mpi
    9831015
     
    9981030!*************************************************************************************
    9991031!$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)
     1032    tab_flds(:,:,ids_windsp) = cpl_windsp2D(:,:)
     1033    tab_flds(:,:,ids_shfice) = cpl_sols2D(:,:,2)
     1034    tab_flds(:,:,ids_nsfice) = cpl_nsol2D(:,:,2)
     1035    tab_flds(:,:,ids_dflxdt) = cpl_fder2D(:,:,2)
    10041036   
    10051037    IF (version_ocean=='nemo') THEN
    1006        tab_flds(:,:,18) = cpl_rriv2D(:,:) + cpl_rcoa2D(:,:)
     1038       tab_flds(:,:,ids_liqrun) = cpl_rriv2D(:,:) + cpl_rcoa2D(:,:)
     1039       IF (cpl_carbon_cycle) tab_flds(:,:,ids_atmco2)=cpl_atm_co22D(:,:)
    10071040    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(:,:)
     1041       tab_flds(:,:,ids_shfoce) = cpl_sols2D(:,:,1)
     1042       tab_flds(:,:,ids_nsfoce) = cpl_nsol2D(:,:,1)
     1043       tab_flds(:,:,ids_icevap) = cpl_evap2D(:,:,2)
     1044       tab_flds(:,:,ids_ocevap) = cpl_evap2D(:,:,1)
     1045       tab_flds(:,:,ids_runcoa) = cpl_rcoa2D(:,:)
     1046       tab_flds(:,:,ids_rivflu) = cpl_rriv2D(:,:)
    10141047    END IF
    10151048
     
    10631096      ENDIF
    10641097     
    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
     1098      tab_flds(:,:,ids_calvin) = tmp_calv(:,:)
    10701099
    10711100!*************************************************************************************
     
    10781107
    10791108       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
     1109          tab_flds(:,:,ids_shftot)  = 0.0
     1110          tab_flds(:,:,ids_nsftot) = 0.0
     1111          tab_flds(:,:,ids_totrai) = 0.0
     1112          tab_flds(:,:,ids_totsno) = 0.0
     1113          tab_flds(:,:,ids_toteva) = 0.0
    10851114 
    10861115          tmp_taux(:,:)    = 0.0
     
    10931122                  cpl_tauy2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
    10941123             
    1095              tab_flds(:,:,9) = cpl_sols2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
     1124             tab_flds(:,:,ids_shftot) = cpl_sols2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
    10961125                  cpl_sols2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
    1097              tab_flds(:,:,11) = cpl_nsol2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
     1126             tab_flds(:,:,ids_nsftot) = cpl_nsol2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
    10981127                  cpl_nsol2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
    1099              tab_flds(:,:,13) = cpl_rain2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
     1128             tab_flds(:,:,ids_totrai) = cpl_rain2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
    11001129                  cpl_rain2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
    1101              tab_flds(:,:,14) = cpl_snow2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
     1130             tab_flds(:,:,ids_totsno) = cpl_snow2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
    11021131                  cpl_snow2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
    1103              tab_flds(:,:,15) = cpl_evap2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
     1132             tab_flds(:,:,ids_toteva) = cpl_evap2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
    11041133                  cpl_evap2D(:,:,2)  * pctsrf2D(:,:,is_sic) / deno(:,:)
    11051134         ENDWHERE
    11061135
    1107           tab_flds(:,:,16) = cpl_evap2D(:,:,2)
     1136          tab_flds(:,:,ids_icevap) = cpl_evap2D(:,:,2)
    11081137         
    11091138       ELSE IF (version_ocean=='opa8') THEN
    11101139          ! 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
     1140          tab_flds(:,:,ids_totrai) = 0.0
     1141          tab_flds(:,:,ids_totsno) = 0.0
    11131142          tmp_taux(:,:)    = 0.0
    11141143          tmp_tauy(:,:)    = 0.0
    11151144          ! For all valid grid cells containing some fraction of ocean or sea-ice
    11161145          WHERE ( deno(:,:) /= 0 )
    1117              tab_flds(:,:,15) = cpl_rain2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
     1146             tab_flds(:,:,ids_totrai) = cpl_rain2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
    11181147                  cpl_rain2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
    1119              tab_flds(:,:,16) = cpl_snow2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
     1148             tab_flds(:,:,ids_totsno) = cpl_snow2D(:,:,1) * pctsrf2D(:,:,is_oce) / deno(:,:) +    &
    11201149                  cpl_snow2D(:,:,2) * pctsrf2D(:,:,is_sic) / deno(:,:)
    11211150             
     
    11631192!$OMP MASTER
    11641193    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)
     1194         tab_flds(:,:,ids_tauxxu), tab_flds(:,:,ids_tauyyu), tab_flds(:,:,ids_tauzzu) )
     1195   
     1196    tab_flds(:,:,ids_tauxxv)  = tab_flds(:,:,ids_tauxxu)
     1197    tab_flds(:,:,ids_tauyyv)  = tab_flds(:,:,ids_tauyyu)
     1198    tab_flds(:,:,ids_tauzzv)  = tab_flds(:,:,ids_tauzzu)
    11701199!$OMP END MASTER
    11711200
     
    11751204!*************************************************************************************
    11761205    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)
     1206        DO j=1,maxsend
     1207          IF (infosend(j)%action) CALL histwrite(nidct,infosend(j)%name, itau_w, &
     1208             tab_flds(:,:,j),iim*(jjm+1),ndexct)
     1209        ENDDO
    11971210    ENDIF
    1198 
    1199 
    12001211!*************************************************************************************
    12011212! Send the table of all fields
     
    12201231    DEALLOCATE(cpl_taux2D, cpl_tauy2D, cpl_windsp2D, stat=error )
    12211232    sum_error = sum_error + error
     1233   
     1234    IF (cpl_carbon_cycle) THEN
     1235       DEALLOCATE(cpl_atm_co22D, stat=error )
     1236       sum_error = sum_error + error
     1237    END IF
     1238
    12221239    IF (sum_error /= 0) THEN
    12231240       abort_message='Pb in deallocation of cpl_xxxx2D coupling variables'
  • LMDZ4/branches/LMDZ4-dev/libf/phylmd/oasis.F90

    r1133 r1152  
    2222 
    2323  IMPLICIT NONE
    24    
    25 ! Maximum number of fields exchanged between ocean and atmosphere
    26   INTEGER, PARAMETER  :: jpmaxfld=40
    27 ! Number of fields exchanged from atmosphere to ocean via flx.F
    28   INTEGER, PARAMETER  :: jpflda2o1=13
    29 ! Number of fields exchanged from atmosphere to ocean via tau.F
    30   INTEGER, PARAMETER  :: jpflda2o2=6
    31 ! Number of fields exchanged from ocean to atmosphere
    32   INTEGER  :: jpfldo2a
    33 
    34   CHARACTER (len=8), DIMENSION(jpmaxfld), PUBLIC, SAVE   :: cl_read
    35   !$OMP THREADPRIVATE(cl_read)
    36   CHARACTER (len=8), DIMENSION(jpmaxfld), PUBLIC, SAVE   :: cl_writ
    37   !$OMP THREADPRIVATE(cl_writ)
    38 
    39   INTEGER, DIMENSION(jpmaxfld), SAVE, PRIVATE            :: in_var_id
    40   !$OMP THREADPRIVATE(in_var_id)
    41   INTEGER, DIMENSION(jpflda2o1+jpflda2o2), SAVE, PRIVATE :: out_var_id
    42   !$OMP THREADPRIVATE(out_var_id)
    43 
     24 
     25  ! Id for fields sent to ocean
     26  INTEGER, PARAMETER :: ids_tauxxu = 1
     27  INTEGER, PARAMETER :: ids_tauyyu = 2
     28  INTEGER, PARAMETER :: ids_tauzzu = 3
     29  INTEGER, PARAMETER :: ids_tauxxv = 4
     30  INTEGER, PARAMETER :: ids_tauyyv = 5
     31  INTEGER, PARAMETER :: ids_tauzzv = 6
     32  INTEGER, PARAMETER :: ids_windsp = 7
     33  INTEGER, PARAMETER :: ids_shfice = 8
     34  INTEGER, PARAMETER :: ids_shfoce = 9
     35  INTEGER, PARAMETER :: ids_shftot = 10
     36  INTEGER, PARAMETER :: ids_nsfice = 11
     37  INTEGER, PARAMETER :: ids_nsfoce = 12
     38  INTEGER, PARAMETER :: ids_nsftot = 13
     39  INTEGER, PARAMETER :: ids_dflxdt = 14
     40  INTEGER, PARAMETER :: ids_totrai = 15
     41  INTEGER, PARAMETER :: ids_totsno = 16
     42  INTEGER, PARAMETER :: ids_toteva = 17
     43  INTEGER, PARAMETER :: ids_icevap = 18
     44  INTEGER, PARAMETER :: ids_ocevap = 19
     45  INTEGER, PARAMETER :: ids_calvin = 20
     46  INTEGER, PARAMETER :: ids_liqrun = 21
     47  INTEGER, PARAMETER :: ids_runcoa = 22
     48  INTEGER, PARAMETER :: ids_rivflu = 23
     49  INTEGER, PARAMETER :: ids_atmco2 = 24
     50  INTEGER, PARAMETER :: maxsend    = 24  ! Maximum number of fields to send
     51 
     52  ! Id for fields received from ocean
     53  INTEGER, PARAMETER :: idr_sisutw = 1
     54  INTEGER, PARAMETER :: idr_icecov = 2
     55  INTEGER, PARAMETER :: idr_icealw = 3
     56  INTEGER, PARAMETER :: idr_icetem = 4
     57  INTEGER, PARAMETER :: idr_curenx = 5
     58  INTEGER, PARAMETER :: idr_cureny = 6
     59  INTEGER, PARAMETER :: idr_curenz = 7
     60  INTEGER, PARAMETER :: idr_oceco2 = 8
     61  INTEGER, PARAMETER :: maxrecv    = 8  ! Maximum number of fields to receive
     62 
     63
     64  TYPE, PUBLIC ::   FLD_CPL            ! Type for coupling field information
     65     CHARACTER(len = 8) ::   name      ! Name of the coupling field   
     66     LOGICAL            ::   action    ! To be exchanged or not
     67     INTEGER            ::   nid       ! Id of the field
     68  END TYPE FLD_CPL
     69
     70  TYPE(FLD_CPL), DIMENSION(maxsend), PUBLIC :: infosend   ! Information for sending coupling fields
     71  TYPE(FLD_CPL), DIMENSION(maxrecv), PUBLIC :: inforecv   ! Information for receiving coupling fields
     72 
    4473  LOGICAL :: cpl_current
     74  LOGICAL :: cpl_carbon_cycle
    4575
    4676#ifdef CPP_COUPLE
     
    5989    USE surface_data, ONLY : version_ocean
    6090    INCLUDE "dimensions.h"
     91    INCLUDE "iniprint.h"
    6192
    6293! Local variables
     
    69100    INTEGER, DIMENSION(4)              :: il_var_actual_shape
    70101    INTEGER                            :: il_var_type
    71     INTEGER                            :: nuout = 6
    72102    INTEGER                            :: jf
    73103    CHARACTER (len = 6)                :: clmodnam
     
    75105    CHARACTER (len = 80)               :: abort_message
    76106    LOGICAL                            :: cpl_current_omp
     107    LOGICAL                            :: cpl_carbon_cycle_omp
    77108
    78109!*    1. Initializations
    79110!        ---------------
    80111!************************************************************************************
    81     WRITE(nuout,*) ' '
    82     WRITE(nuout,*) ' '
    83     WRITE(nuout,*) ' ROUTINE INICMA'
    84     WRITE(nuout,*) ' **************'
    85     WRITE(nuout,*) ' '
    86     WRITE(nuout,*) ' '
     112    WRITE(lunout,*) ' '
     113    WRITE(lunout,*) ' '
     114    WRITE(lunout,*) ' ROUTINE INICMA'
     115    WRITE(lunout,*) ' **************'
     116    WRITE(lunout,*) ' '
     117    WRITE(lunout,*) ' '
    87118
    88119!
     
    90121!
    91122    clmodnam = 'lmdz.x'       ! as in $NBMODEL in Cpl/Nam/namcouple.tmp
     123
    92124
    93125!************************************************************************************
     
    100132!$OMP BARRIER
    101133    cpl_current = cpl_current_omp
    102     WRITE(nuout,*) 'Couple ocean currents, cpl_current = ',cpl_current
    103 
    104     IF (cpl_current) THEN
    105        jpfldo2a=7
    106     ELSE
    107        jpfldo2a=4
    108     END IF
     134    WRITE(lunout,*) 'Couple ocean currents, cpl_current = ',cpl_current
     135
     136!************************************************************************************
     137! Define if coupling carbon cycle or not
     138!************************************************************************************
     139!$OMP MASTER
     140    cpl_carbon_cycle_omp = .FALSE.
     141    CALL getin('cpl_carbon_cycle', cpl_carbon_cycle_omp)
     142!$OMP END MASTER
     143!$OMP BARRIER
     144    cpl_carbon_cycle=cpl_carbon_cycle_omp
     145    WRITE(lunout,*) 'Couple carbon cycle , cpl_carbon_cycle = ',cpl_carbon_cycle
     146
     147!************************************************************************************
     148! Define coupling variables
     149!************************************************************************************
     150
     151! Atmospheric variables to send
     152
     153    infosend(:)%action = .FALSE.
     154
     155    infosend(ids_tauxxu)%action = .TRUE. ; infosend(ids_tauxxu)%name = 'COTAUXXU'
     156    infosend(ids_tauyyu)%action = .TRUE. ; infosend(ids_tauyyu)%name = 'COTAUYYU'
     157    infosend(ids_tauzzu)%action = .TRUE. ; infosend(ids_tauzzu)%name = 'COTAUZZU'
     158    infosend(ids_tauxxv)%action = .TRUE. ; infosend(ids_tauxxv)%name = 'COTAUXXV'
     159    infosend(ids_tauyyv)%action = .TRUE. ; infosend(ids_tauyyv)%name = 'COTAUYYV'
     160    infosend(ids_tauzzv)%action = .TRUE. ; infosend(ids_tauzzv)%name = 'COTAUZZV'
     161    infosend(ids_windsp)%action = .TRUE. ; infosend(ids_windsp)%name = 'COWINDSP'
     162    infosend(ids_shfice)%action = .TRUE. ; infosend(ids_shfice)%name = 'COSHFICE'
     163    infosend(ids_nsfice)%action = .TRUE. ; infosend(ids_nsfice)%name = 'CONSFICE'
     164    infosend(ids_dflxdt)%action = .TRUE. ; infosend(ids_dflxdt)%name = 'CODFLXDT'
     165    infosend(ids_calvin)%action = .TRUE. ; infosend(ids_calvin)%name = 'COCALVIN'
     166   
     167   
     168    IF (version_ocean=='nemo') THEN
     169        infosend(ids_shftot)%action = .TRUE. ; infosend(ids_shftot)%name = 'COQSRMIX'
     170        infosend(ids_nsftot)%action = .TRUE. ; infosend(ids_nsftot)%name = 'COQNSMIX'
     171        infosend(ids_totrai)%action = .TRUE. ; infosend(ids_totrai)%name = 'COTOTRAI'
     172        infosend(ids_totsno)%action = .TRUE. ; infosend(ids_totsno)%name = 'COTOTSNO'
     173        infosend(ids_toteva)%action = .TRUE. ; infosend(ids_toteva)%name = 'COTOTEVA'
     174        infosend(ids_icevap)%action = .TRUE. ; infosend(ids_icevap)%name = 'COICEVAP'
     175        infosend(ids_liqrun)%action = .TRUE. ; infosend(ids_liqrun)%name = 'COLIQRUN'
     176        IF (cpl_carbon_cycle) THEN
     177            infosend(ids_atmco2)%action = .TRUE. ; infosend(ids_atmco2)%name = 'COATMCO2'
     178        ENDIF
     179       
     180    ELSE IF (version_ocean=='opa8') THEN
     181        infosend(ids_shfoce)%action = .TRUE. ; infosend(ids_shfoce)%name = 'COSHFOCE'
     182        infosend(ids_nsfoce)%action = .TRUE. ; infosend(ids_nsfoce)%name = 'CONSFOCE'
     183        infosend(ids_icevap)%action = .TRUE. ; infosend(ids_icevap)%name = 'COTFSICE'
     184        infosend(ids_ocevap)%action = .TRUE. ; infosend(ids_ocevap)%name = 'COTFSOCE'
     185        infosend(ids_totrai)%action = .TRUE. ; infosend(ids_totrai)%name = 'COTOLPSU'
     186        infosend(ids_totsno)%action = .TRUE. ; infosend(ids_totsno)%name = 'COTOSPSU'
     187        infosend(ids_runcoa)%action = .TRUE. ; infosend(ids_runcoa)%name = 'CORUNCOA'
     188        infosend(ids_rivflu)%action = .TRUE. ; infosend(ids_rivflu)%name = 'CORIVFLU'
     189   ENDIF
     190       
     191! Oceanic variables to receive
     192
     193   inforecv(:)%action = .FALSE.
     194
     195   inforecv(idr_sisutw)%action = .TRUE. ; inforecv(idr_sisutw)%name = 'SISUTESW'
     196   inforecv(idr_icecov)%action = .TRUE. ; inforecv(idr_icecov)%name = 'SIICECOV'
     197   inforecv(idr_icealw)%action = .TRUE. ; inforecv(idr_icealw)%name = 'SIICEALW'
     198   inforecv(idr_icetem)%action = .TRUE. ; inforecv(idr_icetem)%name = 'SIICTEMW'
     199   
     200   IF (cpl_current ) THEN
     201       inforecv(idr_curenx)%action = .TRUE. ; inforecv(idr_curenx)%name = 'CURRENTX'
     202       inforecv(idr_cureny)%action = .TRUE. ; inforecv(idr_cureny)%name = 'CURRENTY'
     203       inforecv(idr_curenz)%action = .TRUE. ; inforecv(idr_curenz)%name = 'CURRENTZ'
     204   ENDIF
     205
     206   IF (cpl_carbon_cycle ) THEN
     207       inforecv(idr_oceco2)%action = .TRUE. ; inforecv(idr_oceco2)%name = 'SICO2FLX'
     208   ENDIF
     209
    109210!************************************************************************************
    110211! Here we go: psmile initialisation
     
    117218          CALL abort_gcm(modname,abort_message,1)
    118219       ELSE
    119           WRITE(nuout,*) 'inicma : init psmile ok '
     220          WRITE(lunout,*) 'inicma : init psmile ok '
    120221       ENDIF
    121222    ENDIF
     
    130231
    131232    IF (mpi_rank==mpi_size-1) ig_paral(3)=ig_paral(3)+iim-1
    132     WRITE(nuout,*) mpi_rank,'ig_paral--->',ig_paral(2),ig_paral(3)
     233    WRITE(lunout,*) mpi_rank,'ig_paral--->',ig_paral(2),ig_paral(3)
    133234   
    134235    ierror=PRISM_Ok
     
    139240       CALL abort_gcm(modname,abort_message,1)
    140241    ELSE
    141        WRITE(nuout,*) 'inicma : decomposition domaine psmile ok '
    142     ENDIF
    143 
    144 !************************************************************************************
    145 ! Field Declarations
    146 !************************************************************************************
    147 !     Define symbolic name for fields exchanged from atmos to coupler,
    148 !         must be the same as (1) of the field definition in namcouple:
    149 !
    150 !   Initialization
    151     cl_writ(:)='NOFLDATM'
    152 
    153     cl_writ(1)='COTAUXXU'
    154     cl_writ(2)='COTAUYYU'
    155     cl_writ(3)='COTAUZZU'
    156     cl_writ(4)='COTAUXXV'
    157     cl_writ(5)='COTAUYYV'
    158     cl_writ(6)='COTAUZZV'
    159     cl_writ(7)='COWINDSP'
    160     cl_writ(8)='COSHFICE'
    161     cl_writ(10)='CONSFICE'
    162     cl_writ(12)='CODFLXDT'
    163 
    164     IF (version_ocean=='nemo') THEN
    165       cl_writ(9)='COQSRMIX'
    166       cl_writ(11)='COQNSMIX'
    167       cl_writ(13)='COTOTRAI'
    168       cl_writ(14)='COTOTSNO'
    169       cl_writ(15)='COTOTEVA'
    170       cl_writ(16)='COICEVAP'
    171       cl_writ(17)='COCALVIN'
    172       cl_writ(18)='COLIQRUN'
    173     ELSE IF (version_ocean=='opa8') THEN
    174        cl_writ(9)='COSHFOCE'
    175        cl_writ(11)='CONSFOCE'
    176        cl_writ(13)='COTFSICE'
    177        cl_writ(14)='COTFSOCE'
    178        cl_writ(15)='COTOLPSU'
    179        cl_writ(16)='COTOSPSU'
    180        cl_writ(17)='CORUNCOA'
    181        cl_writ(18)='CORIVFLU'
    182        cl_writ(19)='COCALVIN'
    183     ENDIF
    184 
    185 !
    186 !     Define symbolic name for fields exchanged from coupler to atmosphere,
    187 !         must be the same as (2) of the field definition in namcouple:
    188 !
    189 !   Initialization
    190     cl_read(:)='NOFLDATM'
    191 
    192     cl_read(1)='SISUTESW'
    193     cl_read(2)='SIICECOV'
    194     cl_read(3)='SIICEALW'
    195     cl_read(4)='SIICTEMW'
    196 
    197     IF (cpl_current) THEN
    198        cl_read(5)='CURRENTX'
    199        cl_read(6)='CURRENTY'
    200        cl_read(7)='CURRENTZ'
    201     END IF
     242       WRITE(lunout,*) 'inicma : decomposition domaine psmile ok '
     243    ENDIF
    202244
    203245    il_var_nodims(1) = 2
     
    212254
    213255!************************************************************************************
    214 ! Oceanic Fields
    215 !************************************************************************************
    216     DO jf=1, jpfldo2a
    217        CALL prism_def_var_proto(in_var_id(jf), cl_read(jf), il_part_id, &
    218             il_var_nodims, PRISM_In, il_var_actual_shape, il_var_type, &
    219             ierror)
    220        IF (ierror .NE. PRISM_Ok) THEN
    221           abort_message=' Probleme init dans prism_def_var_proto '
    222           CALL abort_gcm(modname,abort_message,1)
     256! Oceanic Fields to receive
     257! Loop over all possible variables
     258!************************************************************************************
     259    DO jf=1, maxrecv
     260       IF (inforecv(jf)%action) THEN
     261          CALL prism_def_var_proto(inforecv(jf)%nid, inforecv(jf)%name, il_part_id, &
     262               il_var_nodims, PRISM_In, il_var_actual_shape, il_var_type, &
     263               ierror)
     264          IF (ierror .NE. PRISM_Ok) THEN
     265             WRITE(lunout,*) 'inicma : Problem with prism_def_var_proto for field : ',&
     266                  inforecv(jf)%name
     267             abort_message=' Problem in call to prism_def_var_proto for fields to receive'
     268             CALL abort_gcm(modname,abort_message,1)
     269          ENDIF
    223270       ENDIF
    224271    END DO
    225 
    226 !************************************************************************************
    227 ! Atmospheric Fields
    228 !************************************************************************************
    229     DO jf=1, jpflda2o1+jpflda2o2
    230        CALL prism_def_var_proto(out_var_id(jf), cl_writ(jf), il_part_id, &
    231             il_var_nodims, PRISM_Out, il_var_actual_shape, il_var_type, &
    232             ierror)
    233        IF (ierror .NE. PRISM_Ok) THEN
    234           abort_message=' Probleme init dans prism_def_var_proto '
    235           CALL abort_gcm(modname,abort_message,1)
     272   
     273!************************************************************************************
     274! Atmospheric Fields to send
     275! Loop over all possible variables
     276!************************************************************************************
     277    DO jf=1,maxsend
     278       IF (infosend(jf)%action) THEN
     279          CALL prism_def_var_proto(infosend(jf)%nid, infosend(jf)%name, il_part_id, &
     280               il_var_nodims, PRISM_Out, il_var_actual_shape, il_var_type, &
     281               ierror)
     282          IF (ierror .NE. PRISM_Ok) THEN
     283             WRITE(lunout,*) 'inicma : Problem with prism_def_var_proto for field : ',&
     284                  infosend(jf)%name
     285             abort_message=' Problem in call to prism_def_var_proto for fields to send'
     286             CALL abort_gcm(modname,abort_message,1)
     287          ENDIF
    236288       ENDIF
    237289    END DO
    238 
     290   
    239291!************************************************************************************
    240292! End definition
     
    242294    CALL prism_enddef_proto(ierror)
    243295    IF (ierror .NE. PRISM_Ok) THEN
    244        abort_message=' Probleme init dans prism_ endef_proto'
     296       abort_message=' Problem in call to prism_endef_proto'
    245297       CALL abort_gcm(modname,abort_message,1)
    246298    ELSE
    247        WRITE(nuout,*) 'inicma : endef psmile ok '
     299       WRITE(lunout,*) 'inicma : endef psmile ok '
    248300    ENDIF
    249301   
     
    261313!
    262314    INCLUDE "dimensions.h"
     315    INCLUDE "iniprint.h"
    263316! Input arguments
    264317!************************************************************************************
     
    267320! Output arguments
    268321!************************************************************************************
    269     REAL, DIMENSION(iim, jj_nb,jpfldo2a), INTENT(OUT) :: tab_get
     322    REAL, DIMENSION(iim, jj_nb,maxrecv), INTENT(OUT) :: tab_get
    270323
    271324! Local variables
    272325!************************************************************************************
    273     INTEGER                       :: nuout  = 6             ! listing output unit
    274326    INTEGER                       :: ierror, i
    275327    INTEGER                       :: istart,iend
     
    279331
    280332!************************************************************************************
    281     WRITE (nuout,*) ' '
    282     WRITE (nuout,*) 'Fromcpl: Reading fields from CPL, ktime=',ktime
    283     WRITE (nuout,*) ' '
     333    WRITE (lunout,*) ' '
     334    WRITE (lunout,*) 'Fromcpl: Reading fields from CPL, ktime=',ktime
     335    WRITE (lunout,*) ' '
    284336   
    285337    istart=ii_begin
     
    290342    ENDIF
    291343   
    292     DO i = 1, jpfldo2a
    293        field(:) = -99999.
    294        CALL prism_get_proto(in_var_id(i), ktime, field(istart:iend), ierror)
    295        tab_get(:,:,i) = RESHAPE(field(:),(/iim,jj_nb/))
     344    DO i = 1, maxrecv
     345      IF (inforecv(i)%action) THEN
     346          field(:) = -99999.
     347          CALL prism_get_proto(inforecv(i)%nid, ktime, field(istart:iend), ierror)
     348          tab_get(:,:,i) = RESHAPE(field(:),(/iim,jj_nb/))
    296349       
    297        IF (ierror .NE. PRISM_Ok .AND. ierror.NE.PRISM_Recvd .AND. &
    298             ierror.NE.PRISM_FromRest &
    299             .AND. ierror.NE.PRISM_Input .AND. ierror.NE.PRISM_RecvOut &
    300             .AND. ierror.NE.PRISM_FromRestOut) THEN
    301           WRITE (nuout,*)  cl_read(i), ktime   
    302           abort_message=' Probleme dans prism_get_proto '
    303           CALL abort_gcm(modname,abort_message,1)
    304        ENDIF
     350          IF (ierror .NE. PRISM_Ok .AND. ierror.NE.PRISM_Recvd .AND. &
     351             ierror.NE.PRISM_FromRest &
     352             .AND. ierror.NE.PRISM_Input .AND. ierror.NE.PRISM_RecvOut &
     353             .AND. ierror.NE.PRISM_FromRestOut) THEN
     354              WRITE (lunout,*)  'Error with receiving filed : ', inforecv(i)%name, ktime   
     355              abort_message=' Problem in prism_get_proto '
     356              CALL abort_gcm(modname,abort_message,1)
     357          ENDIF
     358      ENDIF
    305359    END DO
    306360   
     
    321375!
    322376    INCLUDE "dimensions.h"
     377    INCLUDE "iniprint.h"
    323378! Input arguments
    324379!************************************************************************************
    325     INTEGER, INTENT(IN)                                          :: ktime
    326     LOGICAL, INTENT(IN)                                          :: last
    327     REAL, DIMENSION(iim, jj_nb, jpflda2o1+jpflda2o2), INTENT(IN) :: tab_put
     380    INTEGER, INTENT(IN)                              :: ktime
     381    LOGICAL, INTENT(IN)                              :: last
     382    REAL, DIMENSION(iim, jj_nb, maxsend), INTENT(IN) :: tab_put
    328383
    329384! Local variables
     
    332387    INTEGER                          :: istart,iend
    333388    INTEGER                          :: wstart,wend
    334     INTEGER, PARAMETER               :: nuout = 6
    335389    INTEGER                          :: ierror, i
    336390    REAL, DIMENSION(iim*jj_nb)       :: field
     
    341395    checkout=.FALSE.
    342396
    343     WRITE(nuout,*) ' '
    344     WRITE(nuout,*) 'Intocpl: sending fields to CPL, ktime= ', ktime
    345     WRITE(nuout,*) 'last ', last
    346     WRITE(nuout,*)
     397    WRITE(lunout,*) ' '
     398    WRITE(lunout,*) 'Intocpl: sending fields to CPL, ktime= ', ktime
     399    WRITE(lunout,*) 'last = ', last
     400    WRITE(lunout,*)
    347401
    348402
     
    360414       IF (is_south_pole) wend=iend-iim+1
    361415       
    362        field = RESHAPE(tab_put(:,:,8),(/iim*jj_nb/))
    363        CALL writeField_phy("fsolice",field(wstart:wend),1)
    364        field = RESHAPE(tab_put(:,:,9),(/iim*jj_nb/))
    365        CALL writeField_phy("fsolwat",field(wstart:wend),1)
    366        field = RESHAPE(tab_put(:,:,10),(/iim*jj_nb/))
    367        CALL writeField_phy("fnsolice",field(wstart:wend),1)
    368        field = RESHAPE(tab_put(:,:,11),(/iim*jj_nb/))
    369        CALL writeField_phy("fnsolwat",field(wstart:wend),1)
    370        field = RESHAPE(tab_put(:,:,12),(/iim*jj_nb/))
    371        CALL writeField_phy("fnsicedt",field(wstart:wend),1)
    372        field = RESHAPE(tab_put(:,:,13),(/iim*jj_nb/))
    373        CALL writeField_phy("evice",field(wstart:wend),1)
    374        field = RESHAPE(tab_put(:,:,14),(/iim*jj_nb/))
    375        CALL writeField_phy("evwat",field(wstart:wend),1)
    376        field = RESHAPE(tab_put(:,:,15),(/iim*jj_nb/))
    377        CALL writeField_phy("lpre",field(wstart:wend),1)
    378        field = RESHAPE(tab_put(:,:,16),(/iim*jj_nb/))
    379        CALL writeField_phy("spre",field(wstart:wend),1)
    380        field = RESHAPE(tab_put(:,:,17),(/iim*jj_nb/))
    381        CALL writeField_phy("dirunoff",field(wstart:wend),1)
    382        field = RESHAPE(tab_put(:,:,18),(/iim*jj_nb/))
    383        CALL writeField_phy("rivrunoff",field(wstart:wend),1)
    384        field = RESHAPE(tab_put(:,:,19),(/iim*jj_nb/))
    385        CALL writeField_phy("calving",field(wstart:wend),1)
    386        field = RESHAPE(tab_put(:,:,1),(/iim*jj_nb/))
    387        CALL writeField_phy("tauxx_u",field(wstart:wend),1)
    388        field = RESHAPE(tab_put(:,:,2),(/iim*jj_nb/))
    389        CALL writeField_phy("tauyy_u",field(wstart:wend),1)
    390        field = RESHAPE(tab_put(:,:,3),(/iim*jj_nb/))
    391        CALL writeField_phy("tauzz_u",field(wstart:wend),1)
    392        field = RESHAPE(tab_put(:,:,4),(/iim*jj_nb/))
    393        CALL writeField_phy("tauxx_v",field(wstart:wend),1)
    394        field = RESHAPE(tab_put(:,:,5),(/iim*jj_nb/))
    395        CALL writeField_phy("tauyy_v",field(wstart:wend),1)
    396        field = RESHAPE(tab_put(:,:,6),(/iim*jj_nb/))
    397        CALL writeField_phy("tauzz_v",field(wstart:wend),1)
    398        field = RESHAPE(tab_put(:,:,7),(/iim*jj_nb/))
    399        CALL writeField_phy("windsp",field(wstart:wend),1)
    400     ENDIF
    401    
     416       DO i = 1, maxsend
     417          IF (infosend(i)%action) THEN
     418             field = RESHAPE(tab_put(:,:,i),(/iim*jj_nb/))
     419             CALL writefield_phy(infosend(i)%name,field(wstart:wend),1)
     420          END IF
     421       END DO
     422    END IF
     423
    402424!************************************************************************************
    403425! PRISM_PUT
    404426!************************************************************************************
    405427
    406     DO i = 1, jpflda2o1+jpflda2o2
    407        field = RESHAPE(tab_put(:,:,i),(/iim*jj_nb/))
    408        CALL prism_put_proto(out_var_id(i), ktime, field(istart:iend), ierror)
    409        
    410        IF (ierror .NE. PRISM_Ok .AND. ierror.NE.PRISM_Sent .AND. ierror.NE.PRISM_ToRest &
    411             .AND. ierror.NE.PRISM_LocTrans .AND. ierror.NE.PRISM_Output .AND. &
    412             ierror.NE.PRISM_SentOut .AND. ierror.NE.PRISM_ToRestOut) THEN
    413           WRITE (nuout,*)  cl_writ(i), ktime   
    414           abort_message=' Probleme dans prism_put_proto '
    415           CALL abort_gcm(modname,abort_message,1)
    416        ENDIF
    417        
     428    DO i = 1, maxsend
     429      IF (infosend(i)%action) THEN
     430          field = RESHAPE(tab_put(:,:,i),(/iim*jj_nb/))
     431          CALL prism_put_proto(infosend(i)%nid, ktime, field(istart:iend), ierror)
     432         
     433          IF (ierror .NE. PRISM_Ok .AND. ierror.NE.PRISM_Sent .AND. ierror.NE.PRISM_ToRest &
     434             .AND. ierror.NE.PRISM_LocTrans .AND. ierror.NE.PRISM_Output .AND. &
     435             ierror.NE.PRISM_SentOut .AND. ierror.NE.PRISM_ToRestOut) THEN
     436              WRITE (lunout,*) 'Error with sending field :', infosend(i)%name, ktime   
     437              abort_message=' Problem in prism_put_proto '
     438              CALL abort_gcm(modname,abort_message,1)
     439          ENDIF
     440      ENDIF
    418441    END DO
    419442   
     
    427450          CALL prism_terminate_proto(ierror)
    428451          IF (ierror .NE. PRISM_Ok) THEN
    429              abort_message=' Probleme dans prism_terminate_proto '
     452             abort_message=' Problem in prism_terminate_proto '
    430453             CALL abort_gcm(modname,abort_message,1)
    431454          ENDIF
Note: See TracChangeset for help on using the changeset viewer.