Esempio n. 1
0
def ipbiaxial(x0, eqincr, ftex, fsx, jobid, theta0):
    """
    in-plane biaxial

    theta in radian
    x0 in radian
    """
    filename = 'ipbiaxial_attemp_temp_%s'%str(jobid).zfill(4)
    r = 1
    x0 = x0[0]
    x = cos(x0)*r
    y = sin(x0)*r
    x = round(x,9)
    y = round(y,9)
    z = -round(( x + y ),9)

    histmaker(
        filename=filename,
        nstep = 1, ictrl = 7, eqincr= eqincr,
        iudot=[[1,1,1],
               [0,1,1],
               [0,0,0]],
        udot=[[x,0,0],
              [0,y,0],
              [0,0,z]],
        iscau=[0,0,1,1,1,1],
        scauchy=[0,0,0,0,0,0]
        )
    prcs = ['0',filename]
    job = vpsc(prcs=prcs, texture=ftex, fsx=fsx,stp=1,jobid=jobid)
    tmp = job.run()
    dsx0=tmp['sbar'][0][0][0,0] - tmp['sbar'][0][0][2,2]
    dsy0=tmp['sbar'][0][0][1,1] - tmp['sbar'][0][0][2,2]
    dsx1=tmp['sbar'][0][1][0,0] - tmp['sbar'][0][1][2,2]
    dsy1=tmp['sbar'][0][1][1,1] - tmp['sbar'][0][1][2,2]

    dsx = dsx1-dsx0
    dsy = dsy1-dsy0
    
    os.system('clear')
    print 'edotx=',x
    print 'edoty=',y    
    print 'dsig_xx =', dsx
    print 'dsig_yy =', dsy

    theta1 = atan2(dsy, dsx) #radian
    print 'theta1 (degree) = ', theta1*180./np.pi
    return theta1-theta0*np.pi/180.
Esempio n. 2
0
def xxxy(jobid=0, n=10,ftex=None,fsx=None,interaction=3, ifig=1):
    """
    plane consisting of sig_{xx} and tau_{xy}
    
    Yield locus in the xx-xy plane
    """
    theta = np.linspace(0,360,n) * np.pi / 180.
    filename=[]
    tmp = 0
    for i in range(n):
        while True:
            fn = 'hist/xxyy_%s_%s.hist'%(
                str(jobid).zfill(4),
                str(tmp).zfill(4))
            if not(os.path.exists(fn)): break
            tmp = tmp + 100
            pass
        tmp = tmp + 1
        filename.append(fn)
        pass
    r = 1.0
    x = cos(theta) * r #xx
    y = sin(theta) * r #xy
    z = -(x+y)
    prcs = [ ]
    for i in range(len(filename)):
        prcs.append('0')
        prcs.append(filename[i])
        x[i] = round(x[i],4)
        y[i] = round(y[i],4)
        z[i] = round(-x[i],4)
        if x[i]+z[i]!=0: raise IOError,'Non zero'
        histmaker(
            filename = filename[i],
            nstep = 1, ictrl = 7, eqincr=0.005,
            iudot=[[1,1,0],
                   [1,0,0],
                   [1,1,0]],
            udot = [[x[i], y[i],  0],
                    [   0,    0,  0],
                    [   0,    0,  z[i]]],
            iscau   = [0, 1, 1, 1, 1, 0], 
            scauchy = [0, 0, 0, 0, 0, 0],
            )
        pass

    x = [ ] #sig_{xx}
    y = [ ] #sig_{yy}

    job=vp_f2py.vpsc(
        texture=ftex, fsx=fsx, iupdate=[0,0,0,0], stp=0,
        interaction=interaction,prcs=prcs, jobid=jobid)
    tmpmaster = job.run()
    sbar = tmpmaster['sbar']
    dbar = tmpmaster['dbar']

    sxx = [] ; dxx=[]
    syy = [] ; dyy=[]
    
    for i in range(len(filename)):
        sxx.append(sbar[i][0][0,0] - sbar[i][0][2,2])
        syy.append(sbar[i][0][0,1])
        dxx.append(dbar[i][0][0,0])
        dyy.append(dbar[i][0][0,1])        
    sxx.append(sxx[0])
    syy.append(syy[0])
    d=[]
    for i in range(len(filename)):
        d.append(atan2(dyy[i],dxx[i]))
        pass
    ## plotting
    fig = plt.figure(ifig); ax=fig.add_subplot(111)
    ax.plot(sxx,syy,'.',label=r'$\sigma_{xx}-\sigma_{xy}$')
    ax.set_xlabel(r'$\sigma_{xx}$', dict(fontsize=20))
    ax.set_ylabel(r'$\sigma_{xy}$', dict(fontsize=20))
    r = 30
    for i in range(len(d)):
        ax.plot(
            [sxx[i],sxx[i]+r*cos(d[i])], #[x0,x1]
            [syy[i],syy[i]+r*sin(d[i])], #[y0,y1]
            color='gray', alpha=0.5, ls='-')
        pass
    ## plotting
    
    #return sbar, dbar
    return sxx,syy
