"Unexpected error in file" in MCNP

In summary, The conversation is about a potential error in a code file. The speaker has gone through the code and doesn't see any issues, but is unsure if there is a problem with the code or with the file itself. They ask if anyone else has any ideas and share a snippet of the code, which appears to be in a computer language called "MCNP." The code is meant to calculate the dose to water from an Ir-192 source and includes various card and surface definitions as well as data cards for photon and electron transport. The speaker also mentions a "grave yard" and a "tally card" for converting units.
  • #1
khary23
93
6
Hello,

I am getting the following error

Unexpected error in file

I have gone through the code and noting seems to be amiss. Does anyone have any ideas?
 

Attachments

  • DoseH2O_Ir2.txt
    3.9 KB · Views: 297
  • Like
Likes DEvens
Engineering news on Phys.org
  • #2
khary23 said:
Hello,

I am getting the following error

Unexpected error in file

I have gone through the code and noting seems to be amiss. Does anyone have any ideas?
What code ? All I see is a text file with no code in it.
 
  • #3
phinds said:
What code ? All I see is a text file with no code in it.
Thats weird. I'll try again and if there is still no code then that might explain the error.
 

Attachments

  • DoseH2O_Ir2.txt
    3.9 KB · Views: 332
  • #4
Here's what I see. I'm not aware of any computer language in which any of this would anything other than data.

Is this code in "MCNP" ?

Dose to water Ir-192 source
C Cell Cards
11 1 -22.42 -1 IMP:p,e=1 $ cylinder that defines source volume
12 3 -8.02 -3 2 5 IMP:p,e=1 $ volume that defines outer radius of casing
13 3 -8.02 -7 -2 1 IMP:p,e=1 $ volume that defines inner radious of casing
14 5 -0.99355 -4 -20 10 19 IMP:p,e=1 $ 2 19
16 3 -8.02 -2 -8 7 6 IMP:p,e=1 $ volume that defins end cap
17 4 -4.01 -10 -4 IMP:p,e=1 $ drive cable -4.81
C 20 2 -0.00125 -18 3 IMP:p,e=1
C 21 2 -0.00125 18 10 -19 IMP:p,e=1
C 22 2 -0.00125 -4 19 IMP:p,e=1
22 5 -0.99355 -20 3 10 -19 IMP:p,e=1 $ #11 #12 #13 #14 #16
23 5 -0.99355 20 -21 IMP:p,e=1 $ Tally Cell
24 5 -0.99355 21 -4 IMP:p,e=1
300 0 4 IMP:p,e=0 $ creates grave yard

C Surface Cards
1 RCC 0 0 -0.175 0 0 0.35 0.03 $ cylinder surface that defines source
2 RCC 0 0 -0.246 0 0 0.492 0.035 $ inner radius of casing
3 RCC 0 0 -0.246 0 0 0.492 0.045 $ outer radius of casing
4 SO 40 $ Graveyard
5 PZ -0.246 $ Bottom of source casing
6 RCC 0 0 0.35 0 0 0.072 0.03 $ end cap cylinder
7 PZ 0.175 $ plane that defines the top of the source
8 PZ 0.246 $ top of source casing
9 PZ -0.175 $ plane that defines the bottom of the source
10 RCC 0 0 -0.246 0 0 -40 0.043 $ drive cable
C 11 SO 10
19 SO 30
20 SO 0.9
21 SO 1.1
C 22 SO 325

C Data Cards
MODE p e $photon and electron transport
C tally card
*F4:p 23
# DE4 DF4 $ convert MeV/cm^2 to MeV/g
0.0010 4065
0.0015 1372
0.0020 615.2
0.0030 191.7
0.0040 81.91
0.0050 41.88
0.0060 24.05
0.0080 9.915
0.0100 4.944
0.0150 1.374
0.0200 0.5503
0.0300 0.1557
0.0400 0.06947
0.0500 0.04223
0.0600 0.03190
0.0800 0.02597
0.1000 0.02546
0.1500 0.02764
0.2000 0.02967
0.3000 0.03192
0.4000 0.03279
0.5000 0.03299
0.6000 0.03284
0.8000 0.03206
1.0000 0.03103
1.2500 0.02965
1.5000 0.02833
C Source is a cylindrical Isotropic Ir-192 photon emitting source centered at origin.
SDEF CEL 11 VEC 0 0 1 POS 0 0 -0.174 RAD D1 EXT D2 ERG D3 PAR 2
C Energy Spectrum of Ir-192 (MeV)
C Radius of circle centered on the axis of the cylinder
SI1 0.029
C Distance from the POS to the end of the cylinder
SI2 0.348
SI3 0 0.110093 0.13634348 0.17698 0.2013112 0.20579549
0.28004 0.2832668 0.29595827 0.30845692 0.31650791
0.329312 0.3744852 0.4164714 0.420532 0.46807152
0.4845780 0.48530 0.489039 0.5885845 0.59337
0.59935 0.60441464 0.61246564 0.70398 0.7658
0.8845418 1.06148 1.0897 1.3783
C Yield(%) Ir-192
SP3 0 0.000126 0.00183 0.000043 0.00472 0.033
0.00023 0.00262 0.2867 0.3 0.8281
0.000185 0.00721 0.00664 0.000737 0.4783
0.03184 0.000022 0.00443 0.04515 0.000426
0.000039 0.0823 0.05309 0.000053 0.0000149
0.002923 0.000528 0.0000108 0.0000124
C Define Materials
C Ir-192
M1 077192 1
C Air
C M2 6000 -0.00012 7000 -0.75527 8000 -0.23178 18000 -0.01283 GAS=1
C Stainless Steel
M3 025000 -0.02 014000 -0.01 024000 -0.17 028000 -0.12 026000 -0.68
C M3 8000 -0.888 1000 -.112
M4 025000 -0.02 014000 -0.01 024000 -0.17 028000 -0.12 026000 -0.68
C Water
M5 1000.04p 0.6667 8000.04p 0.3333
PRINT 50
NPS 10000000
 
  • #5
khary23 said:
I am getting the following error
Unexpected error in file
Is there any information other than this, such as a line number where the error occurred?
 
  • #6
phinds said:
Here's what I see. I'm not aware of any computer language in which any of this would anything other than data.

Is this code in "MCNP" ?

Dose to water Ir-192 source
C Cell Cards
11 1 -22.42 -1 IMP:p,e=1 $ cylinder that defines source volume
12 3 -8.02 -3 2 5 IMP:p,e=1 $ volume that defines outer radius of casing
13 3 -8.02 -7 -2 1 IMP:p,e=1 $ volume that defines inner radious of casing
14 5 -0.99355 -4 -20 10 19 IMP:p,e=1 $ 2 19
16 3 -8.02 -2 -8 7 6 IMP:p,e=1 $ volume that defins end cap
17 4 -4.01 -10 -4 IMP:p,e=1 $ drive cable -4.81
C 20 2 -0.00125 -18 3 IMP:p,e=1
C 21 2 -0.00125 18 10 -19 IMP:p,e=1
C 22 2 -0.00125 -4 19 IMP:p,e=1
22 5 -0.99355 -20 3 10 -19 IMP:p,e=1 $ #11 #12 #13 #14 #16
23 5 -0.99355 20 -21 IMP:p,e=1 $ Tally Cell
24 5 -0.99355 21 -4 IMP:p,e=1
300 0 4 IMP:p,e=0 $ creates grave yard

C Surface Cards
1 RCC 0 0 -0.175 0 0 0.35 0.03 $ cylinder surface that defines source
2 RCC 0 0 -0.246 0 0 0.492 0.035 $ inner radius of casing
3 RCC 0 0 -0.246 0 0 0.492 0.045 $ outer radius of casing
4 SO 40 $ Graveyard
5 PZ -0.246 $ Bottom of source casing
6 RCC 0 0 0.35 0 0 0.072 0.03 $ end cap cylinder
7 PZ 0.175 $ plane that defines the top of the source
8 PZ 0.246 $ top of source casing
9 PZ -0.175 $ plane that defines the bottom of the source
10 RCC 0 0 -0.246 0 0 -40 0.043 $ drive cable
C 11 SO 10
19 SO 30
20 SO 0.9
21 SO 1.1
C 22 SO 325

C Data Cards
MODE p e $photon and electron transport
C tally card
*F4:p 23
# DE4 DF4 $ convert MeV/cm^2 to MeV/g
0.0010 4065
0.0015 1372
0.0020 615.2
0.0030 191.7
0.0040 81.91
0.0050 41.88
0.0060 24.05
0.0080 9.915
0.0100 4.944
0.0150 1.374
0.0200 0.5503
0.0300 0.1557
0.0400 0.06947
0.0500 0.04223
0.0600 0.03190
0.0800 0.02597
0.1000 0.02546
0.1500 0.02764
0.2000 0.02967
0.3000 0.03192
0.4000 0.03279
0.5000 0.03299
0.6000 0.03284
0.8000 0.03206
1.0000 0.03103
1.2500 0.02965
1.5000 0.02833
C Source is a cylindrical Isotropic Ir-192 photon emitting source centered at origin.
SDEF CEL 11 VEC 0 0 1 POS 0 0 -0.174 RAD D1 EXT D2 ERG D3 PAR 2
C Energy Spectrum of Ir-192 (MeV)
C Radius of circle centered on the axis of the cylinder
SI1 0.029
C Distance from the POS to the end of the cylinder
SI2 0.348
SI3 0 0.110093 0.13634348 0.17698 0.2013112 0.20579549
0.28004 0.2832668 0.29595827 0.30845692 0.31650791
0.329312 0.3744852 0.4164714 0.420532 0.46807152
0.4845780 0.48530 0.489039 0.5885845 0.59337
0.59935 0.60441464 0.61246564 0.70398 0.7658
0.8845418 1.06148 1.0897 1.3783
C Yield(%) Ir-192
SP3 0 0.000126 0.00183 0.000043 0.00472 0.033
0.00023 0.00262 0.2867 0.3 0.8281
0.000185 0.00721 0.00664 0.000737 0.4783
0.03184 0.000022 0.00443 0.04515 0.000426
0.000039 0.0823 0.05309 0.000053 0.0000149
0.002923 0.000528 0.0000108 0.0000124
C Define Materials
C Ir-192
M1 077192 1
C Air
C M2 6000 -0.00012 7000 -0.75527 8000 -0.23178 18000 -0.01283 GAS=1
C Stainless Steel
M3 025000 -0.02 014000 -0.01 024000 -0.17 028000 -0.12 026000 -0.68
C M3 8000 -0.888 1000 -.112
M4 025000 -0.02 014000 -0.01 024000 -0.17 028000 -0.12 026000 -0.68
C Water
M5 1000.04p 0.6667 8000.04p 0.3333
PRINT 50
NPS 10000000

The software is called MCNP
 
  • #7
Mark44 said:
Is there any information other than this, such as a line number where the error occurred?

Yes the other line is
"bad trouble in subroutine pass0 of imcn"
 
  • #8
khary23 said:
The software is called MCNP
Which was already clear. My question is, is that stuff in the file CODE in "MCNP" ?
 
  • #9
phinds said:
Which was already clear. My question is, is that stuff in the file CODE in "MCNP" ?
Yes that is the format of MCNP's code.
 
  • Like
Likes phinds
  • #10
Putting this inside [ code]...[ /code] tags (without the space after the left bracket) improves readability:
Code:
Dose to water Ir-192 source
C Cell Cards
11 1 -22.42      -1            IMP:p,e=1 $ cylinder that defines source volume
12 3 -8.02      -3  2 5        IMP:p,e=1 $ volume that defines outer radius of casing
13 3 -8.02      -7 -2 1        IMP:p,e=1 $ volume that defines inner radious of casing
14 5 -0.99355   -4 -20 10 19   IMP:p,e=1 $ 2  19
16 3 -8.02      -2 -8 7 6      IMP:p,e=1 $ volume that defins end cap
17 4 -4.01      -10  -4        IMP:p,e=1 $ drive cable  -4.81
C 20 2 -0.00125 -18 3          IMP:p,e=1
C 21 2 -0.00125 18 10 -19      IMP:p,e=1
C 22 2 -0.00125 -4  19         IMP:p,e=1
22 5 -0.99355  -20 3 10 -19    IMP:p,e=1   $ #11 #12 #13 #14  #16
23 5 -0.99355   20 -21         IMP:p,e=1   $ Tally Cell
24 5 -0.99355   21 -4          IMP:p,e=1
300 0 4                        IMP:p,e=0 $ creates grave yard

C Surface Cards
1 RCC 0 0 -0.175  0 0 0.35 0.03    $ cylinder surface that defines source
2 RCC 0 0 -0.246  0 0 0.492 0.035  $ inner radius of casing
3 RCC 0 0 -0.246  0 0 0.492 0.045  $ outer radius of casing
4 SO 40                           $ Graveyard
5 PZ -0.246                        $ Bottom of source casing
6 RCC 0 0 0.35 0 0 0.072 0.03      $ end cap cylinder
7 PZ 0.175                         $ plane that defines the top of the source
8 PZ 0.246                         $ top of source casing
9 PZ -0.175                        $ plane that defines the bottom of the source
10 RCC 0 0 -0.246 0 0 -40 0.043    $ drive cable
C 11 SO 10
19 SO 30
20 SO 0.9
21 SO 1.1
C 22 SO 325

C Data Cards
MODE p e      $photon and electron transport
C tally card
*F4:p 23
#    DE4               DF4     $ convert MeV/cm^2 to MeV/g
     0.0010             4065
     0.0015             1372
     0.0020             615.2
     0.0030             191.7
     0.0040              81.91
     0.0050              41.88
     0.0060              24.05
     0.0080               9.915
     0.0100               4.944
     0.0150               1.374
     0.0200               0.5503
     0.0300               0.1557
     0.0400               0.06947
     0.0500               0.04223
     0.0600               0.03190
     0.0800               0.02597
     0.1000               0.02546 
     0.1500               0.02764
     0.2000               0.02967
     0.3000               0.03192
     0.4000               0.03279
     0.5000               0.03299
     0.6000               0.03284
     0.8000               0.03206
     1.0000               0.03103
     1.2500               0.02965
     1.5000               0.02833
C Source is a cylindrical Isotropic Ir-192 photon emitting source centered at origin.
SDEF  CEL 11  VEC 0 0 1  POS 0 0 -0.174  RAD D1  EXT D2  ERG D3  PAR 2
C Energy Spectrum of Ir-192 (MeV)
C Radius of circle centered on the axis of the cylinder
SI1 0.029
C Distance from the POS to the end of the cylinder
SI2   0.348
SI3   0 0.110093 0.13634348 0.17698 0.2013112 0.20579549
      0.28004 0.2832668 0.29595827 0.30845692 0.31650791
      0.329312 0.3744852 0.4164714 0.420532 0.46807152
      0.4845780 0.48530 0.489039 0.5885845 0.59337
      0.59935 0.60441464 0.61246564 0.70398 0.7658
      0.8845418 1.06148 1.0897 1.3783
C Yield(%) Ir-192
SP3   0 0.000126 0.00183 0.000043 0.00472 0.033 
      0.00023    0.00262    0.2867    0.3 0.8281
      0.000185 0.00721 0.00664 0.000737 0.4783
      0.03184    0.000022 0.00443 0.04515 0.000426
      0.000039 0.0823    0.05309    0.000053 0.0000149
      0.002923 0.000528 0.0000108 0.0000124
C Define Materials
C Ir-192
M1 077192 1
C Air
C M2 6000 -0.00012 7000 -0.75527 8000 -0.23178 18000 -0.01283 GAS=1
C Stainless Steel
M3 025000 -0.02 014000 -0.01 024000 -0.17 028000 -0.12 026000 -0.68
C M3  8000 -0.888 1000 -.112
M4 025000 -0.02 014000 -0.01 024000 -0.17 028000 -0.12 026000 -0.68
C Water
M5 1000.04p  0.6667   8000.04p  0.3333
PRINT 50
NPS 10000000
The error message that says "bad trouble in subroutine pass0 of imcn" suggests to me that there is a syntax error that is causing a proto-parsing check to fail.

I note that some of the cell definitions have been commented out, which suggests to me that this is in-flux code, wherefore presumably some version of it didn't get the error. Similarly, a presumably previous definition for M3 is commented out, and currently M3 and M4 have the same values in their definitions. Another indication is that the (line 68) comment 'C Energy Spectrum of Ir-192 (MeV)' isn't followed by a corresponding specification in the non-ignored code. That may not be a problem, but it strongly hints at the existence of an earlier version.

If you've modified a file that consisted of code that was error-free prior to your modifications, you might want to look at at your changes first, or start with the latest working predecessor, and reintroduce your changes 'one by one' (to the extent to which doing that would be syntactically acceptable).

A cursory glance at some of the MCNP documentation indicates to me that a dump may be available in an output file.

The description in the MCNP User's Guide leads me to be a bit suspicious regarding the use of the # (complement operator) on line 38, but I haven't seen enough samples or a complete enough description to justify my suspicion as other than unfounded.

I don't know MCNP, so a syntax error in a sample of it isn't very likely to be obvious to me, so if I could not locate the errant line by reference to a message or dump, I would try naively and systematically to isolate the line: I would progressively comment out lines by prepending, e.g., C test1, to a block of lines, and when the error stopped being triggered, uncomment part of the block, until I had, in a manner akin to a binary search, homed in on the faulty line.
 
Last edited:
  • #11
Hi,
what version 6.1 or 6.2 ?
 
  • #12
The issue with the file is geometry. The cells must fill every portion of space exactly once. This is not the case with this file. There are overlaps between cells so that some parts are defined more than once.

It looks like the problem child is cell 17. It overlaps with cells 23 and 24. One possible thing you could do is to exclude cell 17 from them by adding #17 to their definitions. The comment says cell 17 is "drive cable" so it probably needs to extend to the boundary of the model. But I can't be sure that is what you want.

The easiest way to see this sort of error is usually to use the plotting package. The first thing you see (after changing all the tabs to blanks, MCNP 6.2, right?) if you plot this in the default mode is that cell 17 has dotted red line outline over most of its length.

As of MCNP 6.2 it looks like VisEd is no longer part of the package. You should be sure to set up the plotting utility, if you have not already done so. That might require you to get an x-windows emulator for MSWindows if you are using it. On LINUX I can't tell you how to set it up because in this place that is done by our system manager.

Folks, if you don't know MCNP it isn't helpful to complain about "what code?" and similar remarks. The OP's question is reasonable. It is perfectly reasonable to refer to an MCNP input as "a code." The # operator that sysprog complained about introduces vertical format, a properly formed method of inputting data in MCNP. Nearly all of this is unhelpful distraction from the actual problem.
 
  • Informative
Likes sysprog
  • #13
