Class UncollidedProblem

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

class UncollidedProblem : public opensn::LBSProblem

Public Functions

~UncollidedProblem() override
inline virtual void ClearBoundaries() override

Clears all the boundary conditions from the solver.

void BuildSourcePoints()

Generation steps run by UncollidedSolver: locate the point sources, add their images in the reflecting planes, and compute and write the uncollided flux moments.

void AddReflectedSourcePoints()
void Execute(const std::string &file_name, unsigned int progress_interval)

Public Static Functions

static InputParameters GetInputParameters()
static std::shared_ptr<UncollidedProblem> Create(const ParameterBlock &params)

Protected Types

enum class CellRegion

Values:

enumerator NEAR_SOURCE
enumerator BULK

Protected Functions

explicit UncollidedProblem(const InputParameters &params)

Factory-only constructor.

virtual void CheckConfigurationErrors(std::vector<std::string> &errors) const override

Uncollided-generation rules.

virtual void PrintSimHeader() override
virtual void InitializeSpatialDiscretization() override
void BuildSweepOrdering(const SourcePoint &source_point)
std::vector<ReflectionPlane> ComputeReflectionPlanes(std::vector<std::string> &errors) const

Returns the planes of the reflecting boundaries and appends an error for each invalid boundary condition.

virtual void BuildRuntimeData() override

Stores the reflection planes once the configuration has been validated.

void RaytraceNearSourceRegion(const SourcePoint &source_point)
void ProjectReflectedImageSources(unsigned int progress_interval)
std::vector<double> RaytraceLine(RayTracer &ray_tracer, const Cell &cell, const Vector3 &qp_xyz, const SourcePoint &source_point, double tolerance = 1.0e-12)
void RaytraceLineInto(RayTracer &ray_tracer, const Cell &cell, const Vector3 &qp_xyz, const SourcePoint &source_point, std::vector<double> &phi_out, std::vector<std::pair<size_t, double>> &scratch_segs, std::vector<double> &scratch_bp, std::vector<double> &scratch_mfp, double tolerance = 1.0e-12)

Zero-allocation variant: writes into pre-allocated phi_out and reuses the three scratch vectors.

All four buffers must be sized to num_groups_ before the first call (they are reset internally each call, so no manual clearing is needed between calls). On return, scratch_mfp holds the optical depth from the source to qp_xyz per group.

std::optional<ExactCellIntegrals> IntegrateCellExactly(RayTracer &ray_tracer, const Cell &cell, const SourcePoint &source_point)

Integrates the uncollided flux of a point source over a cell, and its leakage through each outgoing face, exactly over direction.

Every direction from the source through the cell leaves it through an outgoing face. Along it the flux is S exp(-tau(r)) / (4 pi r^2), so with tau_in the optical depth from the source to where the ray enters the cell and Delta the chord through the homogeneous cell, the leakage integrand is S exp(-tau_in - sigma_t Delta) / (4 pi) and the volume integrand is S exp(-tau_in) (1 - exp(-sigma_t Delta)) / (4 pi sigma_t). The optical depth comes from ray tracing, so heterogeneous media are handled. For the cell containing the source, the ray starts in the cell, so tau_in = 0 and Delta is the distance to the face.

The directions through each PWL side triangle of each outgoing face are integrated with a composite Gauss-Legendre rule in variables that keep the integrands smooth however close the source is to a face, edge, or vertex, at points that lie on the face.

Returns std::nullopt when a ray from the source could cross the cell more than once: for a cell that does not contain the source, when it is not convex; and for the cell containing the source, when a face is not directly visible from it. Also returns std::nullopt when the source is on the inner side of a face that is not outgoing.

double SubtendedAngleFraction(const Cell &cell, const Vector3 &point) const

Returns the fraction of the full solid angle that a cell subtends at a point on or in it.

The signed solid angles of the PWL side triangles of the cell’s faces are summed, so the result is exact for cells of any shape, including non-convex ones. It is 1 for a point inside the cell, 1/2 on a planar face, and smaller on an edge or vertex.

