Ejemplo n.º 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()
Ejemplo n.º 2
0
# flux j0
ax = axes[2, 0]
plt_j0(fig, ax, ry, 0.025, 4, 5, simname)

# flux j1
ax = axes[2, 1]
plt_j1(fig, ax, ry, 0.05, 4, 5, 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 = R[-1] - R[0] + dR
rhoR = np.sum(rho, axis=1) * dr

vlist = v(R, v0, vp, x0, L)
c1 = cn(R, rhoR, vlist, 1)
c2 = cn(R, rhoR, vlist, 2)
#######################
fig.suptitle(
    r"$q={:1.1f}~ T={:1.1f} k={:1.1f} ~~~~~ c_1={:1.3f}~c_2={:1.3f}$".format(
        q, D, k, c1, c2))
fig.tight_layout()
fig.subplots_adjust(top=0.95)

plt.savefig(savename + ".pdf")
plt.show()
Ejemplo n.º 3
0

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)
vlist = abs(vlist)
vavg = dR * np.sum(vlist) / (L)

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

c = dR * np.sum((vlist - vavg) * (rhoR - rhoavg)) / (vavg * rhoavg * L)

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

plt.plot(R, rhoR * L - 1, label="Numerical")
plt.plot(R, rhoA * L - 1, label="Analytical")
plt.ylabel(r"$\frac{\rho(R)}{\rho_b} - 1$",
           rotation=0,
           fontsize=10,
           labelpad=10)
plt.xlabel(r"$R$")
#plt.title( r"$q = {:1.2f} ~~ D={:1.1f} ~~ c_1 = {:1.5f}  ~~ c_2={:1.5f} $".format(q,D, c1, c2))
plt.title(r"$q = {:1.2f} ~~ D={:1.1f}  $".format(q, D))
plt.legend()
plt.tight_layout()
plt.show()