Summary of MCNP common problems and records of stepping on pits (fuse: endless loop)
As a student majoring in computer science, doing interdisciplinary research is really too torturous. Computer tomography needs to simulate data by itself, so I started to get in touch with MCNP, interlaced like mountains, and MCNP itself has many small pits. To kill.
Recently, I encountered a process where the normal operation of MCNP fell into an infinite loop.
After the solution is resolved, this article is set up as a warning to encourage each other.
Basic error (input card syntax error)
1 line character limit
A row of valid characters can only have 80 columns.
But comments can exceed 80 columns.
2 tabs tab
Can not have, only spaces.
3 line breaks
There can only be two line breaks, respectively between the cell card and the surface card, and between the surface card and the type card.
sinkhole error: run-time infinite loop
In my experiment, the source needs to be rotated and translated, where the translation is 40 steps within 0~10; the rotation is 360° from the rotation, and the step size is 3°. The values of the translation part and the rotation part are as follows: the process is
in Batch processing it directly in python, and then the problem came, when the source was translated to heights of 4.625 and 4.875, the inp file rotated to 343° started to fall into an infinite loop after running for an hour each time, that is, the CPU was occupied, but forever It will not be counted to the next dump. I have tried many times on different machines, and I have changed various things in the inp card.
It didn't work until the decimal part of the source and direction was changed to 1 digit at the end., the original setting is 5 digits, I have tried 3 digits, but 2 digits will not work. It must be 1 bit. I don't know which value makes MCNP fall into an infinite loop.
The real pit is a tiankeng, so take it as a warning.
other errors
1 material
If there is no .71c material in the specified database, it cannot be calculated unless it happens that the MCNP database can be automatically converted. For example, when using the 66c database, I set the .71c material. Although there is no .71c material in the database, it will still be based on the The atomic number is automatically indexed, but sometimes it doesn’t work, which caused me to change the particle type p->n once, and the program couldn’t run as a result. Later, I solved it with the help of my classmates. It is recommended that materials still use the atomic number +00 to represent the natural distribution .
Mistake, corrected on 2022.06.22:
It is recommended that the material still use the atomic number plus particle number to represent the natural distribution.
Some materials may not be distributed naturally, so +00 is still required. such as C and Ar
2 geometry
If my geometry is not wrong:
MCNP cannot handle oblique cylinders (there is no abnormality in the operation: the operation time remains the same, no error is reported, but the overall calculation results are all 0), nor can it handle horizontal cones. It will disappear automatically without data. Run in vain.
3 When the F4 counting card selects mesh
Personal test: If you choose the CYL coordinate system, no matter how the R and Z of the initial coordinate origin of the mesh are set, the result will start from 0.
4 Continuous operation
Under normal circumstances, MCNP5 can only be paused once. For the first time, you can press ctrl+c to pause and then select q to stop, and then the out or mesh file you want will be generated. The next time you want to continue running mcnp5 c r=.r o=.o mesh=.m
, you only need the inp file. But this kind of operation can only be done once. If ctrl+c selects q during the second consecutive operation, an error will be reported when the mcnp5 c is running again, and the pointer cannot be located.
And MCNP can also continue to run in another way. After setting the number of particles for the first time, you can write a con.i file with the content:
continue
nps 1E9
Then mcnp5 c i=con.i r=.r o=.o mesh=.m
set the file name by running, r, o and m.
1E9 in the file is the total number of particles you want to run.
I don't know if this kind of continuous operation can only be done once, I haven't tried it. There is currently no split requirement.
This kind of connection can be done countless times, so when processing files in large batches, you can choose this method, and when there is an accident, the loss is small.
Other pits will be added when they are encountered...