Updates to libmesh init and track length estimator

This commit is contained in:
Patrick Shriwise 2019-12-09 18:53:55 -06:00
parent abf7195251
commit 941a068ed6
5 changed files with 15 additions and 4 deletions

View file

@ -28,7 +28,7 @@ namespace openmc {
namespace settings {
#ifdef LIBMESH
extern std::unique_ptr<libMesh::LibMeshInit> LMI;
extern libMesh::LibMeshInit* LMI;
#endif
// Boolean flags

View file

@ -142,6 +142,10 @@ int openmc_finalize()
if (mpi::bank != MPI_DATATYPE_NULL) MPI_Type_free(&mpi::bank);
#endif
#ifdef LIBMESH
delete settings::LMI;
#endif
return 0;
}

View file

@ -56,7 +56,7 @@ int openmc_init(int argc, char* argv[], const void* intracomm)
#endif
#ifdef LIBMESH
settings::LMI = std::unique_ptr<libMesh::LibMeshInit>(new libMesh::LibMeshInit(argc, argv));
settings::LMI = new libMesh::LibMeshInit(argc, argv);
#endif

View file

@ -2280,8 +2280,15 @@ LibMesh::intersect_track(libMesh::Point start,
// make sure we found a hit for the tet we're in
if (side == -1) {
auto orig_e = e;
start += dir * TINY_BIT; // nudge particle forward
e = (*point_locator_)(start);
if (!e) {
if (!orig_e->on_boundary()) {
std::cout << "May have incorrectly truncated a track." << std::endl;
}
return;
}
continue;
} else {
// add hit to output
@ -2299,7 +2306,7 @@ LibMesh::intersect_track(libMesh::Point start,
// if we exit the mesh, check for re-entry along
// the track
if (!next_e and e->on_boundary()) {
if (!next_e) {
auto result = locate_boundary_element(start + dir * TINY_BIT,
start + dir * track_remaining);
if (result.second) {

View file

@ -38,7 +38,7 @@ namespace openmc {
namespace settings {
#ifdef LIBMESH
std::unique_ptr<libMesh::LibMeshInit> LMI;
libMesh::LibMeshInit* LMI;
#endif
// Default values for boolean flags