Cross-braced shear panel — mixed TrussElement + TieElement diagonals
Part 3 of the unilateral-elements series.
A one-bay braced frame in the xz plane:
n_tl ────── top chord ────── n_tr ← lateral load applied here │ \ / │ │ \ / │ │ \ diag B diag A/ │ columns are regular TrussElements │ \ / │ both diagonals are TieElements │ \ / │ (so each can only pull) │ \ / │ │ \ / │ │ \ / │ │ \ / │ │ \ / │ │ \ / │ │ \/ │ │ /\ │ │ / \ │ │ / \ │ │ / \ │ │ / \ │ │ / \ │ │ / \ │ n_bl ─── bottom chord ────── n_br (both pinned)
diag A = bl → trdiag B = br → tlApplying a horizontal load at n_tr stretches diag A (it’s the diagonal
oriented from bottom-left to top-right of the shear direction) while
diag B would want to shorten — since both diagonals are TieElement
with zero stiffness in compression, diag B goes slack and diag A alone
carries the shear, like a cable-braced steel panel. Flipping the load
sign swaps the roles.
Both load cases are solved and the axial force in each diagonal is reconstructed from the nodal displacements.
Units: mm / N / MPa.

The model before it is solved: its parts, supports (red) and loads (blue).
![The result: the deformed shape coloured by displacement (magnitude [mm])](/examples/core-concepts/unilateral-elements/03-cross-braced-panel-results.webp)
The deformed shape, coloured by displacement (magnitude [mm]), in xfea’s 3D viewer.
Open in 3D turn it, cut it, pick any field: in xfea's viewer, in your browser
The script
Section titled “The script”examples/scripts/02_core_concepts/unilateral_elements/03_cross_braced_panel.py. Run it from the repository with uv run python examples/scripts/02_core_concepts/unilateral_elements/03_cross_braced_panel.py, or, with xfea-examples installed, xfea-examples run 02_core_concepts/unilateral_elements/03_cross_braced_panel.py.
from __future__ import annotations
import mathfrom pathlib import Path
from xfea.model import ( ElasticIsotropic, Model, Node, Part, TieElement, TieSection, TrussElement, TrussSection,)from xfea.problem import Problem, StaticStepfrom xfea.results import DisplacementFieldResults
from xfea_examples import out_dir
# Panel geometry — one bay, 3 m wide × 3 m tallW = 3_000.0 # [mm] bay widthH = 3_000.0 # [mm] bay heightA_CHORD = 2_000.0 # [mm²] chord/column areaA_DIAG = 200.0 # [mm²] slender tie diagonal areaP = 50_000.0 # [N] lateral load at n_tr
steel = ElasticIsotropic(E=210_000.0, v=0.3, density=7.85e-9, name="steel")
def build_panel(tag: str) -> tuple[Model, dict[str, Node], dict[str, object]]: model = Model(name=f"cross_braced_panel_{tag}") part = model.add_part(Part(name="panel"))
nodes = { "bl": part.add_node(Node(xyz=[0.0, 0.0, 0.0])), "br": part.add_node(Node(xyz=[W, 0.0, 0.0])), "tl": part.add_node(Node(xyz=[0.0, 0.0, H])), "tr": part.add_node(Node(xyz=[W, 0.0, H])), }
chord = TrussSection(A=A_CHORD, material=steel) tie = TieSection(A=A_DIAG, material=steel)
# Four bilateral chords/columns — carry compression and tension. part.add_element(TrussElement(nodes=[nodes["bl"], nodes["br"]], section=chord)) # bottom part.add_element(TrussElement(nodes=[nodes["tl"], nodes["tr"]], section=chord)) # top part.add_element(TrussElement(nodes=[nodes["bl"], nodes["tl"]], section=chord)) # left col part.add_element(TrussElement(nodes=[nodes["br"], nodes["tr"]], section=chord)) # right col
# Tension-only diagonals. diag_a = TieElement(nodes=[nodes["bl"], nodes["tr"]], section=tie) diag_b = TieElement(nodes=[nodes["br"], nodes["tl"]], section=tie) part.add_element(diag_a) part.add_element(diag_b)
# Pin base, clamp out-of-plane (y) on top nodes so the panel stays planar. model.add_pin_bc(nodes=[nodes["bl"], nodes["br"]]) model.add_rollerXZ_bc(nodes=[nodes["tl"], nodes["tr"]]) return model, nodes, {"diag_a": diag_a, "diag_b": diag_b}
def _axis(n1: Node, n2: Node) -> tuple[float, float, float]: dx = float(n2.x) - float(n1.x) dy = float(n2.y) - float(n1.y) dz = float(n2.z) - float(n1.z) mag = math.sqrt(dx * dx + dy * dy + dz * dz) return (dx / mag, dy / mag, dz / mag)
def _elongation(element, disp_field, time) -> float: n1, n2 = element.nodes u1 = disp_field.get_result_at(n1, time=time) u2 = disp_field.get_result_at(n2, time=time) du = (float(u2.x) - float(u1.x), float(u2.y) - float(u1.y), float(u2.z) - float(u1.z)) ax, ay, az = _axis(n1, n2) return du[0] * ax + du[1] * ay + du[2] * az
def _axial_force(element, disp_field, time, mode: str): L_el = float(element.length) K = float(element.section.material.E) * float(element.section.A) / L_el delta = _elongation(element, disp_field, time) if mode == "tie": N = K * delta if delta > 0 else 0.0 elif mode == "bilateral": N = K * delta else: raise ValueError(mode) return delta, K, N
def solve_case(tag: str, load_x: float) -> dict: model, nodes, diagonals = build_panel(tag)
problem = model.add_problem(Problem(name=f"{model.name}_run")) step = problem.add_step( StaticStep( name=tag, nlgeom=True, initial_inc_size=0.25, max_inc_size=1.0, min_inc_size=1e-4, max_increments=60, ) ) step.add_uniform_forcefield(nodes=[nodes["tr"]], x=load_x, load_case=tag)
disp = DisplacementFieldResults() step.add_field_outputs([disp])
out = Path(out_dir(model.name)) try: problem.analyse_and_extract(path=out, verbose=False) except Exception as exc: return {"ok": False, "error": f"{type(exc).__name__}: {exc}"}
STEP_END = 1.0 forces = {} for name, element in diagonals.items(): delta, K, N = _axial_force(element, disp, STEP_END, "tie") forces[name] = {"delta": delta, "K": K, "N": N} # Drift = horizontal displacement of the top-right corner. u_tr = disp.get_result_at(nodes["tr"], time=STEP_END) drift = float(u_tr.x) return {"ok": True, "drift": drift, "forces": forces}
def _print_case(label: str, res: dict): print(f"--- {label} ---") if not res["ok"]: print(f" solver failure: {res['error']}") return print(f" top-right drift δx : {res['drift']:+.4f} mm") for name, data in res["forces"].items(): tag = " (slack)" if abs(data["N"]) < 1.0 else "" print(f" {name}: δ = {data['delta']:+.4f} mm, " f"N = {data['N']:+.1f} N{tag}") print()
if __name__ == "__main__": print("Cross-braced panel demo — 4 bilateral chord/column trusses +") print("two TieElement diagonals, all sharing one steel ElasticIsotropic.") print(f" bay: {W:.0f} × {H:.0f} mm") print(f" chord A = {A_CHORD:.0f} mm², tie A = {A_DIAG:.0f} mm²") print(f" load: ± {P:.0f} N in x at n_tr") print()
# Rough analytical estimate for the single active-diagonal regime: theta = math.atan2(H, W) L_diag = math.hypot(W, H) N_diag_ref = P / math.cos(theta) # horizontal equilibrium at n_tr K_diag = steel.E * A_DIAG / L_diag delta_ref = N_diag_ref / K_diag drift_ref = delta_ref / math.cos(theta) # drift ≈ δ / cosθ print("Single-tie-active reference (ignoring chord stretch):") print(f" active diagonal N ≈ P / cosθ = {N_diag_ref:+.1f} N") print(f" active diagonal δ ≈ N / K = {delta_ref:+.4f} mm") print(f" top drift δx ≈ δ / cosθ = {drift_ref:+.4f} mm") print()
_print_case( "Lateral load +X at n_tr (diag A should pull, diag B slack)", solve_case("push_right", +P), ) _print_case( "Lateral load -X at n_tr (diag A slack, diag B pulls)", solve_case("push_left", -P), )
print( "Interpretation:\n" " Pushing right stretches diag A (bl → tr) — it carries the\n" " full shear in tension and the frame drifts by δ / cosθ.\n" " Diag B (br → tl) would be shortened by the same motion, but\n" " a tie carries no force in compression → it goes slack and\n" " carries ≈ 0.\n" "\n" " Pushing left flips the roles. This is the canonical\n" " behaviour of a cable-braced shear wall: only ONE diagonal\n" " is active under any given load direction, so you normally\n" " provide a tie in each diagonal to cover both directions of\n" " lateral load.\n" )© 2026 Francesco Ranaudo · Text and pictures CC BY 4.0 · Code Elastic License 2.0 · how to reuse them