Skip to content

Commit

Permalink
Ensure particle direction is normalized for plotting / volume calcula…
Browse files Browse the repository at this point in the history
…tions (#2816)
  • Loading branch information
paulromano authored Dec 28, 2023
1 parent 4116566 commit 2e4811b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion include/openmc/plot.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef OPENMC_PLOT_H
#define OPENMC_PLOT_H

#include <cmath>
#include <sstream>
#include <unordered_map>

Expand Down Expand Up @@ -200,7 +201,7 @@ T SlicePlotBase::get_map() const
xyz[out_i] = origin_[out_i] + width_[1] / 2. - out_pixel / 2.;

// arbitrary direction
Direction dir = {0.7071, 0.7071, 0.0};
Direction dir = {1. / std::sqrt(2.), 1. / std::sqrt(2.), 0.0};

#pragma omp parallel
{
Expand Down
2 changes: 1 addition & 1 deletion src/volume_calc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ vector<VolumeCalculation::Result> VolumeCalculation::execute() const
p.n_coord() = 1;
Position xi {prn(&seed), prn(&seed), prn(&seed)};
p.r() = lower_left_ + xi * (upper_right_ - lower_left_);
p.u() = {0.5, 0.5, 0.5};
p.u() = {1. / std::sqrt(3.), 1. / std::sqrt(3.), 1. / std::sqrt(3.)};

// If this location is not in the geometry at all, move on to next block
if (!exhaustive_find_cell(p))
Expand Down

0 comments on commit 2e4811b

Please sign in to comment.