From c5a43746ad2d26e734abf728e729299d79475046 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Fri, 28 Feb 2014 18:37:11 -0500 Subject: [PATCH 1/9] added spatial source filter by fissionable material --- src/constants.F90 | 5 +++-- src/initialize.F90 | 36 ++++++++++++++++++++++++++++++++++++ src/input_xml.F90 | 3 +++ src/material_header.F90 | 4 ++++ src/source.F90 | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 79 insertions(+), 2 deletions(-) diff --git a/src/constants.F90 b/src/constants.F90 index f83f7bd2c1..fa19a2ce1e 100644 --- a/src/constants.F90 +++ b/src/constants.F90 @@ -361,8 +361,9 @@ module constants ! Source spatial distribution types integer, parameter :: & - SRC_SPACE_BOX = 1, & ! Source in a rectangular prism - SRC_SPACE_POINT = 2 ! Source at a single point + SRC_SPACE_BOX = 1, & ! Source in a rectangular prism + SRC_SPACE_POINT = 2, & ! Source at a single point + SRC_SPACE_FISSION = 3 ! Source in prism filtered by fissionable mats ! Source angular distribution types integer, parameter :: & diff --git a/src/initialize.F90 b/src/initialize.F90 index 3e67ae8662..586051a9b2 100644 --- a/src/initialize.F90 +++ b/src/initialize.F90 @@ -11,6 +11,7 @@ module initialize use global use input_xml, only: read_input_xml, read_cross_sections_xml, & cells_in_univ_dict, read_plots_xml + use material_header, only: Material use output, only: title, header, write_summary, print_version, & print_usage, write_xs_summary, print_plot, & write_message @@ -107,6 +108,9 @@ contains ! Create linked lists for multiple instances of the same nuclide call same_nuclide_list() + ! Check for fissionable material + call check_mat_fission() + ! Construct unionized energy grid from cross-sections if (grid_method == GRID_UNION) then call time_unionize % start() @@ -897,4 +901,36 @@ contains end subroutine allocate_banks +!=============================================================================== +! CHECK_MAT_FISSION checks material for fissionable nuclides +!=============================================================================== + + subroutine check_mat_fission() + + integer :: i ! Material index counter + integer :: j ! Nuclide index counter + type(Material), pointer :: m => null() + + ! Loop around material + MAT: do i = 1, n_materials + + ! Get material + m => materials(i) + m % fissionable = .false. + + ! Loop around nuclides in material + NUC: do j = 1, m % n_nuclides + + ! Check for fission in nuclide + if (nuclides(m % nuclide(j)) % fissionable) then + m % fissionable = .true. + exit NUC + end if + + end do NUC + + end do MAT + + end subroutine check_mat_fission + end module initialize diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 1869b9709d..c024a0f431 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -292,6 +292,9 @@ contains case ('box') external_source % type_space = SRC_SPACE_BOX coeffs_reqd = 6 + case ('fission') + external_source % type_space = SRC_SPACE_FISSION + coeffs_reqd = 6 case ('point') external_source % type_space = SRC_SPACE_POINT coeffs_reqd = 3 diff --git a/src/material_header.F90 b/src/material_header.F90 index cbfd917498..4f996a7e00 100644 --- a/src/material_header.F90 +++ b/src/material_header.F90 @@ -21,6 +21,10 @@ module material_header ! Temporary names read during initialization character(12), allocatable :: names(:) ! isotope names character(12), allocatable :: sab_names(:) ! name of S(a,b) table + + ! Does this material contain fissionable nuclides? + logical :: fissionable + end type Material end module material_header diff --git a/src/source.F90 b/src/source.F90 index 9dcfd01445..d23c90b71b 100644 --- a/src/source.F90 +++ b/src/source.F90 @@ -135,6 +135,39 @@ contains end do call p % clear() + case (SRC_SPACE_FISSION) + ! Set particle defaults + call p % initialize() + ! Repeat sampling source location until a good site has been found + found = .false. + do while (.not.found) + ! Coordinates sampled uniformly over a box + p_min = external_source % params_space(1:3) + p_max = external_source % params_space(4:6) + r = (/ (prn(), i = 1,3) /) + site % xyz = p_min + r*(p_max - p_min) + + ! Fill p with needed data + p % coord0 % xyz = site % xyz + p % coord0 % uvw = [ ONE, ZERO, ZERO ] + + ! Now search to see if location exists in geometry + call find_cell(p, found) + if (.not. found) then + num_resamples = num_resamples + 1 + if (num_resamples == MAX_EXTSRC_RESAMPLES) then + message = "Maximum number of external source spatial resamples & + &reached!" + call fatal_error() + end if + cycle + end if + if (.not. materials(p % material) % fissionable) then + found = .false. + call p % initialize() + end if + end do + case (SRC_SPACE_POINT) ! Point source site % xyz = external_source % params_space From a3df011e7c1b319aa6f24921c024b64bfa700c7b Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Fri, 5 Sep 2014 15:01:56 -0400 Subject: [PATCH 2/9] added documentation for fission box source --- docs/source/usersguide/input.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/source/usersguide/input.rst b/docs/source/usersguide/input.rst index c9aa8cc866..4a92305bcc 100644 --- a/docs/source/usersguide/input.rst +++ b/docs/source/usersguide/input.rst @@ -311,6 +311,12 @@ attributes/sub-elements: parallelepiped and the last three of which specify the upper-right corner. Source sites are sampled uniformly through that parallelepiped. + To filter a "box" spatial distribution by fissionable material, specify + "fission" tag instead of "box". The ``parameters`` should be given as six + real numbers, the first three of which specify the lower-left corner of a + parallelepiped and the last three of which specify the upper-right + corner. Source sites are sampled uniformly through that parallelepiped. + For a "point" spatial distribution, ``parameters`` should be given as three real numbers which specify the (x,y,z) location of an isotropic point source From 1159c2f3e963caa94b4ac7a915169d4b15c844c1 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Fri, 5 Sep 2014 15:55:33 -0400 Subject: [PATCH 3/9] clear particle after fission sampling --- src/source.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/source.F90 b/src/source.F90 index d23c90b71b..d742c78109 100644 --- a/src/source.F90 +++ b/src/source.F90 @@ -167,6 +167,7 @@ contains call p % initialize() end if end do + call p % clear() case (SRC_SPACE_POINT) ! Point source From 7cdb34e2fd362209bd6c4388d738d66486996610 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 9 Sep 2014 09:01:24 -0400 Subject: [PATCH 4/9] moved location where materials are set to fissionable --- src/ace.F90 | 19 +++++++++++++++++++ src/initialize.F90 | 35 ----------------------------------- 2 files changed, 19 insertions(+), 35 deletions(-) diff --git a/src/ace.F90 b/src/ace.F90 index 58f7fd5707..1586c4dc6d 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -172,6 +172,25 @@ contains ! Avoid some valgrind leak errors call already_read % clear() + ! Loop around material + MAT: do i = 1, n_materials + + ! Get material + m => materials(i) + + ! Loop around nuclides in material + NUC: do j = 1, m % n_nuclides + + ! Check for fission in nuclide + if (nuclides(m % nuclide(j)) % fissionable) then + m % fissionable = .true. + exit NUC + end if + + end do NUC + + end do MAT + end subroutine read_xs !=============================================================================== diff --git a/src/initialize.F90 b/src/initialize.F90 index 586051a9b2..7d4adad493 100644 --- a/src/initialize.F90 +++ b/src/initialize.F90 @@ -108,9 +108,6 @@ contains ! Create linked lists for multiple instances of the same nuclide call same_nuclide_list() - ! Check for fissionable material - call check_mat_fission() - ! Construct unionized energy grid from cross-sections if (grid_method == GRID_UNION) then call time_unionize % start() @@ -901,36 +898,4 @@ contains end subroutine allocate_banks -!=============================================================================== -! CHECK_MAT_FISSION checks material for fissionable nuclides -!=============================================================================== - - subroutine check_mat_fission() - - integer :: i ! Material index counter - integer :: j ! Nuclide index counter - type(Material), pointer :: m => null() - - ! Loop around material - MAT: do i = 1, n_materials - - ! Get material - m => materials(i) - m % fissionable = .false. - - ! Loop around nuclides in material - NUC: do j = 1, m % n_nuclides - - ! Check for fission in nuclide - if (nuclides(m % nuclide(j)) % fissionable) then - m % fissionable = .true. - exit NUC - end if - - end do NUC - - end do MAT - - end subroutine check_mat_fission - end module initialize From deb3934152821e896b99c72fc0da357d0f2c5658 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 9 Sep 2014 09:02:51 -0400 Subject: [PATCH 5/9] default fissionable material to false --- src/material_header.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/material_header.F90 b/src/material_header.F90 index 4f996a7e00..fca735fd2a 100644 --- a/src/material_header.F90 +++ b/src/material_header.F90 @@ -23,7 +23,7 @@ module material_header character(12), allocatable :: sab_names(:) ! name of S(a,b) table ! Does this material contain fissionable nuclides? - logical :: fissionable + logical :: fissionable = .false. end type Material From 6d65923da28f5aab230cf60e7eedaa88bf6f660a Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 9 Sep 2014 09:05:31 -0400 Subject: [PATCH 6/9] accounted for void material --- src/source.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/source.F90 b/src/source.F90 index d742c78109..94d81d5060 100644 --- a/src/source.F90 +++ b/src/source.F90 @@ -162,6 +162,7 @@ contains end if cycle end if + if (p % material == MATERIAL_VOID) cycle if (.not. materials(p % material) % fissionable) then found = .false. call p % initialize() From e877f9aba0a994fa06880a2416507f2719569b1f Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 9 Sep 2014 09:10:17 -0400 Subject: [PATCH 7/9] fixed variable names when setting materials to fissionable --- src/ace.F90 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ace.F90 b/src/ace.F90 index 1586c4dc6d..8067439e1e 100644 --- a/src/ace.F90 +++ b/src/ace.F90 @@ -173,23 +173,23 @@ contains call already_read % clear() ! Loop around material - MAT: do i = 1, n_materials + MATERIAL_LOOP3: do i = 1, n_materials ! Get material - m => materials(i) + mat => materials(i) ! Loop around nuclides in material - NUC: do j = 1, m % n_nuclides + NUCLIDE_LOOP2: do j = 1, mat % n_nuclides ! Check for fission in nuclide - if (nuclides(m % nuclide(j)) % fissionable) then - m % fissionable = .true. - exit NUC + if (nuclides(mat % nuclide(j)) % fissionable) then + mat % fissionable = .true. + exit NUCLIDE_LOOP2 end if - end do NUC + end do NUCLIDE_LOOP2 - end do MAT + end do MATERIAL_LOOP3 end subroutine read_xs From 43dafeec32614e30ba29355a3aeab1166708b992 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Wed, 10 Sep 2014 09:19:38 -0400 Subject: [PATCH 8/9] if in void material resample particle site and moved particle initialize for initial source in fission regions --- src/source.F90 | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/source.F90 b/src/source.F90 index 94d81d5060..c501b633be 100644 --- a/src/source.F90 +++ b/src/source.F90 @@ -136,11 +136,12 @@ contains call p % clear() case (SRC_SPACE_FISSION) - ! Set particle defaults - call p % initialize() ! Repeat sampling source location until a good site has been found found = .false. do while (.not.found) + ! Set particle defaults + call p % initialize() + ! Coordinates sampled uniformly over a box p_min = external_source % params_space(1:3) p_max = external_source % params_space(4:6) @@ -162,11 +163,8 @@ contains end if cycle end if - if (p % material == MATERIAL_VOID) cycle - if (.not. materials(p % material) % fissionable) then - found = .false. - call p % initialize() - end if + if (p % material == MATERIAL_VOID) found = .false. + if (.not. materials(p % material) % fissionable) found = .false. end do call p % clear() From 9e8c7531c5cf17544a92aef2042e71149dc93142 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Wed, 10 Sep 2014 09:23:03 -0400 Subject: [PATCH 9/9] must cycle when encountering material void when performing initial fission source box --- src/source.F90 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/source.F90 b/src/source.F90 index c501b633be..5f928436b9 100644 --- a/src/source.F90 +++ b/src/source.F90 @@ -163,7 +163,10 @@ contains end if cycle end if - if (p % material == MATERIAL_VOID) found = .false. + if (p % material == MATERIAL_VOID) then + found = .false. + cycle + end if if (.not. materials(p % material) % fissionable) found = .false. end do call p % clear()