When ana_sediment is defined & there is an initial nc file..

Sediment modeling collaborators: issues, applications, information exchange

Moderators: arango, robertson, rsignell

Post Reply
Message
Author
LauraB
Posts: 23
Joined: Mon Jul 30, 2007 9:13 pm
Location: Dalhousie University
Contact:

When ana_sediment is defined & there is an initial nc file..

#1 Unread post by LauraB »

Hi ROMS community,

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

jcwarner
Posts: 1200
Joined: Wed Dec 31, 2003 6:16 pm
Location: USGS, USA

Re: When ana_sediment is defined & there is an initial nc file..

#2 Unread post by jcwarner »

Was this a restart (nrrec.ne.0)?
Did your fix work?

LauraB
Posts: 23
Joined: Mon Jul 30, 2007 9:13 pm
Location: Dalhousie University
Contact:

Re: When ana_sediment is defined & there is an initial nc file..

#3 Unread post by LauraB »

Thanks for the reply! This wasn't a restart run (nrrec=0), so I realize now -after your comment- that the DO loop I added is not being used at all! (and probably should be removed)

However, the fix worked and the run is still going on. So it looks like the extra "# ifndef ANA_SEDIMENT" is doing the trick... Yesterday I checked the first few data saved in the history file, and it is reading correctly the initial conditions for sediments (including grain_diameter, which was the one that triggered the error before).

Regards,
Laura

User avatar
arango
Site Admin
Posts: 1361
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: When ana_sediment is defined & there is an initial nc file..

#4 Unread post by arango »

I finally have time to look at this issue. Yes, thank you. There is a missing logic here when the bottom properties are specified with analytical expressions (ANA_SEDIMENT) in sediment of BBL applications. There is not need for the logic that you added inside of the #ifdef SEDIMENT. This logic is taken care for both SEDIMENT and BBL_MODEL below the above logic.

See the following trac :arrow: ticket for more details. Please update :wink:

Post Reply