Skip to content

StructuredLineMesh

StructuredLineMesh

StructuredLineMesh(user_name: str, element: Element, region: Optional[RegionBase] = None, *, base_point_x: float = 0.0, base_point_y: float = 0.0, base_point_z: float = 0.0, base_vector_1_x: float = 1.0, base_vector_1_y: float = 0.0, base_vector_1_z: float = 0.0, base_vector_2_x: float = 0.0, base_vector_2_y: float = 1.0, base_vector_2_z: float = 0.0, normal_x: float = 0.0, normal_y: float = 0.0, normal_z: float = 1.0, grid_size_1: int = 10, grid_size_2: int = 10, spacing_1: float = 1.0, spacing_2: float = 1.0, length: float = 1.0, offset_1: float = 0.0, offset_2: float = 0.0, number_of_lines: int = 1, merge_points: bool = True, density: Optional[float] = None, mass_per_length: Optional[float] = None)

Bases: LineMeshPart

Parametric structured grid of 1D line elements generated along a plane normal.

This mesh part generates a grid of parallel line elements (beams or columns) oriented along a specified vector normal. It is highly useful for structural sub-assemblies such as pile group configurations or multi-column bridge piers, automatically compiling connectivity and calculating mass distributions.

Note
  • Requires a compatible beam element that possesses both a defined cross-section and a coordinate transformation.
  • Rotational and translational masses are integrated per unit length and lumped onto point Mass arrays.
Example
from femora.core.model import Model

model = Model()
sec = model.section.beam.elastic(
    user_name="beam_sec", E=29000.0, A=10.0, Iz=100.0, Iy=100.0
)
transf = model.transformation.transformation3d("Linear", 0.0, 1.0, 0.0)
beam_ele = model.element.beam.disp(ndof=6, section=sec, transformation=transf)

# Create a 2x2 pile group of vertical structured lines
piles = model.meshpart.line.structured_lines(
    user_name="pile_group",
    element=beam_ele,
    grid_size_1=1,
    grid_size_2=1,
    spacing_1=5.0,
    spacing_2=5.0,
    length=20.0,
    normal_x=0.0,
    normal_y=0.0,
    normal_z=1.0,
)
print(piles.tag)

Create a parametric structured grid of line elements.

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
base_point_x float

X-coordinate of the grid base point.

0.0
base_point_y float

Y-coordinate of the grid base point.

0.0
base_point_z float

Z-coordinate of the grid base point.

0.0
base_vector_1_x float

X-component of the first grid vector direction.

1.0
base_vector_1_y float

Y-component of the first grid vector direction.

0.0
base_vector_1_z float

Z-component of the first grid vector direction.

0.0
base_vector_2_x float

X-component of the second grid vector direction.

0.0
base_vector_2_y float

Y-component of the second grid vector direction.

1.0
base_vector_2_z float

Z-component of the second grid vector direction.

0.0
normal_x float

X-component of the line direction vector (plane normal).

0.0
normal_y float

Y-component of the line direction vector (plane normal).

0.0
normal_z float

Z-component of the line direction vector (plane normal).

1.0
grid_size_1 int

Number of cell intervals along the first grid direction.

10
grid_size_2 int

Number of cell intervals along the second grid direction.

10
spacing_1 float

Distance between grid lines along the first direction.

1.0
spacing_2 float

Distance between grid lines along the second direction.

1.0
length float

Length of each line element.

1.0
offset_1 float

Position offset along the first direction.

0.0
offset_2 float

Position offset along the second direction.

0.0
number_of_lines int

Number of element segments to divide each line.

1
merge_points bool

If True, duplicate nodes at adjacent segment boundaries are merged.

True
density Optional[float]

Material density used by this meshpart to create nodal translational and rotational Mass arrays from the element section properties.

None
mass_per_length Optional[float]

Compatibility alias for older line-mass workflows. Femora converts it to density using section area; prefer density for new code.

None

Raises:

Type Description
ValueError

If element is not compatible, grid sizes are negative, spacing or length are non-positive, or number_of_lines is less than 1.

TypeError

If merge_points is not a boolean.

Methods:

is_element_compatible

is_element_compatible(element: Element) -> bool

Verify that the element belongs to compatible type families and has cross-section and transformation metadata.

Parameters:

Name Type Description Default
element Element

Element template to verify.

required

Returns:

Name Type Description
bool bool

True if compatible, False otherwise.

generate_mesh

generate_mesh() -> pv.UnstructuredGrid

Generate lines grid coordinates, compile connectivity, and compute lumped point Mass arrays.

Returns:

Type Description
UnstructuredGrid

pv.UnstructuredGrid: The generated UnstructuredGrid mesh with Point Mass data.