Linear triangle elements
The linear triangle is a three-node constant-strain triangle (CST) for 2D plane
stress. Each node contributes ux and uy displacement DOFs, with
corresponding fx and fy nodal forces.
Use nusa.model.LinearTriangleModel with
nusa.element.LinearTriangle.
Element properties
A CST element requires a material with Young’s modulus E and Poisson’s ratio
nu, plus an explicitly specified thickness:
material = Material(E=200e9, nu=0.3)
element = LinearTriangle(
(n1, n2, n3),
material=material,
thickness=0.1,
)
The canonical element result contains constant strain and stress components:
strain_xx
strain_yy
strain_xy
stress_xx
stress_yy
stress_xy
Example: single CST element
The following example builds a single triangular element, constrains two nodes, applies an in-plane load, solves the model, and plots nodal fields.
1# -*- coding: utf-8 -*-
2# ***********************************
3# Author: Pedro Jorge De Los Santos
4# E-mail: delossantosmfq@gmail.com
5# License: MIT License
6# ***********************************
7
8import matplotlib.pyplot as plt
9
10from nusa import LinearTriangle, LinearTriangleModel, Material, Node, plot_model
11
12
13def build_model():
14 model = LinearTriangleModel("Single CST")
15
16 n1 = Node((0.0, 0.0))
17 n2 = Node((1.0, 0.5))
18 n3 = Node((0.0, 1.0))
19
20 material = Material(E=200e9, nu=0.3)
21 model.add_nodes([n1, n2, n3])
22 model.add_element(
23 LinearTriangle((n1, n2, n3), material=material, thickness=0.1)
24 )
25 model.add_constraint(n1, ux=0.0, uy=0.0)
26 model.add_constraint(n3, ux=0.0, uy=0.0)
27 model.add_force(n2, (1000.0, 0.0))
28 return model
29
30
31def main():
32 model = build_model()
33 plot_model(model)
34
35 result = model.solve()
36 result.plot_nodal_field("ux")
37 result.plot_nodal_field("stress_xx")
38 plt.show()
39
40
41if __name__ == "__main__":
42 main()
Element and nodal fields
Element fields are read directly from the canonical element results:
result.element_field("stress_xx")
Nodal fields can be recovered from element values:
result.nodal_field("stress_xx")
For the current CST implementation, element scalar fields are recovered to nodes using arithmetic averaging over adjacent elements.
Derived fields
NuSA also provides selected derived nodal fields:
result.nodal_field("displacement_magnitude")
result.nodal_field("von_mises_stress")
Legacy short aliases such as sxx and seqv are still accepted by the
post-processing helpers, while the canonical names are preferred in new code.
Visualization
Problem geometry, loads, and constraints are plotted from the model:
from nusa import plot_model
plot_model(model)
Solved scalar fields are plotted from the result:
result.plot_nodal_field("stress_xx")
result.plot_element_field("stress_xx")
This distinction is especially useful for continuum problems because the mesh belongs to the problem definition while stress/strain fields belong to a particular analysis result.