def test_ex_8(self): """ Plastic hinges test """ SS_8.solve() u4 = (SS_8.get_node_displacements(4)["uy"] ** 2 + SS_8.get_node_displacements(4)["ux"] ** 2) ** 0.5 * 1000 self.assertAlmostEqual(u4, 106.45829880642854, places=5)
from anastruct.fem.examples.ex_8_non_linear_portal import ss from copy import deepcopy import time import subprocess import os ELEMENT_MAP = deepcopy(ss.element_map) min_ = 1e8 n = 25 save = True for i in range(n): t0 = time.time() ss.solve(verbosity=1) ss.element_map = deepcopy(ELEMENT_MAP) t = time.time() - t0 print(t) min_ = min(min_, t) print(f"Best of {n} = {min_} s.") if save: with open("non-linear-solve.csv", "a") as f: os.chdir("../../..") git_label = str(subprocess.check_output(["git", "describe", "--tags"])).replace('\\n', '').replace("'", "")[1:] f.write(f"{git_label}, {min_}\n")
from anastruct.fem.examples.ex_8_non_linear_portal import ss from copy import deepcopy import time import subprocess import os ELEMENT_MAP = deepcopy(ss.element_map) min_ = 1e8 n = 25 save = True for i in range(n): t0 = time.time() ss.solve(verbosity=1) ss.element_map = deepcopy(ELEMENT_MAP) t = time.time() - t0 print(t) min_ = min(min_, t) print(f"Best of {n} = {min_} s.") if save: with open("non-linear-solve.csv", "a") as f: os.chdir("../../..") git_label = (str(subprocess.check_output(["git", "describe", "--tags"])).replace( "\\n", "").replace("'", "")[1:]) f.write(f"{git_label}, {min_}\n")