Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
SWIFTsim
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
68
Issues
68
List
Boards
Labels
Milestones
Merge Requests
11
Merge Requests
11
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
SWIFT
SWIFTsim
Commits
5e2482a0
Commit
5e2482a0
authored
Jul 11, 2017
by
Loikki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check if snapshot directory exists and add a digit to the output #321
parent
81269f6a
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
65 additions
and
49 deletions
+65
-49
examples/CoolingBox/energy_plot.py
examples/CoolingBox/energy_plot.py
+2
-2
examples/CoolingHalo/density_profile.py
examples/CoolingHalo/density_profile.py
+2
-2
examples/CoolingHalo/internal_energy_profile.py
examples/CoolingHalo/internal_energy_profile.py
+2
-2
examples/CoolingHalo/test_energy_conservation.py
examples/CoolingHalo/test_energy_conservation.py
+2
-2
examples/CoolingHalo/velocity_profile.py
examples/CoolingHalo/velocity_profile.py
+2
-2
examples/CoolingHaloWithSpin/density_profile.py
examples/CoolingHaloWithSpin/density_profile.py
+2
-2
examples/CoolingHaloWithSpin/internal_energy_profile.py
examples/CoolingHaloWithSpin/internal_energy_profile.py
+2
-2
examples/CoolingHaloWithSpin/test_energy_conservation.py
examples/CoolingHaloWithSpin/test_energy_conservation.py
+2
-2
examples/CoolingHaloWithSpin/velocity_profile.py
examples/CoolingHaloWithSpin/velocity_profile.py
+2
-2
examples/ExternalPointMass/energy_plot.py
examples/ExternalPointMass/energy_plot.py
+2
-2
examples/Gradients/run.sh
examples/Gradients/run.sh
+3
-3
examples/GreshoVortex_2D/plotSolution.py
examples/GreshoVortex_2D/plotSolution.py
+1
-1
examples/HydrostaticHalo/density_profile.py
examples/HydrostaticHalo/density_profile.py
+2
-2
examples/HydrostaticHalo/internal_energy_profile.py
examples/HydrostaticHalo/internal_energy_profile.py
+2
-2
examples/HydrostaticHalo/test_energy_conservation.py
examples/HydrostaticHalo/test_energy_conservation.py
+2
-2
examples/HydrostaticHalo/velocity_profile.py
examples/HydrostaticHalo/velocity_profile.py
+2
-2
examples/IsothermalPotential/energy_plot.py
examples/IsothermalPotential/energy_plot.py
+2
-2
examples/KelvinHelmholtz_2D/plotSolution.py
examples/KelvinHelmholtz_2D/plotSolution.py
+1
-1
examples/Noh_1D/plotSolution.py
examples/Noh_1D/plotSolution.py
+1
-1
examples/Noh_2D/plotSolution.py
examples/Noh_2D/plotSolution.py
+1
-1
examples/Noh_3D/plotSolution.py
examples/Noh_3D/plotSolution.py
+1
-1
examples/SedovBlast_1D/plotSolution.py
examples/SedovBlast_1D/plotSolution.py
+1
-1
examples/SedovBlast_2D/plotSolution.py
examples/SedovBlast_2D/plotSolution.py
+1
-1
examples/SedovBlast_3D/plotSolution.py
examples/SedovBlast_3D/plotSolution.py
+1
-1
examples/SodShock_1D/plotSolution.py
examples/SodShock_1D/plotSolution.py
+1
-1
examples/SodShock_2D/plotSolution.py
examples/SodShock_2D/plotSolution.py
+1
-1
examples/SodShock_3D/plotSolution.py
examples/SodShock_3D/plotSolution.py
+1
-1
examples/SquareTest_2D/plotSolution.py
examples/SquareTest_2D/plotSolution.py
+1
-1
examples/main.c
examples/main.c
+16
-0
src/parallel_io.c
src/parallel_io.c
+1
-1
src/serial_io.c
src/serial_io.c
+1
-1
src/single_io.c
src/single_io.c
+1
-1
src/xmf.c
src/xmf.c
+1
-1
No files found.
examples/CoolingBox/energy_plot.py
View file @
5e2482a0
...
...
@@ -34,7 +34,7 @@ import sys
stats_filename
=
"./energy.txt"
# First snapshot
snap_filename
=
"coolingBox_000.hdf5"
snap_filename
=
"coolingBox_000
0
.hdf5"
# Some constants in cgs units
k_b
=
1.38E-16
#boltzmann
...
...
@@ -104,7 +104,7 @@ print "Cooling time:", cooling_time_cgs, "[s]"
u_snapshots_cgs
=
zeros
(
25
)
t_snapshots_cgs
=
zeros
(
25
)
for
i
in
range
(
25
):
snap
=
h5
.
File
(
"coolingBox_%0.
3
d.hdf5"
%
i
,
'r'
)
snap
=
h5
.
File
(
"coolingBox_%0.
4
d.hdf5"
%
i
,
'r'
)
u_snapshots_cgs
[
i
]
=
sum
(
snap
[
"/PartType0/InternalEnergy"
][:]
*
snap
[
"/PartType0/Masses"
][:])
/
total_mass
[
0
]
*
unit_length
**
2
/
(
unit_time
)
**
2
t_snapshots_cgs
[
i
]
=
snap
[
"/Header"
].
attrs
[
"Time"
]
*
unit_time
...
...
examples/CoolingHalo/density_profile.py
View file @
5e2482a0
...
...
@@ -20,7 +20,7 @@ H_0_cgs = 100. * h * KM_PER_SEC_IN_CGS / (1.0e6 * PARSEC_IN_CGS)
#read some header/parameter information from the first snapshot
filename
=
"Hydrostatic_000.hdf5"
filename
=
"Hydrostatic_000
0
.hdf5"
f
=
h5
.
File
(
filename
,
'r'
)
params
=
f
[
"Parameters"
]
unit_mass_cgs
=
float
(
params
.
attrs
[
"InternalUnitSystem:UnitMass_in_cgs"
])
...
...
@@ -39,7 +39,7 @@ M_vir_cgs = r_vir_cgs * v_c_cgs**2 / CONST_G_CGS
for
i
in
range
(
n_snaps
):
filename
=
"Hydrostatic_%0
3
d.hdf5"
%
i
filename
=
"Hydrostatic_%0
4
d.hdf5"
%
i
f
=
h5
.
File
(
filename
,
'r'
)
coords_dset
=
f
[
"PartType0/Coordinates"
]
coords
=
np
.
array
(
coords_dset
)
...
...
examples/CoolingHalo/internal_energy_profile.py
View file @
5e2482a0
...
...
@@ -38,7 +38,7 @@ H_0_cgs = 100. * h * KM_PER_SEC_IN_CGS / (1.0e6 * PARSEC_IN_CGS)
#read some header/parameter information from the first snapshot
filename
=
"Hydrostatic_000.hdf5"
filename
=
"Hydrostatic_000
0
.hdf5"
f
=
h5
.
File
(
filename
,
'r'
)
params
=
f
[
"Parameters"
]
unit_mass_cgs
=
float
(
params
.
attrs
[
"InternalUnitSystem:UnitMass_in_cgs"
])
...
...
@@ -57,7 +57,7 @@ M_vir_cgs = r_vir_cgs * v_c_cgs**2 / CONST_G_CGS
for
i
in
range
(
n_snaps
):
filename
=
"Hydrostatic_%0
3
d.hdf5"
%
i
filename
=
"Hydrostatic_%0
4
d.hdf5"
%
i
f
=
h5
.
File
(
filename
,
'r'
)
coords_dset
=
f
[
"PartType0/Coordinates"
]
coords
=
np
.
array
(
coords_dset
)
...
...
examples/CoolingHalo/test_energy_conservation.py
View file @
5e2482a0
...
...
@@ -17,7 +17,7 @@ H_0_cgs = 100. * h * KM_PER_SEC_IN_CGS / (1.0e6 * PARSEC_IN_CGS)
#read some header/parameter information from the first snapshot
filename
=
"CoolingHalo_000.hdf5"
filename
=
"CoolingHalo_000
0
.hdf5"
f
=
h5
.
File
(
filename
,
'r'
)
params
=
f
[
"Parameters"
]
unit_mass_cgs
=
float
(
params
.
attrs
[
"InternalUnitSystem:UnitMass_in_cgs"
])
...
...
@@ -41,7 +41,7 @@ time_array_cgs = []
for
i
in
range
(
n_snaps
):
filename
=
"CoolingHalo_%0
3
d.hdf5"
%
i
filename
=
"CoolingHalo_%0
4
d.hdf5"
%
i
f
=
h5
.
File
(
filename
,
'r'
)
coords_dset
=
f
[
"PartType0/Coordinates"
]
coords
=
np
.
array
(
coords_dset
)
...
...
examples/CoolingHalo/velocity_profile.py
View file @
5e2482a0
...
...
@@ -39,7 +39,7 @@ H_0_cgs = 100. * h * KM_PER_SEC_IN_CGS / (1.0e6 * PARSEC_IN_CGS)
#read some header/parameter information from the first snapshot
filename
=
"CoolingHalo_000.hdf5"
filename
=
"CoolingHalo_000
0
.hdf5"
f
=
h5
.
File
(
filename
,
'r'
)
params
=
f
[
"Parameters"
]
unit_mass_cgs
=
float
(
params
.
attrs
[
"InternalUnitSystem:UnitMass_in_cgs"
])
...
...
@@ -58,7 +58,7 @@ M_vir_cgs = r_vir_cgs * v_c_cgs**2 / CONST_G_CGS
for
i
in
range
(
n_snaps
):
filename
=
"CoolingHalo_%0
3
d.hdf5"
%
i
filename
=
"CoolingHalo_%0
4
d.hdf5"
%
i
f
=
h5
.
File
(
filename
,
'r'
)
coords_dset
=
f
[
"PartType0/Coordinates"
]
coords
=
np
.
array
(
coords_dset
)
...
...
examples/CoolingHaloWithSpin/density_profile.py
View file @
5e2482a0
...
...
@@ -21,7 +21,7 @@ H_0_cgs = 100. * h * KM_PER_SEC_IN_CGS / (1.0e6 * PARSEC_IN_CGS)
#read some header/parameter information from the first snapshot
filename
=
"CoolingHalo_000.hdf5"
filename
=
"CoolingHalo_000
0
.hdf5"
f
=
h5
.
File
(
filename
,
'r'
)
params
=
f
[
"Parameters"
]
unit_mass_cgs
=
float
(
params
.
attrs
[
"InternalUnitSystem:UnitMass_in_cgs"
])
...
...
@@ -42,7 +42,7 @@ M_vir_cgs = r_vir_cgs * v_c_cgs**2 / CONST_G_CGS
for
i
in
range
(
n_snaps
):
filename
=
"CoolingHalo_%0
3
d.hdf5"
%
i
filename
=
"CoolingHalo_%0
4
d.hdf5"
%
i
f
=
h5
.
File
(
filename
,
'r'
)
coords_dset
=
f
[
"PartType0/Coordinates"
]
coords
=
np
.
array
(
coords_dset
)
...
...
examples/CoolingHaloWithSpin/internal_energy_profile.py
View file @
5e2482a0
...
...
@@ -39,7 +39,7 @@ H_0_cgs = 100. * h * KM_PER_SEC_IN_CGS / (1.0e6 * PARSEC_IN_CGS)
#read some header/parameter information from the first snapshot
filename
=
"CoolingHalo_000.hdf5"
filename
=
"CoolingHalo_000
0
.hdf5"
f
=
h5
.
File
(
filename
,
'r'
)
params
=
f
[
"Parameters"
]
unit_mass_cgs
=
float
(
params
.
attrs
[
"InternalUnitSystem:UnitMass_in_cgs"
])
...
...
@@ -60,7 +60,7 @@ M_vir_cgs = r_vir_cgs * v_c_cgs**2 / CONST_G_CGS
for
i
in
range
(
n_snaps
):
filename
=
"CoolingHalo_%0
3
d.hdf5"
%
i
filename
=
"CoolingHalo_%0
4
d.hdf5"
%
i
f
=
h5
.
File
(
filename
,
'r'
)
coords_dset
=
f
[
"PartType0/Coordinates"
]
coords
=
np
.
array
(
coords_dset
)
...
...
examples/CoolingHaloWithSpin/test_energy_conservation.py
View file @
5e2482a0
...
...
@@ -20,7 +20,7 @@ H_0_cgs = 100. * h * KM_PER_SEC_IN_CGS / (1.0e6 * PARSEC_IN_CGS)
#read some header/parameter information from the first snapshot
filename
=
"CoolingHalo_000.hdf5"
filename
=
"CoolingHalo_000
0
.hdf5"
f
=
h5
.
File
(
filename
,
'r'
)
params
=
f
[
"Parameters"
]
unit_mass_cgs
=
float
(
params
.
attrs
[
"InternalUnitSystem:UnitMass_in_cgs"
])
...
...
@@ -44,7 +44,7 @@ time_array_cgs = []
for
i
in
range
(
n_snaps
):
filename
=
"CoolingHalo_%0
3
d.hdf5"
%
i
filename
=
"CoolingHalo_%0
4
d.hdf5"
%
i
f
=
h5
.
File
(
filename
,
'r'
)
coords_dset
=
f
[
"PartType0/Coordinates"
]
coords
=
np
.
array
(
coords_dset
)
...
...
examples/CoolingHaloWithSpin/velocity_profile.py
View file @
5e2482a0
...
...
@@ -39,7 +39,7 @@ H_0_cgs = 100. * h * KM_PER_SEC_IN_CGS / (1.0e6 * PARSEC_IN_CGS)
#read some header/parameter information from the first snapshot
filename
=
"CoolingHalo_000.hdf5"
filename
=
"CoolingHalo_000
0
.hdf5"
f
=
h5
.
File
(
filename
,
'r'
)
params
=
f
[
"Parameters"
]
unit_mass_cgs
=
float
(
params
.
attrs
[
"InternalUnitSystem:UnitMass_in_cgs"
])
...
...
@@ -58,7 +58,7 @@ M_vir_cgs = r_vir_cgs * v_c_cgs**2 / CONST_G_CGS
for
i
in
range
(
n_snaps
):
filename
=
"CoolingHalo_%0
3
d.hdf5"
%
i
filename
=
"CoolingHalo_%0
4
d.hdf5"
%
i
f
=
h5
.
File
(
filename
,
'r'
)
coords_dset
=
f
[
"PartType0/Coordinates"
]
coords
=
np
.
array
(
coords_dset
)
...
...
examples/ExternalPointMass/energy_plot.py
View file @
5e2482a0
...
...
@@ -34,7 +34,7 @@ import sys
stats_filename
=
"./energy.txt"
# First snapshot
snap_filename
=
"pointMass_000.hdf5"
snap_filename
=
"pointMass_000
0
.hdf5"
f
=
h5
.
File
(
snap_filename
,
'r'
)
# Read the units parameters from the snapshot
...
...
@@ -71,7 +71,7 @@ Lz_snap = np.zeros(402)
# Read all the particles from the snapshots
for
i
in
range
(
402
):
snap_filename
=
"pointMass_%0.
3
d.hdf5"
%
i
snap_filename
=
"pointMass_%0.
4
d.hdf5"
%
i
f
=
h5
.
File
(
snap_filename
,
'r'
)
pos_x
=
f
[
"PartType1/Coordinates"
][:,
0
]
...
...
examples/Gradients/run.sh
View file @
5e2482a0
...
...
@@ -2,12 +2,12 @@
python makeICs.py stretched
../swift
-s
-t
2 gradientsStretched.yml
python plot.py gradients_stretched_001.hdf5 stretched
python plot.py gradients_stretched_00
0
1.hdf5 stretched
python makeICs.py cartesian
../swift
-s
-t
2 gradientsCartesian.yml
python plot.py gradients_cartesian_001.hdf5 cartesian
python plot.py gradients_cartesian_00
0
1.hdf5 cartesian
python makeICs.py random
../swift
-s
-t
2 gradientsRandom.yml
python plot.py gradients_random_001.hdf5 random
python plot.py gradients_random_00
0
1.hdf5 random
examples/GreshoVortex_2D/plotSolution.py
View file @
5e2482a0
...
...
@@ -83,7 +83,7 @@ solution_s = solution_P / solution_rho**gas_gamma
solution_u
=
solution_P
/
((
gas_gamma
-
1.
)
*
solution_rho
)
# Read the simulation data
sim
=
h5py
.
File
(
"gresho_%0
3
d.hdf5"
%
snap
,
"r"
)
sim
=
h5py
.
File
(
"gresho_%0
4
d.hdf5"
%
snap
,
"r"
)
boxSize
=
sim
[
"/Header"
].
attrs
[
"BoxSize"
][
0
]
time
=
sim
[
"/Header"
].
attrs
[
"Time"
][
0
]
scheme
=
sim
[
"/HydroScheme"
].
attrs
[
"Scheme"
]
...
...
examples/HydrostaticHalo/density_profile.py
View file @
5e2482a0
...
...
@@ -42,7 +42,7 @@ H_0_cgs = 100. * h * KM_PER_SEC_IN_CGS / (1.0e6 * PARSEC_IN_CGS)
#read some header/parameter information from the first snapshot
filename
=
"Hydrostatic_000.hdf5"
filename
=
"Hydrostatic_000
0
.hdf5"
f
=
h5
.
File
(
filename
,
'r'
)
params
=
f
[
"Parameters"
]
unit_mass_cgs
=
float
(
params
.
attrs
[
"InternalUnitSystem:UnitMass_in_cgs"
])
...
...
@@ -63,7 +63,7 @@ M_vir_cgs = r_vir_cgs * v_c_cgs**2 / CONST_G_CGS
for
i
in
range
(
n_snaps
):
filename
=
"Hydrostatic_%0
3
d.hdf5"
%
i
filename
=
"Hydrostatic_%0
4
d.hdf5"
%
i
f
=
h5
.
File
(
filename
,
'r'
)
coords_dset
=
f
[
"PartType0/Coordinates"
]
coords
=
np
.
array
(
coords_dset
)
...
...
examples/HydrostaticHalo/internal_energy_profile.py
View file @
5e2482a0
...
...
@@ -60,7 +60,7 @@ H_0_cgs = 100. * h * KM_PER_SEC_IN_CGS / (1.0e6 * PARSEC_IN_CGS)
#read some header/parameter information from the first snapshot
filename
=
"Hydrostatic_000.hdf5"
filename
=
"Hydrostatic_000
0
.hdf5"
f
=
h5
.
File
(
filename
,
'r'
)
params
=
f
[
"Parameters"
]
unit_mass_cgs
=
float
(
params
.
attrs
[
"InternalUnitSystem:UnitMass_in_cgs"
])
...
...
@@ -79,7 +79,7 @@ M_vir_cgs = r_vir_cgs * v_c_cgs**2 / CONST_G_CGS
for
i
in
range
(
n_snaps
):
filename
=
"Hydrostatic_%0
3
d.hdf5"
%
i
filename
=
"Hydrostatic_%0
4
d.hdf5"
%
i
f
=
h5
.
File
(
filename
,
'r'
)
coords_dset
=
f
[
"PartType0/Coordinates"
]
coords
=
np
.
array
(
coords_dset
)
...
...
examples/HydrostaticHalo/test_energy_conservation.py
View file @
5e2482a0
...
...
@@ -38,7 +38,7 @@ H_0_cgs = 100. * h * KM_PER_SEC_IN_CGS / (1.0e6 * PARSEC_IN_CGS)
#read some header/parameter information from the first snapshot
filename
=
"Hydrostatic_000.hdf5"
filename
=
"Hydrostatic_000
0
.hdf5"
f
=
h5
.
File
(
filename
,
'r'
)
params
=
f
[
"Parameters"
]
unit_mass_cgs
=
float
(
params
.
attrs
[
"InternalUnitSystem:UnitMass_in_cgs"
])
...
...
@@ -62,7 +62,7 @@ time_array_cgs = []
for
i
in
range
(
n_snaps
):
filename
=
"Hydrostatic_%0
3
d.hdf5"
%
i
filename
=
"Hydrostatic_%0
4
d.hdf5"
%
i
f
=
h5
.
File
(
filename
,
'r'
)
coords_dset
=
f
[
"PartType0/Coordinates"
]
coords
=
np
.
array
(
coords_dset
)
...
...
examples/HydrostaticHalo/velocity_profile.py
View file @
5e2482a0
...
...
@@ -60,7 +60,7 @@ H_0_cgs = 100. * h * KM_PER_SEC_IN_CGS / (1.0e6 * PARSEC_IN_CGS)
#read some header/parameter information from the first snapshot
filename
=
"Hydrostatic_000.hdf5"
filename
=
"Hydrostatic_000
0
.hdf5"
f
=
h5
.
File
(
filename
,
'r'
)
params
=
f
[
"Parameters"
]
unit_mass_cgs
=
float
(
params
.
attrs
[
"InternalUnitSystem:UnitMass_in_cgs"
])
...
...
@@ -79,7 +79,7 @@ M_vir_cgs = r_vir_cgs * v_c_cgs**2 / CONST_G_CGS
for
i
in
range
(
n_snaps
):
filename
=
"Hydrostatic_%0
3
d.hdf5"
%
i
filename
=
"Hydrostatic_%0
4
d.hdf5"
%
i
f
=
h5
.
File
(
filename
,
'r'
)
coords_dset
=
f
[
"PartType0/Coordinates"
]
coords
=
np
.
array
(
coords_dset
)
...
...
examples/IsothermalPotential/energy_plot.py
View file @
5e2482a0
...
...
@@ -34,7 +34,7 @@ import sys
stats_filename
=
"./energy.txt"
# First snapshot
snap_filename
=
"Isothermal_000.hdf5"
snap_filename
=
"Isothermal_000
0
.hdf5"
f
=
h5
.
File
(
snap_filename
,
'r'
)
# Read the units parameters from the snapshot
...
...
@@ -70,7 +70,7 @@ Lz_snap = np.zeros(402)
# Read all the particles from the snapshots
for
i
in
range
(
402
):
snap_filename
=
"Isothermal_%0.
3
d.hdf5"
%
i
snap_filename
=
"Isothermal_%0.
4
d.hdf5"
%
i
f
=
h5
.
File
(
snap_filename
,
'r'
)
pos_x
=
f
[
"PartType1/Coordinates"
][:,
0
]
...
...
examples/KelvinHelmholtz_2D/plotSolution.py
View file @
5e2482a0
...
...
@@ -63,7 +63,7 @@ rc('font',**{'family':'sans-serif','sans-serif':['Times']})
snap
=
int
(
sys
.
argv
[
1
])
# Read the simulation data
sim
=
h5py
.
File
(
"kelvinHelmholtz_%0
3
d.hdf5"
%
snap
,
"r"
)
sim
=
h5py
.
File
(
"kelvinHelmholtz_%0
4
d.hdf5"
%
snap
,
"r"
)
boxSize
=
sim
[
"/Header"
].
attrs
[
"BoxSize"
][
0
]
time
=
sim
[
"/Header"
].
attrs
[
"Time"
][
0
]
scheme
=
sim
[
"/HydroScheme"
].
attrs
[
"Scheme"
]
...
...
examples/Noh_1D/plotSolution.py
View file @
5e2482a0
...
...
@@ -58,7 +58,7 @@ snap = int(sys.argv[1])
# Read the simulation data
sim
=
h5py
.
File
(
"noh_%0
3
d.hdf5"
%
snap
,
"r"
)
sim
=
h5py
.
File
(
"noh_%0
4
d.hdf5"
%
snap
,
"r"
)
boxSize
=
sim
[
"/Header"
].
attrs
[
"BoxSize"
][
0
]
time
=
sim
[
"/Header"
].
attrs
[
"Time"
][
0
]
scheme
=
sim
[
"/HydroScheme"
].
attrs
[
"Scheme"
]
...
...
examples/Noh_2D/plotSolution.py
View file @
5e2482a0
...
...
@@ -58,7 +58,7 @@ rc('font',**{'family':'sans-serif','sans-serif':['Times']})
snap
=
int
(
sys
.
argv
[
1
])
# Read the simulation data
sim
=
h5py
.
File
(
"noh_%0
3
d.hdf5"
%
snap
,
"r"
)
sim
=
h5py
.
File
(
"noh_%0
4
d.hdf5"
%
snap
,
"r"
)
boxSize
=
sim
[
"/Header"
].
attrs
[
"BoxSize"
][
0
]
time
=
sim
[
"/Header"
].
attrs
[
"Time"
][
0
]
scheme
=
sim
[
"/HydroScheme"
].
attrs
[
"Scheme"
]
...
...
examples/Noh_3D/plotSolution.py
View file @
5e2482a0
...
...
@@ -59,7 +59,7 @@ snap = int(sys.argv[1])
# Read the simulation data
sim
=
h5py
.
File
(
"noh_%0
3
d.hdf5"
%
snap
,
"r"
)
sim
=
h5py
.
File
(
"noh_%0
4
d.hdf5"
%
snap
,
"r"
)
boxSize
=
sim
[
"/Header"
].
attrs
[
"BoxSize"
][
0
]
time
=
sim
[
"/Header"
].
attrs
[
"Time"
][
0
]
scheme
=
sim
[
"/HydroScheme"
].
attrs
[
"Scheme"
]
...
...
examples/SedovBlast_1D/plotSolution.py
View file @
5e2482a0
...
...
@@ -64,7 +64,7 @@ snap = int(sys.argv[1])
# Read the simulation data
sim
=
h5py
.
File
(
"sedov_%0
3
d.hdf5"
%
snap
,
"r"
)
sim
=
h5py
.
File
(
"sedov_%0
4
d.hdf5"
%
snap
,
"r"
)
boxSize
=
sim
[
"/Header"
].
attrs
[
"BoxSize"
][
0
]
time
=
sim
[
"/Header"
].
attrs
[
"Time"
][
0
]
scheme
=
sim
[
"/HydroScheme"
].
attrs
[
"Scheme"
]
...
...
examples/SedovBlast_2D/plotSolution.py
View file @
5e2482a0
...
...
@@ -65,7 +65,7 @@ snap = int(sys.argv[1])
# Read the simulation data
sim
=
h5py
.
File
(
"sedov_%0
3
d.hdf5"
%
snap
,
"r"
)
sim
=
h5py
.
File
(
"sedov_%0
4
d.hdf5"
%
snap
,
"r"
)
boxSize
=
sim
[
"/Header"
].
attrs
[
"BoxSize"
][
0
]
time
=
sim
[
"/Header"
].
attrs
[
"Time"
][
0
]
scheme
=
sim
[
"/HydroScheme"
].
attrs
[
"Scheme"
]
...
...
examples/SedovBlast_3D/plotSolution.py
View file @
5e2482a0
...
...
@@ -65,7 +65,7 @@ snap = int(sys.argv[1])
# Read the simulation data
sim
=
h5py
.
File
(
"sedov_%0
3
d.hdf5"
%
snap
,
"r"
)
sim
=
h5py
.
File
(
"sedov_%0
4
d.hdf5"
%
snap
,
"r"
)
boxSize
=
sim
[
"/Header"
].
attrs
[
"BoxSize"
][
0
]
time
=
sim
[
"/Header"
].
attrs
[
"Time"
][
0
]
scheme
=
sim
[
"/HydroScheme"
].
attrs
[
"Scheme"
]
...
...
examples/SodShock_1D/plotSolution.py
View file @
5e2482a0
...
...
@@ -67,7 +67,7 @@ snap = int(sys.argv[1])
# Read the simulation data
sim
=
h5py
.
File
(
"sodShock_%0
3
d.hdf5"
%
snap
,
"r"
)
sim
=
h5py
.
File
(
"sodShock_%0
4
d.hdf5"
%
snap
,
"r"
)
boxSize
=
sim
[
"/Header"
].
attrs
[
"BoxSize"
][
0
]
time
=
sim
[
"/Header"
].
attrs
[
"Time"
][
0
]
scheme
=
sim
[
"/HydroScheme"
].
attrs
[
"Scheme"
]
...
...
examples/SodShock_2D/plotSolution.py
View file @
5e2482a0
...
...
@@ -68,7 +68,7 @@ snap = int(sys.argv[1])
# Read the simulation data
sim
=
h5py
.
File
(
"sodShock_%0
3
d.hdf5"
%
snap
,
"r"
)
sim
=
h5py
.
File
(
"sodShock_%0
4
d.hdf5"
%
snap
,
"r"
)
boxSize
=
sim
[
"/Header"
].
attrs
[
"BoxSize"
][
0
]
time
=
sim
[
"/Header"
].
attrs
[
"Time"
][
0
]
scheme
=
sim
[
"/HydroScheme"
].
attrs
[
"Scheme"
]
...
...
examples/SodShock_3D/plotSolution.py
View file @
5e2482a0
...
...
@@ -68,7 +68,7 @@ snap = int(sys.argv[1])
# Read the simulation data
sim
=
h5py
.
File
(
"sodShock_%0
3
d.hdf5"
%
snap
,
"r"
)
sim
=
h5py
.
File
(
"sodShock_%0
4
d.hdf5"
%
snap
,
"r"
)
boxSize
=
sim
[
"/Header"
].
attrs
[
"BoxSize"
][
0
]
time
=
sim
[
"/Header"
].
attrs
[
"Time"
][
0
]
scheme
=
sim
[
"/HydroScheme"
].
attrs
[
"Scheme"
]
...
...
examples/SquareTest_2D/plotSolution.py
View file @
5e2482a0
...
...
@@ -63,7 +63,7 @@ rc('font',**{'family':'sans-serif','sans-serif':['Times']})
snap
=
int
(
sys
.
argv
[
1
])
# Read the simulation data
sim
=
h5py
.
File
(
"square_%0
3
d.hdf5"
%
snap
,
"r"
)
sim
=
h5py
.
File
(
"square_%0
4
d.hdf5"
%
snap
,
"r"
)
boxSize
=
sim
[
"/Header"
].
attrs
[
"BoxSize"
][
0
]
time
=
sim
[
"/Header"
].
attrs
[
"Time"
][
0
]
scheme
=
sim
[
"/HydroScheme"
].
attrs
[
"Scheme"
]
...
...
examples/main.c
View file @
5e2482a0
...
...
@@ -27,6 +27,7 @@
/* Some standard headers. */
#include <fenv.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
...
...
@@ -633,6 +634,21 @@ int main(int argc, char *argv[]) {
/* Initialise the particles */
engine_init_particles
(
&
e
,
flag_entropy_ICs
,
clean_h_values
);
/* Check if output directory exists */
char
dir
[
200
];
int
test
;
/* get output directory */
strcpy
(
dir
,
e
.
snapshotBaseName
);
dirname
(
dir
);
/* test if directory is current directory and update name if yes */
test
=
strchr
(
e
.
snapshotBaseName
,
'/'
)
==
NULL
;
if
(
test
)
strcpy
(
dir
,
"./"
);
/* Check if user has write permission */
test
=
access
(
dir
,
W_OK
);
if
(
-
1
==
test
)
error
(
"Directory %s does not exist or you do not have write permission"
,
dir
);
/* Write the state of the system before starting time integration. */
engine_dump_snapshot
(
&
e
);
...
...
src/parallel_io.c
View file @
5e2482a0
...
...
@@ -667,7 +667,7 @@ void write_output_parallel(struct engine* e, const char* baseName,
/* File name */
char
fileName
[
FILENAME_BUFFER_SIZE
];
snprintf
(
fileName
,
FILENAME_BUFFER_SIZE
,
"%s_%0
3
i.hdf5"
,
baseName
,
snprintf
(
fileName
,
FILENAME_BUFFER_SIZE
,
"%s_%0
4
i.hdf5"
,
baseName
,
outputCount
);
/* First time, we need to create the XMF file */
...
...
src/serial_io.c
View file @
5e2482a0
...
...
@@ -738,7 +738,7 @@ void write_output_serial(struct engine* e, const char* baseName,
/* File name */
char
fileName
[
FILENAME_BUFFER_SIZE
];
snprintf
(
fileName
,
FILENAME_BUFFER_SIZE
,
"%s_%0
3
i.hdf5"
,
baseName
,
snprintf
(
fileName
,
FILENAME_BUFFER_SIZE
,
"%s_%0
4
i.hdf5"
,
baseName
,
outputCount
);
/* Compute offset in the file and total number of particles */
...
...
src/single_io.c
View file @
5e2482a0
...
...
@@ -606,7 +606,7 @@ void write_output_single(struct engine* e, const char* baseName,
/* File name */
char
fileName
[
FILENAME_BUFFER_SIZE
];
snprintf
(
fileName
,
FILENAME_BUFFER_SIZE
,
"%s_%0
3
i.hdf5"
,
baseName
,
snprintf
(
fileName
,
FILENAME_BUFFER_SIZE
,
"%s_%0
4
i.hdf5"
,
baseName
,
outputCount
);
/* First time, we need to create the XMF file */
...
...
src/xmf.c
View file @
5e2482a0
...
...
@@ -135,7 +135,7 @@ void xmf_write_outputfooter(FILE* xmfFile, int output, float time) {
/* Write end of the section of this time step */
fprintf
(
xmfFile
,
"
\n
</Grid> <!-- End of meta-data for output=%0
3
i, time=%f -->
\n
"
,
"
\n
</Grid> <!-- End of meta-data for output=%0
4
i, time=%f -->
\n
"
,
output
,
time
);
fprintf
(
xmfFile
,
"
\n
</Grid> <!-- timeSeries -->
\n
"
);
fprintf
(
xmfFile
,
"</Domain>
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment