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/nicolasmartin/CommitMessage (diff) – NEMO

Changes between Initial Version and Version 1 of user/nicolasmartin/CommitMessage


Ignore:
Timestamp:
2019-10-10T11:39:10+02:00 (5 years ago)
Author:
nemo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • user/nicolasmartin/CommitMessage

    v1 v1  
     1Branch [sourcdev_r11615_ENHANCE-04_namelists_as_internalfiles_agrif. Changes to support [source:/NEMO/branches/2019/dev_r11613_ENHANCE-04_namelists_as_internalfiles] developments. 
     2These changes enable sufficient support for allocatable, zero-dimension character variables defined using the: 
     3 
     4{{{#!f 
     5CHARACTER(LEN=:), ALLOCATABLE :: cstr 
     6}}} 
     7 
     8syntax. This is supported by: 
     9 
     101. Adding : as a valid length identifier at line 1028 in fortran.y (and then rebuilding fortran.c and main.c via make -f Makefile.lex) 
     112. Adding a carrayu entry to Agrif_Variable_c type in AGRIF_FILES/modtypes.F90 where carrayu is declared as: 
     12{{{#!f 
     13   character(:)  ,                 allocatable :: carrayu 
     14}}} 
     153. Ensuring correct deallocation of carrayu in AGRIF_FILES/modsauv.F90 and AGRIF_FILES/modutil.F90 
     164. Substituting carrayu in place of carray0 declarations when character length matches : for zero-dimension variables. This occurs twice in LIB/toamr.c, e.g: 
     17{{{#!f 
     18        if (!strcasecmp(var->v_dimchar  ,":") && var->v_nbdim == 0 ) 
     19        { 
     20        sprintf (tname_2, "%% carrayu"); 
     21        } else { 
     22        sprintf (tname_2, "%% carray%d", var->v_nbdim); 
     23        } 
     24}}} 
     25Any such character variables must be allocated by the user. Typically this is done with lines such as: 
     26{{{#!f 
     27      IF ( .NOT. ALLOCATED(cdnambuff) ) ALLOCATE( CHARACTER(LEN=kleng) :: cdnambuff ) 
     28}}} 
     29making AGRIF accept the CHARACTER(LEN=kleng) :: construct within the ALLOCATE statement was beyond my skills. Fortunately, for the current purpose, this 
     30isn't necessary since such allocations only occur within utility routines in which the appropriate tabvar has been passed down. So: 
     31{{{#!f 
     32!$AGRIF_DO_NOT_TREAT 
     33      IF ( .NOT. ALLOCATED(cdnambuff) ) ALLOCATE( CHARACTER(LEN=kleng) :: cdnambuff ) 
     34!$AGRIF_END_DO_NOT_TREAT 
     35}}} 
     36avoids the issue.