[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 |
---|
[2528] | 20 | USE trcnam ! Namelist read |
---|
[3294] | 21 | USE daymod ! calendar manager |
---|
[1011] | 22 | USE prtctl_trc ! Print control passive tracers (prt_ctl_trc_init routine) |
---|
[4306] | 23 | USE trcsub ! variables to substep passive tracers |
---|
[5836] | 24 | USE trcrst |
---|
[4306] | 25 | USE lib_mpp ! distribued memory computing library |
---|
[5385] | 26 | USE trcice ! tracers in sea ice |
---|
[7646] | 27 | USE trcbc, only : trc_bc_ini ! generalized Boundary Conditions |
---|
[4306] | 28 | |
---|
[335] | 29 | IMPLICIT NONE |
---|
| 30 | PRIVATE |
---|
[1011] | 31 | |
---|
[2528] | 32 | PUBLIC trc_init ! called by opa |
---|
[268] | 33 | |
---|
[2715] | 34 | !!---------------------------------------------------------------------- |
---|
| 35 | !! NEMO/TOP 4.0 , NEMO Consortium (2011) |
---|
[12286] | 36 | !! $Id$ |
---|
[2715] | 37 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
| 38 | !!---------------------------------------------------------------------- |
---|
[335] | 39 | CONTAINS |
---|
[1011] | 40 | |
---|
[2528] | 41 | SUBROUTINE trc_init |
---|
[1011] | 42 | !!--------------------------------------------------------------------- |
---|
[2528] | 43 | !! *** ROUTINE trc_init *** |
---|
[335] | 44 | !! |
---|
[1011] | 45 | !! ** Purpose : Initialization of the passive tracer fields |
---|
| 46 | !! |
---|
| 47 | !! ** Method : - read namelist |
---|
| 48 | !! - control the consistancy |
---|
| 49 | !! - compute specific initialisations |
---|
| 50 | !! - set initial tracer fields (either read restart |
---|
| 51 | !! or read data or analytical formulation |
---|
| 52 | !!--------------------------------------------------------------------- |
---|
[3294] | 53 | ! |
---|
| 54 | IF( nn_timing == 1 ) CALL timing_start('trc_init') |
---|
| 55 | ! |
---|
[945] | 56 | IF(lwp) WRITE(numout,*) |
---|
[2528] | 57 | IF(lwp) WRITE(numout,*) 'trc_init : initial set up of the passive tracers' |
---|
[945] | 58 | IF(lwp) WRITE(numout,*) '~~~~~~~' |
---|
[3294] | 59 | ! |
---|
[5836] | 60 | CALL trc_ini_ctl ! control |
---|
| 61 | CALL trc_nam ! read passive tracers namelists |
---|
[7646] | 62 | CALL top_alloc() ! allocate TOP arrays |
---|
[5836] | 63 | ! |
---|
[7646] | 64 | IF(.NOT.ln_trcdta ) ln_trc_ini(:) = .FALSE. |
---|
[4152] | 65 | ! |
---|
[3294] | 66 | IF(lwp) WRITE(numout,*) |
---|
[7646] | 67 | IF( ln_rsttr .AND. .NOT. l_offline ) CALL trc_rst_cal( nit000, 'READ' ) ! calendar |
---|
| 68 | IF(lwp) WRITE(numout,*) |
---|
[5836] | 69 | ! |
---|
| 70 | CALL trc_ini_sms ! SMS |
---|
[7646] | 71 | CALL trc_ini_inv ! Inventories |
---|
[5836] | 72 | CALL trc_ini_trp ! passive tracers transport |
---|
| 73 | CALL trc_ice_ini ! Tracers in sea ice |
---|
| 74 | ! |
---|
[7646] | 75 | IF(lwp) CALL ctl_opn( numstr, 'tracer.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp , narea ) |
---|
[5836] | 76 | ! |
---|
| 77 | CALL trc_ini_state ! passive tracers initialisation : from a restart or from clim |
---|
[7646] | 78 | IF( nn_dttrc /= 1 ) & |
---|
| 79 | CALL trc_sub_ini ! Initialize variables for substepping passive tracers |
---|
[5836] | 80 | ! |
---|
| 81 | IF( nn_timing == 1 ) CALL timing_stop('trc_init') |
---|
| 82 | ! |
---|
| 83 | END SUBROUTINE trc_init |
---|
| 84 | |
---|
| 85 | |
---|
| 86 | SUBROUTINE trc_ini_ctl |
---|
| 87 | !!---------------------------------------------------------------------- |
---|
| 88 | !! *** ROUTINE trc_ini_ctl *** |
---|
| 89 | !! ** Purpose : Control + ocean volume |
---|
| 90 | !!---------------------------------------------------------------------- |
---|
| 91 | INTEGER :: jk ! dummy loop indices |
---|
| 92 | ! |
---|
| 93 | ! Define logical parameter ton control dirunal cycle in TOP |
---|
| 94 | l_trcdm2dc = ln_dm2dc .OR. ( ln_cpl .AND. ncpl_qsr_freq /= 1 ) |
---|
[7646] | 95 | l_trcdm2dc = l_trcdm2dc .AND. .NOT. l_offline |
---|
[5836] | 96 | IF( l_trcdm2dc .AND. lwp ) CALL ctl_warn( 'Coupling with passive tracers and used of diurnal cycle.', & |
---|
| 97 | & 'Computation of a daily mean shortwave for some biogeochemical models ' ) |
---|
| 98 | ! |
---|
| 99 | END SUBROUTINE trc_ini_ctl |
---|
| 100 | |
---|
| 101 | |
---|
| 102 | SUBROUTINE trc_ini_inv |
---|
| 103 | !!---------------------------------------------------------------------- |
---|
| 104 | !! *** ROUTINE trc_ini_stat *** |
---|
| 105 | !! ** Purpose : passive tracers inventories at initialsation phase |
---|
| 106 | !!---------------------------------------------------------------------- |
---|
[7753] | 107 | INTEGER :: jk, jn ! dummy loop indices |
---|
[5836] | 108 | CHARACTER (len=25) :: charout |
---|
| 109 | !!---------------------------------------------------------------------- |
---|
[3294] | 110 | ! ! masked grid volume |
---|
| 111 | DO jk = 1, jpk |
---|
[7753] | 112 | cvol(:,:,jk) = e1e2t(:,:) * e3t_n(:,:,jk) * tmask(:,:,jk) |
---|
[3294] | 113 | END DO |
---|
| 114 | ! ! total volume of the ocean |
---|
| 115 | areatot = glob_sum( cvol(:,:,:) ) |
---|
[5836] | 116 | ! |
---|
[7753] | 117 | trai(:) = 0._wp ! initial content of all tracers |
---|
[5836] | 118 | DO jn = 1, jptra |
---|
| 119 | trai(jn) = trai(jn) + glob_sum( trn(:,:,:,jn) * cvol(:,:,:) ) |
---|
| 120 | END DO |
---|
[1011] | 121 | |
---|
[5836] | 122 | IF(lwp) THEN ! control print |
---|
| 123 | WRITE(numout,*) |
---|
[7646] | 124 | WRITE(numout,*) ' *** Total number of passive tracer jptra = ', jptra |
---|
| 125 | WRITE(numout,*) ' *** Total volume of ocean = ', areatot |
---|
| 126 | WRITE(numout,*) ' *** Total inital content of all tracers ' |
---|
[5836] | 127 | WRITE(numout,*) |
---|
| 128 | DO jn = 1, jptra |
---|
| 129 | WRITE(numout,9000) jn, TRIM( ctrcnm(jn) ), trai(jn) |
---|
| 130 | ENDDO |
---|
| 131 | WRITE(numout,*) |
---|
| 132 | ENDIF |
---|
| 133 | IF(lwp) WRITE(numout,*) |
---|
| 134 | IF(ln_ctl) THEN ! print mean trends (used for debugging) |
---|
| 135 | CALL prt_ctl_trc_init |
---|
| 136 | WRITE(charout, FMT="('ini ')") |
---|
| 137 | CALL prt_ctl_trc_info( charout ) |
---|
| 138 | CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm ) |
---|
| 139 | ENDIF |
---|
[7646] | 140 | 9000 FORMAT(' tracer nb : ',i2,' name :',a10,' initial content :',e18.10) |
---|
[5836] | 141 | ! |
---|
| 142 | END SUBROUTINE trc_ini_inv |
---|
| 143 | |
---|
| 144 | |
---|
| 145 | SUBROUTINE trc_ini_sms |
---|
| 146 | !!---------------------------------------------------------------------- |
---|
| 147 | !! *** ROUTINE trc_ini_sms *** |
---|
| 148 | !! ** Purpose : SMS initialisation |
---|
| 149 | !!---------------------------------------------------------------------- |
---|
[7646] | 150 | USE trcini_pisces ! PISCES initialisation |
---|
| 151 | USE trcini_cfc ! CFC initialisation |
---|
| 152 | USE trcini_c14 ! C14 initialisation |
---|
| 153 | USE trcini_age ! age initialisation |
---|
| 154 | USE trcini_my_trc ! MY_TRC initialisation |
---|
| 155 | ! |
---|
| 156 | INTEGER :: jn |
---|
[5836] | 157 | !!---------------------------------------------------------------------- |
---|
| 158 | ! |
---|
[7646] | 159 | ! Pass sn_tracer fields to specialized arrays |
---|
| 160 | DO jn = 1, jp_bgc |
---|
| 161 | ctrcnm (jn) = TRIM( sn_tracer(jn)%clsname ) |
---|
| 162 | ctrcln (jn) = TRIM( sn_tracer(jn)%cllname ) |
---|
| 163 | ctrcun (jn) = TRIM( sn_tracer(jn)%clunit ) |
---|
| 164 | ln_trc_ini(jn) = sn_tracer(jn)%llinit |
---|
| 165 | ln_trc_sbc(jn) = sn_tracer(jn)%llsbc |
---|
| 166 | ln_trc_cbc(jn) = sn_tracer(jn)%llcbc |
---|
| 167 | ln_trc_obc(jn) = sn_tracer(jn)%llobc |
---|
| 168 | END DO |
---|
| 169 | ! |
---|
| 170 | IF( ln_pisces ) CALL trc_ini_pisces ! PISCES model |
---|
| 171 | IF( ln_my_trc ) CALL trc_ini_my_trc ! MY_TRC model |
---|
| 172 | IF( ll_cfc ) CALL trc_ini_cfc ! CFC's |
---|
| 173 | IF( ln_c14 ) CALL trc_ini_c14 ! C14 model |
---|
| 174 | IF( ln_age ) CALL trc_ini_age ! AGE |
---|
| 175 | ! |
---|
| 176 | IF(lwp) THEN ! control print |
---|
| 177 | WRITE(numout,*) |
---|
| 178 | WRITE(numout,*) ' trc_init: Summary for selected passive tracers' |
---|
| 179 | WRITE(numout,*) ' ~~~~~~~~~~~~~~' |
---|
| 180 | WRITE(numout,*) ' ID NAME INI SBC CBC OBC' |
---|
| 181 | DO jn = 1, jptra |
---|
| 182 | WRITE(numout,9001) jn, TRIM(ctrcnm(jn)), ln_trc_ini(jn), ln_trc_sbc(jn),ln_trc_cbc(jn),ln_trc_obc(jn) |
---|
| 183 | END DO |
---|
| 184 | ENDIF |
---|
| 185 | 9001 FORMAT(1x,i3,1x,a10,3x,l2,3x,l2,3x,l2,3x,l2) |
---|
| 186 | ! |
---|
[5836] | 187 | END SUBROUTINE trc_ini_sms |
---|
[2528] | 188 | |
---|
[5836] | 189 | SUBROUTINE trc_ini_trp |
---|
| 190 | !!---------------------------------------------------------------------- |
---|
| 191 | !! *** ROUTINE trc_ini_trp *** |
---|
| 192 | !! |
---|
| 193 | !! ** Purpose : Allocate all the dynamic arrays of the OPA modules |
---|
| 194 | !!---------------------------------------------------------------------- |
---|
| 195 | USE trcdmp , ONLY: trc_dmp_ini |
---|
| 196 | USE trcadv , ONLY: trc_adv_ini |
---|
| 197 | USE trcldf , ONLY: trc_ldf_ini |
---|
| 198 | USE trczdf , ONLY: trc_zdf_ini |
---|
| 199 | USE trcrad , ONLY: trc_rad_ini |
---|
| 200 | ! |
---|
| 201 | INTEGER :: ierr |
---|
| 202 | !!---------------------------------------------------------------------- |
---|
| 203 | ! |
---|
| 204 | IF( ln_trcdmp ) CALL trc_dmp_ini ! damping |
---|
| 205 | CALL trc_adv_ini ! advection |
---|
| 206 | CALL trc_ldf_ini ! lateral diffusion |
---|
| 207 | CALL trc_zdf_ini ! vertical diffusion |
---|
| 208 | CALL trc_rad_ini ! positivity of passive tracers |
---|
| 209 | ! |
---|
| 210 | END SUBROUTINE trc_ini_trp |
---|
[5385] | 211 | |
---|
[1254] | 212 | |
---|
[5836] | 213 | SUBROUTINE trc_ini_state |
---|
| 214 | !!---------------------------------------------------------------------- |
---|
| 215 | !! *** ROUTINE trc_ini_state *** |
---|
| 216 | !! ** Purpose : Initialisation of passive tracer concentration |
---|
| 217 | !!---------------------------------------------------------------------- |
---|
| 218 | USE zpshde ! partial step: hor. derivative (zps_hde routine) |
---|
| 219 | USE trcrst ! passive tracers restart |
---|
| 220 | USE trcdta ! initialisation from files |
---|
| 221 | ! |
---|
[7753] | 222 | INTEGER :: jn, jl ! dummy loop indices |
---|
[5836] | 223 | !!---------------------------------------------------------------------- |
---|
| 224 | ! |
---|
[6140] | 225 | ! Initialisation of tracers Initial Conditions |
---|
[7646] | 226 | IF( ln_trcdta ) CALL trc_dta_ini(jptra) |
---|
[1011] | 227 | |
---|
[6140] | 228 | ! Initialisation of tracers Boundary Conditions |
---|
[7646] | 229 | IF( ln_my_trc ) CALL trc_bc_ini(jptra) |
---|
[6140] | 230 | |
---|
[2528] | 231 | IF( ln_rsttr ) THEN |
---|
| 232 | ! |
---|
| 233 | CALL trc_rst_read ! restart from a file |
---|
| 234 | ! |
---|
[1011] | 235 | ELSE |
---|
[7646] | 236 | ! Initialisation of tracer from a file that may also be used for damping |
---|
| 237 | IF( ln_trcdta .AND. nb_trcdta > 0 ) THEN |
---|
| 238 | ! update passive tracers arrays with input data read from file |
---|
[6607] | 239 | DO jn = 1, jptra |
---|
[7646] | 240 | IF( ln_trc_ini(jn) ) THEN |
---|
[3294] | 241 | jl = n_trc_index(jn) |
---|
[7646] | 242 | CALL trc_dta( nit000, sf_trcdta(jl), rf_trfac(jl), trn(:,:,:,jn) ) |
---|
[6701] | 243 | ! |
---|
[7646] | 244 | ! deallocate data structure if data are not used for damping |
---|
| 245 | IF( .NOT.ln_trcdmp .AND. .NOT.ln_trcdmp_clo ) THEN |
---|
[6701] | 246 | IF(lwp) WRITE(numout,*) 'trc_dta: deallocate data arrays as they are only used to initialize the run' |
---|
[7646] | 247 | DEALLOCATE( sf_trcdta(jl)%fnow ) |
---|
[6701] | 248 | IF( sf_trcdta(jl)%ln_tint ) DEALLOCATE( sf_trcdta(jl)%fdta ) |
---|
| 249 | ! |
---|
| 250 | ENDIF |
---|
[3294] | 251 | ENDIF |
---|
| 252 | ENDDO |
---|
[6309] | 253 | ! |
---|
[2528] | 254 | ENDIF |
---|
[3294] | 255 | ! |
---|
[7753] | 256 | trb(:,:,:,:) = trn(:,:,:,:) |
---|
[2528] | 257 | ! |
---|
[1011] | 258 | ENDIF |
---|
[2528] | 259 | |
---|
[7753] | 260 | tra(:,:,:,:) = 0._wp |
---|
[5836] | 261 | ! ! Partial top/bottom cell: GRADh(trn) |
---|
| 262 | END SUBROUTINE trc_ini_state |
---|
[1177] | 263 | |
---|
[2715] | 264 | SUBROUTINE top_alloc |
---|
| 265 | !!---------------------------------------------------------------------- |
---|
| 266 | !! *** ROUTINE top_alloc *** |
---|
| 267 | !! |
---|
| 268 | !! ** Purpose : Allocate all the dynamic arrays of the OPA modules |
---|
| 269 | !!---------------------------------------------------------------------- |
---|
| 270 | USE trc , ONLY: trc_alloc |
---|
[4990] | 271 | USE trdtrc_oce , ONLY: trd_trc_oce_alloc |
---|
| 272 | #if defined key_trdmxl_trc |
---|
| 273 | USE trdmxl_trc , ONLY: trd_mxl_trc_alloc |
---|
[2715] | 274 | #endif |
---|
| 275 | ! |
---|
| 276 | INTEGER :: ierr |
---|
| 277 | !!---------------------------------------------------------------------- |
---|
| 278 | ! |
---|
[6140] | 279 | ierr = trc_alloc() |
---|
[4990] | 280 | ierr = ierr + trd_trc_oce_alloc() |
---|
| 281 | #if defined key_trdmxl_trc |
---|
| 282 | ierr = ierr + trd_mxl_trc_alloc() |
---|
[2715] | 283 | #endif |
---|
| 284 | ! |
---|
| 285 | IF( lk_mpp ) CALL mpp_sum( ierr ) |
---|
| 286 | IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'top_alloc : unable to allocate standard ocean arrays' ) |
---|
| 287 | ! |
---|
| 288 | END SUBROUTINE top_alloc |
---|
| 289 | |
---|
[1011] | 290 | #else |
---|
| 291 | !!---------------------------------------------------------------------- |
---|
| 292 | !! Empty module : No passive tracer |
---|
| 293 | !!---------------------------------------------------------------------- |
---|
| 294 | CONTAINS |
---|
[2528] | 295 | SUBROUTINE trc_init ! Dummy routine |
---|
| 296 | END SUBROUTINE trc_init |
---|
[1011] | 297 | #endif |
---|
| 298 | |
---|
[335] | 299 | !!====================================================================== |
---|
[268] | 300 | END MODULE trcini |
---|