reordersequence.h File Reference

Go to the source code of this file.

Functions

void compute_sequence (const struct UnstructuredGrid *grid, const double *flux, int *sequence, int *components, int *ncomponents)
 
void compute_sequence_graph (const struct UnstructuredGrid *grid, const double *flux, int *sequence, int *components, int *ncomponents, int *ia, int *ja)
 

Detailed Description

Facilities for computing a causal permutation of the cells in an UnstructuredGrid such that fluid transport may be subsequently solved by going from sources and up-stream cells to sinks and down-stream cells.

Function Documentation

◆ compute_sequence()

void compute_sequence ( const struct UnstructuredGrid *  grid,
const double *  flux,
int *  sequence,
int *  components,
int *  ncomponents 
)

Compute causal permutation sequence of grid cells with respect to specific Darcy flux field.

Parameters
[in]gridGrid structure for which to compute causal cell permutation.
[in]fluxDarcy flux field. One scalar value for each interface/connection in the grid, including the boundary. We assume that flux[f] is positive if the flow is from cell grid->face_cells[2*f + 0] to cell grid->face_cells[2*f + 1].
[out]sequenceCausal grid cell permutation. Ordered according to topological sorting of the strongly connected components of the Darcy flux upwind graph. Array of size grid->number_of_cells.
[out]componentsIndirection pointers that describe the strongly connected components (i.e., loops) of the Darcy flux upwind graph. Specifically, the $i$'th strongly connected component constitutes cells sequence[components[i] ... components[i + 1]
  • 1].

In the ideal case of a perfectly reordered upwind graph, this array will hold grid->number_of_cells + 1 elements, and the relation components[i + 1] - components[i] == 1 holds for all $i$. Thus, the components parameter must point to an array of grid->number_of_cells + 1 elements.

Parameters
[out]ncomponentsNumber of strongly connected components. Pointer to a single integer. The components output are valid for all i = 0 ... *ncomponents - 1. Furthermore, the number of components must be in the interval [1 .. grid->number_of_cells].

◆ compute_sequence_graph()

void compute_sequence_graph ( const struct UnstructuredGrid *  grid,
const double *  flux,
int *  sequence,
int *  components,
int *  ncomponents,
int *  ia,
int *  ja 
)

Compute causal permutation sequence of grid cells with respect to specific Darcy flux field. Also return the permuted upwind graph.

Parameters
[in]gridGrid structure for which to compute causal cell permutation.
[in]fluxDarcy flux field. One scalar value for each interface/connection in the grid, including the boundary. We assume that flux[f] is positive if the flow is from cell grid->face_cells[2*f + 0] to cell grid->face_cells[2*f + 1].
[out]sequenceCausal grid cell permutation. Ordered according to topological sorting of the strongly connected components of the Darcy flux upwind graph. Array of size grid->number_of_cells.
[out]componentsIndirection pointers that describe the strongly connected components (i.e., loops) of the Darcy flux upwind graph. Specifically, the $i$'th strongly connected component constitutes cells sequence[components[i] ... components[i + 1]
  • 1].

In the ideal case of a perfectly reordered upwind graph, this array will hold grid->number_of_cells + 1 elements, and the relation components[i + 1] - components[i] == 1 holds for all $i$. Thus, the components parameter must point to an array of grid->number_of_cells + 1 elements.

Parameters
[out]ncomponentsNumber of strongly connected components. Pointer to a single integer. The components output are valid for all i = 0 ... *ncomponents - 1. Furthermore, the number of components must be in the interval [1 .. grid->number_of_cells].
[out]iaIndirection pointers into ja that define the "upwind" cells that influence a particular grid cell.
[out]jaCompressed-sparse representation of the upwind graph. Specifically, the upwind cells that influence cell $i$ are ja[ia[i] .. ia[i+1]-1]. Array of size at least equal to the number of internal faces of grid. The number grid->number_of_faces is an upper bound of the array size.