Skip to content

Commit f7d58fb

Browse files
author
Grego01
committed
NJOY ERRORR module not working with energy grid that start at 0 ev and adding tests to check the safeguards for self-covariance matrices
1 parent e2c28eb commit f7d58fb

2 files changed

Lines changed: 390 additions & 91 deletions

File tree

openmc/data/mf33_njoy.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,17 @@ def _validate_energy_grid_ev(ek: Sequence[float]) -> List[float]:
5151
ek = [float(x) for x in ek]
5252
if len(ek) < 2:
5353
raise ValueError("Energy grid must have at least 2 boundaries (G+1).")
54-
54+
if ek[0] <= 0.0:
55+
raise ValueError(
56+
f"Energy grid lower boundary must be positive (got {ek[0]:g} eV). "
57+
f"ERRORR cannot integrate from zero energy. Use a small positive "
58+
f"value like 1e-5 eV instead."
59+
)
5560
for i in range(1, len(ek)):
5661
if not (ek[i] > ek[i-1]):
5762
raise ValueError("Energy grid boundaries must be strictly increasing (in eV).")
58-
5963
return ek
6064

61-
6265
# ------------------------- NJOY deck builder -------------------------
6366

6467
def _moder_input(nin: int, nout: int) -> str:

0 commit comments

Comments
 (0)