def cntLD(X, Y, XY, IJ, F, r): #Equivalent load for node r = ref._r(XY) EL = ref.XYToEL(ref.XYToNL(X, Y, XY), X, Y, XY, IJ) N = IJ[EL][1][:,1].reshape(1,-1)[0] LD = [[N[0], F*r/8.0, -F*r/8.0, F/4.0], [N[1], F*r/8.0, F*r/8.0, F/4.0], [N[2], -F*r/8.0, F*r/8.0, F/4.0], [N[3], -F*r/8.0, -F*r/8.0, F/4.0]] return LD
def simplyLMy(length, start, XY): #@start [x,y] X = start[0] Y = start[1] r = ref._r(XY) startNL = ref.XYToNL(X, Y, XY) endNL = ref.XYToNL(X, Y + length, XY) step = ref.XYToNL(0, 2.0*r, XY) if length < 0: step*= -1 LMs = [[N,1,0,1] for N in range(startNL, endNL + step, step)] return LMs
def toimshowtr(arrS, scale, width, height, XY): #@width, height: from mesh() cache = mc.Client() if not cache.get('FEMZQ4.imgS')==None: dataArr = cache.get('FEMZQ4.imgS') else: scale_pro = scale / (ref._r(XY)*2.0) scaledData = [[[int(round(l[0][0]*scale_pro)),int(round(l[0][1]*scale_pro))], l[1]] for l in arrS] dataArr = reduce(ref.coordcopy, scaledData, np.zeros((height*scale,width*scale,3))) cache.set('FEMZQ4.imgS', dataArr) return dataArr
def simplyLMy(length, start, XY): #@start [x,y] X = start[0] Y = start[1] r = ref._r(XY) startNL = ref.XYToNL(X, Y, XY) endNL = ref.XYToNL(X, Y + length, XY) step = ref.XYToNL(0, 2.0 * r, XY) if length < 0: step *= -1 LMs = [[N, 0, 1, 1] for N in range(startNL, endNL + step, step)] return LMs
def simplyLMx(length, start, XY): #@start [x,y] X = start[0] Y = start[1] r = ref._r(XY) startNL = ref.XYToNL(X, Y, XY) endNL = ref.XYToNL(X + length, Y, XY) if length < 0: step = -1 if length > 0: step = 1 LMs = [[N,0,1,1] for N in range(startNL, endNL + step, step)] return LMs
def simplyLMx(length, start, XY): #@start [x,y] X = start[0] Y = start[1] r = ref._r(XY) startNL = ref.XYToNL(X, Y, XY) endNL = ref.XYToNL(X + length, Y, XY) if length < 0: step = -1 if length > 0: step = 1 LMs = [[N, 1, 0, 1] for N in range(startNL, endNL + step, step)] return LMs
def SIGME(DP, FEMinput, scale): cache = mc.Client() if not cache.get('FEMZQ4.S') == None: S = cache.get('FEMZQ4.S') else: XY = FEMinput['XY'] IJ = FEMinput['IJ'] E = FEMinput['TEV']['E'] V = FEMinput['TEV']['V'] T = FEMinput['TEV']['T'] r = ref._r(XY) S = [ESIGME(DP[IJ[El[0]][1][:,1],:], r, scale, E, V, El[0], XY, IJ, T) for El in IJ] S = ref.flatter(ref.flatter(S)) #cache.set('FEMZQ4.S', S) return S
def toimshowtr(arrS, scale, width, height, XY): #@width, height: from mesh() cache = mc.Client() if not cache.get('FEMXYQ4.imgS') == None: dataArr = cache.get('FEMXYQ4.imgS') else: scale_pro = scale / (ref._r(XY) * 2.0) scaledData = [[[ int(round(l[0][0] * scale_pro)), int(round(l[0][1] * scale_pro)) ], l[1]] for l in arrS] dataArr = reduce(ref.coordcopy, scaledData, np.zeros((height * scale, width * scale, 3))) cache.set('FEMXYQ4.imgS', dataArr) return dataArr
def GKS(FEMinput): #Calculate global stiffness matrix IJ = FEMinput['IJ'] E = FEMinput['TEV']['E'] V = FEMinput['TEV']['V'] T = FEMinput['TEV']['T'] XY = FEMinput['XY'] KS = np.zeros((XY.shape[0]*3, XY.shape[0]*3)) XY = ref.arrIndexSort(XY) IJ = ref.lstIndexSort(IJ) r = ref._r(XY) KE = KEACM(E, V, T, r) KEsl = [KEdcr(KE, EN[0], IJ) for EN in IJ]#List of Element stiffness matrix KS = np.matrix(reduce(insKE, KEsl, KS)) return KS
def SIGME(DP, FEMinput, parts): cache = mc.Client() if not cache.get('FEMXYQ4.S') == None: S = cache.get('FEMXYQ4.S') else: XY = FEMinput['XY'] IJ = FEMinput['IJ'] E = FEMinput['TEV']['E'] V = FEMinput['TEV']['V'] T = FEMinput['TEV']['T'] r = ref._r(XY) S = [ ESIGME(DP[IJ[El[0]][1][:, 1], :], r, parts, E, V, El[0], XY, IJ, T) for El in IJ ] S = ref.flatter(ref.flatter(S)) cache.set('FEMXYQ4.S', S) return S
def areaLD(X, Y, XY, IJ, F, r): r = ref._r(XY) EL = ref.XYToEL(ref.XYToNL(X, Y, XY), X, Y, XY, IJ) N = IJ[EL][1][:,1].reshape(1,-1)[0] LD = [[N[0], F*r*r*r/3.0, -F*r*r*r/3.0, F*r*r], [N[1], F*r*r*r/3.0, F*r*r*r/3.0, F*r*r], [N[2], -F*r*r*r/3.0, F*r*r*r/3.0, F*r*r], [N[3], -F*r*r*r/3.0, -F*r*r*r/3.0, F*r*r]] return LD