<jupyter_start><jupyter_text>Adiabatic Expansion===================<jupyter_code>import flaremodel as fm
import numpy as np
import matplotlib.pyplot as plt
SAVE_PLOT = True
R = 2*fm.SgrA().Rs # size of the sphere, will be modified if there is expansion
V = 4/3*np.pi*R**3
n_e = 6e10
B = 10.
exp_b = 0.02
ts = R/fm.c/exp_b*np.array([0, 1.5, 3., 4.5])

g_min = 20.
g_max = 1e5
p = 2.
edist = "powerlaw"

nus = np.logspace(9, 20, 100)

params = [p, g_min, g_max]

e_pl_fun = lambda gamma, ne: np.piecewise(gamma, [np.logical_and(gamma < g_max, gamma > g_min)],
                                            [lambda gamma: fm.eDist(gamma, ne, params, edist), 0.]) 
nu_m_fun = lambda R, nu_m, R0: nu_m*(R/R0)**(-(4*p+6)/(p+4))
S_m_fun = lambda R, S_m, R0: S_m*(R/R0)**(-(7*p+3)/(p+4))
t_edist = fm.vdLEdist(sync_cool=True)
t_edist_off = fm.vdLEdist(sync_cool=False)
t_edist.e_dist_fun = e_pl_fun
t_edist_off.e_dist_fun = e_pl_fun
Rs, Bs, e_dist = t_edist.get_ngamma(ts, n_e*V, B, R, exp_b, 1)
Rs, Bs, e_dist_off = t_edist_off.get_ngamma(ts, n_e*V, B, R, exp_b, 1)
geo_user = fm.HomogeneousSphereUserdist()
cs = ["green", "red", "blue", "magenta"]
plt.figure(figsize=(6,5))

for i in range(ts.shape[0]):
    syn = geo_user.compute_synchrotron(nus, e_dist[i,:], [Rs[i], -1], Bs[i], t_edist._gamma)
    plt.loglog(nus, syn, linestyle="-", color=cs[i], label=r"%.1f$R_0$" % (Rs[i]/R))
    if i == 0:
        nu_m_0 = nus[np.argmax(syn)] 
        S_m_0 = np.max(syn)
    
for i in range(ts.shape[0]):
    syn = geo_user.compute_synchrotron(nus, e_dist_off[i,:], [Rs[i], -1], Bs[i], t_edist._gamma)
    plt.loglog(nus, syn, linestyle="-.", color=cs[i])
        
plt.plot(nu_m_fun(Rs, nu_m_0, R), S_m_fun(Rs, S_m_0, R), 'ko-')

plt.legend(loc=2)
plt.ylabel(r"$L_\nu$ [erg / s / Hz]")
plt.xlabel(r"Frequency [Hz]")
plt.ylim([1e22, 1e28])
plt.xlim([2e9, 1e14])
if SAVE_PLOT: plt.savefig("vdL_single.eps", bbox_inches="tight", dpi=300)<jupyter_output>The PostScript backend does not support transparency; partially transparent artists will be rendered opaque.
The PostScript backend does not support transparency; partially transparent artists will be rendered opaque.
{'fraction_non_alphanumeric': 0.18224081822408184, 'fraction_numerical': 0.032543003254300325, 'mean_word_length': 4.236009732360097, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '562613', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1035, 'n_tokens_neox': 953, 'n_words': 208, 'path': 'notebooks/AdiabaticExp.ipynb', 'repo_name': 'ydallilar/flaremodel', 'size': '2151'}