示例#1
0
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


## Test set_force and stress
a = aV[ind]
pn = np.array([1,0,0], dtype=float)
px = np.zeros(3)
stress = frc.py_set_stress(a, fonfV, cV, pn, px)
total_force = frc.py_set_force(a, fonfV, cV, pn, px)
print("\n set_force \n")
print("you don't want this to be 0: %e" %total_force)

## test set_force_Vectorized
NN = np.shape(RV)[0]
#rotAngles = np.zeros([NN,2])
#rotAngles[:,0] = RV[:,0,0]
#rotAngles[:,1] = RV[:,1,0]
pnV = np.random.rand(10,3)
pxV = np.zeros([10,3])
forces = frc.py_set_force_Vectorized(aV, RV, wV, pnV, pxV, gammadot, p0, mu)
# check the relevant entry of this matrix with the computation above
test_ind = 0
a = aV[test_ind]
w = wV[test_ind]
aoi = np.zeros([M,M])

RVs = RV[0::K,:,:]
wVs = wV[0::K,:]
axesVs = axesV[0::K,:]


for i in range(M):
  R = RVs[i]
  w = wVs[i]
  a = axesVs[i]
  fonfV, cV = frc.set_fonfV(a, w, R, gammadot, p0, mu)
  size = np.shape(fonfV)[0]
  for j in range(M):
    px = np.array([xcoords[j], 0., 0.])
    force[i,j] = frc.py_set_force(a, fonfV, cV, pn, px)
    aoi[i,j] = frc.py_area_of_intersection(a,pn,px)
# convert from micro newtons / mircometer ^ 2 to N/m^2 = Pa
# force = force * 1e6
# rows index time, columns index position of plane



ymin = T[0]
ymax = T[-1]
xmin = xcoords[0]
xmax = xcoords[-1]

aspectratio = (xmax-xmin)/(ymax-ymin)

pickle.dump([force,xcoords,T,[xmin,xmax,ymin,ymax]],open("force_data.p","wb"))
示例#3
0
for n in range(NN):
    lam = lamV[n]
    for j in range(JJ):
        #gammadot = gdotV[j]
        Gamma = GammaV[j]
        # compute the time interval
        t0,t1,dt,tau,cap = dfm.set_tau_cap(a0, lam, mu, gammadot, Gamma)
        # get the rotations, axes and angular velocity
        axesV, RV, wV, T = dfm.deform(t0,t1,dt,a0,lam,mu,gammadot,Gamma)
        # thin out the data
        axesV = axesV[0::K]
        RV = RV[0::K]
        wV = wV[0::K]
        T = T[0::K]
        #plt.plot(T,-wV[:,2])
        #plt.title("lam = %i, gdot = %f" %(lam,gammadot))
        #plt.show()
        # get the force on the facets
        MM = np.shape(T)[0]
        force = -np.inf
        for m in range(MM):
            fonfV, cV = frc.set_fonfV(axesV[m], wV[m], RV[m], gammadot, p0, mu)
            force_new = frc.py_set_force(axesV[m], fonfV, cV, pn, px)
            if force_new > force:
                force = force_new
        forceV[n,j] = force


#pickle.dump([lamV, gdotV, forceV], open("pardep_lamgdot.p", "wb"))
#pickle.dump([lamV, GammaV, forceV], open("pardep_lamGammaV.p", "wb"))
示例#4
0
文件: trash.py 项目: tsokawe/fragnew
import numpy as np


# import the constants
lam, mu, gammadot, Gamma, max_stress, p0 = import_constants()
# set the initial axes
a0 = np.array([180.0, 160.0, 140.0])
# compute the time interval
t0, t1, dt, tau, cap = dfm.set_tau_cap(a0, lam, mu, gammadot, Gamma)
# get the rotations, axes and angular velocity
aV, RV, wV, T = dfm.deform(t0, t1, dt, a0, lam, mu, gammadot, Gamma)


TimeInd = 100
a = aV[TimeInd]
w = wV[TimeInd]
R = RV[TimeInd]
rotAng = np.array([R[0, 0], R[1, 0]])
pn = np.array([1.0, 0.0, 0.0])
px = np.zeros(3)

fonfV1, cV = frc.set_fonfV(a, w, R, gammadot, p0, mu)
force1 = frc.py_set_force(a, fonfV1, cV, pn, px)

fonfV2, force2 = frc.py_set_force_Vectorized(a, rotAng, w, pn, px, gammadot, p0, mu)

L0 = np.zeros([3, 3])
L0[0, 1] = gammadot

Lrot = np.dot(np.dot(R, L0), R.T)
示例#5
0
farg2, fonfV2, srf_centers_scaled2, srf_areas_scaled2 = frc.set_fonfV(aV[ind2], \
                                                                      wV[ind2],  \
                                                                      Ra[ind2], \
                                                                      gammadot, p0, mu)


farg3, fonfV3, srf_centers_scaled3, srf_areas_scaled3 = frc.set_fonfV(aV[ind3], \
                                                                      wV[ind3],  \
                                                                      Ra[ind3], \
                                                                      gammadot, p0, mu)

# compute the force wrt a plane
pn = np.array([1.0,0.0,0.0])
px = np.array([0.0,0.0,0.0])

force0 =  frc.py_set_force(aV[ind0], fonfV0, srf_centers_scaled0, pn, px)
force1 =  frc.py_set_force(aV[ind1], fonfV1, srf_centers_scaled1, pn, px)
force2 =  frc.py_set_force(aV[ind2], fonfV2, srf_centers_scaled2, pn, px)
force3 =  frc.py_set_force(aV[ind3], fonfV3, srf_centers_scaled3, pn, px)

# get all forces so we know the max
forces_all = frc.py_set_force_Vectorized(aV, Ra, wV, pn, px, gammadot, p0, mu)
forcemax = np.max(np.abs(forces_all))


indices = [ind0, ind1, ind2, ind3]
forces =  [force0, force1, force2, force3, forcemax]
angles =  [Ra[ind] for ind in indices]
axes =    [aV[ind] for ind in indices]
angvels = [wV[ind,2] for ind in indices]
fargs =   [farg0, farg1, farg2, farg3]