Esempio n. 3
0
def xxyyxy(
    jobid=0, n=10, m=3, ftex=None,
    fsx=None, interaction=3, ifig=1
    ):
    """
    Yield locus in the xx-yy-xy space
    """
    from mpl_toolkits.mplot3d import axes3d, Axes3D

    r=1.0
    theta = np.linspace(0,360,n) * np.pi / 180.
    phi = np.linspace(-89.99,89.99,m) * np.pi / 180.
    filename=[]
    tmp = 0
    for i in range(n-1):
        for j in range(m-1):
            while True:
                fn = 'hist/xxyy_%s_%s.hist'%(
                    str(jobid).zfill(4),
                    str(tmp).zfill(4))
                if not(os.path.exists(fn)): break
                tmp = tmp + 100
                pass
            tmp = tmp + 1
            filename.append(fn)
            pass
        pass
    for j in range(2):
        while True:
            fn = 'hist/xxyy_%s_%s.hist'%(
                str(jobid).zfill(4),
                str(tmp).zfill(4))
            if not(os.path.exists(fn)): break
            tmp = tmp + 100
            pass
        tmp = tmp + 1
        filename.append(fn)
        pass
    
    ## Velocity gradient imposition ----------------------------
    xy=[];x=[];y=[]
    for i in range(m+1): #Loop over xy axis (phi)

        if i==0 or i==m:
            if i==0: xy.append(1)
            elif i==m: xy.append(-1)
            x.append(0.)
            y.append(0.)
            pass
        else:
            temp = sin(phi[i]) * r
            dd = cos(phi[i]) * r
            for j in range(n-1):
                xy.append(temp)
                x.append(cos(theta[j])*dd)
                y.append(sin(theta[j])*dd)
                pass
            pass
        pass
    x = np.array(x); y = np.array(y); xy = np.array(xy)
    prcs = [ ]
    for i in range(len(filename)):
        prcs.append('0')
        prcs.append(filename[i])
        x[i] = round(x[i],9)
        y[i] = round(y[i],9)
        z = -x[i]-y[i]
        histmaker(
            filename = filename[i],
            nstep = 1, ictrl = 7, eqincr=0.005,
            iudot=[[1,1,0],
                   [1,1,0],
                   [1,1,0]],
            udot = [[x[i], xy[i],  0],
                    [   0,  y[i],  0],
                    [   0,     0,  z]],
            iscau   = [0, 0, 1, 1, 1, 0], 
            scauchy = [0, 0, 0, 0, 0, 0],
            )
        pass
    ## -------------------------------------------------------
    x = [ ] #sig_{xx}
    y = [ ] #sig_{yy}
    z = [ ] #sig_{xy}
    job=vp_f2py.vpsc(
        texture=ftex, fsx=fsx, iupdate=[0,0,0,0], stp=0,
        interaction=interaction,prcs=prcs, jobid=jobid)
    tmpmaster = job.run()
    sbar = tmpmaster['sbar']; dbar = tmpmaster['dbar']
    sxx = [] ; dxx=[]
    syy = [] ; dyy=[]
    sxy = [] ; dxy=[]
    for i in range(len(filename)):
        sxx.append(sbar[i][0][0,0] - sbar[i][0][2,2])
        syy.append(sbar[i][0][1,1] - sbar[i][0][2,2])
        sxy.append(sbar[i][0][0,1])
        dxx.append(dbar[i][0][0,0])
        dyy.append(dbar[i][0][1,1])
        dxy.append(dbar[i][0][0,1])
        pass

    # sxx.append(sxx[0])
    # syy.append(syy[0])
    # sxy.append(sxy[0])
    d = [] #strain rate angle (normal to yield surface)
    t = []
    for i in range(len(filename)):
        norm = sqrt(dxx[i]**2+dyy[i]**2)
        d.append(atan2(dyy[i],dxx[i]))
        t.append(atan2(dxy[i],norm))
        pass

    ## plotting
    fig = plt.figure(ifig); #ax=fig.add_subplot(111)
    ax = Axes3D(fig)
    ax.plot(sxx, syy, sxy, '.', label=r'$\sigma_{xx}-\sigma_{yy}-\sigma_{xy}$')
    ax.set_xlabel(r'$\sigma_{xx}$', dict(fontsize=20))
    ax.set_ylabel(r'$\sigma_{yy}$', dict(fontsize=20))
    ax.set_zlabel(r'$\sigma_{xy}$', dict(fontsize=20))

    ax.set_axis_off()
    
    r = 30
    # for i in range(len(d)):
    #     ax.plot(
    #         [sxx[i],sxx[i]+cos(d[i])], #[x0,x1]
    #         [syy[i],syy[i]+sin(d[i])], #[y0,y1]
    #         [sxy[i],sxy[i]+tan(t[i])], #[z0,z1]
    #         color='gray', alpha=0.5, ls='-')
    #     pass
    ## plotting
    
    return sxx,syy,sxy