def meshStructure(this, filename): afm = Airframe(this, 1) middle_spar = 11 hinge_spar = 5 hinge_location = 0.22 # 0.285 #idims = np.array([ 0.08, 0.15, 0.22, hinge_location, 0.3875, 0.49, 0.5925, 0.695, 0.7975, 0.9]) # idims = np.linspace(0.08,0.9,9) #13 idims = np.append( np.linspace(0.08, hinge_location, 5)[0:-1], np.linspace(hinge_location, 0.9, 14)) angle_rib = 3 angle_location = 0.55 #20.0/37.0 #this.wing_width_section_1/this.wing_width_section_2 # + 0.05 ######### jdims = np.array([0.0, 0.18333333, angle_location, 0.7, 0.85, 1.0]) # jdims = np.append(np.linspace(0,angle_location,4)[0:-1],np.linspace(angle_location,1,4)) #13 for i in range(idims.shape[0] - 1): for j in range(jdims.shape[0]): if i < hinge_spar and j < 1: continue afm.addVertFlip('MRIBW:%02d:l:%02d' % (j, i), 'lwing', [idims[i], jdims[j]], [idims[i + 1], jdims[j]]) afm.addVertFlip('MRIBW:%02d:r:%02d' % (j, i), 'rwing', [idims[i], 1 - jdims[j]], [idims[i + 1], 1 - jdims[j]]) for i in range(idims.shape[0]): for j in range(jdims.shape[0] - 1): if i < hinge_spar and j < 1: continue if i in [0, hinge_spar, idims.shape[0] - 1]: # middle_spar, afm.addVertFlip('MSPARW:%02d:l:%02d' % (i, j), 'lwing', [idims[i], jdims[j]], [idims[i], jdims[j + 1]]) afm.addVertFlip('MSPARW:%02d:r:%02d' % (i, j), 'rwing', [idims[i], 1 - jdims[j]], [idims[i], 1 - jdims[j + 1]]) else: if i in [6, 8, 10, 12, 14, 16] and j >= angle_rib - 1: continue afm.addVertFlip('MSTRINGW:%02d:a:l:%02d' % (i, j), 'lwing', [idims[i], jdims[j]], [idims[i], jdims[j + 1]], w=[1, 0.85]) afm.addVertFlip('MSTRINGW:%02d:b:l:%02d' % (i, j), 'lwing', [idims[i], jdims[j]], [idims[i], jdims[j + 1]], w=[0.15, 0]) afm.addVertFlip('MSTRINGW:%02d:a:r:%02d' % (i, j), 'rwing', [idims[i], 1 - jdims[j]], [idims[i], 1 - jdims[j + 1]], w=[1, 0.85]) afm.addVertFlip('MSTRINGW:%02d:b:r:%02d' % (i, j), 'rwing', [idims[i], 1 - jdims[j]], [idims[i], 1 - jdims[j + 1]], w=[0.15, 0]) for i in range(hinge_spar, idims.shape[0]): if i in [hinge_spar, idims.shape[0] - 1]: afm.addCtrVert('MSPARC:%02d' % (i), 'lwing', 'rwing', idims[i]) else: afm.addCtrVert('MSTRINGC:%02d:a' % (i), 'lwing', 'rwing', idims[i], w=[1, 0.85]) afm.addCtrVert('MSTRINGC:%02d:b' % (i), 'lwing', 'rwing', idims[i], w=[0.15, 0]) for i in range(hinge_spar, idims.shape[0] - 1): afm.addCtr('MSKINC:a:%02d' % (i), 'lwing', 'rwing', 0, [idims[i], idims[i + 1]]) for i in range(hinge_spar, idims.shape[0] - 1): afm.addCtr('MSKINC:b:%02d' % (i), 'lwing', 'rwing', 1, [1 - idims[i], 1 - idims[i + 1]]) if this.tail: idims = np.array([0.2, 0.4, 0.6, 0.8]) jdims = np.linspace(0.0, 0.95, 10) for i in range(idims.shape[0] - 1): for j in range(jdims.shape[0]): afm.addVertFlip('MRIBV:%02d:%02d' % (j, i), 'ctail', [idims[i], jdims[j]], [idims[i + 1], jdims[j]]) for i in range(idims.shape[0]): for j in range(jdims.shape[0] - 1): afm.addVertFlip('MSPARV:%02d:%02d' % (i, j), 'ctail', [idims[i], jdims[j]], [idims[i], jdims[j + 1]]) idims = np.linspace(0.15, 0.85, 4) jdims = np.linspace(0.0, 1.0, 8) for i in range(idims.shape[0] - 1): for j in range(jdims.shape[0]): afm.addVertFlip('MRIBF:%02d:%02d' % (j, i), 'flap', [idims[i], jdims[j]], [idims[i + 1], jdims[j]]) for i in range(idims.shape[0]): for j in range(jdims.shape[0] - 1): afm.addVertFlip('MSPARF:%02d:%02d' % (i, j), 'flap', [idims[i], jdims[j]], [idims[i], jdims[j + 1]]) jdims = np.linspace(0, 1, 20) # 13 idims = np.linspace(0, 1, 5) for i in range(idims.shape[0] - 1): for j in range(jdims.shape[0]): afm.addVert('MFRAME:%02d:1:%02d' % (j, i), 'fuse', [idims[i], jdims[j]], [idims[i + 1], jdims[j]], w=[1.0, 0.96], i=[0, 2]) afm.addVert('MFRAME:%02d:3:%02d' % (j, i), 'fuse', [idims[i], jdims[j]], [idims[i + 1], jdims[j]], w=[1.0, 0.96], i=[2, 0]) for i in range(idims.shape[0] - 1): for j in range(jdims.shape[0] - 1): afm.addVert('MLONG:%02d:1:%02d' % (i, j), 'fuse', [idims[i], jdims[j]], [idims[i], jdims[j + 1]], w=[1.0, 0.96], i=[0, 2]) afm.addVert('MLONG:%02d:3:%02d' % (i, j), 'fuse', [idims[i], jdims[j]], [idims[i], jdims[j + 1]], w=[1.0, 0.96], i=[2, 0]) idims = np.linspace(0, 1, 6) for i in range(idims.shape[0] - 1): for j in range(jdims.shape[0]): afm.addVert('MFRAME:%02d:2:%02d' % (j, i), 'fuse', [idims[i], jdims[j]], [idims[i + 1], jdims[j]], w=[1.0, 0.96], i=[1, 3]) for i in range(idims.shape[0] - 1): for j in range(jdims.shape[0] - 1): afm.addVert('MLONG:%02d:2:%02d' % (i, j), 'fuse', [idims[i], jdims[j]], [idims[i], jdims[j + 1]], w=[1.0, 0.96], i=[1, 3]) idims = np.linspace(0, 1, 10) for i in range(idims.shape[0] - 1): for j in range(jdims.shape[0]): afm.addVert('MFRAME:%02d:4:%02d' % (j, i), 'fuse', [idims[i], jdims[j]], [idims[i + 1], jdims[j]], w=[1.0, 0.96], i=[3, 1]) for i in range(idims.shape[0] - 1): for j in range(jdims.shape[0] - 1): afm.addVert('MLONG:%02d:4:%02d' % (i, j), 'fuse', [idims[i], jdims[j]], [idims[i], jdims[j + 1]], w=[1.0, 0.96], i=[3, 1]) afm.preview('preview') afm.mesh() afm.computeMesh(filename)
def meshStructure(self): afm = Airframe(self, 0.2) idims = numpy.linspace(0.45,0.85,7) jdims = numpy.linspace(0,0.9,16) for i in range(idims.shape[0]-1): for j in range(jdims.shape[0]): afm.addVertFlip('Mlw_1:'+str(i)+':'+str(j),'lw',[idims[i],jdims[j]],[idims[i+1],jdims[j]]) afm.addVertFlip('Mrw_1:'+str(i)+':'+str(j),'rw',[idims[i],1-jdims[j]],[idims[i+1],1-jdims[j]]) for i in range(idims.shape[0]): for j in range(jdims.shape[0]-1): if i is 0 or i is idims.shape[0]-1: afm.addVertFlip('Mlw_2:'+str(i)+':'+str(j),'lw',[idims[i],jdims[j]],[idims[i],jdims[j+1]]) afm.addVertFlip('Mrw_2:'+str(i)+':'+str(j),'rw',[idims[i],1-jdims[j]],[idims[i],1-jdims[j+1]]) else: afm.addVertFlip('Mlw_2a:'+str(i)+':'+str(j),'lw',[idims[i],jdims[j]],[idims[i],jdims[j+1]],w=[1,0.85]) afm.addVertFlip('Mlw_2b:'+str(i)+':'+str(j),'lw',[idims[i],jdims[j]],[idims[i],jdims[j+1]],w=[0.15,0]) afm.addVertFlip('Mrw_2a:'+str(i)+':'+str(j),'rw',[idims[i],1-jdims[j]],[idims[i],1-jdims[j+1]],w=[1,0.85]) afm.addVertFlip('Mrw_2b:'+str(i)+':'+str(j),'rw',[idims[i],1-jdims[j]],[idims[i],1-jdims[j+1]],w=[0.15,0]) idims = numpy.linspace(0.18,0.45,6) for j in range(idims.shape[0]-1): afm.addVertFlip('Mlw_sec1:'+str(j),'lw',[idims[j],jdims[j]],[idims[j+1],jdims[j+1]]) afm.addVertFlip('Mrw_sec1:'+str(j),'rw',[idims[j],1-jdims[j]],[idims[j+1],1-jdims[j+1]]) afm.addVertFlip('Mlw_sec2:'+str(j),'lw',[idims[j],jdims[j]],[0.45,jdims[j]]) afm.addVertFlip('Mrw_sec2:'+str(j),'rw',[idims[j],1-jdims[j]],[0.45,1-jdims[j]]) idims = numpy.linspace(0.45,0.85,7) jdims = numpy.linspace(0,0.9,16) for i in range(idims.shape[0]): if i is 0 or i is idims.shape[0]-1: afm.addCtrVert('Mcw_2:'+str(i)+':'+str(j),'lw','rw',idims[i]) else: afm.addCtrVert('Mcw_2a:'+str(i)+':'+str(j),'lw','rw',idims[i],w=[1,0.85]) afm.addCtrVert('Mcw_2b:'+str(i)+':'+str(j),'lw','rw',idims[i],w=[0.15,0]) for i in range(idims.shape[0]-1): afm.addCtr('Mcw_u:','lw','rw',0,[idims[i],idims[i+1]]) for i in range(idims.shape[0]-1): afm.addCtr('Mcw_l:','lw','rw',1,[1-idims[i],1-idims[i+1]]) afm.addCtrVert('Mcw_sec:'+str(i)+':'+str(j),'lw','rw',0.18) idims = numpy.linspace(0.25,0.65,2) jdims = numpy.linspace(0,0.9,10) for i in range(idims.shape[0]-1): for j in range(jdims.shape[0]): afm.addVertFlip('Mlt_1:'+str(i)+':'+str(j),'lt',[idims[i],jdims[j]],[idims[i+1],jdims[j]]) afm.addVertFlip('Mrt_1:'+str(i)+':'+str(j),'rt',[idims[i],1-jdims[j]],[idims[i+1],1-jdims[j]]) afm.addVertFlip('Mvt_1:'+str(i)+':'+str(j),'vt',[idims[i],jdims[j]],[idims[i+1],jdims[j]]) for i in range(idims.shape[0]): for j in range(jdims.shape[0]-1): afm.addVertFlip('Mlt_2:'+str(i)+':'+str(j),'lt',[idims[i],jdims[j]],[idims[i],jdims[j+1]]) afm.addVertFlip('Mrt_2:'+str(i)+':'+str(j),'rt',[idims[i],1-jdims[j]],[idims[i],1-jdims[j+1]]) afm.addVertFlip('Mvt_2:'+str(i)+':'+str(j),'vt',[idims[i],jdims[j]],[idims[i],jdims[j+1]]) for i in range(idims.shape[0]): afm.addCtrVert('Mct_2:'+str(i)+':'+str(j),'lt','rt',idims[i]) for i in range(idims.shape[0]-1): afm.addCtr('Mct_u:','lt','rt',0,[idims[i],idims[i+1]]) for i in range(idims.shape[0]-1): afm.addCtr('Mct_l:','lt','rt',1,[1-idims[i],1-idims[i+1]]) idims = numpy.linspace(0,1,4) jdims = numpy.linspace(0,1,20) for i in range(idims.shape[0]-1): for j in range(jdims.shape[0]): afm.addVert('Mfu_1:'+str(i)+':'+str(j),'fu',[idims[i],jdims[j]],[idims[i+1],jdims[j]],w=[1.0,0.94],i=[0,2]) afm.addVert('Mfu_2:'+str(i)+':'+str(j),'fu',[idims[i],jdims[j]],[idims[i+1],jdims[j]],w=[1.0,0.94],i=[1,3]) afm.addVert('Mfu_3:'+str(i)+':'+str(j),'fu',[idims[i],jdims[j]],[idims[i+1],jdims[j]],w=[1.0,0.94],i=[2,0]) afm.addVert('Mfu_4:'+str(i)+':'+str(j),'fu',[idims[i],jdims[j]],[idims[i+1],jdims[j]],w=[1.0,0.94],i=[3,1]) for i in range(idims.shape[0]): for j in range(jdims.shape[0]-1): afm.addVert('Mfu_5:'+str(i)+':'+str(j),'fu',[idims[i],jdims[j]],[idims[i],jdims[j+1]],w=[1.0,0.97],i=[0,2]) afm.addVert('Mfu_6:'+str(i)+':'+str(j),'fu',[idims[i],jdims[j]],[idims[i],jdims[j+1]],w=[1.0,0.97],i=[1,3]) afm.addVert('Mfu_7:'+str(i)+':'+str(j),'fu',[idims[i],jdims[j]],[idims[i],jdims[j+1]],w=[1.0,0.97],i=[2,0]) afm.addVert('Mfu_8:'+str(i)+':'+str(j),'fu',[idims[i],jdims[j]],[idims[i],jdims[j+1]],w=[1.0,0.97],i=[3,1]) for j in range(jdims.shape[0]-1): afm.addVertFlip('Mfu_0:'+str(j),'fu',[0.4,jdims[j]],[0.4,jdims[j+1]],w=[1.0,0.0],i=[0,2]) afm.preview('conventional_pvw.dat') afm.mesh() afm.computeMesh('conventional_str.dat')
def meshStructure(self): afm = Airframe(self, 1) #0.2) idims = numpy.linspace(0.45, 0.9, 7) jdims = numpy.linspace(0, 1, 16) for i in range(idims.shape[0] - 1): for j in range(jdims.shape[0]): afm.addVertFlip('Mlw_1:' + str(i) + ':' + str(j), 'lwing', [idims[i], jdims[j]], [idims[i + 1], jdims[j]]) afm.addVertFlip('Mrw_1:' + str(i) + ':' + str(j), 'rwing', [idims[i], 1 - jdims[j]], [idims[i + 1], 1 - jdims[j]]) for i in range(idims.shape[0]): for j in range(jdims.shape[0] - 1): if i is 0 or i is idims.shape[0] - 1: afm.addVertFlip('Mlw_2:' + str(i) + ':' + str(j), 'lwing', [idims[i], jdims[j]], [idims[i], jdims[j + 1]]) afm.addVertFlip('Mrw_2:' + str(i) + ':' + str(j), 'rwing', [idims[i], 1 - jdims[j]], [idims[i], 1 - jdims[j + 1]]) else: afm.addVertFlip('Mlw_2a:' + str(i) + ':' + str(j), 'lwing', [idims[i], jdims[j]], [idims[i], jdims[j + 1]], w=[1, 0.85]) afm.addVertFlip('Mlw_2b:' + str(i) + ':' + str(j), 'lwing', [idims[i], jdims[j]], [idims[i], jdims[j + 1]], w=[0.15, 0]) afm.addVertFlip('Mrw_2a:' + str(i) + ':' + str(j), 'rwing', [idims[i], 1 - jdims[j]], [idims[i], 1 - jdims[j + 1]], w=[1, 0.85]) afm.addVertFlip('Mrw_2b:' + str(i) + ':' + str(j), 'rwing', [idims[i], 1 - jdims[j]], [idims[i], 1 - jdims[j + 1]], w=[0.15, 0]) idims = numpy.linspace(0.18, 0.45, 6) for j in range(idims.shape[0] - 1): afm.addVertFlip('Mlw_sec1:' + str(j), 'lwing', [idims[j], jdims[j]], [idims[j + 1], jdims[j + 1]]) afm.addVertFlip('Mrw_sec1:' + str(j), 'rwing', [idims[j], 1 - jdims[j]], [idims[j + 1], 1 - jdims[j + 1]]) afm.addVertFlip('Mlw_sec2:' + str(j), 'lwing', [idims[j], jdims[j]], [0.45, jdims[j]]) afm.addVertFlip('Mrw_sec2:' + str(j), 'rwing', [idims[j], 1 - jdims[j]], [0.45, 1 - jdims[j]]) idims = numpy.linspace(0.45, 0.85, 7) jdims = numpy.linspace(0, 1, 16) for i in range(idims.shape[0]): if i is 0 or i is idims.shape[0] - 1: afm.addCtrVert('Mcw_2:' + str(i) + ':' + str(j), 'lwing', 'rwing', idims[i]) else: afm.addCtrVert('Mcw_2a:' + str(i) + ':' + str(j), 'lwing', 'rwing', idims[i], w=[1, 0.85]) afm.addCtrVert('Mcw_2b:' + str(i) + ':' + str(j), 'lwing', 'rwing', idims[i], w=[0.15, 0]) for i in range(idims.shape[0] - 1): afm.addCtr('Mcw_u:', 'lwing', 'rwing', 0, [idims[i], idims[i + 1]]) for i in range(idims.shape[0] - 1): afm.addCtr('Mcw_l:', 'lwing', 'rwing', 1, [1 - idims[i], 1 - idims[i + 1]]) afm.addCtrVert('Mcw_sec:' + str(i) + ':' + str(j), 'lwing', 'rwing', 0.18) idims = numpy.linspace(0.25, 0.65, 2) jdims = numpy.linspace(0, 0.9, 10) for i in range(idims.shape[0] - 1): for j in range(jdims.shape[0]): afm.addVertFlip('Mlt_1:' + str(i) + ':' + str(j), 'ltail', [idims[i], jdims[j]], [idims[i + 1], jdims[j]]) afm.addVertFlip('Mrt_1:' + str(i) + ':' + str(j), 'rtail', [idims[i], 1 - jdims[j]], [idims[i + 1], 1 - jdims[j]]) afm.addVertFlip('Mvt_1:' + str(i) + ':' + str(j), 'vtail', [idims[i], jdims[j]], [idims[i + 1], jdims[j]]) for i in range(idims.shape[0]): for j in range(jdims.shape[0] - 1): afm.addVertFlip('Mlt_2:' + str(i) + ':' + str(j), 'ltail', [idims[i], jdims[j]], [idims[i], jdims[j + 1]]) afm.addVertFlip('Mrt_2:' + str(i) + ':' + str(j), 'rtail', [idims[i], 1 - jdims[j]], [idims[i], 1 - jdims[j + 1]]) afm.addVertFlip('Mvt_2:' + str(i) + ':' + str(j), 'vtail', [idims[i], jdims[j]], [idims[i], jdims[j + 1]]) for i in range(idims.shape[0]): afm.addCtrVert('Mct_2:' + str(i) + ':' + str(j), 'ltail', 'rtail', idims[i]) for i in range(idims.shape[0] - 1): afm.addCtr('Mct_u:', 'ltail', 'rtail', 0, [idims[i], idims[i + 1]]) for i in range(idims.shape[0] - 1): afm.addCtr('Mct_l:', 'ltail', 'rtail', 1, [1 - idims[i], 1 - idims[i + 1]]) idims = numpy.linspace(0, 1, 4) jdims = numpy.linspace(0, 1, 20) for i in range(idims.shape[0] - 1): for j in range(jdims.shape[0]): afm.addVert('Mfu_F1:' + str(i) + ':' + str(j), 'fuse', [idims[i], jdims[j]], [idims[i + 1], jdims[j]], w=[1.0, 0.94], i=[0, 2]) afm.addVert('Mfu_F2:' + str(i) + ':' + str(j), 'fuse', [idims[i], jdims[j]], [idims[i + 1], jdims[j]], w=[1.0, 0.94], i=[1, 3]) afm.addVert('Mfu_F3:' + str(i) + ':' + str(j), 'fuse', [idims[i], jdims[j]], [idims[i + 1], jdims[j]], w=[1.0, 0.94], i=[2, 0]) afm.addVert('Mfu_F4:' + str(i) + ':' + str(j), 'fuse', [idims[i], jdims[j]], [idims[i + 1], jdims[j]], w=[1.0, 0.94], i=[3, 1]) for i in range(idims.shape[0] - 1): for j in range(jdims.shape[0] - 1): afm.addVert('Mfu_L1:' + str(i) + ':' + str(j), 'fuse', [idims[i], jdims[j]], [idims[i], jdims[j + 1]], w=[1.0, 0.97], i=[0, 2]) afm.addVert('Mfu_L2:' + str(i) + ':' + str(j), 'fuse', [idims[i], jdims[j]], [idims[i], jdims[j + 1]], w=[1.0, 0.97], i=[1, 3]) afm.addVert('Mfu_L3:' + str(i) + ':' + str(j), 'fuse', [idims[i], jdims[j]], [idims[i], jdims[j + 1]], w=[1.0, 0.97], i=[2, 0]) afm.addVert('Mfu_L4:' + str(i) + ':' + str(j), 'fuse', [idims[i], jdims[j]], [idims[i], jdims[j + 1]], w=[1.0, 0.97], i=[3, 1]) for j in range(jdims.shape[0] - 1): afm.addVertFlip('Mfu_0a:' + str(j), 'fuse', [0.4, jdims[j]], [0.4, jdims[j + 1]], w=[1.0, 0.5], i=[0, 2]) afm.addVertFlip('Mfu_0b:' + str(j), 'fuse', [0.4, jdims[j]], [0.4, jdims[j + 1]], w=[0.5, 0.0], i=[0, 2]) afm.preview('conventional_pvw.dat') afm.mesh() afm.computeMesh('conventional_str.dat')