Two-Pile Bent Under DRM Excitation
Two embedded piles support an elevated connecting beam and a mass at its center. A ground-motion pulse travels through the soil and excites the bent. We will build this connected frame, couple both piles to the soil, and follow how the incoming wave moves the frame and bends the piles.
If you are new to embedded pile interfaces, start with the laterally loaded pile. The dynamic single-pile example introduces the wave-loading and absorbing-boundary setup used here.
We use Femora's workflow to generate the wave input, build and solve the model, then create the response plots and movie on Stampede3. The large model and DRM files are created there rather than uploaded from your computer.
Model
The physical soil box is 16 m long, 6 m wide, and 8 m deep. It uses homogeneous elastic soil with Young's modulus 200 MPa, Poisson's ratio 0.4, and density 2,100 kg/m3. Bricks have 0.5 m spacing, giving 32 by 12 by 16 cells. No material damping is assigned to the physical soil.
The piles lie at x = -2.5 m and x = +2.5 m, with y = 0. Both extend from
z = -5 m to z = +3 m. Each has 16 beam-column elements and a circular
1.5 m diameter elastic section. Two connecting beam segments meet at
(0, 0, 3) m. At this joint, we assign a 25,000 kg nodal mass to represent
lateral inertia in the x direction. We do not assign vertical or rotational
inertia to that mass. The connecting beam uses the same section as the piles
and can bend; it is not a rigid cap.
The beam ends share structural nodes with the pile heads, so the structure forms one connected frame. To transfer motion and load between that frame and the soil, we couple the buried pile surfaces with embedded beam-solid interfaces. The above-ground portions remain free of soil coupling.
Because the soil box is finite, outgoing waves would otherwise reflect from its edges and return to the bent. We surround the sides and base with four layers of perfectly matched layer (PML) elements, outside the DRM loading layer. We also assign 5% supplementary Rayleigh damping to the PML region, without matching the undamped physical soil. This is an additional numerical damping choice, not a requirement of PML. The 5% target applies at the Rayleigh calibration frequencies (0.2 and 20 Hz); damping varies with frequency. We fix the PML's exterior faces and leave the ground surface free. These absorbing elements are a numerical boundary, not another physical soil layer.
Build The Bent
The tabs follow the construction order. The code comes from the complete example; excerpts use variables defined by the surrounding script.
Start with homogeneous elastic soil and a uniform brick mesh. The same bounds and spacing are used when generating the DRM points, so the load coordinates agree with the model boundary.
soil_material = model.material.nd.elastic_isotropic(
user_name="soil_mat",
E=SOIL_E,
nu=SOIL_NU,
rho=SOIL_RHO,
) # zero physical damping: linear elastic, no viscous terms
soil_element = model.element.brick.std(ndof=3, material=soil_material)
x_min, x_max, y_min, y_max, z_min, z_max = SOIL_BOUNDS
nx, ny, nz = SOIL_DIVISIONS
model.meshpart.volume.uniform_rectangular_grid(
user_name="soil",
element=soil_element,
x_min=x_min,
x_max=x_max,
y_min=y_min,
y_max=y_max,
z_min=z_min,
z_max=z_max,
nx=nx,
ny=ny,
nz=nz,
)
Define the circular section, then create the two vertical piles and the two horizontal beam segments. Assembly merges their coincident structural endpoints, making one connected bent rather than four independent lines. The transformation's reference vector is perpendicular to both the vertical piles and the horizontal beam segments.
radius = PILE_DIAMETER / 2.0
pile_g = PILE_E / (2.0 * (1.0 + PILE_NU))
pile_area = math.pi * PILE_DIAMETER**2 / 4.0
pile_i = math.pi * PILE_DIAMETER**4 / 64.0
pile_j = math.pi * PILE_DIAMETER**4 / 32.0
pile_section = model.section.beam.elastic(
user_name="pile_section",
E=PILE_E,
A=pile_area,
Iz=pile_i,
Iy=pile_i,
G=pile_g,
J=pile_j,
)
# vecxz=(0,1,0) is perpendicular to both vertical piles and horizontal beams.
transformation = model.transformation.transformation3d(
transf_type="PDelta",
vecxz_x=0.0,
vecxz_y=1.0,
vecxz_z=0.0,
)
beam_element = model.element.beam.disp(
ndof=6,
section=pile_section,
transformation=transformation,
numIntgrPts=5,
)
model.meshpart.line.single_line(
user_name="pile_left",
element=beam_element,
x0=-PILE_X, y0=0.0, z0=PILE_BOTTOM,
x1=-PILE_X, y1=0.0, z1=PILE_TOP,
number_of_lines=PILE_ELEMENTS,
)
model.meshpart.line.single_line(
user_name="pile_right",
element=beam_element,
x0=PILE_X, y0=0.0, z0=PILE_BOTTOM,
x1=PILE_X, y1=0.0, z1=PILE_TOP,
number_of_lines=PILE_ELEMENTS,
)
model.meshpart.line.single_line(
user_name="cap_left",
element=beam_element,
x0=-PILE_X, y0=0.0, z0=CAP_Z,
x1=0.0, y1=0.0, z1=CAP_Z,
number_of_lines=CAP_ELEMENTS,
)
model.meshpart.line.single_line(
user_name="cap_right",
element=beam_element,
x0=PILE_X, y0=0.0, z0=CAP_Z,
x1=0.0, y1=0.0, z1=CAP_Z,
number_of_lines=CAP_ELEMENTS,
)
Couple each pile to the physical soil with an embedded beam-solid interface. The interface samples its cylindrical surface and finds the surrounding brick elements; the two meshes need not share soil nodes. Both interfaces use the same radius and penalty parameters. Finally, add the x-direction mass at the connecting beam's center to represent its lateral inertia.
interface_left = model.interface.beam_solid_interface(
name="pile_soil_interface_left",
beam_part="pile_left",
solid_parts=["soil"],
radius=radius,
n_peri=8,
n_long=3,
penalty_param=1.0e12,
g_penalty=True,
)
interface_right = model.interface.beam_solid_interface(
name="pile_soil_interface_right",
beam_part="pile_right",
solid_parts=["soil"],
radius=radius,
n_peri=8,
n_long=3,
penalty_param=1.0e12,
g_penalty=True,
)
model.mass.meshpart.closest_point(
meshpart_name="cap_left",
xyz=(0.0, 0.0, CAP_Z),
mass_vec=(LUMPED_MASS, 0.0, 0.0),
combine="override",
)
Add the PML shell and assemble the soil and bent. The physical model uses eight partitions and the PML uses eight more. Fix only the outside faces, so waves can travel from the soil into the absorber before reaching a constrained boundary.
model.interface.boundary.absorber(
num_layers=ABSORBER_LAYERS,
num_partitions=ABSORBER_PARTITIONS,
partition_algo="kd-tree",
geometry="Rectangular",
rayleigh_damping=0.05, # Supplementary damping in PML only; physical soil stays undamped
match_damping=False,
boundary_type="PML",
)
model.assembler.create_section(
meshparts=["soil", "pile_left", "pile_right", "cap_left", "cap_right"],
num_partitions=PHYSICAL_PARTITIONS,
partition_algorithm="kd-tree",
merge_points=True,
tolerance=1.0e-6,
)
model.assembler.assemble(merge_points=True, progress_callback=lambda *_: None)
actual_cores = set(int(core) for core in model.assembled_mesh.cell_data["Core"])
if actual_cores != set(range(RANKS)):
raise ValueError(
f"Expected ranks 0..{RANKS - 1}, exported cores: {sorted(actual_cores)}"
)
outer_fixity = [1] * 9 # PML outer faces carry 9 DOFs per node
model.constraint.sp.fix_macro_x_min(dofs=outer_fixity, tol=1.0e-6)
model.constraint.sp.fix_macro_x_max(dofs=outer_fixity, tol=1.0e-6)
model.constraint.sp.fix_macro_y_min(dofs=outer_fixity, tol=1.0e-6)
model.constraint.sp.fix_macro_y_max(dofs=outer_fixity, tol=1.0e-6)
model.constraint.sp.fix_macro_z_min(dofs=outer_fixity, tol=1.0e-6)
With the model connected and its boundary defined, set up a Newmark transient analysis with a 0.001 s time step for 4 s. Record displacement, velocity, and acceleration every 0.005 s to follow the motion. Add beam-force recorders for pile bending and interface recorders for the interaction-point response, so we can also examine how the soil transfers load to the piles. The solve uses one OpenSeesMP process for each of the 16 model partitions.
response_recorder = model.recorder.vtkhdf(
file_base_name=RESPONSE_FILE,
# Trial beam end actions in VTKHDF. Keep XML/interface recorders until
# the installed OpenSees build and mixed-element mapping are verified.
resp_types=["disp", "vel", "accel", "force3D", "localForce3D"],
delta_t=RECORDER_DT,
)
interface_recorder = model.recorder.embedded_beam_solid_interface(
interface=[interface_left, interface_right],
dt=RECORDER_DT,
)
pile_force_recorder = model.recorder.beam_force(
meshparts=["pile_left", "pile_right"],
force_type="globalForce",
file_prefix="pile_force",
output_format="xml",
include_time=True,
delta_t=RECORDER_DT,
precision=16,
)
pile_local_force_recorder = model.recorder.beam_force(
meshparts=["pile_left", "pile_right"],
force_type="localForce",
file_prefix="pile_local_force",
output_format="xml",
include_time=True,
delta_t=RECORDER_DT,
precision=16,
)
cap_force_recorder = model.recorder.beam_force(
meshparts=["cap_left", "cap_right"],
force_type="globalForce",
file_prefix="cap_force",
output_format="xml",
include_time=True,
delta_t=RECORDER_DT,
precision=16,
)
constraint_handler = model.analysis.constraint.plain()
numberer = model.analysis.numberer.parallelrcm()
system = model.analysis.system.mumps()
test = model.analysis.test.energyincr(tol=1.0e-4, max_iter=10, print_flag=5)
algorithm = model.analysis.algorithm.modifiednewton(factor_once=True)
integrator = model.analysis.integrator.newmark(gamma=0.5, beta=0.25, form="D")
dynamic_analysis = model.analysis.transient(
name="dynamic_bent_response",
constraint_handler=constraint_handler,
numberer=numberer,
system=system,
test=test,
algorithm=algorithm,
integrator=integrator,
dt=DYNAMIC_DT,
final_time=FINAL_TIME,
max_retries=0,
)
model.process.add_step(model.actions.set_time(0.0), "Start dynamic time at zero")
model.process.add_step(h5_pattern, "Apply the H5DRM wave field")
model.process.add_step(response_recorder, "Record displacement, velocity, acceleration")
model.process.add_step(interface_recorder, "Record the embedded pile-soil interfaces")
model.process.add_step(pile_force_recorder, "Record both piles' global end forces and moments")
model.process.add_step(pile_local_force_recorder, "Record pile end actions in local beam axes")
model.process.add_step(cap_force_recorder, "Record cap end actions for pile-head balance checks")
model.process.add_step(dynamic_analysis, "Run the dynamic analysis")
Generate The Incoming Motion
To excite this model, we start with a Ricker acceleration pulse prescribed
at the ground surface.
To obtain the incoming wave that produces this pulse, we use a soil column
with the same properties and depth as the 3D model, over a stiff elastic
half-space. create_drm() deconvolves the surface pulse through this profile
and uses the resulting motion to create the wave input.
The domain reduction method (DRM) applies this incoming field along a layer near the edge of the soil mesh. Here the wave travels vertically, with motion in the x direction. The input calculation contains soil but no piles: it describes the ground motion before the structure disturbs it.
With the incoming motion determined, create_drm() writes the DRM input on
a grid matching the soil mesh:
gravity = 9.81
surface_motion = TimeHistory.load(
acc_file=str(motion_dir / "ricker_surface.acc"),
time_file=str(motion_dir / "ricker_surface.time"),
unit_in_g=True,
gravity=gravity,
)
# Use the same soil stiffness, density, and depth as the 3D model.
shear_modulus = SOIL_E / (2.0 * (1.0 + SOIL_NU))
vs_soil = math.sqrt(shear_modulus / SOIL_RHO)
drm_profile = [
{"h": 8.0, "vs": vs_soil, "rho": SOIL_RHO, "damping": 0.0},
]
transfer_function = TransferFunction(
soil_profile=drm_profile,
rock={"vs": 8000.0, "rho": 2000.0, "damping": 0.0},
f_max=180.0,
)
incident_motion, _, _ = transfer_function.deconvolve(
surface_motion, return_all=True
)
drm_file = Path(drm_file)
drm_file.parent.mkdir(parents=True, exist_ok=True)
transfer_function.createDRM(
soil_box,
props={"shape": "box"},
time_history=incident_motion,
filename=str(drm_file),
)
The input must exist before the model can use it, so we make its generation
the first workflow task. create_drm() writes drmload.h5drm in its own task folder
and returns the file path for build_model() to use. Both functions run on
the cluster; we upload only the small surface-motion files.
For the deconvolution step, see Deconvolved Ricker-Wave Site Response.
Run The Workflow
Now connect the input calculation, model construction, solver, and postprocessing in one workflow. The stages run in this order:
input/drmcreates the shareddrmload.h5drmfile.build/bentcreates both piles, the beam, soil, interfaces, and PML, then exportsmodel.tcland a small element-to-geometry mapping.solve/bentlaunches that Tcl model with 16 OpenSeesMP ranks.postprocess/responsescreates histories, pile deformation profiles, and force and moment outputs. Thenpostprocess/movierenders the animation. These two tasks run sequentially; both use the completed solver output.
def build_workflow():
"""Minimal single-case workflow: input -> build -> solve -> postprocess."""
workflow = fm.Workflow("two-pile-bent-drm")
# All tasks run remotely. Each stage waits for the previous one to finish.
# context.output_dir is workspace / stage name / task name.
workflow.add("input", tasks=[fm.tasks.Python("drm", create_drm)])
workflow.add("build", parallel=False, tasks=[fm.tasks.Python("bent", build_model)])
workflow.add(
"solve",
parallel=False,
tasks=[fm.tasks.OpenSees("bent", "build/bent/model.tcl", ranks=RANKS)],
)
workflow.add(
"postprocess", tasks=[
fm.tasks.Python("responses", postprocess_results),
fm.tasks.Python("movie", postprocess_results, kwargs={"movies": True}),
]
)
# Return derived results and diagnostic logs, not the large raw recorder files.
workflow.outputs("postprocess/responses/*", "postprocess/movie/*",
"**/stdout.log", "build/*/model.tcl", "build/*/pile_geometry.json")
return workflow
The workflow workspace is the shared remote run directory. Each Python
task receives a context: context.workspace points to that shared directory,
while context.output_dir points to the task's own folder. For example,
the build task writes inside build/bent. It retrieves the DRM file path
with context.result("input", "drm"), the value returned by create_drm().
After a successful run, the relevant folders look like this:
workspace/
|-- motions/ # Uploaded small motion inputs
|-- two_pile_bent_drm_postprocess.py # Uploaded postprocessor
|-- input/drm/drmload.h5drm # Generated remotely
|-- build/bent/
| |-- model.tcl # Generated remotely
| |-- pile_geometry.json # Pile element tags, partitions, and endpoints
| `-- results/ # Large recorder files
|-- solve/bent/stdout.log
`-- postprocess/
|-- responses/ # Histories, pile profiles, and moment envelopes
`-- movie/ # MP4, preview, and rendering settings
For a fuller explanation of stages, task folders, and return values, see the workflow guide.
Read The Response
After the solve, we first look at the frame's overall motion. The postprocessor
queries the undeformed coordinates of the left pile head
(-2.5, 0, 3), the beam center (0, 0, 3), and the right pile head
(2.5, 0, 3). Femora searches the partitioned results for each point; it does
not assume a particular recorder file contains a particular structural node.
It saves all three displacement components and plots the x histories in millimeters, the direction of the incoming motion. These histories let us compare the connecting beam's center with the two pile heads during and after the pulse.
Response To The Pulse
The figure below comes from the 16-rank remote run with the 5% supplementary PML damping described above. It shows node displacements in the global x direction, not displacement relative to the surrounding soil.

All three locations reach their largest displacement near 0.196 s, then oscillate with decreasing amplitude. The two pile heads move almost together, consistent with the symmetric bent and the incoming wave field. The beam center follows a similar history, with a slightly larger peak. Similar motion does not make the connecting beam rigid; it remains an elastic part of the model.
| Location | Peak absolute x displacement |
|---|---|
| Left pile head | 6.64 mm |
| Beam center | 6.67 mm |
| Right pile head | 6.64 mm |
The solver reaches 4 s. Each plotted history has 800 samples, from 0.001 to 3.996 s at 0.005 s intervals; the final solver step falls after the last recorder sample. These histories show the response of this configuration, not a comparison that isolates the effect of the PML or its extra damping.
Pile Deformation And Bending Moments
The head histories describe the frame's overall motion. To see what happens below the heads, we next extract displacement along each pile using its structural beam nodes, rather than nearby soil nodes.

Solid curves show the maximum signed displacement at each elevation; dashed curves show the minimum. Both use the full four-second record. The x motion dominates, while the y response is close to zero. The two sides need not be symmetric: we take the actual minimum and maximum, not the absolute peak and its negative. An envelope combines extrema reached at different times; it is not a deformed shape at one instant.
Motion alone does not tell us the bending demand, so we also read the recorded
beam end forces and moments. The example provides both XML beam-force and
VTKHDF recorders. VTKHDF support for force3D and localForce3D depends on
the OpenSees version and build;
the postprocessor uses XML for the bending plots below.

The bending envelopes show global Mx and My in kN m. My dominates because the incoming motion acts in the x direction. Solid curves show maxima and dashed curves show minima over the full record.
Adjacent element end moments are put in a common sign convention and averaged at each shared node before taking the minimum and maximum over time. This smoothing gives one value per elevation for presentation; it is not a recovered section-moment diagram. The raw beam and interface forces remain unchanged.
To investigate where the soil transfers load to a pile, we can go further
with the interface records. These provide force and displacement responses at
the sampled interaction points, including axial, radial, and tangential
contributions. They let us follow how the interaction varies along the buried
surface and over time. The interface's beamForce output instead gives the
equivalent actions at beam ends, which can be used with the beam-force records
to examine load balance; it is distinct from the point-level response.
Deformation Movie
The movie shows the first two seconds at half speed, with displacement magnified 120 times for visibility. The soil cut exposes the right pile, and the red sphere represents the center mass. The plots above use the full four-second record and unscaled displacements.
Submit The Example
To run this workflow yourself, use a DesignSafe account with Stampede3 access, an eligible allocation, and access to a registered Femora workflow app providing Femora and OpenSeesMP. At the bottom of the script, replace the app ID and allocation with yours. The shown SKX development-queue request reserves one node with 48 rank slots; this model uses 16 of them. Other queues need their own compatible settings.
settings={
"app_id": "YOUR_REGISTERED_FEMORA_APP",
"system": "stampede3",
"queue": "skx-dev",
"allocation": "YOUR_ALLOCATION",
"nodes": 1,
"cores_per_node": 48,
"minutes": 120,
}
Submit from your Femora checkout:
Femora prompts for login and returns a job UUID. To monitor the job and download the derived results, use:
Log in with L, select the job, and press Enter for details or D to download completed output. Checking a job does not require submitting it again.
Complete source
# =============================================================================
# Femora: Fast Efficient Meta-modeling for OpenSees-based Resilience Analysis
# Copyright 2026 Amin Pakzad and Pedro Arduino
# Developed at the UW Geotechnical Lab
# SPDX-License-Identifier: Apache-2.0
# =============================================================================
# femora-postprocess: examples/soil_structure_interaction/two_pile_bent_drm_postprocess.py
# %% [markdown]
# # Two-Pile Bent under DRM Loading
#
# Two vertical piles (`x = -2.5 and +2.5 m`) connected by a two-segment cap beam at
# `z = 3.0 m` support a mass at the beam center. A ground-motion pulse excites
# the surrounding soil, which transfers motion to the piles through embedded
# interfaces. PML layers at the edges of the soil absorb outgoing waves.
#
# The workflow generates the DRM input, builds and solves the model, and
# extracts response histories, pile profiles, forces, and a movie remotely.
# %%
"""Two-pile bent tutorial with a minimal remote Femora workflow.
Stages: input/drm -> build/bent -> solve/bent (16 ranks) -> postprocess (responses, movie).
Task functions are context callbacks; importing this module runs no simulation.
"""
from __future__ import annotations
import importlib.util
import json
import math
from pathlib import Path
import femora as fm
import numpy as np
import pyvista as pv
from femora import Model
from femora.tools.transferFunction import TimeHistory, TransferFunction
from femora.utils.paths import motions_dir
SOIL_E = 2.0e8
SOIL_NU = 0.4
SOIL_RHO = 2100.0
SOIL_BOUNDS = (-8.0, 8.0, -3.0, 3.0, -8.0, 0.0)
SOIL_DIVISIONS = (32, 12, 16) # 0.5 m brick spacing
PILE_DIAMETER = 1.5
PILE_E = 1.0e10
PILE_NU = 0.3
PILE_ELEMENTS = 16
PILE_BOTTOM = -5.0
PILE_TOP = 3.0
PILE_X = 2.5
CAP_Z = 3.0
CAP_ELEMENTS = 16
LUMPED_MASS = 25_000.0
FINAL_TIME = 4.0
DYNAMIC_DT = 0.001
RECORDER_DT = 0.005
PHYSICAL_PARTITIONS = 8
ABSORBER_PARTITIONS = 8
RANKS = PHYSICAL_PARTITIONS + ABSORBER_PARTITIONS # 16
ABSORBER_LAYERS = 4
POSTPROCESS = "two_pile_bent_drm_postprocess.py"
RESPONSE_FILE = "two_pile_bent_response.vtkhdf"
def create_drm(context):
"""Create the DRM wave input from the surface pulse and return its path."""
drm_file = context.output_dir / "drmload.h5drm"
motion_dir = Path(context.workspace) / "motions"
x_min, x_max, y_min, y_max, z_min, z_max = SOIL_BOUNDS
nx, ny, nz = SOIL_DIVISIONS
soil_box = pv.RectilinearGrid(
np.linspace(x_min, x_max, nx + 1),
np.linspace(y_min, y_max, ny + 1),
np.linspace(z_min, z_max, nz + 1),
).cast_to_unstructured_grid()
gravity = 9.81
surface_motion = TimeHistory.load(
acc_file=str(motion_dir / "ricker_surface.acc"),
time_file=str(motion_dir / "ricker_surface.time"),
unit_in_g=True,
gravity=gravity,
)
# Use the same soil stiffness, density, and depth as the 3D model.
shear_modulus = SOIL_E / (2.0 * (1.0 + SOIL_NU))
vs_soil = math.sqrt(shear_modulus / SOIL_RHO)
drm_profile = [
{"h": 8.0, "vs": vs_soil, "rho": SOIL_RHO, "damping": 0.0},
]
transfer_function = TransferFunction(
soil_profile=drm_profile,
rock={"vs": 8000.0, "rho": 2000.0, "damping": 0.0},
f_max=180.0,
)
incident_motion, _, _ = transfer_function.deconvolve(
surface_motion, return_all=True
)
drm_file = Path(drm_file)
drm_file.parent.mkdir(parents=True, exist_ok=True)
transfer_function.createDRM(
soil_box,
props={"shape": "box"},
time_history=incident_motion,
filename=str(drm_file),
)
return drm_file
def build_model(context):
"""Build the single PML two-pile bent case and return its Tcl path."""
drm_file = Path(context.result("input", "drm")).resolve()
if not drm_file.is_file():
raise FileNotFoundError(drm_file)
case_dir = Path(context.output_dir).resolve()
results_dir = case_dir / "results"
case_dir.mkdir(parents=True, exist_ok=True)
model = Model(model_name="two_pile_bent_drm", model_path=str(case_dir))
model.clear_model()
model.set_results_folder(results_dir.resolve().as_posix())
soil_material = model.material.nd.elastic_isotropic(
user_name="soil_mat",
E=SOIL_E,
nu=SOIL_NU,
rho=SOIL_RHO,
) # zero physical damping: linear elastic, no viscous terms
soil_element = model.element.brick.std(ndof=3, material=soil_material)
x_min, x_max, y_min, y_max, z_min, z_max = SOIL_BOUNDS
nx, ny, nz = SOIL_DIVISIONS
model.meshpart.volume.uniform_rectangular_grid(
user_name="soil",
element=soil_element,
x_min=x_min,
x_max=x_max,
y_min=y_min,
y_max=y_max,
z_min=z_min,
z_max=z_max,
nx=nx,
ny=ny,
nz=nz,
)
radius = PILE_DIAMETER / 2.0
pile_g = PILE_E / (2.0 * (1.0 + PILE_NU))
pile_area = math.pi * PILE_DIAMETER**2 / 4.0
pile_i = math.pi * PILE_DIAMETER**4 / 64.0
pile_j = math.pi * PILE_DIAMETER**4 / 32.0
pile_section = model.section.beam.elastic(
user_name="pile_section",
E=PILE_E,
A=pile_area,
Iz=pile_i,
Iy=pile_i,
G=pile_g,
J=pile_j,
)
# vecxz=(0,1,0) is perpendicular to both vertical piles and horizontal beams.
transformation = model.transformation.transformation3d(
transf_type="PDelta",
vecxz_x=0.0,
vecxz_y=1.0,
vecxz_z=0.0,
)
beam_element = model.element.beam.disp(
ndof=6,
section=pile_section,
transformation=transformation,
numIntgrPts=5,
)
model.meshpart.line.single_line(
user_name="pile_left",
element=beam_element,
x0=-PILE_X, y0=0.0, z0=PILE_BOTTOM,
x1=-PILE_X, y1=0.0, z1=PILE_TOP,
number_of_lines=PILE_ELEMENTS,
)
model.meshpart.line.single_line(
user_name="pile_right",
element=beam_element,
x0=PILE_X, y0=0.0, z0=PILE_BOTTOM,
x1=PILE_X, y1=0.0, z1=PILE_TOP,
number_of_lines=PILE_ELEMENTS,
)
model.meshpart.line.single_line(
user_name="cap_left",
element=beam_element,
x0=-PILE_X, y0=0.0, z0=CAP_Z,
x1=0.0, y1=0.0, z1=CAP_Z,
number_of_lines=CAP_ELEMENTS,
)
model.meshpart.line.single_line(
user_name="cap_right",
element=beam_element,
x0=PILE_X, y0=0.0, z0=CAP_Z,
x1=0.0, y1=0.0, z1=CAP_Z,
number_of_lines=CAP_ELEMENTS,
)
interface_left = model.interface.beam_solid_interface(
name="pile_soil_interface_left",
beam_part="pile_left",
solid_parts=["soil"],
radius=radius,
n_peri=8,
n_long=3,
penalty_param=1.0e12,
g_penalty=True,
)
interface_right = model.interface.beam_solid_interface(
name="pile_soil_interface_right",
beam_part="pile_right",
solid_parts=["soil"],
radius=radius,
n_peri=8,
n_long=3,
penalty_param=1.0e12,
g_penalty=True,
)
model.mass.meshpart.closest_point(
meshpart_name="cap_left",
xyz=(0.0, 0.0, CAP_Z),
mass_vec=(LUMPED_MASS, 0.0, 0.0),
combine="override",
)
model.interface.boundary.absorber(
num_layers=ABSORBER_LAYERS,
num_partitions=ABSORBER_PARTITIONS,
partition_algo="kd-tree",
geometry="Rectangular",
rayleigh_damping=0.05, # Supplementary damping in PML only; physical soil stays undamped
match_damping=False,
boundary_type="PML",
)
model.assembler.create_section(
meshparts=["soil", "pile_left", "pile_right", "cap_left", "cap_right"],
num_partitions=PHYSICAL_PARTITIONS,
partition_algorithm="kd-tree",
merge_points=True,
tolerance=1.0e-6,
)
model.assembler.assemble(merge_points=True, progress_callback=lambda *_: None)
actual_cores = set(int(core) for core in model.assembled_mesh.cell_data["Core"])
if actual_cores != set(range(RANKS)):
raise ValueError(
f"Expected ranks 0..{RANKS - 1}, exported cores: {sorted(actual_cores)}"
)
outer_fixity = [1] * 9 # PML outer faces carry 9 DOFs per node
model.constraint.sp.fix_macro_x_min(dofs=outer_fixity, tol=1.0e-6)
model.constraint.sp.fix_macro_x_max(dofs=outer_fixity, tol=1.0e-6)
model.constraint.sp.fix_macro_y_min(dofs=outer_fixity, tol=1.0e-6)
model.constraint.sp.fix_macro_y_max(dofs=outer_fixity, tol=1.0e-6)
model.constraint.sp.fix_macro_z_min(dofs=outer_fixity, tol=1.0e-6)
drm_tcl_path = drm_file.resolve().as_posix()
h5_pattern = model.pattern.h5drm(
filepath=drm_tcl_path,
factor=1.0,
crd_scale=1.0,
distance_tolerance=0.01,
do_coordinate_transformation=1,
transform_matrix=[1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0],
origin=[0.0, 0.0, 0.0],
)
response_recorder = model.recorder.vtkhdf(
file_base_name=RESPONSE_FILE,
# Trial beam end actions in VTKHDF. Keep XML/interface recorders until
# the installed OpenSees build and mixed-element mapping are verified.
resp_types=["disp", "vel", "accel", "force3D", "localForce3D"],
delta_t=RECORDER_DT,
)
interface_recorder = model.recorder.embedded_beam_solid_interface(
interface=[interface_left, interface_right],
dt=RECORDER_DT,
)
pile_force_recorder = model.recorder.beam_force(
meshparts=["pile_left", "pile_right"],
force_type="globalForce",
file_prefix="pile_force",
output_format="xml",
include_time=True,
delta_t=RECORDER_DT,
precision=16,
)
pile_local_force_recorder = model.recorder.beam_force(
meshparts=["pile_left", "pile_right"],
force_type="localForce",
file_prefix="pile_local_force",
output_format="xml",
include_time=True,
delta_t=RECORDER_DT,
precision=16,
)
cap_force_recorder = model.recorder.beam_force(
meshparts=["cap_left", "cap_right"],
force_type="globalForce",
file_prefix="cap_force",
output_format="xml",
include_time=True,
delta_t=RECORDER_DT,
precision=16,
)
constraint_handler = model.analysis.constraint.plain()
numberer = model.analysis.numberer.parallelrcm()
system = model.analysis.system.mumps()
test = model.analysis.test.energyincr(tol=1.0e-4, max_iter=10, print_flag=5)
algorithm = model.analysis.algorithm.modifiednewton(factor_once=True)
integrator = model.analysis.integrator.newmark(gamma=0.5, beta=0.25, form="D")
dynamic_analysis = model.analysis.transient(
name="dynamic_bent_response",
constraint_handler=constraint_handler,
numberer=numberer,
system=system,
test=test,
algorithm=algorithm,
integrator=integrator,
dt=DYNAMIC_DT,
final_time=FINAL_TIME,
max_retries=0,
)
model.process.add_step(model.actions.set_time(0.0), "Start dynamic time at zero")
model.process.add_step(h5_pattern, "Apply the H5DRM wave field")
model.process.add_step(response_recorder, "Record displacement, velocity, acceleration")
model.process.add_step(interface_recorder, "Record the embedded pile-soil interfaces")
model.process.add_step(pile_force_recorder, "Record both piles' global end forces and moments")
model.process.add_step(pile_local_force_recorder, "Record pile end actions in local beam axes")
model.process.add_step(cap_force_recorder, "Record cap end actions for pile-head balance checks")
model.process.add_step(dynamic_analysis, "Run the dynamic analysis")
case_dir.mkdir(parents=True, exist_ok=True)
tcl_file = case_dir / "model.tcl"
model.export_to_tcl(filename=str(tcl_file.resolve()), progress_callback=lambda *_: None)
# Match XML element tags to real geometry, not recorder/file ordering.
mesh = model.assembled_mesh
pile_geometry = {}
for name in ("pile_left", "pile_right"):
part = model.meshpart.get(name)
cells = np.flatnonzero(mesh.cell_data["MeshPartTag_celldata"] == part.tag)
pile_geometry[name] = [
{"tag": int(model._start_ele_tag + cell),
"core": int(mesh.cell_data["Core"][cell]),
"ends_m": mesh.get_cell(int(cell)).points.tolist()}
for cell in cells if mesh.celltypes[cell] == pv.CellType.LINE
]
(case_dir / "pile_geometry.json").write_text(
json.dumps(pile_geometry, indent=2), encoding="utf-8"
)
print("\nTwo-pile bent DRM response")
print(f" Nodes: {model.assembled_mesh.n_points}")
print(f" Elements: {model.assembled_mesh.n_cells}")
print(f" Piles: 2 x {PILE_ELEMENTS} elements (d={PILE_DIAMETER} m)")
print(f" Cap: 2 x {CAP_ELEMENTS} elements at z={CAP_Z} m")
print(f" DRM input: {drm_file.resolve()}")
print(f" Tcl model: {tcl_file.resolve()}")
return tcl_file
def postprocess_results(context, movies=False):
"""Run response extraction or movie rendering in a separate remote task."""
import matplotlib
matplotlib.use("Agg")
spec = importlib.util.spec_from_file_location(
"bent_postprocess", context.workspace / POSTPROCESS
)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
if movies:
return module.render_bent_movie(
results_root=context.workspace / "build", output_dir=context.output_dir,
)
return module.generate_results(
results_root=context.workspace / "build",
output_dir=context.output_dir,
profiles=True,
forces=True,
)
def build_workflow():
"""Minimal single-case workflow: input -> build -> solve -> postprocess."""
workflow = fm.Workflow("two-pile-bent-drm")
# All tasks run remotely. Each stage waits for the previous one to finish.
# context.output_dir is workspace / stage name / task name.
workflow.add("input", tasks=[fm.tasks.Python("drm", create_drm)])
workflow.add("build", parallel=False, tasks=[fm.tasks.Python("bent", build_model)])
workflow.add(
"solve",
parallel=False,
tasks=[fm.tasks.OpenSees("bent", "build/bent/model.tcl", ranks=RANKS)],
)
workflow.add(
"postprocess", tasks=[
fm.tasks.Python("responses", postprocess_results),
fm.tasks.Python("movie", postprocess_results, kwargs={"movies": True}),
]
)
# Return derived results and diagnostic logs, not the large raw recorder files.
workflow.outputs("postprocess/responses/*", "postprocess/movie/*",
"**/stdout.log", "build/*/model.tcl", "build/*/pile_geometry.json")
return workflow
if __name__ == "__main__":
# Set an app and allocation accessible to your account before submitting.
job = fm.submit(
function=build_workflow,
platform="tacc",
settings={
"app_id": "amnp95-femora-workflow-stampede3",
"system": "stampede3",
"queue": "skx-dev",
"allocation": "DesignSafe-SimCenter",
"nodes": 1,
"cores_per_node": 48,
"minutes": 120,
},
files={
POSTPROCESS: Path(__file__).with_name(POSTPROCESS),
"motions/ricker_surface.acc": motions_dir() / "ricker_surface.acc",
"motions/ricker_surface.time": motions_dir() / "ricker_surface.time",
},
)
print(f"Job UUID: {job.id}")