| 68 | |
| 69 | ------------------------------------------------------------------ |
| 70 | = Jointly Agreed Plan (in discussion with previewer) = |
| 71 | The goal of this action is to continue Simplification started with ticket 1608, and |
| 72 | https://forge.ipsl.jussieu.fr/nemo/wiki/ticket/1593_CNRS9_NOC3_LDF. For this action we |
| 73 | will re-define interface between NEMO core and configurations and update all reference |
| 74 | documentation to reflect the changes made. |
| 75 | |
| 76 | Configuration dependent code can be considered in four functional groups: |
| 77 | |
| 78 | 1. Domain setting |
| 79 | 2. Initial state |
| 80 | 3. Forcing |
| 81 | 4. Physics |
| 82 | |
| 83 | === Phase 1: === |
| 84 | |
| 85 | |
| 86 | The first phase is to create a GYRE configuration which has no configuration dependent |
| 87 | code in the standard modules. This will be achieved by moving code in each of the |
| 88 | functional groups (where appropriate) into 'user defined' modules which can be dropped |
| 89 | into a MY_SRC directory and which are called by generic function names. Calls to these |
| 90 | generic routines should be placed at appropriate points to be activated by suitable |
| 91 | namelist switches. In the GYRE case this will involve relocating the following code |
| 92 | segments: |
| 93 | |
| 94 | {{{ |
| 95 | (Domain) : CASE 5 for jphgr_msh in dom_hgr (two segments: grid and corolis); |
| 96 | single tanh function from zgr_z. |
| 97 | (Initial): istate_gyre in istate.F90 |
| 98 | (Forcing): sbc_gyre in sbcana.F90 |
| 99 | (Physics): None |
| 100 | }}} |
| 101 | |
| 102 | Remove specific calls to *_gyre routines and verify results using the 'user defined' |
| 103 | routines |
| 104 | |
| 105 | === Phase 2: === |
| 106 | |
| 107 | The second phase of this task is to introduce a method of reading all domain settings from |
| 108 | external files. Currently this is done for horizontal grid information if jphgr_msh=0 but |
| 109 | there is no similar mechanism for the vertical grid. For a complete domain description |
| 110 | (ignoring the possibility of iceshelves, for now) the following data are required: |
| 111 | |
| 112 | |
| 113 | {{{ |
| 114 | gphi[t,u,v,f], glam[t,u,v,f], e[1,2][t,u,v,f] ( and optionally e1e2[u,v] ) |
| 115 | gdep[t,w]_0 gdep[t,w]_1d |
| 116 | e3[t,w,u,v,f]_0 e3[t,w,u,v,f]_1d |
| 117 | tmask |
| 118 | jperio, ln_zps, ln_zco, ln_sco, ln_isfcav |
| 119 | }}} |
| 120 | |
| 121 | |
| 122 | Note [u,v,f]masks can be derived from tmask. A configuration-dependent fmask, in |
| 123 | particular, should be considered as a physics choice since it can be used to increase |
| 124 | lateral friction. |
| 125 | |
| 126 | The phase 2 task is therefore to introduce code to produce a mesh and mask file with all |
| 127 | the required content (by changing/adding to nn_msh options). A new namelist parameter can |
| 128 | then be added (jpzgr_msh) such that when jpzgr_msh = 0, a new routine, zgr_read, called |
| 129 | in domzgr will read the vertical grid information from the mesh and mask file: |
| 130 | |
| 131 | {{{ |
| 132 | SELECT CASE( jpzgr_msh ) ! type of vertical grid |
| 133 | ! |
| 134 | CASE ( 0 ) !== read in domain.nc file ==! |
| 135 | ! |
| 136 | IF(lwp) WRITE(numout,*) |
| 137 | IF(lwp) WRITE(numout,*) ' vertical grid read in "domain" file' |
| 138 | ! |
| 139 | CALL zgr_read() |
| 140 | ! add code to build mbathy from tmask: needed in zgr_bot_level |
| 141 | ! possibly build bathy too from gdepw_0 ; after zgr_bot_level? is it needed? |
| 142 | ! |
| 143 | CASE DEFAULT |
| 144 | ! |
| 145 | ! Build the vertical coordinate system |
| 146 | ! ------------------------------------ |
| 147 | CALL zgr_z ! Reference z-coordinate system (always called) |
| 148 | CALL zgr_bat ! Bathymetry fields (levels and meters) |
| 149 | IF( lk_c1d ) CALL lbc_lnk( bathy , 'T', 1._wp ) ! 1D config.: same bathy value over the 3x3 domain |
| 150 | IF( ln_zco ) CALL zgr_zco ! z-coordinate |
| 151 | IF( ln_zps ) CALL zgr_zps ! Partial step z-coordinate |
| 152 | IF( ln_sco ) CALL zgr_sco ! s-coordinate or hybrid z-s coordinate |
| 153 | ! |
| 154 | ! final adjustment of mbathy & check |
| 155 | ! ----------------------------------- |
| 156 | IF( .NOT.lk_c1d ) CALL zgr_bat_ctl ! check bathymetry (mbathy) and suppress isolated ocean points |
| 157 | END SELECT |
| 158 | IF( lzoom ) CALL zgr_bat_zoom ! correct mbathy in case of zoom sub |
| 159 | CALL zgr_bot_level ! deepest ocean level for t-, u- and v-points |
| 160 | CALL zgr_top_level ! shallowest ocean level for T-, U-, V- points |
| 161 | }}} |
| 162 | |
| 163 | Note: The same domain file read in zgr_read is also to be accessed in hgr_read for the |
| 164 | horizontal grid information (jphgr_msh=0). |
| 165 | |
| 166 | The ability to reproduce results from all reference configurations using the external |
| 167 | files to define the domain should be verified at this stage. |
| 168 | |
| 169 | === Phase 3: === |
| 170 | |
| 171 | |
| 172 | The third phase will be to identify configuration dependent physics code and replicate the |
| 173 | functions (or case statement blocks) either by providing user defined functions or reading |
| 174 | appropriate fields from external files. The afore-mentioned fmask modifications are one |
| 175 | example which could be replaced by reading a modified fmask from an external file. |
| 176 | |
| 177 | After this phase it should be possible to run an ORCA2 configuration with no hardcoded |
| 178 | references in the trunk code. |
| 179 | |
| 180 | === Phase 4: === |
| 181 | |
| 182 | Following success with phases 1-3 the next stage will be to systematically break down the |
| 183 | multiple functionality in routines such as domhgr into separate examples of user-defined |
| 184 | routines (in this case a set of routines, each of which sets a different vertical grid). |
| 185 | Care should be taken to standardise subroutine arguments with inputs and return fields |
| 186 | clearly documented. These new routines should be moved into the appropriate MY_SRC |
| 187 | directory of a reference configuration or into a new directory under TOOLS or |
| 188 | MISCELLANEOUS if they are not actively used in any of the reference configurations. |
| 189 | domhgr.F90 and domzgr.F90, in particular, should be greatly simplified by this procedure. |
| 190 | |
| 191 | === Phase 5 === |
| 192 | |
| 193 | Incorporate necessary additions to the domain.nc file to support ISF active configurations |
| 194 | (misfdep, risfdep?) and check for possible redundancy in domain.nc (i.e. are all the |
| 195 | fields really required?). Not sure _1d arrays are, for example? |
| 196 | |
| 197 | Finally check that documentation has been kept up to date. |