From 4e56d2a9e04c498c13e48707f2260d9c516c665b Mon Sep 17 00:00:00 2001 From: Adam Nelson Date: Tue, 4 Dec 2012 10:57:56 -0500 Subject: [PATCH] Fully incorporated the arbitrary Pn scattering input, but it is still limited to n=5. I want to do more testing and look at maybe increasing to n=10. I think the CMFD changes should be working, but I dont have a properly configured machine at the moment. Working on that now so I can test --- src/input_xml.F90 | 378 ++++++++++++++++++++++++++++++++-------------- src/output.F90 | 8 +- 2 files changed, 269 insertions(+), 117 deletions(-) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index b0d7150768..3930b2ddae 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -1714,7 +1714,7 @@ contains ! Get the input string in scores(l) but if scatter-n or scatter-pn ! then strip off the n, and store it as an integer to be used later ! Peform the select case on this modified (number removed) string - score_name = tally_(i) % scores(j) + score_name = tally_(i) % scores(l) if (starts_with(score_name,'scatter-p')) then n_order_pos = scan(score_name,'0123456789') n_order = int(str_to_int( & @@ -1727,8 +1727,8 @@ contains trim(to_str(SCATT_ORDER_MAX)) call warning() n_order = SCATT_ORDER_MAX - score_name = "scatter-p" end if + score_name = "scatter-pn" else if (starts_with(score_name,'scatter-')) then n_order_pos = scan(score_name,'0123456789') n_order = int(str_to_int( & @@ -1741,11 +1741,11 @@ contains trim(to_str(SCATT_ORDER_MAX)) call warning() n_order = SCATT_ORDER_MAX - score_name = "scatter-" end if + score_name = "scatter-n" end if - select case (tally_(i) % scores(l)) + select case (score_name) case ('flux') ! Prohibit user from tallying flux for an individual nuclide if (.not. (t % n_nuclide_bins == 1 .and. & @@ -1773,117 +1773,22 @@ contains ! Set tally estimator to analog t % estimator = ESTIMATOR_ANALOG - case ('scatter-0') - ! Does the same as 'scatter', for convenience - t % score_bins(j) = SCORE_SCATTER - case ('scatter-1') - t % score_bins(j) = SCORE_SCATTER_N - t % scatt_order(j) = 1 - - ! Set tally estimator to analog - t % estimator = ESTIMATOR_ANALOG - case ('scatter-2') - t % score_bins(j) = SCORE_SCATTER_N - t % scatt_order(j) = 2 - - ! Set tally estimator to analog - t % estimator = ESTIMATOR_ANALOG - case ('scatter-3') - t % score_bins(j) = SCORE_SCATTER_N - t % scatt_order(j) = 3 - - ! Set tally estimator to analog - t % estimator = ESTIMATOR_ANALOG - case ('scatter-4') - t % score_bins(j) = SCORE_SCATTER_N - t % scatt_order(j) = 4 - - ! Set tally estimator to analog - t % estimator = ESTIMATOR_ANALOG - case ('scatter-5') - t % score_bins(j) = SCORE_SCATTER_N - t % scatt_order(j) = 5 - - ! Set tally estimator to analog - t % estimator = ESTIMATOR_ANALOG + case ('scatter-n') + if (n_order == 0) then + t % score_bins(j) = SCORE_SCATTER + else + t % score_bins(j) = SCORE_SCATTER_N + ! Set tally estimator to analog + t % estimator = ESTIMATOR_ANALOG + end if + t % scatt_order(j) = n_order - case ('scatter-p0') - ! Same as a scatter-0 or scatter - t % score_bins(j) = SCORE_SCATTER - case ('scatter-p1') - ! Setup each of P0 and P1 + case ('scatter-pn') t % estimator = ESTIMATOR_ANALOG - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 1 - j = j + 1 - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 1 - - case ('scatter-p2') - ! Setup each of P0:P2 - t % estimator = ESTIMATOR_ANALOG - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 2 - j = j + 1 - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 2 - j = j + 1 - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 2 - - case ('scatter-p3') - ! Setup each of P0:P3 - t % estimator = ESTIMATOR_ANALOG - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 3 - j = j + 1 - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 3 - j = j + 1 - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 3 - j = j + 1 - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 3 - - case ('scatter-p4') - ! Setup each of P0:P4 - t % estimator = ESTIMATOR_ANALOG - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 4 - j = j + 1 - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 4 - j = j + 1 - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 4 - j = j + 1 - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 4 - j = j + 1 - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 4 - - case ('scatter-p5') - ! Setup each of P0:P5 - t % estimator = ESTIMATOR_ANALOG - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 5 - j = j + 1 - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 5 - j = j + 1 - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 5 - j = j + 1 - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 5 - j = j + 1 - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 5 - j = j + 1 - t % score_bins(j) = SCORE_SCATTER_PN - t % scatt_order(j) = 5 + ! Setup P0:Pn + t % score_bins(j : j + n_order) = SCORE_SCATTER_PN + t % scatt_order(j : j + n_order) = n_order + j = j + n_order case('transport') t % score_bins(j) = SCORE_TRANSPORT @@ -1990,6 +1895,253 @@ contains trim(tally_(i) % scores(l)) call fatal_error() end select + + +!~ select case (tally_(i) % scores(l)) +!~ case ('flux') +!~ ! Prohibit user from tallying flux for an individual nuclide +!~ if (.not. (t % n_nuclide_bins == 1 .and. & +!~ t % nuclide_bins(1) == -1)) then +!~ message = "Cannot tally flux for an individual nuclide." +!~ call fatal_error() +!~ end if +!~ +!~ t % score_bins(j) = SCORE_FLUX +!~ if (t % find_filter(FILTER_ENERGYOUT) > 0) then +!~ message = "Cannot tally flux with an outgoing energy filter." +!~ call fatal_error() +!~ end if +!~ case ('total') +!~ t % score_bins(j) = SCORE_TOTAL +!~ if (t % find_filter(FILTER_ENERGYOUT) > 0) then +!~ message = "Cannot tally total reaction rate with an & +!~ &outgoing energy filter." +!~ call fatal_error() +!~ end if +!~ case ('scatter') +!~ t % score_bins(j) = SCORE_SCATTER +!~ case ('nu-scatter') +!~ t % score_bins(j) = SCORE_NU_SCATTER +!~ +!~ ! Set tally estimator to analog +!~ t % estimator = ESTIMATOR_ANALOG +!~ case ('scatter-0') +!~ ! Does the same as 'scatter', for convenience +!~ t % score_bins(j) = SCORE_SCATTER +!~ case ('scatter-1') +!~ t % score_bins(j) = SCORE_SCATTER_N +!~ t % scatt_order(j) = 1 +!~ +!~ ! Set tally estimator to analog +!~ t % estimator = ESTIMATOR_ANALOG +!~ case ('scatter-2') +!~ t % score_bins(j) = SCORE_SCATTER_N +!~ t % scatt_order(j) = 2 +!~ +!~ ! Set tally estimator to analog +!~ t % estimator = ESTIMATOR_ANALOG +!~ case ('scatter-3') +!~ t % score_bins(j) = SCORE_SCATTER_N +!~ t % scatt_order(j) = 3 +!~ +!~ ! Set tally estimator to analog +!~ t % estimator = ESTIMATOR_ANALOG +!~ case ('scatter-4') +!~ t % score_bins(j) = SCORE_SCATTER_N +!~ t % scatt_order(j) = 4 +!~ +!~ ! Set tally estimator to analog +!~ t % estimator = ESTIMATOR_ANALOG +!~ case ('scatter-5') +!~ t % score_bins(j) = SCORE_SCATTER_N +!~ t % scatt_order(j) = 5 +!~ +!~ ! Set tally estimator to analog +!~ t % estimator = ESTIMATOR_ANALOG +!~ +!~ case ('scatter-p0') +!~ ! Same as a scatter-0 or scatter +!~ t % score_bins(j) = SCORE_SCATTER +!~ case ('scatter-p1') +!~ ! Setup each of P0 and P1 +!~ t % estimator = ESTIMATOR_ANALOG +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 1 +!~ j = j + 1 +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 1 +!~ +!~ case ('scatter-p2') +!~ ! Setup each of P0:P2 +!~ t % estimator = ESTIMATOR_ANALOG +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 2 +!~ j = j + 1 +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 2 +!~ j = j + 1 +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 2 +!~ +!~ case ('scatter-p3') +!~ ! Setup each of P0:P3 +!~ t % estimator = ESTIMATOR_ANALOG +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 3 +!~ j = j + 1 +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 3 +!~ j = j + 1 +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 3 +!~ j = j + 1 +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 3 +!~ +!~ case ('scatter-p4') +!~ ! Setup each of P0:P4 +!~ t % estimator = ESTIMATOR_ANALOG +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 4 +!~ j = j + 1 +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 4 +!~ j = j + 1 +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 4 +!~ j = j + 1 +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 4 +!~ j = j + 1 +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 4 +!~ +!~ case ('scatter-p5') +!~ ! Setup each of P0:P5 +!~ t % estimator = ESTIMATOR_ANALOG +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 5 +!~ j = j + 1 +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 5 +!~ j = j + 1 +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 5 +!~ j = j + 1 +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 5 +!~ j = j + 1 +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 5 +!~ j = j + 1 +!~ t % score_bins(j) = SCORE_SCATTER_PN +!~ t % scatt_order(j) = 5 +!~ +!~ case('transport') +!~ t % score_bins(j) = SCORE_TRANSPORT +!~ +!~ ! Set tally estimator to analog +!~ t % estimator = ESTIMATOR_ANALOG +!~ case ('diffusion') +!~ t % score_bins(j) = SCORE_DIFFUSION +!~ +!~ ! Set tally estimator to analog +!~ t % estimator = ESTIMATOR_ANALOG +!~ case ('n1n') +!~ t % score_bins(j) = SCORE_N_1N +!~ +!~ ! Set tally estimator to analog +!~ t % estimator = ESTIMATOR_ANALOG +!~ case ('n2n') +!~ t % score_bins(j) = SCORE_N_2N +!~ +!~ ! Set tally estimator to analog +!~ t % estimator = ESTIMATOR_ANALOG +!~ case ('n3n') +!~ t % score_bins(j) = SCORE_N_3N +!~ +!~ ! Set tally estimator to analog +!~ t % estimator = ESTIMATOR_ANALOG +!~ case ('n4n') +!~ t % score_bins(j) = SCORE_N_4N +!~ +!~ ! Set tally estimator to analog +!~ t % estimator = ESTIMATOR_ANALOG +!~ case ('absorption') +!~ t % score_bins(j) = SCORE_ABSORPTION +!~ if (t % find_filter(FILTER_ENERGYOUT) > 0) then +!~ message = "Cannot tally absorption rate with an outgoing & +!~ &energy filter." +!~ call fatal_error() +!~ end if +!~ case ('fission') +!~ t % score_bins(j) = SCORE_FISSION +!~ if (t % find_filter(FILTER_ENERGYOUT) > 0) then +!~ message = "Cannot tally fission rate with an outgoing & +!~ &energy filter." +!~ call fatal_error() +!~ end if +!~ case ('nu-fission') +!~ t % score_bins(j) = SCORE_NU_FISSION +!~ case ('current') +!~ t % score_bins(j) = SCORE_CURRENT +!~ t % type = TALLY_SURFACE_CURRENT +!~ +!~ ! Check to make sure that current is the only desired response +!~ ! for this tally +!~ if (n_words > 1) then +!~ message = "Cannot tally other scoring functions in the same & +!~ &tally as surface currents. Separate other scoring & +!~ &functions into a distinct tally." +!~ call fatal_error() +!~ end if +!~ +!~ ! Since the number of bins for the mesh filter was already set +!~ ! assuming it was a volume tally, we need to adjust the number +!~ ! of bins +!~ +!~ ! Get index of mesh filter +!~ k = t % find_filter(FILTER_MESH) +!~ +!~ ! Get pointer to mesh +!~ i_mesh = t % filters(k) % int_bins(1) +!~ m => meshes(i_mesh) +!~ +!~ ! We need to increase the dimension by one since we also need +!~ ! currents coming into and out of the boundary mesh cells. +!~ t % filters(k) % n_bins = product(m % dimension + 1) +!~ +!~ ! Copy filters to temporary array +!~ allocate(filters(t % n_filters + 1)) +!~ filters(1:t % n_filters) = t % filters +!~ +!~ ! Move allocation back -- filters becomes deallocated during +!~ ! this call +!~ call move_alloc(FROM=filters, TO=t%filters) +!~ +!~ ! Add surface filter +!~ t % n_filters = t % n_filters + 1 +!~ t % filters(t % n_filters) % type = FILTER_SURFACE +!~ t % filters(t % n_filters) % n_bins = 2 * m % n_dimension +!~ allocate(t % filters(t % n_filters) % int_bins(& +!~ 2 * m % n_dimension)) +!~ if (m % n_dimension == 2) then +!~ t % filters(t % n_filters) % int_bins = (/ IN_RIGHT, & +!~ OUT_RIGHT, IN_FRONT, OUT_FRONT /) +!~ elseif (m % n_dimension == 3) then +!~ t % filters(t % n_filters) % int_bins = (/ IN_RIGHT, & +!~ OUT_RIGHT, IN_FRONT, OUT_FRONT, IN_TOP, OUT_TOP /) +!~ end if +!~ t % find_filter(FILTER_SURFACE) = t % n_filters +!~ +!~ case ('events') +!~ t % score_bins(j) = SCORE_EVENTS +!~ +!~ case default +!~ message = "Unknown scoring function: " // & +!~ trim(tally_(i) % scores(l)) +!~ call fatal_error() +!~ end select end do t % n_score_bins = n_scores t % n_nonPN_score_bins = n_words diff --git a/src/output.F90 b/src/output.F90 index fe7aa06683..037bc41c21 100644 --- a/src/output.F90 +++ b/src/output.F90 @@ -1397,7 +1397,7 @@ contains integer :: score_index ! scoring bin index integer :: i_nuclide ! index in nuclides array integer :: i_listing ! index in xs_listings array - integer :: nOrder ! loop index for scattering orders + integer :: n_order ! loop index for scattering orders real(8) :: t_value ! t-values for confidence intervals real(8) :: alpha ! significance level for CI character(MAX_FILE_LEN) :: filename ! name of output file @@ -1587,16 +1587,16 @@ contains repeat(" ", indent), score_name, & to_str(t % scores(score_index,filter_index) % sum), & trim(to_str(t % scores(score_index,filter_index) % sum_sq)) - do nOrder = 1, t % scatt_order(k) + do n_order = 1, t % scatt_order(k) score_index = score_index + 1 - score_name = 'P' // trim(to_str(nOrder)) // & + score_name = 'P' // trim(to_str(n_order)) // & ' Scattering Moment' write(UNIT=UNIT_TALLY, FMT='(1X,2A,1X,A,"+/- ",A)') & repeat(" ", indent), score_name, & to_str(t % scores(score_index,filter_index) % sum), & trim(to_str(t % scores(score_index,filter_index) % sum_sq)) end do - k = k + nOrder - 1 + k = k + n_order - 1 else score_name = score_names(abs(t % score_bins(k))) write(UNIT=UNIT_TALLY, FMT='(1X,2A,1X,A,"+/- ",A)') &