CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Fortran 'list-directed I/O syntax error' (KIVA 3V)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 28, 2009, 11:29
Default Fortran 'list-directed I/O syntax error' (KIVA 3V)
  #1
New Member
 
Robert C
Join Date: Jun 2009
Location: London, UK
Posts: 16
Rep Power: 16
ottbot is on a distinguished road
Hi all, I've been given KIVA 3V code to get familiar with.. Being relatively new to Fortran and CFD, it's been a challenge getting this to run on OS X (using ifort 11)

Anyway, I'm having problems getting kiva to read itape5, this is the specific error:
Code:
forrtl: severe (59): list-directed I/O syntax error, unit 5, file /Users/rob/Desktop/kiva/kiva/itape5
This is happening starting here:
Code:
      read ( 5,*)      id(1),(presi(n),n=1,nreg)
      write(12,*) ' presi  ',(presi(n),n=1,nreg)
      read ( 5,*)      id(1),(tempi(n),n=1,nreg)
      write(12,*) ' tempi  ',(tempi(n),n=1,nreg)
Here is the relevant location in itape5:
Code:
  nreg      1
 presi,		4.9e+6
 tempi,		500.0
 tkei,      0.1
 scli,      0.0
nreg is read just above the fortran line above, then it chokes when trying to read presi, and I can't sort out why. I wrote a small stand alone to do the same thing, which seems to work fine.

Anyone have any ideas how to debug this?

Thanks!
ottbot is offline   Reply With Quote

Old   June 28, 2009, 20:17
Default
  #2
New Member
 
Ananda Himansu
Join Date: Apr 2009
Location: Cleveland, Ohio, USA
Posts: 17
Rep Power: 17
Ananda Himansu is on a distinguished road
It would appear that either (a) you put quotation marks (single or double) to delimit the words "nreg", "presi", "tempi", etc. in your input file itape5, assuming id(1) has been declared to be of type character, or (b) you change the read statement to a formatted read (instead of list-directed) and use the "a" format for the names. However, it is a mystery to me how you succeeded in reading the "nreg 1" line. Perhaps the commas play a role and id(1) is declared of type integer?
Ananda Himansu is offline   Reply With Quote

Old   June 29, 2009, 17:04
Default
  #3
New Member
 
Robert C
Join Date: Jun 2009
Location: London, UK
Posts: 16
Rep Power: 16
ottbot is on a distinguished road
Thanks for the response.. What's most interesting, is I cannot duplicate the problem outside of KIVA.

I've made a test program using relevant snippets from kiva.. The following program works:
Code:
      program readtest
        character *8 id(4)
c        integer nreg
c        double precision presi(10), tempi(2)
        common /scrhoi/ nreg
        common /scrhor/ er(3),presi(3),tempi(2)


	open(unit=5, file='test') 
        open(unit=12,file='out_test')
        read ( 5,600) id(1),nreg
        read ( 5,*)  id(1),(presi(n),n=1,nreg)

        write(12, *), ' presi  ',(presi(n),n=1,nreg)
        read ( 5,*)      id(1),(tempi(n),n=1,nreg)
        write(12, *) ' tempi  ',(tempi(n),n=1,nreg)

 600    format(a8,i5)
      end program readtest
I've defined the variables using the same common statement as in kiva (this is happening in rinput.F)

The program above has no problem reading the following file:
Code:
  nreg      1
 presi,   4.9e+6
 tempi,   500.0
 tkei,      0.1
 scli,      0.0
This executes without error, I can't figure out what's causing KIVA to fail.
ottbot is offline   Reply With Quote

Old   June 29, 2009, 19:41
Default
  #4
New Member
 
Ananda Himansu
Join Date: Apr 2009
Location: Cleveland, Ohio, USA
Posts: 17
Rep Power: 17
Ananda Himansu is on a distinguished road
The fact that your mini-program "readtest.f" works and executes without error does not mean that it conforms to the Fortran standard. Notice that in your mini-program (and presumably in the KIVA read statement that you left out), the character string nreg is read using an "a" format in the format statement labeled 600. That is why KIVA does not bomb out on that line, but rather on the next line. When you run "readtest.f", try writing out id(1) after each read statement.

Try running your mini-program "readtest.f" on an altered input file "test" which contains the lines

nreg 1
'presi', 4.9e+6
'tempi', 500.0
'tkei', 0.1
'scli', 0.0
Ananda Himansu is offline   Reply With Quote

Old   June 30, 2009, 03:26
Default
  #5
New Member
 
Robert C
Join Date: Jun 2009
Location: London, UK
Posts: 16
Rep Power: 16
ottbot is on a distinguished road
Ah, thanks a lot Ananda.. If only I would have listened to you yesterday!

Putting quotes around 'presi', etc got kiva working. Thanks again.
ottbot is offline   Reply With Quote

Old   June 30, 2009, 06:59
Default
  #6
New Member
 
Ananda Himansu
Join Date: Apr 2009
Location: Cleveland, Ohio, USA
Posts: 17
Rep Power: 17
Ananda Himansu is on a distinguished road
You are welcome, Robert. Some compilers are forgiving, but the resulting non-conforming code is not portable to other compilers. However, this particular error was an input format error rather than a syntax error, and so I do not know whether setting a "strict conformance" flag on the compiler would have caused "readtest.f" to object to the original "test" input file.
Ananda Himansu is offline   Reply With Quote

Old   May 28, 2011, 18:20
Default kiva 3V.2x
  #7
New Member
 
habib
Join Date: May 2011
Posts: 5
Rep Power: 14
habib58 is on a distinguished road
I'm looking for the kiva 3V.2x code for editing and I'm very gratful if i will receive it.
I work on internal combustion for optimization of chamber...thanx
habib58 is offline   Reply With Quote

Old   June 11, 2013, 12:09
Default
  #8
New Member
 
Javier
Join Date: Jun 2013
Posts: 1
Rep Power: 0
javisandovali is on a distinguished road
Hi Robert,
I'm having a problem with Kiva 3v, I had the code running and I made the first simulation with no problem... but now I want to do the next simulation and for that purpose I've modified some parameters in the ITAPE5 (such as rpm, fuel mass, etc.) and after that when I try to run the simulation this error appears...
(I don't know why, I mean, I just changed a few numbers from the initial ITAPE5)

"dofio: [1015] Unknown error
logical unit 5, named 'itape5'
lately: reading sequential formatted external IO
part of last data: v 0.0 ^M|^J ca
Abort (core dumped)"

Can you please help me?
Thanks
javisandovali is offline   Reply With Quote

Reply

Tags
fortran, kiva


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparison between C/C++ and Fortran? rick Main CFD Forum 45 September 6, 2011 00:52
CFX11 + Fortran compiler ? Mohan CFX 20 March 30, 2011 18:56
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 19:08
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51
error while compiling the USER Sub routine CFD user CFX 3 November 25, 2002 15:16


All times are GMT -4. The time now is 15:55.