Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index error occurs within the get_XS during continuous energy calculations #278

Open
melekderman opened this issue Jan 23, 2025 · 0 comments
Assignees

Comments

@melekderman
Copy link
Member

melekderman commented Jan 23, 2025

Description:

An index error emerges during continuous energy calculations after the inactive cycles, for example, in the continuous-energy version of the C5G7-TD model (C5CE), static phase 1:

**(mcdc_env) flip1 ~/projects/problems/challenge_problems/07-C5CE-4_phase/static-phase1 1006$ python -m cProfile -o output_1e2.prof input.py --mode=python

  __  __  ____  __ ____   ____
 |  \/  |/ ___|/ /_  _ \ / ___|
 | |\/| | |   /_  / | | | |
 | |  | | |___ / /| |_| | |___
 |_|  |_|\____|// |____/ \____|

           Mode | Python
      Algorithm | History-based
  MPI Processes | 1
 OpenMP Threads | 1
 Now running TNT...

 #     k        GyRad.  k (avg)
 ====  =======  ======  ===================
 1     1.34906   12.27
 2     0.95941   16.70
 3     0.92802   20.42
 4     1.10895   22.34
 5     0.62517   27.32
 6     1.09287   28.71
 7     0.70137   34.20
 8     0.98292   32.01
 9     0.88183   34.07
 10    0.96569   32.04
nuclide["ce_nu_d"][j]: [0. 0. 0. 0. 0.]
E: 2388634.141459218
nuclide["E_nu_d"]: [0. 0. 0. 0. 0.]
nuclide["NE_nu_d"]: 0
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/nfs/stak/users/dermanm/miniconda3/envs/mcdc_env/lib/python3.11/cProfile.py", line 191, in <module>
    main()
  File "/nfs/stak/users/dermanm/miniconda3/envs/mcdc_env/lib/python3.11/cProfile.py", line 180, in main
    runctx(code, globs, None, options.outfile, options.sort)
  File "/nfs/stak/users/dermanm/miniconda3/envs/mcdc_env/lib/python3.11/cProfile.py", line 20, in runctx
    return _pyprofile._Utils(Profile).runctx(statement, globals, locals,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nfs/stak/users/dermanm/miniconda3/envs/mcdc_env/lib/python3.11/profile.py", line 63, in runctx
    prof.runctx(statement, globals, locals)
  File "/nfs/stak/users/dermanm/miniconda3/envs/mcdc_env/lib/python3.11/cProfile.py", line 101, in runctx
    exec(cmd, globals, locals)
  File "input.py", line 378, in <module>
    mcdc.run()
  File "/nfs/stak/users/dermanm/projects/libraries/MCDC/mcdc/main.py", line 84, in run
    loop_eigenvalue(data_arr, mcdc_arr)
  File "/nfs/stak/users/dermanm/projects/libraries/MCDC/mcdc/loop.py", line 154, in loop_eigenvalue
    loop_source(seed_source, data, mcdc)
  File "/nfs/stak/users/dermanm/projects/libraries/MCDC/mcdc/loop.py", line 360, in loop_source
    exhaust_active_bank(data, mcdc)
  File "/nfs/stak/users/dermanm/projects/libraries/MCDC/mcdc/loop.py", line 257, in exhaust_active_bank
    loop_particle(P_arr, data, mcdc)
  File "/nfs/stak/users/dermanm/projects/libraries/MCDC/mcdc/loop.py", line 497, in loop_particle
    step_particle(P_arr, data, prog)
  File "/nfs/stak/users/dermanm/projects/libraries/MCDC/mcdc/loop.py", line 506, in step_particle
    kernel.move_to_event(P_arr, data, mcdc)
  File "/nfs/stak/users/dermanm/projects/libraries/MCDC/mcdc/kernel.py", line 2413, in move_to_event
    eigenvalue_tally(P_arr, distance, mcdc)
  File "/nfs/stak/users/dermanm/projects/libraries/MCDC/mcdc/kernel.py", line 2132, in eigenvalue_tally
    nu_d = get_nu_group(NU_FISSION_DELAYED, nuclide, E, j)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nfs/stak/users/dermanm/projects/libraries/MCDC/mcdc/kernel.py", line 3338, in get_nu_group
    return get_XS(
           ^^^^^^^
  File "/nfs/stak/users/dermanm/projects/libraries/MCDC/mcdc/kernel.py", line 3304, in get_XS
    E2 = E_grid[idx + 1]
         ~~~~~~^^^^^^^^^
IndexError: index 5 is out of bounds for axis 0 with size 5**

Observations:

  • When checking the values of the arguments passed to the get_XS function at this energy, I observed that the values (data, E_grid, and NE) other than E, are zero.

07-C5CE-4_phase/static-phase1:

nuclide["ce_nu_d"][j]: [0. 0. 0. 0. 0.]
E: 2388634.141459218
nuclide["E_nu_d"]: [0. 0. 0. 0. 0.]
nuclide["NE_nu_d"]: 0

07-C5CE-4_phase/static-phase2:

nuclide["ce_nu_d"][j]: [0. 0. 0. 0. 0.]
E: 359140.4050425384
nuclide["E_nu_d"]: [0. 0. 0. 0. 0.]
nuclide["NE_nu_d"]: 0

07-C5CE-4_phase/static-phase3:

nuclide["ce_nu_d"][j]: [0. 0. 0. 0. 0.]
E: 359140.4050425384
nuclide["E_nu_d"]: [0. 0. 0. 0. 0.]
nuclide["NE_nu_d"]: 0

07-C5CE-4_phase/static-phase4:

nuclide["ce_nu_d"][j]: [0. 0. 0. 0. 0.]
E: 1803386.4079506723
nuclide["E_nu_d"]: [0. 0. 0. 0. 0.]
nuclide["NE_nu_d"]: 0
  • For other energies calculated up to this point, I verified that these argument values were not 0, for example:
nuclide["ce_nu_d"][group]: [0.00105286 0.00110932 0.00110932 0.00059784 0.00059784]
E: 0.10319329728921613
nuclide["E_nu_d"]: [1.e-05 5.e+04 4.e+06 7.e+06 3.e+07]
nuclide["NE_nu_d"]: 5
nuclide["ce_nu_d"][group]: [0.00055487 0.00058463 0.00058463 0.00031507 0.00031507]
E: 39.419109137797946
nuclide["E_nu_d"]: [1.e-05 5.e+04 4.e+06 7.e+06 3.e+07]
nuclide["NE_nu_d"]: 5

Identified issues to be resolved:

1) Why are the data, E_grid, and NE values 0 for these specific energy values?
2) When the NE=0 for some reason, the binary_search_with_length function in algorithm.py reduces the index value by 1 and it causes an index error. (The if length == 0: right = len(grid) - 1 statement in binary_search_with_length function within algorithym.py might require review.)

@ilhamv ilhamv self-assigned this Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants