= KERNEL-02_DaveStorkey_RK3Preparation The PI is responsible to closely follow the progress of the action, and especially to contact NEMO project manager if the delay on preview (or review) are longer than the 2 weeks expected. == Help The action has to be detailed briefly in the 'Summary' for later inclusion in other pages. To do so, '''edit 'Summary' section as a common wiki page and set links for the development ticket and branch'''. '''Out of this, the rest of the page ('Abstract'|'Preview'|'Tests'|'Review') can be edited on-line inside the form fields''' considering the following color code given hereafter: [[span(PI(S), style=background-color:lightgrey)]], [[span(Previewer(s), style=background-color:lightblue)]] and [[span(Reviewer(s), style=background-color:lightgreen)]].\\ Record your modifications for the section you have edited by clicking on the corresponding button at the end of the section with 'Save ...' button. Just above, the log record will be updated. The informations inside the form fields and this wiki page itself are stored in 2 separate databases. As a consequence, there is absolutely no risk to make any modification in the page itself as long as you don't rename the page or modify the source code of `{{{#!TracForm ... }}}` processors. == Summary #summary ||= '''Action''' =|| KERNEL-02_DaveStorkey_RK3Preparation || ||= '''PI(S)''' =|| Dave Storkey || {{{#!th '''Digest''' }}} {{{#!td Reorganisation of code to prepare for implementation of RK3 timestepping: 1. Prognostic fields to be passed to tendency routines as arguments. 2. Tracers to be consistency updated as extensive (volume-weighted) quantities throughout the code. }}} |- ||= '''Dependencies''' =|| || ||= '''Target''' =|| || ||= '''Trac Ticket''' =|| #0000 || ||= '''SVN branch''' =|| [source:/branches/$YEAR/dev_r{REV}_{SCOPE}-{NUM}_{PIS}-{KEYWORDS}] || ||= '''Previewer(s)''' =|| Gurvan Madec || ||= '''Reviewer(s)''' =|| Gurvan Madec || ||= '''Link''' =|| [[ExtractUrl(.)]] || {{{#!comment DON'T REMOVE THIS VOID HEADING OR IT WILL BREAK THE INCLUDE FEATURE BETWEEN WIKI PAGES }}} == == {{{#!comment DON'T REMOVE THIS VOID HEADING OR IT WILL BREAK THE INCLUDE FEATURE BETWEEN WIKI PAGES }}} {{{#!Fold title=Abstract tag=h2 [=#abstract] This section should be completed before starting to develop the code, in order to find agreement on the method beforehand. {{{#!TracForm #!subcontext abstract #!submit_label 'Save Abstract' #!keep_history yes === Description [tf.textarea:description -id=piform -class=taform 'Describe the goal of development, and the methodology.\n\nAdd reference documents or publications if relevant.' 0 20] === Implementation [tf.textarea:implementation -id=piform -class=taform 'Describe flow chart of the changes in the code.\n\nList the .F90 files and modules to be changed.\n\nDetailed list of new variables (including namelists) to be defined. Give for each the chosen name (following coding rules) and definition.' 0 20] === Reference manual and web pages updates [tf.textarea:manual -id=piform -class=taform 'Using part 1 and 2, define the summary of changes to be done in the NEMO reference manual (tex files), and in the content of web pages.' 0 20] '''''Updated on [tf.form_updated_on:] by [tf.form_updater:]''''' }}} Once the PI has completed this section, he should send a mail to the previewer(s) asking them to preview the work within two weeks. }}} {{{#!Fold title=Preview tag=h2 [=#preview] Part of the reorganisation for RK3 requires the refactoring of arrays such as un, ub into a single, 4 dimensional array with a time-level dimension. It is expected that much of the work required here can be automated to the extent that it is feasible to re-apply these changes after the annual merge. Below is a working example of how this might be achieved. Perl is used to carry out the pattern matching and substitution because of its ability to match patterns extending over several lines. A random subset of source files are used in this example and serve to illustrate the successes and caveats for the method. '''Version 2 -Tweaked refactoring script to handle indirect addressing (i.e. brackets within array indices)''' '''Step 1''' Perl is used in a 'edit in place' mode so the original files will be overwritten. Step 1 is therefore to create copies of the test files: {{{ #!/bin/bash mkdir TEST_FILES cp FLO/flo_oce.F90 FLO/floats.F90 SBC/sbcfwb.F90 DYN/dynadv_ubs.F90 DYN/dynkeg.F90 DYN/dynvor.F90 DYN/dynadv_cen2.F90 TEST_FILES cp FLO/flo_oce.F90 FLO/floats.F90 SBC/sbcfwb.F90 DYN/dynadv_ubs.F90 DYN/dynkeg.F90 DYN/dynvor.F90 DYN/dynadv_cen2.F90 TEST_FILES_ORG }}} '''The refactoring script''' {{{ #!/bin/bash # INVARS=( ub vb wb un vn wn ) OUTVARS=( uu vv ww uu vv ww ) TLEVS=( Nnn Nnn Nnn Nii Nii Nii ) # rm patch.list for f in TEST_FILES/*.F90 do echo "{{{#!diff" >> patch.list echo "Index: "$f >> patch.list echo "==============================" >> patch.list n=0 for n in `seq 0 1 $(( ${#INVARS[*]} - 1 ))` do perl -0777 -pi -e 's@([+.(,\s\-\/\*\%])'${INVARS[$n]}'(\s*)(\(((?:[^()]++|(?3))*)\))@\1'${OUTVARS[$n]}'\2\(\4,'${TLEVS[$n]}'\)@g' $f done diff -u TEST_FILES_ORG/`basename $f` $f >> patch.list echo "}}}" >> patch.list done }}} '''The refactoring script explained''' {{{ # Some bash arrays to list the old names, new names and associated time-level index. # The choice of names here is not meant to reflect a desired choice. Note all three arrays # must have the same number of entries INVARS=( ub vb wb un vn wn ) OUTVARS=( uu vv ww uu vv ww ) TLEVS=( jtb jtb jtb jtn jtn jtn ) # # Lines referring to patch.list are just generating some output for this Wiki page. # They can be ignored for the purposes of explaining the script # Loop over all files in test directory for f in TEST_FILES/*.F90 do # Loop over each input variable name for n in `seq 0 1 $(( ${#INVARS[*]} - 1 ))` do # The perl command: # -0777 -pi are the options that force replace in place operation. # Could elect to redirect to new files # The substitute command matches the INVAR string preceded by any of: +.(,whitespace-/*% # Any match here goes into the first pattern space (\1) # The INVAR string can have any amount of whitespace (including none) between it and an # opening bracket. This whitespace is preserved in pattern space 2 # Everything following the opening bracket to matching closing bracket # is stored in pattern space 3. This requires a recursion and pattern space 4 ends up with # the interior of the outer brackets # The RHS of the substitute command rebuilds the line replacing INVARS with OUTVARS and # adding a ,TLEVS before the closing bracket perl -0777 -pi -e 's@([+.(,\s\-\/\*\%])'${INVARS[$n]}'(\s*)(\(((?:[^()]++|(?3))*)\))@\1'${OUTVARS[$n]}'\2\(\4,'${TLEVS[$n]}'\)@g' $f # End of variable loop done # End of file loop done }}} ''' Some contrived tests:''' {{{ cat TEST_FILES_ORG/contrived_tests.F90 un(:,:,:) ! The simplest test. Should ==> uu(:,:,:,jtn) un ( ji , jj, : ) ! Check alternative simple case ==> uu ( ji , jj, :,jtn) a+ub(:,:,jk) ! Check preceeding operators are correctly recognised a-vb(:,:,jk) ! Check preceeding operators are correctly recognised a*vn(:,:,jk) ! Check preceeding operators are correctly recognised a/wb(:,:,jk) ! Check preceeding operators are correctly recognised a%wn(:,:,jk) ! Check preceeding operators are correctly recognised .OR.wn(:,:,jk) ! Check preceeding operators are correctly recognised (wn(:,:,jk) + wn(:,:,jk-1)) ! Check preceeding brackets are correctly recognised un ( ji+1 , & ! Check that entries over & jj, jk - 1 ) ! multiple lines are handled wn( mi0(ii) , mj0(jj )) ! Brackets within arguments may break [ does this occur?] pun(:,:,:) ! target preceded by non-whitespace or operator. Should be unchanged sbc_fwb(:,:,:) ! target preceded by non-whitespace or operator. Should be unchanged }}} '''Result of the script on the contrived tests:''' {{{ uu(:,:,:,Nii) ! The simplest test. Should ==> uu(:,:,:,jtn) uu ( ji , jj, : ,Nii) ! Check alternative simple case ==> uu ( ji , jj, :,jtn) a+uu(:,:,jk,Nnn) ! Check preceeding operators are correctly recognised a-vv(:,:,jk,Nnn) ! Check preceeding operators are correctly recognised a*vv(:,:,jk,Nii) ! Check preceeding operators are correctly recognised a/ww(:,:,jk,Nnn) ! Check preceeding operators are correctly recognised a%ww(:,:,jk,Nii) ! Check preceeding operators are correctly recognised .OR.ww(:,:,jk,Nii) ! Check preceeding operators are correctly recognised (ww(:,:,jk,Nii) + ww(:,:,jk-1,Nii)) ! Check preceeding brackets are correctly recognised uu ( ji+1 , & ! Check that entries over & jj, jk - 1 ,Nii) ! multiple lines are handled ww( mi0(ii) , mj0(jj ),Nii) ! Brackets within arguments may break [ does this occur?] pun(:,:,:) ! target preceded by non-whitespace or operator. Should be unchanged sbc_fwb(:,:,:) ! target preceded by non-whitespace or operator. Should be unchanged }}} {{{#!diff Index: TEST_FILES/contrived_tests.F90 ============================== --- TEST_FILES_ORG/contrived_tests.F90 2019-02-12 17:16:52.000000000 +0000 +++ TEST_FILES/contrived_tests.F90 2019-02-12 17:17:06.000000000 +0000 @@ -1,14 +1,14 @@ - un(:,:,:) ! The simplest test. Should ==> uu(:,:,:,jtn) - un ( ji , jj, : ) ! Check alternative simple case ==> uu ( ji , jj, :,jtn) - a+ub(:,:,jk) ! Check preceeding operators are correctly recognised - a-vb(:,:,jk) ! Check preceeding operators are correctly recognised - a*vn(:,:,jk) ! Check preceeding operators are correctly recognised - a/wb(:,:,jk) ! Check preceeding operators are correctly recognised - a%wn(:,:,jk) ! Check preceeding operators are correctly recognised - .OR.wn(:,:,jk) ! Check preceeding operators are correctly recognised - (wn(:,:,jk) + wn(:,:,jk-1)) ! Check preceeding brackets are correctly recognised - un ( ji+1 , & ! Check that entries over - & jj, jk - 1 ) ! multiple lines are handled - wn( mi0(ii) , mj0(jj )) ! Brackets within arguments may break [ does this occur?] + uu(:,:,:,Nii) ! The simplest test. Should ==> uu(:,:,:,jtn) + uu ( ji , jj, : ,Nii) ! Check alternative simple case ==> uu ( ji , jj, :,jtn) + a+uu(:,:,jk,Nnn) ! Check preceeding operators are correctly recognised + a-vv(:,:,jk,Nnn) ! Check preceeding operators are correctly recognised + a*vv(:,:,jk,Nii) ! Check preceeding operators are correctly recognised + a/ww(:,:,jk,Nnn) ! Check preceeding operators are correctly recognised + a%ww(:,:,jk,Nii) ! Check preceeding operators are correctly recognised + .OR.ww(:,:,jk,Nii) ! Check preceeding operators are correctly recognised + (ww(:,:,jk,Nii) + ww(:,:,jk-1,Nii)) ! Check preceeding brackets are correctly recognised + uu ( ji+1 , & ! Check that entries over + & jj, jk - 1 ,Nii) ! multiple lines are handled + ww( mi0(ii) , mj0(jj ),Nii) ! Brackets within arguments may break [ does this occur?] pun(:,:,:) ! target preceded by non-whitespace or operator. Should be unchanged sbc_fwb(:,:,:) ! target preceded by non-whitespace or operator. Should be unchanged }}} So all changes were made correctly and even those entries which were potential pitfalls (pun and sbc_fwb) were correctly ignored. Time to try a real set: '''The results on the sample set of files (patch.list):''' {{{#!diff Index: TEST_FILES/dynadv_cen2.F90 ============================== --- TEST_FILES_ORG/dynadv_cen2.F90 2019-02-08 10:51:12.000000000 +0000 +++ TEST_FILES/dynadv_cen2.F90 2019-02-12 17:17:06.000000000 +0000 @@ -66,14 +66,14 @@ ! !== Horizontal advection ==! ! DO jk = 1, jpkm1 ! horizontal transport - zfu(:,:,jk) = 0.25_wp * e2u(:,:) * e3u_n(:,:,jk) * un(:,:,jk) - zfv(:,:,jk) = 0.25_wp * e1v(:,:) * e3v_n(:,:,jk) * vn(:,:,jk) + zfu(:,:,jk) = 0.25_wp * e2u(:,:) * e3u_n(:,:,jk) * uu(:,:,jk,Nii) + zfv(:,:,jk) = 0.25_wp * e1v(:,:) * e3v_n(:,:,jk) * vv(:,:,jk,Nii) DO jj = 1, jpjm1 ! horizontal momentum fluxes (at T- and F-point) DO ji = 1, fs_jpim1 ! vector opt. - zfu_t(ji+1,jj ,jk) = ( zfu(ji,jj,jk) + zfu(ji+1,jj,jk) ) * ( un(ji,jj,jk) + un(ji+1,jj ,jk) ) - zfv_f(ji ,jj ,jk) = ( zfv(ji,jj,jk) + zfv(ji+1,jj,jk) ) * ( un(ji,jj,jk) + un(ji ,jj+1,jk) ) - zfu_f(ji ,jj ,jk) = ( zfu(ji,jj,jk) + zfu(ji,jj+1,jk) ) * ( vn(ji,jj,jk) + vn(ji+1,jj ,jk) ) - zfv_t(ji ,jj+1,jk) = ( zfv(ji,jj,jk) + zfv(ji,jj+1,jk) ) * ( vn(ji,jj,jk) + vn(ji ,jj+1,jk) ) + zfu_t(ji+1,jj ,jk) = ( zfu(ji,jj,jk) + zfu(ji+1,jj,jk) ) * ( uu(ji,jj,jk,Nii) + uu(ji+1,jj ,jk,Nii) ) + zfv_f(ji ,jj ,jk) = ( zfv(ji,jj,jk) + zfv(ji+1,jj,jk) ) * ( uu(ji,jj,jk,Nii) + uu(ji ,jj+1,jk,Nii) ) + zfu_f(ji ,jj ,jk) = ( zfu(ji,jj,jk) + zfu(ji,jj+1,jk) ) * ( vv(ji,jj,jk,Nii) + vv(ji+1,jj ,jk,Nii) ) + zfv_t(ji ,jj+1,jk) = ( zfv(ji,jj,jk) + zfv(ji,jj+1,jk) ) * ( vv(ji,jj,jk,Nii) + vv(ji ,jj+1,jk,Nii) ) END DO END DO DO jj = 2, jpjm1 ! divergence of horizontal momentum fluxes @@ -105,21 +105,21 @@ IF( ln_linssh ) THEN ! linear free surface: advection through the surface DO jj = 2, jpjm1 DO ji = fs_2, fs_jpim1 - zfu_uw(ji,jj,1) = 0.5_wp * ( e1e2t(ji,jj) * wn(ji,jj,1) + e1e2t(ji+1,jj) * wn(ji+1,jj,1) ) * un(ji,jj,1) - zfv_vw(ji,jj,1) = 0.5_wp * ( e1e2t(ji,jj) * wn(ji,jj,1) + e1e2t(ji,jj+1) * wn(ji,jj+1,1) ) * vn(ji,jj,1) + zfu_uw(ji,jj,1) = 0.5_wp * ( e1e2t(ji,jj) * ww(ji,jj,1,Nii) + e1e2t(ji+1,jj) * ww(ji+1,jj,1,Nii) ) * uu(ji,jj,1,Nii) + zfv_vw(ji,jj,1) = 0.5_wp * ( e1e2t(ji,jj) * ww(ji,jj,1,Nii) + e1e2t(ji,jj+1) * ww(ji,jj+1,1,Nii) ) * vv(ji,jj,1,Nii) END DO END DO ENDIF DO jk = 2, jpkm1 ! interior advective fluxes DO jj = 2, jpj ! 1/4 * Vertical transport DO ji = 2, jpi - zfw(ji,jj,jk) = 0.25_wp * e1e2t(ji,jj) * wn(ji,jj,jk) + zfw(ji,jj,jk) = 0.25_wp * e1e2t(ji,jj) * ww(ji,jj,jk,Nii) END DO END DO DO jj = 2, jpjm1 DO ji = fs_2, fs_jpim1 ! vector opt. - zfu_uw(ji,jj,jk) = ( zfw(ji,jj,jk) + zfw(ji+1,jj ,jk) ) * ( un(ji,jj,jk) + un(ji,jj,jk-1) ) - zfv_vw(ji,jj,jk) = ( zfw(ji,jj,jk) + zfw(ji ,jj+1,jk) ) * ( vn(ji,jj,jk) + vn(ji,jj,jk-1) ) + zfu_uw(ji,jj,jk) = ( zfw(ji,jj,jk) + zfw(ji+1,jj ,jk) ) * ( uu(ji,jj,jk,Nii) + uu(ji,jj,jk-1,Nii) ) + zfv_vw(ji,jj,jk) = ( zfw(ji,jj,jk) + zfw(ji ,jj+1,jk) ) * ( vv(ji,jj,jk,Nii) + vv(ji,jj,jk-1,Nii) ) END DO END DO END DO }}} {{{#!diff Index: TEST_FILES/dynadv_ubs.F90 ============================== --- TEST_FILES_ORG/dynadv_ubs.F90 2019-02-08 10:51:12.000000000 +0000 +++ TEST_FILES/dynadv_ubs.F90 2019-02-12 17:17:06.000000000 +0000 @@ -101,17 +101,17 @@ DO jk = 1, jpkm1 ! Laplacian of the velocity ! ! ! =========================== ! ! ! horizontal volume fluxes - zfu(:,:,jk) = e2u(:,:) * e3u_n(:,:,jk) * un(:,:,jk) - zfv(:,:,jk) = e1v(:,:) * e3v_n(:,:,jk) * vn(:,:,jk) + zfu(:,:,jk) = e2u(:,:) * e3u_n(:,:,jk) * uu(:,:,jk,Nii) + zfv(:,:,jk) = e1v(:,:) * e3v_n(:,:,jk) * vv(:,:,jk,Nii) ! DO jj = 2, jpjm1 ! laplacian DO ji = fs_2, fs_jpim1 ! vector opt. - zlu_uu(ji,jj,jk,1) = ( ub (ji+1,jj ,jk) - 2.*ub (ji,jj,jk) + ub (ji-1,jj ,jk) ) * umask(ji,jj,jk) - zlv_vv(ji,jj,jk,1) = ( vb (ji ,jj+1,jk) - 2.*vb (ji,jj,jk) + vb (ji ,jj-1,jk) ) * vmask(ji,jj,jk) - zlu_uv(ji,jj,jk,1) = ( ub (ji ,jj+1,jk) - ub (ji ,jj ,jk) ) * fmask(ji ,jj ,jk) & - & - ( ub (ji ,jj ,jk) - ub (ji ,jj-1,jk) ) * fmask(ji ,jj-1,jk) - zlv_vu(ji,jj,jk,1) = ( vb (ji+1,jj ,jk) - vb (ji ,jj ,jk) ) * fmask(ji ,jj ,jk) & - & - ( vb (ji ,jj ,jk) - vb (ji-1,jj ,jk) ) * fmask(ji-1,jj ,jk) + zlu_uu(ji,jj,jk,1) = ( uu (ji+1,jj ,jk,Nnn) - 2.*uu (ji,jj,jk,Nnn) + uu (ji-1,jj ,jk,Nnn) ) * umask(ji,jj,jk) + zlv_vv(ji,jj,jk,1) = ( vv (ji ,jj+1,jk,Nnn) - 2.*vv (ji,jj,jk,Nnn) + vv (ji ,jj-1,jk,Nnn) ) * vmask(ji,jj,jk) + zlu_uv(ji,jj,jk,1) = ( uu (ji ,jj+1,jk,Nnn) - uu (ji ,jj ,jk,Nnn) ) * fmask(ji ,jj ,jk) & + & - ( uu (ji ,jj ,jk,Nnn) - uu (ji ,jj-1,jk,Nnn) ) * fmask(ji ,jj-1,jk) + zlv_vu(ji,jj,jk,1) = ( vv (ji+1,jj ,jk,Nnn) - vv (ji ,jj ,jk,Nnn) ) * fmask(ji ,jj ,jk) & + & - ( vv (ji ,jj ,jk,Nnn) - vv (ji-1,jj ,jk,Nnn) ) * fmask(ji-1,jj ,jk) ! zlu_uu(ji,jj,jk,2) = ( zfu(ji+1,jj ,jk) - 2.*zfu(ji,jj,jk) + zfu(ji-1,jj ,jk) ) * umask(ji,jj,jk) zlv_vv(ji,jj,jk,2) = ( zfv(ji ,jj+1,jk) - 2.*zfv(ji,jj,jk) + zfv(ji ,jj-1,jk) ) * vmask(ji,jj,jk) @@ -131,13 +131,13 @@ ! ! Horizontal advection ! DO jk = 1, jpkm1 ! ====================== ! ! ! horizontal volume fluxes - zfu(:,:,jk) = 0.25_wp * e2u(:,:) * e3u_n(:,:,jk) * un(:,:,jk) - zfv(:,:,jk) = 0.25_wp * e1v(:,:) * e3v_n(:,:,jk) * vn(:,:,jk) + zfu(:,:,jk) = 0.25_wp * e2u(:,:) * e3u_n(:,:,jk) * uu(:,:,jk,Nii) + zfv(:,:,jk) = 0.25_wp * e1v(:,:) * e3v_n(:,:,jk) * vv(:,:,jk,Nii) ! DO jj = 1, jpjm1 ! horizontal momentum fluxes at T- and F-point DO ji = 1, fs_jpim1 ! vector opt. - zui = ( un(ji,jj,jk) + un(ji+1,jj ,jk) ) - zvj = ( vn(ji,jj,jk) + vn(ji ,jj+1,jk) ) + zui = ( uu(ji,jj,jk,Nii) + uu(ji+1,jj ,jk,Nii) ) + zvj = ( vv(ji,jj,jk,Nii) + vv(ji ,jj+1,jk,Nii) ) ! IF( zui > 0 ) THEN ; zl_u = zlu_uu(ji ,jj,jk,1) ELSE ; zl_u = zlu_uu(ji+1,jj,jk,1) @@ -163,9 +163,9 @@ ENDIF ! zfv_f(ji ,jj ,jk) = ( zfvi - gamma2 * ( zlv_vu(ji,jj,jk,2) + zlv_vu(ji+1,jj ,jk,2) ) ) & - & * ( un(ji,jj,jk) + un(ji ,jj+1,jk) - gamma1 * zl_u ) + & * ( uu(ji,jj,jk,Nii) + uu(ji ,jj+1,jk,Nii) - gamma1 * zl_u ) zfu_f(ji ,jj ,jk) = ( zfuj - gamma2 * ( zlu_uv(ji,jj,jk,2) + zlu_uv(ji ,jj+1,jk,2) ) ) & - & * ( vn(ji,jj,jk) + vn(ji+1,jj ,jk) - gamma1 * zl_v ) + & * ( vv(ji,jj,jk,Nii) + vv(ji+1,jj ,jk,Nii) - gamma1 * zl_v ) END DO END DO DO jj = 2, jpjm1 ! divergence of horizontal momentum fluxes @@ -198,21 +198,21 @@ IF( ln_linssh ) THEN ! constant volume : advection through the surface DO jj = 2, jpjm1 DO ji = fs_2, fs_jpim1 - zfu_uw(ji,jj,1) = 0.5_wp * ( e1e2t(ji,jj) * wn(ji,jj,1) + e1e2t(ji+1,jj) * wn(ji+1,jj,1) ) * un(ji,jj,1) - zfv_vw(ji,jj,1) = 0.5_wp * ( e1e2t(ji,jj) * wn(ji,jj,1) + e1e2t(ji,jj+1) * wn(ji,jj+1,1) ) * vn(ji,jj,1) + zfu_uw(ji,jj,1) = 0.5_wp * ( e1e2t(ji,jj) * ww(ji,jj,1,Nii) + e1e2t(ji+1,jj) * ww(ji+1,jj,1,Nii) ) * uu(ji,jj,1,Nii) + zfv_vw(ji,jj,1) = 0.5_wp * ( e1e2t(ji,jj) * ww(ji,jj,1,Nii) + e1e2t(ji,jj+1) * ww(ji,jj+1,1,Nii) ) * vv(ji,jj,1,Nii) END DO END DO ENDIF DO jk = 2, jpkm1 ! interior fluxes DO jj = 2, jpj DO ji = 2, jpi - zfw(ji,jj,jk) = 0.25_wp * e1e2t(ji,jj) * wn(ji,jj,jk) + zfw(ji,jj,jk) = 0.25_wp * e1e2t(ji,jj) * ww(ji,jj,jk,Nii) END DO END DO DO jj = 2, jpjm1 DO ji = fs_2, fs_jpim1 ! vector opt. - zfu_uw(ji,jj,jk) = ( zfw(ji,jj,jk)+ zfw(ji+1,jj,jk) ) * ( un(ji,jj,jk) + un(ji,jj,jk-1) ) - zfv_vw(ji,jj,jk) = ( zfw(ji,jj,jk)+ zfw(ji,jj+1,jk) ) * ( vn(ji,jj,jk) + vn(ji,jj,jk-1) ) + zfu_uw(ji,jj,jk) = ( zfw(ji,jj,jk)+ zfw(ji+1,jj,jk) ) * ( uu(ji,jj,jk,Nii) + uu(ji,jj,jk-1,Nii) ) + zfv_vw(ji,jj,jk) = ( zfw(ji,jj,jk)+ zfw(ji,jj+1,jk) ) * ( vv(ji,jj,jk,Nii) + vv(ji,jj,jk-1,Nii) ) END DO END DO END DO }}} {{{#!diff Index: TEST_FILES/dynkeg.F90 ============================== --- TEST_FILES_ORG/dynkeg.F90 2019-02-08 10:51:12.000000000 +0000 +++ TEST_FILES/dynkeg.F90 2019-02-12 17:17:06.000000000 +0000 @@ -56,8 +56,8 @@ !! zhke = 1/2 [ mi-1( un^2 ) + mj-1( vn^2 ) ] !! * kscheme = nkeg_HW : Hollingsworth correction following !! Arakawa (2001). The now horizontal kinetic energy is given by: - !! zhke = 1/6 [ mi-1( 2 * un^2 + ((un(j+1)+un(j-1))/2)^2 ) - !! + mj-1( 2 * vn^2 + ((vn(i+1)+vn(i-1))/2)^2 ) ] + !! zhke = 1/6 [ mi-1( 2 * un^2 + ((uu(j+1,Nii)+uu(j-1,Nii))/2)^2 ) + !! + mj-1( 2 * vn^2 + ((vv(i+1,Nii)+vv(i-1,Nii))/2)^2 ) ] !! !! Take its horizontal gradient and add it to the general momentum !! trend (ua,va). @@ -108,7 +108,7 @@ ii = idx_bdy(ib_bdy)%nbi(jb,igrd) ij = idx_bdy(ib_bdy)%nbj(jb,igrd) ifu = NINT( idx_bdy(ib_bdy)%flagu(jb,igrd) ) - un(ii-ifu,ij,jk) = un(ii,ij,jk) * umask(ii,ij,jk) + uu(ii-ifu,ij,jk,Nii) = uu(ii,ij,jk,Nii) * umask(ii,ij,jk) END DO END DO ! @@ -118,7 +118,7 @@ ii = idx_bdy(ib_bdy)%nbi(jb,igrd) ij = idx_bdy(ib_bdy)%nbj(jb,igrd) ifv = NINT( idx_bdy(ib_bdy)%flagv(jb,igrd) ) - vn(ii,ij-ifv,jk) = vn(ii,ij,jk) * vmask(ii,ij,jk) + vv(ii,ij-ifv,jk,Nii) = vv(ii,ij,jk,Nii) * vmask(ii,ij,jk) END DO END DO ENDIF @@ -131,10 +131,10 @@ DO jk = 1, jpkm1 DO jj = 2, jpj DO ji = fs_2, jpi ! vector opt. - zu = un(ji-1,jj ,jk) * un(ji-1,jj ,jk) & - & + un(ji ,jj ,jk) * un(ji ,jj ,jk) - zv = vn(ji ,jj-1,jk) * vn(ji ,jj-1,jk) & - & + vn(ji ,jj ,jk) * vn(ji ,jj ,jk) + zu = uu(ji-1,jj ,jk,Nii) * uu(ji-1,jj ,jk,Nii) & + & + uu(ji ,jj ,jk,Nii) * uu(ji ,jj ,jk,Nii) + zv = vv(ji ,jj-1,jk,Nii) * vv(ji ,jj-1,jk,Nii) & + & + vv(ji ,jj ,jk,Nii) * vv(ji ,jj ,jk,Nii) zhke(ji,jj,jk) = 0.25_wp * ( zv + zu ) END DO END DO @@ -144,15 +144,15 @@ DO jk = 1, jpkm1 DO jj = 2, jpjm1 DO ji = fs_2, jpim1 ! vector opt. - zu = 8._wp * ( un(ji-1,jj ,jk) * un(ji-1,jj ,jk) & - & + un(ji ,jj ,jk) * un(ji ,jj ,jk) ) & - & + ( un(ji-1,jj-1,jk) + un(ji-1,jj+1,jk) ) * ( un(ji-1,jj-1,jk) + un(ji-1,jj+1,jk) ) & - & + ( un(ji ,jj-1,jk) + un(ji ,jj+1,jk) ) * ( un(ji ,jj-1,jk) + un(ji ,jj+1,jk) ) + zu = 8._wp * ( uu(ji-1,jj ,jk,Nii) * uu(ji-1,jj ,jk,Nii) & + & + uu(ji ,jj ,jk,Nii) * uu(ji ,jj ,jk,Nii) ) & + & + ( uu(ji-1,jj-1,jk,Nii) + uu(ji-1,jj+1,jk,Nii) ) * ( uu(ji-1,jj-1,jk,Nii) + uu(ji-1,jj+1,jk,Nii) ) & + & + ( uu(ji ,jj-1,jk,Nii) + uu(ji ,jj+1,jk,Nii) ) * ( uu(ji ,jj-1,jk,Nii) + uu(ji ,jj+1,jk,Nii) ) ! - zv = 8._wp * ( vn(ji ,jj-1,jk) * vn(ji ,jj-1,jk) & - & + vn(ji ,jj ,jk) * vn(ji ,jj ,jk) ) & - & + ( vn(ji-1,jj-1,jk) + vn(ji+1,jj-1,jk) ) * ( vn(ji-1,jj-1,jk) + vn(ji+1,jj-1,jk) ) & - & + ( vn(ji-1,jj ,jk) + vn(ji+1,jj ,jk) ) * ( vn(ji-1,jj ,jk) + vn(ji+1,jj ,jk) ) + zv = 8._wp * ( vv(ji ,jj-1,jk,Nii) * vv(ji ,jj-1,jk,Nii) & + & + vv(ji ,jj ,jk,Nii) * vv(ji ,jj ,jk,Nii) ) & + & + ( vv(ji-1,jj-1,jk,Nii) + vv(ji+1,jj-1,jk,Nii) ) * ( vv(ji-1,jj-1,jk,Nii) + vv(ji+1,jj-1,jk,Nii) ) & + & + ( vv(ji-1,jj ,jk,Nii) + vv(ji+1,jj ,jk,Nii) ) * ( vv(ji-1,jj ,jk,Nii) + vv(ji+1,jj ,jk,Nii) ) zhke(ji,jj,jk) = r1_48 * ( zv + zu ) END DO END DO @@ -163,8 +163,8 @@ IF (ln_bdy) THEN ! restore velocity masks at points outside boundary - un(:,:,:) = un(:,:,:) * umask(:,:,:) - vn(:,:,:) = vn(:,:,:) * vmask(:,:,:) + uu(:,:,:,Nii) = uu(:,:,:,Nii) * umask(:,:,:) + vv(:,:,:,Nii) = vv(:,:,:,Nii) * vmask(:,:,:) ENDIF ! }}} {{{#!diff Index: TEST_FILES/dynvor.F90 ============================== }}} {{{#!diff Index: TEST_FILES/flo_oce.F90 ============================== --- TEST_FILES_ORG/flo_oce.F90 2019-02-08 10:51:12.000000000 +0000 +++ TEST_FILES/flo_oce.F90 2019-02-12 17:17:06.000000000 +0000 @@ -59,7 +59,7 @@ !!---------------------------------------------------------------------- !! *** FUNCTION flo_oce_alloc *** !!---------------------------------------------------------------------- - ALLOCATE( wb(jpi,jpj,jpk) , nfloat(jpnfl) , nisobfl(jpnfl) , ngrpfl(jpnfl) , & + ALLOCATE( ww(jpi,jpj,jpk,Nnn) , nfloat(jpnfl) , nisobfl(jpnfl) , ngrpfl(jpnfl) , & & flxx(jpnfl) , flyy(jpnfl) , flzz(jpnfl) , & & tpifl(jpnfl) , tpjfl(jpnfl) , tpkfl(jpnfl) , STAT=flo_oce_alloc ) ! }}} ''' Ok This was wrong.Nnn is not what should go into the ALLOCATE statement''' {{{#!diff Index: TEST_FILES/floats.F90 ============================== --- TEST_FILES_ORG/floats.F90 2019-02-08 10:51:12.000000000 +0000 +++ TEST_FILES/floats.F90 2019-02-12 17:17:06.000000000 +0000 @@ -64,7 +64,7 @@ ! CALL flo_rst( kt ) ! trajectories restart ! - wb(:,:,:) = wn(:,:,:) ! Save the old vertical velocity field + ww(:,:,:,Nnn) = ww(:,:,:,Nii) ! Save the old vertical velocity field ! IF( ln_timing ) CALL timing_stop('flo_stp') ! @@ -131,7 +131,7 @@ ! CALL flo_dom ! compute/read initial position of floats ! - wb(:,:,:) = wn(:,:,:) ! set wb for computation of floats trajectories at the first time step + ww(:,:,:,Nnn) = ww(:,:,:,Nii) ! set wb for computation of floats trajectories at the first time step ! END SUBROUTINE flo_init }}} {{{#!diff Index: TEST_FILES/sbcfwb.F90 ============================== }}} So far so good.... Since the preview step must be completed before the PI starts the coding, the previewer(s) answers are expected to be completed within the two weeks after the PI has sent his request. \\ For each question, an iterative process should take place between PI and previewer(s) in order to reach a "YES" answer for each of the following questions. {{{#!TracForm #!subcontext preview_ #!submit_label 'Save Preview' ||= Questions =||= Answer =||= Comment =|| || Does the previewer agree with the proposed methodology? || [tf.select:2.1 -id=preform '' Yes No NR] || [tf.textarea:2.1c -id=preform 'Add a comment?' 50 10] || || Does the previewer agree with the proposed flowchart and list of routines to be changed? || [tf.select:2.2 -id=preform '' Yes No NR] || [tf.textarea:2.2c -id=preform 'Add a comment?' 50 10] || || Does the previewer agree with the proposed new list of variables, including agreement with coding rules? || [tf.select:2.3 -id=preform '' Yes No NR] || [tf.textarea:2.3c -id=preform 'Add a comment?' 50 10] || || Does the previewer agree with the proposed summary of updates in reference manual? || [tf.select:2.4 -id=preform '' Yes No NR] || [tf.textarea:2.4c -id=preform 'Add a comment?' 50 10] || || ... ... ... || [tf.select:2.X -id=preform '' Yes No NR] || [tf.textarea:2.Xc -id=preform 'Add a comment?' 50 10] || '''''Updated on [tf.form_updated_on:] by [tf.form_updater:]''''' }}} Once all "YES" have been reached, the PI can start the development into his development branch. }}} {{{#!Fold title=Tests tag=h2 [=#tests] Once the development is done, the PI should complete this section below and ask the reviewers to start their review in the lower section. {{{#!TracForm #!subcontext tests #!submit_label 'Save Tests' ||= Questions =||= Answer =||= Comment =|| || Can this change be shown to produce expected impact? (if option activated)? || [tf.select:3.1 -id=piform '' Yes No NR] || [tf.textarea:3.1c -id=piform 'Add a comment?' 50 10] || || Can this change be shown to have a null impact? (if option not activated) || [tf.select:3.2 -id=piform '' Yes No NR] || [tf.textarea:3.2c -id=piform 'Add a comment?' 50 10] || || Detailed results of restartability and reproducibility when the option is activated. Please indicate the configuration used for this test || [tf.select:3.3 -id=piform '' Yes No NR] || [tf.textarea:3.3c -id=piform 'Add a comment?' 50 10] || || Detailed results of SETTE tests (restartability and reproducibility for each of the reference configuration) || [tf.select:3.4 -id=piform '' Yes No NR] || [tf.textarea:3.4c -id=piform 'Add a comment?' 50 10] || || Results of the required bit comparability tests been run: Are there no differences when activating the development? || [tf.select:3.5 -id=piform '' Yes No NR] || [tf.textarea:3.5c -id=piform 'Add a comment?' 50 10] || || If some differences appear, is reason for the change valid/understood? || [tf.select:3.6 -id=piform '' Yes No NR] || [tf.textarea:3.6c -id=piform 'Add a comment?' 50 10] || || If some differences appear, is the !ticket describing in detail the impact this change will have on model configurations? || [tf.select:3.7 -id=piform '' Yes No NR] || [tf.textarea:3.7c -id=piform 'Add a comment?' 50 10] || || Is this change expected to preserve all diagnostics? || [tf.select:3.8 -id=piform '' Yes No NR] || [tf.textarea:3.8c -id=piform 'Add a comment?' 50 10] || || If no, is reason for the change valid/understood? || [tf.select:3.9 -id=piform '' Yes No NR] || [tf.textarea:3.9c -id=piform 'Add a comment?' 50 10] || || Are there significant changes in run time/memory? || [tf.select:3.10 -id=piform '' Yes No NR] || [tf.textarea:3.10c -id=piform 'Add a comment?' 50 10] || || ... ... ... || [tf.select:3.XX -id=piform '' Yes No NR] || [tf.textarea:3.XXc -id=piform 'Add a comment?' 50 10] || '''''Updated on [tf.form_updated_on:] by [tf.form_updater:]''''' }}} }}} {{{#!Fold title=Review tag=h2 [=#review] A successful review is needed to schedule the merge of this development into the future NEMO release during next Merge Party (usually in November). {{{#!TracForm #!subcontext review #!submit_label 'Save Review' === Code changes and documentation ||= Question =||= Answer =||= Comment =|| || Is the proposed methodology now implemented? || [tf.select:3.11 -id=revform '' Yes No NR] || [tf.textarea:3.11c -id=revform 'Add a comment?' 50 10] || || Are the code changes in agreement with the flowchart defined at Preview step? || [tf.select:3.12 -id=revform '' Yes No NR] || [tf.textarea:3.12c -id=revform 'Add a comment?' 50 10] || || Are the code changes in agreement with list of routines and variables as proposed at Preview step? \\If not, are the discrepancies acceptable? || [tf.select:3.13 -id=revform '' Yes No NR] || [tf.textarea:3.13c -id=revform 'Add a comment?' 50 10] || || Is the in-line documentation accurate and sufficient? || [tf.select:3.14 -id=revform '' Yes No NR] || [tf.textarea:3.14c -id=revform 'Add a comment?' 50 10] || || Do the code changes comply with NEMO coding standards? || [tf.select:3.15 -id=revform '' Yes No NR] || [tf.textarea:3.15c -id=revform 'Add a comment?' 50 10] || || Is the !ticket of development documented with sufficient details for others to understand the impact of the change? || [tf.select:3.16 -id=revform '' Yes No NR] || [tf.textarea:3.16c -id=revform 'Add a comment?' 50 10] || || Are the reference manual tex files now updated following the proposed summary in preview section? || [tf.select:3.17 -id=revform '' Yes No NR] || [tf.textarea:3.17c -id=revform 'Add a comment?' 50 10] || || Is there a need for some documentation on the web pages (in addition to in-line and reference manual)? \\If yes, please describe and ask PI. A yes answer must include all documentation available. || [tf.select:3.18 -id=revform '' Yes No NR] || [tf.textarea:3.18c -id=revform 'Add a comment?' 50 10] || || ... ... ... || [tf.select:3.XX -id=revform '' Yes No NR] || [tf.textarea:3.XXc -id=revform 'Add a comment?' 50 10] || ==== Review Summary Is the review fully successful? [tf.select:status -id=revform '' Yes No] [tf.textarea:comment -id=revform 'If not, please indicate what is still missing.' 50 10] '''''Updated on [tf.form_updated_on:] by [tf.form_updater:]''''' }}} Once review is successful, the development must be scheduled for merge during next Merge Party Meeting. }}}