Skip to content
Snippets Groups Projects
Commit e5e5737d authored by Loic Hausammann's avatar Loic Hausammann Committed by Matthieu Schaller
Browse files

Add agora

parent ec48bf02
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
wget http://virgodb.cosma.dur.ac.uk/swift-webstorage/CoolingTables/CloudyData_UVB=HM2012.h5 wget http://virgodb.cosma.dur.ac.uk/swift-webstorage/CoolingTables/CloudyData_UVB=HM2012.h5
wget https://obswww.unige.ch/~lhausamm/links/CloudyData_UVB=HM2012_shielded.h5
Initial conditions for the AGORA simulation presented in Roca-Fabrega et al. 2021.
The initial conditions are generated by MUSIC (and thus the path to the binary
should be set in run.sh). The initial conditions are generated for AREPO and
then converted into SWIFT compatible IC with a python script.
We will use SWIFT to cancel the h- and a-factors from the ICs.
The IC consists in a halo evolving to a virial mass of ∼ 1e12 Msun at z = 0 with a relatively
quiescent merger history between z = 2 and 0. The cosmological parameters are taken from WMAP7/9+SNe+BAO.
The target halo contains the highest-resolution dark matter particles particles of masses = 2.8e5 Msun.
# Define the system of units to use internally.
InternalUnitSystem:
UnitMass_in_cgs: 1.98841e43 # 10^10 M_sun in grams
UnitLength_in_cgs: 3.08567758e21 # kpc in centimeters
UnitVelocity_in_cgs: 1e5 # km/s in centimeters per second
UnitCurrent_in_cgs: 1 # Amperes
UnitTemp_in_cgs: 1 # Kelvin
Scheduler:
cell_extra_gparts: 100 # (Optional) Number of spare gparts per top-level allocated at rebuild time for on-the-fly creation.
# Parameters governing the time integration
TimeIntegration:
dt_min: 1e-16 # The minimal time-step size of the simulation (in internal units).
dt_max: 0.1 # The maximal time-step size of the simulation (in internal units).
max_dt_RMS_factor: 0.25 # (Optional) Dimensionless factor for the maximal displacement allowed based on the RMS velocities.
# Cosmological parameters
Cosmology:
h: 0.702 # Reduced Hubble constant
a_begin: 0.00990099 # Initial scale-factor of the simulation
a_end: 1.0 # Final scale factor of the simulation
Omega_m: 0.272 # Matter density parameter
Omega_lambda: 0.728 # Dark-energy density parameter
Omega_b: 0.0455 # Baryon density parameter
Omega_r: 0. # (Optional) Radiation density parameter
w_0: -1.0 # (Optional) Dark-energy equation-of-state parameter at z=0.
w_a: 0. # (Optional) Dark-energy equation-of-state time evolution parameter.
# Parameters governing the snapshots
Snapshots:
basename: agora_cosmo # Common part of the name of output files
time_first: 0. # Time of the first output (in internal units)
delta_time: 1e-2 # Time difference between consecutive outputs (in internal units)
compression: 4
output_list_on: 1 # (Optional) Enable the output list
output_list: output_list.txt # (Optional) File containing the output times (see documentation in "Parameter File" section)
# Parameters governing the conserved quantities statistics
Statistics:
scale_factor_first: 0.00990099
delta_time: 1.02 # Time between statistics output
# Parameters for the self-gravity scheme
Gravity:
eta: 0.025 # Constant dimensionless multiplier for time integration.
MAC: adaptive # Choice of mulitpole acceptance criterion: 'adaptive' OR 'geometric'.
epsilon_fmm: 0.001 # Tolerance parameter for the adaptive multipole acceptance criterion.
theta_cr: 0.7 # Opening angle for the purely gemoetric criterion.
comoving_DM_softening: 0.8 # Comoving softening length (in internal units).
max_physical_DM_softening: 0.08 # Physical softening length (in internal units).
comoving_baryon_softening: 0.8 # Comoving softening length (in internal units).
max_physical_baryon_softening: 0.08 # Physical softening length (in internal units).
softening_ratio_background: 0.0285714 # Fraction of the mean inter-particle separation to use as Plummer-equivalent softening for the background DM particles.
mesh_side_length: 128 # Number of cells along each axis for the periodic gravity mesh.
# Parameters for the hydrodynamics scheme
SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
minimal_temperature: 10. # Kelvin
h_min_ratio: 0.2 # (Optional) Minimal allowed smoothing length in units of the softening. Defaults to 0 if unspecified.
h_max: 100 # (Optional) Maximal allowed smoothing length in internal units. Defaults to FLT_MAX if unspecified.
# Parameters related to the initial conditions
InitialConditions:
file_name: agora_swift.hdf5 # The file to read
periodic: 1 # Non-periodic BCs
cleanup_h_factors: 1 # Remove the h-factors inherited from Gadget
shift: [0, 0, 0] # Centre the box
cleanup_velocity_factors: 1 # (Optional) Clean up the scale-factors used in the definition of the velocity variable in the ICs (e.g. in Gadget files).
cleanup_smoothing_lengths: 1 # (Optional) Clean the values of the smoothing lengths that are read in to remove stupid values. Set to 1 to activate.
# Cooling with Grackle 2.0
GrackleCooling:
cloudy_table: CloudyData_UVB=HM2012_shielded.h5 # Name of the Cloudy Table (available on the grackle bitbucket repository)
with_UV_background: 1 # Enable or not the UV background
redshift: -1 # Redshift to use (-1 means time based redshift)
with_metal_cooling: 1 # Enable or not the metal cooling
provide_volumetric_heating_rates: 0 # User provide volumetric heating rates
provide_specific_heating_rates: 0 # User provide specific heating rates
self_shielding_method: 0 # Grackle (<= 3) or Gear self shielding method
self_shielding_threshold_atom_per_cm3: 0.007 # Required only with GEAR's self shielding. Density threshold of the self shielding
max_steps: 1000
convergence_limit: 1e-2
thermal_time_myr: 5
GEARStarFormation:
star_formation_efficiency: 0.01 # star formation efficiency (c_*)
maximal_temperature: 3e4 # Upper limit to the temperature of a star forming particle
n_stars_per_particle: 1
min_mass_frac: 0.5
GEARPressureFloor:
jeans_factor: 8.75
GEARFeedback:
supernovae_energy_erg: 2.3e51
yields_table: chemistry-AGB+OMgSFeZnSrYBaEu-16072013.h5
discrete_yields: 0
yields_table_first_stars: chemistry-PopIII.hdf5 # Table containing the yields of the first stars.
metallicity_max_first_stars: -1 # Maximal metallicity (in mass fraction) for a first star (-1 to deactivate).
elements: [Fe, Mg, O, S, Zn, Sr, Y, Ba, Eu] # Elements to read in the yields table. The number of element should be one less than the number of elements (N) requested during the configuration (--with-chemistry=GEAR_N).
GEARChemistry:
initial_metallicity: 1e-4
scale_initial_metallicity: 1
Restarts:
delta_hours: 10 # (Optional) decimal hours between dumps of restart files.
#!/usr/env/python3
from h5py import File
import shutil
import numpy as np
import sys
from swiftsimio.visualisation.smoothing_length_generation import generate_smoothing_lengths
import time
from unyt import kpc
filename = "agora_arepo.hdf5"
output = "agora_swift.hdf5"
shutil.copy(filename, output)
with File(output, "a") as f:
f["Header"].attrs["Flag_Entropy_ICs"] = 0
npart = f["Header"].attrs["NumPart_ThisFile"]
mass = f["Header"].attrs["MassTable"]
box = f["Header"].attrs["BoxSize"]
T = f["Header"].attrs["suggested_gas_Tinit"]
# Create the units
f.create_group("Units")
print("Assuming defaults AREPO units")
u_l = 3.085678e21
u_m = 1.989e43
u_v = 1e5
u_t = u_l / u_v
f["Units"].attrs["Unit length in cgs (U_L)"] = u_l
f["Units"].attrs["Unit mass in cgs (U_M)"] = u_m
f["Units"].attrs["Unit time in cgs (U_t)"] = u_t
f["Units"].attrs["Unit current in cgs (U_I)"] = 1.
f["Units"].attrs["Unit temperature in cgs (U_T)"] = 1.
# Create the mass arrays
for i in range(len(npart)):
if npart[i] == 0:
continue
grp = f["PartType%i" % i]
if "Masses" in grp:
continue
masses = np.ones(npart[i]) * mass[i]
grp.create_dataset('Masses', data=masses, dtype='f')
# Create the smoothing lengths
pos = f["PartType0/Coordinates"][:] * kpc
h = generate_smoothing_lengths(pos, box * kpc, kernel_gamma=1.825742)
f["PartType0"].create_dataset("SmoothingLength", data=h.value, dtype="f")
# Deal with the internal energy
u = np.ones(h.shape) * -1 # We set it through the parameters => fill it with garbage
f["PartType0"].create_dataset("InternalEnergy", data=u, dtype="f")
################################################
## AGORA IC file for the 1e12q halo ############
################################################
[setup]
boxlength = 60
zstart = 100
levelmin = 7
levelmin_TF = 9
levelmax = 12
padding = 16 # try reduce it at your own risk
overlap = 4
baryons = yes # switch on for baryon runs
use_2LPT = no
use_LLA = no # AMR codes might want to enable this
#Ellipsoidal refinement region defined on unity cube
region = ellipsoid
region_ellipsoid_matrix[0] = 822.07, -86.84, -661.59
region_ellipsoid_matrix[1] = -86.84, 673.36, 243.17
region_ellipsoid_matrix[2] = -661.59, 243.17, 1295.95
region_ellipsoid_center = 0.527531, 0.522087, 0.449525
[cosmology]
Omega_m = 0.272
Omega_L = 0.728
Omega_b = 0.0455
H0 = 70.2
sigma_8 = 0.807
nspec = 0.961
transfer = eisenstein
#below are MUSIC defaults to initialize gas temperature for some codes
#YHe = 0.248 # primordial He abundance
#gamma = 1.6667 # adiabatic exponent (=5/3)
[random]
cubesize = 256
seed[8] = 95064
seed[9] = 31415
seed[10] = 27183
[poisson]
fft_fine = yes
accuracy = 1e-4
grad_order = 6
laplace_order = 6
[output]
## AREPO
format = arepo
filename = agora_arepo.hdf5
## GENERIC
#format = generic
#filename = debug.hdf5
## ENZO
#format = enzo
#filename = ic.enzo
##enzo_refine_region_fraction = 0.8
## GADGET-2
#format = gadget2
#filename = ics_gadget.dat
#gadget_spreadcoarse = yes
#gadget_write_conn = yes
##gadget_num_files = 8
##gadget_longids = no
##gadget_usekpc = no
##gadget_usemsol = no
##gadget_coarsetype = 5
## RAMSES
#ramses_nml = yes
#format = grafic2
#filename = ics_ramses
## TIPSY
#format = tipsy
#filename = ics_tipsy.dat
## ART
#format = art
#filename = ics_art.dat
##art_swap_endian = yes
##astep = ...
## CART
#format = cart
#filename = ics_cart.dat
\ No newline at end of file
# Scale Factor
0.02
0.025
0.03
0.035
0.04
0.045
0.05
0.055
0.06
0.0625
0.065
0.07
0.075
0.0769231
0.08
0.085
0.09
0.0909091
0.095
0.1
0.105
0.11
0.111111
0.115
0.12
0.125
0.13
0.135
0.14
0.142857
0.145
0.15
0.155
0.16
0.165
0.166667
0.17
0.175
0.18
0.185
0.19
0.195
0.2
0.205
0.21
0.215
0.22
0.225
0.23
0.235
0.24
0.245
0.25
0.255
0.26
0.265
0.27
0.275
0.28
0.285
0.285714
0.29
0.295
0.3
0.305
0.31
0.315
0.32
0.325
0.33
0.333333
0.335
0.34
0.345
0.35
0.355
0.36
0.365
0.37
0.375
0.38
0.385
0.39
0.395
0.4
0.405
0.41
0.415
0.42
0.425
0.43
0.435
0.44
0.445
0.45
0.455
0.46
0.465
0.47
0.475
0.48
0.485
0.49
0.495
0.5
0.505
0.51
0.515
0.52
0.525
0.53
0.535
0.54
0.545
0.55
0.555
0.56
0.565
0.57
0.571429
0.575
0.58
0.585
0.59
0.595
0.6
0.605
0.61
0.615
0.62
0.625
0.63
0.635
0.64
0.645
0.65
0.655
0.66
0.665
0.666667
0.67
0.675
0.68
0.685
0.69
0.695
0.7
0.705
0.71
0.715
0.72
0.725
0.73
0.735
0.74
0.745
0.75
0.755
0.76
0.765
0.77
0.775
0.78
0.785
0.79
0.795
0.8
0.805
0.81
0.815
0.82
0.825
0.83
0.835
0.84
0.845
0.85
0.855
0.86
0.865
0.87
0.875
0.88
0.885
0.89
0.895
0.9
0.905
0.91
0.915
0.92
0.925
0.93
0.935
0.94
0.945
0.95
0.955
0.96
0.965
0.97
0.975
0.98
0.985
0.99
0.995
1
#!/bin/bash
set -e
# MUSIC binary
music=~/music/MUSIC
if test -f $music; then
echo "Using the following version of MUSIC $music."
else
echo "MUSIC is not found."
exit
fi
# Grab the cooling and yield tables if they are not present.
if [ ! -e CloudyData_UVB=HM2012_shielded.h5 ]
then
echo "Fetching tables..."
../getChemistryTable.sh
../../Cooling/getGrackleCoolingTable.sh
fi
echo "Generating the initial conditions"
$music music.conf
echo "Converting the initial conditions into a SWIFT compatible format"
python3 convert_ic.py
echo "Running SWIFT"
../../swift --cooling --feedback --cosmology --limiter --sync --self-gravity --hydro --stars --star-formation --threads=24 agora_cosmo.yml 2>&1 | tee output.log
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment