Exemple #1
0
def Lz_radiated_power(rate_equations, taus, color):
    linestyles = ['dashed', 'solid', 'dashed']
    for i, tau in enumerate(taus):
        print(tau * 1e3)
        times = np.logspace(-7, np.log10(tau * 10), 20)
        y = rt.solve(times, temperature, density, tau)
        rad = atomic.Radiation(y.abundances[-1])
        plt.loglog(temperature,
                   rad.specific_power['total'],
                   color=color,
                   ls=linestyles[i])
Exemple #2
0
    plt.close()
    plt.figure(1)
    plt.clf()
    plt.xlim(xmin=1., xmax=100e3)
    plt.ylim(ymin=1.e-35, ymax=1.e-30)
    linestyles = [
        'dashed', 'dotted', 'dashdot', (0, (3, 1)), (0, (1, 1)),
        (0, (3, 1, 1, 1, 1, 1))
    ]

    ax = plt.gca()

    for i, tau in enumerate(taus):
        y = rt.solve(times, temperature, density, tau)
        rad = atomic.Radiation(y.abundances[-1])
        ax.loglog(temperature,
                  rad.specific_power['total'],
                  color='black',
                  ls=linestyles[i])
        Zmean = np.mean(y.mean_charge(), 1)

    annotate_lines(['$10^{%d}$' % i for i in np.log10(taus * rt.density)])

    power_collrad = atomic.Radiation(y.y_collrad).specific_power['total']
    ax.loglog(rt.temperature, power_collrad, color='black')
    AnnotateRight(ax.lines[-1:], ['$\infty$'])
    title = element_str + r' Lz radiated power'
    ax.set_xlabel(r'$T_\mathrm{e}\ \mathrm{(eV)}$')
    ax.set_ylabel(r'$L_z [\mathrm{W-m^3}]$')
    ax.set_title(title)
Exemple #3
0
import numpy as np
import atomic_neu.atomic as atomic
import matplotlib.pyplot as plt

Element = 'carbon'
ad = atomic.element(Element)
eq = atomic.CoronalEquilibrium(ad)

temperature = np.logspace(0, 3, 50)
electron_density = 1e20
y = eq.ionisation_stage_distribution(temperature, electron_density)

rad = atomic.Radiation(y, neutral_fraction=1e-1, impurity_fraction=2e-2)


plt.figure()
plt.clf()

customize = True

lines = rad.plot()

if customize:
    plt.ylabel(r'$P/n_\mathrm{i} n_\mathrm{e}\ [\mathrm{W m^3}]$')
    # plt.ylim(ymin=1e-35)

    # annotation
    s = '$n_0/n_\mathrm{e}$\n'
    if rad.neutral_fraction == 0:
        s += '$0$'
    else:
Exemple #4
0
#lines_abundance = ax.semilogy(r, y.y.T*100)
#ax.set_ylim(0.3, 400)
#yy.y_coronal.replot_colored(line, lines_abundance)


def normalized_gradient(x, y):
    return -np.gradient(y)/np.gradient(x)/y

# fractional abundance, Zeff, Zmean
y_selected = y_bar.select_times(ne_tau)
for y in y_selected:
    #ax3.semilogy(r, y.y[-1,:].T*100, color='black')
    #lines = ax4.plot(r, y.effective_charge(impurity_fraction),
    #        color='black', ls='--')

    rad = atomic.Radiation(y, impurity_fraction=impurity_fraction)
    total_power = rad.power['total']

    ax4.plot(r, total_power)

    radiation_parameter = total_power / (impurity_fraction * density)
    line, = ax5.plot(r, radiation_parameter)

    rlte = normalized_gradient(r, temperature)
    rlrad = normalized_gradient(r, total_power)
    ax6.plot(r, rlrad)

ax6.plot(r, rlte, 'k--')
ax6.set_ylim(0,10)
#from matplotlib.ticker import FormatStrFormatter
#ax = ax3
Exemple #5
0
 def test_get_neutral_density_default_zero(self):
     rad = atomic.Radiation(self.y1)
     expected = 0.
     result = rad.get_neutral_density()
     self.assertEqual(expected, result)
Exemple #6
0
 def test_power(self):
     rad = atomic.Radiation(self.y1)
     power = rad.power
Exemple #7
0
 def test_get_neutral_density(self):
     rad = atomic.Radiation(self.y1, neutral_fraction=1e-2)
     expected = 1e17
     result = rad.get_neutral_density()
     self.assertEqual(expected, result)
Exemple #8
0
 def test_get_impurity_density_zero(self):
     rad = atomic.Radiation(self.y1, impurity_fraction=0)
     expected = 0
     result = rad.get_impurity_density()
     self.assertEqual(expected, result)
Exemple #9
0
 def test_get_impurity_density_default_1(self):
     rad = atomic.Radiation(self.y1)
     expected = 1e19
     result = rad.get_impurity_density()
     self.assertEqual(expected, result)
Exemple #10
0
 def test_get_impurity_density_finite2(self):
     """There are 10 times as many impurities as main ions."""
     rad = atomic.Radiation(self.y1, impurity_fraction=10)
     expected = 1e20
     result = rad.get_impurity_density()
     self.assertEqual(expected, result)
Exemple #11
0
 def test_get_impurity_density_finite(self):
     rad = atomic.Radiation(self.y1, impurity_fraction=0.1)
     expected = 1e18
     result = rad.get_impurity_density()
     self.assertEqual(expected, result)