Skip to content

Commit 4f386ef

Browse files
Fix GEAR pressure floor
1 parent 23b10e5 commit 4f386ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+763
-777
lines changed

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ doc/html/
2626
doc/latex/
2727
doc/man/
2828
doc/Doxyfile
29+
doc/RTD/source/SubgridModels/*/*.png
30+
doc/RTD/source/RadiativeTransfer/full_dependency_graph_RT.png
2931

3032
examples/*/*/*.xmf
3133
examples/*/*/*.dat
@@ -73,6 +75,14 @@ examples/SmallCosmoVolume/SmallCosmoVolume_cooling/snapshots/
7375
examples/SmallCosmoVolume/SmallCosmoVolume_hydro/snapshots/
7476
examples/SmallCosmoVolume/SmallCosmoVolume_cooling/CloudyData_UVB=HM2012.h5
7577
examples/SmallCosmoVolume/SmallCosmoVolume_cooling/CloudyData_UVB=HM2012_shielded.h5
78+
examples/GEAR/AgoraDisk/CloudyData_UVB=HM2012.h5
79+
examples/GEAR/AgoraDisk/CloudyData_UVB=HM2012_shielded.h5
80+
examples/GEAR/AgoraDisk/chemistry-AGB+OMgSFeZnSrYBaEu-16072013.h5
81+
examples/GEAR/AgoraCosmo/CloudyData_UVB=HM2012_shielded.h5
82+
examples/GEAR/AgoraCosmo/POPIIsw.h5
83+
examples/GEAR/ZoomIn/CloudyData_UVB=HM2012.h5
84+
examples/GEAR/ZoomIn/POPIIsw.h5
85+
examples/GEAR/ZoomIn/snap/
7686

7787
tests/testActivePair
7888
tests/testActivePair.sh
@@ -198,6 +208,10 @@ theory/SPH/Flavours/sph_flavours.pdf
198208
theory/SPH/EoS/eos.pdf
199209
theory/SPH/*.pdf
200210
theory/paper_pasc/pasc_paper.pdf
211+
theory/Multipoles/alpha_derivatives.pdf
212+
theory/Multipoles/alpha_powers.pdf
213+
theory/Multipoles/chi_derivatives.pdf
214+
theory/Multipoles/sigma_derivatives.pdf
201215
theory/Multipoles/fmm.pdf
202216
theory/Multipoles/fmm_standalone.pdf
203217
theory/Multipoles/potential.pdf

configure.ac

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2240,7 +2240,7 @@ fi
22402240
# chemistry function
22412241
AC_ARG_WITH([chemistry],
22422242
[AS_HELP_STRING([--with-chemistry=<function>],
2243-
[chemistry function @<:@none, GEAR_*, GEAR_DIFFUSION_*, QLA, EAGLE default: none@:>@
2243+
[chemistry function @<:@none, GEAR_*, QLA, EAGLE default: none@:>@
22442244
For GEAR, you need to provide the number of elements (e.g. GEAR_10)]
22452245
)],
22462246
[with_chemistry="$withval"],
@@ -2260,13 +2260,6 @@ case "$with_chemistry" in
22602260
none)
22612261
AC_DEFINE([CHEMISTRY_NONE], [1], [No chemistry function])
22622262
;;
2263-
GEAR_DIFFUSION_*)
2264-
AC_DEFINE([CHEMISTRY_GEAR_DIFFUSION], [1], [Chemistry taken from the GEAR model including the metal diffusion])
2265-
number_element=${with_chemistry##*_}
2266-
AC_DEFINE_UNQUOTED([GEAR_CHEMISTRY_ELEMENT_COUNT], [$number_element], [Number of element to follow])
2267-
with_chemistry_name="GEAR (with $number_element elements and diffusion)"
2268-
with_chemistry="GEAR_DIFFUSION"
2269-
;;
22702263
GEAR_*)
22712264
AC_DEFINE([CHEMISTRY_GEAR], [1], [Chemistry taken from the GEAR model])
22722265
number_element=${with_chemistry#*_}

examples/Cooling/CoolingRates/cooling_rates.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,9 @@ int main(int argc, char **argv) {
226226
// Init cosmology
227227
cosmology_init(params, &us, &internal_const, &cosmo);
228228

229+
// Init pressure floor
230+
struct pressure_floor_props pressure_floor;
231+
229232
// Set redshift and associated quantities
230233
const float scale_factor = 1.0 / (1.0 + redshift);
231234
integertime_t ti_current =
@@ -237,7 +240,7 @@ int main(int argc, char **argv) {
237240
cooling_init(params, &us, &internal_const, &hydro_properties, &cooling);
238241
cooling.H_reion_done = 1;
239242
cooling_print(&cooling);
240-
cooling_update(&cosmo, &cooling, &s);
243+
cooling_update(&cosmo, &pressure_floor, &cooling, &s);
241244

242245
// Copy over the raw metals into the smoothed metals
243246
memcpy(&p.chemistry_data.smoothed_metal_mass_fraction,
@@ -323,7 +326,9 @@ int main(int argc, char **argv) {
323326
unsigned long long cpufreq = 0;
324327
clocks_set_cpufreq(cpufreq);
325328

326-
message("This test is only defined for the EAGLE cooling model.");
329+
message(
330+
"This test is only defined for the EAGLE cooling model and with Gadget-2 "
331+
"SPH.");
327332
return 0;
328333
}
329334
#endif

examples/GEAR/AgoraCosmo/README

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ We will use SWIFT to cancel the h- and a-factors from the ICs.
77
The IC consists in a halo evolving to a virial mass of ∼ 1e12 Msun at z = 0 with a relatively
88
quiescent merger history between z = 2 and 0. The cosmological parameters are taken from WMAP7/9+SNe+BAO.
99
The target halo contains the highest-resolution dark matter particles particles of masses = 2.8e5 Msun.
10+
11+
To run this example, SWIFT must be configured with the following options:
12+
13+
./configure --with-chemistry=GEAR_10 --with-cooling=grackle_0 --with-pressure-floor=GEAR --with-stars=GEAR --with-star-formation=GEAR --with-feedback=GEAR

examples/GEAR/AgoraCosmo/agora_cosmo.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,19 @@ GEARStarFormation:
9393
maximal_temperature: 3e4 # Upper limit to the temperature of a star forming particle
9494
n_stars_per_particle: 1
9595
min_mass_frac: 0.5
96+
density_threashold: 1e-30 # Density threashold (in addition to the pressure floor) in g/cm3
9697

9798
GEARPressureFloor:
9899
jeans_factor: 8.75
99100

100101
GEARFeedback:
101-
supernovae_energy_erg: 2.3e51
102-
yields_table: chemistry-AGB+OMgSFeZnSrYBaEu-16072013.h5
102+
supernovae_energy_erg: 1e51
103+
supernovae_efficiency: 2.3
104+
yields_table: POPIIsw.h5
103105
discrete_yields: 0
104-
yields_table_first_stars: chemistry-PopIII.hdf5 # Table containing the yields of the first stars.
106+
yields_table_first_stars: POPIIsw.h5 # Table containing the yields of the first stars.
105107
metallicity_max_first_stars: -1 # Maximal metallicity (in mass fraction) for a first star (-1 to deactivate).
106-
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).
108+
elements: [Fe, Mg, O, C, Al, Ca, Ba, Zn, 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).
107109

108110
GEARChemistry:
109111
initial_metallicity: 1e-4
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
wget http://virgodb.cosma.dur.ac.uk/swift-webstorage/FeedbackTables/POPIIsw.h5
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
wget http://virgodb.cosma.dur.ac.uk/swift-webstorage/CoolingTables/GEAR/CloudyData_UVB=HM2012_shielded.h5
4+
5+

examples/GEAR/AgoraCosmo/getIC.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
wget http://virgodb.cosma.dur.ac.uk/swift-webstorage/ICs/AgoraCosmo/agora_swift.hdf5
4+
5+

examples/GEAR/AgoraCosmo/run.sh

100644100755
Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
#!/bin/bash
22

3-
set -e
4-
5-
# MUSIC binary
6-
music=~/music/MUSIC
7-
if test -f $music; then
8-
echo "Using the following version of MUSIC $music."
9-
else
10-
echo "MUSIC is not found."
11-
exit
3+
# Get the initial conditions
4+
if [ ! -e agora_swift.hdf5 ]
5+
then
6+
echo "Fetching the initial conditions"
7+
./getIC.sh
128
fi
139

14-
# Grab the cooling and yield tables if they are not present.
10+
11+
# Get the Grackle cooling table
1512
if [ ! -e CloudyData_UVB=HM2012_shielded.h5 ]
1613
then
17-
echo "Fetching tables..."
18-
../getChemistryTable.sh
19-
../../Cooling/getGrackleCoolingTable.sh
14+
echo "Fetching the Cloudy tables required by Grackle..."
15+
./getGrackleCoolingTable.sh
16+
fi
17+
18+
19+
if [ ! -e POPIIsw.h5 ]
20+
then
21+
echo "Fetching the chemistry tables..."
22+
./getChemistryTable.sh
2023
fi
2124

22-
echo "Generating the initial conditions"
23-
$music music.conf
2425

25-
echo "Converting the initial conditions into a SWIFT compatible format"
26-
python3 convert_ic.py
2726

28-
echo "Running SWIFT"
27+
2928
../../../swift --cooling --feedback --cosmology --limiter --sync --self-gravity --hydro --stars --star-formation --threads=24 agora_cosmo.yml 2>&1 | tee output.log
29+
30+
31+

examples/GEAR/AgoraDisk/README

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
To run this example, SWIFT must be configured with the following options:
2+
3+
./configure --with-chemistry=GEAR_10 --with-cooling=grackle_0 --with-pressure-floor=GEAR --with-stars=GEAR --with-star-formation=GEAR --with-feedback=GEAR
4+
15
An analysis script for this test case can be found in the AGORA project repository:
26
https://bitbucket.org/mornkr/agora-analysis-script/
37

examples/GEAR/AgoraDisk/agora_disk.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ Scheduler:
2222
# Parameters governing the time integration
2323
TimeIntegration:
2424
time_begin: 0. # The starting time of the simulation (in internal units).
25-
time_end: 0.5 # The end time of the simulation (in internal units).
25+
time_end: 0.25 # The end time of the simulation (in internal units).
2626
dt_min: 1e-10 # The minimal time-step size of the simulation (in internal units).
2727
dt_max: 0.1 # The maximal time-step size of the simulation (in internal units).
2828
max_dt_RMS_factor: 0.25 # (Optional) Dimensionless factor for the maximal displacement allowed based on the RMS velocities.
2929

3030
# Parameters governing the snapshots
3131
Snapshots:
32-
basename: agora_disk # Common part of the name of output files
32+
basename: snapshot # Common part of the name of output files
3333
time_first: 0. # Time of the first output (in internal units)
3434
delta_time: 1e-2 # Time difference between consecutive outputs (in internal units)
3535
compression: 4
@@ -82,26 +82,28 @@ GrackleCooling:
8282
self_shielding_threshold_atom_per_cm3: 0.007 # Required only with GEAR's self shielding. Density threshold of the self shielding
8383
max_steps: 1000
8484
convergence_limit: 1e-2
85-
thermal_time_myr: 5
85+
thermal_time_myr: 0
8686

8787

8888
GEARStarFormation:
8989
star_formation_efficiency: 0.01 # star formation efficiency (c_*)
9090
maximal_temperature: 1e10 # Upper limit to the temperature of a star forming particle
9191
n_stars_per_particle: 1
9292
min_mass_frac: 0.5
93+
density_threashold: 1.67e-23 # Density threashold in g/cm3
94+
9395

9496
GEARPressureFloor:
9597
jeans_factor: 10
9698

9799
GEARFeedback:
98-
supernovae_efficiency: 1.0
99-
supernovae_energy_erg: 0.1e51
100-
yields_table: chemistry-AGB+OMgSFeZnSrYBaEu-16072013.h5
100+
supernovae_energy_erg: 1e51
101+
supernovae_efficiency: 0.1
102+
yields_table: POPIIsw.h5
101103
discrete_yields: 0
102-
yields_table_first_stars: chemistry-PopIII.hdf5 # Table containing the yields of the first stars.
103-
metallicity_max_first_stars: -1 # Maximal metallicity (in mass fraction) for a first star (-1 to deactivate).
104-
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).
104+
yields_table_first_stars: POPIIsw.h5 # Table containing the yields of the first stars.
105+
metallicity_max_first_stars: -5 # Maximal metallicity (in mass fraction) for a first star (-1 to deactivate).
106+
elements: [Fe, Mg, O, C, Al, Ca, Ba, Zn, 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).
105107

106108
GEARChemistry:
107109
initial_metallicity: 1

examples/GEAR/AgoraDisk/changeType.py

Lines changed: 0 additions & 91 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import h5py
2+
import numpy as np
3+
4+
expected_total_mass = 227413100.0
5+
6+
f = h5py.File("snapshot_0025.hdf5", "r")
7+
8+
# get the total stellar mass
9+
mass = f["StarsParticles/Masses"]
10+
total_mass = sum(mass) * 1e10
11+
12+
error = np.fabs((expected_total_mass - total_mass) / expected_total_mass)
13+
14+
if error < 0.01:
15+
print(48 * "!")
16+
print(r"Well done !")
17+
print(r"The stellar mass is %g Msol," % (total_mass))
18+
print(r"The expected stellar mass is %g Msol" % (expected_total_mass))
19+
print(r"This represents an error of %d %% !" % (100 * error))
20+
print(48 * "!")
21+
else:
22+
print(48 * "!")
23+
print(r"Too bad !")
24+
print(r"The stellar mass is %g Msol," % (total_mass))
25+
print(r"While the expected stellar mass is %g Msol" % (expected_total_mass))
26+
print(r"This represents an error of %d %% !" % (100 * error))
27+
print(r"This is beyond the requirements.")
28+
print(48 * "!")

0 commit comments

Comments
 (0)