diff --git a/structuralcodes/materials/constitutive_laws/_bilinearcompression.py b/structuralcodes/materials/constitutive_laws/_bilinearcompression.py index 4709c95..d6e4262 100644 --- a/structuralcodes/materials/constitutive_laws/_bilinearcompression.py +++ b/structuralcodes/materials/constitutive_laws/_bilinearcompression.py @@ -52,9 +52,9 @@ def get_stress( # If it is a scalar if np.isscalar(eps): if eps > 0 or eps < self._eps_cu: - return 0 + return 0 return max(self._E * eps, self._fc) - + # If it is an array sig = self._E * eps sig[sig < self._fc] = self._fc diff --git a/tests/test_materials/test_constitutive_laws.py b/tests/test_materials/test_constitutive_laws.py index e1a2659..a6b6e19 100644 --- a/tests/test_materials/test_constitutive_laws.py +++ b/tests/test_materials/test_constitutive_laws.py @@ -489,7 +489,7 @@ def test_bilinearcompression(fc, eps_c, eps_cu): """Test BilinearCompression material.""" law = BilinearCompression(fc=fc, eps_c=eps_c, eps_cu=eps_cu) - eps = np.linspace(-2*eps_cu, eps_c, 20) + eps = np.linspace(-2 * eps_cu, eps_c, 20) # compute expected E = fc / eps_c @@ -503,10 +503,13 @@ def test_bilinearcompression(fc, eps_c, eps_cu): # compute from BilinearCompression sig_computed_array = law.get_stress(eps) - sig_computed_scalar = np.array([law.get_stress(eps_scalar) for eps_scalar in eps]) + sig_computed_scalar = np.array( + [law.get_stress(eps_scalar) for eps_scalar in eps] + ) tan_computed_array = law.get_tangent(eps) - tan_computed_scalar = np.array([law.get_tangent(eps_scalar) for eps_scalar in eps]) - + tan_computed_scalar = np.array( + [law.get_tangent(eps_scalar) for eps_scalar in eps] + ) # Compare the two assert_allclose(sig_computed_array, sig_expected) @@ -514,7 +517,6 @@ def test_bilinearcompression(fc, eps_c, eps_cu): assert_allclose(tan_computed_array, tan_expected) assert_allclose(tan_computed_scalar, tan_expected) - # Test getting ultimate strain eps_min, eps_max = law.get_ultimate_strain() assert math.isclose(eps_min, -eps_cu) @@ -522,4 +524,4 @@ def test_bilinearcompression(fc, eps_c, eps_cu): eps_min, eps_max = law.get_ultimate_strain(yielding=True) assert math.isclose(eps_min, -eps_c) - assert math.isclose(eps_max, 100) \ No newline at end of file + assert math.isclose(eps_max, 100)