File size: 857 Bytes
bbe9b3e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import numpy as np

from src.generate_t2_graybox_closure import closure_design, material, solve


def test_reference_is_intentionally_richer_than_closure_state():
    law = material()
    assert law.backstress_count == 3
    assert law.isotropic_hardening is not None
    assert len(law.isotropic_hardening.equivalent_plastic_strain) == 7


def test_closure_cohort_preserves_total_reference_backstress():
    row = closure_design(4)[0]
    nine_points = 9
    result = solve(row, points=nine_points)
    assert result["strain"].shape == (nine_points, 6)
    assert result["truth_memories_pa"].shape == (nine_points, 3, 6)
    assert result["memories_pa"].shape == (nine_points, 2, 6)
    np.testing.assert_allclose(
        result["memories_pa"].sum(axis=1),
        result["truth_memories_pa"].sum(axis=1),
        rtol=1.0e-12,
        atol=1.0e-5,
    )