[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 | !!---------------------------------------------------------------------- |
---|
[2977] | 18 | USE oce_trc ! shared variables between ocean and passive tracers |
---|
| 19 | USE trc ! passive tracers common variables |
---|
| 20 | USE trcrst ! passive tracers restart |
---|
[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 |
---|
[2977] | 27 | USE trcdta ! initialisation form files |
---|
| 28 | USE daymod ! calendar manager |
---|
[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 | !!--------------------------------------------------------------------- |
---|
[2977] | 58 | INTEGER :: jk, jn, jl ! dummy loop indices |
---|
| 59 | INTEGER :: ierr ! local integer |
---|
[1011] | 60 | CHARACTER (len=25) :: charout |
---|
[2977] | 61 | REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) :: ztrcdta ! 4D workspace |
---|
[1011] | 62 | !!--------------------------------------------------------------------- |
---|
| 63 | |
---|
[945] | 64 | IF(lwp) WRITE(numout,*) |
---|
[2528] | 65 | IF(lwp) WRITE(numout,*) 'trc_init : initial set up of the passive tracers' |
---|
[945] | 66 | IF(lwp) WRITE(numout,*) '~~~~~~~' |
---|
[1011] | 67 | |
---|
[2715] | 68 | CALL top_alloc() ! allocate TOP arrays |
---|
| 69 | |
---|
[2977] | 70 | IF( ln_dm2dc .AND. ( lk_pisces .OR. lk_lobster ) ) & |
---|
| 71 | & CALL ctl_stop( ' The diurnal cycle is not compatible with PISCES or LOBSTER ' ) |
---|
[1254] | 72 | |
---|
[2977] | 73 | IF( nn_cla == 1 ) & |
---|
| 74 | & CALL ctl_stop( ' Cross Land Advection not yet implemented with passive tracer ; nn_cla must be 0' ) |
---|
[1011] | 75 | |
---|
[2715] | 76 | CALL trc_nam ! read passive tracers namelists |
---|
[1011] | 77 | |
---|
[945] | 78 | IF( lk_lobster ) THEN ; CALL trc_ini_lobster ! LOBSTER bio-model |
---|
| 79 | ELSE ; IF(lwp) WRITE(numout,*) ' LOBSTER not used' |
---|
| 80 | ENDIF |
---|
[1011] | 81 | |
---|
[945] | 82 | IF( lk_pisces ) THEN ; CALL trc_ini_pisces ! PISCES bio-model |
---|
| 83 | ELSE ; IF(lwp) WRITE(numout,*) ' PISCES not used' |
---|
| 84 | ENDIF |
---|
[1011] | 85 | |
---|
[945] | 86 | IF( lk_cfc ) THEN ; CALL trc_ini_cfc ! CFC tracers |
---|
| 87 | ELSE ; IF(lwp) WRITE(numout,*) ' CFC not used' |
---|
| 88 | ENDIF |
---|
[1254] | 89 | |
---|
| 90 | IF( lk_c14b ) THEN ; CALL trc_ini_c14b ! C14 bomb tracer |
---|
| 91 | ELSE ; IF(lwp) WRITE(numout,*) ' C14 not used' |
---|
| 92 | ENDIF |
---|
[1011] | 93 | |
---|
[945] | 94 | IF( lk_my_trc ) THEN ; CALL trc_ini_my_trc ! MY_TRC tracers |
---|
| 95 | ELSE ; IF(lwp) WRITE(numout,*) ' MY_TRC not used' |
---|
[268] | 96 | ENDIF |
---|
[1011] | 97 | |
---|
[2997] | 98 | IF( lwp ) THEN |
---|
| 99 | ! |
---|
| 100 | CALL ctl_opn( numstr, 'tracer.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea ) |
---|
| 101 | ! |
---|
| 102 | ENDIF |
---|
| 103 | |
---|
[2977] | 104 | IF( ln_trcdta ) CALL trc_dta_init |
---|
| 105 | |
---|
[2528] | 106 | IF( ln_rsttr ) THEN |
---|
| 107 | ! |
---|
| 108 | IF( lk_offline ) neuler = 1 ! Set time-step indicator at nit000 (leap-frog) |
---|
| 109 | CALL trc_rst_read ! restart from a file |
---|
| 110 | ! |
---|
[1011] | 111 | ELSE |
---|
[2528] | 112 | IF( lk_offline ) THEN |
---|
| 113 | neuler = 0 ! Set time-step indicator at nit000 (euler) |
---|
| 114 | CALL day_init ! set calendar |
---|
| 115 | ENDIF |
---|
[2977] | 116 | IF( ln_trcdta .AND. nb_trcdta > 0 ) THEN ! Initialisation of tracer from a file that may also be used for damping |
---|
| 117 | ALLOCATE( ztrcdta(jpi,jpj,jpk,nb_trcdta), STAT=ierr ) |
---|
| 118 | IF( ierr > 0 ) THEN |
---|
| 119 | CALL ctl_stop( 'trc_ini: unable to allocate ztrcdta array' ) ; RETURN |
---|
| 120 | ENDIF |
---|
| 121 | ! |
---|
| 122 | CALL trc_dta( nit000, ztrcdta ) ! read tracer data at nit000 |
---|
| 123 | ! |
---|
| 124 | DO jn = 1, jptra |
---|
| 125 | IF( ln_trc_ini(jn) ) THEN ! update passive tracers arrays with input data read from file |
---|
| 126 | jl = n_trc_index(jn) |
---|
| 127 | trn(:,:,:,jn) = ztrcdta(:,:,:,jl) * tmask(:,:,:) |
---|
| 128 | ENDIF |
---|
| 129 | ENDDO |
---|
| 130 | DEALLOCATE( ztrcdta ) |
---|
| 131 | ENDIF |
---|
| 132 | ! |
---|
[2528] | 133 | trb(:,:,:,:) = trn(:,:,:,:) |
---|
| 134 | ! |
---|
[1011] | 135 | ENDIF |
---|
[2528] | 136 | |
---|
[2715] | 137 | tra(:,:,:,:) = 0._wp |
---|
[1286] | 138 | |
---|
[2528] | 139 | IF( ln_zps .AND. .NOT. lk_c1d ) & ! Partial steps: before horizontal gradient of passive |
---|
[2715] | 140 | & CALL zps_hde( nit000, jptra, trn, gtru, gtrv ) ! tracers at the bottom ocean level |
---|
[1177] | 141 | |
---|
[2977] | 142 | ! ! masked grid volume |
---|
| 143 | DO jk = 1, jpk |
---|
| 144 | cvol(:,:,jk) = e1e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk) |
---|
| 145 | END DO |
---|
| 146 | IF( lk_degrad ) cvol(:,:,:) = cvol(:,:,:) * facvol(:,:,:) ! degrad option: reduction by facvol |
---|
| 147 | ! ! total volume of the ocean |
---|
| 148 | areatot = glob_sum( cvol(:,:,:) ) |
---|
[1286] | 149 | |
---|
[2977] | 150 | trai(:) = 0._wp ! initial content of all tracers |
---|
[1011] | 151 | DO jn = 1, jptra |
---|
[2977] | 152 | trai(jn) = trai(jn) + glob_sum( trn(:,:,:,jn) * cvol(:,:,:) ) |
---|
| 153 | END DO |
---|
[1011] | 154 | |
---|
[2715] | 155 | IF(lwp) THEN ! control print |
---|
| 156 | WRITE(numout,*) |
---|
| 157 | WRITE(numout,*) |
---|
| 158 | WRITE(numout,*) ' *** Total number of passive tracer jptra = ', jptra |
---|
| 159 | WRITE(numout,*) ' *** Total volume of ocean = ', areatot |
---|
[2977] | 160 | WRITE(numout,*) ' *** Total inital content of all tracers ' |
---|
[2997] | 161 | WRITE(numout,*) |
---|
[2977] | 162 | DO jn = 1, jptra |
---|
[2997] | 163 | WRITE(numout,9000) jn, TRIM( ctrcnm(jn) ), trai(jn) |
---|
[2977] | 164 | ENDDO |
---|
[2715] | 165 | WRITE(numout,*) |
---|
| 166 | ENDIF |
---|
[2997] | 167 | WRITE(numout,*) |
---|
[2715] | 168 | IF(ln_ctl) THEN ! print mean trends (used for debugging) |
---|
| 169 | CALL prt_ctl_trc_init |
---|
[1011] | 170 | WRITE(charout, FMT="('ini ')") |
---|
| 171 | CALL prt_ctl_trc_info( charout ) |
---|
| 172 | CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm ) |
---|
| 173 | ENDIF |
---|
[2997] | 174 | 9000 FORMAT(' tracer nb : ',i2,' name :',a10,' initial content :',e18.10) |
---|
[2715] | 175 | ! |
---|
[2528] | 176 | END SUBROUTINE trc_init |
---|
[268] | 177 | |
---|
[2715] | 178 | |
---|
| 179 | SUBROUTINE top_alloc |
---|
| 180 | !!---------------------------------------------------------------------- |
---|
| 181 | !! *** ROUTINE top_alloc *** |
---|
| 182 | !! |
---|
| 183 | !! ** Purpose : Allocate all the dynamic arrays of the OPA modules |
---|
| 184 | !!---------------------------------------------------------------------- |
---|
| 185 | USE trcadv , ONLY: trc_adv_alloc ! TOP-related alloc routines... |
---|
| 186 | USE trc , ONLY: trc_alloc |
---|
| 187 | USE trcnxt , ONLY: trc_nxt_alloc |
---|
| 188 | USE trczdf , ONLY: trc_zdf_alloc |
---|
| 189 | USE trdmod_trc_oce, ONLY: trd_mod_trc_oce_alloc |
---|
[2977] | 190 | #if defined key_trdmld_trc |
---|
[2715] | 191 | USE trdmld_trc , ONLY: trd_mld_trc_alloc |
---|
| 192 | #endif |
---|
| 193 | ! |
---|
| 194 | INTEGER :: ierr |
---|
| 195 | !!---------------------------------------------------------------------- |
---|
| 196 | ! |
---|
| 197 | ierr = trc_adv_alloc() ! Start of TOP-related alloc routines... |
---|
| 198 | ierr = ierr + trc_alloc () |
---|
| 199 | ierr = ierr + trc_nxt_alloc() |
---|
| 200 | ierr = ierr + trc_zdf_alloc() |
---|
| 201 | ierr = ierr + trd_mod_trc_oce_alloc() |
---|
[2977] | 202 | #if defined key_trdmld_trc |
---|
[2715] | 203 | ierr = ierr + trd_mld_trc_alloc() |
---|
| 204 | #endif |
---|
| 205 | ! |
---|
| 206 | IF( lk_mpp ) CALL mpp_sum( ierr ) |
---|
| 207 | IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'top_alloc : unable to allocate standard ocean arrays' ) |
---|
| 208 | ! |
---|
| 209 | END SUBROUTINE top_alloc |
---|
| 210 | |
---|
[1011] | 211 | #else |
---|
| 212 | !!---------------------------------------------------------------------- |
---|
| 213 | !! Empty module : No passive tracer |
---|
| 214 | !!---------------------------------------------------------------------- |
---|
| 215 | CONTAINS |
---|
[2528] | 216 | SUBROUTINE trc_init ! Dummy routine |
---|
| 217 | END SUBROUTINE trc_init |
---|
[1011] | 218 | #endif |
---|
| 219 | |
---|
[335] | 220 | !!====================================================================== |
---|
[268] | 221 | END MODULE trcini |
---|