[268] | 1 | MODULE trcini |
---|
[945] | 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE trcini *** |
---|
| 4 | !! TOP : Manage the passive tracer initialization |
---|
| 5 | !!====================================================================== |
---|
[2715] | 6 | !! History : - ! 1991-03 (O. Marti) original code |
---|
| 7 | !! 1.0 ! 2005-03 (O. Aumont, A. El Moussaoui) F90 |
---|
| 8 | !! 2.0 ! 2005-10 (C. Ethe, G. Madec) revised architecture |
---|
| 9 | !! 4.0 ! 2011-01 (A. R. Porter, STFC Daresbury) dynamical allocation |
---|
[274] | 10 | !!---------------------------------------------------------------------- |
---|
[1011] | 11 | #if defined key_top |
---|
| 12 | !!---------------------------------------------------------------------- |
---|
| 13 | !! 'key_top' TOP models |
---|
| 14 | !!---------------------------------------------------------------------- |
---|
[2715] | 15 | !! trc_init : Initialization for passive tracer |
---|
| 16 | !! top_alloc : allocate the TOP arrays |
---|
[1011] | 17 | !!---------------------------------------------------------------------- |
---|
| 18 | USE oce_trc |
---|
| 19 | USE trc |
---|
| 20 | USE trcrst |
---|
[2528] | 21 | USE trcnam ! Namelist read |
---|
[1254] | 22 | USE trcini_cfc ! CFC initialisation |
---|
| 23 | USE trcini_lobster ! LOBSTER initialisation |
---|
| 24 | USE trcini_pisces ! PISCES initialisation |
---|
| 25 | USE trcini_c14b ! C14 bomb initialisation |
---|
| 26 | USE trcini_my_trc ! MY_TRC initialisation |
---|
[1457] | 27 | USE trcdta |
---|
| 28 | USE daymod |
---|
[2528] | 29 | USE zpshde ! partial step: hor. derivative (zps_hde routine) |
---|
[1011] | 30 | USE prtctl_trc ! Print control passive tracers (prt_ctl_trc_init routine) |
---|
| 31 | |
---|
[335] | 32 | IMPLICIT NONE |
---|
| 33 | PRIVATE |
---|
[1011] | 34 | |
---|
[2528] | 35 | PUBLIC trc_init ! called by opa |
---|
[268] | 36 | |
---|
[1011] | 37 | !! * Substitutions |
---|
| 38 | # include "domzgr_substitute.h90" |
---|
[2715] | 39 | !!---------------------------------------------------------------------- |
---|
| 40 | !! NEMO/TOP 4.0 , NEMO Consortium (2011) |
---|
| 41 | !! $Id$ |
---|
| 42 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
| 43 | !!---------------------------------------------------------------------- |
---|
[335] | 44 | CONTAINS |
---|
[1011] | 45 | |
---|
[2528] | 46 | SUBROUTINE trc_init |
---|
[1011] | 47 | !!--------------------------------------------------------------------- |
---|
[2528] | 48 | !! *** ROUTINE trc_init *** |
---|
[335] | 49 | !! |
---|
[1011] | 50 | !! ** Purpose : Initialization of the passive tracer fields |
---|
| 51 | !! |
---|
| 52 | !! ** Method : - read namelist |
---|
| 53 | !! - control the consistancy |
---|
| 54 | !! - compute specific initialisations |
---|
| 55 | !! - set initial tracer fields (either read restart |
---|
| 56 | !! or read data or analytical formulation |
---|
| 57 | !!--------------------------------------------------------------------- |
---|
| 58 | INTEGER :: jk, jn ! dummy loop indices |
---|
| 59 | CHARACTER (len=25) :: charout |
---|
| 60 | !!--------------------------------------------------------------------- |
---|
| 61 | |
---|
[945] | 62 | IF(lwp) WRITE(numout,*) |
---|
[2528] | 63 | IF(lwp) WRITE(numout,*) 'trc_init : initial set up of the passive tracers' |
---|
[945] | 64 | IF(lwp) WRITE(numout,*) '~~~~~~~' |
---|
[1011] | 65 | |
---|
[2715] | 66 | CALL top_alloc() ! allocate TOP arrays |
---|
| 67 | |
---|
| 68 | ! ! masked grid volume |
---|
[1011] | 69 | DO jk = 1, jpk |
---|
[2528] | 70 | cvol(:,:,jk) = e1t(:,:) * e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk) |
---|
[1011] | 71 | END DO |
---|
[1254] | 72 | |
---|
[2715] | 73 | ! ! total volume of the ocean |
---|
[2528] | 74 | #if ! defined key_degrad |
---|
| 75 | areatot = glob_sum( cvol(:,:,:) ) |
---|
[1254] | 76 | #else |
---|
[2528] | 77 | areatot = glob_sum( cvol(:,:,:) * facvol(:,:,:) ) ! degrad option: reduction by facvol |
---|
[1011] | 78 | #endif |
---|
| 79 | |
---|
[2715] | 80 | CALL trc_nam ! read passive tracers namelists |
---|
[1011] | 81 | |
---|
[2715] | 82 | ! ! restart for passive tracer (input) |
---|
[2528] | 83 | IF( ln_rsttr ) THEN |
---|
| 84 | IF(lwp) WRITE(numout,*) ' read a restart file for passive tracer : ', cn_trcrst_in |
---|
| 85 | IF(lwp) WRITE(numout,*) ' ' |
---|
| 86 | ELSE |
---|
[2715] | 87 | IF( lwp .AND. lk_dtatrc ) THEN |
---|
| 88 | DO jn = 1, jptra |
---|
| 89 | IF( lutini(jn) ) & ! open input FILE only IF lutini(jn) is true |
---|
| 90 | & WRITE(numout,*) ' read an initial file for passive tracer number :', jn, ' traceur : ', ctrcnm(jn) |
---|
| 91 | END DO |
---|
| 92 | ENDIF |
---|
| 93 | IF( lwp ) WRITE(numout,*) |
---|
[2528] | 94 | ENDIF |
---|
[1011] | 95 | |
---|
[2528] | 96 | IF( ln_dm2dc .AND. ( lk_pisces .OR. lk_lobster ) ) & |
---|
| 97 | & CALL ctl_stop( ' The diurnal cycle is not compatible with PISCES or LOBSTER ' ) |
---|
| 98 | |
---|
| 99 | IF( nn_cla == 1 ) & |
---|
| 100 | & CALL ctl_stop( ' Cross Land Advection not yet implemented with passive tracer ; nn_cla must be 0' ) |
---|
| 101 | |
---|
[945] | 102 | IF( lk_lobster ) THEN ; CALL trc_ini_lobster ! LOBSTER bio-model |
---|
| 103 | ELSE ; IF(lwp) WRITE(numout,*) ' LOBSTER not used' |
---|
| 104 | ENDIF |
---|
[1011] | 105 | |
---|
[945] | 106 | IF( lk_pisces ) THEN ; CALL trc_ini_pisces ! PISCES bio-model |
---|
| 107 | ELSE ; IF(lwp) WRITE(numout,*) ' PISCES not used' |
---|
| 108 | ENDIF |
---|
[1011] | 109 | |
---|
[945] | 110 | IF( lk_cfc ) THEN ; CALL trc_ini_cfc ! CFC tracers |
---|
| 111 | ELSE ; IF(lwp) WRITE(numout,*) ' CFC not used' |
---|
| 112 | ENDIF |
---|
[1254] | 113 | |
---|
| 114 | IF( lk_c14b ) THEN ; CALL trc_ini_c14b ! C14 bomb tracer |
---|
| 115 | ELSE ; IF(lwp) WRITE(numout,*) ' C14 not used' |
---|
| 116 | ENDIF |
---|
[1011] | 117 | |
---|
[945] | 118 | IF( lk_my_trc ) THEN ; CALL trc_ini_my_trc ! MY_TRC tracers |
---|
| 119 | ELSE ; IF(lwp) WRITE(numout,*) ' MY_TRC not used' |
---|
[268] | 120 | ENDIF |
---|
[1011] | 121 | |
---|
[2528] | 122 | IF( ln_rsttr ) THEN |
---|
| 123 | ! |
---|
| 124 | IF( lk_offline ) neuler = 1 ! Set time-step indicator at nit000 (leap-frog) |
---|
| 125 | CALL trc_rst_read ! restart from a file |
---|
| 126 | ! |
---|
[1011] | 127 | ELSE |
---|
[2528] | 128 | IF( lk_offline ) THEN |
---|
| 129 | neuler = 0 ! Set time-step indicator at nit000 (euler) |
---|
| 130 | CALL day_init ! set calendar |
---|
| 131 | ENDIF |
---|
[2555] | 132 | #if defined key_dtatrc |
---|
| 133 | CALL trc_dta( nit000 ) ! Initialization of tracer from a file that may also be used for damping |
---|
| 134 | DO jn = 1, jptra |
---|
| 135 | IF( lutini(jn) ) trn(:,:,:,jn) = trdta(:,:,:,jn) * tmask(:,:,:) ! initialisation from file if required |
---|
| 136 | END DO |
---|
| 137 | #endif |
---|
[2528] | 138 | trb(:,:,:,:) = trn(:,:,:,:) |
---|
| 139 | ! |
---|
[1011] | 140 | ENDIF |
---|
[2528] | 141 | |
---|
[2715] | 142 | tra(:,:,:,:) = 0._wp |
---|
[1286] | 143 | |
---|
[2528] | 144 | IF( ln_zps .AND. .NOT. lk_c1d ) & ! Partial steps: before horizontal gradient of passive |
---|
[2715] | 145 | & CALL zps_hde( nit000, jptra, trn, gtru, gtrv ) ! tracers at the bottom ocean level |
---|
[1177] | 146 | |
---|
[1286] | 147 | |
---|
[2715] | 148 | ! |
---|
| 149 | trai = 0._wp ! Computation content of all tracers |
---|
[1011] | 150 | DO jn = 1, jptra |
---|
[2528] | 151 | #if ! defined key_degrad |
---|
| 152 | trai = trai + glob_sum( trn(:,:,:,jn) * cvol(:,:,:) ) |
---|
[1254] | 153 | #else |
---|
[2528] | 154 | trai = trai + glob_sum( trn(:,:,:,jn) * cvol(:,:,:) * facvol(:,:,:) ) ! degrad option: reduction by facvol |
---|
[1254] | 155 | #endif |
---|
[1011] | 156 | END DO |
---|
| 157 | |
---|
[2715] | 158 | IF(lwp) THEN ! control print |
---|
| 159 | WRITE(numout,*) |
---|
| 160 | WRITE(numout,*) |
---|
| 161 | WRITE(numout,*) ' *** Total number of passive tracer jptra = ', jptra |
---|
| 162 | WRITE(numout,*) ' *** Total volume of ocean = ', areatot |
---|
| 163 | WRITE(numout,*) ' *** Total inital content of all tracers = ', trai |
---|
| 164 | WRITE(numout,*) |
---|
| 165 | ENDIF |
---|
[1011] | 166 | |
---|
[2715] | 167 | IF(ln_ctl) THEN ! print mean trends (used for debugging) |
---|
| 168 | CALL prt_ctl_trc_init |
---|
[1011] | 169 | WRITE(charout, FMT="('ini ')") |
---|
| 170 | CALL prt_ctl_trc_info( charout ) |
---|
| 171 | CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm ) |
---|
| 172 | ENDIF |
---|
[2715] | 173 | ! |
---|
[2528] | 174 | END SUBROUTINE trc_init |
---|
[268] | 175 | |
---|
[2715] | 176 | |
---|
| 177 | SUBROUTINE top_alloc |
---|
| 178 | !!---------------------------------------------------------------------- |
---|
| 179 | !! *** ROUTINE top_alloc *** |
---|
| 180 | !! |
---|
| 181 | !! ** Purpose : Allocate all the dynamic arrays of the OPA modules |
---|
| 182 | !!---------------------------------------------------------------------- |
---|
| 183 | USE trcadv , ONLY: trc_adv_alloc ! TOP-related alloc routines... |
---|
| 184 | USE trc , ONLY: trc_alloc |
---|
| 185 | USE trcnxt , ONLY: trc_nxt_alloc |
---|
| 186 | USE trczdf , ONLY: trc_zdf_alloc |
---|
| 187 | USE trdmod_trc_oce, ONLY: trd_mod_trc_oce_alloc |
---|
| 188 | #if ! defined key_iomput |
---|
| 189 | USE trcdia , ONLY: trc_dia_alloc |
---|
| 190 | #endif |
---|
| 191 | #if defined key_trcdmp |
---|
| 192 | USE trcdmp , ONLY: trc_dmp_alloc |
---|
| 193 | #endif |
---|
| 194 | #if defined key_dtatrc |
---|
| 195 | USE trcdta , ONLY: trc_dta_alloc |
---|
| 196 | #endif |
---|
| 197 | #if defined key_trdmld_trc || defined key_esopa |
---|
| 198 | USE trdmld_trc , ONLY: trd_mld_trc_alloc |
---|
| 199 | #endif |
---|
| 200 | ! |
---|
| 201 | INTEGER :: ierr |
---|
| 202 | !!---------------------------------------------------------------------- |
---|
| 203 | ! |
---|
| 204 | ierr = trc_adv_alloc() ! Start of TOP-related alloc routines... |
---|
| 205 | ierr = ierr + trc_alloc () |
---|
| 206 | ierr = ierr + trc_nxt_alloc() |
---|
| 207 | ierr = ierr + trc_zdf_alloc() |
---|
| 208 | ierr = ierr + trd_mod_trc_oce_alloc() |
---|
| 209 | #if ! defined key_iomput |
---|
| 210 | ierr = ierr + trc_dia_alloc() |
---|
| 211 | #endif |
---|
| 212 | #if defined key_trcdmp |
---|
| 213 | ierr = ierr + trc_dmp_alloc() |
---|
| 214 | #endif |
---|
| 215 | #if defined key_dtatrc |
---|
| 216 | ierr = ierr + trc_dta_alloc() |
---|
| 217 | #endif |
---|
| 218 | #if defined key_trdmld_trc || defined key_esopa |
---|
| 219 | ierr = ierr + trd_mld_trc_alloc() |
---|
| 220 | #endif |
---|
| 221 | ! |
---|
| 222 | IF( lk_mpp ) CALL mpp_sum( ierr ) |
---|
| 223 | IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'top_alloc : unable to allocate standard ocean arrays' ) |
---|
| 224 | ! |
---|
| 225 | END SUBROUTINE top_alloc |
---|
| 226 | |
---|
[1011] | 227 | #else |
---|
| 228 | !!---------------------------------------------------------------------- |
---|
| 229 | !! Empty module : No passive tracer |
---|
| 230 | !!---------------------------------------------------------------------- |
---|
| 231 | CONTAINS |
---|
[2528] | 232 | SUBROUTINE trc_init ! Dummy routine |
---|
| 233 | END SUBROUTINE trc_init |
---|
[1011] | 234 | #endif |
---|
| 235 | |
---|
[335] | 236 | !!====================================================================== |
---|
[268] | 237 | END MODULE trcini |
---|