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.
2019WP/ENHANCE-04_AndrewC-reporting/Internal_Namelists (diff) – NEMO

Changes between Version 1 and Version 2 of 2019WP/ENHANCE-04_AndrewC-reporting/Internal_Namelists


Ignore:
Timestamp:
2019-10-01T15:37:41+02:00 (5 years ago)
Author:
acc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • 2019WP/ENHANCE-04_AndrewC-reporting/Internal_Namelists

    v1 v2  
    117117  END SUBROUTINE load_nml 
    118118}}} 
     119 
     120'''Full development branch''' 
     121 
     122This approach has been implemented and tested on a 2019 development branch: 
     123 
     124https://forge.ipsl.jussieu.fr/nemo/browser/NEMO/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles 
     125 
     126This branch contains only the substantive changes; to compile and run tests all REWIND and CLOSE operations on the (no longer) units have to be removed. These changes affect many more files but can be scripted so are not included the branch in order to make a later merge easier. The scripts used to prepare code for testing are included below. With these additional changes this code passes most SETTE tests but the AGRIF preprocessor does not currently accept the new allocatable character strings. The conversion routine first bails on: 
     127 
     128{{{ 
     129fcm_internal compile:F nemo /home/acc/NEMO/IMMERSE/dev_r11613_ENHANCE-04_namelists_as_internalfiles/tests/VORTEX_ST/NEMOFILES/ppsrc/nemo/in_out_manager.f90 in_out_manager.f90 
     130/home/acc/NEMO/IMMERSE/dev_r11613_ENHANCE-04_namelists_as_internalfiles/mk/agrifpp.sh  in_out_manager.f90 /home/acc/NEMO/IMMERSE/dev_r11613_ENHANCE-04_namelists_as_internalfiles/tests/VORTEX_ST/NEMOFILES/inc  /home/acc/NEMO/IMMERSE/dev_r11613_ENHANCE-04_namelists_as_internalfiles/tests/VORTEX_ST/NEMOFILES/ppsrc/nemo/in_out_manager.f90 
     131syntax error line 135, file in_out_manager.f90 motclef = |:| 
     132fcm_internal compile failed (256) 
     133 
     134which is the line: 
     135 
     136   CHARACTER(LEN=:), ALLOCATABLE :: numnam_ref      !: character buffer for reference namelist 
     137 
     138}}} 
     139 
     140AGRIF will need to be made to understand the (LEN=: ) syntax before this solution can be progressed. 
     141 
     142All non-AGRIF SETTE tests are passing but note none of the current tests use multiple BDY namelists; a solution for that issue has yet to be coded. 
     143 
     144 
     145'''Lists and scripts''' 
     146To minimise changes that need to be merged later, only the substantive changes have been checked into the development branch. These changes include the new routine in lib_mpp.F90, buffer declarations and replacement of any ctl_opn calls for namelist input. The list of files in this category is held in src/substantive.list and is: 
     147 
     148{{{ 
     149ICE/icestp.F90  
     150OCE/IOM/in_out_manager.F90  
     151OCE/LBC/lib_mpp.F90  
     152OCE/nemogcm.F90  
     153OFF/nemogcm.F90  
     154SAO/nemogcm.F90  
     155SAS/nemogcm.F90  
     156TOP/PISCES/SED/sedini.F90  
     157TOP/PISCES/sms_pisces.F90  
     158TOP/PISCES/trcnam_pisces.F90  
     159TOP/trc.F90  
     160TOP/trcnam.F90 
     161}}} 
     162 
     163A list of files potentially containing REWIND and CLOSE statements (but excluding files in the substantive list) can be built by running the following script in the src directory: 
     164 
     165{{{ 
     166#!/bin/bash 
     167# 
     168INUNITS=( numnam_ref numnam_cfg numnat_ref numnat_cfg numtrc_ref numtrc_cfg numnam_ice_ref numnam_ice_cfg numnamsed_ref numnamsed_cfg numnatp_cfg numnatp_ref ) 
     169RM_CMDS=( REWIND  CLOSE  ) 
     170# 
     171# First build a list of files likely to need alteration 
     172# 
     173 if [ -f all_rewfiles.list ] ; then rm all_rewfiles.list; fi 
     174 for n in `seq 0 1 $(( ${#INUNITS[*]} - 1 ))` 
     175  do 
     176   grep -l -i ${INUNITS[$n]} `find ./ -name '*.[Ffh]90'` >> all_rewfiles.list 
     177   grep -l -i ${INUNITS[$n]} `find ../tests -name '*.[Ffh]90'` | grep -v WORK | grep -v BLD | grep -v NEMOFILES >> all_rewfiles.list 
     178   grep -l -i ${INUNITS[$n]} `find ../cfgs -name '*.[Ffh]90'`  | grep -v WORK | grep -v BLD | grep -v NEMOFILES >> all_rewfiles.list 
     179 done 
     180 sort -u all_rewfiles.list > alluniq_rewfiles.list 
     181 for f in `cat substantive.list` 
     182 do 
     183  ff=`echo $f | sed -e 's:/:\\\/:g'` 
     184  echo $ff 
     185  ed - alluniq_rewfiles.list << EOF 
     186/$ff/d 
     187w 
     188q 
     189EOF 
     190 done 
     191}}} 
     192 
     193and this list can be used to target an editing script which removes any REWIND or CLOSE statements on converted units (also to be run in src): 
     194 
     195{{{ 
     196#!/bin/bash 
     197# 
     198INUNITS=( numnam_ref numnam_cfg numnat_ref numnat_cfg numtrc_ref numtrc_cfg numnam_ice_ref numnam_ice_cfg numnamsed_ref numnamsed_cfg numnatp_cfg numnatp_ref ) 
     199RM_CMDS=( REWIND  CLOSE  ) 
     200# 
     201for f in `cat alluniq_rewfiles.list` 
     202do 
     203 n=0 
     204 for n in `seq 0 1 $(( ${#INUNITS[*]} - 1 ))` 
     205 do 
     206  for m in `seq 0 1 $(( ${#RM_CMDS[*]} - 1 ))` 
     207  do 
     208   perl -ni.bak -e 'print unless m@.*\s*'${RM_CMDS[$m]}'\s*\(\s*'${INUNITS[$n]}'\s*\).*@i'  $f 
     209  done 
     210 done 
     211done 
     212cd ../ 
     213rm `find ./ -name '*.bak'`    
     214}}} 
     215 
     216.