Discrete masonry arch under self-weight
A segmental arch built from 12 individual stone voussoir blocks (a0.stp … a11.stp). Each block is meshed separately and the blocks interact via frictional contact at their joints.
Boundary conditions:
- Both springers (first and last blocks) are pinned at their base.
Contact:
- Hard frictional contact (μ = 0.6) detected via
face_intersection.
Load:
- Gravity self-weight only.
Convergence notes:
- The middle voussoirs are constrained only by contact — they have no fixed
boundary conditions. Before contact forces converge, the blocks are
kinematically unsupported and can develop large rigid-body displacements.
If the analysis diverges, try one or more of the following:
• Increase
max_divergences(Ir) on theContactControls. • Loosen the force/displacement convergence tolerances. • Reduceinitial_inc_sizefurther (e.g. 1e-5) so that contact forces build up before significant unbalanced forces accumulate.allow_partial=True(the default) means a non-converged run still writes its best solution to the .frd file so it can be inspected.

The model before it is solved: its parts, supports (red) and loads (blue).
![The result: the model coloured by stress (vonMises [MPa])](/examples/example-structures/arch-discrete-results.webp)
The model, coloured by stress (vonMises [MPa]), 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/05_example_structures/arch_discrete.py. Run it from the repository with uv run python examples/scripts/05_example_structures/arch_discrete.py, or, with xfea-examples installed, xfea-examples run 05_example_structures/arch_discrete.py.
from xfea.model import HardContactFrictionPenaltyfrom xfea.problem import ContactControlsfrom xfea.problem import Problemfrom xfea.problem import StaticStepfrom xfea.results import DisplacementFieldResultsfrom xfea.results import StressFieldResults
from xfea_examples import out_dirfrom xfea_examples import viewer_wantedfrom xfea_examples.models import arch_discrete_modelfrom xfea.viewers import ViewerSettings, Viewer
# Model — 12 discrete voussoir blocksmu = 0.6 # [-] contact friction coefficientg = 9810 # [mm/s^2] gravity
model, parts, material, section = arch_discrete_model( name="arch_discrete", n_blocks=12, mesh_min=50, # [mm] target min element size mesh_max=200, # [mm] target max element size element_order=2, # C3D10 quadratic tets — better contact convergence)
# Boundary conditions# Pin the base of both springer blocks (block 0 = left, block 11 = right)for springer in (parts[0], parts[-1]): model.add_pin_bc(springer.find_nodes_on_plane(springer.bottom_plane))
# Contact interfaces between adjacent blocks# Only adjacent block pairs share a joint face, so we pass explicit part_pairs# instead of checking all C(12,2)=66 combinations. This is 6x faster with# 12 blocks, and even more so for larger assemblies.## face_intersection is robust for non-conforming meshes at the joints.contact = HardContactFrictionPenalty(mu=mu, tol=1)adjacent_pairs = [(parts[i], parts[i + 1]) for i in range(len(parts) - 1)]model.detect_interfaces( behavior=contact, method="face_intersection", part_pairs=adjacent_pairs,)
print(f"Blocks: {len(parts)}, interfaces detected: {len(model.interfaces)}")
# Problem — gravity analysis with nonlinear geometryproblem = model.add_problem(Problem(name="arch_gravity"))step = problem.add_step( StaticStep( name="gravity", nlgeom=True, max_increments=1000, initial_inc_size=0.1, min_inc_size=1e-3, # Loosen convergence tolerances for this contact-dominated problem. # The middle voussoirs are unsupported until contact forms, so tight # tolerances will cause early cutbacks. Increase max_divergences if # the solver still cuts back too aggressively. contact_controls=ContactControls( max_divergences=50, # allow more diverging iters before cutback residual_tolerance=0.10, # 10 % (vs default 2 %) -- looser force check correction_tolerance=0.20, # 20 % -- looser displacement check zero_load_tolerance=0.05, ), ))
step.add_gravity_field(g=g)
disp = DisplacementFieldResults()stress = StressFieldResults()step.add_field_outputs([disp, stress])
# Analysis# allow_partial=True (default): if the solver does not fully converge, the best# solution written to its results file is still extracted and can be inspected.problem.analyse_and_extract( path=out_dir(model.name), verbose=True, cpus=16,)
print("Discrete arch under self-weight")try: max_vert = disp.get_min_result("z") print(f"- Maximum vertical displacement: {max_vert.z}")except ValueError: print("- No converged results available (analysis did not fully converge).")
settings = ViewerSettings(show_result_vectors=False)
viewer = Viewer(plugin="browser")viewer.add_model(model)viewer.add_results({disp: "z"}, units="mm")if viewer_wanted(): # XFEA_EXAMPLES_SHOW_VIEWER=1, or `xfea-examples config set-show-viewer on` viewer.run()© 2026 Francesco Ranaudo · Text and pictures CC BY 4.0 · Code Elastic License 2.0 · how to reuse them