Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 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
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 @@ -370,10 +370,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 @@ -425,6 +427,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
9 changes: 9 additions & 0 deletions docs/source/capi/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1030,3 +1030,12 @@ Functions
:type scores: const int*
:return: Return status (negative if an error occurred)
:rtype: int

.. c:function:: int openmc_temperature_field_set_temperature(int32_t index, double temperature)

Set the temperature value of a given cell in the temperature field

:param int32_t index: Index in the tempererature mesh
:param double temperature: Temperature in Kelvin
:return: Return status (negative if an error occurred)
:rtype: int
11 changes: 11 additions & 0 deletions docs/source/pythonapi/base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,17 @@ Meshes
openmc.SphericalMesh
openmc.UnstructuredMesh

Fields
------

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

openmc.ScalarField
openmc.TemperatureField

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

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

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

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

.. code-block:: python

# Define a mesh (regular 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 cell
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
8 changes: 8 additions & 0 deletions include/openmc/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,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
57 changes: 57 additions & 0 deletions include/openmc/dnp_drift.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#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 { PLACE_AT_INLET, BLOCK_AT_OUTLET, BLOCK_AT_LOCATION };

//! 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[inout] 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[inout] 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[inout] site Fission site corresponding to the DNP
//! \param[in] decay_time Sampled decay time (in seconds)
//! \param[in] seed Random number generator seed
bool transport_dnp(SourceSite& site, double decay_time, uint64_t* seed);

} // 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 @@ -107,6 +107,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