Changeset 2528 for trunk/NEMOGCM/NEMO/TOP_SRC/TRP/trdmld_trc.F90
- Timestamp:
- 2010-12-27T18:33:53+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NEMOGCM/NEMO/TOP_SRC/TRP/trdmld_trc.F90
- Property svn:keywords set to Id
r1685 r2528 16 16 !! trd_mld_trc_init : initialization step 17 17 !!---------------------------------------------------------------------- 18 USE trp_trc ! tracer definitions (trn, trb, tra, etc.) 19 USE oce_trc ! needed for namelist logicals, and euphotic layer arrays 20 USE trctrp_lec 21 USE trdmld_trc_oce ! definition of main arrays used for trends computations 18 USE trc ! tracer definitions (trn, trb, tra, etc.) 19 USE dom_oce ! domain definition 20 USE zdfmxl , ONLY : nmln !: number of level in the mixed layer 21 USE zdf_oce , ONLY : avt !: vert. diffusivity coef. at w-point for temp 22 # if defined key_zdfddm 23 USE zdfddm , ONLY : avs !: salinity vertical diffusivity coeff. at w-point 24 # endif 25 USE trcnam_trp ! passive tracers transport namelist variables 26 USE trdmod_trc_oce ! definition of main arrays used for trends computations 22 27 USE in_out_manager ! I/O manager 23 28 USE dianam ! build the name of file (routine) … … 29 34 USE sms_pisces 30 35 USE sms_lobster 31 USE trc32 36 33 37 IMPLICIT NONE 34 38 PRIVATE 35 39 36 INTERFACE trd_mod_trc37 MODULE PROCEDURE trd_mod_trc_trp, trd_mod_trc_bio38 END INTERFACE39 40 PUBLIC trd_mod_trc ! routine called by step.F9041 40 PUBLIC trd_mld_trc 42 41 PUBLIC trd_mld_bio 43 42 PUBLIC trd_mld_trc_init 43 PUBLIC trd_mld_trc_zint 44 PUBLIC trd_mld_bio_zint 44 45 45 46 CHARACTER (LEN=40) :: clhstnam ! name of the trends NetCDF file … … 60 61 # include "top_substitute.h90" 61 62 !!---------------------------------------------------------------------- 62 !! TOP 1.0 , LOCEAN-IPSL (2007)63 !! NEMO/TOP 3.3 , NEMO Consortium (2010) 63 64 !! $Header: $ 64 !! Software governed by the CeCILL licence ( modipsl/doc/NEMO_CeCILL.txt)65 !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 65 66 !!---------------------------------------------------------------------- 66 67 67 68 CONTAINS 68 69 SUBROUTINE trd_mod_trc_trp( ptrtrd, kjn, ktrd, kt )70 !!----------------------------------------------------------------------71 !! *** ROUTINE trd_mod_trc ***72 !!----------------------------------------------------------------------73 #if defined key_trcbbl_adv74 REAL(wp), DIMENSION(jpi,jpj,jpk) :: zun, zvn ! temporary arrays75 #else76 USE oce_trc, zun => un ! When no bbl, zun == un77 USE oce_trc, zvn => vn ! When no bbl, zvn == vn78 #endif79 INTEGER, INTENT( in ) :: kt ! time step80 INTEGER, INTENT( in ) :: kjn ! tracer index81 INTEGER, INTENT( in ) :: ktrd ! tracer trend index82 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( inout ) :: ptrtrd ! Temperature or U trend83 !!----------------------------------------------------------------------84 85 IF( kt == nittrc000 ) THEN86 ! IF(lwp)WRITE(numout,*)87 ! IF(lwp)WRITE(numout,*) 'trd_mod_trc:'88 ! IF(lwp)WRITE(numout,*) '~~~~~~~~~~~~'89 ENDIF90 91 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>92 ! Mixed layer trends for passive tracers93 !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<94 95 SELECT CASE ( ktrd )96 CASE ( jptrc_trd_xad ) ; CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_xad , '3D', kjn )97 CASE ( jptrc_trd_yad ) ; CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_yad , '3D', kjn )98 CASE ( jptrc_trd_zad ) ; CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_zad , '3D', kjn )99 CASE ( jptrc_trd_ldf ) ; CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_ldf , '3D', kjn )100 CASE ( jptrc_trd_xei ) ; CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_xei , '3D', kjn )101 CASE ( jptrc_trd_yei ) ; CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_yei , '3D', kjn )102 CASE ( jptrc_trd_bbl ) ; CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_bbl , '3D', kjn )103 CASE ( jptrc_trd_zdf )104 IF( ln_trcldf_iso ) THEN105 CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_ldf, '3D', kjn )106 ELSE107 CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_zdf, '3D', kjn )108 ENDIF109 CASE ( jptrc_trd_zei ) ; CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_zei , '3D', kjn )110 CASE ( jptrc_trd_dmp ) ; CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_dmp , '3D', kjn )111 CASE ( jptrc_trd_sbc ) ; CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_sbc , '2D', kjn )112 CASE ( jptrc_trd_sms ) ; CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_sms , '3D', kjn )113 CASE ( jptrc_trd_bbc ) ; CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_bbc , '3D', kjn )114 CASE ( jptrc_trd_radb ) ; CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_radb , '3D', kjn )115 CASE ( jptrc_trd_radn ) ; CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_radn , '3D', kjn )116 CASE ( jptrc_trd_atf ) ; CALL trd_mld_trc_zint( ptrtrd, jpmld_trc_atf , '3D', kjn )117 END SELECT118 119 120 END SUBROUTINE trd_mod_trc_trp121 122 SUBROUTINE trd_mod_trc_bio( ptrbio, ktrd, kt )123 !!----------------------------------------------------------------------124 !! *** ROUTINE trd_mod_bio ***125 !!----------------------------------------------------------------------126 127 INTEGER, INTENT( in ) :: kt ! time step128 INTEGER, INTENT( in ) :: ktrd ! bio trend index129 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( inout ) :: ptrbio ! Bio trend130 !!----------------------------------------------------------------------131 132 CALL trd_mld_bio_zint( ptrbio, ktrd ) ! Verticaly integrated biological trends133 134 END SUBROUTINE trd_mod_trc_bio135 136 69 137 70 SUBROUTINE trd_mld_trc_zint( ptrc_trdmld, ktrd, ctype, kjn ) … … 170 103 171 104 ! ... Set nmld(ji,jj) = index of first T point below control surf. or outside mixed-layer 172 SELECT CASE ( n ctls_trc ) ! choice of the control surface105 SELECT CASE ( nn_ctls_trc ) ! choice of the control surface 173 106 CASE ( -2 ) ; STOP 'trdmld_trc : not ready ' ! -> isopycnal surface (see ???) 174 107 #if defined key_pisces || defined key_lobster … … 177 110 CASE ( 0 ) ; nmld_trc(:,:) = nmln(:,:) ! -> ML with density criterion (see zdfmxl) 178 111 CASE ( 1 ) ; nmld_trc(:,:) = nbol_trc(:,:) ! -> read index from file 179 CASE ( 2: ) ; n ctls_trc = MIN( nctls_trc, jpktrd_trc - 1 )180 nmld_trc(:,:) = n ctls_trc + 1 ! -> model level112 CASE ( 2: ) ; nn_ctls_trc = MIN( nn_ctls_trc, jpktrd_trc - 1 ) 113 nmld_trc(:,:) = nn_ctls_trc + 1 ! -> model level 181 114 END SELECT 182 115 … … 281 214 tmltrd_bio(:,:,:) = 0.e0 ! <<< reset trend arrays to zero 282 215 ! ... Set nmld(ji,jj) = index of first T point below control surf. or outside mixed-layer 283 SELECT CASE ( n ctls_trc ) ! choice of the control surface216 SELECT CASE ( nn_ctls_trc ) ! choice of the control surface 284 217 CASE ( -2 ) ; STOP 'trdmld_trc : not ready ' ! -> isopycnal surface (see ???) 285 218 CASE ( -1 ) ; nmld_trc(:,:) = neln(:,:) ! -> euphotic layer with light criterion 286 219 CASE ( 0 ) ; nmld_trc(:,:) = nmln(:,:) ! -> ML with density criterion (see zdfmxl) 287 220 CASE ( 1 ) ; nmld_trc(:,:) = nbol_trc(:,:) ! -> read index from file 288 CASE ( 2: ) ; n ctls_trc = MIN( nctls_trc, jpktrd_trc - 1 )289 nmld_trc(:,:) = n ctls_trc + 1 ! -> model level221 CASE ( 2: ) ; nn_ctls_trc = MIN( nn_ctls_trc, jpktrd_trc - 1 ) 222 nmld_trc(:,:) = nn_ctls_trc + 1 ! -> model level 290 223 END SELECT 291 224 … … 380 313 !! of time-averaged mixed-layer fields, this residual WILL NOT BE ZERO 381 314 !! over the first two analysis windows (except if restart). 382 !! N.B. For ORCA2_LIM, use e.g. ntrc_trc=5, ucf_trc=1., nctls_trc=8315 !! N.B. For ORCA2_LIM, use e.g. ntrc_trc=5, rn_ucf_trc=1., nctls_trc=8 383 316 !! for checking residuals. 384 317 !! On a NEC-SX5 computer, this typically leads to: … … 421 354 REAL(wp), DIMENSION(jpi,jpj,jpltrd_trc,jptra) :: ztmltrd2 ! -+ 422 355 !! 423 REAL(wp), DIMENSION(jpi,jpj) :: z2d ! temporary array, used for eiv arrays424 356 CHARACTER (LEN= 5) :: clvar 425 357 #if defined key_dimgout … … 429 361 !!---------------------------------------------------------------------- 430 362 431 IF( llwarn ) THEN ! warnings 432 IF( ( nittrc000 /= nit000 ) & 433 .OR.( ndttrc /= 1 ) ) THEN 434 435 WRITE(numout,*) 'Be careful, trends diags never validated' 436 STOP 'Uncomment this line to proceed' 437 ENDIF 438 ENDIF 363 IF( nn_dttrc /= 1 ) CALL ctl_stop( " Be careful, trends diags never validated " ) 439 364 440 365 ! ====================================================================== … … 450 375 DO ji = 1,jpi 451 376 ik = nmld_trc(ji,jj) 452 zavt = avt(ji,jj,ik)377 zavt = fsavs(ji,jj,ik) 453 378 DO jn = 1, jptra 454 IF( l uttrd(jn) ) &379 IF( ln_trdtrc(jn) ) & 455 380 tmltrd_trc(ji,jj,jpmld_trc_zdf,jn) = - zavt / fse3w(ji,jj,ik) * tmask(ji,jj,ik) & 456 381 & * ( trn(ji,jj,ik-1,jn) - trn(ji,jj,ik,jn) ) & … … 462 387 DO jn = 1, jptra 463 388 ! ... Remove this K_z trend from the iso-neutral diffusion term (if any) 464 IF( l uttrd(jn) ) &389 IF( ln_trdtrc(jn) ) & 465 390 tmltrd_trc(:,:,jpmld_trc_ldf,jn) = tmltrd_trc(:,:,jpmld_trc_ldf,jn) - tmltrd_trc(:,:,jpmld_trc_zdf,jn) 466 391 … … 473 398 ! therefore we do not call lbc_lnk in GYRE config. (closed basin, no cyclic B.C.) 474 399 DO jn = 1, jptra 475 IF( l uttrd(jn) ) THEN400 IF( ln_trdtrc(jn) ) THEN 476 401 DO jl = 1, jpltrd_trc 477 402 CALL lbc_lnk( tmltrd_trc(:,:,jl,jn), 'T', 1. ) ! lateral boundary conditions … … 490 415 ! II.1 Set before values of vertically averages passive tracers 491 416 ! ------------------------------------------------------------- 492 IF( kt > nit trc000 ) THEN417 IF( kt > nit000 ) THEN 493 418 DO jn = 1, jptra 494 IF( l uttrd(jn) ) THEN419 IF( ln_trdtrc(jn) ) THEN 495 420 tmlb_trc (:,:,jn) = tml_trc (:,:,jn) 496 421 tmlatfn_trc(:,:,jn) = tmltrd_trc(:,:,jpmld_trc_atf,jn) … … 505 430 DO jk = 1, jpktrd_trc ! - 1 ??? 506 431 DO jn = 1, jptra 507 IF( l uttrd(jn) ) &432 IF( ln_trdtrc(jn) ) & 508 433 tml_trc(:,:,jn) = tml_trc(:,:,jn) + wkx_trc(:,:,jk) * trn(:,:,jk,jn) 509 434 END DO … … 515 440 ! 516 441 DO jn = 1, jptra 517 IF( l uttrd(jn) ) THEN442 IF( ln_trdtrc(jn) ) THEN 518 443 tmlbb_trc (:,:,jn) = tmlb_trc (:,:,jn) ; tmlbn_trc (:,:,jn) = tml_trc (:,:,jn) 519 444 tmlatfb_trc(:,:,jn) = tmlatfn_trc(:,:,jn) ; tmlradb_trc(:,:,jn) = tmlradn_trc(:,:,jn) … … 544 469 ! ... Cumulate over BOTH physical contributions AND over time steps 545 470 DO jn = 1, jptra 546 IF( l uttrd(jn) ) THEN471 IF( ln_trdtrc(jn) ) THEN 547 472 DO jl = 1, jpltrd_trc 548 473 tmltrdm_trc(:,:,jn) = tmltrdm_trc(:,:,jn) + tmltrd_trc(:,:,jl,jn) … … 552 477 553 478 DO jn = 1, jptra 554 IF( l uttrd(jn) ) THEN479 IF( ln_trdtrc(jn) ) THEN 555 480 ! ... Special handling of the Asselin trend 556 481 tmlatfm_trc(:,:,jn) = tmlatfm_trc(:,:,jn) + tmlatfn_trc(:,:,jn) … … 573 498 574 499 ! Convert to appropriate physical units 575 tmltrd_trc(:,:,:,:) = tmltrd_trc(:,:,:,:) * ucf_trc576 577 itmod = kt - nit trc000 + 1500 tmltrd_trc(:,:,:,:) = tmltrd_trc(:,:,:,:) * rn_ucf_trc 501 502 itmod = kt - nit000 + 1 578 503 it = kt 579 504 580 MODULO_NTRD : IF( MOD( itmod, n trd_trc ) == 0 ) THEN ! nitend MUST be multiple of ntrd_trc505 MODULO_NTRD : IF( MOD( itmod, nn_trd_trc ) == 0 ) THEN ! nitend MUST be multiple of nn_trd_trc 581 506 ! 582 507 ztmltot (:,:,:) = 0.e0 ! reset arrays to zero … … 591 516 592 517 DO jn = 1, jptra 593 IF( l uttrd(jn) ) THEN518 IF( ln_trdtrc(jn) ) THEN 594 519 !-- Compute total trends (use rdttrc instead of rdt ???) 595 IF ( ln_trcadv_ smolar .OR. ln_trcadv_muscl .OR. ln_trcadv_muscl2 ) THEN ! EULER-FORWARD schemes520 IF ( ln_trcadv_muscl .OR. ln_trcadv_muscl2 ) THEN ! EULER-FORWARD schemes 596 521 ztmltot(:,:,jn) = ( tml_trc(:,:,jn) - tmlbn_trc(:,:,jn) )/rdt 597 522 ELSE ! LEAP-FROG schemes … … 629 554 !-- Compute passive tracer total trends 630 555 DO jn = 1, jptra 631 IF( l uttrd(jn) ) THEN556 IF( ln_trdtrc(jn) ) THEN 632 557 tml_sum_trc(:,:,jn) = tmlbn_trc(:,:,jn) + 2 * ( tml_sum_trc(:,:,jn) - tml_trc(:,:,jn) ) + tml_trc(:,:,jn) 633 558 ztmltot2 (:,:,jn) = ( tml_sum_trc(:,:,jn) - tml_sumb_trc(:,:,jn) ) / ( 2.*rdt ) ! now tracer unit is /sec … … 637 562 !-- Compute passive tracer residuals 638 563 DO jn = 1, jptra 639 IF( l uttrd(jn) ) THEN564 IF( ln_trdtrc(jn) ) THEN 640 565 ! 641 566 DO jl = 1, jpltrd_trc … … 680 605 DO jn = 1, jptra 681 606 682 IF( l uttrd(jn) ) THEN607 IF( ln_trdtrc(jn) ) THEN 683 608 WRITE(numout, *) 684 609 WRITE(numout, *) '>>>>>>>>>>>>>>>>>> TRC TRACER jn =', jn, ' <<<<<<<<<<<<<<<<<<' … … 777 702 rmld_sum_trc(:,:) = rmld_sum_trc(:,:) / (2*zfn) ! similar to tml_sum and sml_sum 778 703 DO jn = 1, jptra 779 IF( l uttrd(jn) ) THEN704 IF( ln_trdtrc(jn) ) THEN 780 705 ! For passive tracer instantaneous diagnostics 781 706 tmlbb_trc (:,:,jn) = tmlb_trc (:,:,jn) ; tmlbn_trc (:,:,jn) = tml_trc (:,:,jn) … … 791 716 ! III.4 Convert to appropriate physical units 792 717 ! ------------------------------------------- 793 ztmltot (:,:,jn) = ztmltot (:,:,jn) * ucf_trc/zfn ! instant diags794 ztmlres (:,:,jn) = ztmlres (:,:,jn) * ucf_trc/zfn795 ztmlatf (:,:,jn) = ztmlatf (:,:,jn) * ucf_trc/zfn796 ztmlrad (:,:,jn) = ztmlrad (:,:,jn) * ucf_trc/zfn718 ztmltot (:,:,jn) = ztmltot (:,:,jn) * rn_ucf_trc/zfn ! instant diags 719 ztmlres (:,:,jn) = ztmlres (:,:,jn) * rn_ucf_trc/zfn 720 ztmlatf (:,:,jn) = ztmlatf (:,:,jn) * rn_ucf_trc/zfn 721 ztmlrad (:,:,jn) = ztmlrad (:,:,jn) * rn_ucf_trc/zfn 797 722 tml_sum_trc (:,:,jn) = tml_sum_trc (:,:,jn) / (2*zfn) ! mean diags 798 ztmltot2 (:,:,jn) = ztmltot2 (:,:,jn) * ucf_trc/zfn2799 ztmltrd2 (:,:,:,jn) = ztmltrd2 (:,:,:,jn) * ucf_trc/zfn2800 ztmlatf2 (:,:,jn) = ztmlatf2 (:,:,jn) * ucf_trc/zfn2801 ztmlrad2 (:,:,jn) = ztmlrad2 (:,:,jn) * ucf_trc/zfn2802 ztmlres2 (:,:,jn) = ztmlres2 (:,:,jn) * ucf_trc/zfn2723 ztmltot2 (:,:,jn) = ztmltot2 (:,:,jn) * rn_ucf_trc/zfn2 724 ztmltrd2 (:,:,:,jn) = ztmltrd2 (:,:,:,jn) * rn_ucf_trc/zfn2 725 ztmlatf2 (:,:,jn) = ztmlatf2 (:,:,jn) * rn_ucf_trc/zfn2 726 ztmlrad2 (:,:,jn) = ztmlrad2 (:,:,jn) * rn_ucf_trc/zfn2 727 ztmlres2 (:,:,jn) = ztmlres2 (:,:,jn) * rn_ucf_trc/zfn2 803 728 ENDIF 804 729 END DO … … 820 745 ! ---------------------------------- 821 746 822 IF( lwp .AND. MOD( itmod , n trd_trc ) == 0 ) THEN747 IF( lwp .AND. MOD( itmod , nn_trd_trc ) == 0 ) THEN 823 748 WRITE(numout,*) ' ' 824 749 WRITE(numout,*) 'trd_mld_trc : write passive tracer trends in the NetCDF file :' … … 834 759 DO jn = 1, jptra 835 760 ! 836 IF( luttrd(jn) ) THEN 837 !-- Specific treatment for EIV trends 838 ! WARNING : When eiv is switched on but key_diaeiv is not, we do NOT diagnose 839 ! u_eiv, v_eiv, and w_eiv : the exact eiv advective trends thus cannot be computed, 840 ! only their sum makes sense => mask directional contrib. to avoid confusion 841 z2d(:,:) = tmltrd_trc(:,:,jpmld_trc_xei,jn) + tmltrd_trc(:,:,jpmld_trc_yei,jn) & 842 & + tmltrd_trc(:,:,jpmld_trc_zei,jn) 843 #if ( defined key_trcldf_eiv && defined key_diaeiv ) 844 tmltrd_trc(:,:,jpmld_trc_xei,jn) = -999. 845 tmltrd_trc(:,:,jpmld_trc_yei,jn) = -999. 846 tmltrd_trc(:,:,jpmld_trc_zei,jn) = -999. 847 #endif 761 IF( ln_trdtrc(jn) ) THEN 848 762 CALL histwrite( nidtrd(jn), "mxl_depth", it, rmld_trc(:,:), ndimtrd1, ndextrd1 ) 849 763 !-- Output the fields … … 864 778 & it, ztmlatf(:,:,jn), ndimtrd1, ndextrd1 ) 865 779 866 CALL histwrite( nidtrd(jn), trim(clvar//ctrd_trc( jpltrd_trc+1,2)), & ! now total EIV : jpltrd_trc + 1867 & it, z2d(:,:), ndimtrd1, ndextrd1 )868 !869 780 ENDIF 870 781 END DO … … 872 783 IF( kt == nitend ) THEN 873 784 DO jn = 1, jptra 874 IF( l uttrd(jn) ) CALL histclo( nidtrd(jn) )785 IF( ln_trdtrc(jn) ) CALL histclo( nidtrd(jn) ) 875 786 END DO 876 787 ENDIF … … 881 792 DO jn = 1, jptra 882 793 ! 883 IF( luttrd(jn) ) THEN 884 !-- Specific treatment for EIV trends 885 ! WARNING : see above 886 z2d(:,:) = ztmltrd2(:,:,jpmld_trc_xei,jn) + ztmltrd2(:,:,jpmld_trc_yei,jn) & 887 & + ztmltrd2(:,:,jpmld_trc_zei,jn) 888 889 #if ( defined key_trcldf_eiv && defined key_diaeiv ) 890 ztmltrd2(:,:,jpmld_trc_xei,jn) = -999. 891 ztmltrd2(:,:,jpmld_trc_yei,jn) = -999. 892 ztmltrd2(:,:,jpmld_trc_zei,jn) = -999. 893 #endif 794 IF( ln_trdtrc(jn) ) THEN 894 795 CALL histwrite( nidtrd(jn), "mxl_depth", it, rmld_sum_trc(:,:), ndimtrd1, ndextrd1 ) 895 796 !-- Output the fields … … 911 812 & it, ztmlatf2(:,:,jn), ndimtrd1, ndextrd1 ) 912 813 913 CALL histwrite( nidtrd(jn), trim(clvar//ctrd_trc( jpltrd_trc+1,2)), & ! now total EIV : jpltrd_trc + 1914 & it, z2d(:,:), ndimtrd1, ndextrd1 )915 916 814 ENDIF 917 815 ! … … 919 817 IF( kt == nitend ) THEN 920 818 DO jn = 1, jptra 921 IF( l uttrd(jn) ) CALL histclo( nidtrd(jn) )819 IF( ln_trdtrc(jn) ) CALL histclo( nidtrd(jn) ) 922 820 END DO 923 821 ENDIF … … 931 829 # endif /* key_dimgout */ 932 830 933 IF( MOD( itmod, n trd_trc ) == 0 ) THEN831 IF( MOD( itmod, nn_trd_trc ) == 0 ) THEN 934 832 ! 935 833 ! Reset cumulative arrays to zero … … 1010 908 !!---------------------------------------------------------------------- 1011 909 ! ... Warnings 1012 IF( llwarn ) THEN 1013 IF( ( nittrc000 /= nit000 ) & 1014 .OR.( ndttrc /= 1 ) ) THEN 1015 1016 WRITE(numout,*) 'Be careful, trends diags never validated' 1017 STOP 'Uncomment this line to proceed' 1018 END IF 1019 END IF 910 IF( nn_dttrc /= 1 ) CALL ctl_stop( " Be careful, trends diags never validated " ) 1020 911 1021 912 ! ====================================================================== … … 1058 949 1059 950 ! Convert to appropriate physical units 1060 tmltrd_bio(:,:,:) = tmltrd_bio(:,:,:) * ucf_trc1061 1062 MODULO_NTRD : IF( MOD( kt, n trd_trc ) == 0 ) THEN ! nitend MUST be multiple of ntrd951 tmltrd_bio(:,:,:) = tmltrd_bio(:,:,:) * rn_ucf_trc 952 953 MODULO_NTRD : IF( MOD( kt, nn_trd_trc ) == 0 ) THEN ! nitend MUST be multiple of ntrd 1063 954 ! 1064 955 zfn = float(nmoymltrdbio) ; zfn2 = zfn * zfn … … 1114 1005 ! III.4 Convert to appropriate physical units 1115 1006 ! ------------------------------------------- 1116 ztmltrdbio2 (:,:,:) = ztmltrdbio2 (:,:,:) * ucf_trc/zfn21007 ztmltrdbio2 (:,:,:) = ztmltrdbio2 (:,:,:) * rn_ucf_trc/zfn2 1117 1008 1118 1009 END IF MODULO_NTRD … … 1133 1024 1134 1025 ! define time axis 1135 itmod = kt - nit trc000 + 11026 itmod = kt - nit000 + 1 1136 1027 it = kt 1137 1028 1138 IF( lwp .AND. MOD( itmod , n trd_trc ) == 0 ) THEN1029 IF( lwp .AND. MOD( itmod , nn_trd_trc ) == 0 ) THEN 1139 1030 WRITE(numout,*) ' ' 1140 1031 WRITE(numout,*) 'trd_mld_bio : write ML bio trends in the NetCDF file :' … … 1176 1067 # endif /* key_dimgout */ 1177 1068 1178 IF( MOD( itmod, n trd_trc ) == 0 ) THEN1069 IF( MOD( itmod, nn_trd_trc ) == 0 ) THEN 1179 1070 ! 1180 1071 ! III.5 Reset cumulative arrays to zero … … 1216 1107 INTEGER :: ilseq, jl, jn 1217 1108 REAL(wp) :: zjulian, zsto, zout 1218 CHARACTER (LEN=40) :: clop , cleiv1109 CHARACTER (LEN=40) :: clop 1219 1110 CHARACTER (LEN=15) :: csuff 1220 1111 CHARACTER (LEN=12) :: clmxl 1221 1112 CHARACTER (LEN=16) :: cltrcu 1222 1113 CHARACTER (LEN= 5) :: clvar 1223 1224 NAMELIST/namtoptrd/ ntrd_trc, nctls_trc, ucf_trc, &1225 ln_trdmld_trc_restart, ln_trdmld_trc_instant, luttrd1226 1114 1227 1115 !!---------------------------------------------------------------------- … … 1241 1129 ! I.1 Check consistency of user defined preferences 1242 1130 ! ------------------------------------------------- 1243 #if defined key_trcldf_eiv 1244 IF( lk_trdmld_trc .AND. ln_trcldf_iso ) THEN 1245 WRITE(numout,cform_war) 1246 WRITE(numout,*) ' You asked for ML diagnostics with iso-neutral diffusion ' 1247 WRITE(numout,*) ' and eiv physics. ' 1248 WRITE(numout,*) ' Yet, key_diaeiv is NOT switched on, so the eddy induced ' 1249 WRITE(numout,*) ' velocity is not diagnosed. ' 1250 WRITE(numout,*) ' Therefore, we cannot deduce the eiv advective trends. ' 1251 WRITE(numout,*) ' Only THE SUM of the i,j,k directional contributions then ' 1252 WRITE(numout,*) ' makes sense => To avoid any confusion, we choosed to mask ' 1253 WRITE(numout,*) ' these i,j,k directional contributions (with -999.) ' 1254 nwarn = nwarn + 1 1255 ENDIF 1256 # endif 1257 1258 IF( ( lk_trdmld_trc ) .AND. ( MOD( nitend, ntrd_trc ) /= 0 ) ) THEN 1131 1132 IF( ( lk_trdmld_trc ) .AND. ( MOD( nitend, nn_trd_trc ) /= 0 ) ) THEN 1259 1133 WRITE(numout,cform_err) 1260 1134 WRITE(numout,*) ' Your nitend parameter, nitend = ', nitend 1261 1135 WRITE(numout,*) ' is no multiple of the trends diagnostics frequency ' 1262 WRITE(numout,*) ' you defined, n trd_trc = ', ntrd_trc1136 WRITE(numout,*) ' you defined, nn_trd_trc = ', nn_trd_trc 1263 1137 WRITE(numout,*) ' This will not allow you to restart from this simulation. ' 1264 1138 WRITE(numout,*) ' You should reconsider this choice. ' … … 1269 1143 ENDIF 1270 1144 1271 IF( ( lk_trdmld_trc ) .AND. ( n_cla == 1 ) ) THEN1272 WRITE(numout,cform_war)1273 WRITE(numout,*) ' You set n_cla = 1. Note that the Mixed-Layer diagnostics '1274 WRITE(numout,*) ' are not exact along the corresponding straits. '1275 nwarn = nwarn + 11276 ENDIF1277 1278 1279 1145 ! * Debugging information * 1280 1146 IF( lldebug ) THEN 1281 1147 WRITE(numout,*) ' ln_trcadv_muscl = ' , ln_trcadv_muscl 1282 WRITE(numout,*) ' ln_trcadv_smolar = ' , ln_trcadv_smolar1283 1148 WRITE(numout,*) ' ln_trdmld_trc_instant = ', ln_trdmld_trc_instant 1284 ENDIF1285 1286 IF( ln_trcadv_smolar .AND. .NOT. ln_trdmld_trc_instant ) THEN1287 WRITE(numout,cform_err)1288 WRITE(numout,*) ' Currently, you can NOT use simultaneously tracer Smolark. '1289 WRITE(numout,*) ' advection and window averaged diagnostics of ML trends. '1290 WRITE(numout,*) ' WHY? Everything in trdmld_trc is coded for leap-frog, and '1291 WRITE(numout,*) ' Smolarkiewicz scheme is Euler forward. '1292 WRITE(numout,*) ' In particuliar, entrainment trend would be FALSE. However '1293 WRITE(numout,*) ' this residual is correct for instantaneous ML diagnostics.'1294 WRITE(numout,*)1295 nstop = nstop + 11296 1149 ENDIF 1297 1150 … … 1364 1217 ! I.3 Read control surface from file ctlsurf_idx 1365 1218 ! ---------------------------------------------- 1366 IF( n ctls_trc == 1 ) THEN1219 IF( nn_ctls_trc == 1 ) THEN 1367 1220 CALL ctl_opn( inum, 'ctlsurf_idx', 'OLD', 'UNFORMATTED', 'SEQUENTIAL', -1, numout, lwp ) 1368 1221 READ ( inum ) nbol_trc … … 1378 1231 #else 1379 1232 ! clmxl = legend root for netCDF output 1380 IF( n ctls_trc == 0 ) THEN ! control surface = mixed-layer with density criterion1233 IF( nn_ctls_trc == 0 ) THEN ! control surface = mixed-layer with density criterion 1381 1234 clmxl = 'Mixed Layer ' 1382 ELSE IF( n ctls_trc == 1 ) THEN ! control surface = read index from file1235 ELSE IF( nn_ctls_trc == 1 ) THEN ! control surface = read index from file 1383 1236 clmxl = ' Bowl ' 1384 ELSE IF( n ctls_trc >= 2 ) THEN ! control surface = model level1385 WRITE(clmxl,'(A10,I2,1X)') 'Levels 1 -', n ctls_trc1237 ELSE IF( nn_ctls_trc >= 2 ) THEN ! control surface = model level 1238 WRITE(clmxl,'(A10,I2,1X)') 'Levels 1 -', nn_ctls_trc 1386 1239 ENDIF 1387 1240 … … 1395 1248 STOP 'trd_mld_trc : this was never checked. Comment this line to proceed...' 1396 1249 ENDIF 1397 zsto = n trd_trc * rdt1250 zsto = nn_trd_trc * rdt 1398 1251 clop = "inst("//TRIM(clop)//")" 1399 1252 # else … … 1401 1254 zsto = rdt ! inst. diags : we use IOIPSL time averaging 1402 1255 ELSE 1403 zsto = n trd_trc * rdt ! mean diags : we DO NOT use any IOIPSL time averaging1256 zsto = nn_trd_trc * rdt ! mean diags : we DO NOT use any IOIPSL time averaging 1404 1257 ENDIF 1405 1258 clop = "ave("//TRIM(clop)//")" 1406 1259 # endif 1407 zout = n trd_trc * rdt1260 zout = nn_trd_trc * rdt 1408 1261 1409 1262 IF(lwp) WRITE (numout,*) ' netCDF initialization' … … 1424 1277 ! ==> choose them according to trdmld_trc_oce.F90 <== 1425 1278 1426 #if defined key_diaeiv1427 cleiv = " (*** only total EIV is meaningful ***)" ! eiv advec. trends require u_eiv, v_eiv1428 #else1429 cleiv = " "1430 #endif1431 1279 ctrd_trc(jpmld_trc_xad ,1) = " Zonal advection" ; ctrd_trc(jpmld_trc_xad ,2) = "_xad" 1432 1280 ctrd_trc(jpmld_trc_yad ,1) = " Meridional advection" ; ctrd_trc(jpmld_trc_yad ,2) = "_yad" … … 1434 1282 ctrd_trc(jpmld_trc_ldf ,1) = " Lateral diffusion" ; ctrd_trc(jpmld_trc_ldf ,2) = "_ldf" 1435 1283 ctrd_trc(jpmld_trc_zdf ,1) = " Vertical diff. (Kz)" ; ctrd_trc(jpmld_trc_zdf ,2) = "_zdf" 1436 ctrd_trc(jpmld_trc_xei ,1) = " Zonal EIV advection"//cleiv ; ctrd_trc(jpmld_trc_xei ,2) = "_xei"1437 ctrd_trc(jpmld_trc_yei ,1) = " Merid. EIV advection"//cleiv ; ctrd_trc(jpmld_trc_yei ,2) = "_yei"1438 ctrd_trc(jpmld_trc_zei ,1) = " Vertical EIV advection"//cleiv ; ctrd_trc(jpmld_trc_zei ,2) = "_zei"1439 ctrd_trc(jpmld_trc_bbc ,1) = " Geothermal flux" ; ctrd_trc(jpmld_trc_bbc ,2) = "_bbc"1440 1284 ctrd_trc(jpmld_trc_bbl ,1) = " Adv/diff. Bottom boundary layer" ; ctrd_trc(jpmld_trc_bbl ,2) = "_bbl" 1441 1285 ctrd_trc(jpmld_trc_dmp ,1) = " Tracer damping" ; ctrd_trc(jpmld_trc_dmp ,2) = "_dmp" … … 1445 1289 ctrd_trc(jpmld_trc_radn ,1) = " Correct negative concentrations" ; ctrd_trc(jpmld_trc_radn ,2) = "_radn" 1446 1290 ctrd_trc(jpmld_trc_atf ,1) = " Asselin time filter" ; ctrd_trc(jpmld_trc_atf ,2) = "_atf" 1447 ctrd_trc(jpltrd_trc+1 ,1) = " Total EIV"//cleiv ; ctrd_trc(jpltrd_trc+1 ,2) = "_tei"1448 1291 1449 1292 DO jn = 1, jptra 1450 1293 !-- Create a NetCDF file and enter the define mode 1451 IF( l uttrd(jn) ) THEN1294 IF( ln_trdtrc(jn) ) THEN 1452 1295 csuff="ML_"//ctrcnm(jn) 1453 CALL dia_nam( clhstnam, n trd_trc, csuff )1296 CALL dia_nam( clhstnam, nn_trd_trc, csuff ) 1454 1297 CALL histbeg( clhstnam, jpi, glamt, jpj, gphit, & 1455 & 1, jpi, 1, jpj, nit trc000-ndttrc, zjulian, rdt, nh_t(jn), nidtrd(jn), domain_id=nidom)1298 & 1, jpi, 1, jpj, nit000, zjulian, rdt, nh_t(jn), nidtrd(jn), domain_id=nidom, snc4chunks=snc4set ) 1456 1299 1457 1300 !-- Define the ML depth variable … … 1464 1307 #if defined key_lobster 1465 1308 !-- Create a NetCDF file and enter the define mode 1466 CALL dia_nam( clhstnam, n trd_trc, 'trdbio' )1309 CALL dia_nam( clhstnam, nn_trd_trc, 'trdbio' ) 1467 1310 CALL histbeg( clhstnam, jpi, glamt, jpj, gphit, & 1468 & 1, jpi, 1, jpj, nit trc000-ndttrc, zjulian, rdt, nh_tb, nidtrdbio, domain_id=nidom)1311 & 1, jpi, 1, jpj, nit000, zjulian, rdt, nh_tb, nidtrdbio, domain_id=nidom, snc4chunks=snc4set ) 1469 1312 #endif 1470 1313 1471 1314 !-- Define physical units 1472 IF( ucf_trc == 1. ) THEN1315 IF( rn_ucf_trc == 1. ) THEN 1473 1316 cltrcu = "(mmole-N/m3)/sec" ! all passive tracers have the same unit 1474 ELSEIF ( ucf_trc == 3600.*24.) THEN ! ??? trop long : seulement (mmole-N/m3)1317 ELSEIF ( rn_ucf_trc == 3600.*24.) THEN ! ??? trop long : seulement (mmole-N/m3) 1475 1318 cltrcu = "(mmole-N/m3)/day" ! ??? apparait dans les sorties netcdf 1476 1319 ELSE … … 1485 1328 DO jn = 1, jptra 1486 1329 ! 1487 IF( l uttrd(jn) ) THEN1330 IF( ln_trdtrc(jn) ) THEN 1488 1331 clvar = trim(ctrcnm(jn))//"ml" ! e.g. detml, zooml, no3ml, etc. 1489 1332 CALL histdef(nidtrd(jn), clvar, clmxl//" "//trim(ctrcnm(jn))//" Mixed Layer ", & … … 1504 1347 CALL histdef(nidtrd(jn), trim(clvar//ctrd_trc(jpmld_trc_atf,2)), clmxl//" "//clvar//ctrd_trc(jpmld_trc_atf,1), & 1505 1348 & cltrcu, jpi, jpj, nh_t(jn), 1 , 1, 1 , -99 , 32, clop, zout, zout ) ! IOIPSL: NO time mean 1506 1507 CALL histdef(nidtrd(jn), trim(clvar//ctrd_trc(jpltrd_trc+1,2)), clmxl//" "//clvar//ctrd_trc(jpltrd_trc+1 ,1), &1508 & cltrcu, jpi, jpj, nh_t(jn), 1 , 1, 1 , -99 , 32, clop, zsto, zout ) ! Total EIV1509 1349 ! 1510 1350 ENDIF … … 1520 1360 !-- Leave IOIPSL/NetCDF define mode 1521 1361 DO jn = 1, jptra 1522 IF( l uttrd(jn) ) CALL histend( nidtrd(jn))1362 IF( ln_trdtrc(jn) ) CALL histend( nidtrd(jn), snc4set ) 1523 1363 END DO 1524 1364 1525 1365 #if defined key_lobster 1526 1366 !-- Leave IOIPSL/NetCDF define mode 1527 CALL histend( nidtrdbio )1367 CALL histend( nidtrdbio, snc4set ) 1528 1368 1529 1369 IF(lwp) WRITE(numout,*) … … 1539 1379 !!---------------------------------------------------------------------- 1540 1380 1541 INTERFACE trd_mod_trc1542 MODULE PROCEDURE trd_mod_trc_trp, trd_mod_trc_bio1543 END INTERFACE1544 1545 1381 CONTAINS 1546 1382 … … 1554 1390 WRITE(*,*) 'trd_mld_bio: You should not have seen this print! error?', kt 1555 1391 END SUBROUTINE trd_mld_bio 1556 1557 SUBROUTINE trd_mod_trc_bio( ptrbio, ktrd, kt )1558 INTEGER , INTENT( in ) :: kt ! time step1559 INTEGER , INTENT( in ) :: ktrd ! bio trend index1560 REAL, DIMENSION(:,:,:), INTENT( inout ) :: ptrbio ! Bio trend1561 WRITE(*,*) 'trd_mod_trc_bio : You should not have seen this print! error?', ptrbio(1,1,1)1562 WRITE(*,*) ' " " : You should not have seen this print! error?', ktrd1563 WRITE(*,*) ' " " : You should not have seen this print! error?', kt1564 END SUBROUTINE trd_mod_trc_bio1565 1566 SUBROUTINE trd_mod_trc_trp( ptrtrd, kjn, ktrd, kt )1567 INTEGER , INTENT( in ) :: kt ! time step1568 INTEGER , INTENT( in ) :: kjn ! tracer index1569 INTEGER , INTENT( in ) :: ktrd ! tracer trend index1570 REAL, DIMENSION(:,:,:), INTENT( inout ) :: ptrtrd ! Temperature or U trend1571 WRITE(*,*) 'trd_mod_trc_trp : You should not have seen this print! error?', ptrtrd(1,1,1)1572 WRITE(*,*) ' " " : You should not have seen this print! error?', kjn1573 WRITE(*,*) ' " " : You should not have seen this print! error?', ktrd1574 WRITE(*,*) ' " " : You should not have seen this print! error?', kt1575 END SUBROUTINE trd_mod_trc_trp1576 1392 1577 1393 SUBROUTINE trd_mld_trc_zint( ptrc_trdmld, ktrd, ctype, kjn )
Note: See TracChangeset
for help on using the changeset viewer.