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 2587 for branches/TAM_V3_0/NEMOTAM/OPATAM_SRC/step_tam.F90 – NEMO

Ignore:
Timestamp:
2011-02-15T12:58:59+01:00 (13 years ago)
Author:
vidard
Message:

refer to ticket #798

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/TAM_V3_0/NEMOTAM/OPATAM_SRC/step_tam.F90

    r1885 r2587  
    4343      & tb, sb, tn, sn, ta,  & 
    4444      & un, vn, sshn, sshb,  & 
    45       & sa, ub, vb,          & 
     45      & sa, ub, vb, rn2,     & 
    4646      & ln_dynhpg_imp 
    4747   USE zdfkpp        , ONLY: & 
     
    7676      &  ln_traqsr 
    7777          ! solar radiation penetration flag 
     78   USE asminc 
     79   USE asmbkg 
    7880   USE oce_tam       , ONLY: & ! Tangent linear and adjoint variables 
    7981      & oce_tam_init,        & 
     
    134136   USE wzvmod_tam      ! vertical velocity                (adjoint of wzv     routine) 
    135137 
    136    USE zdfkpp_tam     ! KPP vertical mixing 
    137  
     138!!   USE zdfkpp_tam     ! KPP vertical mixing 
     139   USE zdf_oce, ONLY : lk_zdfcst, avt, avt0, avmu, avmv, avm0, ln_zdfevd         ! KPP vertical mixing 
     140   USE zdfddm, ONLY  : &            ! double diffusion mixing          (zdf_ddm routine) 
     141      & lk_zdfddm,     & 
     142      & zdf_ddm   
     143   USE zdfevd, only:zdf_evd         ! double diffusion mixing          (zdf_ddm routine) 
     144   USE zdfbfr, only:zdf_bfr         ! double diffusion mixing          (zdf_ddm routine) 
     145   USE zdfmxl, only:zdf_mxl         ! double diffusion mixing          (zdf_ddm routine) 
     146   USE eosbn2, ONLY: bn2 
    138147   USE zpshde_tam      ! partial step: hor. derivative     (adjoint of zps_hde routine) 
    139148 
     
    186195   PUBLIC stp_tan,      & 
    187196      &   stp_adj,      & ! called by simvar.F90 
     197#if defined key_tst_tlm 
    188198      &   stp_tlm_tst,  & 
     199#endif 
    189200      &   stp_adj_tst 
    190201 
     
    257268      ! Output the initial state and forcings ... not needed in tangent 
    258269 
    259       ! saving direct variables ua,va, ta, sa before entering in tracer 
    260       zta_tmp (:,:,:) = ta (:,:,:) 
    261       zsa_tmp (:,:,:) = sa (:,:,:) 
    262270      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    263271      ! Ocean physics update 
     
    315323 
    316324#endif 
    317  
    318       ta (:,:,:) = zta_tmp (:,:,:) 
    319       sa (:,:,:) = zsa_tmp (:,:,:) 
    320325      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    321326      ! Active tracers 
     
    11841189 
    11851190   END SUBROUTINE stp_adj_tst 
    1186  
     1191#if defined key_tst_tlm 
    11871192   SUBROUTINE stp_tlm_tst( kumadt ) 
    11881193      !!----------------------------------------------------------------------- 
     
    12281233        & lk_c1d 
    12291234      USE par_tlm,    ONLY: & 
     1235        & tlm_bch,          & 
    12301236        & cur_loop,         & 
    12311237        & h_ratio 
     
    12621268         & zgsp1, zgsp2, zgsp3, zgsp4, zgsp5,     & 
    12631269         & zgsp6, zgsp7      
     1270      REAL(KIND=wp) ::       &   
     1271         & zgsp1_U, zgsp1_V, zgsp1_T, zgsp1_S, zgsp1_SSH,     & 
     1272         & zgsp4_U, zgsp4_V, zgsp4_T, zgsp4_S, zgsp4_SSH,      & 
     1273         & zgsp5_U, zgsp5_V, zgsp5_T, zgsp5_S, zgsp5_SSH      
    12641274      REAL(KIND=wp), DIMENSION(:,:,:), ALLOCATABLE :: & 
    12651275         & ta_tmp   ,        & 
     
    12881298  
    12891299      CHARACTER(LEN=14)   :: cl_name 
    1290       CHARACTER (LEN=128) :: file_out, file_wop, file_wop2 
     1300      CHARACTER (LEN=128) :: file_out, file_wop, file_wop2, file_xdx 
    12911301      CHARACTER (LEN=90)  :: FMT 
    12921302 
     
    13881398      ! Output filename Xn=F(X0) 
    13891399      !-------------------------------------------------------------------- 
    1390       file_wop='trj_wop_step' 
    13911400      CALL tlm_namrd 
    13921401      gamma = h_ratio 
     1402      file_wop='trj_wop_step' 
     1403      file_xdx='trj_xdx_step' 
    13931404      !-------------------------------------------------------------------- 
    13941405      ! Initialize the tangent input with random noise: dx 
     
    14501461          ENDIF 
    14511462     ENDIF  
    1452      CALL istate_p  
     1463     IF ( tlm_bch /= 2 )  CALL istate_p  
    14531464 
    14541465         !-------------------------------------------------------------------- 
     
    14561467         !-------------------------------------------------------------------- 
    14571468 
    1458      PRINT*,'IN TST_STP h_ratio, cur_loop, gamma', h_ratio, ' ',cur_loop,' ', gamma 
    1459      Call flush(numout) 
    1460   
    14611469      ! check that all process are still there... If some process have an error, 
    14621470      ! they will never enter in step and other processes will wait until the end of the cpu time! 
     
    14641472 
    14651473        istp = nit000 
     1474        IF ( tlm_bch /= 2 )  THEN 
    14661475        IF( lk_c1d ) THEN                 ! 1D configuration (no AGRIF zoom) 
    1467         ! 
    14681476           DO WHILE ( istp <= nitend .AND. nstop == 0 ) 
    14691477              CALL stp_c1d( istp ) 
    14701478              istp = istp + 1 
    14711479           END DO 
    1472         ELSE 
    1473            istp = nit000 - 1                 
    1474            IF( ln_trjwri ) CALL tam_trj_wri( istp )    ! Output trajectory fields 
     1480        ENDIF 
    14751481        ENDIF 
    14761482 
     
    14971503        !  Compute the direct model F(X0,t=n) = Xn 
    14981504        !-------------------------------------------------------------------- 
     1505        IF ( tlm_bch /= 2 )  THEN 
    14991506        DO istp = nit000, nitend, 1 
    15001507           CALL stp( istp ) 
    15011508        END DO 
    1502         IF ( cur_loop .EQ. 0) CALL trj_wri_spl(file_wop) 
    1503  
     1509        ENDIF 
     1510        IF ( tlm_bch == 0 ) CALL trj_wri_spl(file_wop) 
     1511        IF ( tlm_bch == 1 ) CALL trj_wri_spl(file_xdx) 
    15041512        !-------------------------------------------------------------------- 
    15051513        !  Compute the Tangent  
    15061514        !-------------------------------------------------------------------- 
    1507         IF ( cur_loop .NE. 0) THEN 
    1508  
    1509            !-------------------------------------------------------------------- 
    1510            !  Storing data 
    1511            !-------------------------------------------------------------------- 
    1512            zun_out   (:,:,:) = un   (:,:,:) 
    1513            zvn_out   (:,:,:) = vn   (:,:,:) 
    1514            ztn_out   (:,:,:) = tn   (:,:,:) 
    1515            zsn_out   (:,:,:) = sn   (:,:,:) 
    1516            zsshn_out (:,:  ) = sshn (:,:  )          
     1515        IF ( tlm_bch == 2 ) THEN         
    15171516 
    15181517           !-------------------------------------------------------------------- 
     
    15201519           !-------------------------------------------------------------------- 
    15211520           qrp_tl = 0.0_wp 
    1522  
     1521#if defined key_tradmp 
     1522           strdmp_tl = 0.0_wp 
     1523           ttrdmp_tl = 0.0_wp 
     1524#endif 
    15231525           a_fwb_tl = 0.0_wp 
    15241526 
     
    15351537           !  Initialization of the dynamics and tracer fields for the tangent 
    15361538           !----------------------------------------------------------------------- 
     1539 
    15371540           CALL istate_init_tan  
     1541  
    15381542           DO istp = nit000, nitend, 1 
    15391543              CALL stp_tan( istp ) 
     1544              !CALL stp_tan_cpd( istp ) 
    15401545           END DO 
    15411546        
     
    15561561           !-------------------------------------------------------------------- 
    15571562           CALL trj_rd_spl(file_wop) 
    1558  
    15591563           zun_wop   (:,:,:) = un   (:,:,:) 
    15601564           zvn_wop   (:,:,:) = vn   (:,:,:) 
     
    15621566           zsn_wop   (:,:,:) = sn   (:,:,:) 
    15631567           zsshn_wop (:,:  ) = sshn (:,:  )   
     1568           CALL trj_rd_spl(file_xdx)  
     1569           zun_out   (:,:,:) = un   (:,:,:) 
     1570           zvn_out   (:,:,:) = vn   (:,:,:) 
     1571           ztn_out   (:,:,:) = tn   (:,:,:) 
     1572           zsn_out   (:,:,:) = sn   (:,:,:) 
     1573           zsshn_out (:,:  ) = sshn (:,:  ) 
    15641574           !-------------------------------------------------------------------- 
    15651575           ! Compute the Linearization Error  
     
    17111721         zzsp_SSH = SQRT(zsp3_SSH) 
    17121722         zgsp5    = zzsp 
     1723         zgsp5_U=zzsp_U 
     1724         zgsp5_V=zzsp_V 
     1725         zgsp5_T=zzsp_T 
     1726         zgsp5_S=zzsp_S 
     1727         zgsp5_SSH=zzsp_SSH 
    17131728         CALL prntst_tlm( cl_name, kumadt, zzsp, h_ratio ) 
    17141729 
     
    17291744         zzsp_SSH =  SQRT(zsp2_SSH) 
    17301745         zgsp4    = zzsp 
     1746         zgsp4_U=zzsp_U 
     1747         zgsp4_V=zzsp_V 
     1748         zgsp4_T=zzsp_T 
     1749         zgsp4_S=zzsp_S 
     1750         zgsp4_SSH=zzsp_SSH 
    17311751         cl_name = 'step_tam:Ln2  ' 
    17321752         CALL prntst_tlm( cl_name, kumadt, zzsp, h_ratio ) 
     
    17611781         zgsp7    = zgsp3/gamma 
    17621782         zgsp1    = zzsp 
     1783         zgsp1_U=zzsp_U 
     1784         zgsp1_V=zzsp_V 
     1785         zgsp1_T=zzsp_T 
     1786         zgsp1_S=zzsp_S 
     1787         zgsp1_SSH=zzsp_SSH 
    17631788         zgsp2    = zgsp1 / zgsp4 
    17641789         zgsp6    = (zgsp2 - 1.0_wp)/gamma 
    17651790 
    17661791         FMT = "(A8,2X,I4.4,2X,E6.1,2X,E20.13,2X,E20.13,2X,E20.13,2X,E20.13,2X,E20.13,2X,E20.13,2X,E20.13)" 
    1767          WRITE(numtan,FMT) 'step    ', cur_loop, h_ratio, zgsp1, zgsp2, zgsp3, zgsp4, zgsp5, zgsp6, zgsp7 
    1768  
     1792 
     1793         WRITE(numtan,FMT) 'step    ', cur_loop, h_ratio, zgsp1, zgsp1_T ,zgsp4_T, zgsp5_T,zgsp1_S,zgsp4_S,zgsp5_S!, 
    17691794         !-------------------------------------------------------------------- 
    17701795         ! Unitary calculus 
     
    19211946   !!====================================================================== 
    19221947#endif 
     1948#endif 
    19231949END MODULE step_tam 
Note: See TracChangeset for help on using the changeset viewer.