.. _temp_ev_one_zone_cooling: Temporal evolution, one zone, only cooling ========================================== Cooling only the newly injecting electrons ------------------------------------------ .. code:: ipython3 import warnings warnings.filterwarnings('ignore') .. code:: ipython3 import matplotlib.pyplot as plt import numpy as np .. code:: ipython3 import jetset print('tested on jetset',jetset.__version__) .. parsed-literal:: tested on jetset 1.2.2 This is a very preliminary documentation for the temporal evolution capabilities of jetset. Here we show how to create a a radiativeregion, and how to evolve the system in order to generate both particle spectra, SEDs, and lightcurves definition of the injected particle distributio,, and of the jet model for the radiative region .. code:: ipython3 from jetset.jet_model import Jet jet_model=Jet() .. code:: ipython3 from jetset.jet_emitters_factory import InjEmittersFactory q_inj=InjEmittersFactory().create_inj_emitters('pl',emitters_type='electrons',normalize=True) q_inj.parameters.gmin.val=10 q_inj.parameters.gmax.val=1E6 q_inj.parameters.p.val=2.3 jet_model.parameters.beam_obj.val=30 jet_model.parameters.B.val=0.2 jet_model.parameters.z_cosm.val=0.03 here we set some relevant parameters taht will be described in detail in the next version of the documentation .. code:: ipython3 inj_duration=5E5 #This is in seconds in the blob rest frame duration=inj_duration*2 T_esc_rad=2 #This is in units of R/c L_inj=1.0E40 #This is in erg/s T_SIZE=1E4 NUM_SET=200 Here, we instantiate the ``JetTimeEvol`` object, passing the radiative region jet model, and the injected particle class. ``only_radiation=True`` **will disable the accleration region, and only the radiative region will be used.** .. code:: ipython3 from jetset.jet_timedep import JetTimeEvol temp_ev=JetTimeEvol(jet_rad=jet_model,Q_inj=q_inj,inplace=True,only_radiation=True) **The IC cooling is switched off, as default, to make the process faster**. to switch on the IC cooling ``temp_ev_acc.IC_cooling='on'`` Now, we setup some relevant parameters .. code:: ipython3 temp_ev.rad_region.jet.nu_min=1E8 T_SIZE=np.int(T_SIZE) temp_ev.parameters.duration.val=duration temp_ev.parameters.TStart_Inj.val=0 temp_ev.parameters.TStop_Inj.val=inj_duration temp_ev.parameters.T_esc_rad.val=T_esc_rad temp_ev.parameters.Esc_Index_rad.val=0 temp_ev.parameters.t_size.val=T_SIZE temp_ev.parameters.num_samples.val=NUM_SET temp_ev.parameters.L_inj.val=L_inj temp_ev.parameters.gmin_grid.val=1.0 temp_ev.parameters.gmax_grid.val=1E8 temp_ev.parameters.gamma_grid_size.val=1500 temp_ev.init_TempEv() temp_ev.show_model() .. parsed-literal:: -------------------------------------------------------------------------------- JetTimeEvol model description -------------------------------------------------------------------------------- physical setup: -------------------------------------------------------------------------------- .. raw:: html Table length=12
namepar typevalunitsval*units*log
delta ttime1.000000e+02s0.0005995849159999999R/cFalse
log. samplingtime0.000000e+00NoneFalse
R/ctime1.667820e+05s1.0R/cFalse
IC coolingoffNoneFalse
Sync coolingonNoneFalse
Adiab. coolingonNoneFalse
Reg. expansionoffNoneFalse
Tesc radtime3.335641e+05s2.0R/cFalse
R_rad rad startregion_position5.000000e+15cmNoneFalse
R_H rad startregion_position1.000000e+17cmNoneFalse
T min. synch. cooling1.934500e+02sNoneFalse
L inj (electrons)injected lum.1.000000e+40erg/sNoneFalse
.. parsed-literal:: model parameters: -------------------------------------------------------------------------------- .. raw:: html Table length=17
model namenamepar typeunitsvalphys. bound. minphys. bound. maxlogfrozen
jet_time_evdurationtime_grids1.000000e+060.000000e+00--FalseTrue
jet_time_evgmin_gridgamma_grid1.000000e+000.000000e+00--FalseTrue
jet_time_evgmax_gridgamma_grid1.000000e+080.000000e+00--FalseTrue
jet_time_evgamma_grid_sizegamma_grid1.500000e+030.000000e+00--FalseTrue
jet_time_evTStart_Injtime_grids0.000000e+000.000000e+00--FalseTrue
jet_time_evTStop_Injtime_grids5.000000e+050.000000e+00--FalseTrue
jet_time_evT_esc_radescape_time(R/c)*2.000000e+00----FalseTrue
jet_time_evEsc_Index_radfp_coeff_index0.000000e+00----FalseTrue
jet_time_evR_rad_startregion_sizecm5.000000e+150.000000e+00--FalseTrue
jet_time_evR_H_rad_startregion_positioncm1.000000e+170.000000e+00--FalseTrue
jet_time_evm_Bmagnetic_field_index1.000000e+001.000000e+002.000000e+00FalseTrue
jet_time_evt_jet_expexp_start_times1.000000e+050.000000e+00--FalseTrue
jet_time_evbeta_exp_Rbeta_expansionv/c*1.000000e+000.000000e+001.000000e+00FalseTrue
jet_time_evB_radmagnetic_fieldG2.000000e-010.000000e+00--FalseTrue
jet_time_evt_sizetime_grid1.000000e+040.000000e+00--FalseTrue
jet_time_evnum_samplestime_ev_output2.000000e+020.000000e+00--FalseTrue
jet_time_evL_injinj_luminosityerg / s1.000000e+400.000000e+00--FalseTrue
.. code:: ipython3 temp_ev.plot_time_profile() .. parsed-literal:: .. image:: Temp_Ev_one_zone_only_cooling_files/Temp_Ev_one_zone_only_cooling_17_1.png .. code:: ipython3 p=temp_ev.plot_pre_run_plot(dpi=100) .. image:: Temp_Ev_one_zone_only_cooling_files/Temp_Ev_one_zone_only_cooling_18_0.png setting ``cache_SEDs_rad=True`` will generate and cache all the SED at any time of the ``NUM_SET``. **This will increase the computational time during the run. Anyhow, will speed up the computation of SEDs and light curves. Moreover, these SEDs will be saved in the model, and read if you will reload the model in the future**. .. code:: ipython3 only_injection=True do_injection=True eval_cross_time=False rest_frame='obs' temp_ev.run(only_injection=only_injection, do_injection=do_injection, cache_SEDs_rad=True) .. parsed-literal:: temporal evolution running .. parsed-literal:: 0%| | 0/10000 [00:00Table length=344
timefluxR_blobt_blob
serg / (cm2 s)cms
float64float64float64float64
0.01.0025312073439857e-185000000000000000.00.0
100.02.721071237898974e-155000000000000000.02912.6213592233007
200.05.441139944590604e-155000000000000000.05825.242718446601
300.08.161208651282235e-155000000000000000.08737.864077669903
400.01.2857452255742743e-145000000000000000.011650.485436893203
500.01.9064888429085333e-145000000000000000.014563.106796116504
600.02.6938015030327216e-145000000000000000.017475.728155339806
700.03.53370922516786e-145000000000000000.020388.349514563106
800.04.524420360115135e-145000000000000000.023300.970873786406
............
33400.02.7653273627251138e-145000000000000000.0972815.5339805826
33500.02.6951267478504774e-145000000000000000.0975728.1553398059
33600.02.627278245468649e-145000000000000000.0978640.7766990291
33700.02.56102578769332e-145000000000000000.0981553.3980582524
33800.02.4961698689486774e-145000000000000000.0984466.0194174757
33900.02.4336458732562352e-145000000000000000.0987378.6407766991
34000.02.3719178229843572e-145000000000000000.0990291.2621359223
34100.02.3126418451267855e-145000000000000000.0993203.8834951456
34200.02.2543527909109737e-145000000000000000.0996116.5048543689
34300.02.197651396466689e-145000000000000000.0999029.1262135921
.. code:: ipython3 plt.plot(lg['time'],lg['flux']) plt.xlabel('time (%s)'%lg['time'].unit) plt.ylabel('flux (%s)'%lg['flux'].unit) .. parsed-literal:: Text(0, 0.5, 'flux (erg / (cm2 s))') .. image:: Temp_Ev_one_zone_only_cooling_files/Temp_Ev_one_zone_only_cooling_28_1.png We generate a lightcurve in the range nu1=2.4E22 Hz, nu2=7.2E25 Hz, with the effect of the **light crossing time**, in the observer frame, setting ``eval_cross_time=True`` .. code:: ipython3 lg_cross=temp_ev.rad_region.make_lc(nu1=2.4E22,nu2=7.2E25,name='gamma',eval_cross_time=True,delta_t_out=1E2,use_cached=True,frame='obs',cross_time_slices=1000) .. code:: ipython3 plt.plot(lg['time'],lg['flux']) plt.plot(lg_cross['time'],lg_cross['flux']) plt.xlabel('time (%s)'%lg['time'].unit) plt.ylabel('flux (%s)'%lg['flux'].unit) .. parsed-literal:: Text(0, 0.5, 'flux (erg / (cm2 s))') .. image:: Temp_Ev_one_zone_only_cooling_files/Temp_Ev_one_zone_only_cooling_31_1.png .. code:: ipython3 np.trapz(lg['flux'],lg['time']),np.trapz(lg_cross['flux'],lg_cross['time']) .. parsed-literal:: (3.3654423005727297e-08, 3.364709952845603e-08) We can save the model and reuse it later for plotting lightcurcves, SEDs, and electron distributions .. code:: ipython3 temp_ev.save_model('temp_ev_only_rad.pkl') .. code:: ipython3 temp_ev_1=JetTimeEvol.load_model('temp_ev_only_rad.pkl') .. code:: ipython3 temp_ev_1.show_model() .. parsed-literal:: -------------------------------------------------------------------------------- JetTimeEvol model description -------------------------------------------------------------------------------- physical setup: -------------------------------------------------------------------------------- .. raw:: html Table length=12
namepar typevalunitsval*units*log
delta ttime1.000000e+02s0.0005995849159999999R/cFalse
log. samplingtime0.000000e+00NoneFalse
R/ctime1.667820e+05s1.0R/cFalse
IC coolingoffNoneFalse
Sync coolingonNoneFalse
Adiab. coolingonNoneFalse
Reg. expansionoffNoneFalse
Tesc radtime3.335641e+05s2.0R/cFalse
R_rad rad startregion_position5.000000e+15cmNoneFalse
R_H rad startregion_position1.000000e+17cmNoneFalse
T min. synch. cooling1.934500e+02sNoneFalse
L inj (electrons)injected lum.1.000000e+40erg/sNoneFalse
.. parsed-literal:: model parameters: -------------------------------------------------------------------------------- .. raw:: html Table length=17
model namenamepar typeunitsvalphys. bound. minphys. bound. maxlogfrozen
jet_time_evdurationtime_grids1.000000e+060.000000e+00--FalseTrue
jet_time_evgmin_gridgamma_grid1.000000e+000.000000e+00--FalseTrue
jet_time_evgmax_gridgamma_grid1.000000e+080.000000e+00--FalseTrue
jet_time_evgamma_grid_sizegamma_grid1.500000e+030.000000e+00--FalseTrue
jet_time_evTStart_Injtime_grids0.000000e+000.000000e+00--FalseTrue
jet_time_evTStop_Injtime_grids5.000000e+050.000000e+00--FalseTrue
jet_time_evT_esc_radescape_time(R/c)*2.000000e+00----FalseTrue
jet_time_evEsc_Index_radfp_coeff_index0.000000e+00----FalseTrue
jet_time_evR_rad_startregion_sizecm5.000000e+150.000000e+00--FalseTrue
jet_time_evR_H_rad_startregion_positioncm1.000000e+170.000000e+00--FalseTrue
jet_time_evm_Bmagnetic_field_index1.000000e+001.000000e+002.000000e+00FalseTrue
jet_time_evt_jet_expexp_start_times1.000000e+050.000000e+00--FalseTrue
jet_time_evbeta_exp_Rbeta_expansionv/c*1.000000e+000.000000e+001.000000e+00FalseTrue
jet_time_evB_radmagnetic_fieldG2.000000e-010.000000e+00--FalseTrue
jet_time_evt_sizetime_grid1.000000e+040.000000e+00--FalseTrue
jet_time_evnum_samplestime_ev_output2.000000e+020.000000e+00--FalseTrue
jet_time_evL_injinj_luminosityerg / s1.000000e+400.000000e+00--FalseTrue
.. code:: ipython3 p=temp_ev_1.plot_tempev_model(region='rad',sed_data=None, use_cached = True) .. image:: Temp_Ev_one_zone_only_cooling_files/Temp_Ev_one_zone_only_cooling_37_0.png .. code:: ipython3 lx=temp_ev_1.rad_region.make_lc(nu1=1E17,nu2=1E18,name='X',eval_cross_time=False,delta_t_out=100,use_cached=True,frame='obs') plt.plot(lx['time'],lx['flux']) plt.xlabel('time (%s)'%lg['time'].unit) plt.ylabel('flux (%s)'%lg['flux'].unit) .. parsed-literal:: Text(0, 0.5, 'flux (erg / (cm2 s))') .. image:: Temp_Ev_one_zone_only_cooling_files/Temp_Ev_one_zone_only_cooling_38_1.png