Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
226 commits
Select commit Hold shift + click to select a range
282ba43
First prototype for temperature field
JoffreyDorville Dec 15, 2025
cf19709
Clean event identifiers for history-based transport
JoffreyDorville Dec 15, 2025
032275a
New particle attribute for the next event
JoffreyDorville Dec 15, 2025
8a138da
Cleaning
JoffreyDorville Dec 15, 2025
d29e700
Common update function for the particle temperature
JoffreyDorville Dec 15, 2025
2e5e0c9
Cleaning
JoffreyDorville Dec 15, 2025
ba02d46
Cleaning
JoffreyDorville Dec 15, 2025
5c52c5f
Add temperature values during the initialization for thermal scatteri…
JoffreyDorville Dec 17, 2025
06f27c7
Clean Python API
JoffreyDorville Dec 19, 2025
d20e3ea
Regression test
JoffreyDorville Dec 19, 2025
6c9b918
Update documentation
JoffreyDorville Dec 20, 2025
4b660d6
Create a main C++ ScalarField class
JoffreyDorville Dec 20, 2025
3b3b32f
Check that size of mesh and size of values are consistent in the fiel…
JoffreyDorville Dec 20, 2025
6dd684d
Formatting
JoffreyDorville Dec 20, 2025
76cdf20
Manage incompatibility with event-based mode
JoffreyDorville Dec 20, 2025
49bfb76
Unit test for the distance to next boundary method
JoffreyDorville Dec 20, 2025
5e79b7b
Missing init file in new regression test
JoffreyDorville Jan 15, 2026
0c67016
Formatting
JoffreyDorville Jan 15, 2026
2ee8edb
First attempt to enable event-based mode
JoffreyDorville Mar 24, 2026
cd4443b
Revert error message for incompatibility with event-based mode
JoffreyDorville Mar 24, 2026
aef0709
Formatting
JoffreyDorville Mar 24, 2026
091925a
Cleaning
JoffreyDorville Mar 24, 2026
b0b28ba
Add distance_to_next_boundary() tests for rectilinear, cylindrical, a…
JoffreyDorville Mar 31, 2026
d886d44
Initialize coord_ with an element to be compatible with p.r() at Part…
JoffreyDorville Mar 31, 2026
cf903c8
C++ unit tests for temperature fields
JoffreyDorville Mar 31, 2026
b1e4fee
C API interface to update temperature values in the temperature field
JoffreyDorville Mar 31, 2026
68d8d9c
C API documentation update
JoffreyDorville Apr 1, 2026
614564b
Remove unused function in Python API
JoffreyDorville Apr 1, 2026
7bee829
Test that the number of temperature values given is consistent with t…
JoffreyDorville Apr 1, 2026
78529b5
Fix XML reader
JoffreyDorville Apr 1, 2026
d91a64d
Define equality function for ScalarFields
JoffreyDorville Apr 1, 2026
068b92b
Unit test for temperature field - Python API
JoffreyDorville Apr 1, 2026
027c35c
Change fatal_error to throw
JoffreyDorville Apr 1, 2026
1bd1b5c
Unit test temperature field - C++ side
JoffreyDorville Apr 1, 2026
9bd31c1
Merge branch 'develop' into temperate_from_mesh
JoffreyDorville Apr 1, 2026
242a842
Temporarily disable part of temperature field c++ unit tests
JoffreyDorville Apr 2, 2026
967090c
Revert initialization of coord_ and declare n_coord_levels in test in…
JoffreyDorville Apr 2, 2026
a8ddf99
Allow c++ test to be compiled with the DAGMC flag
JoffreyDorville Apr 2, 2026
3420117
Restore c++ unit test
JoffreyDorville Apr 2, 2026
5ddfca2
Formatting
JoffreyDorville Apr 2, 2026
d73f0cf
Change where the temperature update is performed for a field
JoffreyDorville Apr 21, 2026
1e104a9
Add unit test corresponding to the failing case
JoffreyDorville Apr 21, 2026
5e6b409
First attempt to solve the coincidence test case
JoffreyDorville Apr 21, 2026
c954785
Update unit tests
JoffreyDorville Apr 21, 2026
7f79940
Cleaning
JoffreyDorville Apr 23, 2026
d6c7a26
Cleaner minimun distance selection
JoffreyDorville Apr 23, 2026
7b7c80a
More robust search of the distance to the next boundary in structured…
JoffreyDorville Apr 23, 2026
6eaef71
Correction
JoffreyDorville Apr 23, 2026
2c51de4
Add a new attribute to particles to store information on the next tra…
JoffreyDorville Apr 30, 2026
a6f6617
Refactor history-based transport to only have one cross surface event
JoffreyDorville Apr 30, 2026
5e88589
Refactor event-based transport to only have one cross surface event
JoffreyDorville Apr 30, 2026
3bde460
Add temperature field bin and bin next
JoffreyDorville Apr 30, 2026
a5f63bf
Cleaning
JoffreyDorville Apr 30, 2026
7ca5f8f
Temporary function to calculate distance to a regular mesh when the p…
JoffreyDorville Apr 30, 2026
bcd208a
Change signature of distance_to_next_boundary to get bins information
JoffreyDorville Apr 30, 2026
92271f9
Update distance_to_next_boundary
JoffreyDorville Apr 30, 2026
0150a02
Remove unused functions
JoffreyDorville Apr 30, 2026
2311beb
Update particle temperature after locating the new cell
JoffreyDorville Apr 30, 2026
e020118
Manage temperature field bins with boundary conditions
JoffreyDorville May 1, 2026
9949c56
Clean the temperature field interface
JoffreyDorville May 1, 2026
de054db
Update DAGMC part of transport
JoffreyDorville May 1, 2026
6a9bd74
Update field cpp unit tests
JoffreyDorville May 4, 2026
b4954d1
Update regular mesh unit test with new distance to next boundary inte…
JoffreyDorville May 4, 2026
9cf6057
Add distance to mesh boundary from outside for rectilinear meshes
JoffreyDorville May 4, 2026
3c9a810
Update unit tests for rectilinear meshes
JoffreyDorville May 4, 2026
07ad591
Remove tests from features that are no longer available
JoffreyDorville May 5, 2026
d4b2140
Find the temperature field cell of secondary particles for pulse-heig…
JoffreyDorville May 5, 2026
f397a9a
Fix reflective boundary conditions with temperature field
JoffreyDorville May 5, 2026
cd906d7
Regression test - box with reflective BC
JoffreyDorville May 6, 2026
6a8f4a8
Regression test - box with vacuum BC
JoffreyDorville May 6, 2026
549beb0
Simplify the implementation and remove tf_bin_last
JoffreyDorville May 6, 2026
a9fff5a
Fix regular mesh index calculation when point is on the lower boundary
JoffreyDorville May 6, 2026
2e10a5d
Formatting
JoffreyDorville May 6, 2026
8f9f44a
Regression test - box with periodic BC
JoffreyDorville May 6, 2026
1ed498a
Regression test - surrounding box with reflective BC
JoffreyDorville May 6, 2026
2966590
Regression test - surrounding box with vacuum BC
JoffreyDorville May 6, 2026
2155926
Regression test - surrounding box with periodic BC
JoffreyDorville May 6, 2026
1901a85
Cleaning
JoffreyDorville May 14, 2026
f2e1948
Reset DAGMC history after crossing the temperature field only
JoffreyDorville May 14, 2026
6009008
Define next event in random ray transport
JoffreyDorville May 14, 2026
bd6a64f
Warn that the temperature field is ignored with random ray
JoffreyDorville May 14, 2026
0af48ac
Update test results because of the fix on regular mesh index when the…
JoffreyDorville May 15, 2026
24e3659
Manage lattices
JoffreyDorville May 15, 2026
ded9baa
Reorganize regular single cube regression tests
JoffreyDorville May 18, 2026
7f2fd78
Reorganize regular nested cubes regression tests
JoffreyDorville May 18, 2026
22f4eb1
Cleaning
JoffreyDorville May 18, 2026
edb6fb9
Reorganize regular verification scripts
JoffreyDorville May 18, 2026
f48b085
DAGMC regression tests + verification scripts
JoffreyDorville May 18, 2026
0edb912
Lattice verification scripts - nested cubes
JoffreyDorville May 19, 2026
a5952fb
Lattice verification scripts - single cube
JoffreyDorville May 19, 2026
7f96b45
Regression tests - lattices
JoffreyDorville May 19, 2026
c2bb44d
README file for temperature field regression tests
JoffreyDorville May 19, 2026
acb857a
Prepare mesh features for DNP transport
JoffreyDorville Feb 16, 2026
ebed0ba
Field refactoring + velocity field
JoffreyDorville Feb 16, 2026
f6cefc8
Add streamline integrator
JoffreyDorville Feb 16, 2026
98082d5
Retrieve settings
JoffreyDorville Feb 16, 2026
3f165c8
DNP transport function
JoffreyDorville Feb 16, 2026
1dd9a27
Add DNP transport to the main transport solver
JoffreyDorville Feb 16, 2026
c39fd56
Formatting
JoffreyDorville Feb 16, 2026
5512ba5
Cleaning
JoffreyDorville Feb 16, 2026
d11757a
Remove nodal evaluation settings
JoffreyDorville Feb 16, 2026
39edb05
Initial regression tests using regular mesh
JoffreyDorville Feb 16, 2026
0a4eda9
Cleaning
JoffreyDorville Feb 16, 2026
33489e6
Fix inconsistencies after rebase
JoffreyDorville May 20, 2026
a726599
Update regular mesh cell based regression test
JoffreyDorville May 20, 2026
fd57b75
Remove abstraction layer for nested field data
JoffreyDorville May 20, 2026
baf20c8
Formatting
JoffreyDorville May 20, 2026
52da5be
Simplify value accessors
JoffreyDorville May 20, 2026
8c1d004
Cleaning
JoffreyDorville May 22, 2026
57c948c
Evaluate the bin correctly during integration steps
JoffreyDorville May 22, 2026
4e0e010
Use raytracing systematically to determine bins after integration steps
JoffreyDorville May 22, 2026
4ce13cc
Update regression tests results
JoffreyDorville May 22, 2026
841f575
Formatting
JoffreyDorville May 26, 2026
9ad188f
Cleaning - streamline integrator
JoffreyDorville May 26, 2026
6b16dc1
Fix error in adjust_time + cleaning + documentation
JoffreyDorville May 26, 2026
b3eb6cd
Cleaning
JoffreyDorville May 26, 2026
a5698a7
Use norm() + remove distance() and distance_sqrd()
JoffreyDorville May 26, 2026
b30b782
Use get_mesh_bin() instead of get_bin()
JoffreyDorville May 26, 2026
9839411
Remove any_cast now that we simplified the data field concept
JoffreyDorville May 27, 2026
fffa768
Protect trilinear interpolation from extrapolation
JoffreyDorville May 27, 2026
78d3829
Clean field evaluation method
JoffreyDorville May 27, 2026
2251ef6
Check values/mesh size consistency
JoffreyDorville May 27, 2026
5fb13ae
Cleaning and documentation - field
JoffreyDorville May 27, 2026
d3e2953
Documentation updates
paulromano May 28, 2026
8b83aa2
Remove unnecessary docstrings on __init__
paulromano May 28, 2026
b8e2148
Reorder settings
paulromano May 28, 2026
9509b8d
Unit tests - dnp_drift linear adjustment functions
JoffreyDorville May 28, 2026
e83c75e
Use base constructor for fields
JoffreyDorville May 28, 2026
2aeeff0
Reset velocity field to default
JoffreyDorville May 28, 2026
9aab1ff
cpp unit tests - Field
JoffreyDorville Jun 2, 2026
f737d61
cpp unit tests - VelocityField
JoffreyDorville Jun 2, 2026
720d5ab
Update field.h documentation
JoffreyDorville Jun 2, 2026
c8b022b
Use bin as parameter in normalize_coordinates instead of using a call…
JoffreyDorville Jun 4, 2026
6abb6c3
Rename Field.get_mesh_bin() to Field.get_bin()
JoffreyDorville Jun 4, 2026
45c6c10
Rename Field.evaluate(r, bin) to Field.evaluate_in_mesh(r, bin)
JoffreyDorville Jun 4, 2026
3c655ec
Rename full_raytracing to bins_and_surface_bins_crossed
JoffreyDorville Jun 4, 2026
c52cc67
Rename randomly_place_on_physical_group to sample_on_physical_groups
JoffreyDorville Jun 4, 2026
b59809d
Rename get_last_bin_inside_mesh to get_bin_clamped
JoffreyDorville Jun 4, 2026
47e78d9
Rename Field.evaluate(r0, r1, bin) to Field.evaluate_clamped(r0, r1, …
JoffreyDorville Jun 4, 2026
2caa02d
Cleaning
JoffreyDorville Jun 4, 2026
f8baa84
Code documentation
JoffreyDorville Jun 4, 2026
86b032e
Use mesh fixture in cpp tests
JoffreyDorville Jun 4, 2026
3769846
Use mesh fixture in field cpp tests
JoffreyDorville Jun 4, 2026
9d95e18
Test RegularMesh.face_area()
JoffreyDorville Jun 4, 2026
0956a78
Test RegularMesh.sample_on_face()
JoffreyDorville Jun 4, 2026
16e0389
Test RegularMesh.return_vertex_unique_id()
JoffreyDorville Jun 4, 2026
42d8fd4
Cleaning
JoffreyDorville Jun 4, 2026
d7262e4
Formatting
JoffreyDorville Jun 4, 2026
664c675
Test RegularMesh.connectivity()
JoffreyDorville Jun 4, 2026
564cd6a
Add custom matcher for Position objects
JoffreyDorville Jun 5, 2026
e616ae3
Test RegularMesh.normalize_coordinates()
JoffreyDorville Jun 5, 2026
2fb2ed3
Cleaning
JoffreyDorville Jun 5, 2026
7821eb6
Test RegularMesh.bins_and_surface_bins_crossed()
JoffreyDorville Jun 5, 2026
ee67a76
Check that r0 is inside the mesh using bin0 in get_next_bin()
JoffreyDorville Jun 5, 2026
8a86e7f
Ensure values are written when the mesh is shared
JoffreyDorville Jun 15, 2026
2a0ecf1
Add openmc_temperature_field_set_temperature to the C API
JoffreyDorville Jun 15, 2026
d696229
Clean docstring for get_temperature(int)
JoffreyDorville Jun 15, 2026
376c2c8
Add settings documentation for temperature_field
JoffreyDorville Jun 15, 2026
7ff1402
Add consistency checks in field Python classes
JoffreyDorville Jun 16, 2026
98401f6
Merge branch 'develop' into temperate_from_mesh
JoffreyDorville Jun 16, 2026
c46c859
Update regression test because of the fix on get_index_direction for …
JoffreyDorville Jun 29, 2026
e517af4
Remove verification scripts and relocate them in a new repo
JoffreyDorville Jun 29, 2026
b05aeac
Update DAGMC test models
JoffreyDorville Jul 2, 2026
072089a
Remove unused event timer for temperature mesh crossing
JoffreyDorville Jul 20, 2026
6764526
Merge branch 'develop' into temperate_from_mesh
JoffreyDorville Aug 6, 2026
1227d54
Add two C API handles for the temperature field
JoffreyDorville Aug 6, 2026
028ea83
Merge branch 'temperate_from_mesh' into dnp_drift_integration
JoffreyDorville Aug 13, 2026
363ddd5
Remove unused meshes in cpp unit tests
JoffreyDorville Aug 13, 2026
f0be065
Formatting
JoffreyDorville Aug 13, 2026
b33d338
Fix __init__.py from microxs regression tests
JoffreyDorville Aug 13, 2026
7d4218e
Fix io formats documentation
paulromano Aug 14, 2026
56b1a09
Simplify type check
paulromano Aug 14, 2026
33aa6b6
Fix docstring
JoffreyDorville Aug 17, 2026
eeedc52
Update test due to PR #3934
JoffreyDorville Aug 19, 2026
04ef8be
Merge branch 'develop' into temperate_from_mesh
JoffreyDorville Aug 20, 2026
a7e013e
Formatting
JoffreyDorville Aug 20, 2026
5f4dcfc
Update skipif statement for DAGMC tests
JoffreyDorville Aug 20, 2026
5d3104a
Update error type for type check test
JoffreyDorville Aug 20, 2026
69e6c9f
Merge branch 'temperate_from_mesh' into dnp_drift_integration
JoffreyDorville Aug 21, 2026
55ab6c0
Prepare unit tests for DNP transport
JoffreyDorville Aug 21, 2026
2b76ac9
Formatting
JoffreyDorville Aug 21, 2026
cc153c2
Simplify DNP transport algorithm
JoffreyDorville Aug 21, 2026
ae81358
Change time before decay logic
JoffreyDorville Aug 21, 2026
61ba1b5
Enable failing test after fix
JoffreyDorville Aug 21, 2026
55e98b3
Manage the case where a DNP is exactly on a mesh boundary
JoffreyDorville Aug 21, 2026
4178feb
Enable unit test where DNP is exactly on a mesh boundary
JoffreyDorville Aug 21, 2026
86a17ed
Add boundary reconcialiation for drifted DNPs - initial implementation
JoffreyDorville Aug 24, 2026
aa82c1a
Update tests with new boundary reconciliation feature
JoffreyDorville Aug 24, 2026
a118647
Update C++ unit tests as well
JoffreyDorville Aug 24, 2026
8f304a6
Update test
JoffreyDorville Aug 25, 2026
d27e07e
Add get_bin_clamped() c++ unit tests
JoffreyDorville Aug 25, 2026
e3a737e
Initialize sample_on_physical_groups unit test
JoffreyDorville Aug 25, 2026
6f4d67a
Use a smart pointer for streamline_integrator
JoffreyDorville Aug 26, 2026
2c61094
Test get_bin_clamped with a rectilinear mesh
JoffreyDorville Aug 26, 2026
f48a7bf
Finalize unit tests for sample_on_physical_groups
JoffreyDorville Aug 26, 2026
eff1390
Merge regular and rectilinear mesh tests
JoffreyDorville Aug 26, 2026
189cb1a
Merge more regular and rectilinear mesh tests
JoffreyDorville Aug 26, 2026
e0e8feb
Protect sample_on_physical_groups from duplicated faces
JoffreyDorville Aug 26, 2026
ced6298
CHECK instead of REQUIRE
JoffreyDorville Aug 26, 2026
652943f
Formatting
JoffreyDorville Aug 26, 2026
95cc8c2
Update tests after sorting face_ids in sample_on_physical_groups
JoffreyDorville Aug 26, 2026
5f481a9
Formatting
JoffreyDorville Aug 26, 2026
37cbf4d
Check for duplicate face IDs in the user-declared settings
JoffreyDorville Aug 26, 2026
b95b697
Add unit tests for reconcile_precursor_drift
JoffreyDorville Aug 27, 2026
dbb51ab
Manage albedo effects on DNP
JoffreyDorville Aug 27, 2026
e54164c
Zero-initialize site
JoffreyDorville Aug 28, 2026
c8f9082
Formatting
JoffreyDorville Aug 28, 2026
e55f7f9
Temporary debug
JoffreyDorville Aug 28, 2026
b204058
Formatting
JoffreyDorville Aug 28, 2026
150a2f3
Ensure model.xml is fully written to disk before openmc_init reads it
JoffreyDorville Aug 28, 2026
e2ea3d7
Refactor boundary conditions to get access to the transformed directi…
JoffreyDorville Aug 28, 2026
6f608b2
Fix openmc_init call in test_dnp_drift.cpp
JoffreyDorville Aug 28, 2026
7e193da
Extend reconcile_precursor_drift to handle all boundary condition types
JoffreyDorville Aug 28, 2026
7ffdec2
Check positions and directions explicitly in c++ unit tests
JoffreyDorville Sep 1, 2026
2637df6
Add periodic and white BC cases in c++ unit tests
JoffreyDorville Sep 1, 2026
5e48e56
Generalize the reconcile function - prototype
JoffreyDorville Sep 1, 2026
6616ec5
Formatting
JoffreyDorville Sep 1, 2026
b2446ec
Clean reconcile function
JoffreyDorville Sep 1, 2026
dcf7272
Add c++ unit tests for particles traveling along external boundary pl…
JoffreyDorville Sep 1, 2026
445a89b
Remove internal crossing c++ unit tests
JoffreyDorville Sep 1, 2026
76fec15
Improve white boundary cases
JoffreyDorville Sep 1, 2026
ca59ff2
Update docstrings
JoffreyDorville Sep 1, 2026
e7e59b2
Use the particle ID to initialize the RNG seed used for the white BC …
JoffreyDorville Sep 1, 2026
8690dcd
Update signature of reconcile function in c++ unit tests
JoffreyDorville Sep 1, 2026
5be05ce
Apply white BC in the c++ unit test
JoffreyDorville Sep 1, 2026
63454e9
Add a RAII guard to ensure cleanup happens even if the test fails
JoffreyDorville Sep 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,12 @@ list(APPEND libopenmc_SOURCES
src/distribution_energy.cpp
src/distribution_multi.cpp
src/distribution_spatial.cpp
src/dnp_drift.cpp
src/eigenvalue.cpp
src/endf.cpp
src/error.cpp
src/event.cpp
src/field.cpp
src/file_utils.cpp
src/finalize.cpp
src/geometry.cpp
Expand Down Expand Up @@ -442,6 +444,7 @@ list(APPEND libopenmc_SOURCES
src/simulation.cpp
src/source.cpp
src/state_point.cpp
src/streamline_integrator.cpp
src/string_utils.cpp
src/summary.cpp
src/surface.cpp
Expand Down
6 changes: 6 additions & 0 deletions docs/source/capi/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1007,3 +1007,9 @@ Functions
:type scores: const int*
:return: Return status (negative if an error occurred)
:rtype: int

.. doxygenfunction:: openmc_temperature_field_set_temperature

.. doxygenfunction:: openmc_temperature_field_size

.. doxygenfunction:: openmc_temperature_field_get_value
21 changes: 21 additions & 0 deletions docs/source/io_formats/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,27 @@ a material default temperature.

*Default*: 293.6 K

.. _temperature_field:

-------------------------------
``<temperature_field>`` Element
-------------------------------

The ``<temperature_field>`` element specifies temperatures in a model in Kelvin
using a temperature field based on a geometric mesh. Temperatures declared using
a temperature field take precedence over all other temperature definition (cell,
material, and global). This element has the following sub-elements:

:mesh:
The ID of the geometric mesh on which the temperature field is defined.

:values:
A whitespace-separated list of temperatures in Kelvin, with one value for
each mesh element. The number of values must match the number of mesh
elements.

*Default*: None

.. _temperature_method:

--------------------------------
Expand Down
11 changes: 11 additions & 0 deletions docs/source/pythonapi/base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,17 @@ Meshes
openmc.SphericalMesh
openmc.UnstructuredMesh

Fields
------

.. autosummary::
:toctree: generated
:nosignatures:
:template: myclassinherit.rst

openmc.ScalarField
openmc.TemperatureField

Geometry Plotting
-----------------

Expand Down
32 changes: 32 additions & 0 deletions docs/source/usersguide/materials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,38 @@ attribute, e.g.,
:attr:`Material.temperature` or :attr:`Cell.temperature`
attributes, respectively.

Alternatively, temperatures can be specified using a temperature field composed
of a mesh and a map that associates a temperature value to each mesh element.
During the simulation, temperatures associated with particles are also updated
every time a temperature field mesh surface is crossed. While a particle is
contained inside the temperature mesh, temperatures from the temperature field
take precedence over any temperature declared for a cell, a material, or
globally.

The following example shows how to specify temperatures using a temperature
field based on a regular mesh:

.. code-block:: python

# Define a mesh
dim = 5
mesh = openmc.RegularMesh()
mesh.lower_left = (0., 0., 0.)
mesh.upper_right = (10.0, 10.0, 10.0)
mesh.dimension = (dim, dim, dim)

# Define temperature values for each mesh element
temperature_values = [273.0 + i * 10 for i in range(dim**3)]

# Create a temperature field
temperature_field = openmc.TemperatureField(mesh, temperature_values)

# Register the temperature field in the settings
settings = openmc.Settings()
settings.temperature_field = temperature_field

.. note:: Temperature fields are currently limited to structured meshes only.

-----------------
Material Mixtures
-----------------
Expand Down
68 changes: 61 additions & 7 deletions include/openmc/boundary_condition.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,38 @@ class BoundaryCondition {
public:
virtual ~BoundaryCondition() = default;

//! Apply the geometric transformation.
//! \param[in] p Particle
//! \param[in] surf Current surface
//! \param[out] new_r Transformed position
//! \param[out] new_u Transformed direction
//! \param[out] new_surface New surface index
virtual void transform(Particle& p, const Surface& surf, Position& new_r,
Direction& new_u, int& new_surface) const = 0;

//! Handle the crossing of the boundary condition by the particle
//! \param[inout] p Particle
//! \param[in] surf Current surface
//! \param[in] new_r Transformed position
//! \param[in] new_u Transformed direction
//! \param[in] new_surface New surface index
virtual void cross_bc(Particle& p, const Surface& surf, const Position& new_r,
const Direction& new_u, int new_surface) const = 0;

//! Perform tracking operations for a particle that strikes the boundary.
//! \param p The particle that struck the boundary. This class is not meant
//! to directly modify anything about the particle, but it will do so
//! indirectly by calling the particle's appropriate cross_*_bc function.
//! \param surf The specific surface on the boundary the particle struck.
virtual void handle_particle(Particle& p, const Surface& surf) const = 0;
virtual void handle_particle(Particle& p, const Surface& surf) const
{
Position new_r;
Direction new_u;
int new_surface;
transform(p, surf, new_r, new_u, new_surface);
BoundaryCondition::handle_albedo(p, surf);
cross_bc(p, surf, new_r, new_u, new_surface);
}

//! Modify the incident particle's weight according to the boundary's albedo.
//! \param p The particle that struck the boundary. This function calculates
Expand Down Expand Up @@ -64,6 +90,9 @@ class BoundaryCondition {
//! Return if this BC has an albedo.
bool has_albedo() const { return (albedo_ > 0.0); }

//! Return albedo value.
double albedo() const { return albedo_; }

private:
double albedo_ = -1.0;
};
Expand All @@ -74,6 +103,16 @@ class BoundaryCondition {

class VacuumBC : public BoundaryCondition {
public:
// Not used - handle_particle is fully overriden
void transform(Particle& p, const Surface& surf, Position& new_r,
Direction& new_u, int& new_surface) const override
{}

// Not used - handle_particle is fully overriden
void cross_bc(Particle& p, const Surface& surf, const Position& new_r,
const Direction& new_u, int new_surface) const override
{}

void handle_particle(Particle& p, const Surface& surf) const override;

std::string type() const override { return "vacuum"; }
Expand All @@ -85,7 +124,11 @@ class VacuumBC : public BoundaryCondition {

class ReflectiveBC : public BoundaryCondition {
public:
void handle_particle(Particle& p, const Surface& surf) const override;
void transform(Particle& p, const Surface& surf, Position& new_r,
Direction& new_u, int& new_surface) const override;

void cross_bc(Particle& p, const Surface& surf, const Position& new_r,
const Direction& new_u, int new_surface) const override;

std::string type() const override { return "reflective"; }
};
Expand All @@ -96,7 +139,11 @@ class ReflectiveBC : public BoundaryCondition {

class WhiteBC : public BoundaryCondition {
public:
void handle_particle(Particle& p, const Surface& surf) const override;
void transform(Particle& p, const Surface& surf, Position& new_r,
Direction& new_u, int& new_surface) const override;

void cross_bc(Particle& p, const Surface& surf, const Position& new_r,
const Direction& new_u, int new_surface) const override;

std::string type() const override { return "white"; }
};
Expand Down Expand Up @@ -128,7 +175,11 @@ class TranslationalPeriodicBC : public PeriodicBC {
public:
TranslationalPeriodicBC(int i_surf, int j_surf);

void handle_particle(Particle& p, const Surface& surf) const override;
void transform(Particle& p, const Surface& surf, Position& new_r,
Direction& new_u, int& new_surface) const override;

void cross_bc(Particle& p, const Surface& surf, const Position& new_r,
const Direction& new_u, int new_surface) const override;

protected:
//! Vector along which incident particles will be moved
Expand All @@ -145,9 +196,12 @@ class RotationalPeriodicBC : public PeriodicBC {
public:
enum PeriodicAxis { x, y, z };
RotationalPeriodicBC(int i_surf, int j_surf, PeriodicAxis axis);
double compute_periodic_rotation(
double rise_1, double run_1, double rise_2, double run_2) const;
void handle_particle(Particle& p, const Surface& surf) const override;

void transform(Particle& p, const Surface& surf, Position& new_r,
Direction& new_u, int& new_surface) const override;

void cross_bc(Particle& p, const Surface& surf, const Position& new_r,
const Direction& new_u, int new_surface) const override;

protected:
//! Angle about the axis by which particle coordinates will be rotated
Expand Down
20 changes: 20 additions & 0 deletions include/openmc/capi.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,26 @@ int openmc_tally_set_nuclides(int32_t index, int n, const char** nuclides);
int openmc_tally_set_scores(int32_t index, int n, const char** scores);
int openmc_tally_set_type(int32_t index, const char* type);
int openmc_tally_set_writable(int32_t index, bool writable);

//! Set a value at a given index in the temperature field
//
//! \param[in] index Index in the field
//! \param[in] temperature Temperature value to apply
//! \return Status (negative if an error occurred)
int openmc_temperature_field_set_temperature(int32_t index, double temperature);

//! Return the temperature field size (number of cells)
//
//! \return Number of cell in the temperature field
size_t openmc_temperature_field_size();

//! Get the value at a given index in the temperature field
//
//! \param[in] index Index in the field
//! \param[out] temperature Temperature value at the given index
//! \return Status (negative if an error occurred)
int openmc_temperature_field_get_value(int32_t index, double* temperature);

int openmc_get_weight_windows_index(int32_t id, int32_t* idx);
int openmc_weight_windows_get_id(int32_t index, int32_t* id);
int openmc_weight_windows_set_id(int32_t index, int32_t id);
Expand Down
8 changes: 8 additions & 0 deletions include/openmc/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,14 @@ enum class GeometryType { CSG, DAG };
// representations. This value represents no surface.
constexpr int32_t SURFACE_NONE {0};

//==============================================================================
// EVENT IDENTIFIER IN HISTORY-BASED TRANSPORT

const int EVENT_UNDEFINED = 0;
const int EVENT_CROSS_SURFACE = 1;
const int EVENT_COLLIDE = 2;
const int EVENT_TIME_CUTOFF = 3;

} // namespace openmc

#endif // OPENMC_CONSTANTS_H
75 changes: 75 additions & 0 deletions include/openmc/dnp_drift.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#ifndef OPENMC_DNP_DRIFT_H
#define OPENMC_DNP_DRIFT_H

#include "openmc/particle_data.h"
#include "openmc/position.h"

namespace openmc {

const int DNP_DRIFT_TRANSPORT_MAX_ITER =
1000; //! Maximum number of iterations allowed in the DNP transport loop.
const double DNP_DRIFT_DISTANCE_MIN =
1.0E-13; //! Minimum distance between two integration steps before stopping
//! the DNP transport loop.

enum class Actions { REENTER, ESCAPE, DECAY_IN_PLACE };

//! Adjust position linearly.
//!
//! This function is used to adjust the position of a DNP that reached its decay
//! time between two integration steps (i.e., t is greater than decay_time). The
//! final position of the DNP is adjusted linearly so that the time
//! corresponding to this new position is equal to the sampled decay time.
//!
//! \param[in,out] y_n Current position
//! \param[in] y_n_minus_1 Previous position
//! \param[in] t Time at current position
//! \param[in] dt Time step
//! \param[in] decay_time Decay time
void _adjust_position(Position& y_n, const Position& y_n_minus_1, double t,
double dt, double decay_time);

//! Adjust time linearly.
//!
//! This function is used to adjust the time associated with the position of a
//! DNP that needs to be stopped between two integration steps. The position C,
//! where the DNP is stopped, must be located between position A and B. Time is
//! adjusted linearly.
//!
//! \param[in,out] t In: time at position B, out: time at position C
//! \param[in] ta Time at position A
//! \param[in] pa Position A
//! \param[in] pb Position B
//! \param[in] pc Position C (between A and B)
void _adjust_time(double& t, double ta, const Position& pa, const Position& pb,
const Position& pc);

//! Explicitly transport a delayed neutron precursor using streamline
//! integration.
//!
//! \param[in,out] site Fission site corresponding to the DNP
//! \param[in] decay_time Sampled decay time (in seconds)
//! \param[in] seed Random number generator seed
//! \return True if the site is considered inside the explicitly modeled part of
//! the system. False otherwise.
bool transport_dnp(SourceSite& site, double decay_time, uint64_t* seed);

//! Reconcile a delayed neutron precursor source site with the model geometry
//! after mesh-based drift.
//!
//! After transporting a delayed neutron precursor on a mesh, the emission site
//! may land outside the model or on a geometry boundary. This function
//! identifies if the site is valid and applies boundary condition corrections
//! as needed. If the function returns true, the site is guaranteed to be usable
//! for the next fission generation.
//!
//! \param[in,out] site Fission site corresponding to the DNP
//! \param[in] particle_id Particle ID used to initialize the RNG seed for the
//! boundary condition sampling (e.g., white BC).
//!\return True if the site is usable for the next generation, false if the site
//! should be discarded.
bool reconcile_precursor_drift(SourceSite& site, int64_t particle_id);

} // namespace openmc

#endif // OPENMC_DNP_DRIFT_H
4 changes: 4 additions & 0 deletions include/openmc/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ void process_surface_crossing_events();
//! Execute the collision event for all particles in this event's buffer
void process_collision_events();

//! Execute the temperature mesh crossing event for all particles in this
//! event's buffer
void process_temperature_mesh_crossing_events();

//! Execute the death event for all particles
//
//! \param n_particles The number of particles in the particle buffer
Expand Down
Loading
Loading