bool IsConvex(const Cell &cell) const

True when every vertex of the cell lies on the inner side of the plane of every face.

void SweepBulkRegion(const SourcePoint &source_point)
UncollidedMatrices ComputeUncollidedIntegrals(const Cell &cell, const Vector3 &pt_loc)
void UpdateBalance(const SourcePoint &source_point)
void AccumulateMoments(const Vector3 &pt_loc)
void WriteFluxMoments(hid_t file)
void FinalizeBalance(hid_t file)
inline bool IsReflectingBoundary(std::uint64_t boundary_id) const

Protected Attributes

std::vector<std::shared_ptr<LogicalVolume>> near_source_logvols_

Near source region logical volumes.

std::vector<SourcePoint> source_points_
std::vector<SourcePoint> reflected_source_points_
std::vector<std::pair<std::string, std::string>> boundary_conditions_

Boundary conditions as (name, type).

std::vector<ReflectionPlane> reflection_planes_
std::set<std::uint64_t> reflecting_boundary_ids_
std::vector<std::vector<FaceOrientation>> cell_face_orientations_

Cell face orientations for the cells in the local cell graph.

std::vector<size_t> near_spls_

Near source uncollided sweep-plane local subgrid.

std::vector<size_t> bulk_spls_

Bulk region uncollided sweep-plane local subgrid.

std::vector<CellRegion> cell_regions_
std::vector<double> destination_phi_
std::vector<double> cell_sizes_

Bounding-box diagonal for each local cell, pre-computed once for RayTracer tolerance scaling.

bool all_cells_convex_ = true

False when the mesh contains any geometrically non-convex cell; true for standard hex/tet meshes.

std::vector<FaceVertData> all_face_verts_
std::vector<uint32_t> cell_face_offsets_
std::vector<uint32_t> cell_num_faces_
std::unordered_map<uint64_t, uint32_t> global_to_local_id_

O(1) global-to-local cell-ID lookup; replaces two O(log N) std::map calls per while-loop step.

bool use_fast_trace_ = false

True when all_cells_convex_ and all faces have <= FaceVertData::max_sides vertices.

unsigned int ell_max_ = 0
bool exact_near_source_leakage_ = false

Integrate the leakages and volume integrals of the cells that share a vertex with a point source’s cell exactly over direction instead of with spatial quadrature.

std::vector<Moment> moments_
std::vector<std::string> moment_names_
std::vector<std::vector<double>> accumulated_moments_
double production_ = 0.
double physical_removal_ = 0.
double reflected_removal_ = 0.
double out_flow_ = 0.

Protected Static Functions

static inline Vector3 ComputeOmega(const Vector3 &point0, const Vector3 &point1)
struct ExactCellIntegrals

Integrals of the uncollided flux of a point source over a cell.

Public Members

std::vector<double> volume_integral

Volume integral of the scalar flux over the cell, per group.

std::vector<std::vector<double>> face_leakage

Outgoing leakage through each cell face, indexed [face][group]; zero for other faces.

struct FaceVertData

Precomputed face vertex data &#8212; bypasses the std::map-backed VertexHandler in the hot path.

Supports faces with up to max_sides vertices (covers common polyhedral mesh faces).

Public Members

Vector3 verts[max_sides]
Vector3 centroid
uint64_t neighbor_id = 0
uint32_t num_sides = 0
uint32_t pad = 0

Public Static Attributes

static uint32_t max_sides = 8
struct Moment

Public Members

unsigned int ell
int m
struct ReflectionPlane

Public Members

std::uint64_t boundary_id = 0
Vector3 normal
double offset = 0.0
struct SourcePoint

Public Members

Vector3 location
std::vector<double> strength
std::vector<Subscriber> subscribers
std::shared_ptr<LogicalVolume> near_source_logvol
std::vector<ReflectionPlane> reflection_planes
struct Subscriber

Public Members

std::uint32_t cell_local_id = 0
double volume_weight = 1.0