Skip to content

Commit 1bf5e12

Browse files
committed
Merge remote-tracking branch 'origin/develop' into Sensitivity-Analysis
Calc. Sens. Coeffs. in one run
2 parents 91691c8 + eb74d49 commit 1bf5e12

39 files changed

Lines changed: 1245 additions & 654 deletions

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ RUN if [ "$build_dagmc" = "on" ]; then \
9696
# Install addition packages required for DAGMC
9797
apt-get -y install libeigen3-dev libnetcdf-dev libtbb-dev libglfw3-dev \
9898
&& pip install --upgrade numpy \
99+
&& pip install --no-cache-dir setuptools cython \
99100
# Clone and install EMBREE
100101
&& mkdir -p $HOME/EMBREE && cd $HOME/EMBREE \
101102
&& git clone --single-branch -b ${EMBREE_TAG} --depth 1 ${EMBREE_REPO} \

docs/source/pythonapi/base.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ Simulation Settings
3737

3838
openmc.read_source_file
3939
openmc.write_source_file
40-
openmc.wwinp_to_wws
4140

4241
Material Specification
4342
----------------------
@@ -262,8 +261,16 @@ Variance Reduction
262261
:template: myclass
263262

264263
openmc.WeightWindows
264+
openmc.WeightWindowsList
265265
openmc.WeightWindowGenerator
266+
267+
.. autosummary::
268+
:toctree: generated
269+
:nosignatures:
270+
:template: myfunction.rst
271+
266272
openmc.hdf5_to_wws
273+
openmc.wwinp_to_wws
267274

268275

269276
Coarse Mesh Finite Difference Acceleration

docs/source/pythonapi/capi.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ Classes
9191
SurfaceFilter
9292
Tally
9393
SensitivityTally
94+
TemporarySession
9495
UniverseFilter
9596
UnstructuredMesh
9697
WeightFilter

docs/source/usersguide/install.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -515,10 +515,13 @@ to install the Python package in :ref:`"editable" mode <devguide_editable>`.
515515
Prerequisites
516516
-------------
517517

518-
The Python API works with Python 3.8+. In addition to Python itself, the API
519-
relies on a number of third-party packages. All prerequisites can be installed
520-
using Conda_ (recommended), pip_, or through the package manager in most Linux
521-
distributions.
518+
In addition to Python itself, the OpenMC Python API relies on a number of
519+
third-party packages. All prerequisites can be installed using Conda_
520+
(recommended), pip_, or through the package manager in most Linux distributions.
521+
The current required Python version and up-to-date list of package dependencies
522+
can be found in the `pyproject.toml <https://github.com/openmc-dev/openmc/blob/develop/pyproject.toml>`_
523+
file in the root directory of the OpenMC repository. An overview of these
524+
dependencies is provided below.
522525

523526
.. admonition:: Required
524527
:class: error

docs/source/usersguide/variance_reduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ solver, the Python input just needs to load the h5 file::
162162

163163
settings.weight_window_checkpoints = {'collision': True, 'surface': True}
164164
settings.survival_biasing = False
165-
settings.weight_windows = openmc.hdf5_to_wws('weight_windows.h5')
165+
settings.weight_windows = openmc.WeightWindowsList.from_hdf5('weight_windows.h5')
166166
settings.weight_windows_on = True
167167

168168
The :class:`~openmc.WeightWindowGenerator` instance is not needed to load an

include/openmc/particle_data.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ struct SourceSite {
5050
int delayed_group {0};
5151
int surf_id {0};
5252
int fission_nuclide;
53+
int surf_id {SURFACE_NONE};
5354
ParticleType particle;
5455

5556
// Extra attributes that don't show up in source written to file
@@ -442,6 +443,7 @@ class ParticleData : public GeometryState {
442443

443444
double wgt_ {1.0};
444445
double wgt_born_ {1.0};
446+
double wgt_ww_born_ {-1.0};
445447
double mu_;
446448
double time_ {0.0};
447449
double time_last_ {0.0};
@@ -556,6 +558,10 @@ class ParticleData : public GeometryState {
556558
double& wgt_born() { return wgt_born_; }
557559
double wgt_born() const { return wgt_born_; }
558560

561+
// Weight window value at birth
562+
double& wgt_ww_born() { return wgt_ww_born_; }
563+
const double& wgt_ww_born() const { return wgt_ww_born_; }
564+
559565
// Statistic weight of particle at last collision
560566
double& wgt_last() { return wgt_last_; }
561567
const double& wgt_last() const { return wgt_last_; }

include/openmc/random_ray/flat_source_domain.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class FlatSourceDomain {
3434

3535
int64_t add_source_to_scalar_flux();
3636
virtual void batch_reset();
37-
void convert_source_regions_to_tallies();
37+
void convert_source_regions_to_tallies(int64_t start_sr_id);
3838
void reset_tally_volumes();
3939
void random_ray_tally();
4040
virtual void accumulate_iteration_flux();

include/openmc/source.h

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ class IndependentSource : public Source {
139139
DomainType domain_type() const { return domain_type_; }
140140
const std::unordered_set<int32_t>& domain_ids() const { return domain_ids_; }
141141

142+
// Setter for spatial distribution
143+
void set_space(UPtrSpace space) { space_ = std::move(space); }
144+
142145
protected:
143146
// Indicates whether derived class already handles constraints
144147
bool constraints_applied() const override { return true; }
@@ -205,6 +208,23 @@ typedef unique_ptr<Source> create_compiled_source_t(std::string parameters);
205208
//! Mesh-based source with different distributions for each element
206209
//==============================================================================
207210

211+
// Helper class to sample spatial position on a single mesh element
212+
class MeshElementSpatial : public SpatialDistribution {
213+
public:
214+
MeshElementSpatial(int32_t mesh_index, int elem_index)
215+
: mesh_index_(mesh_index), elem_index_(elem_index)
216+
{}
217+
218+
//! Sample a position from the distribution
219+
//! \param seed Pseudorandom number seed pointer
220+
//! \return Sampled position
221+
Position sample(uint64_t* seed) const override;
222+
223+
private:
224+
int32_t mesh_index_ {C_NONE}; //!< Index in global meshes array
225+
int elem_index_; //! Index of mesh element
226+
};
227+
208228
class MeshSource : public Source {
209229
public:
210230
// Constructors
@@ -219,18 +239,15 @@ class MeshSource : public Source {
219239
double strength() const override { return space_->total_strength(); }
220240

221241
// Accessors
222-
const std::unique_ptr<Source>& source(int32_t i) const
242+
const unique_ptr<IndependentSource>& source(int32_t i) const
223243
{
224244
return sources_.size() == 1 ? sources_[0] : sources_[i];
225245
}
226246

227-
protected:
228-
bool constraints_applied() const override { return true; }
229-
230247
private:
231248
// Data members
232-
unique_ptr<MeshSpatial> space_; //!< Mesh spatial
233-
vector<std::unique_ptr<Source>> sources_; //!< Source distributions
249+
unique_ptr<MeshSpatial> space_; //!< Mesh spatial
250+
vector<unique_ptr<IndependentSource>> sources_; //!< Source distributions
234251
};
235252

236253
//==============================================================================

0 commit comments

Comments
 (0)