[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 | !!---------------------------------------------------------------------- |
---|
[3294] | 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_pisces ! PISCES initialisation |
---|
| 24 | USE trcini_c14b ! C14 bomb initialisation |
---|
| 25 | USE trcini_my_trc ! MY_TRC initialisation |
---|
[4230] | 26 | USE trcdta ! initialisation from files |
---|
[3294] | 27 | USE daymod ! calendar manager |
---|
[2528] | 28 | USE zpshde ! partial step: hor. derivative (zps_hde routine) |
---|
[1011] | 29 | USE prtctl_trc ! Print control passive tracers (prt_ctl_trc_init routine) |
---|
[4306] | 30 | USE trcsub ! variables to substep passive tracers |
---|
| 31 | USE lib_mpp ! distribued memory computing library |
---|
| 32 | USE sbc_oce |
---|
| 33 | |
---|
[335] | 34 | IMPLICIT NONE |
---|
| 35 | PRIVATE |
---|
[1011] | 36 | |
---|
[2528] | 37 | PUBLIC trc_init ! called by opa |
---|
[268] | 38 | |
---|
[1011] | 39 | !! * Substitutions |
---|
| 40 | # include "domzgr_substitute.h90" |
---|
[2715] | 41 | !!---------------------------------------------------------------------- |
---|
| 42 | !! NEMO/TOP 4.0 , NEMO Consortium (2011) |
---|
| 43 | !! $Id$ |
---|
| 44 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
| 45 | !!---------------------------------------------------------------------- |
---|
[335] | 46 | CONTAINS |
---|
[1011] | 47 | |
---|
[2528] | 48 | SUBROUTINE trc_init |
---|
[1011] | 49 | !!--------------------------------------------------------------------- |
---|
[2528] | 50 | !! *** ROUTINE trc_init *** |
---|
[335] | 51 | !! |
---|
[1011] | 52 | !! ** Purpose : Initialization of the passive tracer fields |
---|
| 53 | !! |
---|
| 54 | !! ** Method : - read namelist |
---|
| 55 | !! - control the consistancy |
---|
| 56 | !! - compute specific initialisations |
---|
| 57 | !! - set initial tracer fields (either read restart |
---|
| 58 | !! or read data or analytical formulation |
---|
| 59 | !!--------------------------------------------------------------------- |
---|
[3294] | 60 | INTEGER :: jk, jn, jl ! dummy loop indices |
---|
[1011] | 61 | CHARACTER (len=25) :: charout |
---|
[4230] | 62 | REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrcdta ! 4D workspace |
---|
[1011] | 63 | !!--------------------------------------------------------------------- |
---|
[3294] | 64 | ! |
---|
| 65 | IF( nn_timing == 1 ) CALL timing_start('trc_init') |
---|
| 66 | ! |
---|
[945] | 67 | IF(lwp) WRITE(numout,*) |
---|
[2528] | 68 | IF(lwp) WRITE(numout,*) 'trc_init : initial set up of the passive tracers' |
---|
[945] | 69 | IF(lwp) WRITE(numout,*) '~~~~~~~' |
---|
[1011] | 70 | |
---|
[2715] | 71 | CALL top_alloc() ! allocate TOP arrays |
---|
| 72 | |
---|
[4607] | 73 | #if defined key_offline |
---|
| 74 | ltrcdm2dc = .FALSE. |
---|
| 75 | #endif |
---|
[1254] | 76 | |
---|
[4607] | 77 | IF( ltrcdm2dc )CALL ctl_warn( ' Diurnal cycle on physics but not in PISCES or LOBSTER ' ) |
---|
| 78 | |
---|
[3294] | 79 | IF( nn_cla == 1 ) & |
---|
| 80 | & CALL ctl_stop( ' Cross Land Advection not yet implemented with passive tracer ; nn_cla must be 0' ) |
---|
[1011] | 81 | |
---|
[4152] | 82 | CALL trc_nam ! read passive tracers namelists |
---|
[3294] | 83 | ! |
---|
| 84 | IF(lwp) WRITE(numout,*) |
---|
[4152] | 85 | ! |
---|
| 86 | IF( ln_rsttr .AND. .NOT. lk_offline ) CALL trc_rst_cal( nit000, 'READ' ) ! calendar |
---|
| 87 | ! |
---|
[3294] | 88 | IF(lwp) WRITE(numout,*) |
---|
| 89 | ! masked grid volume |
---|
| 90 | ! ! masked grid volume |
---|
| 91 | DO jk = 1, jpk |
---|
| 92 | cvol(:,:,jk) = e1e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk) |
---|
| 93 | END DO |
---|
| 94 | IF( lk_degrad ) cvol(:,:,:) = cvol(:,:,:) * facvol(:,:,:) ! degrad option: reduction by facvol |
---|
| 95 | ! ! total volume of the ocean |
---|
| 96 | areatot = glob_sum( cvol(:,:,:) ) |
---|
[1011] | 97 | |
---|
[3294] | 98 | IF( lk_pisces ) CALL trc_ini_pisces ! PISCES bio-model |
---|
| 99 | IF( lk_cfc ) CALL trc_ini_cfc ! CFC tracers |
---|
| 100 | IF( lk_c14b ) CALL trc_ini_c14b ! C14 bomb tracer |
---|
| 101 | IF( lk_my_trc ) CALL trc_ini_my_trc ! MY_TRC tracers |
---|
[2528] | 102 | |
---|
[3294] | 103 | IF( lwp ) THEN |
---|
| 104 | ! |
---|
[4152] | 105 | CALL ctl_opn( numstr, 'tracer.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp , narea ) |
---|
[3294] | 106 | ! |
---|
[945] | 107 | ENDIF |
---|
[1254] | 108 | |
---|
[4230] | 109 | IF( ln_trcdta ) CALL trc_dta_init(jptra) |
---|
[1011] | 110 | |
---|
[3294] | 111 | |
---|
[2528] | 112 | IF( ln_rsttr ) THEN |
---|
| 113 | ! |
---|
| 114 | CALL trc_rst_read ! restart from a file |
---|
| 115 | ! |
---|
[1011] | 116 | ELSE |
---|
[3294] | 117 | ! |
---|
| 118 | IF( ln_trcdta .AND. nb_trcdta > 0 ) THEN ! Initialisation of tracer from a file that may also be used for damping |
---|
| 119 | ! |
---|
[4230] | 120 | CALL wrk_alloc( jpi, jpj, jpk, ztrcdta ) ! Memory allocation |
---|
[3294] | 121 | ! |
---|
| 122 | DO jn = 1, jptra |
---|
| 123 | IF( ln_trc_ini(jn) ) THEN ! update passive tracers arrays with input data read from file |
---|
| 124 | jl = n_trc_index(jn) |
---|
[4230] | 125 | CALL trc_dta( nit000, sf_trcdta(jl),rf_trfac(jl) ) ! read tracer data at nit000 |
---|
| 126 | ztrcdta(:,:,:) = sf_trcdta(jl)%fnow(:,:,:) |
---|
| 127 | trn(:,:,:,jn) = ztrcdta(:,:,:) * tmask(:,:,:) |
---|
| 128 | IF( .NOT.ln_trcdmp .AND. .NOT.ln_trcdmp_clo ) THEN !== deallocate data structure ==! |
---|
| 129 | ! (data used only for initialisation) |
---|
| 130 | IF(lwp) WRITE(numout,*) 'trc_dta: deallocate data arrays as they are only used to initialize the run' |
---|
| 131 | DEALLOCATE( sf_trcdta(jl)%fnow ) ! arrays in the structure |
---|
| 132 | IF( sf_trcdta(jl)%ln_tint ) DEALLOCATE( sf_trcdta(jl)%fdta ) |
---|
| 133 | ! |
---|
| 134 | ENDIF |
---|
[3294] | 135 | ENDIF |
---|
| 136 | ENDDO |
---|
[4230] | 137 | CALL wrk_dealloc( jpi, jpj, jpk, ztrcdta ) |
---|
[2528] | 138 | ENDIF |
---|
[3294] | 139 | ! |
---|
[2528] | 140 | trb(:,:,:,:) = trn(:,:,:,:) |
---|
| 141 | ! |
---|
[1011] | 142 | ENDIF |
---|
[2528] | 143 | |
---|
[2715] | 144 | tra(:,:,:,:) = 0._wp |
---|
[1286] | 145 | |
---|
[2528] | 146 | IF( ln_zps .AND. .NOT. lk_c1d ) & ! Partial steps: before horizontal gradient of passive |
---|
[2715] | 147 | & CALL zps_hde( nit000, jptra, trn, gtru, gtrv ) ! tracers at the bottom ocean level |
---|
[1177] | 148 | |
---|
[3294] | 149 | ! |
---|
| 150 | IF( nn_dttrc /= 1 ) CALL trc_sub_ini ! Initialize variables for substepping passive tracers |
---|
| 151 | ! |
---|
[1286] | 152 | |
---|
[3294] | 153 | trai(:) = 0._wp ! initial content of all tracers |
---|
[1011] | 154 | DO jn = 1, jptra |
---|
[3294] | 155 | trai(jn) = trai(jn) + glob_sum( trn(:,:,:,jn) * cvol(:,:,:) ) |
---|
| 156 | END DO |
---|
[1011] | 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 |
---|
[3294] | 163 | WRITE(numout,*) ' *** Total inital content of all tracers ' |
---|
[2715] | 164 | WRITE(numout,*) |
---|
[3294] | 165 | DO jn = 1, jptra |
---|
| 166 | WRITE(numout,9000) jn, TRIM( ctrcnm(jn) ), trai(jn) |
---|
| 167 | ENDDO |
---|
| 168 | WRITE(numout,*) |
---|
[2715] | 169 | ENDIF |
---|
[3294] | 170 | IF(lwp) WRITE(numout,*) |
---|
[2715] | 171 | IF(ln_ctl) THEN ! print mean trends (used for debugging) |
---|
| 172 | CALL prt_ctl_trc_init |
---|
[1011] | 173 | WRITE(charout, FMT="('ini ')") |
---|
| 174 | CALL prt_ctl_trc_info( charout ) |
---|
| 175 | CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm ) |
---|
| 176 | ENDIF |
---|
[3294] | 177 | 9000 FORMAT(' tracer nb : ',i2,' name :',a10,' initial content :',e18.10) |
---|
[2715] | 178 | ! |
---|
[3294] | 179 | IF( nn_timing == 1 ) CALL timing_stop('trc_init') |
---|
| 180 | ! |
---|
[2528] | 181 | END SUBROUTINE trc_init |
---|
[268] | 182 | |
---|
[2715] | 183 | |
---|
| 184 | SUBROUTINE top_alloc |
---|
| 185 | !!---------------------------------------------------------------------- |
---|
| 186 | !! *** ROUTINE top_alloc *** |
---|
| 187 | !! |
---|
| 188 | !! ** Purpose : Allocate all the dynamic arrays of the OPA modules |
---|
| 189 | !!---------------------------------------------------------------------- |
---|
| 190 | USE trcadv , ONLY: trc_adv_alloc ! TOP-related alloc routines... |
---|
| 191 | USE trc , ONLY: trc_alloc |
---|
| 192 | USE trcnxt , ONLY: trc_nxt_alloc |
---|
| 193 | USE trczdf , ONLY: trc_zdf_alloc |
---|
| 194 | USE trdmod_trc_oce, ONLY: trd_mod_trc_oce_alloc |
---|
[3294] | 195 | #if defined key_trdmld_trc |
---|
[2715] | 196 | USE trdmld_trc , ONLY: trd_mld_trc_alloc |
---|
| 197 | #endif |
---|
| 198 | ! |
---|
| 199 | INTEGER :: ierr |
---|
| 200 | !!---------------------------------------------------------------------- |
---|
| 201 | ! |
---|
| 202 | ierr = trc_adv_alloc() ! Start of TOP-related alloc routines... |
---|
| 203 | ierr = ierr + trc_alloc () |
---|
| 204 | ierr = ierr + trc_nxt_alloc() |
---|
| 205 | ierr = ierr + trc_zdf_alloc() |
---|
| 206 | ierr = ierr + trd_mod_trc_oce_alloc() |
---|
[3294] | 207 | #if defined key_trdmld_trc |
---|
[2715] | 208 | ierr = ierr + trd_mld_trc_alloc() |
---|
| 209 | #endif |
---|
| 210 | ! |
---|
| 211 | IF( lk_mpp ) CALL mpp_sum( ierr ) |
---|
| 212 | IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'top_alloc : unable to allocate standard ocean arrays' ) |
---|
| 213 | ! |
---|
| 214 | END SUBROUTINE top_alloc |
---|
| 215 | |
---|
[1011] | 216 | #else |
---|
| 217 | !!---------------------------------------------------------------------- |
---|
| 218 | !! Empty module : No passive tracer |
---|
| 219 | !!---------------------------------------------------------------------- |
---|
| 220 | CONTAINS |
---|
[2528] | 221 | SUBROUTINE trc_init ! Dummy routine |
---|
| 222 | END SUBROUTINE trc_init |
---|
[1011] | 223 | #endif |
---|
| 224 | |
---|
[335] | 225 | !!====================================================================== |
---|
[268] | 226 | END MODULE trcini |
---|