示例#1
0
def plt_rho1d(ax,q,v,alpha,D,simname):
    rho = np.loadtxt(simname+"data/r.dat", delimiter=';')
    R = np.loadtxt(simname+"data/x.dat")
    r = np.loadtxt(simname+"data/y.dat")
    dR = R[1] - R[0]
    dr = r[1] - r[0]
    L = 2*R[-1]+dR
    NR = rho.shape[0]
    Nr = rho.shape[1]

    rhoR = np.sum(rho,axis=1)
    rhoavg = dR*np.sum(rhoR)/L
    N = np.sum(rhoR)*dR
    rhoR /=N


    vlist = v(R,v0,vp,x0,L)

    c1 = cn(R,rhoR,vlist,1)
    c2 = cn(R,rhoR,vlist,2)


    rhoA = rhoR_analytical(vlist, dR,alpha,D,q)

    ax.plot(R,rhoR*L - 1, label="Numerical")
    ax.plot(R,rhoA*L - 1, label="Analytical")
    ax.set_ylabel(r"$\frac{\rho(R)}{\rho_b} - 1$", rotation=0, fontsize=10,labelpad=10)
    ax.set_xlabel(r"$R$")
    #ax.set_title( r"$q = {:1.1f} ~ D={:1.1f} ~~~~~ c_1 = {:1.3f}  ~ c_2={:1.3f} $".format(q,D, c1, c2))
    #ax.title( r"$q = {:1.2f} ~~ D={:1.1f}  $".format(q,D))
    ax.legend()
示例#2
0
R = np.loadtxt("data/x.dat")
dR = R[1] - R[0]
L = R[-1] - R[0] + dR


def v(x, v0, vp, x0):
    return v0 + vp * np.sin(x * np.pi * 2 / L)
    #return abs(v0 - vp * abs(x-x0))


vlist = v(R, v0, vp, x0)
vlist = abs(vlist)
rhoR = np.sum(rho, axis=1) * dR
N = np.sum(rhoR) * dR
rhoR /= N
rhoA = rhoR_analytical(vlist, dR, alpha, D, q)
N = np.sum(rhoA) * dR
rhoA /= N
plt.plot(R, rhoA, color='black', label="Steady-state")

x = np.loadtxt(dirname + "x.dat")
dx = x[1] - x[0]
y = np.loadtxt(dirname + "y.dat")
dy = y[1] - y[0]

#r = np.loadtxt(dirname+"r0.dat", delimiter=';')
#ry = np.sum(r, axis = 0 )*dx
#rx = np.sum(r, axis = 1 )*dy
rx = np.loadtxt(dirname + "rx0.dat", delimiter=';')
ry = np.loadtxt(dirname + "ry0.dat", delimiter=';')