Repository: CORE-GATECH-GROUP/serpent-tools (python)

Issue:
ENH Support Serpent 2.1.32
**Is your feature request related to a problem? Please describe.**
Warning messages like
```
WARN SERPENT Serpent 2.1.32 found in godiva_res.m, but version 2.1.31 is defined in settings
  Attemping to read anyway. Please report strange behaviors/failures to developers.
```
(also a typo) come through. But things seem to work fine. 

**Describe the solution you'd like**
Determine what new arguments exist in the result file that should be added to https://github.com/CORE-GATECH-GROUP/serpent-tools/blob/develop/serpentTools/variables.yaml even if we just do something like https://github.com/CORE-GATECH-GROUP/serpent-tools/blob/f61cd104bd997aa80429f1059bbc3669adc18654/serpentTools/variables.yaml#L133

I thought I saw there are also new entries added to the depletion file but none seem to show up

**Describe alternatives you've considered**
Carry on regardless.

Per https://github.com/CORE-GATECH-GROUP/serpent-tools/blob/f61cd104bd997aa80429f1059bbc3669adc18654/serpentTools/settings.py#L108-L116 should check if https://github.com/CORE-GATECH-GROUP/serpent-tools/blob/f61cd104bd997aa80429f1059bbc3669adc18654/serpentTools/parsers/results.py#L43-L55 needs updating or we can copy over


Pull request:
API Support Serpent 2.1.32; Default still 2.1.31
Can be toggled with
```python
serpentTools.settings.rc["serpentVersion"] = "2.1.32"
```
or in a context manager to unset after reading
```python
with serpentTools.settings.rc as temprc:
    temprc["serpentVersion"] = "2.1.32"
    r = serpentTools.read("InnerAssembly_res.m")
```

New variable groups for 2.1.32:
```yaml
  energy-deposition: !!set
    {EDEP_MODE, EDEP_DELAYED, EDEP_KEFF_CORR, EDEP_LOCAL_EGD, EDEP_COMP, EDEP_CAPT_E}
```
and the ``burnup-coeff`` group is modified to include `FIMA`

Changes also made to 2.1.31 group for cases where the variables in that
group did not match those in the base group

Variable group changes updated in documentation.

Closes #445 

Patch:
diff --git a/docs/variableGroups.rst b/docs/variableGroups.rst
index 8b2fd56..723a8a5 100644
--- a/docs/variableGroups.rst
+++ b/docs/variableGroups.rst
@@ -30,19 +30,227 @@ variable names converted to ``mixedCaseNames``. This conversion is done
 to fit the style of the project and reduce a few keystrokes for accessing
 variable names.
 
