def evolve_floc(self, Deform = True, MaxTimes = 100, TimeRange = None, FullOutput = False): """ Inputs: MaxTimes int; number of time points to compute the stress over. The deformation integral returns more than we want to use for efficiency reasons when doing these computations over thousands of flocs at once. TimeRange [t0, t1, dt] or None. If None (default), will use dfm's set_tau_cap function to automatically determine the time step and final time. FullOutput Bool; if True will set attributes Ra, wV, and T (see below). Sets Attributes:: forces[MaxTimes][NEdges] float, NEdges is the number of edges in the floc. i j entry is the fragmentation force acting against the j plane at time i aV[MaxTimes][3] float, axes lenghts at each time step (optional) Ra[MaxTimes][2] float, the two unique entries defining rotation R (cos theta, sin theta) wV[MaxTimes][3] float, angular velocity at each time step T[MaxTimes] float, times """ if len(self.mst_sph) == 0: # then the floc is size 1 and won't fragment so we don't bother deforming it Ra = np.array([]) wV = np.array([]) T = np.array([]) forces = np.array([]) else: # compute the time interval if we don't have one if TimeRange == None: t0, t1, dt, tau, cap = dfm.set_tau_cap(self.a0, self.lam, self.mu, self.gammadot, self.Gamma) else: t0,t1,dt = TimeRange # deform the floc (or just rotate if not deforming or is too elongated already) if ( (Deform == True) & (self.a0[0] / self.a0[1] < 6.0) ): aV, Ra, wV, T = dfm.deform(t0, t1, dt, self.a0, self.lam, self.mu, self.gammadot, self.Gamma, True) else: aV, Ra, wV, T = dfm.solid_rotations(t0, t1, dt, self.a0, self.gammadot, True) # shorten the length of the output if np.shape(T)[0] > MaxTimes: StepSize = int(np.floor(np.shape(T)[0] / MaxTimes)) aV = np.ascontiguousarray( aV[::StepSize] ) Ra = np.ascontiguousarray( Ra[::StepSize] ) wV = np.ascontiguousarray( wV[::StepSize] ) T = np.ascontiguousarray( T[::StepSize] ) # get the force matrix forces = frc.py_set_force_Vectorized(aV, Ra, wV, self.pnV_sph, \ self.pxV_sph, self.gammadot, self.p0, self.mu) self.aV = aV if FullOutput == True: self.Ra = Ra self.wV = wV self.T = T self.forces = forces
x = R.T * x' Discussion: =========== R from deform is the map from the body-frame to the laboratory frame. The way we check this is to apply R to the vector (0,1,0). We can think of this like a point on the ellipsoid, scaled to unit length. We know that the shear field we apply will cause the ellipsoid to rotate clockwise in the XY plane. Applying R to (0,1,0) causes this vector to rotate clockwise in the XY plane, which means it sends the point (0,1,0) in the body-fixed frame to its coordinates in the lab frame. """ # import the constants lam, mu, gammadot, Gamma, max_stress, p0 = import_constants() # 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) # get the rotations, axes and angular velocity axes, R, w, T = dfm.deform(t0,t1,dt,a0,lam,mu,gammadot,Gamma, JustAngles = True) Rm = np.zeros([len(T),3,3]) for i in range(len(T)): Rm[i] = dfm.angles_to_matrix(R[i]) # how does R rotate things? let's see. x0 = np.array([0,1.,0]) xR = np.dot(Rm,x0) # xR is a unit vector rotating clockwise in the XY plane, as desired.