def cp03(L_x=4, L_y=4, n_x=2, n_y=4, n_steps=80): rcp = YoshimuraCreasePattern( L_x=L_x, L_y=L_y, n_x=n_x, n_y=n_y, ) n_h = rcp.N_h n_i = rcp.N_i n_v = rcp.N_v lift = Lifting(cp=rcp, show_iter=False, MAX_ITER=500, n_steps=n_steps) caf = CnstrTargetFace(F=[r_, s_, 4 * 0.4 * t_ * r_ * (1 - r_ / L_x) + 0.15]) n_arr = np.hstack([n_h[:, :].flatten(), #n_v[:, :].flatten(), n_i[:, :].flatten() ]) lift.init_tf_lst = [(caf, n_arr)] lift.cnstr_lhs = [[(n_h[0, 0], 2, 1.0)], # 0 [(n_h[0, -1], 2, 1.0)], # 1 [(n_h[-1, 0], 2, 1.0)], # 2 [(n_h[-1, -1], 2, 1.0)], # 3 [(n_h[0, 1], 2, 1.0)], # 4 [(n_h[-1, 1], 2, 1.0)], # 5 [(n_h[0, 0], 1, 1.0)], # 6 [(n_h[0, 0], 1, 1.0), (n_h[1, 0], 1, -1.0)], # 7 [(n_h[0, 0], 1, 1.0), (n_h[-1, 0], 1, -1.0)], # 8 [(n_h[0, -1], 1, 1.0), (n_h[1, -1], 1, -1.0)], # 9 [(n_h[0, -1], 1, 1.0), (n_h[-1, -1], 1, -1.0)], # 10 [(n_h[1, 1], 0, 1.0)], # 11 [(n_h[0, -1], 1, 1.0)], # 12 [(n_h[1, 1], 1, 1.0), (n_h[0, 1], 1, -1.0)], # 13 [(n_h[1, 1], 1, 1.0), (n_h[-1, 1], 1, -1.0)], # 14 # [(n_h[1, 1], 2, 1.0), (n_h[1, 0], 2, -1.0)], # 13 # [(n_h[1, 1], 1, 1.0), (n_h[1, -1], 2, -1.0)], # 14 ] # lift node 0 in z-axes lift.cnstr_rhs[6] = 3.95 return lift
def cp01(L_x=4, L_y=2, n_x=2, n_y=2, n_steps=80): rcp = YoshimuraCreasePattern( L_x=L_x, L_y=L_y, n_x=n_x, n_y=n_y, ) n_h = rcp.N_h n_i = rcp.N_i n_v = rcp.N_v caf = CnstrTargetFace(F=[r_, s_, 4 * 0.4 * t_ * r_ * (1 - r_ / L_x) + 0.15]) n_arr = np.hstack([rcp.N_h[:, :].flatten(), #rcp.N_v[:, :].flatten(), rcp.N_i[:, :].flatten() ]) init = Initialization(cp=rcp, tf_lst=[(caf, n_arr)], t_init=0.1) lift = Lifting(source=init, n_steps=n_steps, show_iter=False, MAX_ITER=500 ) lift.cnstr_lhs = [[(n_h[0, 0], 2, 1.0)], # 0 [(n_h[0, -1], 2, 1.0)], # 1 [(n_h[-1, 0], 2, 1.0)], # 2 [(n_h[-1, -1], 2, 1.0)], # 3 [(n_h[1, 0], 2, 1.0)], # 4 [(n_h[0, 0], 1, 1.0), (n_h[1, 0], 1, -1.0)], # 5 [(n_h[0, 0], 1, 1.0), (n_h[-1, 0], 1, -1.0)], # 6 [(n_h[0, -1], 1, 1.0), (n_h[1, -1], 1, -1.0)], # 7 [(n_h[0, -1], 1, 1.0), (n_h[-1, -1], 1, -1.0)], # 8 [(n_h[1, 0], 0, 1.0)], # 9 [(n_h[0, -1], 1, 1.0)], # 10 ] # lift node 0 in z-axes lift.cnstr_rhs[4] = 1.999999999 return lift
def cp04(L_x=4, L_y=4, n_x=2, n_y=4, n_steps=100): rcp = YoshimuraCreasePattern(L_x=L_x, L_y=L_y, n_x=n_x, n_y=n_y, ) lift = Lifting(cp=rcp, n_steps=n_steps, show_iter=False, MAX_ITER=500) n_h = rcp.N_h n_i = rcp.N_i n_v = rcp.N_v caf = CnstrTargetFace(F=[r_, s_, 4 * 0.4 * t_ * r_ * (1 - r_ / L_x) + 0.15]) n_arr = np.hstack([n_h[:, :].flatten(), #n_v[:, :].flatten(), n_i[:, :].flatten() ]) lift.init_tf_lst = [(caf, n_arr)] z_nodes = n_h[(0, -1), :].flatten() z_cnstr = [[(n, 2, 1.0)] for n in z_nodes] y_links = [] for n_arr in n_h.T: for n in n_arr[1:]: y_links.append([(n_arr[0], 1, 1.0), (n, 1, -1.0)]) x_cnstr = [[(n_h[0, 0], 0, 1.0)]] y_cnstr = [[(n_h[0, -1], 1, 1.0)], [(n_h[0, 0], 1, 1.0)]] lift.cnstr_lhs = z_cnstr + y_links + x_cnstr + y_cnstr # lift node 0 in z-axes lift.cnstr_rhs[-1] = 3.9 return lift
def create_cp_fc_01(L_x=4, L_y=4, n_x=2, n_y=2, z0_ratio=0.1, n_steps=100): '''Create scalable rhombus crease pattern with face constraints One basic element with no general formulation ''' rcp = YoshimuraCreasePattern(n_steps=n_steps, L_x=L_x, L_y=L_y, n_x=n_x, n_y=n_y, show_iter=False, z0_ratio=z0_ratio, MAX_ITER=50) n_h = rcp.N_h n_i = rcp.N_i n_v = rcp.N_v cp = Lifting(n_steps=n_steps) cp.cp_geo(rcp) caf = CnstrTargetFace(F=[r_, s_, 4 * 0.4 * t_ * r_ * (1 - r_ / L_x) + 0.15]) n_arr = np.hstack([n_h[:, :].flatten(), #n_v[:, :].flatten(), n_i[:, :].flatten() ]) cp.init_tf_lst = [(caf, n_arr)] cp.cnstr_lhs = [[(n_h[0, 0], 1, 1.0), (n_h[1, 0], 1, -1.0)], # 1 [(n_h[0, 0], 1, 1.0), (n_h[-1, 0], 1, -1.0)], # 2 [(n_h[0, -1], 1, 1.0), (n_h[1, -1], 1, -1.0)], # 3 [(n_h[0, -1], 1, 1.0), (n_h[-1, -1], 1, -1.0)], # 4 [(n_h[0, -1], 1, 1.0)], [(n_h[1, 0], 0, 1.0)] ] print "n_h[1, 0]", n_h[1, 0] print "n_h[-1,-1]", n_h[-1, 0] print "n_h[1, -1]", n_h[1, -1] print "n_h[-1,-1]", n_h[-1, -1] print "cnstr_lhs", cp.cnstr_lhs print "cnstr_rhs", cp.cnstr_rhs A = 0.2 face_z_t = CF(Rf=z_ - 4 * A * t_ * x_ * (1 - x_ / L_x)) face_x_L2 = CF(Rf=x_ - L_x / 2) cp.cf_lst = [(face_z_t, n_h[0, :]), (face_z_t, n_h[-1, :]), (face_z_t, [n_h[1, 0]]), ] print "edge1", n_h[0, :] print "edge2", n_h[-1, :] return cp
def create_cp_fc_03(L_x=4, L_y=4, n_x=2, n_y=2, z0_ratio=0.1, n_steps=100): '''Create scalable rhombus crease pattern with face constraints other constraints chosen (more in field in z-direction) ''' rcp = YoshimuraCreasePattern(L_x=L_x, L_y=L_y, n_x=n_x, n_y=n_y, z0_ratio=z0_ratio, ) n_h = rcp.N_h n_i = rcp.N_i n_v = rcp.N_v lift = Lifting(cp=rcp, n_steps=n_steps, show_iter=False, MAX_ITER=50) caf = CnstrTargetFace(F=[r_, s_, 4 * 0.4 * t_ * r_ * (1 - r_ / L_x) + 0.15]) n_arr = np.hstack([n_h[:, :].flatten(), #n_v[:, :].flatten(), n_i[:, :].flatten() ]) lift.init_tf_lst = [(caf, n_arr)] y_links = [] n_h_idx = (n_x + 1) / 2 print "n_h_idx", n_h_idx for idx, n in enumerate(n_h[1:, 0]): y_links.append([(n_h[0, 0], 1, 1.0), (n, 1, -1.0)]) for idx, n in enumerate(n_h[1:-1, -1]): y_links.append([(n_h[0, -1], 1, 1.0), (n, 1, -1.0)]) for idx, n in enumerate(n_h[n_h_idx, 1:]): y_links.append([(n, 0, 1.0)]) y_links.append([(n_h[0, -1], 1, 1.0)]) lift.cnstr_lhs = y_links print "n_h[1, 0]", n_h[1, 0] print "n_h[-1,-1]", n_h[-1, 0] print "n_h[1, -1]", n_h[1, -1] print "n_h[-1,-1]", n_h[-1, -1] print "cnstr_lhs", lift.cnstr_lhs print "cnstr_rhs", lift.cnstr_rhs A = 0.784 face_z_t = CF(Rf=z_ - 4 * A * t_ * x_ * (1 - x_ / L_x)) # face_x_L2 = CF(Rf = x_ - L_x / 2) n_arr = np.hstack([n_h[n_h_idx, :].flatten(), n_h[0, :].flatten(), n_h[-1, :].flatten()]) lift.cf_lst = [(face_z_t, n_arr)] print "edge1", n_h[0, :] print "edge2", n_h[-1, :] print "center", n_h[1:-1, :] return lift
def create_cp_fc_02(L_x=4, L_y=4, n_x=2, n_y=2, z0_ratio=0.1, n_steps=100): '''Create scalable rhombus crease pattern with face constraints One basic element with general formulation (extension in y-direction variabel) (extension in x-direction has to be adepted manually) ''' rcp = YoshimuraCreasePattern(n_steps=n_steps, L_x=L_x, L_y=L_y, n_x=n_x, n_y=n_y, show_iter=False, z0_ratio=z0_ratio, MAX_ITER=50) n_h = rcp.N_h n_i = rcp.N_i n_v = rcp.N_v cp = Lifting(n_steps=n_steps) cp.cp_geo(rcp) caf = CnstrTargetFace(F=[r_, s_, 4 * 0.4 * t_ * r_ * (1 - r_ / L_x) + 0.15]) n_arr = np.hstack([n_h[:, :].flatten(), #n_v[:, :].flatten(), n_i[:, :].flatten() ]) cp.init_tf_lst = [(caf, n_arr)] n_h_idx = n_x / 2 n_h_idx = n_x / 2 y_links = [] for n_arr in n_h[0:3, :].T: for idx, n in enumerate(n_arr[1:]): n_x = len(n_arr) y_links.append([(n_arr[0], 1, 1.0), (n, 1, -1.0)]) ''' Extension in x-direction ''' #y_links.append([(n_h[0,0], 1, 1.0), (n_h[-1,0], 1, -1.0)]) #y_links.append([(n_h[0,0], 1, 1.0), (n_h[-2,0], 1, -1.0)]) y_links.append([(n_h[0, -1], 1, 1.0)]) y_links.append([(n_h[1, 0], 0, 1.0)]) cp.cnstr_lhs = y_links print "n_h[1, 0]", n_h[1, 0] print "n_h[-1,-1]", n_h[-1, 0] print "n_h[1, -1]", n_h[1, -1] print "n_h[-1,-1]", n_h[-1, -1] print "cnstr_lhs", cp.cnstr_lhs print "cnstr_rhs", cp.cnstr_rhs A = 0.2 face_z_t = CF(Rf=z_ - 4 * A * t_ * x_ * (1 - x_ / L_x)) cp.cf_lst = [(face_z_t, n_h[1:-1, 0]), (face_z_t, n_h[0, :]), (face_z_t, n_h[-1, :]) ] print "edge1", n_h[0, :] print "edge2", n_h[-1, :] print "center", n_h[1:-1, 0] return cp
def create_cp_fc_inclined(L_x=4, L_y=4, n_x=2, n_y=4, n_steps=100): '''Create scalable rhombus crease pattern with face constraints ''' rcp = YoshimuraCreasePattern(n_steps=n_steps, L_x=L_x, L_y=L_y, n_x=n_x, n_y=n_y, show_iter=False, MAX_ITER=50) n_h = rcp.N_h n_i = rcp.N_i n_v = rcp.N_v cp = Lifting(n_steps=n_steps) cp.cp_geo(rcp) caf = CnstrTargetFace(F=[r_, s_, 4 * 0.4 * t_ * r_ * (1 - r_ / L_x) + 0.15]) n_arr = np.hstack([n_h[:, :].flatten(), #n_v[:, :].flatten(), n_i[:, :].flatten() ]) cp.init_tf_lst = [(caf, n_arr)] y_links = [] # n_h0 = n_h[(0, -1), :-1] # n_h1 = n_h[(0, -1), 1:] # for nv, nh0, nh1 in zip(n_v.T, n_h0.T, n_h1.T): # for v, h0, h1 in zip(nv, nh0, nh1): # print 'constraining', h0, h1 # y_links.append([(h0, 1, 1.0), (h1, 1, -1.0)]) n_h0 = n_h[(0, -1), :-1] n_h1 = n_h[(0, -1), 1:] for nv in n_v.T: print 'adding constraint', nv y_links.append([(nv[0], 0, 1.0), (nv[1], 0, 1.0)]) # here was a conflict @todo - resolve with Jan # for nv, nh0, nh1 in zip(n_v.T, n_h0.T, n_h1.T): # for v, h0, h1 in zip(nv, nh0, nh1): # y_links.append([(v, 1, 1.0), (h1, 1, -0.5)]) cp.cnstr_lhs = y_links print "cnstr_lhs", cp.cnstr_lhs print "cnstr_rhs", cp.cnstr_rhs # A = L_x * 0.2 A = 0.2 # face_z_t = CF(Rf = z_ - 4 * A * t_ / L_x * x_ * (1 - x_ / L_x)) face_z_t = CF(Rf=z_ - 4 * A * t_ * x_ * (1 - x_ / L_x)) face_x_L2 = CF(Rf=x_ - L_x / 2) face_y_L2 = CF(Rf=y_ - L_y / 2) # face_y_Ly = CF(Rf = y_ - L_y) #old n_h_idx = n_x / 2 z_nodes = n_h[:, :].flatten() # y_nodes = n_i[:, 0] # + list(n_v[:, :].flatten()) y_nodes = n_i[0, 0] # + list(n_v[:, :].flatten()) cp.cf_lst = [(face_y_L2, [n_i[0, 0]]), (face_z_t, z_nodes), ## (face_x_L2, n_h[2, (0, -1)].flatten()), # (face_x_L2, n_h[n_h_idx, (0, -1)].flatten()), (face_x_L2, n_h[n_h_idx, :].flatten()), ] return cp
def create_cp_fc_bow(L_x=4, L_y=4, n_x=4, n_y=2, z0_ratio=0.1, n_steps=100): '''Create scalable rhombus crease pattern with face constraints bad working ''' rcp = YoshimuraCreasePattern(n_steps=n_steps, L_x=L_x, L_y=L_y, n_x=n_x, n_y=n_y, show_iter=False, z0_ratio=z0_ratio, MAX_ITER=50) n_h = rcp.N_h n_i = rcp.N_i n_v = rcp.N_v cp = Lifting(n_steps=n_steps) cp.cp_geo(rcp) caf = CnstrTargetFace(F=[r_, s_, 4 * 0.4 * t_ * r_ * (1 - r_ / L_x) + 0.15]) n_arr = np.hstack([n_h[:, :].flatten(), #n_v[:, :].flatten(), n_i[:, :].flatten() ]) cp.init_tf_lst = [(caf, n_arr)] # y_links = [] # n_h0 = n_h[(0, -1), :-1] # n_h1 = n_h[(0, -1), 1:] # for nv, nh0, nh1 in zip(n_v.T, n_h0.T, n_h1.T): # for v, h0, h1 in zip(nv, nh0, nh1): # y_links.append([(v, 1, 1.0), (h1, 1, -0.5)]) # cp.cnstr_lhs = y_links # cp.cnstr_rhs = np.zeros((len(cp.cnstr_lhs),), dtype = float) # print "cnstr_lhs", cp.cnstr_lhs # print "cnstr_rhs", cp.cnstr_rhs # A = L_x * 0.2 A = 0.2 # face_z_t = CF(Rf = z_ - 4 * A * t_ / L_x * x_ * (1 - x_ / L_x)) face_z_t = CF(Rf=z_ - 4 * A * t_ * x_ * (1 - x_ / L_x)) face_x_L2 = CF(Rf=x_ - L_x / 2) #old # face_y_L2 = CF(Rf = y_ - L_y / 2) #new face_y_L0 = CF(Rf=y_) # face_y_Ly = CF(Rf = y_ - L_y) # n_h_idx = n_x / 2 # z_nodes = n_h[:, :].flatten() # cp.cf_lst = [(face_y_L2, [n_i[0, 0]]), # (face_z_t, z_nodes), ### (face_x_L2, n_h[2, (0, -1)].flatten()), ## (face_x_L2, n_h[n_h_idx, (0, -1)].flatten()), # (face_x_L2, n_h[n_h_idx, :].flatten()), # ] #new n_h_idx = n_x / 2 z_nodes_field1 = n_h[1:n_h_idx, 0].flatten() z_nodes_field2 = n_h[(n_h_idx + 1):-1, 0].flatten() z_nodes_field3 = n_h[1:n_h_idx, 1].flatten() z_nodes_field4 = n_h[(n_h_idx + 1):-1, 1].flatten() cp.cf_lst = [(face_y_L0, [n_h[0, 0]]), (face_y_L0, [n_h[n_h_idx, -1]]), (face_y_L0, [n_h[-1, 0]]), (face_z_t, z_nodes_field1), (face_z_t, z_nodes_field2), (face_z_t, z_nodes_field3), (face_z_t, z_nodes_field4), (face_z_t, n_h[n_h_idx, :]), (face_z_t, n_h[0, :]), (face_z_t, n_h[-1, :]), # (face_z_t, n_h[n_h_idx,1:]), # (face_x_L2, n_h[2, (0, -1)].flatten()), # (face_x_L2, n_h[n_h_idx, (0, -1)].flatten()), (face_x_L2, n_h[n_h_idx, :].flatten()), ] print "field1", z_nodes_field1 print "field2", z_nodes_field2 print "edge1", n_h[0, :] print "edge2", n_h[-1, :] print "center", n_h[n_h_idx, :] return cp
def cp05(L_x=4, L_y=4, n_x=2, n_y=4, n_steps=100, skew_coeff=0.0): '''Exploit symmetric constraints ''' rcp = YoshimuraCreasePattern( L_x=L_x, L_y=L_y, n_x=n_x, n_y=n_y, ) n_h = rcp.N_h n_i = rcp.N_i n_v = rcp.N_v lift = Lifting(cp=rcp, n_steps=n_steps, show_iter=False, MAX_ITER=500) caf = CnstrTargetFace(F=[r_, s_, 4 * 0.4 * t_ * r_ * (1 - r_ / L_x) + 0.15]) n_arr = np.hstack([n_h[:, :].flatten(), #n_v[:, :].flatten(), n_i[:, :].flatten() ]) lift.init_tf_lst = [(caf, n_arr)] z_nodes = n_h[(0, -1), :].flatten() z_cnstr = [[(n, 2, 1.0)] for n in z_nodes] y_links = [] for n_arr in n_h[:, (0, -1)].T: for idx, n in enumerate(n_arr[1:]): n_x = len(n_arr) coeff = skew_coeff * float(idx + 1) / float(n_x) y_links.append([(n_arr[0], 1, 1.0 - coeff), (n, 1, -1.0)]) for n_arr in n_h[:, 1:-1].T: y_links.append([(n_arr[0], 1, 1.0), (n_arr[-1], 1, -1.0)]) x_links = [] z_links = [] # for n0, n1 in zip(n_h[1:-1, 0], n_h[1:-1, -1]): # x_links.append([(n0, 0, 1.0), (n1, 0, 1.0)]) # z_links.append([(n0, 2, 1.0), (n1, 2, -1.0)]) for n in n_v[0, 1:]: z_links.append([(n_v[0, 0], 2, 1.0), (n, 2, -1.0)]) n_h_idx = n_y / 4 x_cnstr = [[(n_h[0, n_h_idx], 0, 1.0)]] y_cnstr = [[(n_h[0, n_h_idx], 1, 1.0)]] cntrl = [[(n_h[-1, n_h_idx], 0, 1.0)]] #cntrl = [[(n_h[-1, 0], 1, 1.0)]] lift.cnstr_lhs = z_cnstr + x_links + y_links + z_links + x_cnstr + y_cnstr + cntrl # lift node 0 in z-axes lift.cnstr_rhs[-1] = -L_x * 0.1 return lift
def create_cp_fc(L_x=4, L_y=4, n_x=1, n_y=2, n_steps=100): '''Create scalable rhombus crease pattern with face constraints ''' rcp = YoshimuraCreasePattern(L_x=L_x, L_y=L_y, n_x=n_x, n_y=n_y) n_h = rcp.N_h n_i = rcp.N_i n_v = rcp.N_v n_h_idx = n_y / 4 lift = Lifting(cp=rcp, n_steps=n_steps, show_iter=False, MAX_ITER=500) caf = CnstrTargetFace(F=[r_, s_, 4 * 0.4 * t_ * r_ * (1 - r_ / L_x) + 0.15]) n_arr = np.hstack([rcp.N_h[:, :].flatten(), #rcp.N_v[:, :].flatten(), rcp.N_i[:, :].flatten() ]) lift.init_tf_lst = [(caf, n_arr)] x_links = [] y_links = [] z_links = [] # for n_arr in n_h[:, (-1,)].T: # for idx, n in enumerate(n_arr[1:]): # y_links.append([(n_arr[0], 1, 1.0), (n, 1, -1.0)]) for n in n_v[-1, 1:]: x_links.append([(n_v[-1, 0], 0, 1.0), (n, 0, -1.0)]) for n0, n1 in zip(n_v[0, :], n_v[-1, :]): z_links.append([(n0, 2, 1.0), (n1, 2, -1.0)]) #cntrl = [[(n_h[-1, -1], 1, 1.0)]] #cntrl = [[(n_h[-1, 1], 0, 1.0)]] lift.cnstr_lhs = x_links + y_links + z_links # + cntrl #cp.cnstr_lhs = z_cnstr # lift node 0 in z-axes #cp.cnstr_rhs[-1] = -L_x * 0.34 face_z_0 = CF(Rf=z_ - 0) face_x_0 = CF(Rf=x_ - 0) face_x_L = CF(Rf=x_ - L_x * (1 - 0.2 * t_)) face_y_0 = CF(Rf=y_ - 0) face_y_L = CF(Rf=y_ - L_y * (1 - 0.1 * t_))#* x_ / L_x)) lift.cf_lst = [(face_x_0, n_h[0, :]), # [n_h[0, 0], n_h[0, -1]]), (face_z_0, n_h[0, :]), # [n_h[0, 0], n_h[0, -1]]), (face_y_0, n_h[:, 0]), # (face_x_L, []), (face_y_L, n_h[:, -1])] # cp.cnstr_rhs[-1] = -L_y * 0.9999 return lift
def create_cp_dc(L_x=4, L_y=4, n_x=1, n_y=2, n_steps=100): '''Create scalable rhombus crease pattern with dof_constraints ''' rcp = YoshimuraCreasePattern(L_x=L_x, L_y=L_y, n_x=n_x, n_y=n_y) n_h = rcp.N_h n_i = rcp.N_i n_v = rcp.N_v n_h_idx = n_y / 4 lift = Lifting(cp=rcp, n_steps=n_steps, show_iter=False, MAX_ITER=500) caf = CnstrTargetFace(F=[r_, s_, 4 * 0.4 * t_ * r_ * (1 - r_ / L_x) + 0.15]) n_arr = np.hstack([rcp.N_h[:, :].flatten(), #rcp.N_v[:, :].flatten(), rcp.N_i[:, :].flatten() ]) lift.init_tf_lst = [(caf, n_arr)] x_links = [] y_links = [] z_links = [] z_nodes = n_h[(0, 0, -1, -1), (0, -1, -1, 0)].flatten() print 'z_nodes', z_nodes #z_cnstr = [[(n, 2, 1.0)] for n in z_nodes] x_cnstr = [[(n_h[0, 0], 0, 1.0)]] y_cnstr = [[(n_h[0, 0], 1, 1.0)]] z_cnstr = [[(n_h[0, 0], 2, 1.0)]] for n_arr in n_h[:, (0, -1)].T: for idx, n in enumerate(n_arr[1:]): n_x = len(n_arr) y_links.append([(n_arr[0], 1, 1.0), (n, 1, -1.0)]) for n in n_h[0, 1:]: z_links.append([(n_h[0, 0], 2, 1.0), (n, 2, -1.0)]) x_links.append([(n_h[0, 0], 0, 1.0), (n, 0, -1.0)]) #x_links.append([(n_h[0, -1], 0, 1.0), (n_h[0, -1], 1, -0.5)]) for n in n_v[-1, 1:]: x_links.append([(n_v[-1, 0], 0, 1.0), (n, 0, -1.0)]) for n0, n1 in zip(n_v[0, :], n_v[-1, :]): z_links.append([(n0, 2, 1.0), (n1, 2, -1.0)]) #cntrl = [[(n_h[-1, -1], 1, 1.0)]] cntrl = [[(n_h[-1, 1], 0, 1.0)]] print 'x_cnstr', len(x_cnstr) print 'y_cnstr', len(y_cnstr) print 'z_cnstr', len(z_cnstr) print 'x_links', len(x_links) print 'y_links', len(y_links) print 'z_links', len(z_links) lift.cnstr_lhs = z_cnstr + x_links + y_links + z_links + x_cnstr + y_cnstr + cntrl #cp.cnstr_lhs = z_cnstr # lift node 0 in z-axes lift.cnstr_rhs[-1] = -L_x * 0.34 # cp.cnstr_rhs[-1] = -L_y * 0.9999 return lift
def create_cp_fc_inclined(L_x=4, L_y=4, n_x=1, n_y=2, n_steps=100): '''Create scalable rhombus crease pattern with face constraints ''' rcp = YoshimuraCreasePattern(L_x=L_x, L_y=L_y, n_x=n_x, n_y=n_y) n_h = rcp.N_h n_i = rcp.N_i n_v = rcp.N_v n_h_idx = n_y / 4 lift = Lifting(cp=rcp, n_steps=n_steps, show_iter=False, MAX_ITER=2000) caf = CnstrTargetFace(F=[r_, s_, 4 * 0.4 * t_ * r_ * (1 - r_ / L_x) + 0.15]) n_arr = np.hstack([rcp.N_h[:, :].flatten(), #rcp.N_v[:, :].flatten(), rcp.N_i[:, :].flatten() ]) lift.init_tf_lst = [(caf, n_arr)] x_links = [] y_links = [] z_links = [] # for n_arr in n_h[:, (-1,)].T: # for idx, n in enumerate(n_arr[1:]): # y_links.append([(n_arr[0], 1, 1.0), (n, 1, -1.0)]) # for n in n_v[-1, 1:]: # x_links.append([(n_v[-1, 0], 0, 1.0), (n, 0, -1.0)]) # for n0, n1 in zip(n_v[0, :], n_v[-1, :]): # z_links.append([(n0, 2, 1.0), (n1, 2, -1.0)]) # y_links.append([(n0, 1, 1.0), (n1, 1, -1.0)]) #cntrl = [[(n_h[-1, -1], 1, 1.0)]] #cntrl = [[(n_h[-1, 1], 0, 1.0)]] lift.cnstr_lhs = x_links + y_links + z_links # + cntrl #cp.cnstr_lhs = z_cnstr # lift node 0 in z-axes #cp.cnstr_rhs[-1] = -L_x * 0.34 # face_z_0 = CF(Rf = z_ - (1 - x_ / L_x) * 0.2 * t_) face_z_0 = CF(Rf=z_ - 0) face_x_0 = CF(Rf=x_ - 0) # face_x_L = CF(Rf = x_ - L_x * (1 - 0.2 * t_)) # face_y_0 = CF(Rf = y_ - 0) # face_y_L = CF(Rf = y_ - L_y * (1 - 0.1 * t_)) #parallel movement bothsided face_y_0 = CF(Rf=y_ - L_y * (0.05 * t_))# * x_ / L_x) face_y_L = CF(Rf=y_ - L_y * (1 - 0.05 * t_))# * x_ / L_x) #parallel movement: one side inclined # face_y_0 = CF(Rf = y_ - L_y / 2.0 * (0.1 * t_) * x_ / L_x) # face_y_L = CF(Rf = y_ - L_y * (1 - 0.05 * t_))# * x_ / L_x) #one side inclined, other side fixed # face_y_0 = CF(Rf = y_ - 0) # face_y_L = CF(Rf = y_ - L_y + L_y * 0.1 * t_* x_ / L_x) ##symmetric inclined along x # face_y_0 = CF(Rf = y_ - L_y / 2.0 * 0.1 * t_ * x_ / L_x) # face_y_L = CF(Rf = y_ - L_y + L_y / 2.0 * 0.1 * t_ * x_ / L_x) # ##symmetric inclined along both x and y # face_y_0 = CF(Rf = y_ - L_y / 2.0 * 0.05 * t_ * y_ / L_y) # face_y_L = CF(Rf = y_ - L_y + L_y / 2.0 * 0.05 * t_ * y_ / L_y) # cp.cf_lst = [(face_x_0, n_h[0, :]), # (face_z_0, n_h[0, :]), # (face_y_0, n_h[:, 0]), # (face_y_L, n_h[:, -1])] z_nodes = n_h[:, :].flatten() print z_nodes lift.cf_lst = [(face_x_0, [n_h[0, 0]]), (face_z_0, z_nodes), (face_y_0, n_h[:, 0]), (face_y_L, n_h[:, -1])] return lift
from oricrete.folding2 import CreasePattern, Lifting, CreasePatternView cp = CreasePattern(X=[[ 0, 0, 0 ], [ 1, 0, 0 ]], L=[[ 0, 1 ]]) lift = Lifting(cp=cp, n_steps=10, dof_constraints=[([(0, 1, 1.0)], 1.0), ([(0, 2, 1.0)], 0.0), ([(0, 0, 1.0)], 0.0), ([(1, 2, 1.0)], 0.0), ([(0, 1, 0.5), (1, 1, -1.0)], 0.0)] ) lift.U_0[4] = 0.1 v = CreasePatternView(root=lift.root) v.configure_traits()
from oricrete.folding2 import CreasePattern, Lifting, CreasePatternView cp = CreasePattern(X=[[ 0, 0, 1.0 ], [ 1, 0, 1.5 ], [ 0.5, 0.0, 0.0], [ 0.1, 0, 1.05]], L=[[ 0, 1 ], [ 2, 3 ]], F=[[0, 1, 3]]) lift = Lifting(cp=cp, n_steps=10, LP=[[3, 0]], dof_constraints=[([(3, 0, 1.0)], 0.82), ([(1, 2, 1.0)], 0.0), ([(1, 1, 1.0)], 0.0), ([(0, 2, 1.0)], 0.0), ([(0, 1, 1.0)], 0.0), ([(2, 0, 1.0)], 0.0), ([(2, 1, 1.0)], 0.0), ([(0, 0, 1.0)], 0.0)]) lift.U_0[9] = 0.1 v = CreasePatternView(root=lift.root) v.configure_traits()
from oricrete.folding2 import CreasePattern, Lifting, CreasePatternView cp = CreasePattern(X=[[0, 0, 0], [1, 0, 0], [1, 1, 0], [0.5, 0.3, 0]], # node for the grab point L=[[0, 1], [1, 2], [2, 0]], F=[[0, 1, 2]]) lift = Lifting(cp=cp, n_steps=10, GP=[[3, 0]], dof_constraints=[([(0, 0, 1.0)], 0.0), ([(0, 1, 1.0)], 0.0), ([(0, 2, 1.0)], 0.0), ([(1, 1, 1.0)], 0.0), ([(2, 1, 1.0)], 0.0), ([(3, 2, 1.0)], 0.3)]) lift.U_0[8] = 0.1 v = CreasePatternView(root=lift.source) v.configure_traits()