示例#1
0
import pickle
import numpy as np

import time

# import constants
lam, mu, gammadot, Gamma, max_stress, p0 = import_constants()
constants = import_constants()
# load sample floc
rawcoords = pickle.load(open('/home/eric/fragnew/input/processed_data/singlefloc.p','rb'))

myfloc = floc.Floc(rawcoords, constants, True)
myfloc.evolve_floc(FullOutput=True)

# get the surface forces and centers of facets
force_heads, force_tails, facet_areas = frc.set_fonfV(myfloc.a0, myfloc.wV[0], myfloc.Ra[0], gammadot, p0, mu)
force_heads *= 1 / facet_areas[:,None]  #undo the scaling by the area


# the image has a quarter-section cut out of it so we need to remove some 
# of the heads and tails. 

N = len(force_tails)
thetaV = np.zeros(N)
for i in range(N):
    thetaV[i] = np.arctan2(force_tails[i,1],force_tails[i,0])    

# shift up to (0,2pi]
thetaV += np.pi

# pick out the ones in the region to be removed
示例#2
0
# Test py_set_farg 
print('\n set_farg \n')
farg = frc.py_set_farg(a, w, L, p0, mu)
print('runs')
# Test py_scale_triangulation 
print('\n scale_triangulations \n')
srf_cV_scaled, srf_areas_scaled, srf_normals_scaled = frc.py_scale_triangulations(a)
print('runs')
# Test py_set_force_facets
print('\n set_force_facets \n')
fonfTest = frc.py_set_force_facets(farg, srf_normals_scaled, srf_areas_scaled)
print('runs')
# Test set_fonfV
print('\n set_fonfV \n')
farg,fonfV,cV,srf_areas_scaled = frc.set_fonfV(a, w, R, gammadot, p0, mu)
print('runs')


###############################################################################
###############################################################################
#####################          TEST STRESS FUNCTIONS       ####################
###############################################################################
###############################################################################

print("\n TESTING STRESS FUNCTIONS \n")

# Test set_stress
print('\n set_stress \n')
f = np.array([1.0, 0.0, 0.0])
pn = np.array([1.0,0.0,0.0])
示例#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
# set the initial axes
a0 = np.array([180., 160., 140.])
# compute the time interval
t0,t1,dt,tau,cap = dfm.set_tau_cap(a0, lam, mu, gammadot, Gamma)
t1 = .025*t1
dt = .025*dt
# get the rotations, axes and angular velocity
aV, RV, wV, T = dfm.deform(t0,t1,dt,a0,lam,mu,gammadot,Gamma)

# test force_facets, which sets the force on the centers of the facets
# 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
示例#5
0
# looking at the plots)

ind0 = 0
ind1 = 508
ind2 = 612
ind3 = 720


#axes0, w0, rotAngles0 = aV[ind0], wV[ind0], Ra[ind0]
#axes1, w1, rotAngles1 = aV[ind1], wV[ind1], Ra[ind1]
#axes2, w2, rotAngles2 = aV[ind2], wV[ind2], Ra[ind2]
#axes3, w3, rotAngles3 = aV[ind3], wV[ind3], Ra[ind3]


farg0, fonfV0, srf_centers_scaled0, srf_areas_scaled0 = frc.set_fonfV(aV[ind0], \
                                                                      wV[ind0],  \
                                                                      Ra[ind0], \
                                                                      gammadot, p0, mu)

farg1, fonfV1, srf_centers_scaled1, srf_areas_scaled1 = frc.set_fonfV(aV[ind1], \
                                                                      wV[ind1],  \
                                                                      Ra[ind1], \
                                                                      gammadot, p0, mu)

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],  \