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

BUG Sensitivity order error with realist card #487

Open
GrimFe opened this issue Jun 27, 2023 · 6 comments
Open

BUG Sensitivity order error with realist card #487

GrimFe opened this issue Jun 27, 2023 · 6 comments
Labels

Comments

@GrimFe
Copy link

GrimFe commented Jun 27, 2023

Summary of issue

I run sensitivity calculations on the Jezebel model willing to perturb the fission and capture cross section of U235.
I run four calculations, perturbing the reactions, two using the mtlist card (sens pert xs mtlist 18 102 and sens pert xs mtlist 102 18) and two using the realist card (sens pert xs realist capt fiss and sens pert xs realist fiss capt). The four cases will be respectively named 'A', 'B', 'C' and 'D' in the following.
The sensitivity profiles processed with serpentTools are positive for fission and negative for capture in cases A, B, C and viceversa in case D.

Code for reproducing the issue

sts.read("mt_18_102.i_sens0.m").plot("keff")
sts.read("mt_102_18.i_sens0.m").plot("keff")
sts.read("rea_f_c.i_sens0.m").plot("keff")
sts.read("rea_c_f.i_sens0.m").plot("keff")

Actual outcome including console output and error traceback if applicable

A:
image
B:
image
C:
image
D:
image

Expected outcome

The four plots should be the same.

Versions

Please provide the following:

  • Version from serpentTools.__version__: '0.9.4'
  • Python version - python --version: 3.10.8
  • IPython or Jupyter version if applicable: 7.31.1

Additional comments

  1. From a first analysis the error seems to be possibly related to the parsing of section '% Indices for different perturbations:', since it differs in the output files:
    • A: iSENS_PERT_TOT_XS = 1; iSENS_PERT_MT_18_XS = 2; iSENS_PERT_MT_19_XS = 3; iSENS_PERT_MT_20_XS = 4; iSENS_PERT_MT_21_XS = 5; iSENS_PERT_MT_102_XS = 6;
    • B: iSENS_PERT_TOT_XS = 1; iSENS_PERT_MT_18_XS = 2; iSENS_PERT_MT_19_XS = 3; iSENS_PERT_MT_20_XS = 4; iSENS_PERT_MT_21_XS = 5; iSENS_PERT_MT_102_XS = 6;
    • C: iSENS_PERT_TOT_XS = 1; iSENS_PERT_CAPT_XS = 2; iSENS_PERT_FISS_XS = 3;
    • D: iSENS_PERT_TOT_XS = 1; iSENS_PERT_CAPT_XS = 3; iSENS_PERT_FISS_XS = 2;
  2. A difference in the order of the Energy integrated sensitivities was also noticed:
    image
@GrimFe GrimFe added the bug label Jun 27, 2023
@drewejohnson
Copy link
Collaborator

@GrimFe thanks for bringing this up. Seems quite strange indeed.

Looking at your comment

C: iSENS_PERT_TOT_XS = 1; iSENS_PERT_CAPT_XS = 2; iSENS_PERT_FISS_XS = 3;
D: iSENS_PERT_TOT_XS = 1; iSENS_PERT_CAPT_XS = 3; iSENS_PERT_FISS_XS = 2;

I think this could be source of the problem. I would need to check, but we may assume the numbers always increase and take the index position just based on the position of the variable name in that line

@drewejohnson
Copy link
Collaborator

@GrimFe can you provide the Serpent version you're using to generate these files? The sensitivity file in our test suite has the xs perturbation indices on different lines

% Indices for different perturbations:

iSENS_PERT_TOT_XS       = 1;
iSENS_PERT_ELA_XS       = 2;
iSENS_PERT_SAB_XS       = 3;
iSENS_PERT_INL_XS       = 4;
iSENS_PERT_CAPT_XS      = 5;
iSENS_PERT_FISS_XS      = 6;
iSENS_PERT_NXN_XS       = 7;

and the other weird thing is we don't to any direction actions on these index parameters either. Instead, we use the SENS_PERT_LIST array

SENS_PERT_LIST = [
'total xs                      '
'ela scatt xs                  '
'sab scatt xs                  '
'inl scatt xs                  '
'capture xs                    '
'fission xs                    '
'nxn xs                        '
];

Is there anything strange in that array in your outputs?

@GrimFe
Copy link
Author

GrimFe commented Aug 28, 2023

Hi @drewejohnson,

I am using Serpent 2.2.0

