I wanted to add sediments to my model. My initial conditions for physics and biology were given in a netcdf file, while I wanted analytical conditions for the sediments. As far as I understand, whenever ana_* is defined, analytical initial fields are used (even if there is an initial netcdf file). However, I got the following error:
NLM: CHECKVARS - unable to find model variable: grain_diameter
in file: /home/ROMS_LB/Bioupw21/initial_21a2.nc
...
ROMS/TOMS - Output NetCDF summary for Grid 01:
Analytical header files used:
/home/ROMS_LB/User/Functionals/ana_grid.h
/home/ROMS_LB/User/Functionals/ana_hmixcoef.h
/home/ROMS_LB/User/Functionals/ana_sediment.h
ROMS/TOMS - Input error ............. exit_flag: 2
I think the problem was in checkvars.F, where get_var didn't check for bottom variables (idBott) inside the "# ifdef ANA_SEDIMENT" loop. Below I copy the piece of code with my modifications. I look forward to hearing your opinions about this fix!
Best,
Laura
Utility/checkvars.F:
Code: Select all
# ifdef SEDIMENT
# ifdef ANA_SEDIMENT
IF (nrrec(ng).ne.0) THEN
DO itrc=1,NST
get_var(idTvar(idsed(itrc)))=.TRUE.
get_var(idfrac(itrc))=.TRUE.
get_var(idBmas(itrc))=.TRUE.
END DO
DO itrc=1,MBEDP
get_var(idSbed(itrc))=.TRUE.
END DO
!---by LB: need to look for Bott initial conds at ana_sed
DO itrc=1,MBOTP
get_var(idBott(itrc))=.TRUE.
END DO
!----
END IF
# else
DO itrc=1,NST
get_var(idTvar(idsed(itrc)))=.TRUE.
get_var(idfrac(itrc))=.TRUE.
get_var(idBmas(itrc))=.TRUE.
END DO
DO itrc=1,MBEDP
get_var(idSbed(itrc))=.TRUE.
END DO
# endif
# ifdef BEDLOAD
IF (nrrec(ng).ne.0) THEN
DO itrc=1,NST
get_var(idUbld(itrc))=.TRUE.
get_var(idVbld(itrc))=.TRUE.
END DO
END IF
# endif
# ifdef SED_MORPH
IF (nrrec(ng).ne.0) THEN
get_var(idbath)=.TRUE.
END IF
# endif
# endif
# if defined SEDIMENT || defined BBL_MODEL
!---by LB: need to skip this step if ana_sed was defined...
# ifndef ANA_SEDIMENT
DO itrc=1,MBOTP
get_var(idBott(itrc))=.TRUE.
END DO
# endif
# endif