Skip to main content

debug_c_el/
debug_c_el.rs

1use section_properties::ParametricSection;
2use section_properties::fea::Tri6;
3use section_properties::geometry::Point;
4
5fn main() {
6    let points = [
7        Point::new(0.0, 0.0), // node 0
8        Point::new(1.0, 0.0), // node 1
9        Point::new(0.0, 1.0), // node 2
10        Point::new(0.5, 0.0), // node 3 (mid 0-1)
11        Point::new(0.5, 0.5), // node 4 (mid 1-2)
12        Point::new(0.0, 0.5), // node 5 (mid 2-0)
13    ];
14
15    let tri6 = Tri6::from_points(0, points, [0, 1, 2, 3, 4, 5], 1.0, 1.0, 1.0).unwrap();
16
17    let (k_el, f_el, c_el) = tri6.torsion_properties();
18
19    println!("=== Tri6 Element Matrices on Unit Triangle (C_e with 7-point rule) ===");
20    println!("\nC_e (6x1):");
21    for i in 0..6 {
22        println!("  C[{}] = {:.10}", i, c_el[i]);
23    }
24    let c_sum: f64 = c_el.iter().sum();
25    println!("Sum C_e = {:.10} (expected 0.5)", c_sum);
26
27    // Expected with correct 7-point rule:
28    // C_corner = A/12 = 0.5/12 = 0.041666...
29    // C_mid = A/6 = 0.5/6 = 0.08333...
30    println!(
31        "\nExpected: corner = {:.10}, mid = {:.10}",
32        0.5 / 12.0,
33        0.5 / 6.0
34    );
35}