[941] | 1 | MODULE trcnxt |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE trcnxt *** |
---|
| 4 | !! Ocean passive tracers: time stepping on passives tracers |
---|
| 5 | !!====================================================================== |
---|
[2528] | 6 | !! History : 7.0 ! 1991-11 (G. Madec) Original code |
---|
| 7 | !! ! 1993-03 (M. Guyon) symetrical conditions |
---|
| 8 | !! ! 1995-02 (M. Levy) passive tracers |
---|
| 9 | !! ! 1996-02 (G. Madec & M. Imbard) opa release 8.0 |
---|
| 10 | !! 8.0 ! 1996-04 (A. Weaver) Euler forward step |
---|
| 11 | !! 8.2 ! 1999-02 (G. Madec, N. Grima) semi-implicit pressure grad. |
---|
| 12 | !! NEMO 1.0 ! 2002-08 (G. Madec) F90: Free form and module |
---|
| 13 | !! ! 2002-08 (G. Madec) F90: Free form and module |
---|
| 14 | !! ! 2002-11 (C. Talandier, A-M Treguier) Open boundaries |
---|
| 15 | !! ! 2004-03 (C. Ethe) passive tracers |
---|
| 16 | !! ! 2007-02 (C. Deltel) Diagnose ML trends for passive tracers |
---|
| 17 | !! 2.0 ! 2006-02 (L. Debreu, C. Mazauric) Agrif implementation |
---|
| 18 | !! 3.0 ! 2008-06 (G. Madec) time stepping always done in trazdf |
---|
| 19 | !! 3.1 ! 2009-02 (G. Madec, R. Benshila) re-introduce the vvl option |
---|
| 20 | !! 3.3 ! 2010-06 (C. Ethe, G. Madec) Merge TRA-TRC |
---|
[1175] | 21 | !!---------------------------------------------------------------------- |
---|
[941] | 22 | #if defined key_top |
---|
| 23 | !!---------------------------------------------------------------------- |
---|
| 24 | !! 'key_top' TOP models |
---|
| 25 | !!---------------------------------------------------------------------- |
---|
| 26 | !! trc_nxt : time stepping on passive tracers |
---|
| 27 | !!---------------------------------------------------------------------- |
---|
| 28 | USE oce_trc ! ocean dynamics and tracers variables |
---|
[2528] | 29 | USE trc ! ocean passive tracers variables |
---|
[941] | 30 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
| 31 | USE prtctl_trc ! Print control for debbuging |
---|
[2528] | 32 | USE trdmod_oce |
---|
| 33 | USE trdtra |
---|
| 34 | USE tranxt |
---|
| 35 | # if defined key_agrif |
---|
[941] | 36 | USE agrif_top_update |
---|
| 37 | USE agrif_top_interp |
---|
[2528] | 38 | # endif |
---|
[941] | 39 | |
---|
| 40 | IMPLICIT NONE |
---|
| 41 | PRIVATE |
---|
| 42 | |
---|
[2715] | 43 | PUBLIC trc_nxt ! routine called by step.F90 |
---|
| 44 | PUBLIC trc_nxt_alloc ! routine called by nemogcm.F90 |
---|
[2528] | 45 | |
---|
[2715] | 46 | REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) :: r2dt |
---|
| 47 | |
---|
[941] | 48 | !!---------------------------------------------------------------------- |
---|
[2528] | 49 | !! NEMO/TOP 3.3 , NEMO Consortium (2010) |
---|
[1152] | 50 | !! $Id$ |
---|
[2715] | 51 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[941] | 52 | !!---------------------------------------------------------------------- |
---|
| 53 | CONTAINS |
---|
| 54 | |
---|
[2715] | 55 | INTEGER FUNCTION trc_nxt_alloc() |
---|
| 56 | !!---------------------------------------------------------------------- |
---|
| 57 | !! *** ROUTINE trc_nxt_alloc *** |
---|
| 58 | !!---------------------------------------------------------------------- |
---|
| 59 | ALLOCATE( r2dt(jpk), STAT=trc_nxt_alloc ) |
---|
| 60 | ! |
---|
| 61 | IF( trc_nxt_alloc /= 0 ) CALL ctl_warn('trc_nxt_alloc : failed to allocate array') |
---|
| 62 | ! |
---|
| 63 | END FUNCTION trc_nxt_alloc |
---|
| 64 | |
---|
| 65 | |
---|
[941] | 66 | SUBROUTINE trc_nxt( kt ) |
---|
| 67 | !!---------------------------------------------------------------------- |
---|
| 68 | !! *** ROUTINE trcnxt *** |
---|
| 69 | !! |
---|
| 70 | !! ** Purpose : Compute the passive tracers fields at the |
---|
| 71 | !! next time-step from their temporal trends and swap the fields. |
---|
| 72 | !! |
---|
| 73 | !! ** Method : Apply lateral boundary conditions on (ua,va) through |
---|
| 74 | !! call to lbc_lnk routine |
---|
| 75 | !! default: |
---|
| 76 | !! arrays swap |
---|
| 77 | !! (trn) = (tra) ; (tra) = (0,0) |
---|
| 78 | !! (trb) = (trn) |
---|
| 79 | !! |
---|
| 80 | !! For Arakawa or TVD Scheme : |
---|
| 81 | !! A Asselin time filter applied on now tracers (trn) to avoid |
---|
| 82 | !! the divergence of two consecutive time-steps and tr arrays |
---|
| 83 | !! to prepare the next time_step: |
---|
| 84 | !! (trb) = (trn) + atfp [ (trb) + (tra) - 2 (trn) ] |
---|
| 85 | !! (trn) = (tra) ; (tra) = (0,0) |
---|
| 86 | !! |
---|
| 87 | !! |
---|
| 88 | !! ** Action : - update trb, trn |
---|
| 89 | !!---------------------------------------------------------------------- |
---|
[1271] | 90 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
[2715] | 91 | ! |
---|
[2528] | 92 | INTEGER :: jk, jn ! dummy loop indices |
---|
[941] | 93 | REAL(wp) :: zfact ! temporary scalar |
---|
| 94 | CHARACTER (len=22) :: charout |
---|
[2528] | 95 | REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE :: ztrdt |
---|
[941] | 96 | !!---------------------------------------------------------------------- |
---|
| 97 | |
---|
[2528] | 98 | IF( kt == nit000 .AND. lwp ) THEN |
---|
[941] | 99 | WRITE(numout,*) |
---|
| 100 | WRITE(numout,*) 'trc_nxt : time stepping on passive tracers' |
---|
| 101 | ENDIF |
---|
| 102 | |
---|
[2528] | 103 | ! Update after tracer on domain lateral boundaries |
---|
[941] | 104 | DO jn = 1, jptra |
---|
| 105 | CALL lbc_lnk( tra(:,:,:,jn), 'T', 1. ) |
---|
[2528] | 106 | END DO |
---|
[941] | 107 | |
---|
| 108 | |
---|
| 109 | #if defined key_obc |
---|
[2528] | 110 | !! CALL obc_trc( kt ) ! OBC open boundaries |
---|
[941] | 111 | #endif |
---|
[2528] | 112 | #if defined key_bdy |
---|
| 113 | !! CALL bdy_trc( kt ) ! BDY open boundaries |
---|
| 114 | #endif |
---|
[941] | 115 | #if defined key_agrif |
---|
[2528] | 116 | CALL Agrif_trc ! AGRIF zoom boundaries |
---|
[941] | 117 | #endif |
---|
| 118 | |
---|
| 119 | |
---|
[2528] | 120 | ! set time step size (Euler/Leapfrog) |
---|
| 121 | IF( neuler == 0 .AND. kt == nit000) THEN ; r2dt(:) = rdttrc(:) ! at nit000 (Euler) |
---|
| 122 | ELSEIF( kt <= nit000 + 1 ) THEN ; r2dt(:) = 2.* rdttrc(:) ! at nit000 or nit000+1 (Leapfrog) |
---|
| 123 | ENDIF |
---|
[941] | 124 | |
---|
[2528] | 125 | ! trends computation initialisation |
---|
| 126 | IF( l_trdtrc ) THEN |
---|
| 127 | ALLOCATE( ztrdt(jpi,jpj,jpk,jptra) ) !* store now fields before applying the Asselin filter |
---|
| 128 | ztrdt(:,:,:,:) = trn(:,:,:,:) |
---|
| 129 | ENDIF |
---|
| 130 | ! Leap-Frog + Asselin filter time stepping |
---|
| 131 | IF( neuler == 0 .AND. kt == nit000 ) THEN ! Euler time-stepping at first time-step |
---|
| 132 | ! ! (only swap) |
---|
| 133 | DO jn = 1, jptra |
---|
| 134 | DO jk = 1, jpkm1 |
---|
| 135 | trn(:,:,jk,jn) = tra(:,:,jk,jn) |
---|
| 136 | END DO |
---|
| 137 | END DO |
---|
| 138 | ! |
---|
| 139 | ELSE |
---|
| 140 | ! Leap-Frog + Asselin filter time stepping |
---|
| 141 | IF( lk_vvl ) THEN ; CALL tra_nxt_vvl( kt, 'TRC', trb, trn, tra, jptra ) ! variable volume level (vvl) |
---|
| 142 | ELSE ; CALL tra_nxt_fix( kt, 'TRC', trb, trn, tra, jptra ) ! fixed volume level |
---|
| 143 | ENDIF |
---|
| 144 | ENDIF |
---|
[1175] | 145 | |
---|
[2528] | 146 | #if defined key_agrif |
---|
| 147 | ! Update tracer at AGRIF zoom boundaries |
---|
| 148 | IF( .NOT.Agrif_Root() ) CALL Agrif_Update_Trc( kt ) ! children only |
---|
| 149 | #endif |
---|
[941] | 150 | |
---|
[2528] | 151 | ! trends computation |
---|
| 152 | IF( l_trdtrc ) THEN ! trends |
---|
| 153 | DO jn = 1, jptra |
---|
| 154 | DO jk = 1, jpkm1 |
---|
| 155 | zfact = 1.e0 / r2dt(jk) |
---|
| 156 | ztrdt(:,:,jk,jn) = ( trb(:,:,jk,jn) - ztrdt(:,:,jk,jn) ) * zfact |
---|
| 157 | CALL trd_tra( kt, 'TRC', jn, jptra_trd_atf, ztrdt ) |
---|
[1175] | 158 | END DO |
---|
[2528] | 159 | END DO |
---|
| 160 | DEALLOCATE( ztrdt ) |
---|
| 161 | END IF |
---|
| 162 | ! |
---|
[941] | 163 | IF(ln_ctl) THEN ! print mean trends (used for debugging) |
---|
| 164 | WRITE(charout, FMT="('nxt')") |
---|
| 165 | CALL prt_ctl_trc_info(charout) |
---|
| 166 | CALL prt_ctl_trc(tab4d=trn, mask=tmask, clinfo=ctrcnm) |
---|
| 167 | ENDIF |
---|
[2528] | 168 | ! |
---|
[941] | 169 | END SUBROUTINE trc_nxt |
---|
| 170 | |
---|
| 171 | #else |
---|
| 172 | !!---------------------------------------------------------------------- |
---|
| 173 | !! Default option Empty module |
---|
| 174 | !!---------------------------------------------------------------------- |
---|
| 175 | CONTAINS |
---|
| 176 | SUBROUTINE trc_nxt( kt ) |
---|
| 177 | INTEGER, INTENT(in) :: kt |
---|
| 178 | WRITE(*,*) 'trc_nxt: You should not have seen this print! error?', kt |
---|
| 179 | END SUBROUTINE trc_nxt |
---|
| 180 | #endif |
---|
| 181 | !!====================================================================== |
---|
| 182 | END MODULE trcnxt |
---|