1 of 44

VegasAfterglow: An Advanced Toolkit for Modeling GRB Afterglows

Yihan Wang, Connery Chen & Bing Zhang

Nevada Center for Astrophysics, UNLV

2 of 44

We developed a code

mainly for GRB afterglow

It supports:

-Arbitrary non-axisymmetric energy/Gamma/magnetization profiles

-Forward, Reverse shock and jet spreading

-Relativistic & Non-relativistic regimes

-Self-absorption

-Arbitrary energy injection

-Inverse compton process with Klein-Nishina correction

3 of 44

Apple M4 single core w/ clang 16.0.0

It’s ~50x faster than available good public GRB afterglow code

4 of 44

Jet

-energy profile

-Lorentz factor profile

-magnetization profile

-injection function

-spreading

Medium

-density profile

-microphysics parameters

 

Forward shock

-bulk Lorentz factor

-comoving B field

-down str # density

-shock width

Reverse shock

-bulk Lorentz factor

-comoving B field

-down str # density

-shock width

 

 

 

 

 

 

 

 

 

 

Observer

-viewing angle

-luminosity distance

-observing frequencies

Observations

-flux

-spectrum

Dynamics

Radiation

Geometry

GRB Afterglow

5 of 44

Urrutia + 2022

 

medium

 

 

jet

 

 

 

 

6 of 44

 

 

Chiang&Dermer 1999; Piran 1999;

Shock Dynamics

 

 

Zhang 2018

Huang et al. 1999, 2000

 

 

+ radiation

 

 

Pe’er 2012

Nava et al. 2013

+ pressure

+ adiabatic expansion

7 of 44

Shock Dynamics - Tophat Jet

 

coasting

deceleration

Newtonian

coasting

deceleration

Newtonian

 

 

 

8 of 44

Shock Dynamics – structured Jet

 

 

Gaussian Jet

Powerlaw Jet

9 of 44

Shock Dynamics – Energy injection

10 of 44

Shock Dynamics – Energy injection

 

acceleration

deceleration

Newtonian

acceleration

deceleration

Newtonian

injection ends

Gaussian Jet + spin down

11 of 44

Shock Dynamics – user defined Jet

Energy profile

 

Injection function

 

Initial Lorentz factor profile

 

Initial magnetization profile

 

All can be customized!

12 of 44

Shock Dynamics – user defined Jet

A random example

synchrotron X-ray emission

13 of 44

Shock Dynamics – Reverse shock

14 of 44

Shock Dynamics – Reverse shock

I

(unshocked medium)

II

(shocked medium)

III

(shocked ejecta)

IV

(unshocked ejecta)

DC

forward shock front

reverse shock front

 

 

 

 

Zhang&Kobayashi 2005

15 of 44

Shock Dynamics – Jet spreading

 

 

Tophat jet in ISM

jet break

Newtonian

 

 

 

 

16 of 44

Radiation: Synchrotron spectrum

mapping

 

 

 

 

 

 

 

 

17 of 44

Radiation: Synchrotron spectrum

mapping

 

 

18 of 44

slow cooling, weak absorption

slow cooling, medium absorption

fast cooling, weak absorption

fast cooling, medium absorption

strong absorption

Radiation: Synchrotron spectrum

19 of 44

Radiation: Synchrotron spectrum

20 of 44

LHAASO 2023

Radiation: Inverse Compton

MAGIC 2019

190114C

221009A

21 of 44

Radiation: Inverse Compton

Shock front

Up stream

Down stream

22 of 44

Radiation: Inverse Compton

electron distribution

photon spectrum

 

 

 

 

 

 

 

 

?

IC cooling

?

IC spectrum

23 of 44

Gao, Lei, Wu & Zhang 2013

 

electron distribution

photon spectrum

24 of 44

 

 

Radiation: Inverse Compton

electron distribution

photon spectrum

25 of 44

Radiation: Inverse Compton

electron distribution

IC spectrum

26 of 44

Radiation: Inverse Compton

Optical

RS electron

FS electron

RS photon

FS photon

27 of 44

Jet

-energy profile

-Lorentz factor profile

-magnetization profile

-injection function

-spreading

Medium

-density profile

-microphysics parameters

 

Forward shock

-bulk Lorentz factor

-comoving B field

-down str # density

-shock width

Reverse shock

-bulk Lorentz factor

-comoving B field

-down str # density

-shock width

 

 

 

 

 

 

 

 

 

 

Observer

-viewing angle

-luminosity distance

-observing frequencies

Observations

-flux

-spectrum

GRB Afterglow

28 of 44

Model level optimization

Algorithm/code level optimization

Black Magic

Apple M4 single core w/ clang 16.0.0

 

Gaussian jet/ISM

Synchrotron only

29 of 44

Zoom out

Model level optimization

30 of 44

 

 

Model level optimization

 

 

 

Grids that perform real calculations

interpolations

31 of 44

 

Off-axis Gaussian jet

Model level optimization

Converged grid size:

128x128x128 (without interpolations)

32x32x32 (with interpolations)

32 of 44

Algorithm level optimization

Ingredients (data)

Recipe (algorithm)

33 of 44

Algorithm level optimization

Data scale

# of operations

34 of 44

In seconds

In minutes

CPU

~ bytes

Cache

~ MB

RAM

~ GB

Algorithm level optimization

35 of 44

Black Magic

shock ODE

spectrum evaluation/interpolation

others

log

exp

pow

relative precision ~10-16

total CPU cost

36 of 44

Black Magic

37 of 44

Radiation: deep Newtonian regime in GW170817

 

LOS

tobs=1000 d

The shock dynamics of GW170817 after 1000 days is already in the deep Newtonian regime

38 of 44

Radiation: deep Newtonian regime in GW170817

 

 

 

cyclotron

synchrotron

 

 

 

 

 

39 of 44

 

 

pitch angle

viewing angle

First kind Bessel function

 

 

 

 

 

40 of 44

 

 

transition from synchrotron to cyclotron

 

41 of 44

Radiation: cyclotron cutoffs on GW170817

42 of 44

We developed a code

We call it VegasAfterglow

It supports:

-Arbitrary non-axisymmetric energy/Gamma/magnetization profiles

-Forward, Reverse shock and jet spreading

-Relativistic & Non-relativistic regimes

-Self-absorption

-Arbitrary energy injection

-Inverse compton with Klein-Nishina correction

43 of 44

Apple M4 single core w/ clang 16.0.0

It’s ~50x faster than available good public GRB afterglow code

44 of 44

Light curves in X-ray band

Fiducial GW170817

Narrower jet

Wider jet

Smaller viewing angle

Larger viewing angle