def H48toYld(rv=[2.2,2.0,2.9],m=6,iplot=False): """ Characterize yld2000-2D using Hill48. 1. First, characterize Hill48 using three r-values 2. Obtain RB, YB, and yield stresses in uniaxial to characterize YLD2000-2D 3. Run YLD2000-2D and conduct uniaxial tension tests and compare the r-value and yield stress profiles as well as the plane-stress yield locus with Hill48 4. If iplot==True, the resulting plots are saved to <yld2000fromH48.pdf> 5. Finally, return the chracterized yield function <yfunc_yld> Arguments ========= rv =[ 2.2, 2.0, 2.9] m = 6 Return ------ yfunc_yld """ import tuneH48, yf2 import mk.tests.mechtests as mechtests f,g,h,n = tuneH48.tuneGenR(r=rv) yfunc_H48 = yf2.wrapHill48Gen(f,g,h,n) locus_H48 = locus(yfunc_H48,30000) psi_uni_H48, rvs_uni_H48, ys_uni_H48 \ = mechtests.inplaneTension(yfunc_H48,1) y0, y90, yb, rb, y45, r45 = extractParamsFromYS( locus_H48,psi_uni_H48,rvs_uni_H48,ys_uni_H48) r_yld = [rv[0], rv[1], rv[2], rb] y_yld = [ys_uni_H48[0], y45, ys_uni_H48[-1], yb] yfunc_yld = yf2.wrapYLD(r=r_yld, y=y_yld, m=m) if type(yfunc_yld).__name__=='int': raise IOError locus_yld = locus(yfunc_yld,30000) psi_uni_yld, rvs_uni_yld, ys_uni_yld \ = mechtests.inplaneTension(yfunc_yld,1) if iplot: fig =plt.figure(figsize=(11,3.)); ax1=fig.add_subplot(131);ax2=fig.add_subplot(132) ax3=fig.add_subplot(133) ax1.plot(psi_uni_H48*180/np.pi,ys_uni_H48,label='Hill48') ax2.plot(psi_uni_H48*180/np.pi,rvs_uni_H48,label='Hill48') ax1.plot(psi_uni_yld*180/np.pi,ys_uni_yld,'--',label='YLD2000') ax2.plot(psi_uni_yld*180/np.pi,rvs_uni_yld,'--',label='YLD2000') ax3.plot(locus_H48[0],locus_H48[1],label='Hill48') ax3.plot(locus_yld[0],locus_yld[1],'--',label='YLD2000') ax1.legend(); ax2.legend(); ax3.legend() ax3.set_xlim(0.,); ax3.set_ylim(0.,); ax3.set_aspect('equal') fig.tight_layout() fig.savefig('yld2000fromH48.pdf',bbox_to_inches='tight') return yfunc_yld
def H48toYld_withYS(rv=[2.2, 2.0, 2.9], ys=[1, 1, 1], m=6, iopt=0): """ Characterize yld2000-2D in assistance of Hill48 This function accepets three r-values and three yield stresses. YB and RB are obtained from Hill48 yield function that is characterized by the given r-values. Arguments --------- rv = [] ys = [] m = 6 iopt=0 """ import tuneH48, yf2 import mk.tests.mechtests as mechtests f, g, h, n = tuneH48.tuneGenR(r=rv) yfunc_H48 = yf2.wrapHill48Gen(f, g, h, n) locus_H48 = locus(yfunc_H48, 30000) psi_uni_H48, rvs_uni_H48, ys_uni_H48 \ = mechtests.inplaneTension(yfunc_H48,1) y0, y90, yb, rb, y45, r45 = extractParamsFromYS(locus_H48, psi_uni_H48, rvs_uni_H48, ys_uni_H48) r_yld = [rv[0], rv[1], rv[2], rb] y_yld = [ys[0], ys[1], ys[2], yb] yfunc_yld = yf2.wrapYLD(r=r_yld, y=y_yld, m=m) if type(yfunc_yld).__name__ == 'int': raise IOError if iopt == 0: return yfunc_yld elif iopt == 1: return rb, yb
def objf(xs): nth = len(rv) psis_ref = np.linspace(0,np.pi/2.,nth) f, g, h, n = xs psis, rvs, phis = inplaneTension(fYLD=fYLD,f=f,g=g,h=h,n=n) funcINT = interpolate.interp1d(x=psis,y=rvs) rvs_ref = funcINT(psis_ref) diff = np.sqrt(((rvs_ref - rv)**2).sum())/(nth-1.) return diff
def test2(r0=2.20,r45=1.95,r90=2.9): """ uniaxial tension tests Arguments --------- r0 =2.1 r90 =2.7 """ import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from mk.library.lib import rot import numpy as np from mk.tests.mechtests import inplaneTension h48 = wrapHill48R([r0,r45,r90]) psis = np.linspace(0,+np.pi/2.,100) ## uniaxial tension stress state in the laboratory axes sUniaxial=np.zeros(6) sUniaxial[0]=1. print '%6s %6s %6s %6s %6s %6s %6s %6s'%( 'th','phi','s11','s22','s12','s1','s2','s3') psis, rvs, phis = inplaneTension(fYLD=h48) fig = plt.figure(figsize=(10,3)) ax1 = fig.add_subplot(131) ax2 = fig.add_subplot(132) ax3 = fig.add_subplot(133) import vm_check ax2.plot(psis*180/np.pi,rvs) ax3.plot(psis*180/np.pi,phis) vm_check.main(ax=ax1) ax2.set_ylabel(r'R value') ax3.set_ylabel(r'$\Phi$') fig.tight_layout() for ax in [ax2,ax3]: ax.set_xlabel(r'$\theta$ [deg] from RD') ax.set_xticks(np.arange(0,90.001,30)) fn = 'yf2_test2.pdf' fig.savefig(fn,bbox_inches='tight') print '%s has been saved'%fn
def test2(r0=2.20, r45=1.95, r90=2.9): """ uniaxial tension tests Arguments --------- r0 =2.1 r90 =2.7 """ import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from mk.library.lib import rot import numpy as np from mk.tests.mechtests import inplaneTension h48 = wrapHill48R([r0, r45, r90]) psis = np.linspace(0, +np.pi / 2., 100) ## uniaxial tension stress state in the laboratory axes sUniaxial = np.zeros(6) sUniaxial[0] = 1. print '%6s %6s %6s %6s %6s %6s %6s %6s' % ('th', 'phi', 's11', 's22', 's12', 's1', 's2', 's3') psis, rvs, phis = inplaneTension(fYLD=h48) fig = plt.figure(figsize=(10, 3)) ax1 = fig.add_subplot(131) ax2 = fig.add_subplot(132) ax3 = fig.add_subplot(133) import vm_check ax2.plot(psis * 180 / np.pi, rvs) ax3.plot(psis * 180 / np.pi, phis) vm_check.main(ax=ax1) ax2.set_ylabel(r'R value') ax3.set_ylabel(r'$\Phi$') fig.tight_layout() for ax in [ax2, ax3]: ax.set_xlabel(r'$\theta$ [deg] from RD') ax.set_xticks(np.arange(0, 90.001, 30)) fn = 'yf2_test2.pdf' fig.savefig(fn, bbox_inches='tight') print '%s has been saved' % fn
def H48toYld_withYS( rv=[2.2,2.0,2.9], ys=[1,1,1], m=6,iopt=0): """ Characterize yld2000-2D in assistance of Hill48 This function accepets three r-values and three yield stresses. YB and RB are obtained from Hill48 yield function that is characterized by the given r-values. Arguments --------- rv = [] ys = [] m = 6 iopt=0 """ import tuneH48, yf2 import mk.tests.mechtests as mechtests f,g,h,n = tuneH48.tuneGenR(r=rv) yfunc_H48 = yf2.wrapHill48Gen(f,g,h,n) locus_H48 = locus(yfunc_H48,30000) psi_uni_H48, rvs_uni_H48, ys_uni_H48 \ = mechtests.inplaneTension(yfunc_H48,1) y0, y90, yb, rb, y45, r45 = extractParamsFromYS( locus_H48,psi_uni_H48,rvs_uni_H48,ys_uni_H48) r_yld = [rv[0], rv[1], rv[2], rb] y_yld = [ys[0], ys[1], ys[2], yb] yfunc_yld = yf2.wrapYLD(r=r_yld, y=y_yld, m=m) if type(yfunc_yld).__name__=='int': raise IOError if iopt==0: return yfunc_yld elif iopt==1: return rb,yb
def H48toYld(rv=[2.2, 2.0, 2.9], m=6, iplot=False): """ Characterize yld2000-2D using Hill48. 1. First, characterize Hill48 using three r-values 2. Obtain RB, YB, and yield stresses in uniaxial to characterize YLD2000-2D 3. Run YLD2000-2D and conduct uniaxial tension tests and compare the r-value and yield stress profiles as well as the plane-stress yield locus with Hill48 4. If iplot==True, the resulting plots are saved to <yld2000fromH48.pdf> 5. Finally, return the chracterized yield function <yfunc_yld> Arguments ========= rv =[ 2.2, 2.0, 2.9] m = 6 Return ------ yfunc_yld """ import tuneH48, yf2 import mk.tests.mechtests as mechtests f, g, h, n = tuneH48.tuneGenR(r=rv) yfunc_H48 = yf2.wrapHill48Gen(f, g, h, n) locus_H48 = locus(yfunc_H48, 30000) psi_uni_H48, rvs_uni_H48, ys_uni_H48 \ = mechtests.inplaneTension(yfunc_H48,1) y0, y90, yb, rb, y45, r45 = extractParamsFromYS(locus_H48, psi_uni_H48, rvs_uni_H48, ys_uni_H48) r_yld = [rv[0], rv[1], rv[2], rb] y_yld = [ys_uni_H48[0], y45, ys_uni_H48[-1], yb] yfunc_yld = yf2.wrapYLD(r=r_yld, y=y_yld, m=m) if type(yfunc_yld).__name__ == 'int': raise IOError locus_yld = locus(yfunc_yld, 30000) psi_uni_yld, rvs_uni_yld, ys_uni_yld \ = mechtests.inplaneTension(yfunc_yld,1) if iplot: fig = plt.figure(figsize=(11, 3.)) ax1 = fig.add_subplot(131) ax2 = fig.add_subplot(132) ax3 = fig.add_subplot(133) ax1.plot(psi_uni_H48 * 180 / np.pi, ys_uni_H48, label='Hill48') ax2.plot(psi_uni_H48 * 180 / np.pi, rvs_uni_H48, label='Hill48') ax1.plot(psi_uni_yld * 180 / np.pi, ys_uni_yld, '--', label='YLD2000') ax2.plot(psi_uni_yld * 180 / np.pi, rvs_uni_yld, '--', label='YLD2000') ax3.plot(locus_H48[0], locus_H48[1], label='Hill48') ax3.plot(locus_yld[0], locus_yld[1], '--', label='YLD2000') ax1.legend() ax2.legend() ax3.legend() ax3.set_xlim(0., ) ax3.set_ylim(0., ) ax3.set_aspect('equal') fig.tight_layout() fig.savefig('yld2000fromH48.pdf', bbox_to_inches='tight') return yfunc_yld