Unexpected NaN Values in Particle Position Computation
Bug Description
Unexpected behavior in particle position computation leading to NaN values.
Steps to Reproduce
- Run a simple simulation using the latest OpenMC version.
Simulation example
- Geometry Description: Water-filled sphere centerd at the origin surrounded by a vacuum region.
- Materials Used: The only material defined is water.
-
Particle Source: An isotropic point source of neutrons is placed at the origin
(0, 0, 0)with an energy distribution defined as a discrete energy of 1e6 MeV. - The simulation is set to run in fixed source mode with 1,000,000 particles and 100 batches.
- Include the following modification (under this line in
particle.cppfile):
if ((this)->E_last()*1e8 < 10)
{
std::cout << "p->E_last() "<< (this)->E_last() <<std::endl;
std::cout << "p->r() "<< this->r().x<<" "<<this->r().y<<" "<<this->r().z<<" "<<std::endl;
}
- Recompile the project:
cmake ../openmc
-DCMAKE_CXX_COMPILER=mpicxx
-DOPENMC_USE_MPI=on
-DHDF5_PREFER_PARALLEL=on
-DCMAKE_INSTALL_PREFIX=/root/OpenMC/install
make install
Observed Behavior
The code prints nan values for the position of the particle the once in around 15 batches.
Here is an example for such case:
p->E_last() 4.33725e-08
p->r() nan nan nan
Expected Behavior
The particle position should be well-defined and should not result in NaN values.
Environment
OpenMC official Docker image.
Might be related: https://openmc.discourse.group/t/segmentation-fault-on-simple-model-after-many-particles/3250
Just noting this comment on the geometry description this morning:
Geometry Description: Water-filled sphere centerd at the origin surrounded by a vacuum region.
@Itay-max, is this based on the same geometry as the one @shimwell provided in the forum discussion you've linked above?