[6883] | 1 | MODULE trcini |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE trcini *** |
---|
| 4 | !! TOP : Manage the passive tracer initialization |
---|
| 5 | !!====================================================================== |
---|
| 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 |
---|
| 10 | !!---------------------------------------------------------------------- |
---|
| 11 | #if defined key_top |
---|
| 12 | !!---------------------------------------------------------------------- |
---|
| 13 | !! 'key_top' TOP models |
---|
| 14 | !!---------------------------------------------------------------------- |
---|
| 15 | !! trc_init : Initialization for passive tracer |
---|
| 16 | !! top_alloc : allocate the TOP arrays |
---|
| 17 | !!---------------------------------------------------------------------- |
---|
| 18 | USE par_trc ! need jptra, number of passive tracers |
---|
| 19 | USE oce_trc ! shared variables between ocean and passive tracers |
---|
| 20 | USE trc ! passive tracers common variables |
---|
| 21 | USE trcnam ! Namelist read |
---|
| 22 | USE daymod ! calendar manager |
---|
| 23 | USE prtctl ! Print control passive tracers (prt_ctl_init routine) |
---|
| 24 | USE trcrst |
---|
| 25 | USE lib_mpp ! distribued memory computing library |
---|
| 26 | USE trcice ! tracers in sea ice |
---|
| 27 | USE trcbc ! generalized Boundary Conditions |
---|
| 28 | USE trcais ! tracers from Antartic Ice Sheet |
---|
| 29 | USE trcbdy ! passive-tracer open boundary conditions |
---|
| 30 | |
---|
| 31 | IMPLICIT NONE |
---|
| 32 | PRIVATE |
---|
| 33 | |
---|
| 34 | PUBLIC trc_init ! called by opa |
---|
| 35 | |
---|
| 36 | # include "domzgr_substitute.h90" |
---|
| 37 | !!---------------------------------------------------------------------- |
---|
| 38 | !! NEMO/TOP 4.0 , NEMO Consortium (2018) |
---|
| 39 | !! $Id: trcini.F90 15446 2021-10-26 14:34:38Z cetlod $ |
---|
| 40 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
| 41 | !!---------------------------------------------------------------------- |
---|
| 42 | CONTAINS |
---|
| 43 | |
---|
| 44 | SUBROUTINE trc_init( Kbb, Kmm, Kaa ) |
---|
| 45 | !!--------------------------------------------------------------------- |
---|
| 46 | !! *** ROUTINE trc_init *** |
---|
| 47 | !! |
---|
| 48 | !! ** Purpose : Initialization of the passive tracer fields |
---|
| 49 | !! |
---|
| 50 | !! ** Method : - read namelist |
---|
| 51 | !! - control the consistancy |
---|
| 52 | !! - compute specific initialisations |
---|
| 53 | !! - set initial tracer fields (either read restart |
---|
| 54 | !! or read data or analytical formulation |
---|
| 55 | !!--------------------------------------------------------------------- |
---|
| 56 | INTEGER, INTENT(in) :: Kbb, Kmm, Kaa ! time level indices |
---|
| 57 | ! |
---|
| 58 | IF( ln_timing ) CALL timing_start('trc_init') |
---|
| 59 | ! |
---|
| 60 | IF(lwp) WRITE(numout,*) |
---|
| 61 | IF(lwp) WRITE(numout,*) 'trc_init : initial set up of the passive tracers' |
---|
| 62 | IF(lwp) WRITE(numout,*) '~~~~~~~~' |
---|
| 63 | ! |
---|
| 64 | CALL trc_nam ! read passive tracers namelists |
---|
| 65 | CALL top_alloc() ! allocate TOP arrays |
---|
| 66 | |
---|
| 67 | ! |
---|
| 68 | IF(.NOT.ln_trcdta ) ln_trc_ini(:) = .FALSE. |
---|
| 69 | ! |
---|
| 70 | IF(lwp) WRITE(numout,*) |
---|
| 71 | IF( ln_rsttr .AND. .NOT. l_offline ) CALL trc_rst_cal( nit000, 'READ' ) ! calendar |
---|
| 72 | IF(lwp) WRITE(numout,*) |
---|
| 73 | ! |
---|
| 74 | CALL trc_ini_sms( Kmm ) ! SMS |
---|
| 75 | CALL trc_ini_trp ! passive tracers transport |
---|
| 76 | CALL trc_ice_ini ! Tracers in sea ice |
---|
| 77 | ! |
---|
| 78 | IF( lwm .AND. sn_cfctl%l_trcstat ) THEN |
---|
| 79 | CALL ctl_opn( numstr, 'tracer.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp , narea ) |
---|
| 80 | ENDIF |
---|
| 81 | ! |
---|
| 82 | CALL trc_ini_state( Kbb, Kmm, Kaa ) ! passive tracers initialisation : from a restart or from clim |
---|
| 83 | ! |
---|
| 84 | CALL trc_ini_inv( Kmm ) ! Inventories |
---|
| 85 | ! |
---|
| 86 | IF( ln_timing ) CALL timing_stop('trc_init') |
---|
| 87 | ! |
---|
| 88 | END SUBROUTINE trc_init |
---|
| 89 | |
---|
| 90 | |
---|
| 91 | SUBROUTINE trc_ini_inv( Kmm ) |
---|
| 92 | !!---------------------------------------------------------------------- |
---|
| 93 | !! *** ROUTINE trc_ini_stat *** |
---|
| 94 | !! ** Purpose : passive tracers inventories at initialsation phase |
---|
| 95 | !!---------------------------------------------------------------------- |
---|
| 96 | INTEGER, INTENT(in) :: Kmm ! time level index |
---|
| 97 | INTEGER :: jk, jn ! dummy loop indices |
---|
| 98 | CHARACTER (len=25) :: charout |
---|
| 99 | REAL(wp), DIMENSION(jpi,jpj,jpk,jptra) :: zzmsk |
---|
| 100 | !!---------------------------------------------------------------------- |
---|
| 101 | ! |
---|
| 102 | IF(lwp) WRITE(numout,*) |
---|
| 103 | IF(lwp) WRITE(numout,*) 'trc_ini_inv : initial passive tracers inventories' |
---|
| 104 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~~' |
---|
| 105 | ! |
---|
| 106 | ! ! masked grid volume |
---|
| 107 | DO jk = 1, jpk |
---|
| 108 | cvol(:,:,jk) = e1e2t(:,:) * e3t(:,:,jk,Kmm) * tmask(:,:,jk) |
---|
| 109 | END DO |
---|
| 110 | ! ! total volume of the ocean |
---|
| 111 | areatot = glob_sum( 'trcini', cvol(:,:,:) ) |
---|
| 112 | ! |
---|
| 113 | trai(:) = 0._wp ! initial content of all tracers |
---|
| 114 | DO jn = 1, jptra |
---|
| 115 | trai(jn) = trai(jn) + glob_sum( 'trcini', tr(:,:,:,jn,Kmm) * cvol(:,:,:) ) |
---|
| 116 | END DO |
---|
| 117 | |
---|
| 118 | IF(lwp) THEN ! control print |
---|
| 119 | WRITE(numout,*) |
---|
| 120 | WRITE(numout,*) ' ==>>> Total number of passive tracer jptra = ', jptra |
---|
| 121 | WRITE(numout,*) ' Total volume of ocean = ', areatot |
---|
| 122 | WRITE(numout,*) ' Total inital content of all tracers ' |
---|
| 123 | WRITE(numout,*) |
---|
| 124 | DO jn = 1, jptra |
---|
| 125 | WRITE(numout,9000) jn, TRIM( ctrcnm(jn) ), trai(jn) |
---|
| 126 | ENDDO |
---|
| 127 | WRITE(numout,*) |
---|
| 128 | ENDIF |
---|
| 129 | IF(lwp) WRITE(numout,*) |
---|
| 130 | IF(sn_cfctl%l_prttrc) THEN ! print mean trends (used for debugging) |
---|
| 131 | CALL prt_ctl_init( 'top', jptra ) |
---|
| 132 | WRITE(charout, FMT="('ini ')") |
---|
| 133 | CALL prt_ctl_info( charout, cdcomp = 'top' ) |
---|
| 134 | CALL prt_ctl( tab4d_1=tr(:,:,:,:,Kmm), mask1=tmask, clinfo=ctrcnm ) |
---|
| 135 | ENDIF |
---|
| 136 | 9000 FORMAT(' tracer nb : ',i2,' name :',a10,' initial content :',e18.10) |
---|
| 137 | ! |
---|
| 138 | END SUBROUTINE trc_ini_inv |
---|
| 139 | |
---|
| 140 | |
---|
| 141 | SUBROUTINE trc_ini_sms( Kmm ) |
---|
| 142 | !!---------------------------------------------------------------------- |
---|
| 143 | !! *** ROUTINE trc_ini_sms *** |
---|
| 144 | !! ** Purpose : SMS initialisation |
---|
| 145 | !!---------------------------------------------------------------------- |
---|
| 146 | USE trcini_pisces ! PISCES initialisation |
---|
| 147 | USE trcini_cfc ! CFC initialisation |
---|
| 148 | USE trcini_c14 ! C14 initialisation |
---|
| 149 | USE trcini_age ! age initialisation |
---|
| 150 | USE trcini_my_trc ! MY_TRC initialisation |
---|
| 151 | ! |
---|
| 152 | INTEGER, INTENT(in) :: Kmm ! time level indices |
---|
| 153 | INTEGER :: jn |
---|
| 154 | !!---------------------------------------------------------------------- |
---|
| 155 | ! |
---|
| 156 | ! Pass sn_tracer fields to specialized arrays |
---|
| 157 | DO jn = 1, jp_bgc |
---|
| 158 | ctrcnm (jn) = TRIM( sn_tracer(jn)%clsname ) |
---|
| 159 | ctrcln (jn) = TRIM( sn_tracer(jn)%cllname ) |
---|
| 160 | ctrcun (jn) = TRIM( sn_tracer(jn)%clunit ) |
---|
| 161 | ln_trc_ini(jn) = sn_tracer(jn)%llinit |
---|
| 162 | ln_trc_sbc(jn) = sn_tracer(jn)%llsbc |
---|
| 163 | ln_trc_cbc(jn) = sn_tracer(jn)%llcbc |
---|
| 164 | ln_trc_obc(jn) = sn_tracer(jn)%llobc |
---|
| 165 | ln_trc_ais(jn) = sn_tracer(jn)%llais |
---|
| 166 | END DO |
---|
| 167 | ! |
---|
| 168 | IF( .NOT.ln_trcbc ) THEN |
---|
| 169 | DO jn = 1, jp_bgc |
---|
| 170 | ln_trc_sbc(jn) = .FALSE. |
---|
| 171 | ln_trc_cbc(jn) = .FALSE. |
---|
| 172 | ln_trc_obc(jn) = .FALSE. |
---|
| 173 | END DO |
---|
| 174 | ENDIF |
---|
| 175 | |
---|
| 176 | lltrcbc = ( COUNT(ln_trc_sbc) + COUNT(ln_trc_obc) + COUNT(ln_trc_cbc) ) > 0 |
---|
| 177 | ! |
---|
| 178 | IF( ln_pisces ) CALL trc_ini_pisces( Kmm ) ! PISCES model |
---|
| 179 | IF( ln_my_trc ) CALL trc_ini_my_trc( Kmm ) ! MY_TRC model |
---|
| 180 | IF( ll_cfc ) CALL trc_ini_cfc ( Kmm ) ! CFC's |
---|
| 181 | IF( ln_c14 ) CALL trc_ini_c14 ( Kmm ) ! C14 model |
---|
| 182 | IF( ln_age ) CALL trc_ini_age ( Kmm ) ! AGE |
---|
| 183 | ! |
---|
| 184 | IF(lwp) THEN ! control print |
---|
| 185 | WRITE(numout,*) |
---|
| 186 | WRITE(numout,*) 'trc_init_sms : Summary for selected passive tracers' |
---|
| 187 | WRITE(numout,*) '~~~~~~~~~~~~' |
---|
| 188 | WRITE(numout,*) ' ID NAME INI SBC CBC OBC AIS' |
---|
| 189 | DO jn = 1, jptra |
---|
| 190 | WRITE(numout,9001) jn, TRIM(ctrcnm(jn)), ln_trc_ini(jn),ln_trc_sbc(jn),ln_trc_cbc(jn),ln_trc_obc(jn),ln_trc_ais(jn) |
---|
| 191 | END DO |
---|
| 192 | ENDIF |
---|
| 193 | IF( lwp .AND. ln_trcbc .AND. lltrcbc ) THEN |
---|
| 194 | WRITE(numout,*) |
---|
| 195 | WRITE(numout,*) ' Applying tracer boundary conditions ' |
---|
| 196 | ENDIF |
---|
| 197 | ! |
---|
| 198 | IF( lwp .AND. ln_trcais ) THEN |
---|
| 199 | WRITE(numout,*) |
---|
| 200 | WRITE(numout,*) ' Applying tracer from Antarctic Ice Sheet ' |
---|
| 201 | ENDIF |
---|
| 202 | |
---|
| 203 | 9001 FORMAT(3x,i3,1x,a10,3x,l2,3x,l2,3x,l2,3x,l2,3x,l2) |
---|
| 204 | ! |
---|
| 205 | END SUBROUTINE trc_ini_sms |
---|
| 206 | |
---|
| 207 | |
---|
| 208 | SUBROUTINE trc_ini_trp |
---|
| 209 | !!---------------------------------------------------------------------- |
---|
| 210 | !! *** ROUTINE trc_ini_trp *** |
---|
| 211 | !! |
---|
| 212 | !! ** Purpose : Allocate all the dynamic arrays of the OCE modules |
---|
| 213 | !!---------------------------------------------------------------------- |
---|
| 214 | USE trcdmp , ONLY: trc_dmp_ini |
---|
| 215 | USE trcadv , ONLY: trc_adv_ini |
---|
| 216 | USE trcldf , ONLY: trc_ldf_ini |
---|
| 217 | USE trcrad , ONLY: trc_rad_ini |
---|
| 218 | USE trcsink, ONLY: trc_sink_ini |
---|
| 219 | ! |
---|
| 220 | INTEGER :: ierr |
---|
| 221 | !!---------------------------------------------------------------------- |
---|
| 222 | ! |
---|
| 223 | IF( ln_trcdmp ) CALL trc_dmp_ini ! damping |
---|
| 224 | CALL trc_adv_ini ! advection |
---|
| 225 | CALL trc_ldf_ini ! lateral diffusion |
---|
| 226 | ! ! vertical diffusion: always implicit time stepping scheme |
---|
| 227 | CALL trc_rad_ini ! positivity of passive tracers |
---|
| 228 | CALL trc_sink_ini ! Vertical sedimentation of particles |
---|
| 229 | ! |
---|
| 230 | END SUBROUTINE trc_ini_trp |
---|
| 231 | |
---|
| 232 | |
---|
| 233 | SUBROUTINE trc_ini_state( Kbb, Kmm, Kaa ) |
---|
| 234 | !!---------------------------------------------------------------------- |
---|
| 235 | !! *** ROUTINE trc_ini_state *** |
---|
| 236 | !! ** Purpose : Initialisation of passive tracer concentration |
---|
| 237 | !!---------------------------------------------------------------------- |
---|
| 238 | USE trcrst ! passive tracers restart |
---|
| 239 | USE trcdta ! initialisation from files |
---|
| 240 | ! |
---|
| 241 | INTEGER, INTENT(in) :: Kbb, Kmm, Kaa ! time level index |
---|
| 242 | INTEGER :: jn, jl ! dummy loop indices |
---|
| 243 | !!---------------------------------------------------------------------- |
---|
| 244 | ! |
---|
| 245 | IF( ln_trcdta ) CALL trc_dta_ini( jptra ) ! set initial tracers values |
---|
| 246 | ! |
---|
| 247 | IF( ln_rsttr ) THEN ! restart from a file |
---|
| 248 | ! |
---|
| 249 | CALL trc_rst_read( Kbb, Kmm ) |
---|
| 250 | ! |
---|
| 251 | ELSE ! Initialisation of tracer from a file that may also be used for damping |
---|
| 252 | IF( ln_trcdta .AND. nb_trcdta > 0 ) THEN |
---|
| 253 | ! update passive tracers arrays with input data read from file |
---|
| 254 | DO jn = 1, jptra |
---|
| 255 | IF( ln_trc_ini(jn) ) THEN |
---|
| 256 | jl = n_trc_index(jn) |
---|
| 257 | CALL trc_dta( nit000, jl, tr(:,:,:,jn,Kmm) ) |
---|
| 258 | ENDIF |
---|
| 259 | END DO |
---|
| 260 | ! |
---|
| 261 | ENDIF |
---|
| 262 | ! |
---|
| 263 | tr(:,:,:,:,Kbb) = tr(:,:,:,:,Kmm) |
---|
| 264 | ! |
---|
| 265 | ENDIF |
---|
| 266 | ! |
---|
| 267 | tr(:,:,:,:,Kaa) = 0._wp |
---|
| 268 | ! |
---|
| 269 | IF( ln_bdy ) CALL trc_bdy_ini( jptra ) |
---|
| 270 | IF( ln_trcbc .AND. lltrcbc ) CALL trc_bc_ini( jptra, Kmm ) ! set tracers Boundary Conditions |
---|
| 271 | ! |
---|
| 272 | IF( ln_trcais ) CALL trc_ais_ini ! set tracers from Antarctic Ice Sheet |
---|
| 273 | ! ! Partial top/bottom cell: GRADh(tr(Kmm)) |
---|
| 274 | END SUBROUTINE trc_ini_state |
---|
| 275 | |
---|
| 276 | |
---|
| 277 | SUBROUTINE top_alloc |
---|
| 278 | !!---------------------------------------------------------------------- |
---|
| 279 | !! *** ROUTINE top_alloc *** |
---|
| 280 | !! |
---|
| 281 | !! ** Purpose : Allocate all the dynamic arrays of the OCE modules |
---|
| 282 | !!---------------------------------------------------------------------- |
---|
| 283 | USE trc , ONLY: trc_alloc |
---|
| 284 | USE trdtrc_oce , ONLY: trd_trc_oce_alloc |
---|
| 285 | #if defined key_trdmxl_trc |
---|
| 286 | USE trdmxl_trc , ONLY: trd_mxl_trc_alloc |
---|
| 287 | #endif |
---|
| 288 | ! |
---|
| 289 | INTEGER :: ierr ! local integer |
---|
| 290 | !!---------------------------------------------------------------------- |
---|
| 291 | ! |
---|
| 292 | ierr = trc_alloc() |
---|
| 293 | ierr = ierr + trd_trc_oce_alloc() |
---|
| 294 | #if defined key_trdmxl_trc |
---|
| 295 | ierr = ierr + trd_mxl_trc_alloc() |
---|
| 296 | #endif |
---|
| 297 | ! |
---|
| 298 | CALL mpp_sum( 'trcini', ierr ) |
---|
| 299 | IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'top_alloc : unable to allocate standard ocean arrays' ) |
---|
| 300 | ! |
---|
| 301 | END SUBROUTINE top_alloc |
---|
| 302 | |
---|
| 303 | #else |
---|
| 304 | !!---------------------------------------------------------------------- |
---|
| 305 | !! Empty module : No passive tracer |
---|
| 306 | !!---------------------------------------------------------------------- |
---|
| 307 | CONTAINS |
---|
| 308 | SUBROUTINE trc_init ! Dummy routine |
---|
| 309 | END SUBROUTINE trc_init |
---|
| 310 | #endif |
---|
| 311 | |
---|
| 312 | !!====================================================================== |
---|
| 313 | END MODULE trcini |
---|