Skip to content

CircularOGrid2D

CircularOGrid2D

CircularOGrid2D(user_name: str, element: Element, region: Optional[RegionBase] = None, *, R: float, r0_ratio: float = 0.4, nt: int = 24, nr: int = 12, merge_tolerance: float = 1e-12)

Bases: MeshPart

Parametric structured 2D circular mesh part with an O-Grid topology.

This mesh part discretizes a circular domain into structured quad elements using a central square grid block surrounded by four transition block grids (O-Grid topology). This provides structured mesh quality without coordinate singularity at the center, ideal for modeling circular piles, shaft sections, or circular domain boundaries.

Note
  • Exposes a custom node stitching utility (_merge_nodes) to merge coincident coordinates across adjacent grid blocks.
  • Requires quad elements (such as sspquad or stdquad).
Example
from femora.core.model import Model

model = Model()
mat = model.material.nd.elastic_isotropic(user_name="soil", e_mod=30000.0, nu=0.3, rho=2.0)
ele = model.element.quad.ssp(ndof=2, material=mat)

# Discretize a 2D circular cross-section of radius 5.0
circle = model.meshpart.surface.circular_o_grid(
    user_name="circular_pile_sec",
    element=ele,
    R=5.0,
    r0_ratio=0.4,
    nt=12,
    nr=6,
)
print(circle.tag)

Create a parametric 2D circular O-Grid mesh part.

Parameters:

Name Type Description Default
user_name str

Unique user-defined name for this mesh part.

required
element Element

Associated Element template used for discretization.

required
region Optional[RegionBase]

Physical Region where this mesh part is added.

None
R float

Radius of the circular domain (must be greater than 0).

required
r0_ratio float

Ratio of the inner central square size to the outer radius (must be between 0.1 and 0.9).

0.4
nt int

Number of element intervals along each block transition edge.

24
nr int

Number of radial element intervals in the outer ring block.

12
merge_tolerance float

Distance tolerance used to stitch adjacent block nodes.

1e-12

Raises:

Type Description
ValueError

If R <= 0, r0_ratio is outside (0.1, 0.9), nt or nr is less than 1, or if the element type is not a compatible quad element.

Methods:

generate_mesh

generate_mesh() -> pv.UnstructuredGrid

Construct central and ring block coordinates, merge boundary nodes, and compile a PyVista UnstructuredGrid.

Returns:

Type Description
UnstructuredGrid

pv.UnstructuredGrid: The generated circular UnstructuredGrid.