Last edited [[Timestamp]] [[PageOutline]] === Author === Christian Ethé ---- === Branch === DEV_r1837_TRA_TRP ( the number of revision will be updated ) ---- === Description === '''Motivations''' [[BR]][[BR]] System simplification : Merge of active and passive tracer advection/diffusion modules to avoid duplication of almost identical modules [[BR]][[BR]] '''Strategy''' [[BR]] '''(1)''' Creation of generic advection/diffusion modules A generic routine will be able to work with either active or passive tracers. It will therefore use 4D tracer arrays that will be given in the argument of the routine. The 3 fields, before, now and after are systematically provided in argument even if some all are not necessary used in a given scheme. in diffusion modules (traldf..., trazdf...) : 4D tracer are given through input argument, where the 4th dimension is the tracer type (=2 for temp. and salinity in the active tracer case, =jptrc in the passive tracer one) in advection module (traadv...) : both the 4D tracer and transport components (e2u*e3u*u,...) are given through input argument. for example, for CEN2 advection the routine start as follows: {{{ SUBROUTINE tra_adv_cen2( kt, cdtype, pun, pvn, pwn, ptrab, ptran, ptraa ) !!---------------------------------------------------------------------- !! *** ROUTINE tra_adv_cen2 *** !! !! ** Purpose : !! !! ** Method : !!---------------------------------------------------------------------- INTEGER , INTENT(in ) :: kt ! ocean time-step index CHARACTER(len=3), INTENT(in ) :: cdtype ! =TRA or TRC (tracer indicator) REAL(wp) , INTENT(in ), DIMENSION(:,:,: ) :: pun, pvn, pwn ! 3 ocean transport components REAL(wp) , INTENT(in ), DIMENSION(:,:,:,:) :: ptrab, ptran ! before and now tracer fields REAL(wp) , INTENT(inout), DIMENSION(:,:,:,:) :: ptraa ! tracer trend }}} [[BR]] '''(2)''' Test for T & S 3D arrays by using the fortran '''''RESHAPE''''' function [[BR]][[BR]] In order to test the new tra... modules without changing the temperature and salinity field every where in the code, we use the RESHAPE function in the call of the new routine. For example the call in tra_adv becomes : {{{ SUBROUTINE tra_adv( kt ) !!---------------------------------------------------------------------- !! *** ROUTINE tra_adv *** !! !! ** Purpose : !! !! ** Method : !!---------------------------------------------------------------------- INTEGER, INTENT( in ) :: kt ! ocean time-step index !! INTEGER :: jk ! dummy loop index REAL(wp), DIMENSION(jpi,jpj,jpk) :: zun, zvn, zwn ! effective transports !!---------------------------------------------------------------------- ! ! effective transport DO jk = 1, jpkm1 #if defined key_trabbl_adv ! ! eulerian + bbl transport zun(:,:,jk) = e2u(:,:) * fse3u(:,:,jk) * ( un(:,:,jk) - u_bbl(:,:,jk) ) zvn(:,:,jk) = e1v(:,:) * fse3v(:,:,jk) * ( vn(:,:,jk) - v_bbl(:,:,jk) ) zwn(:,:,jk) = e1t(:,:) * e2t(:,:) * ( wn(:,:,jk) + w_bbl(:,:,jk) ) #else ! ! eulerian transport only zun(:,:,jk) = e2u(:,:) * fse3u(:,:,jk) * un(:,:,jk) zvn(:,:,jk) = e1v(:,:) * fse3v(:,:,jk) * vn(:,:,jk) zwn(:,:,jk) = e1t(:,:) * e2t(:,:) * wn(:,:,jk) #endif END DO zwn(:,:,jpk) = 0.e0 ! no transport trough the bottom ! ! add the eiv transport (if necessary) IF( lk_traldf_eiv ) CALL tra_adv_eiv( kt, zun, zvn, zwn ) CALL tra_adv_cen2( kt, 'TRA', zun, zvn, zwn , & & RESHAPE( tb, (/jpi,jpj,jpk,2/), sb ) , & & RESHAPE( tn, (/jpi,jpj,jpk,2/), sn ) , & & RESHAPE( ta, (/jpi,jpj,jpk,2/), sa ) ) ! 2nd order centered }}} N.B. the transport given in argument is now the effective transport, i.e. including the one associated with eddy induced velocity, or bbl. [[BR]] '''(3)''' Apply to the passive tracers [[BR]] with the 4D tracer arguments, the same module are use for active and passive tracers. The trcadv module becomes: {{{ SUBROUTINE trc_adv( kt ) !!---------------------------------------------------------------------- !! *** ROUTINE trc_adv *** !! !! ** Purpose : !! !! ** Method : !!---------------------------------------------------------------------- INTEGER, INTENT( in ) :: kt ! ocean time-step index !! INTEGER :: jk ! dummy loop index REAL(wp), DIMENSION(jpi,jpj,jpk) :: zun, zvn, zwn ! effective transports !!---------------------------------------------------------------------- ! ! effective transport DO jk = 1, jpkm1 #if defined key_trcbbl_adv ! ! eulerian + bbl transport zun(:,:,jk) = e2u(:,:) * fse3u(:,:,jk) * ( un(:,:,jk) - u_trc_bbl(:,:,jk) ) zvn(:,:,jk) = e1v(:,:) * fse3v(:,:,jk) * ( vn(:,:,jk) - v_trc_bbl(:,:,jk) ) zwn(:,:,jk) = e1t(:,:) * e2t(:,:) * ( wn(:,:,jk) + w_trc_bbl(:,:,jk) ) #else ! ! eulerian transport only zun(:,:,jk) = e2u(:,:) * fse3u(:,:,jk) * un(:,:,jk) zvn(:,:,jk) = e1v(:,:) * fse3v(:,:,jk) * vn(:,:,jk) zwn(:,:,jk) = e1t(:,:) * e2t(:,:) * wn(:,:,jk) #endif END DO zwn(:,:,jpk) = 0.e0 ! no transport trough the bottom ! ! add the eiv transport (if necessary) IF( lk_trcldf_eiv ) CALL trc_adv_eiv( kt, zun, zvn, zwn ) CALL tra_adv_cen2( kt, 'TRC', zun, zvn, zwn, trb, trn, tra ) ! 2nd order centered }}} [[BR]] '''(4)''' Final step : replace T and S 3D arrays by 4D arrays TS throughout the code [[BR]][[BR]] '''Additional Tasks'''[[BR]] [[BR]] - TRENDS[[BR]] * Split the OPA_SRC/TRD/trmod.F90 module in 2 modules * trends_dyn.F90 which manages dynamical trend diagnostics * trends_tra.F90 for the tracers trend diagnostics * As a starting point, both active & passive tracers trends modules ( trdmld.F90 & trdmld_trc.F90 ) will be encapsulate in one module [[BR]] - OBC[[BR]] * rewrite the radiative OBC with 4D array as input argument. OBC will be then available for passive tracers ---- === Testing === Testing could consider (where appropriate) other configurations in addition to NVTK]. ||NVTK Tested||!'''YES/NO!'''|| ||Other model configurations||!'''YES/NO!'''|| ||Processor configurations tested||[ Enter processor configs tested here ]|| ||If adding new functionality please confirm that the [[BR]]New code doesn't change results when it is switched off [[BR]]and !''works!'' when switched on||!'''YES/NO/NA!'''|| (Answering UNSURE is likely to generate further questions from reviewers.) 'Please add further summary details here' * Processor configurations tested * etc---- === Bit Comparability === ||Does this change preserve answers in your tested standard configurations (to the last bit) ?||!'''YES/NO !'''|| ||Does this change bit compare across various processor configurations. (1xM, Nx1 and MxN are recommended)||!'''YES/NO!'''|| ||Is this change expected to preserve answers in all possible model configurations?||!'''YES/NO!'''|| ||Is this change expected to preserve all diagnostics? [[BR]]!,,!''Preserving answers in model runs does not necessarily imply preserved diagnostics. !''||!'''YES/NO!'''|| If you answered !'''NO!''' to any of the above, please provide further details: * Which routine(s) are causing the difference? * Why the changes are not protected by a logical switch or new section-version * What is needed to achieve regression with the previous model release (e.g. a regression branch, hand-edits etc). If this is not possible, explain why not. * What do you expect to see occur in the test harness jobs? * Which diagnostics have you altered and why have they changed?Please add details here........ ---- === System Changes === ||Does your change alter namelists?||!'''YES/NO !'''|| ||Does your change require a change in compiler options?||!'''YES/NO !'''|| If any of these apply, please document the changes required here....... ---- === Resources === !''Please !''summarize!'' any changes in runtime or memory use caused by this change......!'' ---- === IPR issues === ||Has the code been wholly (100%) produced by NEMO developers staff working exclusively on NEMO?||!'''YES/ NO !'''|| If No: * Identify the collaboration agreement details * Ensure the code routine header is in accordance with the agreement, (Copyright/Redistribution etc).Add further details here if required..........