def drive(model, orientations, erate, steps, L, T = 300): pmodel = polycrystal.TaylorModel(model, orientations, nthreads = nthreads) L *= erate dt = emax / steps / erate h_n = pmodel.init_store() d_inc = nemlmath.sym(0.5*(L+L.T)) w_inc = nemlmath.skew(0.5*(L-L.T)) s_n = np.zeros((6,)) d_n = np.zeros((6,)) w_n = np.zeros((3,)) u_n = 0.0 p_n = 0.0 D = [np.zeros(6,)] S = [np.zeros(6,)] for i in range(steps): print(i) d_np1 = d_n + d_inc * dt w_np1 = w_n + w_inc * dt try: s_np1, h_np1, A_np1, B_np1, u_np1, p_np1 = pmodel.update_ld_inc( d_np1, d_n, w_np1, w_n, T, T, dt, 0, s_n, h_n, u_n, p_n) except RuntimeError: break d_n = np.copy(d_np1) w_n = np.copy(w_np1) s_n = np.copy(s_np1) h_n = np.copy(h_np1) u_n = u_np1 p_n = p_np1 D.append(d_np1) S.append(s_np1) return np.array(D), np.array(S)
E = 100000.0 nu = 0.3 t0 = 50.0 ts = 50.0 b = 100.0 g0 = 1.0 n = 12.0 # Setup L *= erate dt = emax / steps / erate d = nemlmath.sym(0.5 * (L + L.T)) w = nemlmath.skew(0.5 * (L - L.T)) model = parse.parse_xml("cpmodel.xml", "example") T = 300.0 h_n = model.init_store() s_n = np.zeros((6, )) d_n = np.zeros((6, )) w_n = np.zeros((3, )) u_n = 0.0 p_n = 0.0 t_n = 0.0
def test_skew_to_vector(self): """ Test C++ tensor -> skew """ self.assertTrue(np.allclose(self.Wv, nemlmath.skew(self.W)))