Regular Grid Sampling

Implemented class: UnifiedSampler2DRegular  |  Method key: "regular_grid"

1. Motivation

Some MLPG formulations — in particular MLPG5 with rectangular control volumes — require a structured, regular node distribution to guarantee that adjacent control volumes are geometrically consistent (i.e., they tile the domain without overlap or gap, so the coefficient of variation CV ≈ 0). In such cases, a quasi-random distribution (Poisson disk) introduces irregular control volume sizes that degrade the accuracy of the integration.

The UnifiedSampler2DRegular generates a single rectangular grid over the bounding box of each planar face, and then classifies each grid point as boundary or interior based on its distance to the polygon boundary. This approach:

2. Algorithm

Step 1: Grid generation

A regular rectangular grid is generated over the 2D bounding box [xmin, xmax] × [ymin, ymax] of the face boundary polygon, with spacing h in both directions:

xij = (xmin + i · h,   ymin + j · h),    i = 0,…,Nx,   j = 0,…,Ny

Step 2: Domain containment filter

Grid points that fall outside the face boundary polygon are discarded (ray-casting test via matplotlib.path.Path.contains_points()).

Step 3: Classification and boundary snapping

For each remaining grid point, the signed distance to the nearest boundary edge is computed. A snap band of width 0.65 h is defined:

The snap band threshold of 0.65 h was determined empirically to produce a clean boundary-to-interior transition without leaving gaps or overlapping nodes.

3. Control Volume Consistency (MLPG5-rect)

In the MLPG5 formulation, the local subdomain of each interior node is a rectangle of half-side αs h / 2 centred at the node. For two adjacent nodes at distance h, their control volumes share exactly one edge (no overlap, no gap) if and only if the node distribution is regular. The coefficient of variation of control volume areas is CV = 0 for a perfect grid.

For Poisson disk distributions, CV > 0 (typically 0.05–0.15), which introduces a small but non-zero integration inconsistency. The regular grid eliminates this source of error entirely at the cost of isotropy.

Note: The regular grid is isotropic by design — the same spacing in both x and y directions. This is appropriate for isotropic material properties and uniform loading. For highly anisotropic problems or non-rectangular domains with complex boundaries, the Poisson disk or Delaunay methods may produce better results near the boundary.

4. Parameters

5. When to Use

Use "regular_grid" when:

6. References