# initial distribution
r0 = 1.
dr0 = 0
# Q0 = np.random.normal(loc=0.9, scale=1., size=(n,))

# generate grid
loc = 2.5
scale = 0.3
qgrid_size = 1000
qgrid = np.linspace(0, 15, qgrid_size)
rho0 = n * norm.pdf(qgrid, loc=loc, scale=scale)
t_end = 24  #60

pms.init_equations(T_r, U_r, T_q, U_q, g)
pms.init_meso(r0, dr0, rho0, qgrid, t_end, n_eval=400)
pms.simulate_meso(method="RK45", atol=1.e-8, rtol=1.e-8, use_upwind=True)

#pms.simulate_meso_own()

pms.name = "onion"
#save_plots( plt, pms, "meso")

pms.plot_g(levels=100)
plt.show()

pms.plot_veff_img(detail=500)
plt.show()

pms.plot_particle_paths_meso_time()
plt.show()
Ejemplo n.º 2
0
# initial distribution
r0 = 1.
dr0 = 0
# Q0 = np.random.normal(loc=0.9, scale=1., size=(n,))

# generate grid
loc = 2
scale = 0.5
qgrid_size = 100
qgrid = np.linspace(-4, 4, qgrid_size)
rho0 = n * norm.pdf(qgrid, loc=loc, scale=scale)
t_end = 60

dpms.init_equations(T_r, U_r, T_q, U_q, g)
dpms.init_meso(r0, dr0, rho0, qgrid, t_end)
dpms.simulate_meso()

path = "../../../documents/paper/images/"
fname = path + "demo_meso"

dpms.plot_g(levels=100)
plt.savefig(fname + "_contour.pdf")
plt.show()
#
#dpms.plot_particle_paths()
#plt.savefig(fname + "_particles_time.pdf")
#plt.show()

#dpms.plot_particle_paths(use_r_axis=True,plot_singular_pts=True)
#plt.savefig(fname + "_particles_statespace.pdf")