From 070e2824869a4df289f3b13f24ae8068108398cf Mon Sep 17 00:00:00 2001 From: Adam Nelson Date: Mon, 19 May 2014 09:36:39 -0400 Subject: [PATCH 1/6] Seem to have fixed the L(I) issue, testing now --- src/ace.F90 | 90 ++++++++++++++++++++++++----------------------------- 1 file changed, 41 insertions(+), 49 deletions(-) diff --git a/src/ace.F90 b/src/ace.F90 index e3327b2da5..68302b16fb 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -967,24 +967,23 @@ contains ! Continuous tabular distribution NR = int(XSS(lc + 1)) NE = int(XSS(lc + 2 + 2*NR)) - ! Before progressing, check to see if data set uses L(I) values - ! in a way inconsistent with the current form of the ACE Format Guide - ! (MCNP5 Manual, Vol 3) allocate(L(NE)) L = int(XSS(lc + 3 + 2*NR + NE: lc + 3 + 2*NR + 2*NE - 1)) - do i = 1,NE - ! Now check to see if L(i) is equal to any other entries - ! If so, then we must exit - if (count(L == L(i)) > 1) then - message = "Invalid usage of L(I) in ACE data; & - &Consider using more recent data set." - call fatal_error() - end if - end do - deallocate(L) + ! Continue with finding data length length = length + 2 + 2*NR + 2*NE do i = 1,NE + ! Some older data sets use the same LDAT for multiple Ein tables. + ! If this is the case, we should skip incrementing length when it is + ! not needed. + if (i < NE) then + if (L(i) == L(i + 1)) then + ! adjust location for this block + j = lc + 2 + 2*NR + NE + i + XSS(j) = XSS(j) - LOCC - lid + cycle + end if + end if ! determine length NP = int(XSS(lc + length + 2)) length = length + 2 + 3*NP @@ -993,6 +992,7 @@ contains j = lc + 2 + 2*NR + NE + i XSS(j) = XSS(j) - LOCC - lid end do + deallocate(L) case (5) ! General evaporation spectrum @@ -1025,24 +1025,23 @@ contains ! Kalbach-Mann correlated scattering NR = int(XSS(lc + 1)) NE = int(XSS(lc + 2 + 2*NR)) - ! Before progressing, check to see if data set uses L(I) values - ! in a way inconsistent with the current form of the ACE Format Guide - ! (MCNP5 Manual, Vol 3) allocate(L(NE)) L = int(XSS(lc + 3 + 2*NR + NE: lc + 3 + 2*NR + 2*NE - 1)) - do i = 1,NE - ! Now check to see if L(i) is equal to any other entries - ! If so, then we must exit - if (count(L == L(i)) > 1) then - message = "Invalid usage of L(I) in ACE data; & - &Consider using more recent data set." - call fatal_error() - end if - end do - deallocate(L) + ! Continue with finding data length length = length + 2 + 2*NR + 2*NE do i = 1,NE + ! Some older data sets use the same LDAT for multiple Ein tables. + ! If this is the case, we should skip incrementing length when it is + ! not needed. + if (i < NE) then + if (L(i) == L(i + 1)) then + ! adjust location for this block + j = lc + 2 + 2*NR + NE + i + XSS(j) = XSS(j) - LOCC - lid + cycle + end if + end if NP = int(XSS(lc + length + 2)) length = length + 2 + 5*NP @@ -1050,29 +1049,30 @@ contains j = lc + 2 + 2*NR + NE + i XSS(j) = XSS(j) - LOCC - lid end do + deallocate(L) case (61) ! Correlated energy and angle distribution NR = int(XSS(lc + 1)) NE = int(XSS(lc + 2 + 2*NR)) - ! Before progressing, check to see if data set uses L(I) values - ! in a way inconsistent with the current form of the ACE Format Guide - ! (MCNP5 Manual, Vol 3) allocate(L(NE)) L = int(XSS(lc + 3 + 2*NR + NE: lc + 3 + 2*NR + 2*NE - 1)) - do i = 1,NE - ! Now check to see if L(i) is equal to any other entries - ! If so, then we must exit - if (count(L == L(i)) > 1) then - message = "Invalid usage of L(I) in ACE data; & - &Consider using more recent data set." - call fatal_error() - end if - end do - deallocate(L) + ! Continue with finding data length length = length + 2 + 2*NR + 2*NE do i = 1,NE + ! Some older data sets use the same LDAT for multiple Ein tables. + ! If this is the case, we should skip incrementing length when it is + ! not needed. + if (i < NE) then + if (L(i) == L(i + 1)) then + ! adjust locators for energy distribution + j = lc + 2 + 2*NR + NE + i + XSS(j) = XSS(j) - LOCC - lid + cycle + end if + end if + ! outgoing energy distribution NP = int(XSS(lc + length + 2)) @@ -1094,7 +1094,7 @@ contains j = lc + 2 + 2*NR + NE + i XSS(j) = XSS(j) - LOCC - lid end do - + deallocate(L) case (66) ! N-body phase space distribution length = 2 @@ -1108,15 +1108,7 @@ contains ! (MCNP5 Manual, Vol 3) allocate(L(NE)) L = int(XSS(lc + 3 + 2*NR + NE: lc + 3 + 2*NR + 2*NE - 1)) - do i = 1,NE - ! Now check to see if L(i) is equal to any other entries - ! If so, then we must exit - if (count(L == L(i)) > 1) then - message = "Invalid usage of L(I) in ACE data; & - &Consider using more recent data set." - call fatal_error() - end if - end do + ! Don't currently do anything with L deallocate(L) ! Continue with finding data length NMU = int(XSS(lc + 4 + 2*NR + 2*NE)) From e22b452b5f4c90de637cf4b7035966d73163480c Mon Sep 17 00:00:00 2001 From: Adam Nelson Date: Mon, 19 May 2014 12:11:13 -0400 Subject: [PATCH 2/6] Fixed an issue where if ACE files first angular distribution for a given incoming energy was isotropic (LC=0), then the length calculation would be incorrect since rxn%adist%location(1) was 0. --- src/ace.F90 | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/ace.F90 b/src/ace.F90 index 68302b16fb..0c1d519d3a 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -789,14 +789,19 @@ contains ! read angular distribution -- currently this does not actually parse the ! angular distribution tables for each incoming energy, that must be done ! on-the-fly - LC = rxn % adist % location(1) - XSS_index = JXS9 + abs(LC) - 1 + XSS_index = JXS9 + LOCB + 2 * NE rxn % adist % data = get_real(length) ! change location pointers since they are currently relative to JXS(9) - LC = abs(rxn % adist % location(1)) - rxn % adist % location = abs(rxn % adist % location) - LC - + LC = LOCB + 2 * NE + 1 + do j = 1, NE + ! For consistency, leave location as 0 if type is isotropic. + ! This is not necessary for current correctness, but can avoid + ! future issues + if (rxn % adist % location(j) /= 0) then + rxn % adist % location(j) = abs(rxn % adist % location(j)) - LC + end if + end do end do end subroutine read_angular_dist From d1ca3519f2c56e400311ed9d6fde91f62512da0b Mon Sep 17 00:00:00 2001 From: Adam Nelson Date: Mon, 19 May 2014 12:19:14 -0400 Subject: [PATCH 3/6] Fixed sample_angles interpolation of mu. The old way was resulting in mus outside the range of [-1,1] and was effectively using the slope of the randomly selected bin but extrapolating to the next lower bin. --- src/physics.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics.F90 b/src/physics.F90 index 5d3433f3be..3460873e55 100644 --- a/src/physics.F90 +++ b/src/physics.F90 @@ -1164,7 +1164,7 @@ contains ! calculate cosine mu0 = rxn % adist % data(lc + k) mu1 = rxn % adist % data(lc + k+1) - mu = mu0 + (32.0_8 * xi - k) * (mu1 - mu0) + mu = mu0 + (32.0_8 * xi - k + ONE) * (mu1 - mu0) elseif (type == ANGLE_TABULAR) then interp = int(rxn % adist % data(lc + 1)) From 9b68d497a2efb4c6ac2df4853606f00ee5a42fc3 Mon Sep 17 00:00:00 2001 From: Adam Nelson Date: Mon, 19 May 2014 20:38:07 -0400 Subject: [PATCH 4/6] Info in Troubleshooting portion of manual regarding L(I) issue is no longer needed. Removed. --- docs/source/usersguide/troubleshoot.rst | 8 -------- 1 file changed, 8 deletions(-) diff --git a/docs/source/usersguide/troubleshoot.rst b/docs/source/usersguide/troubleshoot.rst index ba7e4405cc..10ac12184f 100644 --- a/docs/source/usersguide/troubleshoot.rst +++ b/docs/source/usersguide/troubleshoot.rst @@ -79,14 +79,6 @@ with the :envvar:`CROSS_SECTIONS` environment variable. It is recommended to add a line in your ``.profile`` or ``.bash_profile`` setting the :envvar:`CROSS_SECTIONS` environment variable. -ERROR: Invalid usage of L(I) in ACE data; Consider using more recent data set. -****************************************************************************** - -The cross-sections requested in ``materials.xml`` do not conform to the current -standard format. This typically happens with fissionable nuclides in a ``.6*c`` -library as distributed with MCNP. Please try a newer library such as any from -the ``.7*c`` set. - Geometry Debugging ****************** From eef806e608c880c8b77fd1b61a390587e37da97c Mon Sep 17 00:00:00 2001 From: Adam Nelson Date: Tue, 20 May 2014 06:16:49 -0400 Subject: [PATCH 5/6] Corrected ace reading to look for the existence of the same locator anywhere in the array instead of just after, and updated the tests. --- src/ace.F90 | 6 +++--- tests/test_source_file/results_true.dat | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ace.F90 b/src/ace.F90 index 0c1d519d3a..d414e21f89 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -982,7 +982,7 @@ contains ! If this is the case, we should skip incrementing length when it is ! not needed. if (i < NE) then - if (L(i) == L(i + 1)) then + if (any(L(i) == L(i + 1: NE))) then ! adjust location for this block j = lc + 2 + 2*NR + NE + i XSS(j) = XSS(j) - LOCC - lid @@ -1040,7 +1040,7 @@ contains ! If this is the case, we should skip incrementing length when it is ! not needed. if (i < NE) then - if (L(i) == L(i + 1)) then + if (any(L(i) == L(i + 1: NE))) then ! adjust location for this block j = lc + 2 + 2*NR + NE + i XSS(j) = XSS(j) - LOCC - lid @@ -1070,7 +1070,7 @@ contains ! If this is the case, we should skip incrementing length when it is ! not needed. if (i < NE) then - if (L(i) == L(i + 1)) then + if (any(L(i) == L(i + 1: NE))) then ! adjust locators for energy distribution j = lc + 2 + 2*NR + NE + i XSS(j) = XSS(j) - LOCC - lid diff --git a/tests/test_source_file/results_true.dat b/tests/test_source_file/results_true.dat index d714d0bd43..eb3139f582 100644 --- a/tests/test_source_file/results_true.dat +++ b/tests/test_source_file/results_true.dat @@ -1,2 +1,2 @@ k-combined: -3.013216E-01 2.768871E-03 +3.037843E-01 4.395619E-03 From d737d3f1a3b605d901239a7abea4c11bfab86234 Mon Sep 17 00:00:00 2001 From: Adam Nelson Date: Wed, 21 May 2014 19:47:55 -0400 Subject: [PATCH 6/6] Updated results_true.dat to correspond with the updated test. --- tests/test_source_file/results_true.dat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_source_file/results_true.dat b/tests/test_source_file/results_true.dat index eb3139f582..d714d0bd43 100644 --- a/tests/test_source_file/results_true.dat +++ b/tests/test_source_file/results_true.dat @@ -1,2 +1,2 @@ k-combined: -3.037843E-01 4.395619E-03 +3.013216E-01 2.768871E-03