At line 1895 of file mod_ncparam.f90 Fortran runtime error

Report or discuss software problems and other woes

Moderators: arango, robertson

Post Reply
Message
Author
tongyaop
Posts: 7
Joined: Tue Feb 15, 2022 8:59 pm
Location: University of Minnesota

At line 1895 of file mod_ncparam.f90 Fortran runtime error

#1 Unread post by tongyaop »

Hi!

I have successfully built and executed upwelling test case last week.

Recently, I decided to reorganize the directory, so I changed build_roms.sh and successfully compiled it again. However, when I was trying to run it, there is an error message:

At line 1895 of file mod_ncparam.f90
Fortran runtime error: Index '-1094795586' of dimension 2 of array 'vname' below lower bound of 0.

The code that is reporting the error is shown below (./Build_romsG/ mod_ncparam.f90)

Code: Select all

               IF (TRIM(ADJUSTL(Vname(3,idTvar(i)))).eq.             &
     &                'nondimensional') THEN
                    WRITE (Vname(3,varid),'(a)')                        &
     &                    'meter3 second-1'
                  ELSE
                    WRITE (Vname(3,varid),'(a,1x,a)')                   &
     &                    'meter3 second-1',                            &
     &                    TRIM(ADJUSTL(Vname(3,idTvar(i))))
                  END IF
From my understanding, idTvar(i) is giving me the awful wrong negative index number. However, I couldn't figure out why it does.
Any idea where I should be looking at to solve the error message? I don't recall change anything significantly after a successful simulation last time. Only minor changes in *.in file.

Yangjun666
Posts: 3
Joined: Fri Jan 07, 2022 2:10 pm
Location: South China University of Technology

Re: At line 1895 of file mod_ncparam.f90 Fortran runtime error

#2 Unread post by Yangjun666 »

Dear friend,
I have the same problem and hope it can be solved.

robertson
Site Admin
Posts: 224
Joined: Wed Feb 26, 2003 3:12 pm
Location: IMCS, Rutgers University

Re: At line 1895 of file mod_ncparam.f90 Fortran runtime error

#3 Unread post by robertson »

Vname is referenced 4 times in that code block. Which line is 1895? Also, that code block occurs 3 times in mod_ncparam.f90; which CASE block is line 1895 under? You will need to scroll up about 15 lines to see what CASE block you are in.

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

Re: At line 1895 of file mod_ncparam.f90 Fortran runtime error

#4 Unread post by jcwarner »

not sure if this is the correct answer, but you need to be consistent with salinity and NT value settings.

If you use
#define SALINITY
then make sure ocean.in has NAT = 2

If you use
#undef SALINITY or not even mention salinity,
then make sure ocean.in has NAT = 1

-j

powellb
Posts: 11
Joined: Sat Feb 14, 2004 5:16 am
Location: University of Hawaii

Re: At line 1895 of file mod_ncparam.f90 Fortran runtime error

#5 Unread post by powellb »

Are you running with a biological model enabled? Something is happening as it goes through the number of tracers (as jcwarner pointed above):

Code: Select all

            SELECT CASE (Vinfo(1))
              CASE ('tracer2')
                varid=varid-1
                DO i=1,MT
                  varid=varid+1
                  idTTav(i)=varid
                  DO ng=1,Ngrids
                    Fscale(varid,ng)=scale
                    Iinfo(1,varid,ng)=gtype
Notice the DO loop from 1 to MT. What is happening is that after 'salt', the name is blank, so it fails.

Not sure what is causing it. In fact, I am having the same issue with an internal biological model. I'll post an update if I find the cause. It works fine if I only run the physics.

jpm
Posts: 21
Joined: Thu Aug 27, 2009 4:37 pm
Location: UCSC

Re: At line 1895 of file mod_ncparam.f90 Fortran runtime error

#6 Unread post by jpm »

I just ran into the same issue, I occurred in the same place pointed out by powellb, also using a biological model, so that more than 2 tracers are defined and MT>2.

Code: Select all

!
!  Determine metadata for quadratic tracer averages.
!
            SELECT CASE (Vinfo(1))
              CASE ('tracer2')
                varid=varid-1
                DO i=1,MT
                  varid=varid+1
                  idTTav(i)=varid
                  DO ng=1,Ngrids
                    Fscale(varid,ng)=scale
                    Iinfo(1,varid,ng)=gtype
                  END DO
                  WRITE (Vname(1,varid),'(a,a)')                        &
     &                  TRIM(ADJUSTL(Vname(1,idTvar(i)))), '_2'
The problem was that the entries in idTvar (last line in code snippet above) were unset for indices i > 2, i.e. the biological tracers. The cause of this problem was the order of variables in the varinfo.dat file: the entry for tracer2 occurred before the entries for the biological tracers. Because they are read sequentially from top to bottom, the order matters, and all tracer variables need to appear before variables that read idTvar(i).

After changing the order of variables in the varinfo file, and moving the biological tracers variables up, above tracer2, the issue disappeared for me. The original issue by tongyaop could have a similar explanation, but may also be caused by a variable missing from the varinfo file.
Jann Paul Mattern, Ocean Sciences Department, UCSC

fabeobd
Posts: 16
Joined: Thu Jun 09, 2011 2:10 pm
Location: UNSW Sydney
Contact:

Re: At line 1895 of file mod_ncparam.f90 Fortran runtime error

#7 Unread post by fabeobd »

I'm facing a similar issue when trying to implement a biological model to my circum-Antarctic setup.

Code: Select all

 
 in initialize_biology
 end of initialize_biology
At line 1238 of file mod_ncparam.f90
Fortran runtime error: End of record
these lines in mod_ncparam.f90 are exactly the same pointed by others here:

Code: Select all

!
!  Determine metadata for quadratic tracer averages.
!
            SELECT CASE (Vinfo(1))
              CASE ('tracer2')
                varid=varid-1
                DO i=1,MT
                  varid=varid+1
                  idTTav(i)=varid
                  DO ng=1,Ngrids
                    Fscale(varid,ng)=scale
                    Iinfo(1,varid,ng)=gtype
                  END DO
[b]                  WRITE (Vname(1,varid),'(a,a)')                        &
[/b]     &                  TRIM(ADJUSTL(Vname(1,idTvar(i)))), '_2'
with the one in bold being line 1238.

Following jpm comment, I doubled checked my varinfo.dat but in my case the biological tracers are already appearing before tracer2. Any other suggestion on what to look for?

Thank you,
Fabio
Fabio Boeira Dias, PhD
Postdoctoral researcher
Climate Change Research Centre (CCRC)
University of New South Wales

Post Reply