+.. _vars-2-1-32:
+
+----------
+``2-1-32``
+----------
+
+.. _burnup-coeff-2-1-32:
+
+
+``burnup-coeff``
+----------------
+
+
+  * ``BURNUP`` →  ``burnup``
+  * ``BURN_DAYS`` →  ``burnDays``
+  * ``BURN_MATERIALS`` →  ``burnMaterials``
+  * ``BURN_MODE`` →  ``burnMode``
+  * ``BURN_RANDOMIZE_DATA`` →  ``burnRandomizeData``
+  * ``BURN_STEP`` →  ``burnStep``
+  * ``COEF_BRANCH`` →  ``coefBranch``
+  * ``COEF_BU_STEP`` →  ``coefBuStep``
+  * ``COEF_IDX`` →  ``coefIdx``
+  * ``FIMA`` →  ``fima``
+
+.. _energy-deposition-2-1-32:
+
+
+``energy-deposition``
+---------------------
+
+
+  * ``EDEP_CAPT_E`` →  ``edepCaptE``
+  * ``EDEP_COMP`` →  ``edepComp``
+  * ``EDEP_DELAYED`` →  ``edepDelayed``
+  * ``EDEP_KEFF_CORR`` →  ``edepKeffCorr``
+  * ``EDEP_LOCAL_EGD`` →  ``edepLocalEgd``
+  * ``EDEP_MODE`` →  ``edepMode``
+
+.. _n-balance-2-1-32:
+
+
+``n-balance``
+-------------
+
+
+  * ``BALA_LOSS_NEUTRON_CAPT`` →  ``balaLossNeutronCapt``
+  * ``BALA_LOSS_NEUTRON_CUT`` →  ``balaLossNeutronCut``
+  * ``BALA_LOSS_NEUTRON_ERR`` →  ``balaLossNeutronErr``
+  * ``BALA_LOSS_NEUTRON_FISS`` →  ``balaLossNeutronFiss``
+  * ``BALA_LOSS_NEUTRON_LEAK`` →  ``balaLossNeutronLeak``
+  * ``BALA_LOSS_NEUTRON_TOT`` →  ``balaLossNeutronTot``
+  * ``BALA_NEUTRON_DIFF`` →  ``balaNeutronDiff``
+  * ``BALA_SRC_NEUTRON_FISS`` →  ``balaSrcNeutronFiss``
+  * ``BALA_SRC_NEUTRON_NXN`` →  ``balaSrcNeutronNxn``
+  * ``BALA_SRC_NEUTRON_SRC`` →  ``balaSrcNeutronSrc``
+  * ``BALA_SRC_NEUTRON_TOT`` →  ``balaSrcNeutronTot``
+  * ``BALA_SRC_NEUTRON_VR`` →  ``balaSrcNeutronVr``
+
+.. _optimization-2-1-32:
+
+
+``optimization``
+----------------
+
+
+  * ``DOUBLE_INDEXING`` →  ``doubleIndexing``
+  * ``MG_MAJORANT_MODE`` →  ``mgMajorantMode``
+  * ``OPTIMIZATION_MODE`` →  ``optimizationMode``
+  * ``RECONSTRUCT_MACROXS`` →  ``reconstructMacroxs``
+  * ``RECONSTRUCT_MICROXS`` →  ``reconstructMicroxs``
+  * ``SPECTRUM_COLLAPSE`` →  ``spectrumCollapse``
+
+.. _rad-data-2-1-32:
+
+
+``rad-data``
+------------
+
+
+  * ``ACTINIDE_ACTIVITY`` →  ``actinideActivity``
+  * ``ACTINIDE_DECAY_HEAT`` →  ``actinideDecayHeat``
+  * ``ACTINIDE_ING_TOX`` →  ``actinideIngTox``
+  * ``ACTINIDE_INH_TOX`` →  ``actinideInhTox``
+  * ``ALPHA_DECAY_SOURCE`` →  ``alphaDecaySource``
+  * ``CS134_ACTIVITY`` →  ``cs134Activity``
+  * ``ELECTRON_DECAY_SOURCE`` →  ``electronDecaySource``
+  * ``FISSION_PRODUCT_ACTIVITY`` →  ``fissionProductActivity``
+  * ``FISSION_PRODUCT_DECAY_HEAT`` →  ``fissionProductDecayHeat``
+  * ``FISSION_PRODUCT_ING_TOX`` →  ``fissionProductIngTox``
+  * ``FISSION_PRODUCT_INH_TOX`` →  ``fissionProductInhTox``
+  * ``INGENSTION_TOXICITY`` →  ``ingenstionToxicity``
+  * ``INHALATION_TOXICITY`` →  ``inhalationToxicity``
+  * ``NEUTRON_DECAY_SOURCE`` →  ``neutronDecaySource``
+  * ``PHOTON_DECAY_SOURCE`` →  ``photonDecaySource``
+  * ``SR90_ACTIVITY`` →  ``sr90Activity``
+  * ``TE132_ACTIVITY`` →  ``te132Activity``
+  * ``TOT_ACTIVITY`` →  ``totActivity``
+  * ``TOT_DECAY_HEAT`` →  ``totDecayHeat``
+  * ``TOT_SF_RATE`` →  ``totSfRate``
+
+.. _six-ff-2-1-32:
+
+
+``six-ff``
+----------
+
+
+  * ``SIX_FF_EPSILON`` →  ``sixFfEpsilon``
+  * ``SIX_FF_ETA`` →  ``sixFfEta``
+  * ``SIX_FF_F`` →  ``sixFfF``
+  * ``SIX_FF_KEFF`` →  ``sixFfKeff``
+  * ``SIX_FF_KINF`` →  ``sixFfKinf``
+  * ``SIX_FF_LF`` →  ``sixFfLf``
+  * ``SIX_FF_LT`` →  ``sixFfLt``
+  * ``SIX_FF_P`` →  ``sixFfP``
+
 .. _vars-2-1-31:
 
 ----------
-``2.1.31``
+``2-1-31``
 ----------
 
-Variable groups for Serpent 2.1.31 are identical to those from 
-Serpent 2.1.30
+.. _burnup-coeff-2-1-31:
+
+
+``burnup-coeff``
+----------------
+
+
+  * ``BURNUP`` →  ``burnup``
+  * ``BURN_DAYS`` →  ``burnDays``
+  * ``BURN_MATERIALS`` →  ``burnMaterials``
+  * ``BURN_MODE`` →  ``burnMode``
+  * ``BURN_RANDOMIZE_DATA`` →  ``burnRandomizeData``
+  * ``BURN_STEP`` →  ``burnStep``
+  * ``COEF_BRANCH`` →  ``coefBranch``
+  * ``COEF_BU_STEP`` →  ``coefBuStep``
+  * ``COEF_IDX`` →  ``coefIdx``
+
+.. _n-balance-2-1-31:
+
+
+``n-balance``
+-------------
+
+
+  * ``BALA_LOSS_NEUTRON_CAPT`` →  ``balaLossNeutronCapt``
+  * ``BALA_LOSS_NEUTRON_CUT`` →  ``balaLossNeutronCut``
+  * ``BALA_LOSS_NEUTRON_ERR`` →  ``balaLossNeutronErr``
+  * ``BALA_LOSS_NEUTRON_FISS`` →  ``balaLossNeutronFiss``
+  * ``BALA_LOSS_NEUTRON_LEAK`` →  ``balaLossNeutronLeak``
+  * ``BALA_LOSS_NEUTRON_TOT`` →  ``balaLossNeutronTot``
+  * ``BALA_NEUTRON_DIFF`` →  ``balaNeutronDiff``
+  * ``BALA_SRC_NEUTRON_FISS`` →  ``balaSrcNeutronFiss``
+  * ``BALA_SRC_NEUTRON_NXN`` →  ``balaSrcNeutronNxn``
+  * ``BALA_SRC_NEUTRON_SRC`` →  ``balaSrcNeutronSrc``
+  * ``BALA_SRC_NEUTRON_TOT`` →  ``balaSrcNeutronTot``
+  * ``BALA_SRC_NEUTRON_VR`` →  ``balaSrcNeutronVr``
+
+.. _optimization-2-1-31:
+
+
+``optimization``
+----------------
+
+
+  * ``DOUBLE_INDEXING`` →  ``doubleIndexing``
+  * ``MG_MAJORANT_MODE`` →  ``mgMajorantMode``
+  * ``OPTIMIZATION_MODE`` →  ``optimizationMode``
+  * ``RECONSTRUCT_MACROXS`` →  ``reconstructMacroxs``
+  * ``RECONSTRUCT_MICROXS`` →  ``reconstructMicroxs``
+  * ``SPECTRUM_COLLAPSE`` →  ``spectrumCollapse``
+
+.. _rad-data-2-1-31:
+
+
+``rad-data``
+------------
+
+
+  * ``ACTINIDE_ACTIVITY`` →  ``actinideActivity``
+  * ``ACTINIDE_DECAY_HEAT`` →  ``actinideDecayHeat``
+  * ``ACTINIDE_ING_TOX`` →  ``actinideIngTox``
+  * ``ACTINIDE_INH_TOX`` →  ``actinideInhTox``
+  * ``ALPHA_DECAY_SOURCE`` →  ``alphaDecaySource``
+  * ``CS134_ACTIVITY`` →  ``cs134Activity``
+  * ``ELECTRON_DECAY_SOURCE`` →  ``electronDecaySource``
+  * ``FISSION_PRODUCT_ACTIVITY`` →  ``fissionProductActivity``
+  * ``FISSION_PRODUCT_DECAY_HEAT`` →  ``fissionProductDecayHeat``
+  * ``FISSION_PRODUCT_ING_TOX`` →  ``fissionProductIngTox``
+  * ``FISSION_PRODUCT_INH_TOX`` →  ``fissionProductInhTox``
+  * ``INGENSTION_TOXICITY`` →  ``ingenstionToxicity``
+  * ``INHALATION_TOXICITY`` →  ``inhalationToxicity``
+  * ``NEUTRON_DECAY_SOURCE`` →  ``neutronDecaySource``
+  * ``PHOTON_DECAY_SOURCE`` →  ``photonDecaySource``
+  * ``SR90_ACTIVITY`` →  ``sr90Activity``
+  * ``TE132_ACTIVITY`` →  ``te132Activity``
+  * ``TOT_ACTIVITY`` →  ``totActivity``
+  * ``TOT_DECAY_HEAT`` →  ``totDecayHeat``
+  * ``TOT_SF_RATE`` →  ``totSfRate``
+
+.. _six-ff-2-1-31:
+
+
+``six-ff``
+----------
+
+
+  * ``SIX_FF_EPSILON`` →  ``sixFfEpsilon``
+  * ``SIX_FF_ETA`` →  ``sixFfEta``
+  * ``SIX_FF_F`` →  ``sixFfF``
+  * ``SIX_FF_KEFF`` →  ``sixFfKeff``
+  * ``SIX_FF_KINF`` →  ``sixFfKinf``
+  * ``SIX_FF_LF`` →  ``sixFfLf``
+  * ``SIX_FF_LT`` →  ``sixFfLt``
+  * ``SIX_FF_P`` →  ``sixFfP``
 
 .. _vars-2-1-30:
 
 ----------
-``2.1.30``
+``2-1-30``
 ----------
 
 .. _n-balance-2-1-30:
diff --git a/serpentTools/settings.py b/serpentTools/settings.py
index 5d0239e..28a90ae 100644
--- a/serpentTools/settings.py
+++ b/serpentTools/settings.py
@@ -106,7 +106,7 @@ defaultSettings = {
     },
     'serpentVersion': {
         'default': '2.1.31',
-        'options': ['2.1.29', '2.1.30', '2.1.31'],
+        'options': ['2.1.29', '2.1.30', '2.1.31', '2.1.32'],
         # When adding new version of Serpent, add / update
         # MapStrVersions with variables that indicate the start of specific
         # data blocks / time parameters like burnup
diff --git a/serpentTools/variables.yaml b/serpentTools/variables.yaml
index ea833a9..d92b913 100644
--- a/serpentTools/variables.yaml
+++ b/serpentTools/variables.yaml
@@ -110,24 +110,42 @@ base:
     {ALB_SURFACE, ALB_FLIP_DIR, ALB_N_SURF, ALB_IN_CURR, ALB_OUT_CURR, 
     ALB_TOT_ALB, ALB_PART_ALB}
 
-2-1-30: &2-1-30
-  n-balance: !!set 
+2-1-30:
+  n-balance: !!set &2-1-30-n-balance
     {BALA_SRC_NEUTRON_SRC, BALA_SRC_NEUTRON_FISS, BALA_SRC_NEUTRON_NXN,
      BALA_SRC_NEUTRON_VR, BALA_SRC_NEUTRON_TOT, BALA_LOSS_NEUTRON_CAPT,
      BALA_LOSS_NEUTRON_FISS, BALA_LOSS_NEUTRON_LEAK, BALA_LOSS_NEUTRON_CUT,
      BALA_LOSS_NEUTRON_TOT, BALA_NEUTRON_DIFF, BALA_LOSS_NEUTRON_ERR}
-  rad-data: !!set 
+  rad-data: !!set &2-1-30-rad-data
     {TOT_ACTIVITY, TOT_DECAY_HEAT, TOT_SF_RATE, ACTINIDE_ACTIVITY,
     INHALATION_TOXICITY, INGENSTION_TOXICITY, ACTINIDE_INH_TOX,
     ACTINIDE_ING_TOX, FISSION_PRODUCT_INH_TOX, FISSION_PRODUCT_ING_TOX,
     ACTINIDE_DECAY_HEAT, FISSION_PRODUCT_ACTIVITY, FISSION_PRODUCT_DECAY_HEAT,
     SR90_ACTIVITY, TE132_ACTIVITY, CS134_ACTIVITY, PHOTON_DECAY_SOURCE,
     NEUTRON_DECAY_SOURCE, ALPHA_DECAY_SOURCE, ELECTRON_DECAY_SOURCE}
-  optimization: !!set 
+  optimization: !!set &2-1-30-optimization
     {OPTIMIZATION_MODE, RECONSTRUCT_MICROXS, RECONSTRUCT_MACROXS,
     MG_MAJORANT_MODE, SPECTRUM_COLLAPSE, DOUBLE_INDEXING}
-  six-ff: !!set
+  six-ff: !!set &2-1-30-six-ff
       {SIX_FF_EPSILON, SIX_FF_ETA, SIX_FF_F, SIX_FF_KEFF, SIX_FF_KINF,
       SIX_FF_LT, SIX_FF_LF, SIX_FF_P}
 
-2-1-31: *2-1-30
+2-1-31:
+  n-balance: *2-1-30-n-balance
+  rad-data: *2-1-30-rad-data
+  optimization: *2-1-30-optimization
+  six-ff: *2-1-30-six-ff
+  burnup-coeff: !!set 
+    {BURN_MATERIALS, BURN_MODE, BURN_STEP, BURNUP, BURN_DAYS, COEF_IDX,
+    COEF_BRANCH, COEF_BU_STEP, BURN_RANDOMIZE_DATA}
+
+2-1-32:
+  n-balance: *2-1-30-n-balance
+  rad-data: *2-1-30-rad-data
+  optimization: *2-1-30-optimization
+  six-ff: *2-1-30-six-ff
+  energy-deposition: !!set
+    {EDEP_MODE, EDEP_DELAYED, EDEP_KEFF_CORR, EDEP_LOCAL_EGD, EDEP_COMP, EDEP_CAPT_E}
+  burnup-coeff: !!set 
+    {BURN_MATERIALS, BURN_MODE, BURN_STEP, BURNUP, BURN_DAYS, COEF_IDX,
+    COEF_BRANCH, COEF_BU_STEP, BURN_RANDOMIZE_DATA, FIMA}
\ No newline at end of file


Test patch:
diff --git a/tests/test_results.py b/tests/test_results.py
index 057debd..e562cc3 100644
--- a/tests/test_results.py
+++ b/tests/test_results.py
@@ -1,6 +1,9 @@
 import re
 import os
+from os.path import join as pjoin
+from tempfile import TemporaryDirectory
 
+import numpy
 import pytest
 import serpentTools
 
@@ -38,3 +41,52 @@ def test_multipleGcuNoBu(multipleGcuNoBu):
         assert key.step == 0
         assert key.burnup == 0
         assert key.days == 0
+
+
+@pytest.fixture(scope="module")
+def tdir():
+    with TemporaryDirectory() as temp:
+        yield temp
+
+
+@pytest.fixture(scope="module")
+def fake2132File(tdir):
+    basefile = serpentTools.data.getFile("InnerAssembly_res.m")
+    newfile = pjoin(tdir, "InnerAssembly_2132_res.m")
+    with open(newfile, "w") as ostream, open(basefile, "r") as istream:
+        for line in istream:
+            if "2.1.31" in line:
+                ostream.write(line.replace("2.1.31", "2.1.32"))
+            else:
+                ostream.write(line)
+            if line.startswith("BURN_STEP"):
+                ostream.write(
+                    "BURN_RANDOMIZE_DATA       (idx, [1:  3])  = [ 0 0 0 ];\n"
+                )
+            elif line.startswith("BURN_DAYS"):
+                ostream.write(
+                    "FIMA                      (idx, [1:  3])  = [  0.00000E+00  0.00000E+00  1.00000E+25 ];\n"
+                )
+    yield newfile
+    os.remove(newfile)
+
+
+def test_2132_nofilter(fake2132File):
+    with serpentTools.settings.rc as rc:
+        rc["serpentVersion"] = "2.1.32"
+        reader = serpentTools.read(fake2132File)
+    singleFima = numpy.array([0, 0, 1e25])
+    assert "fima" in reader.resdata
+    assert (reader.resdata["fima"] == singleFima).all(), reader.resdata["fima"]
+    assert not reader.resdata["burnRandomizeData"].any()
+
+
+def test_2132_filterburnup(fake2132File):
+    with serpentTools.settings.rc as rc:
+        rc["serpentVersion"] = "2.1.32"
+        rc["xs.variableGroups"] = ["burnup-coeff", "eig"]
+        reader = serpentTools.read(fake2132File)
+    assert "fima" in reader.resdata
+    assert "burnDays" in reader.resdata
+    assert "absKeff" in reader.resdata
+    assert "pop" not in reader.metadata