import sources_1D as sources import save_routines as save import pdb from simulation_parameters_1D import save_particles, save_fields, te0_equil if __name__ == '__main__': start_time = timer() # Initialize simulation: Allocate memory and set time parameters print('Initializing arrays...') pos, vel, Ie, W_elec, Ib, W_mag, idx, Ep, Bp, temp_N = init.initialize_particles( ) B, E_int, E_half, Ve, Te, Te0 = init.initialize_fields() q_dens, q_dens_adv, Ji, ni, nu = init.initialize_source_arrays() old_particles, old_fields, temp3De, temp3Db, temp1D,\ v_prime, S, T, mp_flux = init.initialize_tertiary_arrays() print('Collecting initial moments...') # Collect initial moments and save initial state sources.collect_moments(vel, Ie, W_elec, idx, q_dens, Ji, ni, nu) if te0_equil == 1: init.set_equilibrium_te0(q_dens, Te0) DT, max_inc, part_save_iter, field_save_iter, B_damping_array, E_damping_array\ = init.set_timestep(vel, Te0) fields.calculate_E(B, Ji, q_dens, E_int, Ve, Te, Te0, temp3De, temp3Db, temp1D, E_damping_array, 0, DT, 0) print('Saving initial conditions...')
import particles_1D as particles import fields_1D as fields import sources_1D as sources import save_routines as save import pdb from simulation_parameters_1D import save_particles, save_fields if __name__ == '__main__': start_time = timer() # Initialize simulation: Allocate memory and set time parameters pos, vel, Ie, W_elec, Ib, W_mag, idx = init.initialize_particles() B, E_int, E_half, Ve, Te, = init.initialize_fields() q_dens, q_dens_adv, Ji, ni, nu = init.initialize_source_arrays() old_particles, old_fields, temp3D, temp3D2, temp1D = init.initialize_tertiary_arrays( ) DT, max_inc, part_save_iter, field_save_iter = init.set_timestep(vel) # Collect initial moments and save initial state sources.collect_moments(vel, Ie, W_elec, idx, q_dens, Ji, ni, nu, temp1D) fields.calculate_E(B, Ji, q_dens, E_int, Ve, Te, temp3D, temp3D2, temp1D) if save_particles == 1: save.save_particle_data(DT, part_save_iter, 0, pos, vel) if save_fields == 1: save.save_field_data(DT, field_save_iter, 0, Ji, E_int, B, Ve, Te, q_dens) particles.assign_weighting_TSC(pos, Ib, W_mag, E_nodes=False)
import fields_1D as fields import sources_1D as sources import save_routines as save from simulation_parameters_1D import save_particles, save_fields, te0_equil if __name__ == '__main__': start_time = timer() # Initialize simulation: Allocate memory and set time parameters pos, vel, Ie, W_elec, Ib, W_mag, idx, Ep, Bp, temp_N = init.initialize_particles( ) B, E_int, E_half, Ve, Te, Te0 = init.initialize_fields() q_dens, q_dens_adv, Ji, ni, nu = init.initialize_source_arrays() old_particles, old_fields, temp3De, temp3Db, temp1D,\ v_prime, S, T = init.initialize_tertiary_arrays() # Collect initial moments and save initial state sources.collect_moments(vel, Ie, W_elec, idx, q_dens, Ji, ni, nu) if te0_equil == 1: init.set_equilibrium_te0(q_dens, Te0) DT, max_inc, part_save_iter, field_save_iter, B_damping_array, E_damping_array\ = init.set_timestep(vel, Te0) fields.calculate_E(B, Ji, q_dens, E_int, Ve, Te, Te0, temp3De, temp3Db, temp1D, E_damping_array) if save_particles == 1: save.save_particle_data(0, DT, part_save_iter, 0, pos, vel, idx)
# TODO: # -- Check initial moments (i.e. verify uniform and expected charge density, zero transverse current density) # -- Vectorise/Optimize particle loss/injection # -- Test run :: Does it compile and execute? if __name__ == '__main__': start_time = timer() # Initialize simulation: Allocate memory and set time parameters pos, vel, Ie, W_elec, Ib, W_mag, idx, Ep, Bp, temp_N = init.initialize_particles( ) B, E_int, E_half, Ve, Te, Te0 = init.initialize_fields() q_dens, q_dens_adv, Ji, ni, nu = init.initialize_source_arrays() old_particles, old_fields, flux_rem, \ temp3De, temp3Db, temp1D, v_prime, S, T = init.initialize_tertiary_arrays() # Collect initial moments and save initial state sources.collect_velocity_moments(pos, vel, Ie, W_elec, idx, nu, Ji) sources.collect_position_moment(pos, Ie, W_elec, idx, q_dens, ni) DT, max_inc, part_save_iter, field_save_iter, B_damping_array, E_damping_array\ = init.set_timestep(vel, Te0) fields.calculate_E(B, Ji, q_dens, E_int, Ve, Te, Te0, temp3De, temp3Db, temp1D, E_damping_array) if save_particles == 1: save.save_particle_data(0, DT, part_save_iter, 0, pos, vel, idx) if save_fields == 1: