def initBeams(dim): tapered = teb.taperedElasticaBeam() tapered.setBeamDimensions(L=dim['L'], Lt=dim['Lt'], t=dim['t'], w=dim['w'], E=dim['E']) tapered.setShearLoad(shearLoad=dim['shearLoad']) tapered.setEndAngle(endAngle=dim['endAngle']) untapered = teb.taperedElasticaBeam() untapered.setBeamDimensions(L=dim['L'], Lt=1, t=dim['t'], w=dim['w'], E=dim['E']) untapered.setShearLoad(shearLoad=dim['shearLoad']) untapered.setEndAngle(endAngle=dim['endAngle']) return (tapered, untapered)
def main(): toRadians = np.pi/180 endAngleDeg = np.array([40, 50, 60], dtype=int) L = 60e-6 Lt = 120e-1 t = 20e-6 w = 20e-6 E = 1e6 beam = teb.taperedElasticaBeam() beam.setBeamDimensions(L=L, Lt=Lt, t=t, w=w, E=E) fig = initFigure() colors = initColors() elasticaLegends = [] eulerLegends = [] for (offset, value) in enumerate(endAngleDeg): elastica(beam=beam, endAngle=value*toRadians, fig=fig, legend=elasticaLegends, color=colors[offset]) euler(beam=beam, endAngle=value*toRadians, fig=fig, legend=eulerLegends, color=colors[offset]) addChartJunk(beam=beam, figure=fig, endAngle=endAngleDeg, elasticaLegends=elasticaLegends, eulerLegends=eulerLegends) saveFile(fig=fig['fig'])
def main(): numPointLoads = 100 pointLoad = np.linspace(.1e-6,18e-6,numPointLoads) L = 60e-6 Lt = 120e-1 t = 20e-6 w = 20e-6 E = 1e6 beam = teb.taperedElasticaBeam() beam.setBeamDimensions(L=L, Lt=Lt, t=t, w=w, E=E) dateCode = datetime.now().strftime('%Y%m%d%H%M') for i, j in zip(pointLoad, range(numPointLoads)): elasticaLegends = [] eulerLegends = [] fig = initFigure() elastica(beam=beam, pointLoad=i, fig=fig, legend=elasticaLegends, color='b') euler(beam=beam, pointLoad=i, fig=fig, legend=eulerLegends, color='r') addChartJunk(beam=beam, figure=fig, pointLoad=i, elasticaLegends=elasticaLegends, eulerLegends=eulerLegends) saveFile(fig=fig['fig'], imageNumber=j, dateCode=dateCode) mpl.close()
def main(): pointLoad = [1e-6, 5e-6, 10e-6] L = 60e-6 Lt = 120e-1 t = 20e-6 w = 20e-6 E = 1e6 beam = teb.taperedElasticaBeam() beam.setBeamDimensions(L=L, Lt=Lt, t=t, w=w, E=E) fig = initFigure() colors = initColors() elasticaLegends = [] eulerLegends = [] for (index, value) in enumerate(pointLoad): elastica(beam=beam, pointLoad=value, fig=fig, legend=elasticaLegends, color=colors[index]) euler(beam=beam, pointLoad=value, fig=fig, legend=eulerLegends, color=colors[index]) addChartJunk(beam=beam, figure=fig, pointLoad=pointLoad, elasticaLegends=elasticaLegends, eulerLegends=eulerLegends) saveFile(fig=fig['fig'])
def beamLoop(E,t,w,L,Lt,ax,label): beam = teb.taperedElasticaBeam() lengthInContact = sp.linspace(0,10,11) * 1e-6 frictionFactor = 1 shearForce = lengthInContact * frictionFactor shearForce = sp.zeros(len(lengthInContact)) endAngle = sp.pi / 2 curvature = sp.zeros(len(lengthInContact)) print(label) for i, thisLength in enumerate(lengthInContact): beam.setBeamDimensions(L - thisLength, Lt, t, w, E) beam.setEndAngle(endAngle) beam.setShearLoad(shearForce[i]) beam.calculateSlopeFunction() beam.calculateDisplacements() curvature[i] = beam.slopeDerivative[-1] print('length =', thisLength*1e6, 'um') #print('curvature =', curvature[i], '1/m') print('radius =', 1/curvature[i]*1e6, 'um') tipThick = beam.thickness(L-thisLength) print('tip thick =', tipThick*1e6, 'um') print() ax.plot(lengthInContact*1e6,1/curvature*1e6,label = label)
def main(): E = 2e6 # modulus of pdms t = 19e-6 # thickness of beam w = 19e-6 # width of beam L = 52e-6 # length of beam Lt = 60e-6 # length of taper #Lt = 1000000e-6 # length of taper thisBeam = teb.taperedElasticaBeam() lengthInContact = sp.linspace(0,10,11) * 1e-6 endAngle = sp.pi / 2 figure = plt.figure() # figure size and resolution width = 9 height = 9 figure.set_figheight(height) figure.set_figwidth(width) ax = figure.add_axes((0.1,0.4,0.8,0.55)) bendingMoment = sp.zeros(len(lengthInContact)) curvature = sp.zeros(len(lengthInContact)) for i, thisLength in enumerate(lengthInContact): thisBeam.setBeamDimensions(L - thisLength, Lt, t, w, E) bendingMoment[i] = thisBeam.calculateSlopeFunctionForEndAngle(endAngle) thisBeam.calculateDisplacements() print(bendingMoment[i],end='\t') curvature[i] = thisBeam.derivativeForEndAngle(0, L - thisLength, bendingMoment[i]) print(curvature[i]) #thisBeam.plotBeam(ax,str(thisLength)) ax.plot(lengthInContact*1e6,1/curvature*1e6) ax.set_xlabel('length in contact (microns)') ax.set_ylabel('radius of curvature (microns)') ax.grid() from datetime import datetime import os string = ('length = '+str(L*1e6)+' microns'+'\n'+ 'thickness = '+str(t*1e6)+' microns'+'\n'+ 'width = '+str(w*1e6)+' microns'+'\n'+ 'modulus = '+str(E/1e6)+' MPa'+'\n'+ 'taper length = '+str(Lt*1e6)+' microns' +'\n'+ datetime.now().strftime('%d %b %Y - %H:%M')+'\n'+ os.path.abspath(__file__)) xPos = 0.5 yPos = 0.05 plt.figtext(xPos, yPos, string, ha='center') # name plot same as script fileName = os.path.basename(__file__) fileName = os.path.splitext(fileName)[0] plotFileName = fileName + '.pdf' figure.savefig(plotFileName, transparent=True)
def main(): E = 1e6 # elastic modulus of beam (Pa) t = 20e-6 # dimension of beam in bending direction (m) w = 20e-6 # width of beam (m) L = 60e-6 # length of beam (m) Lt = 1e6 # length of taper (m) at Lt beam has zero thickness # instantiate beam = teb.taperedElasticaBeam() beam.setBeamDimensions(L,Lt,t,w,E) shearLoad = sp.linspace(0,5e-6,11) energy = [] for load in shearLoad: beam.setShearLoad(load) beam.calculateSlopeFunction() energy.append(beam.calculateStrainEnergy()) fig, ax = configurePlot() ax.plot(shearLoad,energy) fig.savefig('energy.pdf') E = 1e6 # elastic modulus of beam (Pa) t = 20e-6 # dimension of beam in bending direction (m) w = 20e-6 # width of beam (m) L = 60e-6 # length of beam (m) Lt = 1e6 # length of taper (m) at Lt beam has zero thickness I = t**3 * w / 12.0 beam = teb.taperedElasticaBeam() beam.setBeamDimensions(L,Lt,t,w,E) beam.setEndAngle(sp.pi/2) beam.calculateSlopeFunction() energy = beam.calculateStrainEnergy() print 'teb energy = ', energy analyticEnergy = (sp.pi/L/2.0)**2 * E * I / 2 * L print 'analytic energy = ',analyticEnergy energyError = (energy-analyticEnergy)/analyticEnergy print 'error as fraction =', energyError
def initBeam(L,Lt,w,t): E = 1.75e6 # elastic modulus of beam (Pa) # t = 20e-6 # dimension of beam in bending direction (m) # w = 20e-6 # width of beam (m) # L = 75e-5 # length of beam (m) # Lt = 80e-6 # length of taper (m) at Lt beam has zero thickness beam=teb.taperedElasticaBeam() beam.setBeamDimensions(E=E, t=t, w=w, L=L, Lt=Lt) return beam
def initBeam(): E = 200e9 # elastic modulus of beam (Pa) t = 0.4e-3 # dimension of beam in bending direction (m) w = 2e-2 # width of beam (m) L = 2e-3 # length of beam (m) Lt = 2.0151e-3 # length of taper (m) at Lt beam has zero thickness beam=teb.taperedElasticaBeam() beam.setBeamDimensions(E=E, t=t, w=w, L=L, Lt=Lt) return beam
def plotBeam(Lt,suffix): thisBeam = teb.taperedElasticaBeam() lengthInContact = sp.linspace(0,20,11) * 1e-6 endAngle = sp.pi / 2 figure = plt.figure() # figure size and resolution width = 9 height = 9 figure.set_figheight(height) figure.set_figwidth(width) ax = figure.add_axes((0.1,0.4,0.8,0.55)) ax.set_aspect('equal') for i, thisLength in enumerate(lengthInContact): thisBeam.setBeamDimensions(L - thisLength, Lt, t, w, E) thisBeam.calculateSlopeFunctionForEndAngle(endAngle) thisBeam.addSlopeWithLength(endAngle, thisLength) thisBeam.calculateDisplacements() thisBeam.plotBeam(ax,str(thisLength)) ax.grid() ax.legend(loc='best') from datetime import datetime import os string = ('length = '+str(L*1e6)+' microns'+'\n'+ 'thickness = '+str(t*1e6)+' microns'+'\n'+ 'width = '+str(w*1e6)+' microns'+'\n'+ 'modulus = '+str(E/1e6)+' MPa'+'\n'+ 'taper length = '+str(Lt*1e6)+' microns' +'\n'+ datetime.now().strftime('%d %b %Y - %H:%M')+'\n'+ os.path.abspath(__file__)) xPos = 0.5 yPos = 0.05 plt.figtext(xPos, yPos, string, ha='center') # name plot same as script fileName = os.path.basename(__file__) fileName = os.path.splitext(fileName)[0] plotFileName = fileName + '-' + suffix + '.pdf' figure.savefig(plotFileName, transparent=True)
def main(): E = 1e6 # elastic modulus of beam (Pa) t = 20e-6 # dimension of beam in bending direction (m) w = 20e-6 # width of beam (m) L = 60e-6 # length of beam (m) Lt = 1e6 # length of taper (m) at Lt beam has zero thickness # instantiate beam = teb.taperedElasticaBeam() beam.setBeamDimensions(L,Lt,t,w,E) shearLoad = 1e-6 # point load condition endAngle = 3.1415/2 axialLoad = [-2.0e-6, 0.0, 2.0e-6] beam.setShearLoad(shearLoad) beam.setEndAngle(endAngle) width = 6.0 # fig width height = 6.0 # fig height fig = plt.figure() fig.set_figheight(height) fig.set_figwidth(width) ax = fig.add_axes((0.1,0.1,0.8,0.8)) #ax.set_aspect('equal') ax.grid() for al in axialLoad: beam.setAxialLoad(al) # solve psi(s) function beam.calculateSlopeFunction() # convert psi(s) to cartesian beam.calculateDisplacements() legendString = str(al) # plot beam position beam.plotBeam(ax,legendString) ax.legend(loc='best') fig.savefig('arbLoad.pdf')
def main(): degrees = np.pi/180 endAngle = np.linspace(1,89,89) L = 60e-6 Lt = 120e-1 t = 20e-6 w = 20e-6 E = 1e6 beam = teb.taperedElasticaBeam() beam.setBeamDimensions(L=L, Lt=Lt, t=t, w=w, E=E) dateCode = datetime.now().strftime('%Y%m%d%H%M') for i in endAngle: elasticaLegends = [] eulerLegends = [] fig = initFigure() elastica(beam=beam, endAngle=i*np.pi/180, fig=fig, legend=elasticaLegends, color='b') euler(beam=beam, endAngle=i*np.pi/180, fig=fig, legend=eulerLegends, color='r') addChartJunk(beam=beam, figure=fig, endAngle=i*np.pi/180, elasticaLegends=elasticaLegends, eulerLegends=eulerLegends) saveFile(fig=fig['fig'], endAngle=i*np.pi/180, dateCode=dateCode)
#!/usr/bin/env python import taperedElasticaBeam as teb import matplotlib as mpl import matplotlib.pyplot as plt E = 2e6 # modulus of pdms t = 19e-6 # thickness of beam w = 19e-6 # width of beam I = t**3 * w / 12.0 # moment of inertia L = 52e-6 # length of beam Lt = 60e-6 # length of taper Lt = 1000000e-6 # length of taper thisBeam = teb.taperedElasticaBeam() thisBeam.setBeamDimensions(L,Lt,t,w,E) load = 1e-5 thisBeam.applyShearLoad(load) thisBeam.printParameters() thisBeam.calculateSlopeFunction() thisBeam.calculateDisplacements() figure = plt.figure() # figure size and resolution width = 9 height = 9 figure.set_figheight(height) figure.set_figwidth(width) #ax = figure.add_subplot(121) #ax = figure.add_axes((left_margin, height/2+0.5,
def createBeams(E, t, w, I, L, Lt): untaperedBeam = teb.taperedElasticaBeam() taperedBeam = teb.taperedElasticaBeam() taperedBeam.setBeamDimensions(L=L, Lt=Lt, t=t, w=w, E=E) untaperedBeam.setBeamDimensions(L=L, Lt=1, t=t, w=w, E=E) return (untaperedBeam, taperedBeam)