Exemple #1
0
ax7 = p.subplot2grid((17, 5), (8, 1), rowspan=8)
ax8 = p.subplot2grid((17, 5), (8, 2), rowspan=8)
ax9 = p.subplot2grid((17, 5), (8, 3), rowspan=8)
ax10 = p.subplot2grid((17, 5), (8, 4), rowspan=8)

cbar = p.subplot2grid((17, 5), (16, 0), colspan=4)
cbar2 = p.subplot2grid((17, 5), (16, 4), colspan=4)

axes = [ax1, ax2, ax3, ax4, ax5, ax6, ax7, ax8, ax9, ax10]
nums = [0, 5, 10, 15, 20, 25, 30, 35, 40]

cmin = 0.9
cmax = 2.1

for j in np.arange(len(nums)):
    sn = arepo.Simulation("../output/snap_%.3d.hdf5" % nums[j])

    sn.plot_AMRslice(sn.rho,
                     axes=axes[j],
                     colorbar=False,
                     cmap='parula',
                     res=2048,
                     vmin=cmin,
                     vmax=cmax,
                     gradient=sn.grar)
    axes[j].xaxis.set_visible(False)
    axes[j].yaxis.set_visible(False)
    axes[j].set_frame_on(False)
    axes[j].annotate("t = %.2g" % sn.time, [0.02, 1.87], color='black')

arr = np.arange(0, 256)
Exemple #2
0
import matplotlib.pyplot as p
import arepo
import numpy as np

toinch = 0.393700787
p.figure(figsize=np.array([14.7, 5]) * toinch, dpi=300)

ax1 = p.subplot2grid((1, 3), (0, 0))
ax2 = p.subplot2grid((1, 3), (0, 1))
ax3 = p.subplot2grid((1, 3), (0, 2))

axes = [ax1, ax2, ax3]
nums = [0, 100, 200]

for j in np.arange(len(nums)):
    sn = arepo.Simulation("../output_static/snap_%.3d.hdf5" % nums[j])

    sn.plot_AMRslice(sn.rho, axes=axes[j], colorbar=False)
    axes[j].xaxis.set_visible(False)
    axes[j].yaxis.set_visible(False)
    axes[j].set_frame_on(False)
    axes[j].annotate("t = %.2g" % sn.time, [0.02, 0.9], color='white')

p.tight_layout()
p.show()
p.savefig("KH_time.pdf", dpi=300)
Exemple #3
0
import matplotlib.pyplot as p
import arepo
import numpy as np

toinch = 0.393700787
p.figure(figsize=np.array([14.7,10])*toinch, dpi=300)



sn = arepo.Simulation("../output_2d/snap_%.3d.hdf5"%10)

sn.plot_radprof(sn.rho, label="t = %.2g"%sn.time, bins = 200)

t = np.loadtxt("output_2d.dat",skiprows=2)

p.plot(t[:,1],t[:,2], label="analytical solution",zorder=0)

p.legend(loc=4, frameon=False, fontsize=9)
p.tight_layout()
p.show()
p.savefig("sedov_profile_2d.pdf", dpi=300)
Exemple #4
0
import matplotlib.pyplot as p
import arepo
import numpy as np

toinch = 0.393700787
p.figure(figsize=np.array([14.7 * 2. / 3, 5]) * toinch, dpi=300)

ax1 = p.subplot2grid((1, 2), (0, 0))
ax2 = p.subplot2grid((1, 2), (0, 1))

axes = [ax1, ax2]
sims = [
    '../output_amr/snap_200.hdf5', '../output_amr_nosmoothing/snap_200.hdf5'
]
label = ["AMR", "AMR no smoothing"]

for j in np.arange(len(sims)):
    sn = arepo.Simulation(sims[j])

    sn.plot_AMRslice(sn.amrlevel, axes=axes[j], colorbar=False, cmap="RdBu")
    axes[j].xaxis.set_visible(False)
    axes[j].yaxis.set_visible(False)
    axes[j].set_frame_on(False)
    axes[j].annotate(label[j], [0.02, 0.9], color='white')

p.tight_layout()
p.show()
p.savefig("KH_amrlevel.pdf", dpi=300)
Exemple #5
0
#!/usr/bin/env python

import numpy as np
import sys
from argparse import ArgumentParser
import matplotlib.pyplot as plt

import arepo
from grad import analytic_grad_rho

parser = ArgumentParser()
parser.add_argument("snapshot")
args = parser.parse_args()

out = arepo.Simulation(args.snapshot)

# Discard border cells
x, y, z = out.pos.T
margin = 0.1
inside = (x > margin) & (x < 1 - margin) & (y > margin) & (y < 1 - margin)

theta = np.deg2rad(57)
gx, gy, gz = out.grar[inside, :].T

# Reference gradient (analytic)
grefx, grefy, grefz = analytic_grad_rho(x[inside], y[inside])

err = np.sqrt((gx - grefx)**2 + (gy - grefy)**2 + (gz - grefz)**2)

print "Gradient error (max, L2):", np.max(err), np.sqrt(np.mean(err**2))