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 4292 for branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90 – NEMO

Ignore:
Timestamp:
2013-11-20T17:28:04+01:00 (10 years ago)
Author:
cetlod
Message:

dev_MERGE_2013 : 1st step of the merge, see ticket #1185

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90

    r4161 r4292  
    2525   USE oce             ! ocean dynamics and tracers  
    2626   USE dom_oce         ! ocean space and time domain 
     27   USE dynadv, ONLY: ln_dynadv_vec 
    2728   USE zdf_oce         ! ocean vertical physics 
    2829   USE ldftra_oce      ! ocean active tracers: lateral physics 
     
    4445   USE diadimg         ! dimg direct access file format output 
    4546   USE diaar5, ONLY :   lk_diaar5 
     47   USE dynadv, ONLY :   ln_dynadv_vec 
    4648   USE iom 
    4749   USE ioipsl 
     
    144146      ENDIF 
    145147 
    146       CALL iom_put( "toce"   , tsn(:,:,:,jp_tem)                     )    ! temperature 
    147       CALL iom_put( "soce"   , tsn(:,:,:,jp_sal)                     )    ! salinity 
    148       CALL iom_put( "sst"    , tsn(:,:,1,jp_tem)                     )    ! sea surface temperature 
    149       CALL iom_put( "sst2"   , tsn(:,:,1,jp_tem) * tsn(:,:,1,jp_tem) )    ! square of sea surface temperature 
    150       CALL iom_put( "sss"    , tsn(:,:,1,jp_sal)                     )    ! sea surface salinity 
    151       CALL iom_put( "sss2"   , tsn(:,:,1,jp_sal) * tsn(:,:,1,jp_sal) )    ! square of sea surface salinity 
    152       CALL iom_put( "uoce"   , un                                    )    ! i-current       
    153       CALL iom_put( "suoce"  , un(:,:,1)                             )    ! surface i-current       
    154       CALL iom_put( "voce"   , vn                                    )    ! j-current 
    155       CALL iom_put( "svoce"  , vn(:,:,1)                             )    ! surface j-current 
    156   
    157       CALL iom_put( "avt"    , avt                                   )    ! T vert. eddy diff. coef. 
    158       CALL iom_put( "avm"    , avmu                                  )    ! T vert. eddy visc. coef. 
     148      IF( lk_vvl ) THEN 
     149         z3d(:,:,:) = tsn(:,:,:,jp_tem) * fse3t_n(:,:,:) 
     150         CALL iom_put( "toce" , z3d                        )   ! heat content 
     151         CALL iom_put( "sst"  , z3d(:,:,1)                 )   ! sea surface heat content 
     152         z3d(:,:,1) = tsn(:,:,1,jp_tem) * z3d(:,:,1) 
     153         CALL iom_put( "sst2" , z3d(:,:,1)                 )   ! sea surface content of squared temperature 
     154         z3d(:,:,:) = tsn(:,:,:,jp_sal) * fse3t_n(:,:,:)             
     155         CALL iom_put( "soce" , z3d                        )   ! salinity content 
     156         CALL iom_put( "sss"  , z3d(:,:,1)                 )   ! sea surface salinity content 
     157         z3d(:,:,1) = tsn(:,:,1,jp_sal) * z3d(:,:,1) 
     158         CALL iom_put( "sss2" , z3d(:,:,1)                 )   ! sea surface content of squared salinity 
     159      ELSE 
     160         CALL iom_put( "toce" , tsn(:,:,:,jp_tem)          )   ! temperature 
     161         CALL iom_put( "sst"  , tsn(:,:,1,jp_tem)          )   ! sea surface temperature 
     162         CALL iom_put( "sst2" , tsn(:,:,1,jp_tem) * tsn(:,:,1,jp_tem) ) ! square of sea surface temperature 
     163         CALL iom_put( "soce" , tsn(:,:,:,jp_sal)          )   ! salinity 
     164         CALL iom_put( "sss"  , tsn(:,:,1,jp_sal)          )   ! sea surface salinity 
     165         CALL iom_put( "sss2" , tsn(:,:,1,jp_sal) * tsn(:,:,1,jp_sal) ) ! square of sea surface salinity 
     166      END IF 
     167      IF( lk_vvl .AND. (.NOT. ln_dynadv_vec) ) THEN 
     168         CALL iom_put( "uoce" , un(:,:,:) * fse3u_n(:,:,:) )    ! i-transport 
     169         CALL iom_put( "voce" , vn(:,:,:) * fse3v_n(:,:,:) )    ! j-transport 
     170      ELSE 
     171         CALL iom_put( "uoce" , un                         )    ! i-current 
     172         CALL iom_put( "voce" , vn                         )    ! j-current 
     173      END IF 
     174      CALL iom_put(    "avt"  , avt                        )    ! T vert. eddy diff. coef. 
     175      CALL iom_put(    "avm"  , avmu                       )    ! T vert. eddy visc. coef. 
    159176      IF( lk_zdfddm ) THEN 
    160177         CALL iom_put( "avs" , fsavs(:,:,:)                          )    ! S vert. eddy diff. coef. 
     
    252269      ! 
    253270      CALL wrk_alloc( jpi , jpj      , zw2d ) 
    254       IF ( ln_traldf_gdia )  call wrk_alloc( jpi , jpj , jpk  , zw3d ) 
     271      IF ( ln_traldf_gdia .OR. lk_vvl )  call wrk_alloc( jpi , jpj , jpk  , zw3d ) 
    255272      ! 
    256273      ! Output the initial state and forcings 
     
    325342            &          nit000-1, zjulian, zdt, nh_T, nid_T, domain_id=nidom, snc4chunks=snc4set ) 
    326343         CALL histvert( nid_T, "deptht", "Vertical T levels",      &  ! Vertical grid: gdept 
    327             &           "m", ipk, gdept_0, nz_T, "down" ) 
     344            &           "m", ipk, gdept_1d, nz_T, "down" ) 
    328345         !                                                            ! Index of ocean points 
    329346         CALL wheneq( jpi*jpj*ipk, tmask, 1, 1., ndex_T , ndim_T  )      ! volume 
     
    361378            &          nit000-1, zjulian, zdt, nh_U, nid_U, domain_id=nidom, snc4chunks=snc4set ) 
    362379         CALL histvert( nid_U, "depthu", "Vertical U levels",      &  ! Vertical grid: gdept 
    363             &           "m", ipk, gdept_0, nz_U, "down" ) 
     380            &           "m", ipk, gdept_1d, nz_U, "down" ) 
    364381         !                                                            ! Index of ocean points 
    365382         CALL wheneq( jpi*jpj*ipk, umask, 1, 1., ndex_U , ndim_U  )      ! volume 
     
    374391            &          nit000-1, zjulian, zdt, nh_V, nid_V, domain_id=nidom, snc4chunks=snc4set ) 
    375392         CALL histvert( nid_V, "depthv", "Vertical V levels",      &  ! Vertical grid : gdept 
    376             &          "m", ipk, gdept_0, nz_V, "down" ) 
     393            &          "m", ipk, gdept_1d, nz_V, "down" ) 
    377394         !                                                            ! Index of ocean points 
    378395         CALL wheneq( jpi*jpj*ipk, vmask, 1, 1., ndex_V , ndim_V  )      ! volume 
     
    387404            &          nit000-1, zjulian, zdt, nh_W, nid_W, domain_id=nidom, snc4chunks=snc4set ) 
    388405         CALL histvert( nid_W, "depthw", "Vertical W levels",      &  ! Vertical grid: gdepw 
    389             &          "m", ipk, gdepw_0, nz_W, "down" ) 
     406            &          "m", ipk, gdepw_1d, nz_W, "down" ) 
    390407 
    391408 
     
    397414         CALL histdef( nid_T, "vosaline", "Salinity"                           , "PSU"    ,   &  ! sn 
    398415            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout ) 
     416         IF(  lk_vvl  ) THEN 
     417            CALL histdef( nid_T, "vovvle3t", "Level thickness"                    , "m"      ,&  ! e3t_n 
     418            &             jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout ) 
     419            CALL histdef( nid_T, "vovvldep", "T point depth"                      , "m"      ,&  ! e3t_n 
     420            &             jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout ) 
     421            CALL histdef( nid_T, "vovvldef", "Squared level deformation"          , "%^2"    ,&  ! e3t_n 
     422            &             jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout ) 
     423         ENDIF 
    399424         !                                                                                      !!! nid_T : 2D 
    400425         CALL histdef( nid_T, "sosstsst", "Sea Surface temperature"            , "C"      ,   &  ! sst 
     
    408433         CALL histdef( nid_T, "sosfldow", "downward salt flux"                 , "PSU/m2/s",  &  ! sfx 
    409434            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
    410 #if ! defined key_vvl 
    411          CALL histdef( nid_T, "sosst_cd", "Concentration/Dilution term on temperature"        &  ! emp * tsn(:,:,1,jp_tem) 
     435         IF(  .NOT. lk_vvl  ) THEN 
     436            CALL histdef( nid_T, "sosst_cd", "Concentration/Dilution term on temperature"     &  ! emp * tsn(:,:,1,jp_tem) 
    412437            &                                                                  , "KgC/m2/s",  &  ! sosst_cd 
    413             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
    414          CALL histdef( nid_T, "sosss_cd", "Concentration/Dilution term on salinity"           &  ! emp * tsn(:,:,1,jp_sal) 
     438            &             jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
     439            CALL histdef( nid_T, "sosss_cd", "Concentration/Dilution term on salinity"        &  ! emp * tsn(:,:,1,jp_sal) 
    415440            &                                                                  , "KgPSU/m2/s",&  ! sosss_cd 
    416             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
    417 #endif 
     441            &             jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
     442         ENDIF 
    418443         CALL histdef( nid_T, "sohefldo", "Net Downward Heat Flux"             , "W/m2"   ,   &  ! qns + qsr 
    419444            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
     
    587612      ! --------------------- 
    588613 
    589       ! ndex(1) est utilise ssi l'avant dernier argument est diffferent de  
     614      ! ndex(1) est utilise ssi l'avant dernier argument est different de  
    590615      ! la taille du tableau en sortie. Dans ce cas , l'avant dernier argument 
    591616      ! donne le nombre d'elements, et ndex la liste des indices a sortir 
     
    597622 
    598623      ! Write fields on T grid 
    599       CALL histwrite( nid_T, "votemper", it, tsn(:,:,:,jp_tem), ndim_T , ndex_T  )   ! temperature 
    600       CALL histwrite( nid_T, "vosaline", it, tsn(:,:,:,jp_sal), ndim_T , ndex_T  )   ! salinity 
    601       CALL histwrite( nid_T, "sosstsst", it, tsn(:,:,1,jp_tem), ndim_hT, ndex_hT )   ! sea surface temperature 
    602       CALL histwrite( nid_T, "sosaline", it, tsn(:,:,1,jp_sal), ndim_hT, ndex_hT )   ! sea surface salinity 
     624      IF( lk_vvl ) THEN 
     625         CALL histwrite( nid_T, "votemper", it, tsn(:,:,:,jp_tem) * fse3t_n(:,:,:) , ndim_T , ndex_T  )   ! heat content 
     626         CALL histwrite( nid_T, "vosaline", it, tsn(:,:,:,jp_sal) * fse3t_n(:,:,:) , ndim_T , ndex_T  )   ! salt content 
     627         CALL histwrite( nid_T, "sosstsst", it, tsn(:,:,1,jp_tem) * fse3t_n(:,:,1) , ndim_hT, ndex_hT )   ! sea surface heat content 
     628         CALL histwrite( nid_T, "sosaline", it, tsn(:,:,1,jp_sal) * fse3t_n(:,:,1) , ndim_hT, ndex_hT )   ! sea surface salinity content 
     629      ELSE 
     630         CALL histwrite( nid_T, "votemper", it, tsn(:,:,:,jp_tem) , ndim_T , ndex_T  )   ! temperature 
     631         CALL histwrite( nid_T, "vosaline", it, tsn(:,:,:,jp_sal) , ndim_T , ndex_T  )   ! salinity 
     632         CALL histwrite( nid_T, "sosstsst", it, tsn(:,:,1,jp_tem) , ndim_hT, ndex_hT )   ! sea surface temperature 
     633         CALL histwrite( nid_T, "sosaline", it, tsn(:,:,1,jp_sal) , ndim_hT, ndex_hT )   ! sea surface salinity 
     634 
     635      ENDIF 
     636      IF( lk_vvl ) THEN 
     637         zw3d(:,:,:) = ( ( fse3t_n(:,:,:) - e3t_0(:,:,:) ) / e3t_0(:,:,:) * 100 * tmask(:,:,:) ) ** 2 
     638         CALL histwrite( nid_T, "vovvle3t", it, fse3t_n (:,:,:) , ndim_T , ndex_T  )   ! level thickness 
     639         CALL histwrite( nid_T, "vovvldep", it, fsdept_n(:,:,:) , ndim_T , ndex_T  )   ! t-point depth 
     640         CALL histwrite( nid_T, "vovvldef", it, zw3d             , ndim_T , ndex_T  )   ! level thickness deformation 
     641      ENDIF 
    603642      CALL histwrite( nid_T, "sossheig", it, sshn          , ndim_hT, ndex_hT )   ! sea surface height 
    604643      CALL histwrite( nid_T, "sowaflup", it, ( emp-rnf )   , ndim_hT, ndex_hT )   ! upward water flux 
     
    606645                                                                                  ! (includes virtual salt flux beneath ice  
    607646                                                                                  ! in linear free surface case) 
    608 #if ! defined key_vvl 
    609       zw2d(:,:) = emp (:,:) * tsn(:,:,1,jp_tem) 
    610       CALL histwrite( nid_T, "sosst_cd", it, zw2d, ndim_hT, ndex_hT )             ! c/d term on sst 
    611       zw2d(:,:) = emp (:,:) * tsn(:,:,1,jp_sal) 
    612       CALL histwrite( nid_T, "sosss_cd", it, zw2d, ndim_hT, ndex_hT )             ! c/d term on sss 
    613 #endif 
     647      IF( .NOT. lk_vvl ) THEN 
     648         zw2d(:,:) = emp (:,:) * tsn(:,:,1,jp_tem) 
     649         CALL histwrite( nid_T, "sosst_cd", it, zw2d, ndim_hT, ndex_hT )          ! c/d term on sst 
     650         zw2d(:,:) = emp (:,:) * tsn(:,:,1,jp_sal) 
     651         CALL histwrite( nid_T, "sosss_cd", it, zw2d, ndim_hT, ndex_hT )          ! c/d term on sss 
     652      ENDIF 
    614653      CALL histwrite( nid_T, "sohefldo", it, qns + qsr     , ndim_hT, ndex_hT )   ! total heat flux 
    615654      CALL histwrite( nid_T, "soshfldo", it, qsr           , ndim_hT, ndex_hT )   ! solar heat flux 
     
    752791      ! 
    753792      CALL wrk_dealloc( jpi , jpj      , zw2d ) 
    754       IF ( ln_traldf_gdia )  call wrk_dealloc( jpi , jpj , jpk  , zw3d ) 
     793      IF ( ln_traldf_gdia .OR. lk_vvl )  call wrk_dealloc( jpi , jpj , jpk  , zw3d ) 
    755794      ! 
    756795      IF( nn_timing == 1 )   CALL timing_stop('dia_wri') 
     
    813852          1, jpi, 1, jpj, nit000-1, zjulian, zdt, nh_i, id_i, domain_id=nidom, snc4chunks=snc4set ) ! Horizontal grid : glamt and gphit 
    814853      CALL histvert( id_i, "deptht", "Vertical T levels",   &    ! Vertical grid : gdept 
    815           "m", jpk, gdept_0, nz_i, "down") 
     854          "m", jpk, gdept_1d, nz_i, "down") 
    816855 
    817856      ! Declare all the output fields as NetCDF variables 
     
    841880      CALL histdef( id_i, "sometauy", "Meridional Wind Stress", "N/m2"   ,   &   ! j-wind stress 
    842881         &          jpi, jpj, nh_i, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) 
     882      IF( lk_vvl ) THEN 
     883         CALL histdef( id_i, "vovvldep", "T point depth"         , "m"      ,   &   ! t-point depth 
     884            &          jpi, jpj, nh_i, jpk, 1, jpk, nz_i, 32, clop, zsto, zout ) 
     885      END IF 
    843886 
    844887#if defined key_lim2 
Note: See TracChangeset for help on using the changeset viewer.