예제 #1
0
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
예제 #2
0
파일: tuneYld2000.py 프로젝트: youngung/MK
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
예제 #3
0
def ex1():
    """
    Excercise - Tune H48 using three r-values and calculate YS.
    Using the three given r-values used in H48
    find rb, y0, y45, y90, and yb by fitting YS of H48 with
    that of yld2000-2d
    """
    import tuneH48
    import mk.yieldFunction.yf2 as yf2
    rv = [2.2, 2.0, 2.9]
    f, g, h, n = tuneH48.tuneGenR(r=rv)
    yfunc_H48 = yf2.wrapHill48Gen(f, g, h, n)
    YS_H48X, YS_H48Y = locus(yfunc_H48, 1000)
    r, th = xy2rt(np.array(YS_H48X), np.array(YS_H48Y))

    ## popt = [rv, y45, y90, yb]
    popt = case2([r, th], rv=rv)
    rv.append(popt[0])
    ys = np.ones(4)
    ys[1:] = popt[1:]

    ##
    print 'rv:', rv
    print 'ys:', ys
    yfunc_yld2000 = wrapYLD(r=rv, y=ys, m=8)

    import matplotlib.pyplot as plt
    fig = plt.figure()
    ax = fig.add_subplot(111)

    YS_YLDX, YS_YLDY = locus(yfunc_yld2000, 1000)
    ax.plot(YS_H48X, YS_H48Y, '-', label='Hill48')
    ax.plot(YS_YLDX, YS_YLDY, '-', label='YLD2000')
    ax.set_xlim(0., )
    ax.set_ylim(0., )
    ax.set_aspect('equal')
    ax.legend(loc='best')
    # print YS_YLDX
    # print YS_YLDY
    fig.savefig('Yld2000-Hill48.pdf')
예제 #4
0
파일: tuneYld2000.py 프로젝트: youngung/MK
def ex1():
    """
    Excercise - Tune H48 using three r-values and calculate YS.
    Using the three given r-values used in H48
    find rb, y0, y45, y90, and yb by fitting YS of H48 with
    that of yld2000-2d
    """
    import tuneH48
    import mk.yieldFunction.yf2 as yf2
    rv=[2.2,2.0,2.9]
    f,g,h,n = tuneH48.tuneGenR(r=rv)
    yfunc_H48 = yf2.wrapHill48Gen(f,g,h,n)
    YS_H48X, YS_H48Y = locus(yfunc_H48,1000)
    r, th = xy2rt(np.array(YS_H48X), np.array(YS_H48Y))

    ## popt = [rv, y45, y90, yb]
    popt = case2([r,th], rv=rv)
    rv.append(popt[0])
    ys = np.ones(4)
    ys[1:] = popt[1:]

    ##
    print 'rv:', rv
    print 'ys:', ys
    yfunc_yld2000 = wrapYLD(r=rv,y=ys,m=8)

    import matplotlib.pyplot as plt
    fig = plt.figure(); ax=fig.add_subplot(111)

    YS_YLDX, YS_YLDY = locus(yfunc_yld2000,1000)
    ax.plot(YS_H48X,YS_H48Y,'-',label='Hill48')
    ax.plot(YS_YLDX,YS_YLDY,'-',label='YLD2000')
    ax.set_xlim(0.,)
    ax.set_ylim(0.,)
    ax.set_aspect('equal')
    ax.legend(loc='best')
    # print YS_YLDX
    # print YS_YLDY
    fig.savefig('Yld2000-Hill48.pdf')
예제 #5
0
파일: tuneYld2000.py 프로젝트: youngung/MK
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
예제 #6
0
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