Skip to content
New issue

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

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

Already on GitHub? # to your account

[BUG] - renumbering universes not working properly #103

Open
AlbertoBittes opened this issue Oct 23, 2024 · 12 comments
Open

[BUG] - renumbering universes not working properly #103

AlbertoBittes opened this issue Oct 23, 2024 · 12 comments
Labels
bug Something isn't working

Comments

@AlbertoBittes
Copy link
Collaborator

Describe the bug
the renumber() method of Input class is not renumbering universes correctly. in particular, one cell is left non-renumbered after the usage of the method.

To Reproduce
Steps to reproduce the behavior:

  1. use function renumber(universe=1)
  2. write the renumbered input
  3. See error

Expected behavior
All cells U= flag is renumbered correctly

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows
  • F4Enix version: last
  • Python version 3.9.19
@AlbertoBittes AlbertoBittes added the bug Something isn't working label Oct 23, 2024
@dodu94
Copy link
Member

dodu94 commented Oct 23, 2024

weird for it to be a random cell... have you done any other manipulation of the input before trying to renumber? (maybe acting on that specific cell?) because in that case we may have a numjuggler problem where when you are modifying something in a cell the attribute is not reflected correctly everywhere

@AlbertoBittes
Copy link
Collaborator Author

AlbertoBittes commented Oct 23, 2024

The problem is indeed related to numjuggler and how it writes a card. Here an example on how to reproduce the error:

from numjuggler.parser import Card
definition = ['600177 400 -1.00000e+00 $ WATER_LEFT\n', '          600003 -600421 601230 -600013 600011\n', '           Vol=1.335972e+01\n', '           imp:n=1.0   imp:p=1.0   U=5972  \n']
cell2 = Card(definition, ctype=3, pos=1)
cell2.get_values()
cell2._set_value_by_type("u", 30)
print(cell2.card())

@akolsek
Copy link
Contributor

akolsek commented Nov 27, 2024

Definitively an important bug that needs to be solved :)

@dodu94
Copy link
Member

dodu94 commented Nov 27, 2024

The thing is that we still do not have a minimum example of this that can reproduce the error

@AlbertoBittes
Copy link
Collaborator Author

@dodu94 actually I posted an example

@dodu94
Copy link
Member

dodu94 commented Nov 27, 2024

There is a difference betweeen a screenshot of a much more complex model where the thing did not work and finding a minimum working example attached to this issue that can be parsed and used for debugging :D

@AlbertoBittes
Copy link
Collaborator Author

But look at the comments of the issue, I posted a python code

@dodu94
Copy link
Member

dodu94 commented Nov 27, 2024

But look at the comments of the issue, I posted a python code

mu bad, I did not realize that without the output and I forgot that we discussed this in the past

@dodu94
Copy link
Member

dodu94 commented Nov 28, 2024

Additional details: it seems that there is something specific with the number 5972

from numjuggler.parser import Card
definition = [
    '600177 400 -1.00000e+00 $ WATER_LEFT\n',
    '          600003 -600421 601230 -600013 600011\n',
    '           Vol=1.335972e+01\n',
    '           imp:n=1.0   imp:p=1.0   U=5972  \n']

cell2 = Card(definition, ctype=3, pos=1)
cell2.get_values()
print(cell2.card())
cell2._set_value_by_type("u", 30)
print(cell2.card())

print(cell2.input[-1])
600177 400 -1.00000e+00 $ WATER_LEFT
          600003 -600421 601230 -600013 600011
           Vol=1.335972e+01
           imp:n=1.0   imp:p=1.0   U=5972  

600177 400 -1.00000e+00 $ WATER_LEFT
          600003 -600421 601230 -600013 600011
           Vol=1.3330  e+01
           imp:n=1.0   imp:p=1.0   U=5972  

           imp:n=~   imp:p=~   U=5972

Using another number the universe field is correctly recognized

from numjuggler.parser import Card
definition = [
    '600177 400 -1.00000e+00 $ WATER_LEFT\n',
    '          600003 -600421 601230 -600013 600011\n',
    '           Vol=1.335972e+01\n',
    '           imp:n=1.0   imp:p=1.0   U=5973  \n']

cell2 = Card(definition, ctype=3, pos=1)
cell2.get_values()
print(cell2.card())
cell2._set_value_by_type("u", 30)
print(cell2.card())

print(cell2.input[-1])
600177 400 -1.00000e+00 $ WATER_LEFT
          600003 -600421 601230 -600013 600011
           Vol=1.335972e+01
           imp:n=1.0   imp:p=1.0   U=5973  

600177 400 -1.00000e+00 $ WATER_LEFT
          600003 -600421 601230 -600013 600011
           Vol=1.335972e+01
           imp:n=1.0   imp:p=1.0   U=30    

           imp:n=~   imp:p=~   U={:<4}

@dodu94
Copy link
Member

dodu94 commented Nov 28, 2024

here you have the problematic numbers in the range from 0 to 10000

for num in range(10000):
    definition = [
        '600177 400 -1.00000e+00 $ WATER_LEFT\n',
        '          600003 -600421 601230 -600013 600011\n',
        '           Vol=1.335972e+01\n',
        f'           imp:n=1.0   imp:p=1.0   U={num}  \n']

    cell2 = Card(definition, ctype=3, pos=1)
    cell2.get_values()
    cell2._set_value_by_type("u", 30)
    if not 'U=30' in cell2.card():
        print(num)
0
1
2
3
5
7
9
33
35
59
72
97
335
359
597
972
3359
3597
5972

@Radiation-Transport
Copy link
Member

Why are these problematic numbers? Have been already preallocated someway?

@dodu94
Copy link
Member

dodu94 commented Nov 28, 2024

Do not now yet

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants