Skip to content

Commit

Permalink
Merge branch 'update_parameters' of https://github.com/j-fletcher/openmc
Browse files Browse the repository at this point in the history
 into update_parameters
  • Loading branch information
j-fletcher committed Jun 23, 2023
2 parents 21c4350 + b7b5aa6 commit b0a9c50
Show file tree
Hide file tree
Showing 20 changed files with 25 additions and 19 deletions.
2 changes: 1 addition & 1 deletion examples/custom_source/build_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
settings.run_mode = 'fixed source'
settings.batches = 10
settings.particles = 1000
source = openmc.IndependentSource()
source = openmc.CompiledSource()
source.library = 'build/libsource.so'
settings.source = source
settings.export_to_xml()
Expand Down
2 changes: 1 addition & 1 deletion examples/lattice/hexagonal/build_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
# Create an initial uniform spatial source distribution over fissionable zones
bounds = [-1, -1, -1, 1, 1, 1]
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
settings_file.source = openmc.source.Source(space=uniform_dist)
settings_file.source = openmc.IndependentSource(space=uniform_dist)

settings_file.keff_trigger = {'type' : 'std_dev', 'threshold' : 5E-4}
settings_file.trigger_active = True
Expand Down
2 changes: 1 addition & 1 deletion examples/lattice/nested/build_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
# Create an initial uniform spatial source distribution over fissionable zones
bounds = [-1, -1, -1, 1, 1, 1]
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
settings_file.source = openmc.source.Source(space=uniform_dist)
settings_file.source = openmc.IndependentSource(space=uniform_dist)

settings_file.export_to_xml()

Expand Down
2 changes: 1 addition & 1 deletion examples/lattice/simple/build_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
# Create an initial uniform spatial source distribution over fissionable zones
bounds = [-1, -1, -1, 1, 1, 1]
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
settings_file.source = openmc.source.Source(space=uniform_dist)
settings_file.source = openmc.IndependentSource(space=uniform_dist)

settings_file.trigger_active = True
settings_file.trigger_max_batches = 100
Expand Down
2 changes: 1 addition & 1 deletion examples/parameterized_custom_source/build_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
settings.run_mode = 'fixed source'
settings.batches = 10
settings.particles = 1000
source = openmc.IndependentSource()
source = openmc.CompiledSource()
source.library = 'build/libparameterized_source.so'
source.parameters = 'radius=3.0, energy=14.08e6'
settings.source = source
Expand Down
2 changes: 1 addition & 1 deletion examples/pincell/build_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
lower_left = (-pitch/2, -pitch/2, -1)
upper_right = (pitch/2, pitch/2, 1)
uniform_dist = openmc.stats.Box(lower_left, upper_right, only_fissionable=True)
settings.source = openmc.source.Source(space=uniform_dist)
settings.source = openmc.IndependentSource(space=uniform_dist)

# For source convergence checks, add a mesh that can be used to calculate the
# Shannon entropy
Expand Down
2 changes: 1 addition & 1 deletion examples/pincell_depletion/restart_depletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# Create an initial uniform spatial source distribution over fissionable zones
bounds = [-0.62992, -0.62992, -1, 0.62992, 0.62992, 1]
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
settings.source = openmc.source.Source(space=uniform_dist)
settings.source = openmc.IndependentSource(space=uniform_dist)

entropy_mesh = openmc.RegularMesh()
entropy_mesh.lower_left = [-0.39218, -0.39218, -1.e50]
Expand Down
2 changes: 1 addition & 1 deletion examples/pincell_depletion/run_depletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
# Create an initial uniform spatial source distribution over fissionable zones
bounds = [-0.62992, -0.62992, -1, 0.62992, 0.62992, 1]
uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True)
settings.source = openmc.source.Source(space=uniform_dist)
settings.source = openmc.IndependentSource(space=uniform_dist)

entropy_mesh = openmc.RegularMesh()
entropy_mesh.lower_left = [-0.39218, -0.39218, -1.e50]
Expand Down
2 changes: 1 addition & 1 deletion examples/pincell_multigroup/build_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
lower_left = (-pitch/2, -pitch/2, -1)
upper_right = (pitch/2, pitch/2, 1)
uniform_dist = openmc.stats.Box(lower_left, upper_right, only_fissionable=True)
settings.source = openmc.source.Source(space=uniform_dist)
settings.source = openmc.IndependentSource(space=uniform_dist)
settings.export_to_xml()

###############################################################################
Expand Down
7 changes: 3 additions & 4 deletions openmc/cmfd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,13 +1074,12 @@ def _initialize_cmfd(self):
# Get acceleration map, otherwise set all regions to be accelerated
if self._mesh.map is not None:
check_length('CMFD coremap', self._mesh.map,
np.product(self._indices[0:3]))
np.prod(self._indices[:3]))
if openmc.lib.master():
self._coremap = np.array(self._mesh.map)
else:
if openmc.lib.master():
self._coremap = np.ones((np.product(self._indices[0:3])),
dtype=int)
self._coremap = np.ones(np.prod(self._indices[:3]), dtype=int)

# Check CMFD tallies accummulated before feedback turned on
if self._feedback and self._solver_begin < self._tally_begin:
Expand Down Expand Up @@ -1434,7 +1433,7 @@ def _calc_fission_source(self):
# nfissxs

# Calculate volume
vol = np.product(self._hxyz, axis=3)
vol = np.prod(self._hxyz, axis=3)

# Reshape phi by number of groups
phi = self._phi.reshape((n, ng))
Expand Down
13 changes: 9 additions & 4 deletions openmc/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,10 @@ def from_model_xml(cls, path='model.xml'):
model.materials = openmc.Materials.from_xml_element(root.find('materials'))
model.geometry = openmc.Geometry.from_xml_element(root.find('geometry'), model.materials)

if root.find('tallies'):
if root.find('tallies') is not None:
model.tallies = openmc.Tallies.from_xml_element(root.find('tallies'), meshes)

if root.find('plots'):
if root.find('plots') is not None:
model.plots = openmc.Plots.from_xml_element(root.find('plots'))

return model
Expand Down Expand Up @@ -575,10 +575,15 @@ def import_properties(self, filename):
cell_id = int(name.split()[1])
cell = cells[cell_id]
if cell.fill_type in ('material', 'distribmat'):
cell.temperature = group['temperature'][()]
temperature = group['temperature'][()]
cell.temperature = temperature
if self.is_initialized:
lib_cell = openmc.lib.cells[cell_id]
lib_cell.set_temperature(group['temperature'][()])
if temperature.size > 1:
for i, T in enumerate(temperature):
lib_cell.set_temperature(T, i)
else:
lib_cell.set_temperature(temperature[0])

# Make sure number of materials matches
mats_group = fh['materials']
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions tests/regression_tests/deplete_with_transfer_rates/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pathlib import Path
import shutil
import sys

import numpy as np
import pytest
Expand Down Expand Up @@ -45,6 +46,7 @@ def model():

return openmc.Model(geometry, materials, settings)

@pytest.mark.skipif(sys.version_info < (3, 9), reason="Requires Python 3.9+")
@pytest.mark.parametrize("rate, dest_mat, power, ref_result", [
(1e-5, None, 0.0, 'no_depletion_only_removal'),
(-1e-5, None, 0.0, 'no_depletion_only_feed'),
Expand Down
2 changes: 1 addition & 1 deletion tests/testing_harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def _create_cmfd_result_str(self, cmfd_run):
outstr += '\ncmfd openmc source comparison\n'
outstr += '\n'.join(['{:.6E}'.format(x) for x in cmfd_run.src_cmp])
outstr += '\ncmfd source\n'
cmfdsrc = np.reshape(cmfd_run.cmfd_src, np.product(cmfd_run.indices),
cmfdsrc = np.reshape(cmfd_run.cmfd_src, np.prod(cmfd_run.indices),
order='F')
outstr += '\n'.join(['{:.6E}'.format(x) for x in cmfdsrc])
outstr += '\n'
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/weightwindows/test_ww_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def model():
# 10 keV neutron point source at the origin
space = openmc.stats.Point()
energy = openmc.stats.Discrete(x=[1e4], p=[1.0])
settings.source = openmc.Source(space=space, energy=energy)
settings.source = openmc.IndependentSource(space=space, energy=energy)

return openmc.Model(geometry=geometry, settings=settings)

Expand Down

0 comments on commit b0a9c50

Please sign in to comment.