Skip to content

Commit

Permalink
TST: test clean-up and completion
Browse files Browse the repository at this point in the history
  • Loading branch information
saullocastro committed Mar 11, 2024
1 parent 1302afa commit f4fd747
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
7 changes: 0 additions & 7 deletions composites/kassapoglou.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,3 @@ def calc_Nxx_crit_combined_shear_full(Nxy, a, b, D11, D12, D16, D22, D26, D66):
Nxx_crit2 = a*(36*a11 + 9*a22 + sqrt(term))/(18*pi**2*b)
return min(abs(Nxx_crit1), abs(Nxx_crit2))


if __name__ == '__main__':
# NOTE a difficult convergence case...
args = '0.8 14089642.804130534 2011013.713237885 5.359101079856173e-12 5453279.395887981 2582673.2451443337'.split(' ')
args = map(float, args)
test = calc_Nxy_crit(*args)

10 changes: 9 additions & 1 deletion tests/test_kassapoglou.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def test_calc_Nxx_crit():
#plt.plot(AR_values, np.asarray(res))
#plt.show()

assert np.allclose(calc_Nxx_crit(b*AR, b, 1, 1, D11, D12, D22, D66),
calc_Nxx_crit(b*AR, b, 1, None, D11, D12, D22, D66))

try:
calc_Nxx_crit(b*AR, b, None, None, D11, D12, D22, D66)
except NotImplementedError:
Expand All @@ -81,10 +84,15 @@ def test_calc_Nxy_crit():
a_values = np.linspace(0.1, 0.5)
res = []
for a in a_values:
res.append(calc_Nxy_crit(a, lam.D[0, 0], lam.D[0, 1], lam.D[0, 2], lam.D[1, 1], lam.D[2, 2]))
res.append(calc_Nxy_crit(a, lam.D11, lam.D12, lam.D16, lam.D22, lam.D66))
res_expected = [79688.55992406543, 68114.0022704454, 58889.57598574364, 51419.57333450177, 45285.73547400736, 40187.4044061502, 35903.96554281875, 32270.57385354717, 29162.053403091162, 26481.969879263816, 24155.06026735022, 22121.89066686104, 20335.02310316517, 18756.22315240477, 17354.39749457425, 16104.051205932257, 14984.120320908534, 13977.078850002274, 13068.248915899261, 12245.262872171586, 11497.640308736318, 10816.452732075362, 10194.055750316005, 9623.87366720392, 9100.225083361767, 8618.180819678446, 8173.447493599944, 7762.271588205649, 7381.359992966362, 7027.813861439158, 6699.073294971503, 6392.870873657024, 6107.192453563187, 5840.243960125795, 5590.423152014058, 5356.295523016742, 5136.573663123334, 4930.099522731353, 4735.829122489075, 4552.8193308193, 4380.216395633825, 4217.245969223063, 4063.204408198967, 3917.45116557157, 3779.4021210406136, 3648.5237195644836, 3524.327808168894, 3406.3670775281935, 3294.2310286958063, 3187.5423969626177]
assert np.allclose(res, res_expected)

try:
calc_Nxy_crit(a, -lam.D11, lam.D12, lam.D16, lam.D22, lam.D66)
except RuntimeError:
pass

#import matplotlib.pyplot as plt
#plt.plot(a_values*1000, np.asarray(res)/1000)
#plt.xlabel('Plate dimension a [mm]')
Expand Down

0 comments on commit f4fd747

Please sign in to comment.