Skip to content

Commit f72a699

Browse files
committed
nominal fixes for ray trace plots with dagmc
1 parent eee45df commit f72a699

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

openmc/plots.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ def _check_domains_consistent_with_color_by(self, domains):
10971097
'color_by=material')
10981098
else:
10991099
if not isinstance(region, openmc.Cell):
1100-
raise Exception('Domain list must be materials if '
1100+
raise Exception('Domain list must be cells if '
11011101
'color_by=cell')
11021102

11031103
def to_xml_element(self):

src/dagmc.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,8 +764,7 @@ Direction DAGSurface::reflect(Position r, Direction u, GeometryState* p) const
764764
double dir[3];
765765
rval = dagmc_ptr_->get_angle(surf, pnt, dir, &p->history());
766766
MB_CHK_ERR_CONT(rval);
767-
p->last_dir() = u.reflect(dir);
768-
return p->last_dir();
767+
return u.reflect(dir);
769768
}
770769

771770
//==============================================================================

src/plot.cpp

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,18 +1621,7 @@ void Ray::trace()
16211621
return;
16221622
}
16231623

1624-
if (i_surface_ > 0 &&
1625-
model::surfaces[i_surface_]->geom_type_ == GeometryType::DAG) {
1626-
#ifdef DAGMC
1627-
int32_t i_cell = next_cell(
1628-
i_surface_, cell_last(n_coord() - 1), lowest_coord().universe);
1629-
inside_cell = i_cell >= 0;
1630-
#else
1631-
fatal_error("Not compiled for DAGMC, but somehow you have a DAGCell!");
1632-
#endif
1633-
} else {
1634-
inside_cell = exhaustive_find_cell(*this, settings::verbosity >= 10);
1635-
}
1624+
inside_cell = exhaustive_find_cell(*this, settings::verbosity >= 10);
16361625

16371626
if (inside_cell) {
16381627

@@ -1750,7 +1739,10 @@ void PhongRay::on_intersection()
17501739
return;
17511740
}
17521741

1753-
Direction normal = model::surfaces.at(i_surface())->normal(r_local());
1742+
// Get surface pointer
1743+
const auto& surf = model::surfaces.at(i_surface());
1744+
1745+
Direction normal = surf->normal(r_local());
17541746
normal /= normal.norm();
17551747

17561748
// Need to apply translations to find the normal vector in
@@ -1762,7 +1754,7 @@ void PhongRay::on_intersection()
17621754
}
17631755
}
17641756

1765-
if (surface() > 0) {
1757+
if (surf->geom_type_ != GeometryType::DAG && surface() > 0) {
17661758
normal *= -1.0;
17671759
}
17681760

0 commit comments

Comments
 (0)