Skip to content

Commit

Permalink
Merge pull request openmc-dev#867 from paulromano/mesh1d-bugfix
Browse files Browse the repository at this point in the history
Make sure get_pandas_dataframe() works with 1D mesh filter
  • Loading branch information
Will Boyd authored Apr 26, 2017
2 parents b72ca4e + fb9f7e2 commit 762c99b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
5 changes: 4 additions & 1 deletion openmc/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,9 +777,12 @@ def get_pandas_dataframe(self, data_size, **kwargs):
# Find mesh dimensions - use 3D indices for simplicity
if len(self.mesh.dimension) == 3:
nx, ny, nz = self.mesh.dimension
else:
elif len(self.mesh.dimension) == 2:
nx, ny = self.mesh.dimension
nz = 1
else:
nx = self.mesh.dimension
ny = nz = 1

# Generate multi-index sub-column for x-axis
filter_bins = np.arange(1, nx + 1)
Expand Down
11 changes: 6 additions & 5 deletions src/nuclide_header.F90
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,12 @@ subroutine nuclide_from_hdf5(this, group_id, temperature, method, tolerance, &
call sort(temps_available)

! If only one temperature is available, revert to nearest temperature
if (size(temps_available) == 1 .and. &
method == TEMPERATURE_INTERPOLATION .and. master) then
call warning("Cross sections for " // trim(this % name) // " are only &
&available at one temperature. Reverting to nearest temperature &
&method.")
if (size(temps_available) == 1 .and. method == TEMPERATURE_INTERPOLATION) then
if (master) then
call warning("Cross sections for " // trim(this % name) // " are only &
&available at one temperature. Reverting to nearest temperature &
&method.")
end if
method = TEMPERATURE_NEAREST
end if

Expand Down
6 changes: 5 additions & 1 deletion src/physics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,11 @@ subroutine elastic_scatter(i_nuclide, rxn, kT, E, uvw, mu_lab, wgt)
! Sample scattering angle
select type (dist => rxn % products(1) % distribution(1) % obj)
type is (UncorrelatedAngleEnergy)
mu_cm = dist % angle % sample(E)
if (allocated(dist % angle % energy)) then
mu_cm = dist % angle % sample(E)
else
mu_cm = TWO*prn() - ONE
end if
end select

! Determine direction cosines in CM
Expand Down

0 comments on commit 762c99b

Please sign in to comment.