mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
Use 0-based indexing for tally derivatives
This commit is contained in:
parent
9f6a7466e2
commit
fe6fba2954
5 changed files with 21 additions and 22 deletions
|
|
@ -39,7 +39,7 @@ public:
|
|||
int surface_filter_ {C_NONE};
|
||||
int mesh_filter_ {C_NONE};
|
||||
|
||||
int deriv_ {F90_NONE}; //!< Index of a TallyDerivative object for diff tallies.
|
||||
int deriv_ {C_NONE}; //!< Index of a TallyDerivative object for diff tallies.
|
||||
|
||||
private:
|
||||
std::vector<int32_t> filters_; //!< Filter indices in global filters array
|
||||
|
|
|
|||
|
|
@ -1004,9 +1004,8 @@ contains
|
|||
|
||||
call read_tally_derivatives(root % ptr)
|
||||
|
||||
call get_node_list(root, "derivative", node_deriv_list)
|
||||
do i = 1, size(node_deriv_list)
|
||||
deriv => tally_deriv_c(i - 1)
|
||||
do i = 0, n_tally_derivs() - 1
|
||||
deriv => tally_deriv_c(i)
|
||||
call tally_deriv_dict % set(deriv % id, i)
|
||||
end do
|
||||
|
||||
|
|
@ -1599,8 +1598,8 @@ contains
|
|||
call get_node_value(node_tal, "derivative", deriv_id)
|
||||
|
||||
! Find the derivative with the given id, and store it's index.
|
||||
do j = 1, n_tally_derivs()
|
||||
deriv => tally_deriv_c(j - 1)
|
||||
do j = 0, n_tally_derivs() - 1
|
||||
deriv => tally_deriv_c(j)
|
||||
if (deriv % id == deriv_id) then
|
||||
call t % set_deriv(j)
|
||||
! Only analog or collision estimators are supported for differential
|
||||
|
|
@ -1618,7 +1617,7 @@ contains
|
|||
end if
|
||||
end do
|
||||
|
||||
deriv => tally_deriv_c(t % deriv() - 1)
|
||||
deriv => tally_deriv_c(t % deriv())
|
||||
if (deriv % variable == DIFF_NUCLIDE_DENSITY &
|
||||
.or. deriv % variable == DIFF_TEMPERATURE) then
|
||||
if (any(t % nuclide_bins == -1)) then
|
||||
|
|
|
|||
|
|
@ -531,9 +531,9 @@ contains
|
|||
endif
|
||||
|
||||
! Write derivative information.
|
||||
if (t % deriv() /= NONE) then
|
||||
if (t % deriv() /= C_NONE) then
|
||||
!associate(deriv => tally_derivs(t % deriv()))
|
||||
deriv => tally_deriv_c(t % deriv() - 1)
|
||||
deriv => tally_deriv_c(t % deriv())
|
||||
select case (deriv % variable)
|
||||
case (DIFF_DENSITY)
|
||||
write(unit=unit_tally, fmt="(' Density derivative Material ',A)") &
|
||||
|
|
|
|||
|
|
@ -177,9 +177,9 @@ contains
|
|||
! Write information for derivatives.
|
||||
if (n_tally_derivs() > 0) then
|
||||
derivs_group = create_group(tallies_group, "derivatives")
|
||||
do i = 1, n_tally_derivs()
|
||||
do i = 0, n_tally_derivs() - 1
|
||||
!associate(deriv => tally_derivs(i))
|
||||
deriv => tally_deriv_c(i - 1)
|
||||
deriv => tally_deriv_c(i)
|
||||
deriv_group = create_group(derivs_group, "derivative " &
|
||||
// trim(to_str(deriv % id)))
|
||||
select case (deriv % variable)
|
||||
|
|
@ -305,8 +305,8 @@ contains
|
|||
deallocate(str_array)
|
||||
|
||||
! Write derivative information.
|
||||
if (tally % deriv() /= NONE) then
|
||||
deriv => tally_deriv_c(tally % deriv() - 1)
|
||||
if (tally % deriv() /= C_NONE) then
|
||||
deriv => tally_deriv_c(tally % deriv())
|
||||
call write_dataset(tally_group, "derivative", &
|
||||
deriv % id)
|
||||
end if
|
||||
|
|
|
|||
|
|
@ -1184,7 +1184,7 @@ contains
|
|||
!#########################################################################
|
||||
! Add derivative information on score for differential tallies.
|
||||
|
||||
if (t % deriv() /= NONE) then
|
||||
if (t % deriv() /= C_NONE) then
|
||||
call apply_derivative_to_score(p, t, i_nuclide, atom_density, &
|
||||
score_bin, score)
|
||||
end if
|
||||
|
|
@ -2375,7 +2375,7 @@ contains
|
|||
! Add derivative information for differential tallies. Note that the
|
||||
! i_nuclide and atom_density arguments do not matter since this is an
|
||||
! analog estimator.
|
||||
if (t % deriv() /= NONE) then
|
||||
if (t % deriv() /= C_NONE) then
|
||||
call apply_derivative_to_score(p, t, 0, ZERO, SCORE_NU_FISSION, score)
|
||||
end if
|
||||
|
||||
|
|
@ -3006,7 +3006,7 @@ contains
|
|||
! perturbated variable.
|
||||
|
||||
!associate(deriv => tally_derivs(t % deriv()))
|
||||
deriv => tally_deriv_c(t % deriv() - 1)
|
||||
deriv => tally_deriv_c(t % deriv())
|
||||
flux_deriv = deriv % flux_deriv
|
||||
|
||||
!select case (tally_derivs(t % deriv()) % variable)
|
||||
|
|
@ -3568,9 +3568,9 @@ contains
|
|||
! A void material cannot be perturbed so it will not affect flux derivatives
|
||||
if (p % material == MATERIAL_VOID) return
|
||||
|
||||
do i = 1, n_tally_derivs()
|
||||
do i = 0, n_tally_derivs() - 1
|
||||
!associate(deriv => tally_derivs(i))
|
||||
deriv => tally_deriv_c(i - 1)
|
||||
deriv => tally_deriv_c(i)
|
||||
select case (deriv % variable)
|
||||
|
||||
case (DIFF_DENSITY)
|
||||
|
|
@ -3644,9 +3644,9 @@ contains
|
|||
! A void material cannot be perturbed so it will not affect flux derivatives
|
||||
if (p % material == MATERIAL_VOID) return
|
||||
|
||||
do i = 1, n_tally_derivs()
|
||||
do i = 0, n_tally_derivs() - 1
|
||||
!associate(deriv => tally_derivs(i))
|
||||
deriv => tally_deriv_c(i - 1)
|
||||
deriv => tally_deriv_c(i)
|
||||
select case (deriv % variable)
|
||||
|
||||
case (DIFF_DENSITY)
|
||||
|
|
@ -3720,8 +3720,8 @@ contains
|
|||
subroutine zero_flux_derivs()
|
||||
integer :: i
|
||||
type(TallyDerivative), pointer :: deriv
|
||||
do i = 1, n_tally_derivs()
|
||||
deriv => tally_deriv_c(i - 1)
|
||||
do i = 0, n_tally_derivs() - 1
|
||||
deriv => tally_deriv_c(i)
|
||||
deriv % flux_deriv = ZERO
|
||||
end do
|
||||
end subroutine zero_flux_derivs
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue