Error: Bad Trouble in IMCN - Unexpected EOF

  • Thread starter Thread starter NuclearEng12
  • Start date Start date
  • Tags Tags
    Error
Click For Summary

Discussion Overview

The discussion revolves around an error encountered in a computational code related to input file formatting, specifically regarding the "bad trouble in imcn in routine pass1" and "unexpected eof" messages. Participants explore potential issues with the input file structure after the addition of specific cards (sdef and nps) and provide suggestions for troubleshooting.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant reports an error message after modifying the input file, suspecting the new cards as the source of the problem.
  • Another participant emphasizes the need for clarity regarding the software and operating system used, suggesting that without this information, the query may not be considered technical.
  • A different participant asserts that the input file format does not meet program expectations, suggesting that the sdef or nps cards may not be added correctly.
  • One contributor notes that the SI1 card should be followed by an 'A' to indicate an array and that the SP1 card must match the number of entries in SI1. They also mention that omitting a corresponding SP2 for SI2 could lead to the unexpected EOF error.
  • Another participant points out that the first distribution must have equal numbers on the SI and SP cards and that the second distribution requires both SI and SP lines.
  • A later reply discusses formatting issues, indicating that leading spaces in the input file may cause the program to misinterpret the structure of the cards, potentially leading to the EOF error.
  • One participant adds that if there is a continuation of a previous card, no digits should appear within the first five spaces of the new line, as this could cause the program to misinterpret the input.

Areas of Agreement / Disagreement

Participants express various concerns and suggestions regarding the input file formatting, indicating that there is no consensus on a single solution. Multiple competing views on how to address the error remain present in the discussion.

Contextual Notes

Participants mention specific formatting rules and potential pitfalls in the input file structure, such as the need for matching entries between SI and SP cards, the correct use of indentation, and the importance of avoiding tabs. However, the discussion does not resolve the underlying issues, leaving some assumptions and dependencies on definitions unaddressed.

NuclearEng12
Messages
11
Reaction score
0
I am getting an error which reads as follows:


"bad trouble in imcn in routine pass1
unexpected eof in file ****** "

I just added a sdef and nps card to my input file, so I assumed the error was with one of those.

SDEF AXS=0 0 1 ERG=D1 RAD=D2 WGT=1 TME=0 PAR=1
SI1 0 .4 .8 1.2 1.6 2 2.4 2.8 3.2 3.6 4 4.4 4.8 5.2 5.6 6 6.4
6.8 7.2 7.6 8 8.4 8.8 9.2 9.6 10 10.4 10.8 11.2 11.6 12 12.4
12.8 13.2 13.6 14 14.4 14.8 15.2 15.6 16 16.4 16.8 17.2 17.6
18 18.4 18.8 19.2 19.6 20
SP1 0 .8718 .0320 .0181 .0145 .0121 .0113 .009 .007 .0044 .0035
.0035 .0028 .0028 .0023 .0011 .0011 .0007 .0005 .0002 .0004
.0002 .0002 .000026 .000081 .0002 .000089 .0001 .000077
.000018 .000018 .000026 0 0 .000017 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
SI2 -21 0

But I just can not figure out what is the problem. Would appreciate any suggestions.
 
Engineering news on Phys.org
Without any specification of software and OS used it classifies for random thoughts thread, not technical question.
 
The format of your input file does not comply with what is expected by the program.
Apparently you cannot add sdef or nps to it, or at least not in the way you have done it.

To fix it, you need to use a document specifying the format of the file, if it exists.

Or contact the author of the code and ask him.

Or you would need to analyse the code that tries to read the input file.
Assuming of course that you have access to the source code.
It seems to be in some module named "imcn" that contains a routine named "pass1".
Search for the error message in the source code.
I expect the code to be fairly straight forward, so you may be able to deduce what it expects.
 
I'm not familiar with MCNP, but one should check one's syntax.

I believe that SI1 should be followed by an A to indicate an array.

SP1 should have the same number of entries as SI1.

SI2 needs a corresponding SP2 with the same number of entries. If SP2 is omitted, that is probably where the program encounters and unexpected EOF since it would be looking for a SP2 vector.


I nice simple reference - http://www.mne.ksu.edu/~jks/MCNPprmr.pdf


I would also urge one to annotate (write comments in) the input deck in order to explain the model and the logic behind the model (see page 30 (33 of 45 in pdf) of the document cited).
 
Last edited:
The first distribution needs equal numbers on the SI and SP cards
You need to fix the second distribution defining the radius of your source. it needs an si and sp line,

Also check you have not removed the line break between the surface cards and data cards
 
NuclearEng12 said:
I am getting an error which reads as follows:


"bad trouble in imcn in routine pass1
unexpected eof in file ****** "

I just added a sdef and nps card to my input file, so I assumed the error was with one of those.

SDEF AXS=0 0 1 ERG=D1 RAD=D2 WGT=1 TME=0 PAR=1
SI1 0 .4 .8 1.2 1.6 2 2.4 2.8 3.2 3.6 4 4.4 4.8 5.2 5.6 6 6.4
6.8 7.2 7.6 8 8.4 8.8 9.2 9.6 10 10.4 10.8 11.2 11.6 12 12.4
12.8 13.2 13.6 14 14.4 14.8 15.2 15.6 16 16.4 16.8 17.2 17.6
18 18.4 18.8 19.2 19.6 20
SP1 0 .8718 .0320 .0181 .0145 .0121 .0113 .009 .007 .0044 .0035
.0035 .0028 .0028 .0023 .0011 .0011 .0007 .0005 .0002 .0004
.0002 .0002 .000026 .000081 .0002 .000089 .0001 .000077
.000018 .000018 .000026 0 0 .000017 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0
SI2 -21 0

But I just can not figure out what is the problem. Would appreciate any suggestions.

Ok, that's odd. In the quote screen the continuation of the SI card and SP card are shown indented, but not when I read your post directly. And when I preview there are no leading blanks either. PF has some quirks.

When your SDEF uses ERG=D1, then you add cards to provide the information. Those cards are cards, not continuations of the SDEF. You hook them up through the number, D1 goes with SI1 and SP1. You don't hook them up with indenting.

So in the first two lines

SDEF AXS=0 0 1 ERG=D1 RAD=D2 WGT=1 TME=0 PAR=1
__________SI1 0 .4 .8 1.2 1.6 2 2.4 2.8 3.2 3.6 4 4.4 4.8 5.2 5

I put in _ characters indicating the leading blanks I found. Don't use _ in MCNP, use blank.

You have blank characters in front of SI1. The first line of the SI1 card does not get indented. It's a card. The extra lines of the SI1 card get indented. (With spaces, not a tab. Don't use the tab character.) MCNP probably thinks the various SI and SP cards are part of the SDEF card. (Indenting 5 or more spaces indicates a continuation of a card.)

So it's looking for the SI and SP cards to match ERG=D1 and RAD=D2, and does not find them before the end of the file, because it has not parsed the entire (incorrect) SDEF card yet.

Other than that, round up the usual suspects:

Cells then surfaces then data, exactly one blank line between.

No tab characters.

Look to your line lengths, nothing longer than 72 characters.

Number of entries in SI1 and SP1 have to agree.

Hope this helps.
Dan
 
I concur with evrything the previous writer said with one important addition.

If there is an continuation to a previuos card you cannot have a digit within the first 5 spaces of the new line. MCNP then interprets this as a new card. Just an important note to think of when writing your input deck.
 

Similar threads

Replies
6
Views
7K