[2030] | 1 | MODULE trczdf |
---|
| 2 | !!============================================================================== |
---|
| 3 | !! *** MODULE trczdf *** |
---|
| 4 | !! Ocean Passive tracers : vertical diffusive trends |
---|
| 5 | !!===================================================================== |
---|
| 6 | !! History : 9.0 ! 2005-11 (G. Madec) Original code |
---|
| 7 | !! NEMO 3.0 ! 2008-01 (C. Ethe, G. Madec) merge TRC-TRA |
---|
| 8 | !!---------------------------------------------------------------------- |
---|
| 9 | #if defined key_top |
---|
| 10 | !!---------------------------------------------------------------------- |
---|
| 11 | !! 'key_top' TOP models |
---|
| 12 | !!---------------------------------------------------------------------- |
---|
| 13 | !! trc_ldf : update the tracer trend with the lateral diffusion |
---|
| 14 | !! ldf_ctl : initialization, namelist read, and parameters control |
---|
| 15 | !!---------------------------------------------------------------------- |
---|
| 16 | USE oce_trc ! ocean dynamics and active tracers |
---|
| 17 | USE trc ! ocean passive tracers variables |
---|
| 18 | USE trcnam_trp ! passive tracers transport namelist variables |
---|
| 19 | USE trazdf_exp ! vertical diffusion: explicit (tra_zdf_exp routine) |
---|
| 20 | USE trazdf_imp ! vertical diffusion: implicit (tra_zdf_imp routine) |
---|
| 21 | USE trdmod_oce |
---|
| 22 | USE trdtra |
---|
[2715] | 23 | USE prtctl_trc ! Print control |
---|
[2030] | 24 | |
---|
| 25 | IMPLICIT NONE |
---|
| 26 | PRIVATE |
---|
| 27 | |
---|
[2715] | 28 | PUBLIC trc_zdf ! called by step.F90 |
---|
| 29 | PUBLIC trc_zdf_alloc ! called by nemogcm.F90 |
---|
[2030] | 30 | |
---|
| 31 | INTEGER :: nzdf = 0 ! type vertical diffusion algorithm used |
---|
| 32 | ! ! defined from ln_zdf... namlist logicals) |
---|
[2715] | 33 | REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) :: r2dt ! vertical profile time-step, = 2 rdttra |
---|
| 34 | ! ! except at nit000 (=rdttra) if neuler=0 |
---|
[2030] | 35 | |
---|
| 36 | !! * Substitutions |
---|
| 37 | # include "domzgr_substitute.h90" |
---|
| 38 | # include "zdfddm_substitute.h90" |
---|
| 39 | # include "vectopt_loop_substitute.h90" |
---|
| 40 | !!---------------------------------------------------------------------- |
---|
[2287] | 41 | !! NEMO/TOP 3.3 , NEMO Consortium (2010) |
---|
[2281] | 42 | !! $Id$ |
---|
[2715] | 43 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[2030] | 44 | !!---------------------------------------------------------------------- |
---|
| 45 | CONTAINS |
---|
| 46 | |
---|
[2715] | 47 | INTEGER FUNCTION trc_zdf_alloc() |
---|
| 48 | !!---------------------------------------------------------------------- |
---|
| 49 | !! *** ROUTINE trc_zdf_alloc *** |
---|
| 50 | !!---------------------------------------------------------------------- |
---|
| 51 | ALLOCATE( r2dt(jpk) , STAT=trc_zdf_alloc ) |
---|
| 52 | ! |
---|
| 53 | IF( trc_zdf_alloc /= 0 ) CALL ctl_warn('trc_zdf_alloc : failed to allocate array.') |
---|
| 54 | ! |
---|
| 55 | END FUNCTION trc_zdf_alloc |
---|
| 56 | |
---|
| 57 | |
---|
[2030] | 58 | SUBROUTINE trc_zdf( kt ) |
---|
| 59 | !!---------------------------------------------------------------------- |
---|
| 60 | !! *** ROUTINE trc_zdf *** |
---|
| 61 | !! |
---|
| 62 | !! ** Purpose : compute the vertical ocean tracer physics. |
---|
| 63 | !!--------------------------------------------------------------------- |
---|
| 64 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
| 65 | ! |
---|
| 66 | INTEGER :: jk, jn |
---|
| 67 | CHARACTER (len=22) :: charout |
---|
| 68 | REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE :: ztrtrd ! 4D workspace |
---|
| 69 | !!--------------------------------------------------------------------- |
---|
| 70 | |
---|
[2148] | 71 | IF( kt == nit000 ) CALL zdf_ctl ! initialisation & control of options |
---|
[2030] | 72 | |
---|
[2052] | 73 | #if ! defined key_pisces |
---|
[2148] | 74 | IF( neuler == 0 .AND. kt == nit000 ) THEN ! at nit000 |
---|
[2517] | 75 | r2dt(:) = rdttrc(:) ! = rdttrc (restarting with Euler time stepping) |
---|
[2148] | 76 | ELSEIF( kt <= nit000 + nn_dttrc ) THEN ! at nit000 or nit000+1 |
---|
[2517] | 77 | r2dt(:) = 2. * rdttrc(:) ! = 2 rdttrc (leapfrog) |
---|
[2030] | 78 | ENDIF |
---|
[2052] | 79 | #else |
---|
[2517] | 80 | r2dt(:) = rdttrc(:) ! = rdttrc (for PISCES use Euler time stepping) |
---|
[2052] | 81 | #endif |
---|
[2030] | 82 | |
---|
| 83 | IF( l_trdtrc ) THEN |
---|
| 84 | ALLOCATE( ztrtrd(jpi,jpj,jpk,jptra) ) ! temporary save of trends |
---|
| 85 | ztrtrd(:,:,:,:) = tra(:,:,:,:) |
---|
| 86 | ENDIF |
---|
| 87 | |
---|
| 88 | SELECT CASE ( nzdf ) ! compute lateral mixing trend and add it to the general trend |
---|
| 89 | CASE ( -1 ) ! esopa: test all possibility with control print |
---|
[2082] | 90 | CALL tra_zdf_exp( kt, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra ) |
---|
[2034] | 91 | WRITE(charout, FMT="('zdf1 ')") ; CALL prt_ctl_trc_info(charout) |
---|
| 92 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
[2082] | 93 | CALL tra_zdf_imp( kt, 'TRC', r2dt, trb, tra, jptra ) |
---|
[2034] | 94 | WRITE(charout, FMT="('zdf2 ')") ; CALL prt_ctl_trc_info(charout) |
---|
| 95 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
[2082] | 96 | CASE ( 0 ) ; CALL tra_zdf_exp( kt, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra ) ! explicit scheme |
---|
| 97 | CASE ( 1 ) ; CALL tra_zdf_imp( kt, 'TRC', r2dt, trb, tra, jptra ) ! implicit scheme |
---|
[2030] | 98 | |
---|
| 99 | END SELECT |
---|
| 100 | |
---|
| 101 | IF( l_trdtra ) THEN ! save the vertical diffusive trends for further diagnostics |
---|
| 102 | DO jn = 1, jptra |
---|
| 103 | DO jk = 1, jpkm1 |
---|
| 104 | ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn) - trb(:,:,jk,jn) ) / r2dt(jk) ) - ztrtrd(:,:,jk,jn) |
---|
| 105 | END DO |
---|
| 106 | CALL trd_tra( kt, 'TRC', jn, jptra_trd_zdf, ztrtrd(:,:,:,jn) ) |
---|
| 107 | END DO |
---|
| 108 | DEALLOCATE( ztrtrd ) |
---|
| 109 | ENDIF |
---|
| 110 | |
---|
| 111 | ! ! print mean trends (used for debugging) |
---|
| 112 | IF( ln_ctl ) THEN |
---|
| 113 | WRITE(charout, FMT="('zdf ')") ; CALL prt_ctl_trc_info(charout) |
---|
| 114 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
| 115 | END IF |
---|
| 116 | ! |
---|
| 117 | END SUBROUTINE trc_zdf |
---|
| 118 | |
---|
| 119 | |
---|
| 120 | SUBROUTINE zdf_ctl |
---|
| 121 | !!---------------------------------------------------------------------- |
---|
| 122 | !! *** ROUTINE zdf_ctl *** |
---|
| 123 | !! |
---|
| 124 | !! ** Purpose : Choose the vertical mixing scheme |
---|
| 125 | !! |
---|
| 126 | !! ** Method : Set nzdf from ln_zdfexp |
---|
| 127 | !! nzdf = 0 explicit (time-splitting) scheme (ln_trczdf_exp=T) |
---|
| 128 | !! = 1 implicit (euler backward) scheme (ln_trczdf_exp=F) |
---|
[2476] | 129 | !! NB: The implicit scheme is required when using : |
---|
| 130 | !! - rotated lateral mixing operator |
---|
| 131 | !! - TKE, GLS or KPP vertical mixing scheme |
---|
[2030] | 132 | !!---------------------------------------------------------------------- |
---|
| 133 | |
---|
| 134 | ! Define the vertical tracer physics scheme |
---|
| 135 | ! ========================================== |
---|
| 136 | |
---|
| 137 | ! Choice from ln_zdfexp already read in namelist in zdfini module |
---|
| 138 | IF( ln_trczdf_exp ) THEN ! use explicit scheme |
---|
| 139 | nzdf = 0 |
---|
| 140 | ELSE ! use implicit scheme |
---|
| 141 | nzdf = 1 |
---|
| 142 | ENDIF |
---|
| 143 | |
---|
| 144 | ! Force implicit schemes |
---|
| 145 | IF( ln_trcldf_iso ) nzdf = 1 ! iso-neutral lateral physics |
---|
| 146 | IF( ln_trcldf_hor .AND. ln_sco ) nzdf = 1 ! horizontal lateral physics in s-coordinate |
---|
[2476] | 147 | #if defined key_zdftke || defined key_zdfgls || defined key_zdfkpp |
---|
| 148 | nzdf = 1 ! TKE, GLS or KPP physics |
---|
[2030] | 149 | #endif |
---|
| 150 | IF( ln_trczdf_exp .AND. nzdf == 1 ) THEN |
---|
[2476] | 151 | CALL ctl_stop( 'trc_zdf : If using the rotated lateral mixing operator or TKE, GLS or KPP vertical scheme ', & |
---|
| 152 | & ' the implicit scheme is required, set ln_trczdf_exp = .false.' ) |
---|
[2030] | 153 | ENDIF |
---|
| 154 | |
---|
| 155 | ! Test: esopa |
---|
| 156 | IF( lk_esopa ) nzdf = -1 ! All schemes used |
---|
| 157 | |
---|
| 158 | IF(lwp) THEN |
---|
| 159 | WRITE(numout,*) |
---|
| 160 | WRITE(numout,*) 'trc:zdf_ctl : vertical passive tracer physics scheme' |
---|
| 161 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
| 162 | IF( nzdf == -1 ) WRITE(numout,*) ' ESOPA test All scheme used' |
---|
| 163 | IF( nzdf == 0 ) WRITE(numout,*) ' Explicit time-splitting scheme' |
---|
| 164 | IF( nzdf == 1 ) WRITE(numout,*) ' Implicit (euler backward) scheme' |
---|
| 165 | ENDIF |
---|
| 166 | |
---|
| 167 | END SUBROUTINE zdf_ctl |
---|
| 168 | #else |
---|
| 169 | !!---------------------------------------------------------------------- |
---|
| 170 | !! Default option Empty module |
---|
| 171 | !!---------------------------------------------------------------------- |
---|
| 172 | CONTAINS |
---|
| 173 | SUBROUTINE trc_zdf( kt ) |
---|
| 174 | INTEGER, INTENT(in) :: kt |
---|
| 175 | WRITE(*,*) 'trc_zdf: You should not have seen this print! error?', kt |
---|
| 176 | END SUBROUTINE trc_zdf |
---|
| 177 | #endif |
---|
| 178 | !!============================================================================== |
---|
| 179 | END MODULE trczdf |
---|