Error: Symbol ‘norgwd_gfron’ in namelist ‘namnorgwd’ at (1) must be declared before the namelist is declared. I’m getting this error. Is there a flag or how can i overcome in this situation?
It is the include file;
NAMELIST/NAMNORGWD/&
& NORGWD_RUWMAX, NORGWD_SAT, NORGWD_RDISS, &
& NORGWD_DELTAT, NORGWD_KMIN, NORGWD_KMAX, &
& NORGWD_CMIN, NORGWD_CMAX, &
& NORGWD_PLAUNCH, NORGWD_PNOVERDIF, NORGWD_PRMAX, NORGWD_DZ, NORGWD_PTROPO, &
& NORGWD_SCHEME, NORGWD_GB, NORGWD_GFRON, NORGWD_DZFRON
mpif90 -c -fconvert=swap -fno-second-underscore -fbacktrace -m64 -fopenmp -ffree-line-length-none -fno-sign-zero -fno-range-check -fpic -fallo w-argument-mismatch -g -pipe -DLINUX -DLITTLE_ENDIAN -DLITTLE -DADDRESS64 -O2 -I/home/celaleddin/model_kurulum/packs/46t1bf07_MAIN.01.MPIGNU.x/src/local/utilities/ice/module -I/home/celaleddin/model_kurulum/packs/46t1bf07_MAIN.01.MPIGN U.x/src/local/obstat/module -I/usr/include -I/home/celaleddin/model_kurulum/packs/46t1bf07_MAIN.01.MPIGNU.x/src/local/ifsaux/module -I/home/celaleddin/model_kurulum/packs/46t1bf07_MAIN.01.MPIGNU.x/src/local/.intfb/arpifs -I/home/celaled din/model_kurulum/packs/46t1bf07_MAIN.01.MPIGNU.x/src/local/.include/arpifes/headers -I/home/celaleddin/model_kurulum/packs/46t1bf07_MAIN.01.MPIGNU.x/src/local/.include/arpifs/modules sunorgwd.F90
Welcome to the forum!
Since the compiler complains about a symbol that is not defined (and apparently not about others), the thing to do is declare what type the variable norgwd_gfron is exactly. You are using (I do hope) IMPLICIT NONE?
Yes sure i’m using. Shall i change the sorting in the below code because getting similar errors for others not only NORGWD_GFRON .
/home/celaleddin/model_kurulum/packs/46t1bf07_MAIN.01.MPIGNU.x/src/local/.include/arpifs/headers/namnorgwd.nam.h:3:21:
3 | & NORGWD_RUWMAX, NORGWD_SAT, NORGWD_RDISS, &
| 1
Error: Symbol ‘norgwd_ruwmax’ in namelist ‘namnorgwd’ at (1) must be declared before the namelist is declared.
/home/celaleddin/model_kurulum/packs/46t1bf07_MAIN.01.MPIGNU.x/src/local/.include/arpifs/headers/namnorgwd.nam.h:3:33:
3 | & NORGWD_RUWMAX, NORGWD_SAT, NORGWD_RDISS, &
| 1
Error: Symbol ‘norgwd_sat’ in namelist ‘namnorgwd’ at (1) must be declared before the namelist is declared.
/home/celaleddin/model_kurulum/packs/46t1bf07_MAIN.01.MPIGNU.x/src/local/.include/arpifs/headers/namnorgwd.nam.h:3:47:
3 | & NORGWD_RUWMAX, NORGWD_SAT, NORGWD_RDISS, &
| 1
Error: Symbol ‘norgwd_rdiss’ in namelist ‘namnorgwd’ at (1) must be declared before the namelist is declared.
/home/celaleddin/model_kurulum/packs/46t1bf07_MAIN.01.MPIGNU.x/src/local/.include/arpifs/headers/namnorgwd.nam.h:4:36:
`
#include “namnorgwd.nam.h”
CHARACTER(LEN=4), POINTER :: NORGWD_SCHEME
REAL(KIND=JPRB), POINTER :: NORGWD_PRMAX
REAL(KIND=JPRB), POINTER :: NORGWD_DZ
REAL(KIND=JPRB), POINTER :: NORGWD_PTROPO
REAL(KIND=JPRB), POINTER :: NORGWD_RUWMAX
REAL(KIND=JPRB), POINTER :: NORGWD_SAT
REAL(KIND=JPRB), POINTER :: NORGWD_RDISS
REAL(KIND=JPRB), POINTER :: NORGWD_DELTAT
REAL(KIND=JPRB), POINTER :: NORGWD_KMIN
REAL(KIND=JPRB), POINTER :: NORGWD_KMAX
REAL(KIND=JPRB), POINTER :: NORGWD_CMIN
REAL(KIND=JPRB), POINTER :: NORGWD_CMAX
REAL(KIND=JPRB), POINTER :: NORGWD_PLAUNCH
REAL(KIND=JPRB), POINTER :: NORGWD_PNOVERDIF
REAL(KIND=JPRB), POINTER :: NORGWD_DZFRON
REAL(KIND=JPRB), POINTER :: NORGWD_GFRON
REAL(KIND=JPRB), POINTER :: NORGWD_GB
`
Oh, I do not use namelists myself, but the error message might actually be misleading: your variables have the pointer attribute. I am not sure that is allowed in namelists (though why it would not be allowed is not something I can speculate about). Could you try without that attribute?
@Arjen, you are correct. NAMELIST does not work as soon as you have pointers and allocatables in derived types.
You can check this thread on GitHub for some examples with NAMELIST
i just moved to
#include “namnorgwd.nam.h” end of the line and worked. Thanks for helps!
NAMELIST has allowed pointers and allocatables for 20 years in some circumstances. In May 2004 F2003 9.5.3.6 paragraph 2 said
Every allocatable namelist-group-object in the namelist group shall be allocated and every namelist-group-object that is a pointer shall be associated with a target. If a namelist-group-object is polymorphic or has an ultimate component that is allocatable or a pointer, that object shall be processed by a user-defined derived-type input/output procedure (9.5.3.7)
The only differences in F2023 12.6.4.7 are that “user-defined derived-type” is replaced by “defined” and “9.5.3.7” by “12.6.4.8”.
Thanks for the info. Last time I tried (my tests are in the previous link) using NAMELIST with allocatable components in derived types both ifort 21 and gfortran 14 did not even compile the program. I re-edited my answer to be more specific to derived types.
I also came across that discussion on the intel forum that shed some light on the matter.
Sad. I have often written things permitted by a Fortran standard but not by compilers that should have followed that standard.