Changeset 3316 for branches/2012/dev_r3309_LOCEAN12_Ediag
- Timestamp:
- 2012-02-21T17:00:02+01:00 (12 years ago)
- Location:
- branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef.xml
r3294 r3316 19 19 <group id="grid_T" axis_ref="none" grid_ref="grid_T"> 20 20 <field id="toce" description="temperature" unit="degC" axis_ref="deptht" /> 21 21 <field id="soce" description="salinity" unit="psu" axis_ref="deptht" /> 22 22 <field id="sst" description="sea surface temperature" unit="degC" /> 23 23 <field id="sst2" description="square of sea surface temperature" unit="degC2" /> … … 117 117 <field id="Mmx_v" description="Mm current barotrope along j-axis harmonic real part " unit="m/s" /> 118 118 <field id="Mmy_v" description="Mm current barotrope along j-axis harmonic imaginary part " unit="m/s" /> 119 </group> 119 <!-- variables available with key_trdtra --> 120 <field id="ttrd_xad" description="temperature-trend: i-advection" unit="degC/s" axis_ref="deptht" /> 121 <field id="strd_xad" description="salinity -trend: i-advection" unit="psu/s" axis_ref="deptht" /> 122 <field id="ttrd_yad" description="temperature-trend: j-advection" unit="degC/s" axis_ref="deptht" /> 123 <field id="strd_yad" description="salinity -trend: j-advection" unit="psu/s" axis_ref="deptht" /> 124 <field id="ttrd_zad" description="temperature-trend: k-advection" unit="degC/s" axis_ref="deptht" /> 125 <field id="strd_zad" description="salinity -trend: k-advection" unit="psu/s" axis_ref="deptht" /> 126 <field id="ttrd_sad" description="temperature-trend: surface adv. (no-vvl)" unit="degC/s" /> 127 <field id="strd_sad" description="salinity -trend: surface adv. (no-vvl)" unit="psu/s" /> 128 <field id="ttrd_ldf" description="temperature-trend: lateral diffusion" unit="degC/s" axis_ref="deptht" /> 129 <field id="strd_ldf" description="salinity -trend: lateral diffusion" unit="psu/s" axis_ref="deptht" /> 130 <field id="ttrd_zdf" description="temperature-trend: vertical diffusion" unit="degC/s" axis_ref="deptht" /> 131 <field id="strd_zdf" description="salinity -trend: vertical diffusion" unit="psu/s" axis_ref="deptht" /> 132 <field id="ttrd_zdfp" description="temperature-trend: pure vert. diffusion" unit="degC/s" axis_ref="deptht" /> 133 <field id="strd_zdfp" description="salinity -trend: pure vert. diffusion" unit="psu/s" axis_ref="deptht" /> 134 <field id="ttrd_dmp" description="temperature-trend: interior restoring" unit="degC/s" axis_ref="deptht" /> 135 <field id="strd_dmp" description="salinity -trend: interior restoring" unit="psu/s" axis_ref="deptht" /> 136 <field id="ttrd_bbl" description="temperature-trend: bottom boundary layer" unit="degC/s" axis_ref="deptht" /> 137 <field id="strd_bbl" description="salinity -trend: bottom boundary layer" unit="psu/s" axis_ref="deptht" /> 138 <field id="ttrd_npc" description="temperature-trend: non-penetrative conv." unit="degC/s" axis_ref="deptht" /> 139 <field id="strd_npc" description="salinity -trend: non-penetrative conv." unit="psu/s" axis_ref="deptht" /> 140 <field id="ttrd_qns" description="temperature-trend: non-solar heating" unit="degC/s" /> 141 <field id="ttrd_qsr" description="temperature-trend: solar penetr. heating" unit="degC/s" axis_ref="deptht" /> 142 <field id="ttrd_bbc" description="temperature-trend: geothermal heating" unit="degC/s" axis_ref="deptht" /> 143 </group> 120 144 121 145 <!-- SBC --> … … 215 239 <field id="ueiv_heattr" description="ocean bolus heat transport along i-axis" unit="W" axis_ref="none" /> 216 240 <field id="udiff_heattr" description="ocean diffusion heat transport along i-axis" unit="W" axis_ref="none" /> 217 </group> 241 <!-- variables available with key_trddyn --> 242 <field id="utrd_hpg" description="i-trend: hydrostatic pressure gradient" unit="m/s^2" /> 243 <field id="utrd_spg" description="i-trend: surface pressure gradient" unit="m/s^2" /> 244 <field id="utrd_keg" description="i-trend: KE gradient or hor. adv." unit="m/s^2" /> 245 <field id="utrd_rvo" description="i-trend: relative vorticity or metric term" unit="m/s^2" /> 246 <field id="utrd_pvo" description="i-trend: planetary vorticity" unit="m/s^2" /> 247 <field id="utrd_zad" description="i-trend: vertical advection" unit="m/s^2" /> 248 <field id="utrd_udx" description="i-trend: U.dx[U]" unit="m/s^2" /> 249 <field id="utrd_ldf" description="i-trend: lateral diffusion" unit="m/s^2" /> 250 <field id="utrd_zdf" description="i-trend: vertical diffusion" unit="m/s^2" /> 251 <field id="utrd_tau" description="i-trend: wind stress " unit="m/s^2" axis_ref="none"/> 252 <field id="utrd_bfr" description="i-trend: bottom friction" unit="m/s^2" /> 253 </group> 218 254 219 255 <!-- V grid --> … … 233 269 <field id="veiv_heattr" description="ocean bolus heat transport along j-axis" unit="W" axis_ref="none" /> 234 270 <field id="vdiff_heattr" description="ocean diffusion heat transport along j-axis" unit="W" axis_ref="none" /> 271 <!-- variables available with key_trddyn --> 272 <field id="vtrd_hpg" description="j-trend: hydrostatic pressure gradient" unit="m/s^2" /> 273 <field id="vtrd_spg" description="j-trend: surface pressure gradient" unit="m/s^2" /> 274 <field id="vtrd_keg" description="j-trend: KE gradient or hor. adv." unit="m/s^2" /> 275 <field id="vtrd_rvo" description="j-trend: relative vorticity or metric term" unit="m/s^2" /> 276 <field id="vtrd_pvo" description="j-trend: planetary vorticity" unit="m/s^2" /> 277 <field id="vtrd_zad" description="j-trend: vertical advection" unit="m/s^2" /> 278 <field id="vtrd_vdy" description="i-trend: V.dx[V]" unit="m/s^2" /> 279 <field id="vtrd_ldf" description="j-trend: lateral diffusion" unit="m/s^2" /> 280 <field id="vtrd_zdf" description="j-trend: vertical diffusion" unit="m/s^2" /> 281 <field id="vtrd_tau" description="j-trend: wind stress " unit="m/s^2" axis_ref="none"/> 282 <field id="vtrd_bfr" description="j-trend: bottom friction" unit="m/s^2" /> 235 283 </group> 236 284 -
branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/namelist
r3306 r3316 814 814 ! ! or mixed-layer trends or barotropic vorticity ("key_trdmld" or "key_trdvor") 815 815 !----------------------------------------------------------------------- 816 nn_trd = 365 ! time step frequency dynamics and tracers trends 816 ln_3D_trd_d = .FALSE. ! (T) 3D momentum trends or (F) not 817 ln_3D_trd_t = .FALSE. ! (T) 3D tracer trends or (F) not 818 ln_ML_trd_d = .FALSE. ! (T) 2D tracer trends averaged over the mixed layer 819 ln_ML_trd_t = .FALSE. ! (T) 2D momentum trends averaged over the mixed layer 820 ln_PE_trd = .FALSE. ! (T) 3D Potential Energy trends or (F) not 821 ln_KE_trd = .FALSE. ! (T) 3D Kinetic Energy trends or (F) not 822 ln_vor_trd = .FALSE. ! (T) 3D barotropic vorticity trends or (F) not 823 ln_glo_trd = .FALSE. ! (T) global domain averaged diag for T, T^2, KE, and PE 824 nn_trd = 365 ! print frequency (ln_glo_trd=T) (unit=time step) 817 825 nn_ctls = 0 ! control surface type in mixed-layer trends (0,1 or n<jpk) 818 826 rn_ucf = 1. ! unit conversion factor (=1 -> /seconds ; =86400. -> /day) -
branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv_cen2.F90
r3294 r3316 103 103 zfu_uw(:,:,:) = ua(:,:,:) - zfu_uw(:,:,:) 104 104 zfv_vw(:,:,:) = va(:,:,:) - zfv_vw(:,:,:) 105 CALL trd_mod( zfu_uw, zfv_vw, jpdyn_trd_ had, 'DYN', kt )105 CALL trd_mod( zfu_uw, zfv_vw, jpdyn_trd_keg, 'DYN', kt ) 106 106 zfu_t(:,:,:) = ua(:,:,:) 107 107 zfv_t(:,:,:) = va(:,:,:) -
branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv_ubs.F90
r3294 r3316 196 196 zfu_uw(:,:,:) = ua(:,:,:) - zfu_uw(:,:,:) 197 197 zfv_vw(:,:,:) = va(:,:,:) - zfv_vw(:,:,:) 198 CALL trd_mod( zfu_uw, zfv_vw, jpdyn_trd_ had, 'DYN', kt )198 CALL trd_mod( zfu_uw, zfv_vw, jpdyn_trd_keg, 'DYN', kt ) 199 199 zfu_t(:,:,:) = ua(:,:,:) 200 200 zfv_t(:,:,:) = va(:,:,:) -
branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynnxt.F90
r3294 r3316 17 17 !! 3.3 ! 2010-09 (D. Storkey, E.O'Dea) Bug fix for BDY module 18 18 !! 3.3 ! 2011-03 (P. Oddo) Bug fix for time-splitting+(BDY-OBC) and not VVL 19 !! 3.4 ! 2012-02 (G. Madec) add the diagnostic of the time filter trends 19 20 !!------------------------------------------------------------------------- 20 21 … … 25 26 USE dom_oce ! ocean space and time domain 26 27 USE sbc_oce ! Surface boundary condition: ocean fields 28 USE trdmod_oce ! ocean trends 27 29 USE phycst ! physical constants 28 30 USE dynspg_oce ! type of surface pressure gradient … … 38 40 USE bdyvol ! ocean open boundary condition (bdy_vol routines) 39 41 USE in_out_manager ! I/O manager 42 USE iom ! I/O manager library 40 43 USE lbclnk ! lateral boundary condition (or mpp link) 41 44 USE lib_mpp ! MPP library 42 45 USE wrk_nemo ! Memory Allocation 43 46 USE prtctl ! Print control 47 USE timing ! Timing 44 48 #if defined key_agrif 45 49 USE agrif_opa_interp 46 50 #endif 47 USE timing ! Timing48 51 49 52 IMPLICIT NONE … … 81 84 !! at the local domain boundaries through lbc_lnk call, 82 85 !! at the one-way open boundaries (lk_obc=T), 83 !! at the AGRIF zoom 86 !! at the AGRIF zoom boundaries (lk_agrif=T) 84 87 !! 85 88 !! * Apply the time filter applied and swap of the dynamics … … 101 104 REAL(wp) :: z2dt ! temporary scalar 102 105 #endif 103 REAL(wp) :: zue3a, zue3n, zue3b, zuf, zec ! local scalars104 REAL(wp) :: zve3a, zve3n, zve3b, zvf 105 REAL(wp), POINTER, DIMENSION(:,:,:) :: ze3u_f, ze3v_f 106 REAL(wp) :: zue3a, zue3n, zue3b, zuf, zec ! local scalars 107 REAL(wp) :: zve3a, zve3n, zve3b, zvf, z1_2dt ! - - 108 REAL(wp), POINTER, DIMENSION(:,:,:) :: ze3u_f, ze3v_f, zua, zva 106 109 !!---------------------------------------------------------------------- 107 110 ! 108 111 IF( nn_timing == 1 ) CALL timing_start('dyn_nxt') 109 112 ! 110 CALL wrk_alloc( jpi,jpj,jpk, ze3u_f, ze3v_f )113 CALL wrk_alloc( jpi,jpj,jpk, ze3u_f, ze3v_f, zua, zva ) 111 114 ! 112 115 IF( kt == nit000 ) THEN … … 186 189 # endif 187 190 #endif 191 192 IF( ln_3D_trd_d ) THEN ! 3D output: total momentum trends a prepare the atf trend computation 193 z1_2dt = 1._wp / (2. * rdt) ! Euler or leap-frog time step 194 IF( neuler == 0 .AND. kt == nit000 ) z1_2dt = 1._wp / rdt 195 zua(:,:,:) = ( ua(:,:,:) - ub(:,:,:) ) * z1_2dt 196 zva(:,:,:) = ( va(:,:,:) - vb(:,:,:) ) * z1_2dt 197 CALL iom_put( "utrd_tot", zua ) ! total momentum trends (but the asselin time filter) 198 CALL iom_put( "vtrd_tot", zva ) 199 zua(:,:,:) = un(:,:,:) ! save the before velocity before the asselin filter 200 zva(:,:,:) = vn(:,:,:) ! (caution: there is a shift by 1 timestep in the 201 ! ! computation of the asselin filter trends) 202 ENDIF 188 203 189 204 ! Time filter and swap of dynamics arrays … … 276 291 ENDIF 277 292 293 IF( ln_3D_trd_d ) THEN ! 3D output: asselin filter trends on momentum 294 zua(:,:,:) = ( ub(:,:,:) - zua(:,:,:) ) * z1_2dt 295 zva(:,:,:) = ( vb(:,:,:) - zva(:,:,:) ) * z1_2dt 296 CALL iom_put( "utrd_atf", zua ) ! asselin filter trends on momentum 297 CALL iom_put( "vtrd_atf", zva ) 298 ENDIF 299 278 300 IF(ln_ctl) CALL prt_ctl( tab3d_1=un, clinfo1=' nxt - Un: ', mask1=umask, & 279 301 & tab3d_2=vn, clinfo2=' Vn: ' , mask2=vmask ) 280 302 ! 281 CALL wrk_dealloc( jpi,jpj,jpk, ze3u_f, ze3v_f )303 CALL wrk_dealloc( jpi,jpj,jpk, ze3u_f, ze3v_f, zua, zva ) 282 304 ! 283 305 IF( nn_timing == 1 ) CALL timing_stop('dyn_nxt') -
branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/DYN/dynvor.F90
r3294 r3316 15 15 !! 3.2 ! 2009-04 (R. Benshila) vvl: correction of een scheme 16 16 !! 3.3 ! 2010-10 (C. Ethe, G. Madec) reorganisation of initialisation phase 17 !! 3.5 ! 2012-02 (G. Madec) suppress jpdyn_trd_dat vorticity trend simplification 17 18 !!---------------------------------------------------------------------- 18 19 … … 115 116 ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 116 117 CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_pvo, 'DYN', kt ) 117 CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_dat, 'DYN', kt )118 118 ELSE 119 119 CALL vor_ene( kt, ntot, ua, va ) ! total vorticity … … 134 134 ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 135 135 CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_pvo, 'DYN', kt ) 136 CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_dat, 'DYN', kt )137 136 ELSE 138 137 CALL vor_ens( kt, ntot, ua, va ) ! total vorticity … … 153 152 ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 154 153 CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_pvo, 'DYN', kt ) 155 CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_dat, 'DYN', kt )156 154 ELSE 157 155 CALL vor_mix( kt ) ! total vorticity (mix=ens-ene) … … 172 170 ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) 173 171 CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_pvo, 'DYN', kt ) 174 CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_dat, 'DYN', kt )175 172 ELSE 176 173 CALL vor_een( kt, ntot, ua, va ) ! total vorticity -
branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRA/traldf.F90
r3294 r3316 35 35 PRIVATE 36 36 37 PUBLIC tra_ldf 38 PUBLIC tra_ldf_init 37 PUBLIC tra_ldf ! called by step.F90 38 PUBLIC tra_ldf_init ! called by opa.F90 39 39 ! 40 40 INTEGER :: nldf = 0 ! type of lateral diffusion used defined from ln_traldf_... namlist logicals) -
branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRD/trdicp.F90
r3294 r3316 5 5 !!===================================================================== 6 6 !! History : 1.0 ! 2004-08 (C. Talandier) New trends organization 7 !! 3.5 ! 2012-02 (G. Madec) add 3D tracer zdf trend output using iom 7 8 !!---------------------------------------------------------------------- 8 9 #if defined key_trdtra || defined key_trddyn || defined key_esopa … … 22 23 USE ldfdyn_oce ! ocean dynamics: lateral physics 23 24 USE zdf_oce ! ocean vertical physics 24 USE in_out_manager ! I/O manager 25 USE lib_mpp ! distibuted memory computing library 25 USE zdfddm ! ocean vertical physics: double diffusion 26 26 USE eosbn2 ! equation of state 27 27 USE phycst ! physical constants 28 USE lib_mpp ! distibuted memory computing library 29 USE in_out_manager ! I/O manager 30 USE iom ! I/O manager library 28 31 USE wrk_nemo ! Memory allocation 29 30 32 31 33 IMPLICIT NONE … … 44 46 # include "domzgr_substitute.h90" 45 47 # include "vectopt_loop_substitute.h90" 48 # include "zdfddm_substitute.h90" 46 49 !!---------------------------------------------------------------------- 47 50 !! NEMO/OPA 3.3 , NEMO Consortium (2010) … … 55 58 !! *** ROUTINE trd_2d *** 56 59 !! 57 !! ** Purpose : verify the basin averaged properties of tracers and/or58 !! momentum equations at every time step frequency nn_trd.59 !!---------------------------------------------------------------------- 60 REAL(wp), DIMENSION( jpi,jpj), INTENT(inout) :: ptrd2dx ! Temperature or U trend61 REAL(wp), DIMENSION( jpi,jpj), INTENT(inout) :: ptrd2dy ! Salinity or V trend62 INTEGER 63 CHARACTER(len=3) 60 !! ** Purpose : compute and print the domain averaged properties of tracers 61 !! and/or momentum equations at each nn_trd time step. 62 !!---------------------------------------------------------------------- 63 REAL(wp), DIMENSION(:,:), INTENT(inout) :: ptrd2dx ! Temperature or U trend 64 REAL(wp), DIMENSION(:,:), INTENT(inout) :: ptrd2dy ! Salinity or V trend 65 INTEGER , INTENT(in ) :: ktrd ! tracer trend index 66 CHARACTER(len=3) , INTENT(in ) :: ctype ! momentum ('DYN') or tracers ('TRA') trends 64 67 !! 65 68 INTEGER :: ji, jj ! loop indices … … 123 126 !! momentum equations at every time step frequency nn_trd. 124 127 !!---------------------------------------------------------------------- 125 REAL(wp), DIMENSION( jpi,jpj,jpk), INTENT(inout) :: ptrd3dx ! Temperature or U trend126 REAL(wp), DIMENSION( jpi,jpj,jpk), INTENT(inout) :: ptrd3dy ! Salinity or V trend127 INTEGER, 128 CHARACTER(len=3), 128 REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptrd3dx ! Temperature or U trend 129 REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptrd3dy ! Salinity or V trend 130 INTEGER, INTENT(in ) :: ktrd ! momentum or tracer trend index 131 CHARACTER(len=3), INTENT(in ) :: ctype ! momentum ('DYN') or tracers ('TRA') trends 129 132 !! 130 133 INTEGER :: ji, jj, jk ! dummy loop indices … … 253 256 !! ** Purpose : write dynamic trends in ocean.output 254 257 !!---------------------------------------------------------------------- 255 !256 258 INTEGER, INTENT(in) :: kt ! ocean time-step index 257 259 ! … … 261 263 !!---------------------------------------------------------------------- 262 264 265 IF( ln_3D_trd_t .AND. ln_3D_trd_d ) RETURN ! do nothing if 3D output with IOM 266 263 267 CALL wrk_alloc( jpi, jpj, jpk, zkx, zky, zkz, zkepe ) 264 268 … … 266 270 ! ------------------- 267 271 268 IF( MOD( kt,nn_trd) == 0 .OR. kt == nit000 .OR. kt == nitend ) THEN272 IF( MOD( kt, nn_trd ) == 0 .OR. kt == nit000 .OR. kt == nitend ) THEN 269 273 270 274 ! I.1 Conversion potential energy - kinetic energy … … 449 453 !!---------------------------------------------------------------------- 450 454 INTEGER, INTENT(in) :: kt ! ocean time-step index 451 !!---------------------------------------------------------------------- 455 ! 456 INTEGER :: jk ! loop indices 457 REAL(wp), POINTER, DIMENSION(:,:,:) :: zwt, zws, ztrdt, ztrds ! 3D workspace 458 !!---------------------------------------------------------------------- 459 460 461 IF( ln_3D_trd_t ) THEN ! 3D output: treat the vertical diffusion trends (if iso) 462 ! 463 CALL wrk_alloc( jpi, jpj, jpk, zwt, zws, ztrdt, ztrds ) 464 ! 465 IF( ln_traldf_iso ) THEN ! iso-neutral diffusion : re-compute the PURE vertical diffusive trend 466 ! ! zdf trends using now field (called after the swap) 467 zwt(:,:, 1 ) = 0._wp ; zws(:,:, 1 ) = 0._wp ! vertical diffusive fluxes 468 zwt(:,:,jpk) = 0._wp ; zws(:,:,jpk) = 0._wp 469 DO jk = 2, jpk 470 zwt(:,:,jk) = avt(:,:,jk) * ( tsn(:,:,jk-1,jp_tem) - tsn(:,:,jk,jp_tem) ) / fse3w(:,:,jk) * tmask(:,:,jk) 471 zws(:,:,jk) = fsavs(:,:,jk) * ( tsn(:,:,jk-1,jp_sal) - tsn(:,:,jk,jp_sal) ) / fse3w(:,:,jk) * tmask(:,:,jk) 472 END DO 473 ! 474 ztrdt(:,:,jpk) = 0._wp ; ztrds(:,:,jpk) = 0._wp 475 DO jk = 1, jpkm1 476 ztrdt(:,:,jk) = ( zwt(:,:,jk) - zwt(:,:,jk+1) ) / fse3t(:,:,jk) 477 ztrds(:,:,jk) = ( zws(:,:,jk) - zws(:,:,jk+1) ) / fse3t(:,:,jk) 478 END DO 479 CALL iom_put( "ttrd_zdfp", ztrdt ) ! PURE vertical diffusion (no isoneutral contribution) 480 CALL iom_put( "strd_zdfp", ztrds ) 481 ENDIF 482 ! 483 CALL wrk_dealloc( jpi, jpj, jpk, zwt, zws, ztrdt, ztrds ) 484 ! 485 RETURN ! do nothing else if 3D output with IOM 486 ! 487 ENDIF 488 452 489 453 490 ! I. Tracers trends -
branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRD/trdicp_oce.F90
r2528 r3316 4 4 !! Ocean trends : set tracer and momentum trend variables 5 5 !!====================================================================== 6 7 !!---------------------------------------------------------------------- 8 !! 'key_trdtra' or tracer trends diagnostics 9 !! 'key_trddyn' momentum trends diagnostics 6 !! History : 1.0 ! 2004-08 (C. Talandier) New trends organization 7 !! 3.5 ! 2012-02 (G. Madec) add 3D tracer zdf trend output using iom 10 8 !!---------------------------------------------------------------------- 11 9 USE par_oce ! ocean parameters -
branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRD/trdmod.F90
r3294 r3316 6 6 !! History : 1.0 ! 2004-08 (C. Talandier) Original code 7 7 !! - ! 2005-04 (C. Deltel) Add Asselin trend in the ML budget 8 !! 3.3 ! 2010-10 (C. Ethe, G. Madec) reorganisation of initialisation phase 8 !! 3.3 ! 2010-10 (C. Ethe, G. Madec) reorganisation of initialisation phase 9 !! 3.5 ! 2012-02 (G. Madec) add 3D trends output for T, S, U, V, PE and KE 9 10 !!---------------------------------------------------------------------- 10 11 #if defined key_trdtra || defined key_trddyn || defined key_trdmld || defined key_trdvor || defined key_esopa 11 12 !!---------------------------------------------------------------------- 12 !! trd_mod : Call the trend to be computed 13 !! trd_mod : manage the type of trend diagnostics 14 !! trd_3Diom : output 3D momentum and/or tracer trends using IOM 15 !! trd_budget : domain averaged budget of trends (including kinetic energy and tracer variance trends) 13 16 !! trd_mod_init : Initialization step 14 17 !!---------------------------------------------------------------------- … … 24 27 USE trdmld ! ocean active mixed layer tracers trends 25 28 USE in_out_manager ! I/O manager 29 USE iom ! I/O manager library 26 30 USE lib_mpp ! MPP library 27 31 USE wrk_nemo ! Memory allocation 28 29 32 30 33 IMPLICIT NONE … … 44 47 !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 45 48 !!---------------------------------------------------------------------- 46 47 49 CONTAINS 48 50 … … 51 53 !! *** ROUTINE trd_mod *** 52 54 !! 53 !! ** Purpose : Dispatch all trends computation, e.g. vorticity, mld or54 !! integral constraints55 !! ----------------------------------------------------------------------56 ! 55 !! ** Purpose : Dispatch all trends computation, e.g. 3D output, integral 56 !! constraints, barotropic vorticity, kinetic enrgy, 57 !! potential energy, and/or mixed layer budget. 58 !!---------------------------------------------------------------------- 57 59 REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptrdx ! Temperature or U trend 58 60 REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptrdy ! Salinity or V trend 61 INTEGER , INTENT(in ) :: ktrd ! tracer trend index 59 62 CHARACTER(len=3) , INTENT(in ) :: ctype ! momentum or tracers trends type 'DYN'/'TRA' 60 63 INTEGER , INTENT(in ) :: kt ! time step 61 INTEGER , INTENT(in ) :: ktrd ! tracer trend index62 64 !! 63 65 INTEGER :: ji, jj ! dummy loop indices 64 REAL(wp), POINTER, DIMENSION(:,:) :: ztswu, ztswv, ztbfu, ztbfv, z2dx, z2dy 65 !!---------------------------------------------------------------------- 66 67 CALL wrk_alloc( jpi, jpj, ztswu, ztswv, ztbfu, ztbfv, z2dx, z2dy ) 68 69 z2dx(:,:) = 0._wp ; z2dy(:,:) = 0._wp ! initialization of workspace arrays 70 71 IF( neuler == 0 .AND. kt == nit000 ) THEN ; r2dt = rdt ! = rdtra (restart with Euler time stepping) 72 ELSEIF( kt <= nit000 + 1) THEN ; r2dt = 2. * rdt ! = 2 rdttra (leapfrog) 73 ENDIF 74 75 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 76 ! I. Integral Constraints Properties for momentum and/or tracers trends 77 !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 78 79 IF( ( mod(kt,nn_trd) == 0 .OR. kt == nit000 .OR. kt == nitend) ) THEN 80 ! 81 IF( lk_trdtra .AND. ctype == 'TRA' ) THEN ! active tracer trends 82 SELECT CASE ( ktrd ) 83 CASE ( jptra_trd_ldf ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_ldf, ctype ) ! lateral diff 84 CASE ( jptra_trd_zdf ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_zdf, ctype ) ! vertical diff (Kz) 85 CASE ( jptra_trd_bbc ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_bbc, ctype ) ! bottom boundary cond 86 CASE ( jptra_trd_bbl ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_bbl, ctype ) ! bottom boundary layer 87 CASE ( jptra_trd_npc ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_npc, ctype ) ! static instability mixing 88 CASE ( jptra_trd_dmp ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_dmp, ctype ) ! damping 89 CASE ( jptra_trd_qsr ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_qsr, ctype ) ! penetrative solar radiat. 90 CASE ( jptra_trd_nsr ) ; z2dx(:,:) = ptrdx(:,:,1) 91 z2dy(:,:) = ptrdy(:,:,1) 92 CALL trd_icp( z2dx , z2dy , jpicpt_nsr, ctype ) ! non solar radiation 93 CASE ( jptra_trd_xad ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_xad, ctype ) ! x- horiz adv 94 CASE ( jptra_trd_yad ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_yad, ctype ) ! y- horiz adv 95 CASE ( jptra_trd_zad ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_zad, ctype ) ! z- vertical adv 96 CALL trd_icp( ptrdx, ptrdy, jpicpt_zad, ctype ) 97 ! compute the surface flux condition wn(:,:,1)*tsn(:,:,1,jp_tem) 98 z2dx(:,:) = wn(:,:,1)*tsn(:,:,1,jp_tem)/fse3t(:,:,1) 99 z2dy(:,:) = wn(:,:,1)*tsn(:,:,1,jp_sal)/fse3t(:,:,1) 100 CALL trd_icp( z2dx , z2dy , jpicpt_zl1, ctype ) ! 1st z- vertical adv 101 END SELECT 102 END IF 103 104 IF( lk_trddyn .AND. ctype == 'DYN' ) THEN ! momentum trends 105 ! 106 SELECT CASE ( ktrd ) 107 CASE ( jpdyn_trd_hpg ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_hpg, ctype ) ! hydrost. pressure grad 108 CASE ( jpdyn_trd_keg ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_keg, ctype ) ! KE gradient 109 CASE ( jpdyn_trd_rvo ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_rvo, ctype ) ! relative vorticity 110 CASE ( jpdyn_trd_pvo ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_pvo, ctype ) ! planetary vorticity 111 CASE ( jpdyn_trd_ldf ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_ldf, ctype ) ! lateral diffusion 112 CASE ( jpdyn_trd_had ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_had, ctype ) ! horizontal advection 113 CASE ( jpdyn_trd_zad ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_zad, ctype ) ! vertical advection 114 CASE ( jpdyn_trd_spg ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_spg, ctype ) ! surface pressure grad. 115 CASE ( jpdyn_trd_dat ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_dat, ctype ) ! damping term 116 CASE ( jpdyn_trd_zdf ) ! vertical diffusion 117 ! subtract surface forcing/bottom friction trends 118 ! from vertical diffusive momentum trends 119 ztswu(:,:) = 0._wp ; ztswv(:,:) = 0._wp 120 ztbfu(:,:) = 0._wp ; ztbfv(:,:) = 0._wp 121 DO jj = 2, jpjm1 122 DO ji = fs_2, fs_jpim1 ! vector opt. 123 ! save the surface forcing momentum fluxes 124 ztswu(ji,jj) = utau(ji,jj) / ( fse3u(ji,jj,1)*rau0 ) 125 ztswv(ji,jj) = vtau(ji,jj) / ( fse3v(ji,jj,1)*rau0 ) 126 ! bottom friction contribution now handled explicitly 127 ptrdx(ji,jj,1) = ptrdx(ji,jj,1) - ztswu(ji,jj) 128 ptrdy(ji,jj,1) = ptrdy(ji,jj,1) - ztswv(ji,jj) 129 END DO 130 END DO 131 ! 132 CALL trd_icp( ptrdx, ptrdy, jpicpd_zdf, ctype ) 133 CALL trd_icp( ztswu, ztswv, jpicpd_swf, ctype ) ! wind stress forcing term 134 ! bottom friction contribution now handled explicitly 135 CASE ( jpdyn_trd_bfr ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_bfr, ctype ) ! bottom friction term 136 END SELECT 137 ! 138 END IF 139 ! 140 END IF 141 142 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 143 ! II. Vorticity trends 144 !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 145 146 IF( lk_trdvor .AND. ctype == 'DYN' ) THEN 147 ! 66 REAL(wp), POINTER, DIMENSION(:,:) :: ztswu, ztswv ! 2D workspace 67 !!---------------------------------------------------------------------- 68 69 CALL wrk_alloc( jpi, jpj, ztswu, ztswv ) 70 71 IF( neuler == 0 .AND. kt == nit000 ) THEN ; r2dt = rdt ! = rdtra (restart with Euler time stepping) 72 ELSEIF( kt <= nit000 + 1) THEN ; r2dt = 2. * rdt ! = 2 rdttra (leapfrog) 73 ENDIF 74 75 ! !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 76 IF( ln_3D_trd_d .OR. ln_3D_trd_t ) THEN ! 3D output of momentum and/or tracers trends using IOM interface 77 ! !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 78 CALL trd_3Diom ( ptrdx, ptrdy, ktrd, ctype, kt ) 79 ! 80 ENDIF 81 ! !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 82 IF( ln_glo_trd ) THEN ! I. Integral Constraints Properties for momentum and/or tracers trends 83 ! !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 84 CALL trd_budget( ptrdx, ptrdy, ktrd, ctype, kt ) 85 ! 86 ENDIF 87 88 ! !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 89 IF( lk_trdvor .AND. ctype == 'DYN' ) THEN ! II. Vorticity trends 90 ! !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 148 91 SELECT CASE ( ktrd ) 149 92 CASE ( jpdyn_trd_hpg ) ; CALL trd_vor_zint( ptrdx, ptrdy, jpvor_prg ) ! Hydrostatique Pressure Gradient … … 152 95 CASE ( jpdyn_trd_pvo ) ; CALL trd_vor_zint( ptrdx, ptrdy, jpvor_pvo ) ! Planetary Vorticity Term 153 96 CASE ( jpdyn_trd_ldf ) ; CALL trd_vor_zint( ptrdx, ptrdy, jpvor_ldf ) ! Horizontal Diffusion 154 CASE ( jpdyn_trd_had ) ; CALL ctl_warn('Vorticity for horizontal advection trend never checked')155 97 CASE ( jpdyn_trd_zad ) ; CALL trd_vor_zint( ptrdx, ptrdy, jpvor_zad ) ! Vertical Advection 156 98 CASE ( jpdyn_trd_spg ) ; CALL trd_vor_zint( ptrdx, ptrdy, jpvor_spg ) ! Surface Pressure Grad. 157 CASE ( jpdyn_trd_dat ) ; CALL trd_vor_zint( ptrdx, ptrdy, jpvor_bev ) ! Beta V158 99 CASE ( jpdyn_trd_zdf ) ! Vertical Diffusion 159 ! subtract surface forcing/bottom friction trends160 ! from vertical diffusive momentum trends161 100 ztswu(:,:) = 0.e0 ; ztswv(:,:) = 0.e0 162 ztbfu(:,:) = 0.e0 ; ztbfv(:,:) = 0.e0 163 DO jj = 2, jpjm1 101 DO jj = 2, jpjm1 ! wind stress trends 164 102 DO ji = fs_2, fs_jpim1 ! vector opt. 165 ! save the surface forcing momentum fluxes 166 ztswu(ji,jj) = utau(ji,jj) / ( fse3u(ji,jj,1)*rau0 ) 167 ztswv(ji,jj) = vtau(ji,jj) / ( fse3v(ji,jj,1)*rau0 ) 168 ! 169 ptrdx(ji,jj,1 ) = ptrdx(ji,jj,1 ) - ztswu(ji,jj) 170 ptrdy(ji,jj,1 ) = ptrdy(ji,jj,1 ) - ztswv(ji,jj) 103 ztswu(ji,jj) = ( utau_b(ji,jj) + utau(ji,jj) ) / ( fse3u(ji,jj,1) * rau0 ) 104 ztswv(ji,jj) = ( vtau_b(ji,jj) + vtau(ji,jj) ) / ( fse3v(ji,jj,1) * rau0 ) 171 105 END DO 172 106 END DO 173 107 ! 174 CALL trd_vor_zint( ptrdx, ptrdy, jpvor_zdf ) 175 CALL trd_vor_zint( ztswu, ztswv, jpvor_swf ) ! Wind stress forcing term108 CALL trd_vor_zint( ptrdx, ptrdy, jpvor_zdf ) ! zdf trend including surf./bot. stresses 109 CALL trd_vor_zint( ztswu, ztswv, jpvor_swf ) ! surface wind stress 176 110 CASE ( jpdyn_trd_bfr ) 177 CALL trd_vor_zint( ptrdx, ptrdy, jpvor_bfr ) ! Bottom friction term111 CALL trd_vor_zint( ptrdx, ptrdy, jpvor_bfr ) ! Bottom stress 178 112 END SELECT 179 113 ! … … 184 118 !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 185 119 186 IF( lk_trdmld .AND. ctype == 'TRA' ) THEN 187 120 IF( lk_trdmld .AND. ctype == 'TRA' ) THEN 188 121 !----------------------------------------------------------------------------------------------- 189 122 ! W.A.R.N.I.N.G : … … 198 131 199 132 SELECT CASE ( ktrd ) 200 CASE ( jptra_trd_xad ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_xad, '3D' ) ! merid.advection201 CASE ( jptra_trd_yad ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_yad, '3D' ) ! zonaladvection202 CASE ( jptra_trd_zad ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_zad, '3D' ) ! vertical advection203 CASE ( jptra_trd_ldf ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_ldf, '3D' ) ! lateral diffusive204 CASE ( jptra_trd_bbl ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_bbl, '3D' ) ! bottom boundary layer133 CASE ( jptra_trd_xad ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_xad, '3D' ) ! zonal advection 134 CASE ( jptra_trd_yad ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_yad, '3D' ) ! merid. advection 135 CASE ( jptra_trd_zad ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_zad, '3D' ) ! vertical advection 136 CASE ( jptra_trd_ldf ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_ldf, '3D' ) ! lateral diffusion 137 CASE ( jptra_trd_bbl ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_bbl, '3D' ) ! bottom boundary layer 205 138 CASE ( jptra_trd_zdf ) 206 IF( ln_traldf_iso ) THEN 207 CALL trd_mld_zint( ptrdx, ptrdy, jpmld_ldf, '3D' ) ! vertical diffusion (K_z) 208 ELSE 209 CALL trd_mld_zint( ptrdx, ptrdy, jpmld_zdf, '3D' ) ! vertical diffusion (K_z) 139 IF( ln_traldf_iso ) THEN ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_ldf, '3D' ) ! lateral diffusion (K_z) 140 ELSE ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_zdf, '3D' ) ! vertical diffusion (K_z) 210 141 ENDIF 211 CASE ( jptra_trd_dmp ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_dmp, '3D' ) ! internal 3D restoring (tradmp)212 CASE ( jptra_trd_qsr ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_for, '3D' ) ! air-sea : penetrative sol radiat142 CASE ( jptra_trd_dmp ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_dmp, '3D' ) ! internal 3D restoring (tradmp) 143 CASE ( jptra_trd_qsr ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_for, '3D' ) ! air-sea : penetrative sol radiat 213 144 CASE ( jptra_trd_nsr ) 214 ptrdx(:,:,2:jpk) = 0. e0 ; ptrdy(:,:,2:jpk) = 0.e0215 CALL trd_mld_zint( ptrdx, ptrdy, jpmld_for, '2D' ) ! air-sea : non penetr sol radiat216 CASE ( jptra_trd_bbc ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_bbc, '3D' ) ! bottom bound cond (geoth flux)217 CASE ( jptra_trd_atf ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_atf, '3D' ) ! asselin numerical218 CASE ( jptra_trd_npc ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_npc, '3D' ) ! non penetr convect adjustment145 ptrdx(:,:,2:jpk) = 0._wp ; ptrdy(:,:,2:jpk) = 0._wp 146 CALL trd_mld_zint( ptrdx, ptrdy, jpmld_for, '2D' ) ! air-sea : non penetr sol radiat 147 CASE ( jptra_trd_bbc ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_bbc, '3D' ) ! bottom bound cond (geoth flux) 148 CASE ( jptra_trd_atf ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_atf, '3D' ) ! asselin numerical 149 CASE ( jptra_trd_npc ) ; CALL trd_mld_zint( ptrdx, ptrdy, jpmld_npc, '3D' ) ! non penetr convect adjustment 219 150 END SELECT 220 221 ENDIF 222 ! 223 CALL wrk_dealloc( jpi, jpj, ztswu, ztswv , ztbfu, ztbfv, z2dx, z2dy)151 ! 152 ENDIF 153 ! 154 CALL wrk_dealloc( jpi, jpj, ztswu, ztswv ) 224 155 ! 225 156 END SUBROUTINE trd_mod 226 157 158 159 SUBROUTINE trd_budget( ptrdx, ptrdy, ktrd, ctype, kt ) 160 !!--------------------------------------------------------------------- 161 !! *** ROUTINE trd_budget *** 162 !! 163 !! ** Purpose : integral constraint diagnostics for momentum and/or tracer trends 164 !! 165 !!---------------------------------------------------------------------- 166 REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptrdx ! Temperature or U trend 167 REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptrdy ! Salinity or V trend 168 INTEGER , INTENT(in ) :: ktrd ! tracer trend index 169 CHARACTER(len=3) , INTENT(in ) :: ctype ! momentum or tracers trends type 'DYN'/'TRA' 170 INTEGER , INTENT(in ) :: kt ! time step 171 !! 172 INTEGER :: ji, jj ! dummy loop indices 173 REAL(wp), POINTER, DIMENSION(:,:) :: ztswu, ztswv, z2dx, z2dy ! 2D workspace 174 !!---------------------------------------------------------------------- 175 176 CALL wrk_alloc( jpi, jpj, ztswu, ztswv, z2dx, z2dy ) 177 178 IF( MOD(kt,nn_trd) == 0 .OR. kt == nit000 .OR. kt == nitend ) THEN 179 ! 180 IF( lk_trdtra .AND. ctype == 'TRA' ) THEN ! active tracer trends 181 SELECT CASE ( ktrd ) 182 CASE ( jptra_trd_ldf ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_ldf, ctype ) ! lateral diff 183 CASE ( jptra_trd_zdf ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_zdf, ctype ) ! vertical diff (Kz) 184 CASE ( jptra_trd_bbc ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_bbc, ctype ) ! bottom boundary cond 185 CASE ( jptra_trd_bbl ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_bbl, ctype ) ! bottom boundary layer 186 CASE ( jptra_trd_npc ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_npc, ctype ) ! static instability mixing 187 CASE ( jptra_trd_dmp ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_dmp, ctype ) ! damping 188 CASE ( jptra_trd_qsr ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_qsr, ctype ) ! penetrative solar radiat. 189 CASE ( jptra_trd_nsr ) ; z2dx(:,:) = ptrdx(:,:,1) ! non solar radiation 190 z2dy(:,:) = ptrdy(:,:,1) 191 CALL trd_icp( z2dx , z2dy , jpicpt_nsr, ctype ) 192 CASE ( jptra_trd_xad ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_xad, ctype ) ! x- horiz adv 193 CASE ( jptra_trd_yad ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_yad, ctype ) ! y- horiz adv 194 CASE ( jptra_trd_zad ) ; CALL trd_icp( ptrdx, ptrdy, jpicpt_zad, ctype ) ! z- vertical adv 195 ! ! surface flux 196 IF( lk_vvl ) THEN ! variable volume = zero 197 z2dx(:,:) = 0._wp 198 z2dy(:,:) = 0._wp 199 ELSE ! constant volume = wn*tsn/e3t 200 z2dx(:,:) = wn(:,:,1) * tsn(:,:,1,jp_tem) / fse3t(:,:,1) 201 z2dy(:,:) = wn(:,:,1) * tsn(:,:,1,jp_sal) / fse3t(:,:,1) 202 ENDIF 203 CALL trd_icp( z2dx , z2dy , jpicpt_zl1, ctype ) 204 END SELECT 205 ENDIF 206 207 IF( lk_trddyn .AND. ctype == 'DYN' ) THEN ! momentum trends 208 ! 209 SELECT CASE ( ktrd ) 210 CASE( jpdyn_trd_hpg ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_hpg, ctype ) ! hydrost. pressure gradient 211 CASE( jpdyn_trd_spg ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_spg, ctype ) ! surface pressure grad. 212 CASE( jpdyn_trd_pvo ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_pvo, ctype ) ! planetary vorticity 213 CASE( jpdyn_trd_rvo ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_rvo, ctype ) ! relative vorticity or metric term 214 CASE( jpdyn_trd_keg ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_keg, ctype ) ! KE gradient or hor. advection 215 CASE( jpdyn_trd_zad ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_zad, ctype ) ! vertical advection 216 CASE( jpdyn_trd_ldf ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_ldf, ctype ) ! lateral diffusion 217 CASE( jpdyn_trd_zdf ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_zdf, ctype ) ! vertical diffusion (icluding bfr & tau) 218 ztswu(:,:) = ( utau_b(ji,jj) + utau(ji,jj) ) / ( fse3u(:,:,1) * rau0 ) 219 ztswv(:,:) = ( vtau_b(ji,jj) + vtau(ji,jj) ) / ( fse3v(:,:,1) * rau0 ) 220 CALL trd_icp( ztswu, ztswv, jpicpd_swf, ctype ) ! wind stress trends 221 CASE( jpdyn_trd_bfr ) ; CALL trd_icp( ptrdx, ptrdy, jpicpd_bfr, ctype ) ! bottom friction trends 222 END SELECT 223 ! 224 ENDIF 225 ! 226 ENDIF 227 ! 228 CALL wrk_dealloc( jpi, jpj, ztswu, ztswv, z2dx, z2dy ) 229 ! 230 END SUBROUTINE trd_budget 231 232 233 SUBROUTINE trd_3Diom( ptrdx, ptrdy, ktrd, ctype, kt ) 234 !!--------------------------------------------------------------------- 235 !! *** ROUTINE trd_3Diom *** 236 !! 237 !! ** Purpose : output 3D trends using IOM 238 !!---------------------------------------------------------------------- 239 REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptrdx ! Temperature or U trend 240 REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: ptrdy ! Salinity or V trend 241 INTEGER , INTENT(in ) :: ktrd ! tracer trend index 242 CHARACTER(len=3) , INTENT(in ) :: ctype ! momentum or tracers trends type 'DYN'/'TRA' 243 INTEGER , INTENT(in ) :: kt ! time step 244 !! 245 INTEGER :: ji, jj, jk ! dummy loop indices 246 REAL(wp), POINTER, DIMENSION(:,:) :: z2dx, z2dy, ztswu, ztswv ! 2D workspace 247 REAL(wp), POINTER, DIMENSION(:,:,:) :: z3dx, z3dy ! 3D workspace 248 !!---------------------------------------------------------------------- 249 250 IF( lk_trdtra .AND. ctype == 'TRA' ) THEN ! active tracer trends 251 ! 252 !!gm Rq: mask the trends already masked in trd_tra, but lbc_lnk should probably be added 253 ! 254 SELECT CASE( ktrd ) 255 CASE( jptra_trd_xad ) ; CALL iom_put( "ttrd_xad", ptrdx ) ! x- horizontal advection 256 CALL iom_put( "strd_xad", ptrdy ) 257 CASE( jptra_trd_yad ) ; CALL iom_put( "ttrd_yad", ptrdx ) ! y- horizontal advection 258 CALL iom_put( "strd_yad", ptrdy ) 259 CASE( jptra_trd_zad ) ; CALL iom_put( "ttrd_zad", ptrdx ) ! z- vertical advection 260 CALL iom_put( "strd_zad", ptrdy ) 261 IF( .NOT.lk_vvl ) THEN ! cst volume : adv flux through z=0 surface 262 z2dx(:,:) = wn(:,:,1) * tsn(:,:,1,jp_tem) / fse3t(:,:,1) 263 z2dy(:,:) = wn(:,:,1) * tsn(:,:,1,jp_sal) / fse3t(:,:,1) 264 CALL iom_put( "ttrd_sad", z2dx ) 265 CALL iom_put( "strd_sad", z2dy ) 266 ENDIF 267 CASE( jptra_trd_ldf ) ; CALL iom_put( "ttrd_ldf", ptrdx ) ! lateral diffusion 268 CALL iom_put( "strd_ldf", ptrdy ) 269 CASE( jptra_trd_zdf ) ; CALL iom_put( "ttrd_zdf", ptrdx ) ! vertical diffusion (including Kz contribution) 270 CALL iom_put( "strd_zdf", ptrdy ) 271 CASE( jptra_trd_dmp ) ; CALL iom_put( "ttrd_dmp", ptrdx ) ! internal restoring (damping) 272 CALL iom_put( "strd_dmp", ptrdy ) 273 CASE( jptra_trd_bbl ) ; CALL iom_put( "ttrd_bbl", ptrdx ) ! bottom boundary layer 274 CALL iom_put( "strd_bbl", ptrdy ) 275 CASE( jptra_trd_npc ) ; CALL iom_put( "ttrd_npc", ptrdx ) ! static instability mixing 276 CALL iom_put( "strd_npc", ptrdy ) 277 CASE( jptra_trd_qsr ) ; CALL iom_put( "ttrd_qsr", ptrdx ) ! penetrative solar radiat. (only on temperature) 278 CASE( jptra_trd_nsr ) ; CALL iom_put( "ttrd_qns", ptrdx(:,:,1) ) ! non-solar radiation (only on temperature) 279 CASE( jptra_trd_bbc ) ; CALL iom_put( "ttrd_bbc", ptrdx ) ! geothermal heating (only on temperature) 280 END SELECT 281 ENDIF 282 283 IF( lk_trddyn .AND. ctype == 'DYN' ) THEN ! momentum trends 284 ! 285 ptrdx(:,:,:) = ptrdx(:,:,:) * umask(:,:,:) ! mask the trends 286 ptrdy(:,:,:) = ptrdy(:,:,:) * vmask(:,:,:) 287 !!gm NB : here a lbc_lnk should probably be added 288 ! 289 SELECT CASE( ktrd ) 290 CASE( jpdyn_trd_hpg ) ; CALL iom_put( "utrd_hpg", ptrdx ) ! hydrostatic pressure gradient 291 CALL iom_put( "vtrd_hpg", ptrdy ) 292 CASE( jpdyn_trd_spg ) ; CALL iom_put( "utrd_spg", ptrdx ) ! surface pressure gradient 293 CALL iom_put( "vtrd_spg", ptrdy ) 294 CASE( jpdyn_trd_pvo ) ; CALL iom_put( "utrd_pvo", ptrdx ) ! planetary vorticity 295 CALL iom_put( "vtrd_pvo", ptrdy ) 296 CASE( jpdyn_trd_rvo ) ; CALL iom_put( "utrd_rvo", ptrdx ) ! relative vorticity (or metric term) 297 CALL iom_put( "vtrd_rvo", ptrdy ) 298 CASE( jpdyn_trd_keg ) ; CALL iom_put( "utrd_keg", ptrdx ) ! Kinetic Energy gradient (or had) 299 CALL iom_put( "vtrd_keg", ptrdy ) 300 z3dx(:,:,:) = 0._wp ! U.dxU & V.dyV (approximation) 301 z3dy(:,:,:) = 0._wp 302 DO jk = 1, jpkm1 ! no mask as un,vn are masked 303 DO jj = 2, jpjm1 304 DO ji = 2, jpim1 305 z3dx(ji,jj,jk) = un(ji,jj,jk) * ( un(ji+1,jj,jk) - un(ji-1,jj,jk) ) / ( 2._wp * e1u(ji,jj) ) 306 z3dy(ji,jj,jk) = vn(ji,jj,jk) * ( vn(ji,jj+1,jk) - vn(ji,jj-1,jk) ) / ( 2._wp * e2v(ji,jj) ) 307 END DO 308 END DO 309 END DO 310 CALL lbc_lnk( z3dx, 'U', -1. ) ; CALL lbc_lnk( z3dy, 'V', -1. ) 311 CALL iom_put( "utrd_udx", z3dx ) 312 CALL iom_put( "vtrd_vdy", z3dy ) 313 CASE( jpdyn_trd_zad ) ; CALL iom_put( "utrd_zad", ptrdx ) ! vertical advection 314 CALL iom_put( "vtrd_zad", ptrdy ) 315 CASE( jpdyn_trd_ldf ) ; CALL iom_put( "utrd_ldf", ptrdx ) ! lateral diffusion 316 CALL iom_put( "vtrd_ldf", ptrdy ) 317 CASE( jpdyn_trd_zdf ) ; CALL iom_put( "utrd_zdf", ptrdx ) ! vertical diffusion 318 CALL iom_put( "vtrd_zdf", ptrdy ) 319 ! ! wind stress trends 320 z2dx(:,:) = ( utau_b(ji,jj) + utau(ji,jj) ) / ( fse3u(:,:,1) * rau0 ) 321 z2dy(:,:) = ( vtau_b(ji,jj) + vtau(ji,jj) ) / ( fse3v(:,:,1) * rau0 ) 322 CALL iom_put( "utrd_tau", z2dx ) 323 CALL iom_put( "vtrd_tau", z2dy ) 324 CASE( jpdyn_trd_bfr ) ; CALL iom_put( "utrd_bfr", ptrdx ) ! bottom friction term 325 CALL iom_put( "vtrd_bfr", ptrdy ) 326 END SELECT 327 ! 328 ENDIF 329 ! 330 CALL wrk_dealloc( jpi, jpj , z2dx, z2dy, ztswu, ztswv ) 331 CALL wrk_dealloc( jpi, jpj, jpk, z3dx, z3dy ) 332 ! 333 END SUBROUTINE trd_3Diom 334 227 335 #else 228 336 !!---------------------------------------------------------------------- 229 !! Default case : Empty module 230 !!---------------------------------------------------------------------- 231 USE trdmod_oce ! ocean variables trends 232 USE trdvor ! ocean vorticity trends 233 USE trdicp ! ocean bassin integral constraints properties 234 USE trdmld ! ocean active mixed layer tracers trends 337 !! Default case : Empty module No trend diagnostics 235 338 !!---------------------------------------------------------------------- 236 339 CONTAINS 237 SUBROUTINE trd_mod( ptrd3dx, ptrd3dy, ktrd, ctype, kt ) ! Empty routine238 REAL (wp) :: ptrd3dx(:,:,:), ptrd3dy(:,:,:)340 SUBROUTINE trd_mod( ptrdx, ptrdy, ktrd, ctype, kt ) ! Empty routine 341 REAL :: ptrdx(:,:,:), ptrdy(:,:,:) 239 342 INTEGER :: ktrd, kt 240 343 CHARACTER(len=3) :: ctype 241 WRITE(*,*) 'trd_ 3d: You should not have seen this print! error ?', ptrd3dx(1,1,1), ptrd3dy(1,1,1)242 WRITE(*,*) ' " ": You should not have seen this print! error ?', ktrd, ctype, kt344 WRITE(*,*) 'trd_mod: You should not have seen this print! error ?', & 345 & ptrdx(1,1,1), ptrdy(1,1,1), ktrd, ctype, kt 243 346 END SUBROUTINE trd_mod 244 347 #endif … … 251 354 !!---------------------------------------------------------------------- 252 355 USE in_out_manager ! I/O manager 253 !! 254 NAMELIST/namtrd/ nn_trd, nn_ctls, cn_trdrst_in, cn_trdrst_out, ln_trdmld_restart, rn_ucf, ln_trdmld_instant 356 357 NAMELIST/namtrd/ ln_3D_trd_d, ln_KE_trd, ln_vor_trd, ln_ML_trd_d, & 358 & ln_3D_trd_t, ln_PE_trd, ln_glo_trd, ln_ML_trd_t, & 359 & nn_trd , cn_trdrst_in , ln_trdmld_restart, & 360 & nn_ctls, cn_trdrst_out, ln_trdmld_instant, rn_ucf 255 361 !!---------------------------------------------------------------------- 256 362 … … 264 370 WRITE(numout,*) ' ~~~~~~~~~~~~~' 265 371 WRITE(numout,*) ' Namelist namtrd : set trends parameters' 266 WRITE(numout,*) ' frequency of trends diagnostics nn_trd = ', nn_trd 267 WRITE(numout,*) ' control surface type nn_ctls = ', nn_ctls 268 WRITE(numout,*) ' restart for ML diagnostics ln_trdmld_restart = ', ln_trdmld_restart 269 WRITE(numout,*) ' instantaneous or mean ML T/S ln_trdmld_instant = ', ln_trdmld_instant 270 WRITE(numout,*) ' unit conversion factor rn_ucf = ', rn_ucf 372 WRITE(numout,*) ' U & V trends: 3D output ln_3D_trd_d = ', ln_3D_trd_d 373 WRITE(numout,*) ' T & S trends: 3D output ln_3D_trd_t = ', ln_3D_trd_t 374 WRITE(numout,*) ' Kinetic Energy trends ln_KE_trd = ', ln_KE_trd 375 WRITE(numout,*) ' Potential Energy trends ln_PE_trd = ', ln_PE_trd 376 WRITE(numout,*) ' Barotropic vorticity trends ln_vor_trd = ', ln_vor_trd 377 WRITE(numout,*) ' check domain averaged dyn & tra trends ln_glo_trd = ', ln_glo_trd 378 WRITE(numout,*) ' U & V trends: Mixed Layer averaged ln_ML_trd_d = ', ln_3D_trd_d 379 WRITE(numout,*) ' T & S trends: Mixed Layer averaged ln_ML_trd_t = ', ln_3D_trd_t 380 ! 381 WRITE(numout,*) ' frequency of trends diagnostics (glo) nn_trd = ', nn_trd 382 WRITE(numout,*) ' control surface type (mld) nn_ctls = ', nn_ctls 383 WRITE(numout,*) ' restart for ML diagnostics ln_trdmld_restart = ', ln_trdmld_restart 384 WRITE(numout,*) ' instantaneous or mean ML T/S ln_trdmld_instant = ', ln_trdmld_instant 385 WRITE(numout,*) ' unit conversion factor rn_ucf = ', rn_ucf 271 386 ENDIF 272 387 ENDIF 388 ! 389 IF( ln_KE_trd .OR. ln_PE_trd .OR. ln_ML_trd_d ) & 390 CALL ctl_stop( 'KE, PE, aur ML on momentum are not yet coded we stop' ) 391 !!gm : Potential BUG : 3D output only for vector invariant form! add a ctl_stop or code the flux form case 392 !!gm : bug/pb for vertical advection of tracer in vvl case: add T.dt[eta] in the output... 273 393 ! 274 394 IF( lk_trddyn .OR. lk_trdtra ) CALL trd_icp_init ! integral constraints trends -
branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRD/trdmod_oce.F90
r2715 r3316 14 14 15 15 ! !!* Namelist namtrd: diagnostics on dynamics/tracer trends * 16 INTEGER , PUBLIC :: nn_trd = 10 !: time step frequency dynamics and tracers trends 16 LOGICAL , PUBLIC :: ln_3D_trd_d = .FALSE. !: (T) 3D momentum trends or (F) not 17 LOGICAL , PUBLIC :: ln_3D_trd_t = .FALSE. !: (T) 3D tracer trends or (F) not 18 LOGICAL , PUBLIC :: ln_PE_trd = .FALSE. !: (T) 3D Potential Energy trends or (F) not 19 LOGICAL , PUBLIC :: ln_KE_trd = .FALSE. !: (T) 3D Kinetic Energy trends or (F) not 20 LOGICAL , PUBLIC :: ln_vor_trd = .FALSE. !: (T) 3D barotropic vorticity trends or (F) not 21 LOGICAL , PUBLIC :: ln_glo_trd = .FALSE. !: (T) global domain averaged diag for T, T^2, KE, and PE 22 LOGICAL , PUBLIC :: ln_ML_trd_t = .FALSE. !: (T) 2D tracer trends averaged over the mixed layer 23 LOGICAL , PUBLIC :: ln_ML_trd_d = .FALSE. !: (T) 2D momentum trends averaged over the mixed layer 24 INTEGER , PUBLIC :: nn_trd = 10 !: time step frequency for ln_glo_trd 17 25 INTEGER , PUBLIC :: nn_ctls = 0 !: control surface type for trends vertical integration 18 26 REAL(wp), PUBLIC :: rn_ucf = 1. !: unit conversion factor (for netCDF trends outputs) … … 43 51 INTEGER, PUBLIC, PARAMETER :: jptra_trd_zad = 3 !: z- vertical advection 44 52 INTEGER, PUBLIC, PARAMETER :: jptra_trd_ldf = 4 !: lateral diffusion 45 INTEGER, PUBLIC, PARAMETER :: jptra_trd_zdf = 5 !: vertical diffusion (Kz)46 INTEGER, PUBLIC, PARAMETER :: jptra_trd_bbc = 6 !: Bottom Boundary Condition (geoth. flux)47 INTEGER, PUBLIC, PARAMETER :: jptra_trd_bbl = 7 !: Bottom Boundary Layer (diffusive /convective)48 INTEGER, PUBLIC, PARAMETER :: jptra_trd_npc = 8 !: static instability mixing49 INTEGER, PUBLIC, PARAMETER :: jptra_trd_dmp = 9 !: damping53 INTEGER, PUBLIC, PARAMETER :: jptra_trd_zdf = 5 !: vertical diffusion 54 INTEGER, PUBLIC, PARAMETER :: jptra_trd_bbc = 6 !: Bottom Boundary Condition (geoth. heating) 55 INTEGER, PUBLIC, PARAMETER :: jptra_trd_bbl = 7 !: Bottom Boundary Layer (diffusive and/or advective) 56 INTEGER, PUBLIC, PARAMETER :: jptra_trd_npc = 8 !: non-penetrative convection treatment 57 INTEGER, PUBLIC, PARAMETER :: jptra_trd_dmp = 9 !: internal restoring (damping) 50 58 INTEGER, PUBLIC, PARAMETER :: jptra_trd_qsr = 10 !: penetrative solar radiation 51 INTEGER, PUBLIC, PARAMETER :: jptra_trd_nsr = 11 !: non solar radiation52 INTEGER, PUBLIC, PARAMETER :: jptra_trd_atf = 12 !: Asselin correction53 #if defined key_top 54 ! !!!* Passive tracers trends indexes 59 INTEGER, PUBLIC, PARAMETER :: jptra_trd_nsr = 11 !: non solar radiation 60 INTEGER, PUBLIC, PARAMETER :: jptra_trd_atf = 12 !: Asselin time filter 61 ! 62 ! !!!* Passive tracers trends indexes (use if "key_top" defined) 55 63 INTEGER, PUBLIC, PARAMETER :: jptra_trd_sms = 13 !: sources m. sinks 56 64 INTEGER, PUBLIC, PARAMETER :: jptra_trd_radn = 14 !: corr. trn<0 in trcrad 57 65 INTEGER, PUBLIC, PARAMETER :: jptra_trd_radb = 15 !: corr. trb<0 in trcrad (like atf) 58 #endif 59 66 ! 60 67 ! !!!* Momentum trends indexes 61 68 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_hpg = 1 !: hydrostatic pressure gradient 62 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_keg = 2 !: kinetic energy gradient 63 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_rvo = 3 !: relative vorticity 64 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_pvo = 4 !: planetary vorticity 65 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_ldf = 5 !: lateral diffusion 66 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_had = 6 !: horizontal advection 67 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_zad = 7 !: vertical advection 68 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_zdf = 8 !: vertical diffusion 69 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_spg = 9 !: surface pressure gradient 70 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_dat = 10 !: damping term 71 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_swf = 11 !: surface wind forcing 72 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_bfr = 12 !: bottom friction 69 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_spg = 2 !: surface pressure gradient 70 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_keg = 3 !: kinetic energy gradient or horizontal advection 71 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_rvo = 4 !: relative vorticity or metric term 72 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_pvo = 5 !: planetary vorticity 73 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_zad = 6 !: vertical advection 74 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_ldf = 7 !: horizontal diffusion 75 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_zdf = 8 !: vertical diffusion 76 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_swf = 9 !: surface stress 77 INTEGER, PUBLIC, PARAMETER :: jpdyn_trd_bfr = 10 !: bottom stress 73 78 74 79 !!---------------------------------------------------------------------- -
branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRD/trdtra.F90
r3294 r3316 2 2 !!====================================================================== 3 3 !! *** MODULE trdtra *** 4 !! Ocean diagnostics: ocean tracers trends 4 !! Ocean diagnostics: ocean tracers trends pre-processing 5 5 !!===================================================================== 6 !! History : 1.0 ! 2004-08 (C. Talandier) Original code 7 !! 2.0 ! 2005-04 (C. Deltel) Add Asselin trend in the ML budget 8 !! 3.3 ! 2010-06 (C. Ethe) merge TRA-TRC 6 !! History : 3.3 ! 2010-06 (C. Ethe) creation for the TRA/TRC merge 7 !! 3.5 ! 2012-02 (G. Madec) update the comments 9 8 !!---------------------------------------------------------------------- 10 9 #if defined key_trdtra || defined key_trdmld || defined key_trdmld_trc 11 10 !!---------------------------------------------------------------------- 12 !! trd_tra : Call the trend to be computed13 !! ----------------------------------------------------------------------14 USE dom_oce ! ocean domain15 USE trdmod_oce ! ocean active mixed layer tracers trends16 USE trdmod 17 USE trdmod _trc ! ocean passive mixed layer tracers trends18 USE in_out_manager ! I/O manager19 USE lib_mpp ! MPP library20 USE wrk_nemo ! Memory allocation21 11 !! trd_tra : pre-process the tracer trends and calll trd_mod(_trc) 12 !! trd_tra_adv : transform a div(U.T) trend into a U.grad(T) trend 13 !!---------------------------------------------------------------------- 14 USE dom_oce ! ocean domain 15 USE trdmod_oce ! ocean active mixed layer tracers trends 16 USE trdmod ! ocean active mixed layer tracers trends 17 USE trdmod_trc ! ocean passive mixed layer tracers trends 18 USE in_out_manager ! I/O manager 19 USE lib_mpp ! MPP library 20 USE wrk_nemo ! Memory allocation 22 21 23 22 IMPLICIT NONE 24 23 PRIVATE 25 24 26 PUBLIC trd_tra ! called by all traXXmodules25 PUBLIC trd_tra ! called by all tra_... modules 27 26 28 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: trdtx, trdty, trdt !:27 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: trdtx, trdty, trdt ! use to store the temperature trends 29 28 30 29 !! * Substitutions … … 32 31 # include "vectopt_loop_substitute.h90" 33 32 !!---------------------------------------------------------------------- 34 !! NEMO/OPA 4.0 , NEMO Consortium (2011)33 !! NEMO/OPA 3.3 , NEMO Consortium (2010) 35 34 !! $Id$ 36 35 !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 53 52 !! *** ROUTINE trd_tra *** 54 53 !! 55 !! ** Purpose : Dispatch all trends computation, e.g. vorticity, mld or 56 !! integral constraints 54 !! ** Purpose : pre-process tracer trends 57 55 !! 58 !! ** Method/usage : For the mixed-layer trend, the control surface can be either 59 !! a mixed layer depth (time varying) or a fixed surface (jk level or bowl). 60 !! Choose control surface with nn_ctls in namelist NAMTRD : 61 !! nn_ctls = 0 : use mixed layer with density criterion 62 !! nn_ctls = 1 : read index from file 'ctlsurf_idx' 63 !! nn_ctls > 1 : use fixed level surface jk = nn_ctls 64 !!---------------------------------------------------------------------- 65 ! 66 INTEGER , INTENT(in) :: kt ! time step 67 CHARACTER(len=3) , INTENT(in) :: ctype ! tracers trends type 'TRA'/'TRC' 68 INTEGER , INTENT(in) :: ktra ! tracer index 69 INTEGER , INTENT(in) :: ktrd ! tracer trend index 70 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in) :: ptrd ! tracer trend or flux 71 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in), OPTIONAL :: pun ! velocity 72 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in), OPTIONAL :: ptra ! Tracer variablea 56 !! ** Method : - mask the trend 57 !! - advection (ptra present) converte the incoming flux (U.T) 58 !! into trend (U.T => -U.grat(T)=div(U.T)-T.div(U)) through a 59 !! call to trd_tra_adv 60 !! - 'TRA' case : regroup T & S trends 61 !! - send the trends to trd_mod(_trc) for further processing 62 !!---------------------------------------------------------------------- 63 INTEGER , INTENT(in) :: kt ! time step 64 CHARACTER(len=3) , INTENT(in) :: ctype ! tracers trends type 'TRA'/'TRC' 65 INTEGER , INTENT(in) :: ktra ! tracer index 66 INTEGER , INTENT(in) :: ktrd ! tracer trend index 67 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in) :: ptrd ! tracer trend or flux 68 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in), OPTIONAL :: pun ! now velocity 69 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in), OPTIONAL :: ptra ! now tracer variable 73 70 ! 74 71 REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrds 75 72 !!---------------------------------------------------------------------- 76 73 ! 77 74 CALL wrk_alloc( jpi, jpj, jpk, ztrds ) 78 79 IF( .NOT. ALLOCATED( trdtx ) ) THEN 75 ! 76 IF( .NOT. ALLOCATED( trdtx ) ) THEN ! allocate trdtra arrays 80 77 IF( trd_tra_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'trd_tra : unable to allocate arrays' ) 81 78 ENDIF 82 79 83 ! Control of optional arguments84 IF( ctype == 'TRA' .AND. ktra == jp_tem ) THEN85 IF( PRESENT( ptra ) ) THEN 86 SELECT CASE( ktrd ) ! shift depending on the direction87 CASE( jptra_trd_xad ) ;CALL trd_tra_adv( ptrd, pun, ptra, 'X', trdtx )88 CASE( jptra_trd_yad ) ;CALL trd_tra_adv( ptrd, pun, ptra, 'Y', trdty )89 CASE( jptra_trd_zad ) ;CALL trd_tra_adv( ptrd, pun, ptra, 'Z', trdt )80 IF( ctype == 'TRA' .AND. ktra == jp_tem ) THEN !== Temperature trend ==! 81 ! 82 IF( PRESENT( ptra ) ) THEN ! advection: transform flux into trend 83 SELECT CASE( ktrd ) 84 CASE( jptra_trd_xad ) ; CALL trd_tra_adv( ptrd, pun, ptra, 'X', trdtx ) 85 CASE( jptra_trd_yad ) ; CALL trd_tra_adv( ptrd, pun, ptra, 'Y', trdty ) 86 CASE( jptra_trd_zad ) ; CALL trd_tra_adv( ptrd, pun, ptra, 'Z', trdt ) 90 87 END SELECT 91 ELSE 92 trdt(:,:,:) = ptrd(:,:,:) 93 IF( ktrd == jptra_trd_bbc .OR. ktrd == jptra_trd_qsr ) THEN 94 ztrds(:,:,:) = 0. 95 CALL trd_mod( trdt, ztrds, ktrd, ctype, kt ) 96 END IF 88 ELSE ! other trends: 89 trdt(:,:,:) = ptrd(:,:,:) * tmask(:,:,:) ! mask & store 90 IF( ktrd == jptra_trd_bbc .OR. ktrd == jptra_trd_qsr ) THEN ! qsr, bbc: on temperature only 91 ztrds(:,:,:) = 0._wp 92 CALL trd_mod( trdt, ztrds, ktrd, ctype, kt ) ! send to trd_mod 93 ENDIF 94 ENDIF 95 ! 96 ENDIF 97 98 IF( ctype == 'TRA' .AND. ktra == jp_sal ) THEN !== Salinity trends ==! 99 ! 100 IF( PRESENT( ptra ) ) THEN ! advection: transform the advective flux into a trend 101 SELECT CASE( ktrd ) ! and send T & S trends to trd_mod 102 CASE( jptra_trd_xad ) ; CALL trd_tra_adv( ptrd , pun , ptra, 'X' , ztrds ) 103 CALL trd_mod ( trdtx, ztrds, ktrd, ctype, kt ) 104 CASE( jptra_trd_yad ) ; CALL trd_tra_adv( ptrd , pun , ptra, 'Y' , ztrds ) 105 ; CALL trd_mod ( trdty, ztrds, ktrd, ctype, kt ) 106 CASE( jptra_trd_zad ) ; CALL trd_tra_adv( ptrd , pun , ptra, 'Z' , ztrds ) 107 CALL trd_mod ( trdt , ztrds, ktrd, ctype, kt ) 108 END SELECT 109 ELSE ! other trends: mask and send T & S trends to trd_mod 110 ztrds(:,:,:) = ptrd(:,:,:) * tmask(:,:,:) 111 CALL trd_mod( trdt, ztrds, ktrd, ctype, kt ) 112 ENDIF 113 ! 114 ENDIF 115 116 IF( ctype == 'TRC' ) THEN !== passive tracer trend ==! 117 ! 118 IF( PRESENT( ptra ) ) THEN ! advection: transform flux into a trend 119 SELECT CASE( ktrd ) 120 CASE( jptra_trd_xad ) ; CALL trd_tra_adv( ptrd , pun , ptra, 'X', ztrds ) 121 CASE( jptra_trd_yad ) ; CALL trd_tra_adv( ptrd , pun , ptra, 'Y', ztrds ) 122 CASE( jptra_trd_zad ) ; CALL trd_tra_adv( ptrd , pun , ptra, 'Z', ztrds ) 123 END SELECT 124 ELSE ! other trends: mask 125 ztrds(:,:,:) = ptrd(:,:,:) * tmask(:,:,:) 97 126 END IF 98 END IF 99 100 IF( ctype == 'TRA' .AND. ktra == jp_sal ) THEN 101 IF( PRESENT( ptra ) ) THEN 102 SELECT CASE( ktrd ) ! shift depending on the direction 103 CASE( jptra_trd_xad ) 104 CALL trd_tra_adv( ptrd, pun, ptra, 'X', ztrds ) 105 CALL trd_mod( trdtx, ztrds, ktrd, ctype, kt ) 106 CASE( jptra_trd_yad ) 107 CALL trd_tra_adv( ptrd, pun, ptra, 'Y', ztrds ) 108 CALL trd_mod( trdty, ztrds, ktrd, ctype, kt ) 109 CASE( jptra_trd_zad ) 110 CALL trd_tra_adv( ptrd, pun, ptra, 'Z', ztrds ) 111 CALL trd_mod( trdt , ztrds, ktrd, ctype, kt ) 112 END SELECT 113 ELSE 114 ztrds(:,:,:) = ptrd(:,:,:) 115 CALL trd_mod( trdt, ztrds, ktrd, ctype, kt ) 116 END IF 117 END IF 118 119 IF( ctype == 'TRC' ) THEN 120 ! 121 IF( PRESENT( ptra ) ) THEN 122 SELECT CASE( ktrd ) ! shift depending on the direction 123 CASE( jptra_trd_xad ) 124 CALL trd_tra_adv( ptrd, pun, ptra, 'X', ztrds ) 125 CALL trd_mod_trc( ztrds, ktra, ktrd, kt ) 126 CASE( jptra_trd_yad ) 127 CALL trd_tra_adv( ptrd, pun, ptra, 'Y', ztrds ) 128 CALL trd_mod_trc( ztrds, ktra, ktrd, kt ) 129 CASE( jptra_trd_zad ) 130 CALL trd_tra_adv( ptrd, pun, ptra, 'Z', ztrds ) 131 CALL trd_mod_trc( ztrds, ktra, ktrd, kt ) 132 END SELECT 133 ELSE 134 ztrds(:,:,:) = ptrd(:,:,:) 135 CALL trd_mod_trc( ztrds, ktra, ktrd, kt ) 136 END IF 127 ! 128 CALL trd_mod_trc( ztrds, ktra, ktrd, kt ) ! send trend to trd_mod_trc 137 129 ! 138 130 ENDIF … … 147 139 !! *** ROUTINE trd_tra_adv *** 148 140 !! 149 !! ** Purpose : transformed the i-, j- or k-advective flux into thes 150 !! i-, j- or k-advective trends, resp. 151 !! ** Method : i-advective trends = -un. di-1[T] = -( di-1[fi] - tn di-1[un] ) 152 !! k-advective trends = -un. di-1[T] = -( dj-1[fi] - tn dj-1[un] ) 153 !! k-advective trends = -un. di+1[T] = -( dk+1[fi] - tn dk+1[un] ) 154 !!---------------------------------------------------------------------- 155 REAL(wp) , INTENT(in ), DIMENSION(jpi,jpj,jpk) :: pf ! advective flux in one direction 156 REAL(wp) , INTENT(in ), DIMENSION(jpi,jpj,jpk) :: pun ! now velocity in one direction 157 REAL(wp) , INTENT(in ), DIMENSION(jpi,jpj,jpk) :: ptn ! now or before tracer 158 CHARACTER(len=1), INTENT(in ) :: cdir ! X/Y/Z direction 159 REAL(wp) , INTENT(out), DIMENSION(jpi,jpj,jpk) :: ptrd ! advective trend in one direction 141 !! ** Purpose : transformed a advective flux into a masked advective trends 142 !! 143 !! ** Method : use the following transformation: -div(U.T) = - U grad(T) + T.div(U) 144 !! i-advective trends = -un. di-1[T] = -( di-1[fi] - tn di-1[un] ) 145 !! j-advective trends = -un. di-1[T] = -( dj-1[fi] - tn dj-1[un] ) 146 !! k-advective trends = -un. di+1[T] = -( dk+1[fi] - tn dk+1[un] ) 147 !! where fi is the incoming advective flux. 148 !!---------------------------------------------------------------------- 149 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in ) :: pf ! advective flux in one direction 150 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in ) :: pun ! now velocity in one direction 151 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in ) :: ptn ! now or before tracer 152 CHARACTER(len=1) , INTENT(in ) :: cdir ! X/Y/Z direction 153 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( out) :: ptrd ! advective trend in one direction 160 154 ! 161 155 INTEGER :: ji, jj, jk ! dummy loop indices 162 INTEGER :: ii, ij, ik ! index shift function of the direction 163 REAL(wp) :: zbtr ! local scalar 164 !!---------------------------------------------------------------------- 165 166 SELECT CASE( cdir ) ! shift depending on the direction 167 CASE( 'X' ) ; ii = 1 ; ij = 0 ; ik = 0 ! i-advective trend 168 CASE( 'Y' ) ; ii = 0 ; ij = 1 ; ik = 0 ! j-advective trend 169 CASE( 'Z' ) ; ii = 0 ; ij = 0 ; ik =-1 ! k-advective trend 156 INTEGER :: ii, ij, ik ! index shift as function of the direction 157 !!---------------------------------------------------------------------- 158 ! 159 SELECT CASE( cdir ) ! shift depending on the direction 160 CASE( 'X' ) ; ii = 1 ; ij = 0 ; ik = 0 ! i-trend 161 CASE( 'Y' ) ; ii = 0 ; ij = 1 ; ik = 0 ! j-trend 162 CASE( 'Z' ) ; ii = 0 ; ij = 0 ; ik =-1 ! k-trend 170 163 END SELECT 171 172 ! ! set to zero uncomputed values 173 ptrd(jpi,:,:) = 0.e0 ; ptrd(1,:,:) = 0.e0 174 ptrd(:,jpj,:) = 0.e0 ; ptrd(:,1,:) = 0.e0 175 ptrd(:,:,jpk) = 0.e0 176 ! 177 ! 178 DO jk = 1, jpkm1 164 ! 165 ! ! set to zero uncomputed values 166 ptrd(jpi,:,:) = 0._wp ; ptrd(1,:,:) = 0._wp 167 ptrd(:,jpj,:) = 0._wp ; ptrd(:,1,:) = 0._wp 168 ptrd(:,:,jpk) = 0._wp 169 ! 170 DO jk = 1, jpkm1 ! advective trend 179 171 DO jj = 2, jpjm1 180 172 DO ji = fs_2, fs_jpim1 ! vector opt. 181 zbtr = 1.e0/ ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )182 ptrd(ji,jj,jk) = - zbtr * ( pf (ji,jj,jk) - pf (ji-ii,jj-ij,jk-ik)&183 & - ( pun(ji,jj,jk) - pun(ji-ii,jj-ij,jk-ik) ) * ptn(ji,jj,jk))173 ptrd(ji,jj,jk) = - ( pf (ji,jj,jk) - pf (ji-ii,jj-ij,jk-ik) & 174 & - ( pun(ji,jj,jk) - pun(ji-ii,jj-ij,jk-ik) ) * ptn(ji,jj,jk) ) & 175 & / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) ) * tmask(ji,jj,jk) 184 176 END DO 185 177 END DO … … 188 180 END SUBROUTINE trd_tra_adv 189 181 190 # 182 #else 191 183 !!---------------------------------------------------------------------- 192 184 !! Default case : Dummy module No trend diagnostics … … 196 188 SUBROUTINE trd_tra( kt, ctype, ktra, ktrd, ptrd, pu, ptra ) 197 189 !!---------------------------------------------------------------------- 198 INTEGER , INTENT(in) :: kt ! time step 199 CHARACTER(len=3) , INTENT(in) :: ctype ! tracers trends type 'TRA'/'TRC' 200 INTEGER , INTENT(in) :: ktra ! tracer index 201 INTEGER , INTENT(in) :: ktrd ! tracer trend index 202 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in) :: ptrd ! tracer trend 203 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in), OPTIONAL :: pu ! velocity 204 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in), OPTIONAL :: ptra ! Tracer variable 205 WRITE(*,*) 'trd_3d: You should not have seen this print! error ?', ptrd(1,1,1), ptra(1,1,1), pu(1,1,1), & 206 & ktrd, ktra, ctype, kt 190 CHARACTER(len=3) , INTENT(in) :: ctype 191 INTEGER , INTENT(in) :: kt, ktra, ktrd 192 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in) :: ptrd 193 REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in), OPTIONAL :: pu, ptra ! Tracer variable 194 WRITE(*,*) 'trd_tra: You should not have seen this print! error ?', & 195 & ptrd(1,1,1), ptra(1,1,1), pu(1,1,1), ktrd, ktra, ctype, kt 207 196 END SUBROUTINE trd_tra 208 # endif 197 #endif 198 209 199 !!====================================================================== 210 200 END MODULE trdtra -
branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRD/trdvor.F90
r3294 r3316 4 4 !! Ocean diagnostics: momentum trends 5 5 !!===================================================================== 6 !! History : 1.0 ! 04-2006 (L. Brunier, A-M. Treguier) Original code 7 !! 2.0 ! 04-2008 (C. Talandier) New trends organization 6 !! History : 1.0 ! 2006-01 (L. Brunier, A-M. Treguier) Original code 7 !! 2.0 ! 2008-04 (C. Talandier) New trends organization 8 !! 3.5 ! 2012-02 (G. Madec) regroup beta.V computation with pvo trend 8 9 !!---------------------------------------------------------------------- 9 10 #if defined key_trdvor || defined key_esopa … … 109 110 !! trends output in netCDF format using ioipsl 110 111 !!---------------------------------------------------------------------- 111 !112 112 INTEGER , INTENT(in ) :: ktrd ! ocean trend index 113 113 REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: putrdvor ! u vorticity trend … … 229 229 END DO 230 230 231 ! Save Beta.V term to avoid average before Curl232 ! Beta.V : intergration, noaverage233 IF( ktrd == jpvor_ bev) THEN231 ! Planetary vorticity: 2nd computation (Beta.V term) store the vertical sum 232 ! as Beta.V term need intergration, not average 233 IF( ktrd == jpvor_pvo ) THEN 234 234 zubet(:,:) = zudpvor(:,:) 235 235 zvbet(:,:) = zvdpvor(:,:) 236 ENDIF 237 238 ! Average except for Beta.V 236 DO ji = 1, jpim1 237 DO jj = 1, jpjm1 238 vortrd(ji,jj,jpvor_bev) = ( zvbet(ji+1,jj) - zvbet(ji,jj) & 239 & - ( zubet(ji,jj+1) - zubet(ji,jj) ) ) / ( e1f(ji,jj) * e2f(ji,jj) ) 240 END DO 241 END DO 242 ! Average of the Curl and Surface mask 243 vortrd(:,:,jpvor_bev) = vortrd(:,:,jpvor_bev) * hur(:,:) * fmask(:,:,1) 244 ENDIF 245 ! 246 ! Average 239 247 zudpvor(:,:) = zudpvor(:,:) * hur(:,:) 240 248 zvdpvor(:,:) = zvdpvor(:,:) * hvr(:,:) 241 249 ! 242 250 ! Curl 243 251 DO ji=1,jpim1 … … 247 255 END DO 248 256 END DO 249 250 257 ! Surface mask 251 258 vortrd(:,:,ktrd) = vortrd(:,:,ktrd) * fmask(:,:,1) 252 253 ! Special treatement for the Beta.V term254 ! Compute the Curl of the Beta.V term which is not averaged255 IF( ktrd == jpvor_bev ) THEN256 DO ji=1,jpim1257 DO jj=1,jpjm1258 vortrd(ji,jj,jpvor_bev) = ( zvbet(ji+1,jj) - zvbet(ji,jj) &259 & - ( zubet(ji,jj+1) - zubet(ji,jj) ) ) / ( e1f(ji,jj) * e2f(ji,jj) )260 END DO261 END DO262 263 ! Average on the Curl264 vortrd(:,:,jpvor_bev) = vortrd(:,:,jpvor_bev) * hur(:,:)265 266 ! Surface mask267 vortrd(:,:,jpvor_bev) = vortrd(:,:,jpvor_bev) * fmask(:,:,1)268 ENDIF269 259 270 260 IF( ndebug /= 0 ) THEN … … 330 320 331 321 ! Curl 332 DO ji =1,jpim1333 DO jj =1,jpjm1322 DO ji = 1, jpim1 323 DO jj = 1, jpjm1 334 324 vor_avr(ji,jj) = ( ( zvn(ji+1,jj) - zvn(ji,jj) ) & 335 325 & - ( zun(ji,jj+1) - zun(ji,jj) ) ) / ( e1f(ji,jj) * e2f(ji,jj) ) * fmask(ji,jj,1)
Note: See TracChangeset
for help on using the changeset viewer.