= 2016WP SIMPLIF-5_ACC Re-implementation of Smagorinsky = This is the color code for the fulfilment of this form: {{{#!td style="background:lightgrey" PI(S) }}} {{{#!td style="background:lightblue" Previewer(s) }}} {{{#!td style="background:lightgreen" Reviewer(s) }}} ---- 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.[[BR]] [[PageOutline(2)]] == Abstract == This section should be completed before starting to develop the code, in order to find agreement on the method beforehand.[[BR]] '''To enabling the !ticket and the source links in the Trac environment, those have to be hardcoded in the form''' {{{ #!TracForm #!subcontext abstract #!submit_label 'Submit Abstract' #!keep_history yes {{{#!th Action }}} {{{#!td [tf.input:action -id=piform '${WORKING_GROUP|INSTITUTE}-${ACTION_NUMBER} $Title' 100] }}} |- {{{#!th style="background-color:lightgrey" PI(S) }}} {{{#!td [tf.input:pi -id=piform 'Names' 100] }}} |- {{{#!th Ticket }}} {{{#!td style="background:lightgrey" #1689 }}} |- {{{#!th Branch }}} {{{#!td style="background:lightgrey" `[source:/branches/$YEAR/dev_r${FORK_REVISION}_${WORKING_GROUP|INSTITUTE}${ACTION_NUMBER}_${PURPOSE}]` }}} |- {{{#!th style="background-color:lightblue" Previewer(s) }}} {{{#!td [tf.input:previewers -id=piform 'Names' 100] }}} |- {{{#!th style="background-color:lightgreen" Reviewer(s) }}} {{{#!td [tf.input:reviewers -id=piform 'Names' 100] }}} ---------------------------------------------------------- = Initial plan (before preview) = Part 1: Description[[BR]] [tf.textarea:description -id=piform 'Describe the goal of development, and the methodology.\n\nAdd reference documents or publications if relevant.' 200 20] Part 2: Implementation[[BR]] [tf.textarea:implementation -id=piform '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.\nGive for each the chosen name (following coding rules) and definition.' 200 20] Part 3: Reference manual updates[[BR]] [tf.textarea:manual -id=piform 'Using part 1 and 2, define the summary of changes to be done in the NEMO reference manual (tex files).' 200 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. }}} {{{#!div style="background:#ffe8eb" = Jointly agreed plan (after preview) = == Description == This task reimplements a spatially varying eddy viscosity coefficient proportional to the local deformation rate and grid scale (Smagorinsky 1993). This reimplementation takes advantage of the recently reorganised and simplified LDF modules which means the scheme can be implemented as a simple alternative to the existing scheme for a space and time varying coefficient (nn_aht_ijk_t=31). This will provide a much cleaner implementation than the version which was removed from v3.6_STABLE and requires very few additional arrays and no preprocessor keys == Implementation == The changes will occur primarily in ldfdyn.F90. Firstly, in MODULE ldfdyn which will acquire the following name list additions: {{{ !! If nn_ahm_ijk_t = 32 a time and space varying Smagorinsky viscosity !! will be computed. REAL(wp), PUBLIC :: rn_csmc !: Smagorinsky constant of proportionality REAL(wp), PUBLIC :: rn_cfacmin !: Multiplicative factor of theorectical minimum Smagorinsky viscosity REAL(wp), PUBLIC :: rn_cfacmax !: Multiplicative factor of theorectical maximum Smagorinsky viscosity }}} The majority of code changes then occur in ldf_dyn where the CASE statement is extended to respond to CASE 32 by setting coefficients according to the Smagorinsky scheme as revisited in Griffies and Hallberg (2000). For efficiency it is useful to define module-private 2D arrays to store some calculated terms: {{{ REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: dtensq !: horizontal tension squared (Smagorinsky only) REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: dshesq !: horizontal shearing strain squared (Smagorinsky only) REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: esqt, esqf !: Square of the local gridscale (e1e2/(e1+e2))**2 }}} The length-squared terms (L^2^) are geometric invariants that can be calculated once at start (ldf_dyn_init). The horizontal tension (D,,T,,= du/dx - dv/y) is calculated at T-points using the before velocities. The horizontal shearing strain (D,,S,, = du/dy + dv/dx) is calculated at F-points using the same velocities. Storing the squares of these terms means that computing viscosity coefficients at T & F points is merely a case of combining different averages of these arrays. Using the relationship given by Griffies and Hallberg (2000); namely: {{{ B_smag = A_smag * L^2 / 8 }}} means that the biharmonic coefficients (if required) can be computed from a simple scaling of the harmonic values. Note that the new implementation of the biharmonic operator as a re-rentrant laplacian means that the square root of the biharmonic coefficient should be returned by this routine. == Reference manual == The description of the Smagorinsky scheme in the current reference will be altered to reflect the new method of activation. At this stage there are no plans to implement the additional experimental options in the previous implementation (i.e. the ability to control the contribution of the sheer term with an additional name list parameter and the option to apply a Smagorinsky type criterion to a space a time varying diffusion coefficient. Details of the new implementation will be added and will include both the continuous and discrete forms of the operators used. '''Griffies, S., M., and W. Hallberg, R''' , Biharmonic friction with a Smagorinsky-like viscosity for use in large-scale eddy-permitting ocean models, Mon. Wea. Rev., 128(8), 2935-2946, 2000. }}} == Preview == 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.[[BR]]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 'Submit 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. == 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 'Submit 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:]'' ==== }}} == 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 'Submit 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?[[BR]]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)?[[BR]]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][[BR]] [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.