Skip to content

Commit

Permalink
use automated file lookup in pygrackle examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mabruzzo committed Oct 3, 2024
1 parent 832b8d1 commit 16bffd3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
8 changes: 5 additions & 3 deletions src/python/examples/cooling_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@

from pygrackle import \
chemistry_data, \
constants, \
evolve_constant_density, \
setup_fluid_container
from pygrackle.utilities.physical_constants import \
mass_hydrogen_cgs, \
sec_per_Myr, \
cm_per_mpc
from pygrackle.utilities.data_path import grackle_data_dir
from pygrackle.utilities.model_tests import \
get_model_set, \
model_test_format_version
Expand Down Expand Up @@ -62,8 +62,10 @@
my_chemistry.primordial_chemistry = 0
my_chemistry.metal_cooling = 1
my_chemistry.UVbackground = 1
my_chemistry.grackle_data_file = \
os.path.join(grackle_data_dir, "CloudyData_UVB=HM2012.h5")
my_chemistry.grackle_data_file = "CloudyData_UVB=HM2012.h5"
my_chemistry.grackle_data_file_options = constants.GR_DFOPT_MANAGED



density = 0.1 * mass_hydrogen_cgs # g /cm^3
temperature = 1e6 # K
Expand Down
6 changes: 3 additions & 3 deletions src/python/examples/cooling_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

from pygrackle import \
chemistry_data, \
constants, \
setup_fluid_container
from pygrackle.utilities.data_path import grackle_data_dir
from pygrackle.utilities.physical_constants import \
mass_hydrogen_cgs, \
sec_per_Myr, \
Expand Down Expand Up @@ -63,8 +63,8 @@
my_chemistry.UVbackground = 1
my_chemistry.self_shielding_method = 0
my_chemistry.H2_self_shielding = 0
my_chemistry.grackle_data_file = \
os.path.join(grackle_data_dir, "CloudyData_UVB=HM2012.h5")
my_chemistry.grackle_data_file = "CloudyData_UVB=HM2012.h5"
my_chemistry.grackle_data_file_options = constants.GR_DFOPT_MANAGED

my_chemistry.use_specific_heating_rate = 1
my_chemistry.use_volumetric_heating_rate = 1
Expand Down
6 changes: 3 additions & 3 deletions src/python/examples/freefall.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

from pygrackle import \
chemistry_data, \
constants, \
evolve_constant_density, \
evolve_freefall, \
setup_fluid_container
from pygrackle.utilities.physical_constants import \
mass_hydrogen_cgs, \
sec_per_Myr, \
cm_per_mpc
from pygrackle.utilities.data_path import grackle_data_dir
from pygrackle.utilities.model_tests import \
get_model_set, \
model_test_format_version
Expand Down Expand Up @@ -65,8 +65,8 @@
my_chemistry.CaseBRecombination = 1
my_chemistry.cie_cooling = 1
my_chemistry.h2_optical_depth_approximation = 1
my_chemistry.grackle_data_file = os.path.join(
grackle_data_dir, "cloudy_metals_2008_3D.h5")
my_chemistry.grackle_data_file = "cloudy_metals_2008_3D.h5"
my_chemistry.grackle_data_file_options = constants.GR_DFOPT_MANAGED

redshift = 0.

Expand Down
7 changes: 4 additions & 3 deletions src/python/examples/yt_grackle.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
import sys
import yt

from pygrackle import add_grackle_fields
from pygrackle.utilities.data_path import grackle_data_dir
from pygrackle import add_grackle_fields, constants
from pygrackle.utilities.model_tests import model_test_format_version

output_name = os.path.basename(__file__[:-3]) # strip off ".py"
Expand Down Expand Up @@ -45,9 +44,11 @@

ds = yt.load(ds_path)

grackle_data_file = os.path.join(grackle_data_dir, "CloudyData_UVB=HM2012.h5")
grackle_data_file = "CloudyData_UVB=HM2012.h5"
grackle_data_file_options = constants.GR_DFOPT_MANAGED

grackle_pars = {'grackle_data_file': grackle_data_file,
'grackle_data_file_options': grackle_data_file_options,
'UVbackground': 1,
'h2_on_dust': 1}

Expand Down

0 comments on commit 16bffd3

Please sign in to comment.