import numpy as np import matplotlib.pyplot as plt import atomic from ensemble_average import time_dependent_power if __name__ == '__main__': times = np.logspace(-7, 0, 50) temperature = np.logspace(0, 3, 50) density = 1e19 from atomic.pec import TransitionPool ad = atomic.element('argon') tp = TransitionPool.from_adf15('adas_data/pec/transport_llu#ar*.dat') ad = tp.filter_energy(2e3, 20e3, 'eV').create_atomic_data(ad) rt = atomic.RateEquations(ad) y = rt.solve(times, temperature, density) taus = np.array([ 1e14, 1e15, 1e16, 1e17, 1e18])/density plt.figure(2); plt.clf() time_dependent_power(y, taus) plt.ylim(ymin=1e-35) plt.draw() plt.figure(3); plt.clf() time_dependent_power(y, taus, ensemble_average=True) plt.ylim(ymin=1e-35) plt.draw()
for i, key in enumerate(['line_power', 'continuum_power', 'cx_power']): if label: label_str = key else: label_str = None c= ad.coeffs[key](charge, te, ne) ax.loglog(te, c, colors[i], label=label_str, **kwargs) ax.set_ylabel('$P/n_\mathrm{e} n_\mathrm{I}\ [\mathrm{W m^3}]$') if __name__ == '__main__': ad = atomic.element('carbon') tp = TransitionPool.from_adf15('adas_data/pec/pec96#c_pju*.dat') #tp = tp.filter_energy(2e3, 20e3, 'eV') ad_filtered = tp.create_atomic_data(ad) te = np.logspace(0, 3) f = plt.figure(1); f.clf() for i, charge in enumerate([1, 2, 5]): ax = f.add_subplot(3, 1, i+1) plot_coeffs(ad, te, charge) plot_coeffs(ad_filtered, te, charge, marker='x', ls='', label=None) ax.set_ylim(1e-35, 1e-30) label = '$\mathrm{%s}^{%d+}$' % (ad.element, charge) ax.text(0.02, 0.95, label, transform=ax.transAxes, va='top')
def parabolic_profile(y0): x = np.linspace(1., 0, 50) y = 1 - x**2 y *= y0 return x, y r, temperature = parabolic_profile(3e3) r, density = parabolic_profile(1e19) try: ad except NameError: from atomic.pec import TransitionPool ad = atomic.element('argon') tp = TransitionPool.from_adf15('adas_data/pec/transport_llu#ar*.dat') ad = tp.filter_energy(2e3, 20e3, 'eV').create_atomic_data(ad) eq = atomic.CoronalEquilibrium(ad) y = eq.ionisation_stage_distribution(temperature, density) ne_tau = np.array([1e-1, 1e-2, 1e-3]) impurity_fraction = 0.05 texts = ['$10^{%d}$' % i for i in np.log10(ne_tau)] try: tau_ss except NameError: t_normalized = np.logspace(-4, 0, 500)
for i, key in enumerate(['line_power', 'continuum_power', 'cx_power']): if label: label_str = key else: label_str = None c = ad.coeffs[key](charge, te, ne) ax.loglog(te, c, colors[i], label=label_str, **kwargs) ax.set_ylabel('$P/n_\mathrm{e} n_\mathrm{I}\ [\mathrm{W m^3}]$') if __name__ == '__main__': ad = atomic.element('carbon') tp = TransitionPool.from_adf15('../adas_data/pec96#c_pju*.dat') #tp = tp.filter_energy(2e1, 20e3, 'eV') ad_filtered = tp.create_atomic_data(ad) te = np.logspace(0, 3) f = plt.figure(1) f.clf() for i, charge in enumerate([1, 2, 5]): ax = f.add_subplot(3, 1, i + 1) plot_coeffs(ad, te, charge) plot_coeffs(ad_filtered, te, charge, marker='x', ls='', label=None) ax.set_ylim(1e-35, 1e-30) label = '$\mathrm{%s}^{%d+}$' % (ad.element, charge) ax.text(0.02, 0.95, label, transform=ax.transAxes, va='top')