Note
Go to the end to download the full example code.
Open a phantom dump#
This simple example shows how to open a phantom dump in shamrock
Download a phantom dump
10 dump_folder = "_to_trash"
11 import os
12
13 os.system("mkdir -p " + dump_folder)
14
15 url = "https://raw.githubusercontent.com/Shamrock-code/reference-files/refs/heads/main/blast_00010"
16
17 filename = dump_folder + "/blast_00010"
18
19 from urllib.request import urlretrieve
20
21 urlretrieve(url, filename)
('_to_trash/blast_00010', <http.client.HTTPMessage object at 0x7f8ed94296a0>)
Open the phantom dump
26 import shamrock
27
28 dump = shamrock.load_phantom_dump(filename)
Print the data
33 dump.print_state()
--- dump state ---
table_header_fort_int len = 22
nparttot 576
ntypes 8
npartoftype 576
npartoftype 0
npartoftype 0
npartoftype 0
npartoftype 0
npartoftype 0
npartoftype 0
npartoftype 0
nblocks 1
nptmass 0
ndustlarge 0
ndustsmall 0
idust 7
idtmax_n 1
idtmax_frac 0
idumpfile 10
majorv 2023
minorv 0
microv 0
isink 0
table_header_i8 len = 0
table_header_i16 len = 0
table_header_i32 len = 2
iexternalforce 0
ieos 2
table_header_i64 len = 10
nparttot 576
ntypes 8
npartoftype 576
npartoftype 0
npartoftype 0
npartoftype 0
npartoftype 0
npartoftype 0
npartoftype 0
npartoftype 0
table_header_fort_real len = 37
gamma 1.6666666666666667
RK2 0
polyk2 0
qfacdisc 0.75
qfacdisc2 0.75
time 0.050000000000000225
dtmax 0.005
rhozero 1
hfact 1.2
tolh 0.0001
C_cour 0.3
C_force 0.25
alpha 0
alphau 1
alphaB 1
massoftype 0.001726334915006219
massoftype 0.001726334915006219
massoftype 0.001726334915006219
massoftype 0.001726334915006219
massoftype 0.001726334915006219
massoftype 0.001726334915006219
massoftype 0.001726334915006219
massoftype 0.001726334915006219
Bextx 0
Bexty 0
Bextz 0
dum 0
xmin -0.5
xmax 0.5
ymin -0.4871392896287467
ymax 0.4871392896287467
zmin -0.5103103630798287
zmax 0.5103103630798287
get_conserv -1
etot_in 1.0000000000000013
angtot_in 0
totmom_in 0
table_header_f32 len = 0
table_header_f64 len = 4
udist 1
umass 1
utime 1
umagfd 3.5449077018167907
block 0 :
--blocks_fort_int --
--blocks_i8 --
--blocks_i16 --
--blocks_i32 --
--blocks_i64 --
tag = iorig size = 576
--blocks_fort_real--
tag = x size = 576
tag = y size = 576
tag = z size = 576
tag = vx size = 576
tag = vy size = 576
tag = vz size = 576
tag = u size = 576
--blocks_f32 --
tag = h size = 576
tag = alpha size = 576
tag = divv size = 576
--blocks_f64 --
block 1 :
--blocks_fort_int --
--blocks_i8 --
--blocks_i16 --
--blocks_i32 --
--blocks_i64 --
--blocks_fort_real--
--blocks_f32 --
--blocks_f64 --
------------------
Total running time of the script: (0 minutes 0.347 seconds)
Estimated memory usage: 72 MB