def getCurlMag(pos): L = bpy.context.scene.my_props.P M = bpy.context.scene.my_props.Q N = bpy.context.scene.my_props.R #pos=obj.location R = ReferenceFrame('R') H = L* R.x +M * R.y + N * R.z F=H.subs([(x, R[0]), (y, R[1]), (z, R[2])]) G = curl(F, R) p=pos[0] q=pos[1] r=pos[2] if G==0: return 0 else: lis=list(G.args[0][0].subs([(R[0], p), (R[1], q), (R[2], r)])) u,v,w=lis[:] curl_vec=np.array([u,v,w]) mag=(np.dot(curl_vec,curl_vec))**.5 frame = bpy.context.scene.frame_current fps = bpy.context.scene.render.fps startFrame = bpy.context.scene.my_props.startFrame t = (frame-startFrame)/fps theta= mag*(t**2) return theta
def PVort(S,T,P,U,V): theta=np.zeros(np.shape(S)) for ii in range(0,np.shape(S)[1]): for jj in range(0,np.shape(S)[2]): theta[:,ii,jj]=sw.ptmp(S[:,ii,jj],T[:,ii,jj],P) rho=sw.dens(S,T,P) omega=7.2921159*10**(-5) zeta=2*omega+curl(U,V) Q=(1/rho)*(zeta)*np.gradient(theta)
def getCurlAxis(obj, pos): L = bpy.context.scene.my_props.P M = bpy.context.scene.my_props.Q N = bpy.context.scene.my_props.R R = ReferenceFrame('R') H =L* R.x + M * R.y + N * R.z #print(H) F=H.subs([(x, R[0]), (y, R[1]), (z, R[2])]) G = curl(F, R) a = pos[0] b = pos[1] c = pos[2] if G==0: pass else: lis = list(G.args[0][0].subs([(R[0], a), (R[1], b), (R[2], c)])) u,v,w=lis[:] vector=(u,v,w) DirectionVector = mathutils.Vector(vector) obj.rotation_mode = 'QUATERNION' obj.rotation_quaternion = DirectionVector.to_track_quat('Z','Y')
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jul 2 19:20:16 2021 @author: shrohanmohapatra """ from sympy.physics.vector import ReferenceFrame from sympy.physics.vector import curl from sympy import Function R = ReferenceFrame('R') psi = Function('psi') print(curl(psi(R[0], R[1]) * R.z, R)) print((-1) * curl(curl(curl(psi(R[0], R[1]) * R.z, R), R), R))
def rot(a): return curl(a, R)
def reducedLineCriteria(vectSlice, eps=1e-4): #computes the starting points for the strain/stress Lines #pts must satisfy abs(H(ki3) = abs(avg(grad(ki3) cross ki3)) < eps #H = helicity Helic = np.dot(vectSlice,sp.curl(vectSlice)) return