diff --git a/examples/AgoraDisk/change_h.py b/examples/AgoraDisk/change_h.py new file mode 100644 index 0000000000000000000000000000000000000000..fcaaa25446123f7336e395da5efaab3a975c52f7 --- /dev/null +++ b/examples/AgoraDisk/change_h.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python + +# ./translate_particles.py filename +from h5py import File +import sys + +NPartType = 1 +f = File(sys.argv[-1]) + +for i in range(NPartType): + name = "PartType%i" % i + if name not in f: + continue + + grp = f[name + "/SmoothingLength"] + grp[:] *= 1.823 + +f.close() diff --git a/examples/AgoraDisk/getIC.sh b/examples/AgoraDisk/getIC.sh index ec06c6f5613c497b74d9ed8dcdb7df71d1973f7e..35f8770cd62eba0f501c1d7457afda6ec929f9ba 100644 --- a/examples/AgoraDisk/getIC.sh +++ b/examples/AgoraDisk/getIC.sh @@ -6,4 +6,4 @@ if [ "$#" -ne 1 ]; then exit fi -wget https://obswww.unige.ch/~lhausamm/swift/IC/@1.hdf5 +wget https://obswww.unige.ch/~lhausamm/swift/IC/AgoraDisk/@1.hdf5 diff --git a/examples/AgoraDisk/getSolution.sh b/examples/AgoraDisk/getSolution.sh new file mode 100644 index 0000000000000000000000000000000000000000..d8e990a8ea3a8e31ff64e7b3aa104ba27300ee6c --- /dev/null +++ b/examples/AgoraDisk/getSolution.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +wget https://obswww.unige.ch/~lhausamm/swift/IC/AgoraDisk/Gear/snapshot_0000 +wget https://obswww.unige.ch/~lhausamm/swift/IC/AgoraDisk/Gear/snapshot_0500 + diff --git a/examples/AgoraDisk/plot_solution.py b/examples/AgoraDisk/plot_solution.py index b54ca2d46d0e55823616c12bcbf8c64765006d25..56fd41fe2c9693f7814571fd64d3d377cbb40d4d 100644 --- a/examples/AgoraDisk/plot_solution.py +++ b/examples/AgoraDisk/plot_solution.py @@ -9,7 +9,7 @@ # yield incorrect results. # ####################################################################### -# This script is a copy of the AGORA project (give link) +# This script is a copy of the AGORA project (https://bitbucket.org/mornkr/agora-analysis-script/) # modified in order to take into account SWIFT import matplotlib matplotlib.use('Agg') @@ -64,8 +64,8 @@ dataset_num = 2 # 1/2 = 1st dataset(Gra yt_version_pre_3_2_3 = 0 # 0/1 = NO/YES to "Is the yt version being used pre yt-dev-3.2.3?" times = [0, 500] # in Myr figure_width = 30 # in kpc -n_ref = 32 # for SPH codes -over_refine_factor = 1 # for SPH codes +n_ref = 8 # for SPH codes +over_refine_factor = 2 # for SPH codes aperture_size_SFR_map = 750 # in pc = Used if draw_SFR_map = 1, 750 matches Bigiel et al. (2008) young_star_cutoff_SFR_map = 20 # in Myr = Used if draw_SFR_map = 1 young_star_cutoff_star_radius_DF = 20 # in Myr = Used if draw_star_radius_DF = 1 @@ -105,10 +105,15 @@ marker_names = ['s', 'o', 'p', 'v', '^', '<', '>', 'h', '*'] # [file_location[1]+'GADGET-3/AGORA_ISO_LOW_SF_SNII_Thermal_Chevalier_SFT10/snap_iso_sf_000.hdf5', file_location[1]+'GADGET-3/AGORA_ISO_LOW_SF_SNII_Thermal_Chevalier_SFT10/snap_iso_sf_010.hdf5'], # [file_location[1]+'GEAR/snapshot_0000', file_location[1]+'GEAR/snapshot_0500'], # [file_location[1]+'GIZMO/snapshot_temp_000', file_location[1]+'GIZMO/snapshot_temp_100']]] - -codes = ["SWIFT"] -filenames = [[["../agora_disk_0000.hdf5", "../agora_disk_0000.hdf5"]], - [["../agora_disk_0000.hdf5", "../agora_disk_0000.hdf5"]]] +codes = ['SWIFT', 'GEAR'] +filenames = [[["./agora_disk_0000.hdf5", "./agora_disk_0050.hdf5"], + ["./snapshot_0000", "./snapshot_0500"]], + [["./agora_disk_0000.hdf5", "./agora_disk_0050.hdf5"], + ["./snapshot_0000", "./snapshot_0500"]]] + +# codes = ["SWIFT"] +# filenames = [[["./agora_disk_0000.hdf5", "./agora_disk_0050.hdf5"]], +# [["./agora_disk_0000.hdf5", "./agora_disk_0050.hdf5"]]] # codes = ['ART-I'] # filenames = [[[file_location[0]+'ART-I/IC/AGORA_Galaxy_LOW.d', file_location[0]+'ART-I/t0.5Gyr/10MpcBox_csf512_02350.d']], # [[file_location[1]+'ART-I/IC/AGORA_Galaxy_LOW.d', file_location[1]+'ART-I/t0.5Gyr/10MpcBox_csf512_02350.d']]] @@ -131,8 +136,8 @@ filenames = [[["../agora_disk_0000.hdf5", "../agora_disk_0000.hdf5"]], # filenames = [[[file_location[0]+'GADGET-3/AGORA_ISO_LOW_DRY/snap_iso_dry_000.hdf5', file_location[0]+'GADGET-3/AGORA_ISO_LOW_DRY/snap_iso_dry_010.hdf5']], # [[file_location[1]+'GADGET-3/AGORA_ISO_LOW_SF_SNII_Thermal_Chevalier_SFT10/snap_iso_sf_000.hdf5', file_location[1]+'GADGET-3/AGORA_ISO_LOW_SF_SNII_Thermal_Chevalier_SFT10/snap_iso_sf_010.hdf5']]] # codes = ['GEAR'] -# filenames = [[[file_location[0]+'GEAR/snapshot_0000', file_location[0]+'GEAR/snapshot_0500']], -# [[file_location[1]+'GEAR/snapshot_0000', file_location[1]+'GEAR/snapshot_0500']]] +# filenames = [[['snapshot_0000', 'snapshot_0500']], +# [['snapshot_0000', 'snapshot_0500']]] # codes = ['GIZMO'] # filenames = [[[file_location[0]+'GIZMO/snapshot_temp_000', file_location[0]+'GIZMO/snapshot_temp_100']], # [[file_location[1]+'GIZMO/snapshot_temp_000', file_location[1]+'GIZMO/snapshot_temp_100']]] @@ -485,9 +490,9 @@ for time in range(len(times)): PartType_StarBeforeFiltered_to_use = "PartType4" MassType_to_use = "Masses" elif codes[code] == "SWIFT": - PartType_Gas_to_use = "PartType0" - PartType_Star_to_use = "PartType4" - PartType_StarBeforeFiltered_to_use = "PartType4" + PartType_Gas_to_use = "PartType0" + PartType_Star_to_use = "PartType2" + PartType_StarBeforeFiltered_to_use = "PartType2" MassType_to_use = "Masses" elif codes[code] == 'RAMSES': PartType_StarBeforeFiltered_to_use = "all" diff --git a/examples/AgoraDisk/run.sh b/examples/AgoraDisk/run.sh index f7e33443aa4fcd2f2116ede4c69ab18194621d57..269f4a692d38c3ea53e2644c4d901dc686986961 100644 --- a/examples/AgoraDisk/run.sh +++ b/examples/AgoraDisk/run.sh @@ -20,5 +20,15 @@ cp $1.hdf5 agora_disk.hdf5 # Run SWIFT ../swift -s -G -t 8 agora_disk.yml 2>&1 | tee output.log -# Plot the solution -# python plotSolution.py 5 +echo "Changing smoothing length to be Gadget compatible" +./change_h.py agora_disk_0000.hdf5 +./change_h.py agora_disk_0050.hdf5 + +if [ ! -e snapshot_0000 ] || [ ! -e snapshot_0500 ] +then + echo "Fetching Gear solution..." + ./getSolution.sh +fi + +echo "Plotting..." +./plot_solution.py