From fc42f85d6a462d572ada080e6c6c97f33212c9f4 Mon Sep 17 00:00:00 2001 From: Knights-Templars Date: Mon, 9 Oct 2023 11:11:22 -0400 Subject: [PATCH 1/3] Added a function to calculate shell masses --- tardis/energy_input/gamma_ray_transport.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tardis/energy_input/gamma_ray_transport.py b/tardis/energy_input/gamma_ray_transport.py index e89098e8ca6..24b7c44cd7e 100644 --- a/tardis/energy_input/gamma_ray_transport.py +++ b/tardis/energy_input/gamma_ray_transport.py @@ -260,6 +260,28 @@ def initialize_packets( ) +def calculate_shell_masses(model): + + """Function to calculate shell masses + Parameters + ---------- + model : tardis.Radial1DModel + The tardis model to calculate gamma ray propagation through + Returns + ------- + numpy.ndarray + shell masses in units of g + + """ + outer_velocities = model.v_outer.to("cm/s").value + inner_velocities = model.v_inner.to("cm/s").value + ejecta_density = model.density.to("g/cm^3").value + ejecta_volume = model.volume.to("cm^3").value + shell_masses = ejecta_volume * ejecta_density + + return shell_masses + + def main_gamma_ray_loop( num_decays, model, From 52faa243c1d5865202d4edfda206d1c3ccc08229 Mon Sep 17 00:00:00 2001 From: Knights-Templars Date: Mon, 9 Oct 2023 14:25:46 -0400 Subject: [PATCH 2/3] Added a function to calculate shell masses --- tardis/energy_input/gamma_ray_transport.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tardis/energy_input/gamma_ray_transport.py b/tardis/energy_input/gamma_ray_transport.py index 24b7c44cd7e..33c88e0dfa0 100644 --- a/tardis/energy_input/gamma_ray_transport.py +++ b/tardis/energy_input/gamma_ray_transport.py @@ -273,8 +273,7 @@ def calculate_shell_masses(model): shell masses in units of g """ - outer_velocities = model.v_outer.to("cm/s").value - inner_velocities = model.v_inner.to("cm/s").value + ejecta_density = model.density.to("g/cm^3").value ejecta_volume = model.volume.to("cm^3").value shell_masses = ejecta_volume * ejecta_density From d0e9e238c4e5e0383c6711aac5d0a1d7589763a1 Mon Sep 17 00:00:00 2001 From: Knights-Templars Date: Mon, 9 Oct 2023 14:28:33 -0400 Subject: [PATCH 3/3] changed shell masses with the new function --- tardis/energy_input/gamma_ray_transport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tardis/energy_input/gamma_ray_transport.py b/tardis/energy_input/gamma_ray_transport.py index 33c88e0dfa0..79f83d67c20 100644 --- a/tardis/energy_input/gamma_ray_transport.py +++ b/tardis/energy_input/gamma_ray_transport.py @@ -367,7 +367,7 @@ def main_gamma_ray_loop( by=["atomic_number", "mass_number"], ascending=False ) - shell_masses = ejecta_volume * ejecta_density + shell_masses = calculate_shell_masses(model) time_start = time_explosion time_end *= u.d.to(u.s)