def setup(self, from_file=False): eq = self.equilibrium thomson_data = self.thomson_data params = strahl.defaultParams() self.params = params params['numerical.time.final'] = 0.5 params['numerical.grid.k'] = 10 params['numerical.time.dt'] = 3e-4 rho_vol, rho_vol_LCFS = get_rho_volume(eq) rho_pol = np.linspace(0,1,20) _, ne = thomson_data.fit_density(rho_pol, pieces=4) _, Te = thomson_data.fit_temperature(rho_pol, pieces=4) ne /= 1e6 if from_file: r = np.loadtxt('r_profile.txt') D = np.loadtxt('D_profile.txt') v = np.loadtxt('v_profile.txt') D = np.interp(rho_pol, r, D) v = np.interp(rho_pol, r, v) v[0] = 0. else: f_D = strahl.modified_gauss(6, 2, 1.9, 0.4, 0.05, 0.8) D = f_D(rho_pol) v = strahl.velocity_from_zero_flux(rho_vol, rho_pol, D, ne) self.tau=50e-3 params['geometry.rho_volume'] = rho_vol * 100 params['background.rho_poloidal'] = rho_pol params['background.electron_density'] = ne params['background.electron_temperature'] = Te params['geometry.rho_volume_at_lcfs'] = rho_vol_LCFS * 100 params['background.decay_length'] = rho_vol_LCFS * 0.1 params['impurity.sol_width'] = rho_vol_LCFS * 0.1 params['impurity.convection_velocity'] = v params['impurity.diffusion_coefficient'] = D
import strahl params = strahl.defaultParams() t, flx = strahl.rectangular_pulse(length=5e-3, max_value=2.5e23) params['impurity.influx'] = (t, flx) params['numerical.time.dt'] = 1e-4 params['numerical.time.final'] = 0.5 strahl.create_input(params, './wk')
import strahl strahl.create_input(strahl.defaultParams(), "./wk")