# for a fixed time point time_ind = 75 a = aV[time_ind] w = wV[time_ind] R = RV[time_ind] fonfV, cV = frc.set_fonfV(a, w, R, gammadot, p0, mu) # get the centers of the facets cV, trash, srf_normals_scaled = frc.py_scale_triangulations(a) # get the corrected magnitude of the stress for a sample intersecting plane pn = np.array([1.0,0.0,0.0]) #px = np.zeros(3) #px = np.array([-0.003-6.26 ,0.0,0.0]) #px2 = np.array([-0.004-6.26 ,0.0,0.0]) pnp = np.random.rand(3) pn = pnp/np.linalg.norm(pnp) pxp = np.random.rand(3) px = .5*a0*pxp N = np.shape(fonfV)[0] nf = np.zeros(N) for i in range(N): nf[i] = frc.py_correct_pndotf(fonfV[i], cV[i], pn, px) aoi = frc.py_area_of_intersection(a,pn,px) stress = frc.py_stress(a, fonfV, cV, pn, px) norms = np.array([np.linalg.norm(x) for x in fonfV]) maxnorm = np.max(norms)
else: print("FAILED") problem = True ## Test correct_pndotf print("\n correct_pndotf \n") # case 1: force points away from plane, does not intersect f = np.array([1.0, 0.0, 0.0]) c = np.array([1.0, 0.0, 0.0]) pn = np.array([1.0,0.0,0.0]) px = np.zeros(3) pndotf = np.dot(f,pn) pndotf_test = frc.py_correct_pndotf(f, c, pn, px) if (pndotf == pndotf_test): print("passed") else: print("FAILED") problem = True # case 2: force points towards plane, does not intersect f = np.array([1.0, 0.0, 0.0]) c = np.array([-3.0, 0.0, 0.0]) pn = np.array([1.0,0.0,0.0]) px = np.zeros(3) pndotf = np.dot(f,pn) pndotf_test = frc.py_correct_pndotf(f, c, pn, px) if (pndotf == - pndotf_test):
dt = (1.2 * dt) / 2.0 # get the rotations, axes and angular velocity axesV, RV, wV, T = dfm.deform(t0,t1,dt,a0,lam,mu,gammadot,Gamma) M = 500 scale = .9 xcoords = np.linspace(-scale*a0[0],scale*a0[0],M) px = np.zeros(3) pn = np.array([1.0,0.0,0.0]) N = np.shape(RV)[0] K = int(np.floor(N / M)) RVs = RV[0::K,:,:] wVs = wV[0::K,:] axesVs = axesV[0::K,:] i = 122 j = 69 R = RVs[i] w = wVs[i] a = axesVs[i] fonfV, cV = frc.set_fonfV(a, w, R, gammadot, p0, mu) ind = 3230 f = fonfV[ind] c = cV[ind] px = np.array([xcoords[j], 0., 0.]) #force = frc.py_set_force(a, fonfV, cV, pn, px) dot = frc.py_correct_pndotf(f,c,pn,px) print(dot)