New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
ticket/0927_Energy_diag (diff) – NEMO

Changes between Version 56 and Version 57 of ticket/0927_Energy_diag


Ignore:
Timestamp:
2012-06-21T10:40:02+02:00 (12 years ago)
Author:
fabien.roquet
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ticket/0927_Energy_diag

    v56 v57  
    1 [[PageOutline]] Last edited [[Timestamp]]  !'''Author!''' : Gurvan Madec  !'''Ticket !''' : !#927  !'''Branch!''' : ![https://forge.ipsl.jussieu.fr/nemo/browser/branches/2012/dev_r3309_LOCEAN12_Ediag 2012/dev_r3309_LOCEAN12_Ediag]  ---- == !'''LOCEAN .12 - Energy diagnostics!''' == !'''     Motivation: !'''    output 3D trends of tracers, momentum, kinetic energy and potential energy.  !'''     Status :!''' the extraction of trends terms exists, but not the 3D output of the trends     !'''     Main tasks :!'''              (1) implement the 3D output of tracers and momentum trends using iom_put            (2) compute and output the 3D trends of PE and KE                 (3) validatation + documentation       !'''     Science Reviewer:! ''' NOCS guy?           !'''     System Reviewer:! '''  NOCS guy?          !'''     Deadline:! '''   spring 2012     !'''     Priority:! '''      high      !'''     Depends on:! '''    gurvan disponibilities     !'''     Principal Investigator : !'''      Gurvan Madec and Simona Flavoni (simona.flavoni@locean-ipsl.upmc.fr)       ---- == !''' Detail of the implementation!''' == ---- === !''' Step I : add the 3D output !''' === see ![https://forge.ipsl.jussieu.fr/nemo/log/branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC?rev=3316 revision 3316]    !'''        trdmod_oce!'''         module and !'''        namtrd namelist!'''              logical flags added in namlist namtrd which now controls what is done with the trends.   All the types of treatment of a given trend are available at the same time. The memory requirement will only increase due to the time averaged arrays defined in IOM.  !{{{    LOGICAL , PUBLIC  ::   ln_dyn_trd   = .FALSE.        !: (T) 3D momentum             trends or (F) not    LOGICAL , PUBLIC  ::   ln_tra_trd   = .FALSE.        !: (T) 3D tracer               trends or (F) not    LOGICAL , PUBLIC  ::   ln_PE_trd    = .FALSE.        !: (T) 3D Potential Energy     trends or (F) not    LOGICAL , PUBLIC  ::   ln_KE_trd    = .FALSE.        !: (T) 3D Kinetic   Energy     trends or (F) not    LOGICAL , PUBLIC  ::   ln_vor_trd   = .FALSE.        !: (T) 3D barotropic vorticity trends or (F) not    LOGICAL , PUBLIC  ::   ln_glo_trd   = .FALSE.        !: (T) global domain averaged diag for T, T^2, KE, and PE    LOGICAL , PUBLIC  ::   ln_dyn_mld   = .FALSE.        !: (T) 2D tracer   trends averaged over the mixed layer     LOGICAL , PUBLIC  ::   ln_tra_mld   = .FALSE.        !: (T) 2D momentum trends averaged over the mixed layer  }}} Add these new logical in the namelist. !'''==>>> CAUTION only in the ORCA2_LIM directory!'''   NB: here is the new name set in revision number 3318     !'''        trdtra!'''         module     Add a systematic mask of the trend.  Change the comments to better describe the purpose of this module. Its purpose is:      'TRA' case:  to regroup T & S trends and send them to trd_mod, with, in case of advection, transform the incoming advective fluxes into advctive trend (U.grad[T])           'TRC' case:  send trend to ted_mod_trc, with,  in case of advection,  transform the incoming advective fluxes into advective trend            all cases  : mask the trend    (!'''        ===>>>   PROBABLY add in the module a lbc_lnk so that the trend is defined everywhere!'''        )    !'''        dynadv_cen2 and _ubs!'''         modules     change jpdyn_trd_had  into jpdyn_trd_keg. Now in flux form _keg corresponds to the horizontal advection trends and _rvo to the metric terms       !'''        dynnxt!'''         module     add the output using mom of the total den trend (except asselin time filter) ("utrd_tot", "vtrd_tot") and of the asselin time filter trend ("utrd_atf", "vtrd_atf") but with a shift by one time step       !'''        dynvor, trdvor and trdmod_oce!'''         modules     suppress the call to trd_mod in the jpdyn_trd_dat case (computation of beta.V) add add the calculation of beta.V term in 'trdvor' in jpvor_pvo case. And obviously suppress jpdyn_trd_dat from trdmod_oce   Also suppress the jpdyn_trd_had case  horizontal advection for the dynamics is 'keg' + 'vor'  ; in case of flux form,  'had' is put in 'keg' and the metric terms is put in 'vor'   there is now only 10 trends on the dynamics instead of 12       !'''        trdmod!'''         module     1- introduce the new logical namelist parameters  2- introduce new subroutines : !'''trd_budget!''' : computation of the domain averaged T,T!^2!^, PE, KE trends formerly computes in trd_mod routine)  !''' trd_3Diom!''': output of the 3D trends using IOM        !'''        trdicp!'''         module     add in trd_twr routine the computation of the vertical diffusive trend on T & S in case of iso-neutral diffusion (ln_traldf_iso=T). These trends ("ttrd_zdfp", "strd_zdfp")  name zdfp for "PURE" vertical diffusion trends are output so that by difference with "zdf" trends we can access to the vertical contribution of the iso-neutral operator        !'''        iodef.xml!'''         file     add all the trends nick name : !'''==>>> CAUTION only in the ORCA2_LIM directory!'''      ---- === !''' Step II : simplification of the structure !''' ===   !'''        trdicp and trdicp_oce!'''         modules     see ![https://forge.ipsl.jussieu.fr/nemo/log/branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC?rev=3317 revision 3317]  1- suppress trdicp_oce module (put required variables in trdmod_oce parameters)  2- use the jptra_trd_...  instead of jpicp_...  3- move trd_budget subroutine from trdmod to trdicp.F90. Suppress trd_icp routine (i.e. trd_2d, trd_3d) as the work is now simply done in trd_budget.  4- rescan all dyn/tra trend indices. add jptra_trd_zdfp for "PURE Kz dissusive trend when ln_traldf_iso=T (see also changes in tranxt where a call to trd_tra is done just before the swap, so that PURE Kz trends can be diagnosed in tra_trd. See also xml file).  5- jptra_trd_nsr and jptra_trd_cdt are 3D trends as their incorporate both surface forcing AND runoff, the later being possibly spread in depth (!'''==>>> probably to be changed!''')  6- suppress the key_trddyn key trdtra  from trdicp     !'''        trdtra - trddyn - trdmod - trdvor!'''         modules : impact on !'''        TRA!'''        , !'''        DYN!'''        , !'''        TRD!'''         and almost all !'''        TOP_SRC!'''         modules     see ![https://forge.ipsl.jussieu.fr/nemo/log/branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC?rev=3318 revision 3318]  Change the logic : split DYN and TRA trend diagnostics in separate modules   move the call to trd_... from the end of step to the select CASE(jp..._atf) i.e. when the last trend is send to trdtra or trddyn   Change the name of the trend indices from jptra_trd_xxx to jptra_xxx and from jpdyn_trd_yyy to jpdyn_yyy. This impact TRA,DYN, TRD but also all TOP_SRC   0- move trdmod_oce into trd_oce  1- trdvor: move the trdvor 1st part from trdmod to trevor module. Suppress the call of trd_vor from step (now called in trddyn for each trend, with the output done for the last trend (_atf).   2- create a trddyn that manage the distribution to iom, global mean, KE, vor, mld   3- trdtra in TRC case pre-process advective trends and then call trdmod_trc ; in TRA case: it regroups T & S trend in one and calla local routine to manage the distribution to iom, global mean, PE, mld  4- trdmod now contains only the trdmod_init routine. Rename all as trdini.F90 and ted_init subroutine 5- suppress all !'''key_trd...!''' keys (thanks to dynamical allocation) except for the top key: !'''key_trdmld_trc!'''.   !''' ==>>> To be done!'''    ---- === !''' Step III : addition of 3D KE diagnostics !''' ===   !'''        trdken!'''         module     see ![https://forge.ipsl.jussieu.fr/nemo/log/branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC?rev=3325 revision 3325]  0- bug correction:  in trddyn.F90  (ji,jj) ==>> (:,:) in surface stress computation   1- create a trdken.F90 module which compute the KE trends at T-point and out them using IOM  TO BE DONE: diagnose the KE local dissipation and associated diffusive fluxes ; diagnose bottom friction in all cases (implicit/explicit) ; in flux form, remove the KE*divh(U) from the H/V advection trends  NB: Missing the KE trends in the xml files ; Bug in trdtra: 2 call to ted_tra_mng in case of jptra_zdfp. Both corrected in Step IV release (see below)  ---- === !''' Step IV : addition of 3D PE diagnostics !''' ===   !'''        trdpen!'''         module     see ![https://forge.ipsl.jussieu.fr/nemo/log/branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC?rev=3326 revision 3326] and ![https://forge.ipsl.jussieu.fr/nemo/log/branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC?rev=3327 revision 3327] 0- correct a bug in trdtra and trdken  1- add xml name for both PE and KE   2- create a trdpen.F90 module which compute the PE trends at T-point and out them using IOM  3- introduce in eosbn2 a subroutine, eos_drau_dtds, that computes the partial derivative off in situ density with respect to T and S (NB: only coded the 2 linear eos, !'''TO BE DONE  for the UNESCO eos!''' (nn_eos=0)  4- correct a few bugs and adopt almost systematic CASE structure in trdtra (see revision 3327)  NB: to be verified: the addition of a ssh term in PE for NOT lk_vvl case  NB: runoff put as a source term in the divergence computation since v3.3 (see divcur), implication for source term in PE, but also tracer trends ? !'''Think about that!'''''!''''                    !'''Pending issues!''' :    atmospheric pressure gradient trend not taken into account (see dynspg.F90  !'''        To be done !!!!'''                !'''    kpp non-local trend put in zdf trends !!!  this will not work ! a additional trend term should be add !'''        To be done !!!!'''                !'''    problems to be solved: vvl case for tracer sad trends ; flux form case for had (keg) and zad momentum trends       add separate modules for each option ...    create the momentum diag over the ML    reshape trdtra so that T and S are treated separately in all ted routine (including mld diag...)  !'''Changes done by Fabien R.!'''    In trdtra.F90:   * removed semi-colon on lines 118 and 267.  * replaced ln_glo_trd by ln_PE_trd in line 239.  * Moved wrk_alloc and wrk_dealloc  in the IF (.NOT.lk_vvl ) structure.  In trddyn.F90:   * Added wrk_alloc, wrk_dealloc and lbc_lnk in trd_dyn_iom.    Remove unused variables ztswu, ztswv.  * Following norm in the code, utrd_bfr and vtrd_bfr should be filled only when ln_bfrimp=.FALSE. (non implicit bottom friction).  * Implicit bottom friction is calculated at the end of each timestep, in dynzdf_imp.    The diagnostic of bottom friction in the implicit case is saved in separate variable names to avoid confusion: utrd_bfr_imp and vtrd_bfr_imp.    Similarly, diagnostics of wind stress inputs are provided in 2D fields utrd_tau and vtrd_tau.  In step.F90:   * Added "IF( .NOT.ln_bfrimp)" before the "CALL dyn_bfr( kstp )" to clarify that dyn_bfr is called only if bottom friction is explicit, as proposed by gm.  In trdglo.F90:   * In trd_glo_init, corrected definition for tvolt:             tvolt = tvolt + SUM( e1e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk) * tmask_i(:,:) )  * Treatment of bfr has been clarified: if bfr is implicit (ln_bfrimp=.TRUE.), the bottom friction term remain 0, as bottom friction is implicitly included in the vertical diffusion term.  In trd_oce.F90    ---- === Testing === Testing could consider (where appropriate) other configurations in addition to NVTK].  ''' 
    2  
    3 || 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.......... || 
    4  
    51[[PageOutline]] Last edited [[Timestamp]] 
    62 
     
    128 
    139---- 
    14 == '''LOCEAN .12 - Energy diagnostics''' == 
     10'''LOCEAN .12 - Energy diagnostics''' 
     11 
    1512'''     Motivation: '''    output 3D trends of tracers, momentum, kinetic energy and potential energy.[[BR]] '''     Status :''' the extraction of trends terms exists, but not the 3D output of the trends   [[BR]] '''     Main tasks :'''         [[BR]] 
    1613 
    17   (1) implement the 3D output of tracers and momentum trends using iom_put [[BR]]                               (2) compute and output the 3D trends of PE and KE [[BR]]                                    (3) validatation + documentation  [[BR]] 
     14  (1) implement the 3D output of tracers and momentum trends using iom_put [[BR]]                                (2) compute and output the 3D trends of PE and KE [[BR]]                                     (3) validatation + documentation  [[BR]] 
    1815 
    1916'''     Science Reviewer:''' NOCS guy?     [[BR]]     '''     System Reviewer:'''  NOCS guy?     [[BR]]    '''     Deadline:'''   spring 2012   [[BR]] '''     Priority:'''      high    [[BR]] '''     Depends on:'''    gurvan disponibilities   [[BR]] '''     Principal Investigator : '''      Gurvan Madec and Simona Flavoni (simona.flavoni@locean-ipsl.upmc.fr)  [[BR]] [[BR]] 
    2017 
    2118---- 
    22 == ''' Detail of the implementation''' == 
    23 ---- 
    24 === ''' Step I : add the 3D output ''' === 
     19''' Detail of the implementation''' 
     20 
     21---- 
     22''' Step I : add the 3D output ''' 
     23 
    2524see [https://forge.ipsl.jussieu.fr/nemo/log/branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC?rev=3316 revision 3316] 
    2625 
    27   '''                               trdmod_oce'''                                module and '''                               namtrd namelist'''                                [[BR]] 
     26  '''                                trdmod_oce'''                                 module and '''                                namtrd namelist'''                                 [[BR]] 
    2827 
    2928logical flags added in namlist namtrd which now controls what is done with the trends. [[BR]] All the types of treatment of a given trend are available at the same time. The memory requirement will only increase due to the time averaged arrays defined in IOM. 
    3029 
    31 {{{ 
    32    LOGICAL , PUBLIC  ::   ln_dyn_trd   = .FALSE.        !: (T) 3D momentum             trends or (F) not 
    33    LOGICAL , PUBLIC  ::   ln_tra_trd   = .FALSE.        !: (T) 3D tracer               trends or (F) not 
    34    LOGICAL , PUBLIC  ::   ln_PE_trd    = .FALSE.        !: (T) 3D Potential Energy     trends or (F) not 
    35    LOGICAL , PUBLIC  ::   ln_KE_trd    = .FALSE.        !: (T) 3D Kinetic   Energy     trends or (F) not 
    36    LOGICAL , PUBLIC  ::   ln_vor_trd   = .FALSE.        !: (T) 3D barotropic vorticity trends or (F) not 
    37    LOGICAL , PUBLIC  ::   ln_glo_trd   = .FALSE.        !: (T) global domain averaged diag for T, T^2, KE, and PE 
    38    LOGICAL , PUBLIC  ::   ln_dyn_mld   = .FALSE.        !: (T) 2D tracer   trends averaged over the mixed layer  
    39    LOGICAL , PUBLIC  ::   ln_tra_mld   = .FALSE.        !: (T) 2D momentum trends averaged over the mixed layer  
    40 }}} 
     30LOGICAL , PUBLIC  ::   ln_dyn_trd   = .FALSE.        !: (T) 3D momentum             trends or (F) not    LOGICAL , PUBLIC  ::   ln_tra_trd   = .FALSE.        !: (T) 3D tracer               trends or (F) not    LOGICAL , PUBLIC  ::   ln_PE_trd    = .FALSE.        !: (T) 3D Potential Energy     trends or (F) not    LOGICAL , PUBLIC  ::   ln_KE_trd    = .FALSE.        !: (T) 3D Kinetic   Energy     trends or (F) not    LOGICAL , PUBLIC  ::   ln_vor_trd   = .FALSE.        !: (T) 3D barotropic vorticity trends or (F) not    LOGICAL , PUBLIC  ::   ln_glo_trd   = .FALSE.        !: (T) global domain averaged diag for T, T!^2, KE, and PE    LOGICAL , PUBLIC  ::   ln_dyn_mld   = .FALSE.        !: (T) 2D tracer   trends averaged over the mixed layer     LOGICAL , PUBLIC  ::   ln_tra_mld   = .FALSE.        !: (T) 2D momentum trends averaged over the mixed layer 
     31 
    4132Add these new logical in the namelist. '''==>>> CAUTION only in the ORCA2_LIM directory''' [[BR]] NB: here is the new name set in revision number 3318[[BR]] 
    4233 
    43   '''                               trdtra'''                                module[[BR]] 
     34  '''                                trdtra'''                                 module[[BR]] 
    4435 
    4536Add a systematic mask of the trend.[[BR]] Change the comments to better describe the purpose of this module. Its purpose is: [[BR]] 
    4637 
    47   'TRA' case:  to regroup T & S trends and send them to trd_mod, with, in case of advection, transform the incoming advective fluxes into advctive trend (U.grad[T])[[BR]]                               'TRC' case:  send trend to ted_mod_trc, with,  in case of advection,  transform the incoming advective fluxes into advective trend [[BR]]                               all cases  : mask the trend    ('''                               ===>>>   PROBABLY add in the module a lbc_lnk so that the trend is defined everywhere'''                               ) 
    48  
    49   '''                               dynadv_cen2 and _ubs'''                                modules[[BR]] 
     38  'TRA' case:  to regroup T & S trends and send them to trd_mod, with, in case of advection, transform the incoming advective fluxes into advctive trend (U.grad[T])[[BR]]                                'TRC' case:  send trend to ted_mod_trc, with,  in case of advection,  transform the incoming advective fluxes into advective trend [[BR]]                                all cases  : mask the trend    ('''                                ===>>>   PROBABLY add in the module a lbc_lnk so that the trend is defined everywhere'''                                ) 
     39 
     40  '''                                dynadv_cen2 and _ubs'''                                 modules[[BR]] 
    5041 
    5142change jpdyn_trd_had  into jpdyn_trd_keg. Now in flux form _keg corresponds to the horizontal advection trends and _rvo to the metric terms[[BR]] [[BR]] 
    5243 
    53   '''                               dynnxt'''                                module[[BR]] 
     44  '''                                dynnxt'''                                 module[[BR]] 
    5445 
    5546add the output using mom of the total den trend (except asselin time filter) ("utrd_tot", "vtrd_tot") and of the asselin time filter trend ("utrd_atf", "vtrd_atf") but with a shift by one time step[[BR]] [[BR]] 
    5647 
    57   '''                               dynvor, trdvor and trdmod_oce'''                                modules[[BR]] 
     48  '''                                dynvor, trdvor and trdmod_oce'''                                 modules[[BR]] 
    5849 
    5950suppress the call to trd_mod in the jpdyn_trd_dat case (computation of beta.V) add add the calculation of beta.V term in 'trdvor' in jpvor_pvo case. And obviously suppress jpdyn_trd_dat from trdmod_oce [[BR]] Also suppress the jpdyn_trd_had case  horizontal advection for the dynamics is 'keg' + 'vor'  ; in case of flux form,  'had' is put in 'keg' and the metric terms is put in 'vor' [[BR]] there is now only 10 trends on the dynamics instead of 12[[BR]] [[BR]] 
    6051 
    61   '''                               trdmod'''                                module[[BR]] 
     52  '''                                trdmod'''                                 module[[BR]] 
    6253 
    63541- introduce the new logical namelist parameters[[BR]] 2- introduce new subroutines : '''trd_budget''' : computation of the domain averaged T,T^2^, PE, KE trends formerly computes in trd_mod routine)[[BR]] ''' trd_3Diom''': output of the 3D trends using IOM [[BR]] [[BR]] 
    6455 
    65   '''                               trdicp'''                                module[[BR]] 
     56  '''                                trdicp'''                                 module[[BR]] 
    6657 
    6758add in trd_twr routine the computation of the vertical diffusive trend on T & S in case of iso-neutral diffusion (ln_traldf_iso=T). These trends ("ttrd_zdfp", "strd_zdfp")  name zdfp for "PURE" vertical diffusion trends are output so that by difference with "zdf" trends we can access to the vertical contribution of the iso-neutral operator [[BR]] [[BR]] 
    6859 
    69   '''                               iodef.xml'''                                file[[BR]] 
     60  '''                                iodef.xml'''                                 file[[BR]] 
    7061 
    7162add all the trends nick name : '''==>>> CAUTION only in the ORCA2_LIM directory''' [[BR]] [[BR]] 
    7263 
    7364---- 
    74 === ''' Step II : simplification of the structure ''' === 
    75   '''                               trdicp and trdicp_oce'''                                modules[[BR]] 
     65''' Step II : simplification of the structure ''' 
     66 
     67  '''                                trdicp and trdicp_oce'''                                 modules[[BR]] 
    7668 
    7769see [https://forge.ipsl.jussieu.fr/nemo/log/branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC?rev=3317 revision 3317] 
     
    79711- suppress trdicp_oce module (put required variables in trdmod_oce parameters)[[BR]] 2- use the jptra_trd_...  instead of jpicp_...  3- move trd_budget subroutine from trdmod to trdicp.F90. Suppress trd_icp routine (i.e. trd_2d, trd_3d) as the work is now simply done in trd_budget.[[BR]] 4- rescan all dyn/tra trend indices. add jptra_trd_zdfp for "PURE Kz dissusive trend when ln_traldf_iso=T (see also changes in tranxt where a call to trd_tra is done just before the swap, so that PURE Kz trends can be diagnosed in tra_trd. See also xml file).  5- jptra_trd_nsr and jptra_trd_cdt are 3D trends as their incorporate both surface forcing AND runoff, the later being possibly spread in depth ('''==>>> probably to be changed''')[[BR]] 6- suppress the key_trddyn key trdtra  from trdicp[[BR]] 
    8072 
    81   '''                               trdtra - trddyn - trdmod - trdvor'''                                modules : impact on '''                               TRA'''                               , '''                               DYN'''                               , '''                               TRD'''                                and almost all '''                               TOP_SRC'''                                modules[[BR]] 
     73  '''                                trdtra - trddyn - trdmod - trdvor'''                                 modules : impact on '''                                TRA'''                                , '''                                DYN'''                                , '''                                TRD'''                                 and almost all '''                                TOP_SRC'''                                 modules[[BR]] 
    8274 
    8375see [https://forge.ipsl.jussieu.fr/nemo/log/branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC?rev=3318 revision 3318] 
     
    9284 
    9385---- 
    94 === ''' Step III : addition of 3D KE diagnostics ''' === 
    95   '''                               trdken'''                                module[[BR]] 
     86''' Step III : addition of 3D KE diagnostics ''' 
     87 
     88  '''                                trdken'''                                 module[[BR]] 
    9689 
    9790see [https://forge.ipsl.jussieu.fr/nemo/log/branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC?rev=3325 revision 3325] 
     
    10699 
    107100---- 
    108 === ''' Step IV : addition of 3D PE diagnostics ''' === 
    109   '''                               trdpen'''                                module[[BR]] 
     101''' Step IV : addition of 3D PE diagnostics ''' 
     102 
     103  '''                                trdpen'''                                 module[[BR]] 
    110104 
    111105see [https://forge.ipsl.jussieu.fr/nemo/log/branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC?rev=3326 revision 3326] and [https://forge.ipsl.jussieu.fr/nemo/log/branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC?rev=3327 revision 3327] 0- correct a bug in trdtra and trdken 
     
    123117[[BR]] [[BR]] [[BR]] [[BR]] [[BR]] [[BR]] [[BR]] [[BR]] [[BR]] '''Pending issues''' : 
    124118 
    125   atmospheric pressure gradient trend not taken into account (see dynspg.F90  '''                               To be done !!!!'''                               [[BR]]                              ''' 
    126  
    127   kpp non-local trend put in zdf trends !!!  this will not work ! a additional trend term should be add '''                               To be done !!!!'''                               [[BR]]                              ''' 
     119  atmospheric pressure gradient trend not taken into account (see dynspg.F90  '''                                To be done !!!!'''                                [[BR]]                               ''' 
     120 
     121  kpp non-local trend put in zdf trends !!!  this will not work ! a additional trend term should be add '''                                To be done !!!!'''                                [[BR]]                               ''' 
    128122 
    129123  problems to be solved: vvl case for tracer sad trends ; flux form case for had (keg) and zad momentum trends[[BR]] 
     
    140134 
    141135 * removed semi-colon on lines 118 and 267. 
     136 
     137 
    142138 * replaced ln_glo_trd by ln_PE_trd in line 239. 
     139 
     140 
    143141 * Moved wrk_alloc and wrk_dealloc  in the IF (.NOT.lk_vvl ) structure. 
    144142 
     143 
     144 
    145145In trddyn.F90: 
    146146 
    147  * Added wrk_alloc, wrk_dealloc and lbc_lnk in trd_dyn_iom.[[BR]]Remove unused variables ztswu, ztswv. 
     147 * Added wrk_alloc, wrk_dealloc and lbc_lnk in trd_dyn_iom. 
     148 
     149Remove unused variables ztswu, ztswv. 
     150 
     151 
    148152 * Following norm in the code, utrd_bfr and vtrd_bfr should be filled only when ln_bfrimp=.FALSE. (non implicit bottom friction). 
    149  * Implicit bottom friction is calculated at the end of each timestep, in dynzdf_imp.[[BR]]The diagnostic of bottom friction in the implicit case is saved in separate variable names to avoid confusion: utrd_bfri and vtrd_bfri.[[BR]]Similarly, diagnostics of wind stress inputs are provided in 2D fields utrd_tau and vtrd_tau. 
     153 
     154 
     155 * Implicit bottom friction is calculated at the end of each timestep, in dynzdf_imp. 
     156 
     157The diagnostic of bottom friction in the implicit case is saved in separate variable names to avoid confusion: utrd_bfri and vtrd_bfri. 
     158 
     159Similarly, diagnostics of wind stress inputs are provided in 2D fields utrd_tau and vtrd_tau. 
     160 
     161 
    150162 
    151163In step.F90: 
     
    153165 * Added "IF( .NOT.ln_bfrimp)" before the "CALL dyn_bfr( kstp )" to clarify that dyn_bfr is called only if bottom friction is explicit, as proposed by gm. 
    154166 
     167 
     168 
    155169In trdglo.F90: 
    156170 
    157  * In trd_glo_init, corrected definition for tvolt:[[BR]]         tvolt = tvolt + SUM( e1e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk) * tmask_i(:,:) ) 
     171 * In trd_glo_init, corrected definition for tvolt: 
     172 
     173tvolt = tvolt + SUM( e1e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk) * tmask_i(:,:) ) 
     174 
     175 
    158176 * Treatment of bfr has been clarified: if bfr is implicit (ln_bfrimp=.TRUE.), the bottom friction term remain 0, as bottom friction is implicitly included in the vertical diffusion term. 
     177 
     178 
    159179 * Correction of outputs of dynamic trends and hke. 
     180 
     181 
    160182 * What is the test: "pressure gradient u2 = - 1/rau0 u.dz(rhop)" ? Identity is not verified in my configuration! 
     183 
     184 
    161185 * Wind stress is always zero (although not in the 3d diag provided in trddyn.F90) 
     186 
     187 
    162188 * TODO: Once trddyn and trdtra are ready, use them for trdglo computations... 
     189 
     190 
    163191 * In glo_dyn_wri, missing zcof to compute density flux at w-point?! 
     192 
     193 
    164194 * Conversion is calculated as -g*div(rho*U)/rho0 !! Not sure what the link with -rho*g*w... 
    165195 
     196 
     197 
    166198In trd_oce.F90 
    167199 
    168 {{{ 
    169    INTEGER, PUBLIC, PARAMETER ::   jptot_dyn  = 13     !: Total trend nb: change it when adding/removing one indice below 
    170    !                               ===============     !   
    171    INTEGER, PUBLIC, PARAMETER ::   jpdyn_hpg  =  1     !: hydrostatic pressure gradient  
    172    INTEGER, PUBLIC, PARAMETER ::   jpdyn_spg  =  2     !: surface     pressure gradient 
    173    INTEGER, PUBLIC, PARAMETER ::   jpdyn_keg  =  3     !: kinetic energy gradient  or horizontal advection 
    174    INTEGER, PUBLIC, PARAMETER ::   jpdyn_rvo  =  4     !: relative  vorticity      or metric term 
    175    INTEGER, PUBLIC, PARAMETER ::   jpdyn_pvo  =  5     !: planetary vorticity 
    176    INTEGER, PUBLIC, PARAMETER ::   jpdyn_zad  =  6     !: vertical advection 
    177    INTEGER, PUBLIC, PARAMETER ::   jpdyn_ldf  =  7     !: horizontal diffusion    
    178    INTEGER, PUBLIC, PARAMETER ::   jpdyn_zdf  =  8     !: vertical   diffusion 
    179    INTEGER, PUBLIC, PARAMETER ::   jpdyn_bfr  =  9     !: bottom  stress  
    180    INTEGER, PUBLIC, PARAMETER ::   jpdyn_atf  = 10     !: Asselin time filter 
    181    INTEGER, PUBLIC, PARAMETER ::   jpdyn_tau  = 11     !: surface stress 
    182    INTEGER, PUBLIC, PARAMETER ::   jpdyn_bfri = 12     !: implicit bottom friction (ln_bfrimp=.TRUE.) 
    183    INTEGER, PUBLIC, PARAMETER ::   jpdyn_ken  = 13     !: use for calculation of KE 
    184  
    185  
    186 }}} 
     200INTEGER, PUBLIC, PARAMETER ::   jptot_dyn  = 13     !: Total trend nb: change it when adding/removing one indice below    !                               ===============     !      INTEGER, PUBLIC, PARAMETER ::   jpdyn_hpg  =  1     !: hydrostatic pressure gradient     INTEGER, PUBLIC, PARAMETER ::   jpdyn_spg  =  2     !: surface     pressure gradient    INTEGER, PUBLIC, PARAMETER ::   jpdyn_keg  =  3     !: kinetic energy gradient  or horizontal advection    INTEGER, PUBLIC, PARAMETER ::   jpdyn_rvo  =  4     !: relative  vorticity      or metric term    INTEGER, PUBLIC, PARAMETER ::   jpdyn_pvo  =  5     !: planetary vorticity    INTEGER, PUBLIC, PARAMETER ::   jpdyn_zad  =  6     !: vertical advection    INTEGER, PUBLIC, PARAMETER ::   jpdyn_ldf  =  7     !: horizontal diffusion       INTEGER, PUBLIC, PARAMETER ::   jpdyn_zdf  =  8     !: vertical   diffusion    INTEGER, PUBLIC, PARAMETER ::   jpdyn_bfr  =  9     !: bottom  stress     INTEGER, PUBLIC, PARAMETER ::   jpdyn_atf  = 10     !: Asselin time filter    INTEGER, PUBLIC, PARAMETER ::   jpdyn_tau  = 11     !: surface stress    INTEGER, PUBLIC, PARAMETER ::   jpdyn_bfri = 12     !: implicit bottom friction (ln_bfrimp=.TRUE.)    INTEGER, PUBLIC, PARAMETER ::   jpdyn_ken  = 13     !: use for calculation of KE 
     201 
    187202 * where jpdyn_tau and jpdyn_bfri are diagnostics of surface and bottom stress, respectively. 
     203 
     204 
    188205 * jpdyn_ken has been added for the calculation of KE in dynnxt.F90 (done just before the swap) 
    189206 
     207 
     208 
    190209In trd_ken.F90: 
    191210 
    192211 * l110: DO ji = 2, jpj should be DO ji = 2, jpi 
     212 
     213 
    193214 * Same in l133, l152 and l178. 
     215 
     216 
    194217 * In l183, replaced "ketrd_bfr" by "ketrd_bfri" to avoid confusion with "ketrd_bfr". 
    195  * Important: contribution from atf is calculated with un and vn, after they have been updated.[[BR]]  A small error is made: the contribution of ATF term at time t is recorded with trends taken at t-1. 
     218 
     219 
     220 * Important: contribution from atf is calculated with un and vn, after they have been updated. 
     221 
     222A small error is made: the contribution of ATF term at time t is recorded with trends taken at t-1. 
     223 
     224 
    196225 * In trd_ken_init, the 3 variables fse3x_n were replaced by their constant value fse3x for the non-vvl case. 
     226 
     227 
    197228 * Definition of KE (kinetic_energy in xml) at time t+1/2: KE(t+1/2)=rau0*u(t)*u(t+1)/2, calculated during dynnxt.F90, using ktrd=jpdyn_ken. 
     229 
     230 
    198231 * l. 109: multiplication by rau0 of zke to obtain KE trends in W/m3, and KE in J/m3. 
     232 
     233 
    199234 * remove r1_2_rau0 variable, which is no more used. 
     235 
     236 
    200237 * Add subroutine ken_conv_P2K to compute conversion rate. 
    201238 
     239 
     240 
    202241In dynspg_flt: 
    203242 
    204243 * Add a diagnostic of the explicit and implicit (due to filter) contributions to SPG. 
     244 
     245 
    205246 * sshimp: diagnostic of the ssh modification due to filter. 
    206247 
     248 
     249 
    207250In dynnxt.F90 
    208251 
    209252 * rn_atfp=0.1 in the GYRE configuration, but in the Documentation 6.9, rn_atfp (not nn_atfp!!) is said to be typically equal to 0.001. Is it normal? 
     253 
     254 
    210255 * computation of z1_2dt must be put before the IF( ln_dyn_trd ) block (l. 194 and 195) 
     256 
     257 
    211258 * Add call to ken_conv_P2K (+USE trdken) and save conv rate in ketrd_convP2K (l. 200) 
    212259 
     260 
     261 
    213262In eosbn2.F90 
    214263 
    215264 * Add Vallis equation of state (Vallis 2006, p34-35): most simple form of EOS which accounts for thermobaricity, cabelling and compressibility. 
     265 
     266 
    216267 * STRANGE: nn_eos=0 case is a modified version of the Jackett and McDougall (1995) EOS!! Numerically close though... 
     268 
     269 
    217270 * Add original  [wiki:McDougall Jackett and McDougall] (1995) EOS (nn_eos=-1) 
     271 
     272 
    218273   * Buoyancy frequency calculation: exact formulation. 
     274 
     275 
    219276   * Same for alpha and beta 
     277 
     278 
    220279 * eos_alpha_beta added, which provides alpha and beta 
    221  * compute_pen added to provide PE anomaly, and its partial derivatives with respect to T and S, needed in PE diagnostic (trdpen).[[BR]]PE anomaly is the anomaly of PE: (PE - rau0*gz)/(rau0*gz). For a linear case, PE anomaly is equal to density anomaly (nice isn't it?)[[BR]]Done for linear case, and Vallis case. [[BR]]Not ready yet for realistic cases... (discussion with Trevor is needed!)[[BR]]When z=0, PE anomaly is always defined asymptotically, converging toward the density anomaly value. 
     280 
     281 
     282 * compute_pen added to provide PE anomaly, and its partial derivatives with respect to T and S, needed in PE diagnostic (trdpen). 
     283 
     284PE anomaly is the anomaly of PE: (PE - rau0*gz)/(rau0*gz). For a linear case, PE anomaly is equal to density anomaly (nice isn't it?) 
     285 
     286Done for linear case, and Vallis case. 
     287 
     288Not ready yet for realistic cases... (discussion with Trevor is needed!) 
     289 
     290When z=0, PE anomaly is always defined asymptotically, converging toward the density anomaly value. 
     291 
     292 
    222293 * TODO: add global arrays for alpha and beta, computed at the same time than bn2? Indeed, they are used in several places, and are needed to compute bn2 in any case... 
     294 
     295 
    223296 * BUG: I don't understand why, but the linear case 1 is very slow, contrary to the others. Could it be coming from eos_alpbet? 
     297 
     298 
    224299 *  
    225300 
     
    228303 * Add 'trdt(:,:,:) = ptrd(:,:,:) * tmask(:,:,:)' in CASE jptra_bbc in trd_tra (l. 103) 
    229304 
     305 
     306 
    230307In trdpen.F90 
    231308 
    232309 * replace petrd_ldf by petrd_zdf in l. 102 
     310 
     311 
    233312 * renamed petrd_for as petrd_nsr for consistency with trd_oce (l. 107) 
     313 
     314 
    234315 * remove lines on petrd_sad in CASE jptra_atf in trd_pen: petrd_sad cannot be called 2 times. Furthermore, contribution of asselin filter on ssh must be diagnosed in ssh_nxt, not in tra_nxt!! 
     316 
     317 
    235318 * Remove '( nn_eos == 0 .OR. nn_eos == 3 ) .AND. ' in the condition to call pen_ddt_dds in trd_pen (l. 79). These two coefficients are updates at each timestep whatever the eos (very quick anyway for the linear case!) 
     319 
     320 
    236321 * Add 'CALL iom_put( "potential_energy", zpe )' in trd_pen, just after the call to pen_ddt_dds. 
     322 
     323 
    237324 * Replace ptrdx by ptrdy and remove multiplication by fsde3w to compute pe trends in trd_pen (l. 88-89) 
    238325 
     326 
     327 
    239328Bug during compilation: 
    240329 
    241  * make: Circular dynhpg.o <- trddyn.o dependency dropped[[BR]]patched by compiling a first time with the line 'USE trddyn' commented in dynhpg.F90, then recompiling with 'USE trddyn' decommented. 
     330 * make: Circular dynhpg.o <- trddyn.o dependency dropped 
     331 
     332patched by compiling a first time with the line 'USE trddyn' commented in dynhpg.F90, then recompiling with 'USE trddyn' decommented. 
     333 
     334 
    242335 
    243336Documentation: 
    244337 
    245338 * In Annex A, 
     339 
     340 
    246341   * change label name Apdx_A_grad_p in Apdx_A_grad_p2 l. 418 and 430. 
     342 
     343 
    247344   * sign error for vertical advection in Eq. A.18 (tracer equation) 
     345 
     346 
    248347 * In Annex C, sign errors corrected in discretization of HPG (p. 293) 
     348 
     349 
    249350 * In Chap_TRA, 
     351 
     352 
    250353   * update part 5.8 on equation of state to include reference to Vallis2006+JM95 true formulation 
     354 
     355 
    251356   * In Chap_DYN, correction of title 6.1.2, and references 
    252357 
    253 ---- 
    254 === Testing === 
     358 
     359 
     360---- 
     361Testing 
     362 
    255363Testing could consider (where appropriate) other configurations in addition to NVTK]. 
    256364 
     
    258366|| Other model configurations || !'''YES/NO!''' || 
    259367|| Processor configurations tested || [ Enter processor configs tested here ] || 
    260 || 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!''' || 
     368|| If adding new functionality please confirm that the[[BR]][[BR]]New code doesn't change results when it is switched off[[BR]][[BR]]and !''works!'' when switched on || !'''YES/NO/NA!''' || 
    261369 
    262370(Answering UNSURE is likely to generate further questions from reviewers.) 
     
    265373 
    266374 * Processor configurations tested 
     375 
     376 
    267377 * etc---- 
    268378 
    269 === Bit Comparability === 
     379 
     380 
     381Bit Comparability 
     382 
    270383|| Does this change preserve answers in your tested standard configurations (to the last bit) ? || !'''YES/NO !''' || 
    271384|| Does this change bit compare across various processor configurations. (1xM, Nx1 and MxN are recommended) || !'''YES/NO!''' || 
    272385|| Is this change expected to preserve answers in all possible model configurations? || !'''YES/NO!''' || 
    273 || Is this change expected to preserve all diagnostics? [[BR]]!,,!''Preserving answers in model runs does not necessarily imply preserved diagnostics. !'' || !'''YES/NO!''' || 
     386|| Is this change expected to preserve all diagnostics?[[BR]][[BR]]!,,!''Preserving answers in model runs does not necessarily imply preserved diagnostics. !'' || !'''YES/NO!''' || 
    274387 
    275388If you answered !'''NO!''' to any of the above, please provide further details: 
    276389 
    277390 * Which routine(s) are causing the difference? 
     391 
     392 
    278393 * Why the changes are not protected by a logical switch or new section-version 
     394 
     395 
    279396 * 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. 
     397 
     398 
    280399 * What do you expect to see occur in the test harness jobs? 
     400 
     401 
    281402 * Which diagnostics have you altered and why have they changed?Please add details here........ 
    282403 
    283 ---- 
    284 === System Changes === 
     404 
     405 
     406---- 
     407System Changes 
     408 
    285409|| Does your change alter namelists? || !'''YES/NO !''' || 
    286410|| Does your change require a change in compiler options? || !'''YES/NO !''' || 
     
    289413 
    290414---- 
    291 === Resources === 
     415Resources 
     416 
    292417!''Please !''summarize!'' any changes in runtime or memory use caused by this change......!'' 
    293418 
    294419---- 
    295 === IPR issues === 
     420IPR issues 
     421 
    296422|| Has the code been wholly (100%) produced by NEMO developers staff working exclusively on NEMO? || !'''YES/ NO !''' || 
    297423 
     
    299425 
    300426 * Identify the collaboration agreement details 
     427 
     428 
    301429 * Ensure the code routine header is in accordance with the agreement, (Copyright/Redistribution etc).Add further details here if required..........