[458] | 1 | MODULE trazdf |
---|
| 2 | !!============================================================================== |
---|
| 3 | !! *** MODULE trazdf *** |
---|
| 4 | !! Ocean active tracers: vertical component of the tracer mixing trend |
---|
| 5 | !!============================================================================== |
---|
[2528] | 6 | !! History : 1.0 ! 2005-11 (G. Madec) Original code |
---|
| 7 | !! 3.0 ! 2008-01 (C. Ethe, G. Madec) merge TRC-TRA |
---|
[458] | 8 | !!---------------------------------------------------------------------- |
---|
[503] | 9 | |
---|
| 10 | !!---------------------------------------------------------------------- |
---|
[458] | 11 | !! tra_zdf : Update the tracer trend with the vertical diffusion |
---|
[2528] | 12 | !! tra_zdf_init : initialisation of the computation |
---|
[458] | 13 | !!---------------------------------------------------------------------- |
---|
| 14 | USE oce ! ocean dynamics and tracers variables |
---|
| 15 | USE dom_oce ! ocean space and time domain variables |
---|
[2715] | 16 | USE domvvl ! variable volume |
---|
| 17 | USE phycst ! physical constant |
---|
[458] | 18 | USE zdf_oce ! ocean vertical physics variables |
---|
[888] | 19 | USE sbc_oce ! surface boundary condition: ocean |
---|
| 20 | USE dynspg_oce |
---|
[458] | 21 | USE trazdf_exp ! vertical diffusion: explicit (tra_zdf_exp routine) |
---|
| 22 | USE trazdf_imp ! vertical diffusion: implicit (tra_zdf_imp routine) |
---|
| 23 | USE ldftra_oce ! ocean active tracers: lateral physics |
---|
[4990] | 24 | USE trd_oce ! trends: ocean variables |
---|
| 25 | USE trdtra ! trends manager: tracers |
---|
| 26 | ! |
---|
[458] | 27 | USE in_out_manager ! I/O manager |
---|
| 28 | USE prtctl ! Print control |
---|
[592] | 29 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
[2715] | 30 | USE lib_mpp ! MPP library |
---|
[3294] | 31 | USE wrk_nemo ! Memory allocation |
---|
| 32 | USE timing ! Timing |
---|
[592] | 33 | |
---|
[458] | 34 | IMPLICIT NONE |
---|
| 35 | PRIVATE |
---|
| 36 | |
---|
[2715] | 37 | PUBLIC tra_zdf ! routine called by step.F90 |
---|
| 38 | PUBLIC tra_zdf_init ! routine called by nemogcm.F90 |
---|
[458] | 39 | |
---|
[2715] | 40 | INTEGER :: nzdf = 0 ! type vertical diffusion algorithm used (defined from ln_zdf... namlist logicals) |
---|
[458] | 41 | |
---|
| 42 | !! * Substitutions |
---|
| 43 | # include "domzgr_substitute.h90" |
---|
| 44 | # include "zdfddm_substitute.h90" |
---|
| 45 | # include "vectopt_loop_substitute.h90" |
---|
| 46 | !!---------------------------------------------------------------------- |
---|
[4990] | 47 | !! NEMO/OPA 3.7 , NEMO Consortium (2014) |
---|
[888] | 48 | !! $Id$ |
---|
[2715] | 49 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[458] | 50 | !!---------------------------------------------------------------------- |
---|
[2715] | 51 | CONTAINS |
---|
[458] | 52 | |
---|
| 53 | SUBROUTINE tra_zdf( kt ) |
---|
| 54 | !!---------------------------------------------------------------------- |
---|
| 55 | !! *** ROUTINE tra_zdf *** |
---|
| 56 | !! |
---|
| 57 | !! ** Purpose : compute the vertical ocean tracer physics. |
---|
| 58 | !!--------------------------------------------------------------------- |
---|
| 59 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
[2528] | 60 | !! |
---|
[458] | 61 | INTEGER :: jk ! Dummy loop indices |
---|
[3294] | 62 | REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrdt, ztrds ! 3D workspace |
---|
[458] | 63 | !!--------------------------------------------------------------------- |
---|
[3294] | 64 | ! |
---|
| 65 | IF( nn_timing == 1 ) CALL timing_start('tra_zdf') |
---|
| 66 | ! |
---|
[458] | 67 | IF( neuler == 0 .AND. kt == nit000 ) THEN ! at nit000 |
---|
[2715] | 68 | r2dtra(:) = rdttra(:) ! = rdtra (restarting with Euler time stepping) |
---|
[458] | 69 | ELSEIF( kt <= nit000 + 1) THEN ! at nit000 or nit000+1 |
---|
[2715] | 70 | r2dtra(:) = 2. * rdttra(:) ! = 2 rdttra (leapfrog) |
---|
[458] | 71 | ENDIF |
---|
| 72 | |
---|
[2528] | 73 | IF( l_trdtra ) THEN !* Save ta and sa trends |
---|
[3294] | 74 | CALL wrk_alloc( jpi, jpj, jpk, ztrdt, ztrds ) |
---|
| 75 | ztrdt(:,:,:) = tsa(:,:,:,jp_tem) |
---|
| 76 | ztrds(:,:,:) = tsa(:,:,:,jp_sal) |
---|
[458] | 77 | ENDIF |
---|
| 78 | |
---|
| 79 | SELECT CASE ( nzdf ) ! compute lateral mixing trend and add it to the general trend |
---|
[3294] | 80 | CASE ( 0 ) ; CALL tra_zdf_exp( kt, nit000, 'TRA', r2dtra, nn_zdfexp, tsb, tsa, jpts ) ! explicit scheme |
---|
| 81 | CASE ( 1 ) ; CALL tra_zdf_imp( kt, nit000, 'TRA', r2dtra, tsb, tsa, jpts ) ! implicit scheme |
---|
[458] | 82 | CASE ( -1 ) ! esopa: test all possibility with control print |
---|
[3294] | 83 | CALL tra_zdf_exp( kt, nit000, 'TRA', r2dtra, nn_zdfexp, tsb, tsa, jpts ) |
---|
[2528] | 84 | CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' zdf0 - Ta: ', mask1=tmask, & |
---|
| 85 | & tab3d_2=tsa(:,:,:,jp_sal), clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) |
---|
[3294] | 86 | CALL tra_zdf_imp( kt, nit000, 'TRA', r2dtra, tsb, tsa, jpts ) |
---|
[2528] | 87 | CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' zdf1 - Ta: ', mask1=tmask, & |
---|
| 88 | & tab3d_2=tsa(:,:,:,jp_sal), clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) |
---|
[458] | 89 | END SELECT |
---|
[5462] | 90 | ! DRAKKAR SSS control { |
---|
| 91 | ! JMM avoid negative salinities near river outlet ! Ugly fix |
---|
| 92 | ! JMM : restore negative salinities to small salinities: |
---|
| 93 | WHERE ( tsa(:,:,:,jp_sal) < 0._wp ) tsa(:,:,:,jp_sal) = 0.1_wp |
---|
[458] | 94 | |
---|
[1110] | 95 | IF( l_trdtra ) THEN ! save the vertical diffusive trends for further diagnostics |
---|
| 96 | DO jk = 1, jpkm1 |
---|
[2715] | 97 | ztrdt(:,:,jk) = ( ( tsa(:,:,jk,jp_tem) - tsb(:,:,jk,jp_tem) ) / r2dtra(jk) ) - ztrdt(:,:,jk) |
---|
| 98 | ztrds(:,:,jk) = ( ( tsa(:,:,jk,jp_sal) - tsb(:,:,jk,jp_sal) ) / r2dtra(jk) ) - ztrds(:,:,jk) |
---|
[1110] | 99 | END DO |
---|
[4990] | 100 | CALL lbc_lnk( ztrdt, 'T', 1. ) |
---|
| 101 | CALL lbc_lnk( ztrds, 'T', 1. ) |
---|
| 102 | CALL trd_tra( kt, 'TRA', jp_tem, jptra_zdf, ztrdt ) |
---|
| 103 | CALL trd_tra( kt, 'TRA', jp_sal, jptra_zdf, ztrds ) |
---|
[3294] | 104 | CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds ) |
---|
[1110] | 105 | ENDIF |
---|
| 106 | |
---|
| 107 | ! ! print mean trends (used for debugging) |
---|
[2528] | 108 | IF(ln_ctl) CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' zdf - Ta: ', mask1=tmask, & |
---|
| 109 | & tab3d_2=tsa(:,:,:,jp_sal), clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) |
---|
[2715] | 110 | ! |
---|
[3294] | 111 | IF( nn_timing == 1 ) CALL timing_stop('tra_zdf') |
---|
| 112 | ! |
---|
[458] | 113 | END SUBROUTINE tra_zdf |
---|
| 114 | |
---|
| 115 | |
---|
[2528] | 116 | SUBROUTINE tra_zdf_init |
---|
[458] | 117 | !!---------------------------------------------------------------------- |
---|
[2528] | 118 | !! *** ROUTINE tra_zdf_init *** |
---|
[458] | 119 | !! |
---|
| 120 | !! ** Purpose : Choose the vertical mixing scheme |
---|
| 121 | !! |
---|
[789] | 122 | !! ** Method : Set nzdf from ln_zdfexp |
---|
[458] | 123 | !! nzdf = 0 explicit (time-splitting) scheme (ln_zdfexp=T) |
---|
| 124 | !! = 1 implicit (euler backward) scheme (ln_zdfexp=F) |
---|
| 125 | !! NB: rotation of lateral mixing operator or TKE or KPP scheme, |
---|
| 126 | !! the implicit scheme is required. |
---|
| 127 | !!---------------------------------------------------------------------- |
---|
| 128 | USE zdftke |
---|
[2528] | 129 | USE zdfgls |
---|
[458] | 130 | USE zdfkpp |
---|
| 131 | !!---------------------------------------------------------------------- |
---|
| 132 | |
---|
| 133 | ! Choice from ln_zdfexp already read in namelist in zdfini module |
---|
[2528] | 134 | IF( ln_zdfexp ) THEN ; nzdf = 0 ! use explicit scheme |
---|
| 135 | ELSE ; nzdf = 1 ! use implicit scheme |
---|
[458] | 136 | ENDIF |
---|
| 137 | |
---|
| 138 | ! Force implicit schemes |
---|
[2528] | 139 | IF( lk_zdftke .OR. lk_zdfgls .OR. lk_zdfkpp ) nzdf = 1 ! TKE, GLS or KPP physics |
---|
| 140 | IF( ln_traldf_iso ) nzdf = 1 ! iso-neutral lateral physics |
---|
| 141 | IF( ln_traldf_hor .AND. ln_sco ) nzdf = 1 ! horizontal lateral physics in s-coordinate |
---|
| 142 | IF( ln_zdfexp .AND. nzdf == 1 ) CALL ctl_stop( 'tra_zdf : If using the rotation of lateral mixing operator', & |
---|
| 143 | & ' TKE or KPP scheme, the implicit scheme is required, set ln_zdfexp = .false.' ) |
---|
[458] | 144 | |
---|
| 145 | ! Test: esopa |
---|
| 146 | IF( lk_esopa ) nzdf = -1 ! All schemes used |
---|
| 147 | |
---|
| 148 | IF(lwp) THEN |
---|
| 149 | WRITE(numout,*) |
---|
[2528] | 150 | WRITE(numout,*) 'tra_zdf_init : vertical tracer physics scheme' |
---|
[458] | 151 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
| 152 | IF( nzdf == -1 ) WRITE(numout,*) ' ESOPA test All scheme used' |
---|
| 153 | IF( nzdf == 0 ) WRITE(numout,*) ' Explicit time-splitting scheme' |
---|
| 154 | IF( nzdf == 1 ) WRITE(numout,*) ' Implicit (euler backward) scheme' |
---|
| 155 | ENDIF |
---|
[2528] | 156 | ! |
---|
| 157 | END SUBROUTINE tra_zdf_init |
---|
[458] | 158 | |
---|
| 159 | !!============================================================================== |
---|
| 160 | END MODULE trazdf |
---|