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.
user/gm/Misc.Items – NEMO
wiki:user/gm/Misc.Items

Version 16 (modified by gm, 15 years ago) (diff)

--


Miscellaneous Items

Last edited Timestamp?

Purpose:
Series of various improvements that have not been introduced in the schedule.


0. Propose change in OPA_SRC directory

Create LBC = lateral Boundary condition <== contains the following staff: BDY, OBC, cla..., lbc lnk & mpp staff

New philosophy of interaction between components of the system :
Instead of adding dummy module to be able to run the system without one of its component (for example run the ocean without passive tracer), use the associated CPP key.
Action:

1# all the passive tracer dummy modules (e.g. trcini.F90, trcstp.F90, sms.F90) can be removed from OPA_SRC, with only the use of key_top in step.F90.
==> done in realsease 3.2

NB: the interface to AGRIF (agrif_opa_...F90) or its links if the assoicated routine are encapsulated into #if defined key_agrif.
NB: generalise the link strategy to the sea-ice and especially limsbc(_2) that should be put into LIM_SRC_2(_3) with a link in I2C

NB: generalise the link strategy to the off-line tracers [[BR]]

authorise sub-directory in LBC, DIA... (i.e. modification of the scripts using /*/*.F90...)

NB: FLO, TRD may be kept in the OPA_SRC, but for the Documentation I really prefer to move them in DIA

 BDY                         ==>   LBC + revised the ocean interface especially in dynnxt.F90
 DIA
 DOM
 DTA
 DYN
 FLO                         ==>   DIA ???
 IOM
 LDF
 OBC                         ==>   LBC
 SBC
 SOL
 TRA
 TRD                         ==>   DIA  ???
 ZDF
agrif_opa_interp.F90         ==>   ???
agrif_opa_sponge.F90         ==>   ???
agrif_opa_update.F90         ==>   ???
cla.F90                      ==>   LBC + revision of cla CALL (no more in step but in divcur.F90)
cla_div.F90                  ==>   LBC
cla_dynspg.F90               ==>   LBC
ctlopn.F90                   ==>   IOM 
daymod.F90                         put it in DOM ?  and rename it domday.F90
'''eosbn2.F90                   ==>   TRA''' 
geo2ocean.F90                ==>   SBC   only used in SBC 
ice_oce.F90
istate.F90                   ==>   DOM rename it dom_istate ?
lbclnk.F90                   ==>   LBC 
lbcnfd.F90                   ==>   LBC
lib_cray.f90                 ==>   SOL  may be suppressed soon (with IOM for output)
lib_feti.F90                 ==>   SOL  obsolescence : to be suppressed
lib_isml.f90                 ==>   SOL   when rigid-lid and FETI will be suppressed this can be also suppressed
lib_mpp.F90                  ==>   LBC
lib_print.f90                ==>   IOM
model.f90
module_example                     rename zzz_module_example (to be at the end of the list) ? 
mppini.F90                   ==>   LBC   merge of mppini and mppini2 ....  + Doc
mppini_2.h90                 ==>   LBC
oce.F90
opa.F90
par_EEL_R2.h90                     to be tranformed into a module !
par_EEL_R5.h90                     - idem -
par_EEL_R6.h90                     - idem -
par_GYRE.h90                       - idem -
par_kind.F90
par_oce.F90
par_ORCA_R2.h90                    to be tranformed into a module !  and add par_ORCA_R1 and R12 cases
par_ORCA_R4.h90                    - idem -
par_ORCA_R05.h90                   - idem -
par_ORCA_R025.h90                  - idem -
phycst.F90
prtctl.F90                   ==>   IOM 
restart.F90                  ==>   IOM 
'''sms.F90                      ==>   removed'''
step.F90
stpctl.F90
trc_oce.F90
trcini.F90                   ==>   removed
trcstp.F90                   ==>   removed
vectopt_loop_substitute.h90

1. Time step management

The size of the time step may be different at the first time step (nit000), whether an Euler start is used or not (neuler namelist parameter)

This means that neuler appears and is used in all the following modules :

C1D_SRC/dynnxt_c1d.F90

NST_SRC/agrif_opa_interp.F90

OFF_SRC/DOM/dom_oce.F90

OPA_SRC/DOM/dom_oce.F90 , domvvl.F90

OPA_SRC/DYN/dynnxt.F90 , dynspg.F90 , dynspg_flt.F90 , dynspg_rl.F90 , dynspg_ts.F90 , dynzdf.F90 , wzvmod.F90

OPA_SRC/OBC/obcdta.F90 , obcspg.F90

OPA_SRC/SOL/solmat.F90

OPA_SRC/TRA/traadv_muscl.F90 , traadv_muscl2.F90 , traadv_qck.F90 , traadv_tvd.F90 , traadv_ubs.F90 , traldf.F90 , tranxt.F90 , trazdf.F90

OPA_SRC/TRD/trdmod.F90

TOP_SRC/LOBSTER/trcexp.F90

TOP_SRC/TRP/trcadv_tvd.F90 , trcnxt.F90 , trczdf_exp.F90 , TRP/trczdf_imp.F90 , trczdf_iso.F90 , trczdf_iso_vopt.F90

OPA_SRC/istate.F90, restart.F90

TOP_SRC/oce_trc.F90

A solution is to introduce in OPA/SRC/DOM/dom_oce.F90 two new variable (r2dt_dyn, r2dt_tra) which are updted once for all in step.F90 module or even better in opa.F90

In dom_oce.F90

   !!----------------------------------------------------------------------
   !! time domain
   !!----------------------------------------------------------------------
...
   REAL(wp)                 ::   r2dt_dyn   !: time-step, =2*rdt   , except at nit000 (=rdt   ) if neuler=0
   REAL(wp), DIMENSION(jpk) ::   r2dt_tra   !: time-step, =2*rdttra, except at nit000 (=rdttra) if neuler=0

In opa.F90 the correct time step is defined during the first 2 time-step only:

      istp = nit000
      IF( lk_c1d ) THEN                 ! 1D configuration (no AGRIF zoom)
         !
         DO WHILE ( istp <= nitend .AND. nstop == 0 )
            IF( neuler == 0 .AND. kt == nit000    ) THEN   ! nit000 with Euler time stepping
               r2dt_dyn    =      rdt            
               r2dt_tra(:) =      rdttra(:)     
            ELSEIF(               kt <= nit000 + 1) THEN   ! nit000(+1) without Euler or nit000 + 1 with Euler
               r2dt_dyn    = 2. * rdt      
               r2dt_tra(:) = 2. * rdttra(:)
            ENDIF
            CALL stp_c1d( istp )
            istp = istp + 1
         END DO
      ELSE                              ! 3D ocean with or without AGRIF zoom
         !
         DO WHILE ( istp <= nitend .AND. nstop == 0 )
            IF( neuler == 0 .AND. kt == nit000    ) THEN   ! nit000 with Euler time stepping
               r2dt_dyn    =      rdt            
               r2dt_tra(:) =      rdttra(:)     
            ELSEIF(               kt <= nit000 + 1) THEN   ! nit000(+1) without Euler or nit000 + 1 with Euler
               r2dt_dyn    = 2. * rdt      
               r2dt_tra(:) = 2. * rdttra(:)
            ENDIF
#if defined key_agrif
            CALL Agrif_Step( stp )
#else
            CALL stp( istp )
#endif
            istp = istp + 1
            IF( lk_mpp )   CALL mpp_max( nstop )
         END DO
      ENDIF

and then remove neuler case from all other routine where it appears. Indeed, in the euler initialisation 'before fields' = 'now fields'so the computation is OK.

CAUTION : check potential problem in daymod.F90(use rdt, rdttra, not r2dt_dyn or r2dt_tra)


2. Namelist naming convention

Once for all, the namelist naming convention should be applied to all the variables that appear in all the namelists.

Recall : namelist naming convention — a namelist variable name should start with the following prefix:

namelist   integer   real  logical   character   structure   etc...
variable     nn_      rn_    ln_        cn_         sn_         ...



3. Tricky trick on mbathy

A tricky trick on mbathy have been introduced 20 years ago! The read mbathy field is modified in the model, and even worse it take different alues in different part of the code (domhgr, dommsk and all other routines called in step). tricky tricks are always dangerous and source of numerous bugs. They should be removed from the system.

here, the forseen solution is to introduce in domzgr.F90, arrays known by all modules that defined the last ocean level at t, u, v, w point. Such arrays already exist (at least some of them) in numerous places in the code, see for example mbatu, mbatv in zpshde.F90, or are recomputed at each time step (see dynhpf, trabbc, trabbl, traldf_iso, ...).


4. Achieved the time stepping before dynnxt

In a mirror of the tracer time stepping strategy, the momentum time stepping can be achieved in dynzdf, or in dynspg so that dynnxt only perform the filter and the swap.

A priori faster, much simpler especially with vvl and the plug-in of AGRIF, BDY and OBC.


5. Isopycnal Slopes…

Introduce in ldfslp the call to eos et zpshde at before time-step (not bn2 as it is used in zdfevd) (simplification of step)

change the computation of the slopes from the use of rdn, bn2 to the use of alfbet computed at u-, v- and w-points using their local pressure. A priori, faster and adapted for the crazy vertical coordinate developped by Matthieu Leclair. It also prefigures the Griffies operator.



6. Revised ZDF

With zdftke2 in the process of becoming the standard turbulent closure scheme, a wide horizontal stencil is no more required to compute avmu and avmv. They can be evaluated by just using the 2 neighbouring avm at w-point. Therefore, all zdf.. can be modified to compute only momentum and tracer turbulent mixing coefficient at w-point. avmu, avmv can be removed and in dynzdf_exp and dynzdf_imp a averaged value of avm is used instead of avmu and avmv arrays.
This will save between 6 and 12 call to lbc_lnk by time step [[BR]] The pending issue is that the algorithm of the KPP scheme should be revisited so that it becomes stable without any averaging. Similarly for the GLS scheme, but this should be OK, as the turbulent closure available in GLS come from Burchard, the guy who has found how to stabilise the TKE scheme without a wide horizontal averaging procedure.



7. Standard configuration

Two idea here.

  • Replace the par_xxx.h90 files by par_xxx.F90 modules

This is inscribed in the general strategy of removing as much as possible the .h90 from the system. Only the two h90 file related to vectopt_loop and domzgr should remain.

See an example of that in the dev_001_GM branche, the following modules (orca, ell, gyre and my_cfg) :

https://forge.ipsl.jussieu.fr/nemo/browser/branches/dev_001_GM/NEMO/OPA_SRC/par_orca_r2.F90
https://forge.ipsl.jussieu.fr/nemo/browser/branches/dev_001_GM/NEMO/OPA_SRC/par_orca_r4.F90
https://forge.ipsl.jussieu.fr/nemo/browser/branches/dev_001_GM/NEMO/OPA_SRC/par_orca_r05.F90
https://forge.ipsl.jussieu.fr/nemo/browser/branches/dev_001_GM/NEMO/OPA_SRC/par_orca_r025.F90
https://forge.ipsl.jussieu.fr/nemo/browser/branches/dev_001_GM/NEMO/OPA_SRC/par_eel_r2.F90
https://forge.ipsl.jussieu.fr/nemo/browser/branches/dev_001_GM/NEMO/OPA_SRC/par_eel_r5.F90
https://forge.ipsl.jussieu.fr/nemo/browser/branches/dev_001_GM/NEMO/OPA_SRC/par_eel_r2.F90
https://forge.ipsl.jussieu.fr/nemo/browser/branches/dev_001_GM/NEMO/OPA_SRC/par_gyre.F90
https://forge.ipsl.jussieu.fr/nemo/browser/branches/dev_001_GM/NEMO/OPA_SRC/par_my_cfg.F90

  • Introduce ORCA_R1 configuration

ORCA 1 should be offer among the available configuration, but as R05 or R025, it will not be a reference configuration, just a standard one.

  • Introduce the number of level in the name of orca configuration

For example, par_orca_r2.F90 becomes par_orca_r2_L31.F90, a the associated key becomes key_orca2_r2_L31
Generalise this to all ORCA configuration?

  • Introduce a standard 75 levels configuration

introduce a par_orca_r2_L75.F90 module with the correct specification, i.e. the following parameters:

jpk = 75
zsur = -3.958951371276829e+03
za0 = 1.039530096000000e+02
za1 = 2.415951269000000e+00
zkth = 1.535101370000000e+01
zacr = 7.000000000000000e+00
za2 = 1.007609285000000e+02
zkth2 = 4.802989372000000e+01
zacr2 = 1.300000000000000e+01

this leads to the following CREME_DE_LA_CREME_75 vertical grid:

level      gdept      gdepw        e3t        e3w
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1     0.5058     0.0000     1.0235     1.0000
    2     1.5559     1.0239     1.0787     1.0496
    3     2.6677     2.1032     1.1474     1.1112
    4     3.8563     3.2513     1.2329     1.1878
    5     5.1404     4.4851     1.3391     1.2831
    6     6.5430     5.8252     1.4709     1.4015
    7     8.0925     7.2974     1.6337     1.5481
    8     9.8228     8.9327     1.8334     1.7286
    9    11.7737    10.7679     2.0761     1.9490
   10    13.9910    12.8460     2.3671     2.2152
   11    16.5253    15.2153     2.7104     2.5320
   12    19.4298    17.9279     3.1075     2.9023
   13    22.7576    21.0376     3.5565     3.3257
   14    26.5583    24.5960     4.0521     3.7989
   15    30.8746    28.6497     4.5861     4.3149
   16    35.7402    33.2370     5.1493     4.8646
   17    41.1800    38.3871     5.7333     5.4391
   18    47.2119    44.1210     6.3329     6.0313
   19    53.8506    50.4545     6.9473     6.6381
   20    61.1128    57.4026     7.5809     7.2613
   21    69.0217    64.9846     8.2424     7.9074
   22    77.6112    73.2287     8.9445     8.5875
   23    86.9294    82.1756     9.7028     9.3156
   24    97.0413    91.8814    10.5349    10.1084
   25   108.0303   102.4202    11.4603    10.9847
   26   120.0000   113.8852    12.5000    11.9645
   27   133.0758   126.3909    13.6764    13.0696
   28   147.4062   140.0740    15.0133    14.3232
   29   163.1645   155.0950    16.5363    15.7499
   30   180.5499   171.6402    18.2725    17.3760
   31   199.7900   189.9228    20.2504    19.2294
   32   221.1412   210.1845    22.4999    21.3393
   33   244.8906   232.6970    25.0520    23.7362
   34   271.3564   257.7629    27.9377    26.4512
   35   300.8875   285.7158    31.1877    29.5153
   36   333.8628   316.9199    34.8307    32.9584
   37   370.6885   351.7680    38.8923    36.8077
   38   411.7938   390.6786    43.3930    41.0867
   39   457.6256   434.0905    48.3467    45.8127
   40   508.6399   482.4563    53.7580    50.9952
   41   565.2923   536.2332    59.6208    56.6338
   42   628.0260   595.8721    65.9164    62.7162
   43   697.2586   661.8052    72.6122    69.2169
   44   773.3683   734.4322    79.6613    76.0960
   45   856.6789   814.1057    87.0031    83.2999
   46   947.4479   901.1180    94.5648    90.7615
   47  1045.8543   995.6885   102.2636    98.4025
   48  1151.9912  1097.9541   110.0107   106.1368
   49  1265.8614  1207.9631   117.7149   113.8739
   50  1387.3770  1325.6725   125.2870   121.5229
   51  1516.3636  1450.9505   132.6439   128.9972
   52  1652.5684  1583.5824   139.7120   136.2182
   53  1795.6708  1723.2798   146.4299   143.1181
   54  1945.2955  1869.6931   152.7498   149.6420
   55  2101.0265  2022.4249   158.6383   155.7495
   56  2262.4216  2181.0444   164.0757   161.4141
   57  2429.0252  2345.1010   169.0552   166.6227
   58  2600.3805  2514.1372   173.5806   171.3740
   59  2776.0393  2687.6994   177.6651   175.6769
   60  2955.5704  2865.3470   181.3288   179.5481
   61  3138.5649  3046.6592   184.5965   183.0104
   62  3324.6408  3231.2404   187.4966   186.0907
   63  3513.4456  3418.7230   190.0591   188.8182
   64  3704.6567  3608.7693   192.3144   191.2232
   65  3897.9819  3801.0721   194.2924   193.3362
   66  4093.1587  3995.3542   196.0221   195.1866
   67  4289.9524  4191.3671   197.5306   196.8024
   68  4488.1546  4388.8895   198.8431   198.2098
   69  4687.5811  4587.7254   199.9829   199.4332
   70  4888.0698  4787.7020   200.9709   200.4946
   71  5089.4786  4988.6673   201.8260   201.4139
   72  5291.6832  5190.4885   202.5652   202.2091
   73  5494.5753  5393.0495   203.2034   202.8960
   74  5698.0608  5596.2492   203.7539   203.4889
   75  5902.0578  5800.0000   204.2284   204.0000



8. Semi-implicit scheme for vertical diffusion

idea: introduce a semi-implicit scheme in zdf computation as an alternative to the full implicit scheme (dynzdf_imp ; trazdf_imp). The semi implicit scheme (Crank-Nicholson) is known to be more accurate than the full implicit scheme.
Gurvan



9. limadv(_2) optimisation

idea : it seems that the last 3 loop of lim_adv_x and lim_adv_y (in both limad and limadv_2 modules) can be merge in one. This can significantly speed up the routine, in both vector and scalar computers.
Gurvan



10. use fr_i = 1. - frld in LIM

compute the ice fraction at the same time as the leads fraction in order to avoid (1.-frld) computation seen in many parts of LIM.
Same idea, define 1/rdt_ice which is use several time



11. suppress zdfini

move the zdf_init subroutine from zdfini.F90 to zdf_oce.F90 and remove zdfini.F90 from the system
change the USE in opa.F90 from USE zdfini to USE zdf_oce
The modified zdf_oce.F90 can be found here : https://forge.ipsl.jussieu.fr/nemo/attachment/wiki/Misc.Items/zdf_oce.F90
and a version with updated style here : https://forge.ipsl.jussieu.fr/nemo/attachment/wiki/Misc.Items/zdf_oce%2Bstyle.F90
CAUTION: circular dependency occurs due to the use of zdf_oce in many places... Therefore the initial idea is good, but the content itself of zdf_ini must be re-thinked [[BR]]

Gurvan



12. Namelist management

Idea: for the NEMO team, it should be better if there is only ONE reference namelist + a script which changes the default value to provide default values for each reference configuration (GYRE, ORCA2_LIM, ORCA2_LIM_PISCES, AGRF ...). With such a feature, changes in the namelist list will be automatically spread out in the namelist configurations. Furthermore, the script will enlighten the namelist specificities of each configuration.


13. others…

Attachments (2)

Download all attachments as: .zip