DEvens said:
The # operator that sysprog complained about introduces vertical format, a properly formed method of inputting data in MCNP.
Regarding that, my post included:
sysprog said:
The description in the MCNP User's Guide leads me to be a bit suspicious regarding the use of the # (complement operator) on line 38, but I haven't seen enough samples or a complete enough description to justify my suspicion as other than unfounded.
The section of the manual on the complement operator includes:
MCNP User's Guide said:
#n means that the description of the current cell is the complement of the description of cell n. #(...) means complement the portion of the cell description in the parentheses (usually just a list of surfaces describing another cell).
I don't agree with your assessment that I "complained about" the # operator; I think that I merely suggested that its use might be among the things in the code that should be evaluated for the possibility of syntactic incorrectness.
DEvens said:
if you don't know MCNP it isn't helpful to complain
Everyone who responded was clearly focused on being of assistance to @khary23 in getting the error corrected. I concede that given that, as I said:
sysprog said:
I don't know MCNP
I was to some extent shooting in the dark; however, the procedure that I suggested I think reliably would find the part of the code that caused the error condition to be raised, and that would facilitate correction of the code.

In this instance, knowing MCNP, as apparently you do, presumably should allow for a more helpful response, but I don't think that should be taken to mean that the well-intentioned, and not incogent, efforts of others, should be castigated as unhelpful complaining.

For my part, other than emplacing the code within the appropriate BB tags, had your post already been present, I'd have not presented any potentially distracting material.
DEvens said:
As of MCNP 6.2 it looks like VisEd is no longer part of the package. You should be sure to set up the plotting utility, if you have not already done so. That might require you to get an x-windows emulator for MSWindows if you are using it.
Regarding X-Windows on Windows, CygWin/X is available at https://x.cygwin.com/
 
  • #14
Hi,
you have a cookie-cutter because of cell 17.
try this modification :

Dose to water Ir-192 source
C Cell Cards
Dose to water Ir-192 source
C Cell Cards
[…]
16 3 -8.02 -2 -8 7 6 IMP:p,e=1 $ volume that defins end cap
17 4 -4.01 -10 IMP:p,e=1 $ drive cable -4.81
22 5 -0.99355 -20 3 10 -19 IMP:p,e=1 $ #11 #12 #13 #14 #16
23 5 -0.99355 20 -21 10 IMP:p,e=1 $ Tally Cell
24 5 -0.99355 21 -4 10 IMP:p,e=1
300 0 4 IMP:p,e=0 $ creates grave yard

C Surface Cards
[…]
10 RCC 0 0 -0.246 0 0 -39.753 0.043 $ drive cable

And no error
 

Attachments

  • DoseH2O_Ir2new.txt
    3.9 KB · Views: 282

Related to "Unexpected error in file" in MCNP

What causes an "Unexpected error in file" in MCNP?

There are several potential causes for this error, including incorrect input parameters, missing or corrupted data files, or a bug in the software. It is important to carefully check all input parameters and data files to ensure they are correct and complete.

How can I troubleshoot an "Unexpected error in file" in MCNP?

One way to troubleshoot this error is to carefully review the error message and any accompanying error log files. These may provide clues as to what caused the error. Additionally, you can try running the simulation with different input parameters to see if the error persists.

Can a user prevent an "Unexpected error in file" in MCNP?

While unexpected errors can occur in any software, there are steps that users can take to minimize the chances of encountering this error in MCNP. These include carefully reviewing input parameters and data files, regularly updating to the latest version of the software, and reporting any bugs or issues to the developers.

Is there a way to recover from an "Unexpected error in file" in MCNP?

In some cases, it may be possible to recover from this error by restarting the simulation or adjusting input parameters. However, if the error persists, it may be necessary to seek assistance from the MCNP support team or consult the user manual for further guidance.

Are there any known solutions for an "Unexpected error in file" in MCNP?

There is no one-size-fits-all solution for this error as it can have various causes. However, some common solutions include double-checking input parameters and data files, updating to the latest version of the software, and reporting any bugs or issues to the developers. It may also be helpful to consult online forums or seek assistance from other MCNP users.

Similar threads

  • Nuclear Engineering
Replies
1
Views
1K
  • Nuclear Engineering
Replies
6
Views
2K
Replies
1
Views
1K
Replies
6
Views
1K
Replies
8
Views
2K
  • Nuclear Engineering
Replies
2
Views
2K
  • Nuclear Engineering
Replies
1
Views
1K
Replies
19
Views
1K
Replies
3
Views
2K
Back
Top