Foam::PDRutils Namespace Reference

Utilities for PDR (eg, for setFields) More...

Functions

void one_d_overlap (scalar xmin, scalar xmax, const PDRblock::location &grid, List< scalar > &olap, int *cmin, int *cmax, int *cfmin, int *cfmax)
 Determine 1-D overlap locations for a geometric entity. More...
 
void two_d_overlap (const UList< scalar > &a_olap, label amin, label amax, const UList< scalar > &b_olap, label bmin, label bmax, SquareMatrix< scalar > &ab_olap)
 Combine two 1D overlaps. More...
 
void circle_overlap (scalar ac, scalar bc, scalar dia, scalar theta, scalar wa, scalar wb, const PDRblock::location &agrid, label amin, label amax, const PDRblock::location &bgrid, label bmin, label bmax, SquareMatrix< scalar > &ab_olap, SquareMatrix< scalar > &ab_perim, SquareMatrix< scalar > &a_lblock, SquareMatrix< scalar > &ac_lblock, SquareMatrix< scalar > &c_count, SquareMatrix< symmTensor2D > &c_drag, SquareMatrix< scalar > &b_lblock, SquareMatrix< scalar > &bc_lblock)
 
double inters_cy (double xc, double yc, double rad, double x1, double x2, double y1, double y2, scalar *perim_p, scalar *x_proj_edge_p, scalar *y_proj_edge_p, scalar *x_overlap_p, scalar *y_overlap_p)
 Area of intersection between circle and rectangle. More...
 
double inters_db (double xc, double yc, double theta, double wa, double wb, double x1, double x2, double y1, double y2, scalar *count_p, symmTensor2D &vdrag, scalar *perim_p, scalar *x_lblk, scalar *y_lblk, scalar *x_centre_p, scalar *y_centre_p)
 The area overlap in the plane of a diagonal block and a cell. More...
 
double l_blockage (double xc, double yc, double rad, double x1, double x2, double y1, double y2, scalar *count_p, scalar *drag_p, scalar *centre_p)
 

Detailed Description

Utilities for PDR (eg, for setFields)

Utilities for PDR (eg, for setFields). Internal usage only.

The C lineage of the original code is still evident in the use of pointers instead of references. This will be addressed in later versions of the code (2019-12).

Source files

Function Documentation

◆ one_d_overlap()

void one_d_overlap ( scalar  xmin,
scalar  xmax,
const PDRblock::location grid,
List< scalar > &  olap,
int *  cmin,
int *  cmax,
int *  cfmin,
int *  cfmax 
)

Determine 1-D overlap locations for a geometric entity.

Parameters
[in]xmin- min position of the geometric entity
[in]xmax- max position of the geometric entity
[in]grid- grid point information
[out]olap- Fraction of cell-width with overlap 0 for no overlap, 1 for full overlap.
[out]cmin- first cell index (inclusive) with overlap, values in the range [0,nCells]
[out]cmax- last cell index (inclusive) with overlap, values in the range [0,nCells]
[out]cfmin- first cell index (inclusive) with staggered face, values in the range [0,nCells]
[out]cfmax- last cell index (inclusive) with staggered face, values in the range [0,nCells]

◆ two_d_overlap()

void two_d_overlap ( const UList< scalar > &  a_olap,
label  amin,
label  amax,
const UList< scalar > &  b_olap,
label  bmin,
label  bmax,
SquareMatrix< scalar > &  ab_olap 
)

Combine two 1D overlaps.

Multiplying the two 1-d overlaps yields the proportion of each (2D) cell that is covered.

Note
We go one over the relevant min/max limits since these values might be used. The 1D arrays will have bee initially zeroed throughout.

◆ circle_overlap()

void circle_overlap ( scalar  ac,
scalar  bc,
scalar  dia,
scalar  theta,
scalar  wa,
scalar  wb,
const PDRblock::location agrid,
label  amin,
label  amax,
const PDRblock::location bgrid,
label  bmin,
label  bmax,
SquareMatrix< scalar > &  ab_olap,
SquareMatrix< scalar > &  ab_perim,
SquareMatrix< scalar > &  a_lblock,
SquareMatrix< scalar > &  ac_lblock,
SquareMatrix< scalar > &  c_count,
SquareMatrix< symmTensor2D > &  c_drag,
SquareMatrix< scalar > &  b_lblock,
SquareMatrix< scalar > &  bc_lblock 
)

Calculate the proportion of each (two-dimensional) grid cell overlapped by the circle or angled rectangle.

Coordinates are labelled a and b.

Parameters
[in]ac,bccoordinates of centre of circle or rectangle
[in]diadiameter of circle (zero for rectangle)
[in]theta,wa,wbparameters for rectangle
[in]amin,amaxfirst and last cells in a-grid overlapped by object
[in]agridlocations of grid lines of a-grid
[in]amin,amaxfirst and last cells in b-grid overlapped by object
[in]bgridlocations of grid lines of b-grid
[out]abolap2-D array of (proportionate) area blockage by grid cell
[out]a_lblock2-D array of (proportionate) blockage to a-direction flow (This will be area blockage when extruded in the third coordinate).
[out]a_count2-D array The contribution of this object to the count of obstacles blocking a-direction flow. This is only non-zero if the object is inside the lateral boundaries of the cell. It is large negative if the cell is totally blocked in this direction.
[out]c_drag

2-D array of tensor that will give tensor drag in each cell (when multiplied Cd, cylinder length, and 0.5 rho*U^2) Dimension: L.

Note
this routine does not zero array elements outside the amin to amax, bmin to bmax area.

◆ inters_cy()

double inters_cy ( double  xc,
double  yc,
double  rad,
double  x1,
double  x2,
double  y1,
double  y2,
scalar *  perim_p,
scalar *  x_proj_edge_p,
scalar *  y_proj_edge_p,
scalar *  x_overlap_p,
scalar *  y_overlap_p 
)

Area of intersection between circle and rectangle.

Calculates the area of intersection between the circle, centre (xc, yc), radius rad, and the rectangle with sides at x = x1 & x2, and y = y1 and y2.

The return value is the fraction of the rectangle's area covered by the circle.

Parameters
xccircle centre (x)
yccircle centre (y)
radcircle radius

◆ inters_db()

double inters_db ( double  xc,
double  yc,
double  theta,
double  wa,
double  wb,
double  x1,
double  x2,
double  y1,
double  y2,
scalar *  count_p,
symmTensor2D vdrag,
scalar *  perim_p,
scalar *  x_lblk,
scalar *  y_lblk,
scalar *  x_centre_p,
scalar *  y_centre_p 
)

The area overlap in the plane of a diagonal block and a cell.

Calculates the overlap, in the plane of a diagonal block and a cell, plus blockage and drag parameters. Note that x and y herein may be any two of the three coordinates - would have been better not to label them x and y.

On entry: xc, yc Coordinates of axis of d.b. theta, wa, wb Angle and widths

The returned parameters will be multiplied by the length of the obstacle's intersection with the third dimension of the 3-D cell to give this obstacle's contribution to the count, drag and area blockages. The return value is the area of intersection, which will multiply to volume blockage.

◆ l_blockage()

double l_blockage ( double  xc,
double  yc,
double  rad,
double  x1,
double  x2,
double  y1,
double  y2,
scalar *  count_p,
scalar *  drag_p,
scalar *  centre_p 
)