I have been attempting to model a situation involving Doppler broadening at extremely high temperatures, much higher than the temperatures included in the premade libraries. As a result, I installed njoy2016 using the instructions on the njoy21 website, and got it to run. Then, I placed it in a folder that allows it to be used as a command, and tried to get new temperatures for Deuterium as a test:
D = openmc.data.IncidentNeutron.from_njoy('D.endf', temperatures=[300., 600., 1000.])
However, I get the following error: Command 'njoy' returned non-zero exit status 77.
Hi @number1son100 and welcome to the forum! I would suggest passing the argument stdout=True which will show you the NJOY output when it is running. That should hopefully give you a better clue of what might be going wrong when running NJOY.
D = openmc.data.IncidentNeutron.from_njoy(
'D.endf',
temperatures=[300., 600., 1000.],
stdout=True
)
Thank you @paulromano! I did this, and got the following result:
njoy 2016.64 24May21 10/21/21 18:24:05
*****************************************************************************
reconr... 0.0s
broadr... 0.0s
---message from broadr---no broadenable reactions
heatr... 0.0s
---message from hinit---mf6, mt 50 does not give recoil za= 1
one-particle recoil approx. used.
***error in findf*** mat 128 mf 3 mt 1 not on tape 22
STOP 77
Traceback (most recent call last):
File "/home/number1son100/Desktop/TF_Link_Verification/add_temperatures.py", line 7, in <module>
neutron_methods.expand_temperatures()
File "/home/number1son100/Desktop/TF_Link_Verification/neutron_methods.py", line 7, in expand_temperatures
D = openmc.data.IncidentNeutron.from_njoy('D.endf', temperatures=[300., 600., 1000.], stdout=True)
File "/home/number1son100/anaconda3/envs/openmc-env/lib/python3.9/site-packages/openmc/data/neutron.py", line 817, in from_njoy
make_ace(filename, temperatures, **kwargs)
File "/home/number1son100/anaconda3/envs/openmc-env/lib/python3.9/site-packages/openmc/data/njoy.py", line 416, in make_ace
run(commands, tapein, tapeout, **kwargs)
File "/home/number1son100/anaconda3/envs/openmc-env/lib/python3.9/site-packages/openmc/data/njoy.py", line 235, in run
raise CalledProcessError(njoy.returncode, njoy_exec,
subprocess.CalledProcessError: Command 'njoy' returned non-zero exit status 77.
If anyone knows what this “tape” is and how to get the right one for a deuterium atom, that would be great! Thanks!
I got the ENDF file by using the ENDF database to search for all reactions related to H-2, and then check-marked all of them. I got them as a text file, and then changed the file ending to .endf. Should I be doing this another way? The file is in the same folder as the python script that is calling njoy from openmc.
I went and I found that when I downloaded an endf file directly instead of copying and pasting into a text document, I was able to get past that error. However, another is now appearing:
At line 1002 of file /home/number1son100/NJOY2016/src/endf.f90 (unit = 20, file = 'tape20')
Fortran runtime error: Bad value during integer read
This was with NJOY2016. I replaced the script with NJOY21, and got this error instead:
processing mat 128 in endf-6 format
------------------------------------------------------------------
1-H - 2 LANL EVAL-FEB97 P.G.Young,G.M.Hale,M.B.Chadwick
mat has no resonance parameters
At line 1002 of file /home/number1son100/NJOY21/bin/_deps/njoy-src/src/endf.f90 (unit = 20, file = 'tape20')
Fortran runtime error: Bad value during integer read
Traceback (most recent call last):
File "/home/number1son100/Desktop/TF_Link_Verification/add_temperatures.py", line 7, in <module>
neutron_methods.expand_temperatures()
File "/home/number1son100/Desktop/TF_Link_Verification/neutron_methods.py", line 7, in expand_temperatures
D = openmc.data.IncidentNeutron.from_njoy('E4R2024_e4.txt', temperatures=[300., 600., 1000.], stdout=True)
File "/home/number1son100/anaconda3/envs/openmc-env/lib/python3.9/site-packages/openmc/data/neutron.py", line 817, in from_njoy
make_ace(filename, temperatures, **kwargs)
File "/home/number1son100/anaconda3/envs/openmc-env/lib/python3.9/site-packages/openmc/data/njoy.py", line 416, in make_ace
run(commands, tapein, tapeout, **kwargs)
File "/home/number1son100/anaconda3/envs/openmc-env/lib/python3.9/site-packages/openmc/data/njoy.py", line 235, in run
raise CalledProcessError(njoy.returncode, njoy_exec,
subprocess.CalledProcessError: Command 'njoy' returned non-zero exit status 2.
You definitely should not download snippets of an ENDF file and try to piece them together. That is a sure recipe to get yourself in trouble. You should get a full ENDF evaluation from the library that you are interested in. For example, if you want the H-2 evaluation from ENDF/B-VIII.0, go to the NNDC website and download the neutron reaction sublibrary. You should have better luck processing the file after that.
Note that we have pre-generated HDF5 libraries with temperatures up to 2500 K available at https://openmc.org.
Perfect! Almost there now. I appreciate your help. I am new to this whole field, so this was very informative. Following your advice, I have now gotten NJOY to work at temperatures under 10^6 K. However, I am working with deuterium at fusion-relevant temperatures of around 1.2*10^8 K (10 keV). When attempting to get cross-sections at this high temperature, I am now getting another error:
acer...monte carlo neutron and photon data 0.4s
acer... 0.4s
input endf unit ...................... 20
input pendf unit ..................... 26
input gendf unit ..................... 0
output ace format unit ............... 27
output directory unit ................ 28
run type option ...................... 1
print option (0 min, 1 max) .......... 0
type of ace file ..................... 1
mat to be processed .................. 128
temperature .......................... 1.160E+08
new formats .......................... 1
photon option ........................ 1
smoothing option ..................... 1
using endf-6 format
***error in first***desired temperature not found.
STOP 77
Traceback (most recent call last):
File "/home/number1son100/Desktop/TF_Link_Verification/add_temperatures.py", line 7, in <module>
neutron_methods.expand_temperatures()
File "/home/number1son100/Desktop/TF_Link_Verification/neutron_methods.py", line 8, in expand_temperatures
D = openmc.data.IncidentNeutron.from_njoy('ENDF-B-VIII.0/neutrons/n-001_H_002.endf', temperatures=[temperature], stdout=True)
File "/home/number1son100/anaconda3/envs/openmc-env/lib/python3.9/site-packages/openmc/data/neutron.py", line 817, in from_njoy
make_ace(filename, temperatures, **kwargs)
File "/home/number1son100/anaconda3/envs/openmc-env/lib/python3.9/site-packages/openmc/data/njoy.py", line 416, in make_ace
run(commands, tapein, tapeout, **kwargs)
File "/home/number1son100/anaconda3/envs/openmc-env/lib/python3.9/site-packages/openmc/data/njoy.py", line 235, in run
raise CalledProcessError(njoy.returncode, njoy_exec,
subprocess.CalledProcessError: Command 'njoy' returned non-zero exit status 77.
The code I am using is included below:
temperature = 10*1000/(8.617333262*10**(-5))
D = openmc.data.IncidentNeutron.from_njoy('ENDF-B-VIII.0/neutrons/n-001_H_002.endf', temperatures=[temperature], stdout=True)
This appears to be caused by a bug in NJOY. As a quick workaround, you can try rounding your temperature to have fewer significant digits. The following works for me:
temperature = 10*1000/(8.617333262*10**(-5))
D = openmc.data.IncidentNeutron.from_njoy(..., temperatures=[round(temperature, -2)], stdout=True)
Thank you! I implemented this solution, and tried rounding to a couple of different digits. I am getting a slightly different error, but it is still showing up each time:
Traceback (most recent call last):
File "/home/number1son100/Desktop/TF_Link_Verification/add_temperatures.py", line 7, in <module>
neutron_methods.expand_temperatures()
File "/home/number1son100/Desktop/TF_Link_Verification/neutron_methods.py", line 8, in expand_temperatures
D = openmc.data.IncidentNeutron.from_njoy('ENDF-B-VIII.0/neutrons/n-001_H_002.endf', temperatures=[round(temperature,-2)], stdout=True)
File "/home/number1son100/anaconda3/envs/openmc-env/lib/python3.9/site-packages/openmc/data/neutron.py", line 875, in from_njoy
kerma = data.reactions[301].xs[temp]
KeyError: '116045200K'
I was getting this same error before too. Any idea why?
Again, I think this is some kind of bug in NJOY related to the previous one. NJOY ends up rounding the temperature to 6 or 7 significant digits, so in the ACE file, the temperature is approximately 116045181 K which causes problems in OpenMC (because it expects to see the temperature that was input by the user). Not sure what to suggest – you may just need to hold off until the NJOY team can get the previous bug fixed.