njoy / NJOY2016

Nuclear data processing with legacy NJOY
https://www.njoy21.io/NJOY2016
Other
95 stars 83 forks source link

ACER doesn't find temperature when value is very high #222

Open paulromano opened 2 years ago

paulromano commented 2 years ago

Broadening H2 from ENDF/B-VIII.0 to T=10,000,001 K results in strange error in ACER. Namely, with the following input:

reconr /
20 21
'ENDF/B-8.0 PENDF for   1-H -  2 '/
128 2/
0.001/ err
'ENDF/B-8.0:   1-H -  2 '/
'Processed by NJOY'/
0/

broadr /
20 21 22
128 1 0 0 0. /
0.001/ errthn
10000001.0
0/

acer /
20 22 0 23 24
1 0 1 .01 /
'ENDF/B-8.0:   1-H -  2  at 10000001.0'/
128 10000001.0
1 1/
/
stop

Running this with NJOY, I get:


 njoy 2016.65  xxAug21                                       10/27/21 22:10:55
 *****************************************************************************

 reconr...                                                                0.0s

 broadr...                                                                0.0s

 acer...                                                                  0.2s

 ***error in first***desired temperature not found.

STOP 77

I'm not sure what exactly it is that makes NJOY break. Other large temperatures (e.g., T=10,000,010 K) seem to work.

whaeck commented 2 years ago

This is due to the ENDF precision while using ASCII ENDF files to exchange information between NJOY modules. Since we only have 6 digits after the decimal point, 10000001 get printed as 1.000000+7, leading to a difference of 1 K which fails the test in the first subroutine.

Switching to binary mode resolve this without any code changes, but I'm inclined to add a relative tolerance check on the temperature as well.

whaeck commented 2 years ago

10000010 actually works because you can write this as 1.000001+7 in an ASCII ENDF file. Gotta love fixed precision.

paulromano commented 2 years ago

@whaeck Is there anywhere one can find an up-to-date description of the ACE binary format? I do see that going to binary fixes this, but if you write an ASCII ACE file the precision is lost at the last step.

whaeck commented 2 years ago

As far as I know, the binary ACE format is actually compiler dependent (and you need the same one for MCNP for it to read the file) - at least it was like that over 15 years ago. I could not get binary ACE files coming out of NJOY get accepted by different versions of MCNP(X).

We're actually looking into a new binary format for the data going into MCNP but that is still for out in the future.

paulromano commented 2 years ago

Ok, that seems like a wise idea. Thanks for the clarification @whaeck!