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/eosbn2_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/eosbn2_tam.F90

    r1885 r2587  
    130130   PUBLIC eos_adj_tst 
    131131   PUBLIC bn2_adj_tst 
     132#if defined key_tst_tlm 
    132133   PUBLIC eos_tlm_tst 
    133134   PUBLIC bn2_tlm_tst 
     135#endif 
    134136#endif 
    135137    
     
    30573059 
    30583060   END SUBROUTINE bn2_adj_tst 
    3059  
     3061#if defined key_tst_tlm 
    30603062   SUBROUTINE eos_insitu_tlm_tst( kumadt ) 
    30613063      !!----------------------------------------------------------------------- 
     
    30913093      USE tamtrj              ! writing out state trajectory 
    30923094      USE par_tlm,    ONLY: & 
     3095        & tlm_bch,          & 
    30933096        & cur_loop,         & 
    30943097        & h_ratio 
     
    31343137         & jk 
    31353138      CHARACTER(LEN=14)   :: cl_name 
    3136       CHARACTER (LEN=128) :: file_out_sc, file_wop, file_out 
     3139      CHARACTER (LEN=128) :: file_out_sc, file_wop, file_out, file_xdx 
    31373140      CHARACTER (LEN=90)  :: FMT 
    31383141      REAL(KIND=wp), DIMENSION(100):: & 
     
    31603163      zs_tlin(  :,:,:)   = 0.0_wp 
    31613164      zrd_out(  :,:,:)   = 0.0_wp  
    3162       zrd_tl (  :,:,:)   = 0.0_wp 
    31633165      zrd_wop(  :,:,:)   = 0.0_wp 
    31643166      zscerrrd(:)        = 0.0_wp 
    31653167      zscrd(:)           = 0.0_wp 
    3166  
     3168      IF ( tlm_bch == 2 ) zrd_tl (  :,:,:)   = 0.0_wp     
    31673169      !-------------------------------------------------------------------- 
    31683170      ! Output filename Xn=F(X0) 
    31693171      !-------------------------------------------------------------------- 
    3170       file_wop='trj_wop_eos_insitu' 
    31713172      CALL tlm_namrd 
    31723173      gamma = h_ratio 
     3174      file_wop='trj_wop_eos_insitu' 
     3175      file_xdx='trj_xdx_eos_insitu' 
    31733176      !-------------------------------------------------------------------- 
    31743177      ! Initialize the tangent input with random noise: dx 
     
    31963199      ! Complete Init for Direct 
    31973200      !------------------------------------------------------------------- 
    3198       CALL istate_p   
     3201      IF ( tlm_bch /= 2 )  CALL istate_p   
    31993202 
    32003203      ! *** initialize the reference trajectory 
     
    32133216      !  Compute the direct model F(X0,t=n) = Xn 
    32143217      !--------------------------------------------------------------------       
    3215       CALL eos(tn, sn, zrd_out) 
     3218      IF ( tlm_bch /= 2 )  CALL eos(tn, sn, zrd_out) 
    32163219      rhd(:,:,:)= zrd_out(:,:,:) 
    3217       IF ( cur_loop .EQ. 0) CALL trj_wri_spl(file_wop) 
     3220      IF ( tlm_bch == 0 ) CALL trj_wri_spl(file_wop) 
     3221      IF ( tlm_bch == 1 ) CALL trj_wri_spl(file_xdx) 
    32183222      !-------------------------------------------------------------------- 
    32193223      !  Compute the Tangent  
    32203224      !-------------------------------------------------------------------- 
    3221       IF ( cur_loop .NE. 0) THEN 
    3222          !-------------------------------------------------------------------- 
    3223          !  Storing data 
    3224          !-------------------------------------------------------------------- 
     3225      IF ( tlm_bch == 2 ) THEN 
    32253226         !-------------------------------------------------------------------- 
    32263227         ! Initialize the tangent variables: dy^* = W dy   
     
    32413242         CALL trj_rd_spl(file_wop)  
    32423243         zrd_wop  (:,:,:) = rhd  (:,:,:) 
    3243  
     3244         CALL trj_rd_spl(file_xdx)  
     3245         zrd_out  (:,:,:) = rhd  (:,:,:) 
    32443246         !-------------------------------------------------------------------- 
    32453247         ! Compute the Linearization Error  
     
    33673369      USE tamtrj              ! writing out state trajectory 
    33683370      USE par_tlm,    ONLY: & 
     3371        & tlm_bch,          & 
    33693372        & cur_loop,         & 
    33703373        & h_ratio 
     
    34163419         & jk 
    34173420      CHARACTER(LEN=14)   :: cl_name 
    3418       CHARACTER (LEN=128) :: file_out, file_wop 
     3421      CHARACTER (LEN=128) :: file_out, file_wop,file_xdx 
    34193422      CHARACTER (LEN=90)  :: FMT 
    34203423      REAL(KIND=wp), DIMENSION(100):: & 
     
    34473450      zrd_out(  :,:,:)   = 0.0_wp 
    34483451      zrh_out(  :,:,:)   = 0.0_wp  
    3449       zrd_tl (  :,:,:)   = 0.0_wp 
    3450       zrh_tl (  :,:,:)   = 0.0_wp 
    34513452      zrd_wop(  :,:,:)   = 0.0_wp 
    34523453      zrh_wop(  :,:,:)   = 0.0_wp 
     
    34553456      zscrd(:)           = 0.0_wp 
    34563457      zscrh(:)           = 0.0_wp 
    3457  
     3458      IF ( tlm_bch == 2 )  THEN 
     3459         zrd_tl (  :,:,:)   = 0.0_wp 
     3460         zrh_tl (  :,:,:)   = 0.0_wp 
     3461      ENDIF 
    34583462      !-------------------------------------------------------------------- 
    34593463      ! Output filename Xn=F(X0) 
    34603464      !-------------------------------------------------------------------- 
    3461       file_wop='trj_wop_eos_pot' 
    34623465      CALL tlm_namrd 
    34633466      gamma = h_ratio  
     3467      file_wop='trj_wop_eos_pot' 
     3468      file_xdx='trj_xdx_eos_pot' 
    34643469      !-------------------------------------------------------------------- 
    34653470      ! Initialize the tangent input with random noise: dx 
     
    34863491      ! Complete Init for Direct 
    34873492      !------------------------------------------------------------------- 
    3488       CALL istate_p   
     3493      IF ( tlm_bch /= 2 )  CALL istate_p   
    34893494 
    34903495      ! *** initialize the reference trajectory 
     
    35033508      !  Compute the direct model F(X0,t=n) = Xn 
    35043509      !--------------------------------------------------------------------       
    3505       CALL eos(tn, sn, zrd_out, zrh_out) 
     3510      IF ( tlm_bch /= 2 )      CALL eos(tn, sn, zrd_out, zrh_out) 
    35063511      rhd (:,:,:) = zrd_out(:,:,:) 
    35073512      rhop(:,:,:) = zrh_out(:,:,:) 
    3508       IF ( cur_loop .EQ. 0) CALL trj_wri_spl(file_wop) 
     3513      IF ( tlm_bch == 0 ) CALL trj_wri_spl(file_wop) 
     3514      IF ( tlm_bch == 1 ) CALL trj_wri_spl(file_xdx) 
    35093515      !-------------------------------------------------------------------- 
    35103516      !  Compute the Tangent  
    35113517      !-------------------------------------------------------------------- 
    3512       IF ( cur_loop .NE. 0) THEN 
    3513          !-------------------------------------------------------------------- 
    3514          !  Storing data 
    3515          !-------------------------------------------------------------------- 
     3518      IF ( tlm_bch == 2 ) THEN 
    35163519         !-------------------------------------------------------------------- 
    35173520         ! Initialize the tangent variables: dy^* = W dy   
     
    35363539         zrd_wop  (:,:,:) = rhd  (:,:,:) 
    35373540         zrh_wop  (:,:,:) = rhop (:,:,:) 
    3538  
     3541         CALL trj_rd_spl(file_xdx)  
     3542         zrd_out  (:,:,:) = rhd  (:,:,:) 
     3543         zrh_out  (:,:,:) = rhop (:,:,:) 
    35393544         !-------------------------------------------------------------------- 
    35403545         ! Compute the Linearization Error  
     
    36953700      USE tamtrj              ! writing out state trajectory 
    36963701      USE par_tlm,    ONLY: & 
     3702        & tlm_bch,          & 
    36973703        & cur_loop,         & 
    36983704        & h_ratio 
     
    37413747         & jj 
    37423748      CHARACTER(LEN=14)   :: cl_name 
    3743       CHARACTER (LEN=128) :: file_out, file_wop 
     3749      CHARACTER (LEN=128) :: file_out, file_wop, file_xdx 
    37443750      CHARACTER (LEN=90)  :: FMT 
    37453751      REAL(KIND=wp), DIMENSION(100):: & 
     
    37713777      zs_tlin(  :,:)   = 0.0_wp 
    37723778      zrd_out(  :,:)   = 0.0_wp  
    3773       zrd_tl (  :,:)   = 0.0_wp 
    37743779      zrd_wop(  :,:)   = 0.0_wp 
    37753780      zscerrrd( :)     = 0.0_wp 
    37763781      zscrd(:)         = 0.0_wp 
    3777  
     3782      IF ( tlm_bch == 2 )      zrd_tl (  :,:)   = 0.0_wp 
    37783783      !-------------------------------------------------------------------- 
    37793784      ! Output filename Xn=F(X0) 
    37803785      !-------------------------------------------------------------------- 
    3781       file_wop='trj_wop_eos_2d' 
    3782  
    37833786      CALL tlm_namrd 
    37843787      gamma = h_ratio 
     3788      file_wop='trj_wop_eos_2d' 
     3789      file_xdx='trj_xdx_eos_2d' 
    37853790      !-------------------------------------------------------------------- 
    37863791      ! Initialize the tangent input with random noise: dx 
     
    38043809      ! Complete Init for Direct 
    38053810      !------------------------------------------------------------------- 
    3806       CALL istate_p   
     3811      IF ( tlm_bch /= 2 ) CALL istate_p   
    38073812      ! *** initialize the reference trajectory 
    38083813      ! ------------ 
     
    38243829      !  Compute the direct model F(X0,t=n) = Xn 
    38253830      !--------------------------------------------------------------------     
    3826       CALL eos(ztem, zsal, zdep, zrd_out) 
     3831      IF ( tlm_bch /= 2 ) CALL eos(ztem, zsal, zdep, zrd_out) 
    38273832      rhd (:,:,2) = zrd_out(:,:) 
    3828       IF ( cur_loop .EQ. 0) CALL trj_wri_spl(file_wop) 
     3833      IF ( tlm_bch == 0 ) CALL trj_wri_spl(file_wop) 
     3834      IF ( tlm_bch == 1 ) CALL trj_wri_spl(file_xdx) 
    38293835      !-------------------------------------------------------------------- 
    38303836      !  Compute the Tangent  
    38313837      !-------------------------------------------------------------------- 
    3832       IF ( cur_loop .NE. 0) THEN 
    3833          !-------------------------------------------------------------------- 
    3834          !  Storing data 
    3835          !-------------------------------------------------------------------- 
     3838      IF ( tlm_bch == 2 ) THEN 
    38363839         !-------------------------------------------------------------------- 
    38373840         ! Initialize the tangent variables: dy^* = W dy   
     
    38543857         CALL trj_rd_spl(file_wop)  
    38553858         zrd_wop  (:,:) = rhd  (:,:,2) 
     3859         CALL trj_rd_spl(file_xdx)  
     3860         zrd_out  (:,:) = rhd  (:,:,2) 
    38563861         !-------------------------------------------------------------------- 
    38573862         ! Compute the Linearization Error  
     
    39763981      USE tamtrj              ! writing out state trajectory 
    39773982      USE par_tlm,    ONLY: & 
     3983        & tlm_bch,          & 
    39783984        & cur_loop,         & 
    39793985        & h_ratio 
     
    40234029         & z3r                 
    40244030      CHARACTER(LEN=14)   :: cl_name 
    4025       CHARACTER (LEN=128) :: file_out, file_wop 
     4031      CHARACTER (LEN=128) :: file_out, file_wop, file_xdx 
    40264032      CHARACTER (LEN=90)  :: FMT 
    40274033      REAL(KIND=wp), DIMENSION(100):: & 
     
    40514057      ! Output filename Xn=F(X0) 
    40524058      !-------------------------------------------------------------------- 
    4053       file_wop='trj_wop_bn2' 
    4054  
    40554059      CALL tlm_namrd 
    40564060      gamma = h_ratio     
     4061      file_wop='trj_wop_bn2' 
     4062      file_xdx='trj_xdx_bn2'   
    40574063      !-------------------------------------------------------------------- 
    40584064      ! Initialize the tangent input with random noise: dx 
     
    40794085      ! Complete Init for Direct 
    40804086      !------------------------------------------------------------------- 
    4081       CALL istate_p   
     4087      IF ( tlm_bch /= 2 ) CALL istate_p   
    40824088 
    40834089      ! *** initialize the reference trajectory 
     
    40984104      !  Compute the direct model F(X0,t=n) = Xn 
    40994105      !-------------------------------------------------------------------- 
    4100       CALL bn2(tn, sn, rn2) 
    4101       IF ( cur_loop .EQ. 0) CALL trj_wri_spl(file_wop) 
     4106      IF ( tlm_bch /= 2 ) CALL bn2(tn, sn, rn2) 
     4107      IF ( tlm_bch == 0 ) CALL trj_wri_spl(file_wop) 
     4108      IF ( tlm_bch == 1 ) CALL trj_wri_spl(file_xdx) 
    41024109      !-------------------------------------------------------------------- 
    41034110      !  Compute the Tangent  
    41044111      !-------------------------------------------------------------------- 
    4105       IF ( cur_loop .NE. 0) THEN 
    4106          !-------------------------------------------------------------------- 
    4107          !  Storing data 
    4108          !-------------------------------------------------------------------- 
    4109          zrn2_out  (:,:,:) = rn2   (:,:,:)          
    4110  
     4112      IF ( tlm_bch == 2 ) THEN 
    41114113         !-------------------------------------------------------------------- 
    41124114         ! Initialize the tangent variables: dy^* = W dy   
     
    41314133         CALL trj_rd_spl(file_wop)  
    41324134         zrn2_wop  (:,:,:) = rn2  (:,:,:) 
    4133  
     4135         CALL trj_rd_spl(file_xdx)  
     4136         zrn2_out  (:,:,:) = rn2  (:,:,:) 
    41344137         !-------------------------------------------------------------------- 
    41354138         ! Compute the Linearization Error  
     
    42444247   END SUBROUTINE eos_tlm_tst 
    42454248#endif 
     4249#endif 
    42464250   !!====================================================================== 
    42474251END MODULE eosbn2_tam 
Note: See TracChangeset for help on using the changeset viewer.