New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 2789 for branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90 – NEMO

Ignore:
Timestamp:
2011-06-27T13:18:25+02:00 (13 years ago)
Author:
cetlod
Message:

Implementation of the merge of TRA/TRP : first guess, see ticket #842

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90

    r2715 r2789  
    4646   USE limwri_2  
    4747#endif 
    48    USE dtatem 
    49    USE dtasal 
    5048   USE lib_mpp         ! MPP library 
    5149 
     
    116114      !! ** Method  :  use iom_put 
    117115      !!---------------------------------------------------------------------- 
    118       USE oce, ONLY :   z3d => ta   ! use ta as 3D workspace 
    119116      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released 
     117      USE wrk_nemo, ONLY: z3d => wrk_3d_1 
    120118      USE wrk_nemo, ONLY: z2d => wrk_2d_1 
    121119      !! 
     
    126124      !!---------------------------------------------------------------------- 
    127125      !  
    128       IF( wrk_in_use(2, 1))THEN 
    129          CALL ctl_stop('dia_wri: ERROR - requested 2D workspace unavailable.') 
    130          RETURN 
     126      IF(  wrk_in_use(3, 1) .OR. wrk_in_use(2, 1) ) THEN 
     127         CALL ctl_stop('dia_wri: ERROR - requested 2D workspace unavailable.')  ;  RETURN 
    131128      END IF 
    132129      ! 
     
    137134      ENDIF 
    138135 
    139       CALL iom_put( "toce"   , tn                    )    ! temperature 
    140       CALL iom_put( "soce"   , sn                    )    ! salinity 
    141       CALL iom_put( "sst"    , tn(:,:,1)             )    ! sea surface temperature 
    142       CALL iom_put( "sst2"   , tn(:,:,1) * tn(:,:,1) )    ! square of sea surface temperature 
    143       CALL iom_put( "sss"    , sn(:,:,1)             )    ! sea surface salinity 
    144       CALL iom_put( "sss2"   , sn(:,:,1) * sn(:,:,1) )    ! square of sea surface salinity 
    145       CALL iom_put( "uoce"   , un                    )    ! i-current       
    146       CALL iom_put( "voce"   , vn                    )    ! j-current 
     136      CALL iom_put( "toce"   , tsn(:,:,:,jp_tem)                     )    ! temperature 
     137      CALL iom_put( "soce"   , tsn(:,:,:,jp_sal)                     )    ! salinity 
     138      CALL iom_put( "sst"    , tsn(:,:,1,jp_tem)                     )    ! sea surface temperature 
     139      CALL iom_put( "sst2"   , tsn(:,:,1,jp_tem) * tsn(:,:,1,jp_tem) )    ! square of sea surface temperature 
     140      CALL iom_put( "sss"    , tsn(:,:,1,jp_sal)                     )    ! sea surface salinity 
     141      CALL iom_put( "sss2"   , tsn(:,:,1,jp_sal) * tsn(:,:,1,jp_sal) )    ! square of sea surface salinity 
     142      CALL iom_put( "uoce"   , un                                    )    ! i-current       
     143      CALL iom_put( "voce"   , vn                                    )    ! j-current 
    147144       
    148       CALL iom_put( "avt"    , avt                   )    ! T vert. eddy diff. coef. 
    149       CALL iom_put( "avm"    , avmu                  )    ! T vert. eddy visc. coef. 
     145      CALL iom_put( "avt"    , avt                                   )    ! T vert. eddy diff. coef. 
     146      CALL iom_put( "avm"    , avmu                                  )    ! T vert. eddy visc. coef. 
    150147      IF( lk_zdfddm ) THEN 
    151          CALL iom_put( "avs" , fsavs(:,:,:)          )    ! S vert. eddy diff. coef. 
     148         CALL iom_put( "avs" , fsavs(:,:,:)                          )    ! S vert. eddy diff. coef. 
    152149      ENDIF 
    153150 
    154151      DO jj = 2, jpjm1                                    ! sst gradient 
    155152         DO ji = fs_2, fs_jpim1   ! vector opt. 
    156             zztmp      = tn(ji,jj,1) 
    157             zztmpx     = ( tn(ji+1,jj  ,1) - zztmp ) / e1u(ji,jj) + ( zztmp - tn(ji-1,jj  ,1) ) / e1u(ji-1,jj  ) 
    158             zztmpy     = ( tn(ji  ,jj+1,1) - zztmp ) / e2v(ji,jj) + ( zztmp - tn(ji  ,jj-1,1) ) / e2v(ji  ,jj-1) 
     153            zztmp      = tsn(ji,jj,1,jp_tem) 
     154            zztmpx     = ( tsn(ji+1,jj  ,1,jp_tem) - zztmp ) / e1u(ji,jj) + ( zztmp - tsn(ji-1,jj  ,1,jp_tem) ) / e1u(ji-1,jj  ) 
     155            zztmpy     = ( tsn(ji  ,jj+1,1,jp_tem) - zztmp ) / e2v(ji,jj) + ( zztmp - tsn(ji  ,jj-1,1,jp_tem) ) / e2v(ji  ,jj-1) 
    159156            z2d(ji,jj) = 0.25 * ( zztmpx * zztmpx + zztmpy * zztmpy )   & 
    160157               &              * umask(ji,jj,1) * umask(ji-1,jj,1) * vmask(ji,jj,1) * umask(ji,jj-1,1) 
     
    178175            DO jj = 2, jpjm1 
    179176               DO ji = fs_2, fs_jpim1   ! vector opt. 
    180                   z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * zztmp * ( tn(ji,jj,jk) + tn(ji+1,jj,jk) ) 
     177                  z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * zztmp * ( tsn(ji,jj,jk,jp_tem) + tsn(ji+1,jj,jk,jp_tem) ) 
    181178               END DO 
    182179            END DO 
     
    192189            DO jj = 2, jpjm1 
    193190               DO ji = fs_2, fs_jpim1   ! vector opt. 
    194                   z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * zztmp * ( tn(ji,jj,jk) + tn(ji,jj+1,jk) ) 
     191                  z2d(ji,jj) = z2d(ji,jj) + z3d(ji,jj,jk) * zztmp * ( tsn(ji,jj,jk,jp_tem) + tsn(ji,jj+1,jk,jp_tem) ) 
    195192               END DO 
    196193            END DO 
     
    200197      ENDIF 
    201198      ! 
    202       IF( wrk_not_released(2, 1))THEN 
     199      IF( wrk_not_released(3, 1) .OR. wrk_not_released(2, 1) ) THEN 
    203200         CALL ctl_stop('dia_wri: ERROR - failed to release 2D workspace.') 
    204201         RETURN 
     
    516513 
    517514      ! Write fields on T grid 
    518       CALL histwrite( nid_T, "votemper", it, tn            , ndim_T , ndex_T  )   ! temperature 
    519       CALL histwrite( nid_T, "vosaline", it, sn            , ndim_T , ndex_T  )   ! salinity 
    520       CALL histwrite( nid_T, "sosstsst", it, tn(:,:,1)     , ndim_hT, ndex_hT )   ! sea surface temperature 
    521       CALL histwrite( nid_T, "sosaline", it, sn(:,:,1)     , ndim_hT, ndex_hT )   ! sea surface salinity 
     515      CALL histwrite( nid_T, "votemper", it, tsn(:,:,:,jp_tem), ndim_T , ndex_T  )   ! temperature 
     516      CALL histwrite( nid_T, "vosaline", it, tsn(:,:,:,jp_sal), ndim_T , ndex_T  )   ! salinity 
     517      CALL histwrite( nid_T, "sosstsst", it, tsn(:,:,1,jp_tem), ndim_hT, ndex_hT )   ! sea surface temperature 
     518      CALL histwrite( nid_T, "sosaline", it, tsn(:,:,1,jp_sal), ndim_hT, ndex_hT )   ! sea surface salinity 
    522519      CALL histwrite( nid_T, "sossheig", it, sshn          , ndim_hT, ndex_hT )   ! sea surface height 
    523520!!$#if  defined key_lim3 || defined key_lim2  
     
    528525!!$      CALL histwrite( nid_T, "sorunoff", it, runoff        , ndim_hT, ndex_hT )   ! runoff 
    529526      CALL histwrite( nid_T, "sowaflcd", it, ( emps-rnf )  , ndim_hT, ndex_hT )   ! c/d water flux 
    530       zw2d(:,:) = ( emps(:,:) - rnf(:,:) ) * sn(:,:,1) * tmask(:,:,1) 
     527      zw2d(:,:) = ( emps(:,:) - rnf(:,:) ) * tsn(:,:,1,jp_sal) * tmask(:,:,1) 
    531528      CALL histwrite( nid_T, "sosalflx", it, zw2d          , ndim_hT, ndex_hT )   ! c/d salt flux 
    532529      CALL histwrite( nid_T, "sohefldo", it, qns + qsr     , ndim_hT, ndex_hT )   ! total heat flux 
     
    539536      CALL histwrite( nid_T, "sohefldp", it, qrp           , ndim_hT, ndex_hT )   ! heat flux damping 
    540537      CALL histwrite( nid_T, "sowafldp", it, erp           , ndim_hT, ndex_hT )   ! freshwater flux damping 
    541       IF( ln_ssr ) zw2d(:,:) = erp(:,:) * sn(:,:,1) * tmask(:,:,1) 
     538      IF( ln_ssr ) zw2d(:,:) = erp(:,:) * tsn(:,:,1,jp_sal) * tmask(:,:,1) 
    542539      CALL histwrite( nid_T, "sosafldp", it, zw2d          , ndim_hT, ndex_hT )   ! salt flux damping 
    543540#endif 
     
    545542      CALL histwrite( nid_T, "sohefldp", it, qrp           , ndim_hT, ndex_hT )   ! heat flux damping 
    546543      CALL histwrite( nid_T, "sowafldp", it, erp           , ndim_hT, ndex_hT )   ! freshwater flux damping 
    547          IF( ln_ssr ) zw2d(:,:) = erp(:,:) * sn(:,:,1) * tmask(:,:,1) 
     544         IF( ln_ssr ) zw2d(:,:) = erp(:,:) * tsn(:,:,1,jp_sal) * tmask(:,:,1) 
    548545      CALL histwrite( nid_T, "sosafldp", it, zw2d          , ndim_hT, ndex_hT )   ! salt flux damping 
    549546#endif 
     
    711708 
    712709      ! Write all fields on T grid 
    713       CALL histwrite( id_i, "votemper", kt, tn      , jpi*jpj*jpk, idex )    ! now temperature 
    714       CALL histwrite( id_i, "vosaline", kt, sn      , jpi*jpj*jpk, idex )    ! now salinity 
    715       CALL histwrite( id_i, "sossheig", kt, sshn     , jpi*jpj    , idex )    ! sea surface height 
    716       CALL histwrite( id_i, "vozocrtx", kt, un       , jpi*jpj*jpk, idex )    ! now i-velocity 
    717       CALL histwrite( id_i, "vomecrty", kt, vn       , jpi*jpj*jpk, idex )    ! now j-velocity 
    718       CALL histwrite( id_i, "vovecrtz", kt, wn       , jpi*jpj*jpk, idex )    ! now k-velocity 
    719       CALL histwrite( id_i, "sowaflup", kt, (emp-rnf), jpi*jpj    , idex )    ! freshwater budget 
    720       CALL histwrite( id_i, "sohefldo", kt, qsr + qns, jpi*jpj    , idex )    ! total heat flux 
    721       CALL histwrite( id_i, "soshfldo", kt, qsr      , jpi*jpj    , idex )    ! solar heat flux 
    722       CALL histwrite( id_i, "soicecov", kt, fr_i     , jpi*jpj    , idex )    ! ice fraction 
    723       CALL histwrite( id_i, "sozotaux", kt, utau     , jpi*jpj    , idex )    ! i-wind stress 
    724       CALL histwrite( id_i, "sometauy", kt, vtau     , jpi*jpj    , idex )    ! j-wind stress 
     710      CALL histwrite( id_i, "votemper", kt, tsn(:,:,:,jp_tem), jpi*jpj*jpk, idex )    ! now temperature 
     711      CALL histwrite( id_i, "vosaline", kt, tsn(:,:,:,jp_sal), jpi*jpj*jpk, idex )    ! now salinity 
     712      CALL histwrite( id_i, "sossheig", kt, sshn             , jpi*jpj    , idex )    ! sea surface height 
     713      CALL histwrite( id_i, "vozocrtx", kt, un               , jpi*jpj*jpk, idex )    ! now i-velocity 
     714      CALL histwrite( id_i, "vomecrty", kt, vn               , jpi*jpj*jpk, idex )    ! now j-velocity 
     715      CALL histwrite( id_i, "vovecrtz", kt, wn               , jpi*jpj*jpk, idex )    ! now k-velocity 
     716      CALL histwrite( id_i, "sowaflup", kt, (emp-rnf )       , jpi*jpj    , idex )    ! freshwater budget 
     717      CALL histwrite( id_i, "sohefldo", kt, qsr + qns        , jpi*jpj    , idex )    ! total heat flux 
     718      CALL histwrite( id_i, "soshfldo", kt, qsr              , jpi*jpj    , idex )    ! solar heat flux 
     719      CALL histwrite( id_i, "soicecov", kt, fr_i             , jpi*jpj    , idex )    ! ice fraction 
     720      CALL histwrite( id_i, "sozotaux", kt, utau             , jpi*jpj    , idex )    ! i-wind stress 
     721      CALL histwrite( id_i, "sometauy", kt, vtau             , jpi*jpj    , idex )    ! j-wind stress 
    725722 
    726723      ! 3. Close the file 
Note: See TracChangeset for help on using the changeset viewer.