Class SweepChunk

Nested Relationships

Nested Types

Inheritance Relationships

Derived Types

Class Documentation

class SweepChunk

Sweep work function.

Subclassed by opensn::AAHCSDASweepChunk, opensn::AAHDSweepChunk, opensn::AAHSweepChunk, opensn::AAHSweepChunkRZ, opensn::AAHSweepChunkSpherical, opensn::AAHSweepChunkTD, opensn::CBCDSweepChunk, opensn::CBCSweepChunk, opensn::CBCSweepChunkTD

Public Types

using MomentCallbackFunc = std::function<void(SweepChunk *sweeper, AngleSet *angle_set)>

Convenient typdef for the moment call back function. See moment_callbacks.

Public Functions

inline SweepChunk(std::vector<double> &destination_phi, std::vector<double> &destination_psi, const std::shared_ptr<Mesh> &grid, const SpatialDiscretization &discretization, const std::vector<UnitCellMatrices> &unit_cell_matrices, const std::vector<CellLBSView> &cell_transport_views, std::vector<CellOutflowView> &cell_outflow_views, const std::vector<double> &source_moments, const LBSGroupset &groupset, const BlockID2XSMap &xs, unsigned int num_moments, unsigned int max_num_cell_dofs, unsigned int min_num_cell_dofs)
virtual void Sweep(AngleSet &angle_set)

Sweep chunks should override this.

virtual void SetAngleSet(AngleSet &angle_set)

Sets the currently active angleset.

void SetCell(Cell const *cell_ptr)

Sets the active cell for cell-by-cell sweeps.

virtual void ZeroDestinationPhi()

Zero the portion of the output flux moments vector corresponding to the groupset for this sweep chunk.

inline void ZeroDestinationPsi()

Sets all elements of the output angular flux vector to zero.

inline bool SaveAngularFluxEnabled() const

Returns true if angular flux storage is allocated.

inline void SetBoundarySourceActiveFlag(bool flag_value)

Activates or deactivates the surface src flag.

inline bool IsSurfaceSourceActive() const

Returns the surface src-active flag.

inline void IncludeRHSTimeTerm(bool status)

Include contribution from previous psi_n in RHS source term.

inline virtual bool IsTimeDependent() const
virtual void SetDestinationsFromAngularFlux(const AngleAggregation &angle_agg)

Overwrite this groupset’s scalar flux moments and outflows with sums over the stored angular flux in a fixed order: angle sets in aggregation order, then their directions.

Parameters:

angle_agg – Angle aggregation of the groupset; its order fixes the summation order.

virtual void BeginSweep()

Prepares the chunk for a sweep.

The sweep scheduler calls this before the first angle set of a sweep, after the destination flux moments of the groupset are zeroed. A chunk with compact groupset moments copies the groupset’s source moments here.

virtual void EndSweep()

Finishes a sweep of the chunk.

The sweep scheduler calls this after the last angle set of a sweep. A chunk with compact groupset moments copies the groupset’s flux moments to the destination here.

virtual ~SweepChunk() = default

Public Members

std::vector<MomentCallbackFunc> moment_callbacks

Functions of type MomentCallbackFunc can be added to the moment_callbacks vector and these can be called from within functions taking a LBSGroupset instance.

The intention is that this function can be used as a general interface to retrieve angular flux values

Protected Functions

void EnableCompactGroupsetMoments(unsigned int num_problem_groups)

Makes the sweeps of this chunk use contiguous copies of the groupset’s moments.

When the groupset does not hold every group, a sweep reads the groupset’s source moments from, and adds its flux moments to, contiguous copies of the groupset’s part of the moments. The moments of a node then lie together, so a kernel reads them in fewer memory accesses. The copies exist only during a sweep. A chunk enables this only if every kernel it runs reads the moments through GetGroupsetMoments().

GroupsetMoments GetGroupsetMoments()

Where the current sweep reads the source moments and adds the flux moments.

void ComputeDestinationsFromAngularFlux(const AngleAggregation &angle_agg, const std::vector<double> &psi)

Overwrite the scalar flux moments and outflows with fixed-order sums over an angular flux.

Parameters:
  • angle_agg – Angle aggregation of the groupset; its order fixes the summation order.

  • psi – Angular flux laid out like destination_psi_.

void ComputeTimeDependentDestinationsFromAngularFlux(const AngleAggregation &angle_agg, const std::vector<double> &psi_old, double theta)

Overwrite the scalar flux moments and outflows of a time-dependent sweep.

The moments are those of psi^{n+theta} = theta psi^{n+1} + (1 - theta) psi^n, while destination_psi_ holds psi^{n+1}.

Parameters:
  • angle_agg – Angle aggregation of the groupset; its order fixes the summation order.

  • psi_old – Angular flux psi^n at the start of the time step.

  • theta – Time-integration parameter of the theta scheme.

Protected Attributes

const std::shared_ptr<Mesh> grid_
const SpatialDiscretization &discretization_
const std::vector<UnitCellMatrices> &unit_cell_matrices_
const std::vector<CellLBSView> &cell_transport_views_
std::vector<CellOutflowView> &cell_outflow_views_
const std::vector<double> &source_moments_
const LBSGroupset &groupset_
const BlockID2XSMap &xs_
const unsigned int num_moments_
const unsigned int max_num_cell_dofs_
const unsigned int min_num_cell_dofs_
const size_t groupset_angle_group_stride_
const size_t groupset_group_stride_
std::vector<double> &destination_phi_
std::vector<double> &destination_psi_
std::vector<double> psi_theta_

Angular flux at time n + theta, used by ComputeTimeDependentDestinationsFromAngularFlux.

bool surface_source_active_ = false
bool include_rhs_time_term_ = true
const Cell *cell_
struct GroupsetMoments

Where a sweep reads the groupset’s source moments and adds its flux moments.

Moment m of group g of the groupset at node n is entry n * node_stride + m * moment_stride + group_offset + g of both arrays. Initialize it with braces, which zero any members left out.

Public Functions

inline std::size_t Index(std::size_t n, unsigned int m) const

Index of moment m of the groupset’s first group at node n.

Public Members

const double *source
double *phi
std::size_t node_stride
std::size_t moment_stride
std::size_t group_offset