Skip to content

Commit 51b8047

Browse files
authored
Merge pull request #52 from pshriwise/vac-bound-particle-tool
Treat vacuum boundary condition as such in particle simulation tool
2 parents d748ca6 + 52c09c8 commit 51b8047

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

tools/particle_sim.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ void cross_surface()
7777
{
7878
n_events_++;
7979
log("Event {} for particle {}", n_events_, id_);
80+
auto boundary_condition = xdg_->mesh_manager()->get_surface_property(surface_intersection_.second, PropertyType::BOUNDARY_CONDITION);
81+
log("Particle crossing surface {}. Boundary condition: {}", surface_intersection_.second, boundary_condition.value);
8082
// check for the surface boundary condition
81-
if (xdg_->mesh_manager()->get_surface_property(surface_intersection_.second, PropertyType::BOUNDARY_CONDITION).value == "reflecting") {
83+
if (boundary_condition.value == "reflecting") {
8284
log("Particle {} reflects off surface {}", id_, surface_intersection_.second);
8385
log("Direction before reflection: ({}, {}, {})", u_.x, u_.y, u_.z);
8486

@@ -96,6 +98,9 @@ void cross_surface()
9698
log("Resetting particle history to last intersection");
9799
history_ = {history_.back()};
98100
}
101+
} else if (boundary_condition.value == "vacuum") {
102+
log("Particle crossing vacuum boundary. Terminating...");
103+
alive_ = false;
99104
} else {
100105
volume_ = xdg_->mesh_manager()->next_volume(volume_, surface_intersection_.second);
101106
log("Particle {} enters volume {}", id_, volume_);

0 commit comments

Comments
 (0)