Here is what I have copy-pasted from my output _sens0.m files:

  • sens pert xs mtlist 18 102

    SENS_PERT_LIST = [
    'total xs                      '
    'mt 18 xs                      '
    'mt 19 xs                      '
    'mt 20 xs                      '
    'mt 21 xs                      '
    'mt 102 xs                     '
    ];
    
    % Indices for different perturbations:
    
    iSENS_PERT_TOT_XS       = 1;
    iSENS_PERT_MT_18_XS     = 2;
    iSENS_PERT_MT_19_XS     = 3;
    iSENS_PERT_MT_20_XS     = 4;
    iSENS_PERT_MT_21_XS     = 5;
    iSENS_PERT_MT_102_XS    = 6;
    
  • sens pert xs mtlist 102 18

    SENS_PERT_LIST = [
    'total xs                      '
    'mt 18 xs                      '
    'mt 19 xs                      '
    'mt 20 xs                      '
    'mt 21 xs                      '
    'mt 102 xs                     '
    ];
    
    % Indices for different perturbations:
    
    iSENS_PERT_TOT_XS       = 1;
    iSENS_PERT_MT_18_XS     = 2;
    iSENS_PERT_MT_19_XS     = 3;
    iSENS_PERT_MT_20_XS     = 4;
    iSENS_PERT_MT_21_XS     = 5;
    iSENS_PERT_MT_102_XS    = 6;
    
  • sens pert xs realist capt fiss

    SENS_PERT_LIST = [
    'total xs                      '
    'capture xs                    '
    'fission xs                    '
    ];
    
    % Indices for different perturbations:
    
    iSENS_PERT_TOT_XS       = 1;
    iSENS_PERT_CAPT_XS      = 2;
    iSENS_PERT_FISS_XS      = 3;
    
  • sens pert xs realist fiss capt inl ela

    SENS_PERT_LIST = [
    'total xs                      '
    'ela scatt xs                  '
    'inl scatt xs                  '
    'capture xs                    '
    'fission xs                    '
    ];
    
    % Indices for different perturbations:
    
    iSENS_PERT_TOT_XS       = 1;
    iSENS_PERT_ELA_XS       = 5;
    iSENS_PERT_INL_XS       = 4;
    iSENS_PERT_CAPT_XS      = 3;
    iSENS_PERT_FISS_XS      = 2;
    
  • sens pert xs realist fiss capt

    SENS_PERT_LIST = [
    'total xs                      '
    'capture xs                    '
    'fission xs                    '
    ];
    
    % Indices for different perturbations:
    
    iSENS_PERT_TOT_XS       = 1;
    iSENS_PERT_CAPT_XS      = 3;
    iSENS_PERT_FISS_XS      = 2;
    

Apparently, no matter what I set (realist capt fiss or realist fiss capt), SENS_PERT_LIST is unchanged, while iSENS_PERT_* changes. This looks a little unexpected to me.

I hope this helps to find where the issue is and maybe clarifies my previous message.

@drewejohnson
Copy link
Collaborator

Thanks @GrimFe

SENS_PERT_LIST = [
'total xs                      '
'ela scatt xs                  '
'inl scatt xs                  '
'capture xs                    '
'fission xs                    '
];

% Indices for different perturbations:

iSENS_PERT_TOT_XS       = 1;
iSENS_PERT_ELA_XS       = 5;
iSENS_PERT_INL_XS       = 4;
iSENS_PERT_CAPT_XS      = 3;
iSENS_PERT_FISS_XS      = 2;

and

SENS_PERT_LIST = [
'total xs                      '
'capture xs                    '
'fission xs                    '
];

% Indices for different perturbations:

iSENS_PERT_TOT_XS       = 1;
iSENS_PERT_CAPT_XS      = 3;
iSENS_PERT_FISS_XS      = 2;

Feel like Serpent bugs. But the other sens pert realist examples you posted still seem to have consistent ordering in the SENS_PRT_LIST and the iSENS_PERT_* variables.

Apparently, no matter what I set (realist capt fiss or realist fiss capt), SENS_PERT_LIST is unchanged, while iSENS_PERT_* changes. This looks a little unexpected to me.

I agree. Are you able to post this to the Serpent forum?

@GrimFe
Copy link
Author

GrimFe commented Oct 4, 2023

@pinky21
Copy link

pinky21 commented Feb 9, 2024

I have the same problem:

The results are obtained with

  • Serpent-Version: 2.2.0
  • Version from serpentTools.__version__: '0.10.1'
  • Python version: python --version: Python 3.9.12

relevant Serpent input:

sens pert zailist 922350 922380 10010
sens pert nubar
sens pert chi
sens pert xs realist fiss ela sab inl capt nxn
sens pert eleg 3

relevant Serpent output (*_sens0.m file):

% Reactions included in sensitivity calculation:

SENS_PERT_LIST = [
'total xs                      '
'ela scatt xs                  '
'sab scatt xs                  '
'inl scatt xs                  '
'capture xs                    '
'fission xs                    '
'nxn xs                        '
'nubar total                   '
'nubar prompt                  '
'nubar delayed                 '
'chi total                     '
'chi prompt                    '
'chi delayed                   '
'ela leg mom 1                 '
'ela leg mom 2                 '
'ela leg mom 3                 '
];

% Indices for different perturbations:

iSENS_PERT_TOT_XS       = 1;
iSENS_PERT_ELA_XS       = 3;
iSENS_PERT_SAB_XS       = 4;
iSENS_PERT_INL_XS       = 5;
iSENS_PERT_CAPT_XS      = 6;
iSENS_PERT_FISS_XS      = 2;
iSENS_PERT_NXN_XS       = 7;
iSENS_PERT_NUBAR_TOT    = 8;
iSENS_PERT_NUBAR_PROMPT = 9;
iSENS_PERT_NUBAR_DEL    = 10;
iSENS_PERT_CHI_TOT      = 11;
iSENS_PERT_CHI_PROMPT   = 12;
iSENS_PERT_CHI_DEL      = 13;
iSENS_PERT_ELA_P1       = 14;
iSENS_PERT_ELA_P2       = 15;
iSENS_PERT_ELA_P3       = 16;

As evident the ordering of the reactions given in SENS_PERT_LIST does not correspond to the indices given in iSENS_PERT_*

It appears that the Parser of serpentTools is inferring the index from the SENS_PERT_LIST by assuming the index always increases, as you mentioned above and is not taking the indices from the iSENS_PERT_* values. If the iSENS_PERT_* values would be taken instead, the parsed values would be fine (at least for the example, I am calculating above).

Thank you :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants