[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 |
---|
[4946] | 32 | USE trd_oce |
---|
[2528] | 33 | USE trdtra |
---|
| 34 | USE tranxt |
---|
| 35 | # if defined key_agrif |
---|
[941] | 36 | USE agrif_top_interp |
---|
[2528] | 37 | # endif |
---|
[941] | 38 | |
---|
| 39 | IMPLICIT NONE |
---|
| 40 | PRIVATE |
---|
| 41 | |
---|
[2715] | 42 | PUBLIC trc_nxt ! routine called by step.F90 |
---|
| 43 | PUBLIC trc_nxt_alloc ! routine called by nemogcm.F90 |
---|
[2528] | 44 | |
---|
[2715] | 45 | REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) :: r2dt |
---|
| 46 | |
---|
[941] | 47 | !!---------------------------------------------------------------------- |
---|
[2528] | 48 | !! NEMO/TOP 3.3 , NEMO Consortium (2010) |
---|
[1152] | 49 | !! $Id$ |
---|
[2715] | 50 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[941] | 51 | !!---------------------------------------------------------------------- |
---|
| 52 | CONTAINS |
---|
| 53 | |
---|
[2715] | 54 | INTEGER FUNCTION trc_nxt_alloc() |
---|
| 55 | !!---------------------------------------------------------------------- |
---|
| 56 | !! *** ROUTINE trc_nxt_alloc *** |
---|
| 57 | !!---------------------------------------------------------------------- |
---|
| 58 | ALLOCATE( r2dt(jpk), STAT=trc_nxt_alloc ) |
---|
| 59 | ! |
---|
| 60 | IF( trc_nxt_alloc /= 0 ) CALL ctl_warn('trc_nxt_alloc : failed to allocate array') |
---|
| 61 | ! |
---|
| 62 | END FUNCTION trc_nxt_alloc |
---|
| 63 | |
---|
| 64 | |
---|
[941] | 65 | SUBROUTINE trc_nxt( kt ) |
---|
| 66 | !!---------------------------------------------------------------------- |
---|
| 67 | !! *** ROUTINE trcnxt *** |
---|
| 68 | !! |
---|
| 69 | !! ** Purpose : Compute the passive tracers fields at the |
---|
| 70 | !! next time-step from their temporal trends and swap the fields. |
---|
| 71 | !! |
---|
| 72 | !! ** Method : Apply lateral boundary conditions on (ua,va) through |
---|
| 73 | !! call to lbc_lnk routine |
---|
| 74 | !! default: |
---|
| 75 | !! arrays swap |
---|
| 76 | !! (trn) = (tra) ; (tra) = (0,0) |
---|
| 77 | !! (trb) = (trn) |
---|
| 78 | !! |
---|
| 79 | !! For Arakawa or TVD Scheme : |
---|
| 80 | !! A Asselin time filter applied on now tracers (trn) to avoid |
---|
| 81 | !! the divergence of two consecutive time-steps and tr arrays |
---|
| 82 | !! to prepare the next time_step: |
---|
| 83 | !! (trb) = (trn) + atfp [ (trb) + (tra) - 2 (trn) ] |
---|
| 84 | !! (trn) = (tra) ; (tra) = (0,0) |
---|
| 85 | !! |
---|
| 86 | !! |
---|
| 87 | !! ** Action : - update trb, trn |
---|
| 88 | !!---------------------------------------------------------------------- |
---|
[1271] | 89 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
[2715] | 90 | ! |
---|
[2528] | 91 | INTEGER :: jk, jn ! dummy loop indices |
---|
[941] | 92 | REAL(wp) :: zfact ! temporary scalar |
---|
| 93 | CHARACTER (len=22) :: charout |
---|
[3294] | 94 | REAL(wp), POINTER, DIMENSION(:,:,:,:) :: ztrdt |
---|
[941] | 95 | !!---------------------------------------------------------------------- |
---|
[3294] | 96 | ! |
---|
| 97 | IF( nn_timing == 1 ) CALL timing_start('trc_nxt') |
---|
| 98 | ! |
---|
| 99 | IF( kt == nittrc000 .AND. lwp ) THEN |
---|
[941] | 100 | WRITE(numout,*) |
---|
| 101 | WRITE(numout,*) 'trc_nxt : time stepping on passive tracers' |
---|
| 102 | ENDIF |
---|
| 103 | |
---|
[2528] | 104 | ! Update after tracer on domain lateral boundaries |
---|
[941] | 105 | DO jn = 1, jptra |
---|
| 106 | CALL lbc_lnk( tra(:,:,:,jn), 'T', 1. ) |
---|
[2528] | 107 | END DO |
---|
[941] | 108 | |
---|
| 109 | |
---|
[2528] | 110 | #if defined key_bdy |
---|
| 111 | !! CALL bdy_trc( kt ) ! BDY open boundaries |
---|
| 112 | #endif |
---|
[941] | 113 | #if defined key_agrif |
---|
[2528] | 114 | CALL Agrif_trc ! AGRIF zoom boundaries |
---|
[941] | 115 | #endif |
---|
| 116 | |
---|
| 117 | |
---|
[2528] | 118 | ! set time step size (Euler/Leapfrog) |
---|
[3294] | 119 | IF( neuler == 0 .AND. kt == nittrc000 ) THEN ; r2dt(:) = rdttrc(:) ! at nittrc000 (Euler) |
---|
| 120 | ELSEIF( kt <= nittrc000 + 1 ) THEN ; r2dt(:) = 2.* rdttrc(:) ! at nit000 or nit000+1 (Leapfrog) |
---|
[2528] | 121 | ENDIF |
---|
[941] | 122 | |
---|
[2528] | 123 | ! trends computation initialisation |
---|
| 124 | IF( l_trdtrc ) THEN |
---|
[3294] | 125 | CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrdt ) !* store now fields before applying the Asselin filter |
---|
[2528] | 126 | ztrdt(:,:,:,:) = trn(:,:,:,:) |
---|
| 127 | ENDIF |
---|
| 128 | ! Leap-Frog + Asselin filter time stepping |
---|
[3294] | 129 | IF( neuler == 0 .AND. kt == nittrc000 ) THEN ! Euler time-stepping at first time-step |
---|
| 130 | ! ! (only swap) |
---|
[2528] | 131 | DO jn = 1, jptra |
---|
| 132 | DO jk = 1, jpkm1 |
---|
| 133 | trn(:,:,jk,jn) = tra(:,:,jk,jn) |
---|
| 134 | END DO |
---|
| 135 | END DO |
---|
| 136 | ! |
---|
| 137 | ELSE |
---|
| 138 | ! Leap-Frog + Asselin filter time stepping |
---|
[3294] | 139 | IF( lk_vvl ) THEN ; CALL tra_nxt_vvl( kt, nittrc000, 'TRC', trb, trn, tra, jptra ) ! variable volume level (vvl) |
---|
| 140 | ELSE ; CALL tra_nxt_fix( kt, nittrc000, 'TRC', trb, trn, tra, jptra ) ! fixed volume level |
---|
[2528] | 141 | ENDIF |
---|
| 142 | ENDIF |
---|
[1175] | 143 | |
---|
[2528] | 144 | ! trends computation |
---|
| 145 | IF( l_trdtrc ) THEN ! trends |
---|
| 146 | DO jn = 1, jptra |
---|
| 147 | DO jk = 1, jpkm1 |
---|
| 148 | zfact = 1.e0 / r2dt(jk) |
---|
| 149 | ztrdt(:,:,jk,jn) = ( trb(:,:,jk,jn) - ztrdt(:,:,jk,jn) ) * zfact |
---|
[4946] | 150 | CALL trd_tra( kt, 'TRC', jn, jptra_atf, ztrdt ) |
---|
[1175] | 151 | END DO |
---|
[2528] | 152 | END DO |
---|
[3294] | 153 | CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrdt ) |
---|
[2528] | 154 | END IF |
---|
| 155 | ! |
---|
[941] | 156 | IF(ln_ctl) THEN ! print mean trends (used for debugging) |
---|
| 157 | WRITE(charout, FMT="('nxt')") |
---|
| 158 | CALL prt_ctl_trc_info(charout) |
---|
| 159 | CALL prt_ctl_trc(tab4d=trn, mask=tmask, clinfo=ctrcnm) |
---|
| 160 | ENDIF |
---|
[2528] | 161 | ! |
---|
[3294] | 162 | IF( nn_timing == 1 ) CALL timing_stop('trc_nxt') |
---|
| 163 | ! |
---|
[941] | 164 | END SUBROUTINE trc_nxt |
---|
| 165 | |
---|
| 166 | #else |
---|
| 167 | !!---------------------------------------------------------------------- |
---|
| 168 | !! Default option Empty module |
---|
| 169 | !!---------------------------------------------------------------------- |
---|
| 170 | CONTAINS |
---|
| 171 | SUBROUTINE trc_nxt( kt ) |
---|
| 172 | INTEGER, INTENT(in) :: kt |
---|
| 173 | WRITE(*,*) 'trc_nxt: You should not have seen this print! error?', kt |
---|
| 174 | END SUBROUTINE trc_nxt |
---|
| 175 | #endif |
---|
| 176 | !!====================================================================== |
---|
| 177 | END MODULE trcnxt |
---|