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 5836 for trunk/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90 – NEMO

Ignore:
Timestamp:
2015-10-26T15:49:40+01:00 (8 years ago)
Author:
cetlod
Message:

merge the simplification branch onto the trunk, see ticket #1612

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90

    r5566 r5836  
    1717   !!                 ! 2005-11  (V. Garnier) Surface pressure gradient organization 
    1818   !!            3.2  ! 2008-11  (B. Lemaire) creation from old diawri 
     19   !!            3.7  ! 2014-01  (G. Madec) remove eddy induced velocity from no-IOM output 
     20   !!                 !                     change name of output variables in dia_wri_state 
    1921   !!---------------------------------------------------------------------- 
    2022 
     
    2729   USE dynadv, ONLY: ln_dynadv_vec 
    2830   USE zdf_oce         ! ocean vertical physics 
    29    USE ldftra_oce      ! ocean active tracers: lateral physics 
    30    USE ldfdyn_oce      ! ocean dynamics: lateral physics 
    31    USE traldf_iso_grif, ONLY : psix_eiv, psiy_eiv 
     31   USE ldftra          ! lateral physics: eddy diffusivity coef. 
    3232   USE sol_oce         ! solver variables 
    3333   USE sbc_oce         ! Surface boundary condition: ocean fields 
     
    232232      IF( iom_use('w_masstr') .OR. iom_use('w_masstr2') ) THEN   ! vertical mass transport & its square value 
    233233         ! Caution: in the VVL case, it only correponds to the baroclinic mass transport. 
    234          z2d(:,:) = rau0 * e12t(:,:) 
     234         z2d(:,:) = rau0 * e1e2t(:,:) 
    235235         DO jk = 1, jpk 
    236236            z3d(:,:,jk) = wn(:,:,jk) * z2d(:,:) 
     
    247247         DO jj = 2, jpjm1                                    ! sst gradient 
    248248            DO ji = fs_2, fs_jpim1   ! vector opt. 
    249                zztmp      = tsn(ji,jj,1,jp_tem) 
    250                zztmpx     = ( tsn(ji+1,jj  ,1,jp_tem) - zztmp ) / e1u(ji,jj) + ( zztmp - tsn(ji-1,jj  ,1,jp_tem) ) / e1u(ji-1,jj  ) 
    251                zztmpy     = ( tsn(ji  ,jj+1,1,jp_tem) - zztmp ) / e2v(ji,jj) + ( zztmp - tsn(ji  ,jj-1,1,jp_tem) ) / e2v(ji  ,jj-1) 
     249               zztmp  = tsn(ji,jj,1,jp_tem) 
     250               zztmpx = ( tsn(ji+1,jj,1,jp_tem) - zztmp ) * r1_e1u(ji,jj) + ( zztmp - tsn(ji-1,jj  ,1,jp_tem) ) * r1_e1u(ji-1,jj) 
     251               zztmpy = ( tsn(ji,jj+1,1,jp_tem) - zztmp ) * r1_e2v(ji,jj) + ( zztmp - tsn(ji  ,jj-1,1,jp_tem) ) * r1_e2v(ji,jj-1) 
    252252               z2d(ji,jj) = 0.25 * ( zztmpx * zztmpx + zztmpy * zztmpy )   & 
    253253                  &              * umask(ji,jj,1) * umask(ji-1,jj,1) * vmask(ji,jj,1) * umask(ji,jj-1,1) 
     
    401401      !!      Each nwrite time step, output the instantaneous or mean fields 
    402402      !!---------------------------------------------------------------------- 
    403       !! 
    404       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index 
    405       !! 
     403      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
     404      ! 
    406405      LOGICAL ::   ll_print = .FALSE.                        ! =T print and flush numout 
    407406      CHARACTER (len=40) ::   clhstnam, clop, clmx           ! local names 
     
    412411      INTEGER  ::   jn, ierror                               ! local integers 
    413412      REAL(wp) ::   zsto, zout, zmax, zjulian, zdt           ! local scalars 
    414       !! 
     413      ! 
    415414      REAL(wp), POINTER, DIMENSION(:,:)   :: zw2d       ! 2D workspace 
    416415      REAL(wp), POINTER, DIMENSION(:,:,:) :: zw3d       ! 3D workspace 
     
    419418      IF( nn_timing == 1 )   CALL timing_start('dia_wri') 
    420419      ! 
    421       CALL wrk_alloc( jpi , jpj      , zw2d ) 
    422       IF ( ln_traldf_gdia .OR. lk_vvl )  call wrk_alloc( jpi , jpj , jpk  , zw3d ) 
     420                     CALL wrk_alloc( jpi,jpj      , zw2d ) 
     421      IF( lk_vvl )   CALL wrk_alloc( jpi,jpj,jpk  , zw3d ) 
    423422      ! 
    424423      ! Output the initial state and forcings 
     
    657656          
    658657         clmx ="l_max(only(x))"    ! max index on a period 
    659          CALL histdef( nid_T, "sobowlin", "Bowl Index"                         , "W-point",   &  ! bowl INDEX  
    660             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clmx, zsto, zout ) 
     658!         CALL histdef( nid_T, "sobowlin", "Bowl Index"                         , "W-point",   &  ! bowl INDEX  
     659!            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clmx, zsto, zout ) 
    661660#if defined key_diahth 
    662661         CALL histdef( nid_T, "sothedep", "Thermocline Depth"                  , "m"      ,   & ! hth 
     
    682681         CALL histdef( nid_U, "vozocrtx", "Zonal Current"                      , "m/s"    ,   &  ! un 
    683682            &          jpi, jpj, nh_U, ipk, 1, ipk, nz_U, 32, clop, zsto, zout ) 
    684          IF( ln_traldf_gdia ) THEN 
    685             CALL histdef( nid_U, "vozoeivu", "Zonal EIV Current"                  , "m/s"    ,   &  ! u_eiv 
    686                  &          jpi, jpj, nh_U, ipk, 1, ipk, nz_U, 32, clop, zsto, zout ) 
    687          ELSE 
    688 #if defined key_diaeiv 
    689             CALL histdef( nid_U, "vozoeivu", "Zonal EIV Current"                  , "m/s"    ,   &  ! u_eiv 
    690             &          jpi, jpj, nh_U, ipk, 1, ipk, nz_U, 32, clop, zsto, zout ) 
    691 #endif 
    692          END IF 
    693683         !                                                                                      !!! nid_U : 2D 
    694684         CALL histdef( nid_U, "sozotaux", "Wind Stress along i-axis"           , "N/m2"   ,   &  ! utau 
     
    700690         CALL histdef( nid_V, "vomecrty", "Meridional Current"                 , "m/s"    ,   &  ! vn 
    701691            &          jpi, jpj, nh_V, ipk, 1, ipk, nz_V, 32, clop, zsto, zout ) 
    702          IF( ln_traldf_gdia ) THEN 
    703             CALL histdef( nid_V, "vomeeivv", "Meridional EIV Current"             , "m/s"    ,   &  ! v_eiv 
    704                  &          jpi, jpj, nh_V, ipk, 1, ipk, nz_V, 32, clop, zsto, zout ) 
    705          ELSE  
    706 #if defined key_diaeiv 
    707             CALL histdef( nid_V, "vomeeivv", "Meridional EIV Current"             , "m/s"    ,   &  ! v_eiv 
    708             &          jpi, jpj, nh_V, ipk, 1, ipk, nz_V, 32, clop, zsto, zout ) 
    709 #endif 
    710          END IF 
    711692         !                                                                                      !!! nid_V : 2D 
    712693         CALL histdef( nid_V, "sometauy", "Wind Stress along j-axis"           , "N/m2"   ,   &  ! vtau 
     
    718699         CALL histdef( nid_W, "vovecrtz", "Vertical Velocity"                  , "m/s"    ,   &  ! wn 
    719700            &          jpi, jpj, nh_W, ipk, 1, ipk, nz_W, 32, clop, zsto, zout ) 
    720          IF( ln_traldf_gdia ) THEN 
    721             CALL histdef( nid_W, "voveeivw", "Vertical EIV Velocity"              , "m/s"    ,   &  ! w_eiv 
    722                  &          jpi, jpj, nh_W, ipk, 1, ipk, nz_W, 32, clop, zsto, zout ) 
    723          ELSE 
    724 #if defined key_diaeiv 
    725             CALL histdef( nid_W, "voveeivw", "Vertical EIV Velocity"              , "m/s"    ,   &  ! w_eiv 
    726                  &          jpi, jpj, nh_W, ipk, 1, ipk, nz_W, 32, clop, zsto, zout ) 
    727 #endif 
    728          END IF 
    729701         CALL histdef( nid_W, "votkeavt", "Vertical Eddy Diffusivity"          , "m2/s"   ,   &  ! avt 
    730702            &          jpi, jpj, nh_W, ipk, 1, ipk, nz_W, 32, clop, zsto, zout ) 
     
    737709         ENDIF 
    738710         !                                                                                      !!! nid_W : 2D 
    739 #if defined key_traldf_c2d 
    740          CALL histdef( nid_W, "soleahtw", "lateral eddy diffusivity"           , "m2/s"   ,   &  ! ahtw 
    741             &          jpi, jpj, nh_W, 1  , 1, 1  , - 99, 32, clop, zsto, zout ) 
    742 # if defined key_traldf_eiv  
    743             CALL histdef( nid_W, "soleaeiw", "eddy induced vel. coeff. at w-point", "m2/s",   &  ! aeiw 
    744                &       jpi, jpj, nh_W, 1  , 1, 1  , - 99, 32, clop, zsto, zout ) 
    745 # endif 
    746 #endif 
    747  
    748711         CALL histend( nid_W, snc4chunks=snc4set ) 
    749712 
     
    853816 
    854817      CALL histwrite( nid_U, "vozocrtx", it, un            , ndim_U , ndex_U )    ! i-current 
    855       IF( ln_traldf_gdia ) THEN 
    856          IF (.not. ALLOCATED(psix_eiv))THEN 
    857             ALLOCATE( psix_eiv(jpi,jpj,jpk) , psiy_eiv(jpi,jpj,jpk) , STAT=ierr ) 
    858             IF( lk_mpp   )   CALL mpp_sum ( ierr ) 
    859             IF( ierr > 0 )   CALL ctl_stop('STOP', 'diawri: unable to allocate psi{x,y}_eiv') 
    860             psix_eiv(:,:,:) = 0.0_wp 
    861             psiy_eiv(:,:,:) = 0.0_wp 
    862          ENDIF 
    863          DO jk=1,jpkm1 
    864             zw3d(:,:,jk) = (psix_eiv(:,:,jk+1) - psix_eiv(:,:,jk))/fse3u(:,:,jk)  ! u_eiv = -dpsix/dz 
    865          END DO 
    866          zw3d(:,:,jpk) = 0._wp 
    867          CALL histwrite( nid_U, "vozoeivu", it, zw3d, ndim_U , ndex_U )           ! i-eiv current 
    868       ELSE 
    869 #if defined key_diaeiv 
    870          CALL histwrite( nid_U, "vozoeivu", it, u_eiv, ndim_U , ndex_U )          ! i-eiv current 
    871 #endif 
    872       ENDIF 
    873818      CALL histwrite( nid_U, "sozotaux", it, utau          , ndim_hU, ndex_hU )   ! i-wind stress 
    874819 
    875820      CALL histwrite( nid_V, "vomecrty", it, vn            , ndim_V , ndex_V  )   ! j-current 
    876       IF( ln_traldf_gdia ) THEN 
    877          DO jk=1,jpk-1 
    878             zw3d(:,:,jk) = (psiy_eiv(:,:,jk+1) - psiy_eiv(:,:,jk))/fse3v(:,:,jk)  ! v_eiv = -dpsiy/dz 
    879          END DO 
    880          zw3d(:,:,jpk) = 0._wp 
    881          CALL histwrite( nid_V, "vomeeivv", it, zw3d, ndim_V , ndex_V )           ! j-eiv current 
    882       ELSE 
    883 #if defined key_diaeiv 
    884          CALL histwrite( nid_V, "vomeeivv", it, v_eiv, ndim_V , ndex_V )          ! j-eiv current 
    885 #endif 
    886       ENDIF 
    887821      CALL histwrite( nid_V, "sometauy", it, vtau          , ndim_hV, ndex_hV )   ! j-wind stress 
    888822 
    889823      CALL histwrite( nid_W, "vovecrtz", it, wn             , ndim_T, ndex_T )    ! vert. current 
    890       IF( ln_traldf_gdia ) THEN 
    891          DO jk=1,jpk-1 
    892             DO jj = 2, jpjm1 
    893                DO ji = fs_2, fs_jpim1  ! vector opt. 
    894                   zw3d(ji,jj,jk) = (psiy_eiv(ji,jj,jk) - psiy_eiv(ji,jj-1,jk))/e2v(ji,jj) + & 
    895                        &    (psix_eiv(ji,jj,jk) - psix_eiv(ji-1,jj,jk))/e1u(ji,jj) ! w_eiv = dpsiy/dy + dpsiy/dx 
    896                END DO 
    897             END DO 
    898          END DO 
    899          zw3d(:,:,jpk) = 0._wp 
    900          CALL histwrite( nid_W, "voveeivw", it, zw3d          , ndim_T, ndex_T )    ! vert. eiv current 
    901       ELSE 
    902 #   if defined key_diaeiv 
    903          CALL histwrite( nid_W, "voveeivw", it, w_eiv          , ndim_T, ndex_T )    ! vert. eiv current 
    904 #   endif 
    905       ENDIF 
    906824      CALL histwrite( nid_W, "votkeavt", it, avt            , ndim_T, ndex_T )    ! T vert. eddy diff. coef. 
    907825      CALL histwrite( nid_W, "votkeavm", it, avmu           , ndim_T, ndex_T )    ! T vert. eddy visc. coef. 
     
    909827         CALL histwrite( nid_W, "voddmavs", it, fsavs(:,:,:), ndim_T, ndex_T )    ! S vert. eddy diff. coef. 
    910828      ENDIF 
    911 #if defined key_traldf_c2d 
    912       CALL histwrite( nid_W, "soleahtw", it, ahtw          , ndim_hT, ndex_hT )   ! lateral eddy diff. coef. 
    913 # if defined key_traldf_eiv 
    914          CALL histwrite( nid_W, "soleaeiw", it, aeiw       , ndim_hT, ndex_hT )   ! EIV coefficient at w-point 
    915 # endif 
    916 #endif 
    917829 
    918830      ! 3. Close all files 
     
    925837      ENDIF 
    926838      ! 
    927       CALL wrk_dealloc( jpi , jpj      , zw2d ) 
    928       IF ( ln_traldf_gdia .OR. lk_vvl )  call wrk_dealloc( jpi , jpj , jpk  , zw3d ) 
     839                     CALL wrk_dealloc( jpi , jpj        , zw2d ) 
     840      IF( lk_vvl )   CALL wrk_dealloc( jpi , jpj , jpk  , zw3d ) 
    929841      ! 
    930842      IF( nn_timing == 1 )   CALL timing_stop('dia_wri') 
     
    958870      !!---------------------------------------------------------------------- 
    959871      !  
    960 !     IF( nn_timing == 1 )   CALL timing_start('dia_wri_state') ! not sure this works for routines not called in first timestep 
    961  
    962872      ! 0. Initialisation 
    963873      ! ----------------- 
     
    1018928         CALL histdef( id_i, "vovvldep", "T point depth"         , "m"      ,   &   ! t-point depth 
    1019929            &          jpi, jpj, nh_i, jpk, 1, jpk, nz_i, 32, clop, zsto, zout ) 
    1020       END IF 
     930      ENDIF 
    1021931 
    1022932#if defined key_lim2 
     
    1042952      CALL histwrite( id_i, "vomecrty", kt, vn               , jpi*jpj*jpk, idex )    ! now j-velocity 
    1043953      CALL histwrite( id_i, "vovecrtz", kt, wn               , jpi*jpj*jpk, idex )    ! now k-velocity 
    1044       CALL histwrite( id_i, "sowaflup", kt, (emp-rnf )       , jpi*jpj    , idex )    ! freshwater budget 
     954      CALL histwrite( id_i, "sowaflup", kt, emp-rnf          , jpi*jpj    , idex )    ! freshwater budget 
    1045955      CALL histwrite( id_i, "sohefldo", kt, qsr + qns        , jpi*jpj    , idex )    ! total heat flux 
    1046956      CALL histwrite( id_i, "soshfldo", kt, qsr              , jpi*jpj    , idex )    ! solar heat flux 
     
    1060970      ENDIF 
    1061971#endif 
    1062         
    1063 !     IF( nn_timing == 1 )   CALL timing_stop('dia_wri_state') ! not sure this works for routines not called in first timestep 
    1064972      !  
    1065  
    1066973   END SUBROUTINE dia_wri_state 
    1067974   !!====================================================================== 
Note: See TracChangeset for help on using the changeset viewer.