def galactic_model(self): ''' Model of the Galaxy. In this example, the Galaxy has two-dimensional bar and spiral arms. The spiral arms are described by the Composite model (2+2) The bar does not grow adiabatically The axisymmetric component has its defaul values from Allen & Santillan (1990). ''' galaxy = BarAndSpirals3D() galaxy.kinetic_energy = quantities.zero galaxy.potential_energy = quantities.zero galaxy.parameters.spiral_contribution = True galaxy.parameters.spiral_model = 2 galaxy.parameters.omega_spiral = self.omega_spiral_main_sp galaxy.parameters.spiral_phase = self.spiral_phase_main_sp galaxy.parameters.amplitude = self.amplitude_main_sp galaxy.parameters.m = self.number_main_sp galaxy.parameters.tan_pitch_angle = self.tangent_pitch_angle_main_sp galaxy.parameters.phi21_spiral = self.spiral_phase_second_sp galaxy.parameters.omega_spiral2 = self.omega_spiral_second_sp galaxy.parameters.amplitude2 = self.amplitude_second_sp galaxy.parameters.m2 = self.number_second_sp galaxy.parameters.tan_pitch_angle2 = self.tangent_pitch_angle_second_sp galaxy.parameters.rsp = self.separation_sp galaxy.parameters.bar_contribution = True galaxy.parameters.bar_phase = self.bar_phase galaxy.parameters.omega_bar = self.omega_bar galaxy.parameters.mass_bar = self.mass_bar galaxy.parameters.aaxis_bar = self.aaxis_bar galaxy.parameters.axis_ratio_bar = self.axis_ratio_bar galaxy.commit_parameters() self.omega_system = galaxy.parameters.omega_system self.initial_phase_sytem = galaxy.parameters.initial_phase return galaxy
def galaxy(self): global I galaxy = BarAndSpirals3D(redirection='file', redirect_stdout_file="GAL{0}.log".format(I)) I = I + 1 galaxy.kinetic_energy = quantities.zero galaxy.potential_energy = quantities.zero galaxy.parameters.bar_contribution = True galaxy.parameters.bar_phase = self.bar_phase galaxy.parameters.omega_bar = self.omega_bar galaxy.parameters.mass_bar = self.mass_bar galaxy.parameters.aaxis_bar = self.aaxis_bar galaxy.parameters.axis_ratio_bar = self.axis_ratio_bar galaxy.parameters.spiral_contribution = False galaxy.parameters.spiral_phase = self.spiral_phase galaxy.parameters.omega_spiral = self.omega_spiral galaxy.parameters.amplitude = self.amplitude galaxy.parameters.rsp = self.rsp galaxy.parameters.m = self.m galaxy.parameters.tan_pitch_angle = self.tan_pitch_angle galaxy.commit_parameters() self.omega = galaxy.parameters.omega_system self.initial_phase = galaxy.parameters.initial_phase print("INITIAL_PHASE:", self.initial_phase) galaxy.kinetic_energy = quantities.zero galaxy.potential_energy = quantities.zero return galaxy
def galaxy_model_with_bar_and_spirals(mass_bar=1.4e10 | units.MSun, initial_phase_bar_and_SA=0.35, semimajor_axis_bar=3.12 | units.kpc, axis_ratio_bar=0.37, vertical_axis_bar=1 | units.kpc, amplitude_spirals=3e6 | (units.MSun / units.kpc**3), scale_length_spirals=2.6 | units.kpc, number_of_arms=2, tangent_pitch_angle=0.2773, scale_height_spirals=0.3 | units.kpc, fiducial_radius=8 | units.kpc): # Galaxy model that uses a three dimensional bar (no adiabatic growing) # and the C&G model for the spiral arms galaxy = BarAndSpirals3D() galaxy.parameters.bar_contribution = True galaxy.parameters.bar_phase = initial_phase_bar_and_SA galaxy.parameters.mass_bar = mass_bar galaxy.parameters.aaxis_bar = semimajor_axis_bar galaxy.parameters.axis_ratio_bar = axis_ratio_bar galaxy.parameters.caxis_bar = vertical_axis_bar galaxy.parameters.spiral_contribution = True galaxy.parameters.spiral_model = 1 galaxy.parameters.spiral_phase = initial_phase_bar_and_SA galaxy.parameters.spiral_density_amplitude = amplitude_spirals galaxy.parameters.r_sigma = scale_length_spirals galaxy.parameters.m = number_of_arms galaxy.parameters.tan_pitch_angle = tangent_pitch_angle galaxy.parameters.scale_height = scale_height_spirals galaxy.parameters.fiducial_radius = fiducial_radius galaxy.commit_parameters() return galaxy
def galaxy(self): # Model of the Galaxy. # In this example, the Galaxy has two-dimensional bar and spiral arms. # The spiral arms model is the TWA # The bar does not grow adiabatically # The axisymmetric component has its defaul values from Allen & # Santillan (1990). galaxy = BarAndSpirals3D() galaxy.kinetic_energy = quantities.zero galaxy.potential_energy = quantities.zero galaxy.parameters.bar_contribution = True galaxy.parameters.bar_phase = self.bar_phase galaxy.parameters.omega_bar = self.omega_bar galaxy.parameters.mass_bar = self.mass_bar galaxy.parameters.aaxis_bar = self.aaxis_bar galaxy.parameters.axis_ratio_bar = self.axis_ratio_bar galaxy.parameters.spiral_contribution = True galaxy.parameters.spiral_model = 0 galaxy.parameters.spiral_phase = self.spiral_phase galaxy.parameters.omega_spiral = self.omega_spiral galaxy.parameters.amplitude = self.amplitude galaxy.parameters.rsp = self.rsp galaxy.parameters.m = self.m galaxy.parameters.tan_pitch_angle = self.tan_pitch_angle galaxy.commit_parameters() self.omega = galaxy.parameters.omega_system self. initial_phase = galaxy.parameters.initial_phase return galaxy
def galaxy_model(initial_phase_bar=(-20 * numpy.pi) / 180, initial_phase_spiral_arms=(-20 * numpy.pi) / 180, pattern_speed_spiral_arms=20 | (units.kms / units.kpc), amplitude_spiral_arms=1100 | (units.kms**2 / units.kpc), number_of_arms=4, separation_locus_spiral_arms=3.12 | units.kpc, tangent_pitch_angle=0.227194425, pattern_speed_bar=50 | (units.kms / units.kpc), mass_bar=1.1e10 | units.MSun, semimajor_axis_bar=3.12 | units.kpc, axis_ratio_bar=0.37): # Model of the Galaxy. # In this example, the Galaxy has two-dimensional bar and spiral arms. # The spiral arms model is the TWA # The bar does not grow adiabatically # The axisymmetric component has its defaul values from Allen & Santillan (1990). galaxy = BarAndSpirals3D() galaxy.parameters.bar_contribution = True galaxy.parameters.bar_phase = initial_phase_bar galaxy.parameters.omega_bar = pattern_speed_bar galaxy.parameters.mass_bar = mass_bar galaxy.parameters.aaxis_bar = semimajor_axis_bar galaxy.parameters.axis_ratio_bar = axis_ratio_bar galaxy.parameters.spiral_contribution = True galaxy.parameters.spiral_model = 0 galaxy.parameters.spiral_phase = initial_phase_spiral_arms galaxy.parameters.omega_spiral = pattern_speed_spiral_arms galaxy.parameters.amplitude = amplitude_spiral_arms galaxy.parameters.rsp = separation_locus_spiral_arms galaxy.parameters.m = number_of_arms galaxy.parameters.tan_pitch_angle = tangent_pitch_angle galaxy.commit_parameters() return galaxy
def test2(self): galaxy = BarAndSpirals3D() vc1 = galaxy.get_velcirc(10. | units.kpc, 0. | units.kpc, 0. | units.kpc) vc2 = galaxy.get_velcirc(0. | units.kpc, 10. | units.kpc, 0. | units.kpc) self.assertEqual(vc1, vc2) self.assertAlmostEqual(vc1, 219.324003066 | units.kms)
yticks = numpy.arange(0, 100, 10) xticks = numpy.arange(0, 15, 1) ax.set_xlim(0, 15) ax.set_ylim(0, 100) ax.set_ylabel("$\Omega$ $[kms^{-1}kpc^{-1}]$") ax.set_xlabel("R [Kpc]") plt.yticks(yticks) plt.xticks(xticks) plt.grid(True) plt.show() if __name__ in ('__main__', '__plot__'): MW = BarAndSpirals3D( ) # Axisymmetric model of the Galaxy with default values MW.commit_parameters() r = numpy.arange(0.001, 15, 0.005) | units.kpc phi = numpy.pi / 4. #phi can take any value x, y, z = r * numpy.cos(phi), r * numpy.sin(phi), 0 | units.kpc circular_velocity = MW.get_velcirc(x, y, z) omega = circular_velocity / r # Angular velocity epicyclic_frecuency = MW.get_epifreq(x, y, z) kappa = epicyclic_frecuency / r # epicyclic velocity #Inner and Outer Lindblad resonances for 2,4 spiral arms ILRm2 = omega - kappa / 2. OLRm2 = omega + kappa / 2. ILRm4 = omega - kappa / 4.
def galaxy_model_purely_axisymmetric(): # Axisymmetric Galaxy model with default values galaxy = BarAndSpirals3D() galaxy.commit_parameters() return galaxy
def test1(self): galaxy = BarAndSpirals3D() self.assertEqual(galaxy.model_time, 0. | units.yr)
yticks = numpy.arange(0, 100, 10) xticks = numpy.arange(0, 15, 1) ax.set_xlim(0, 15) ax.set_ylim(0, 100) ax.set_ylabel("$\Omega$ $[kms^{-1}kpc^{-1}]$") ax.set_xlabel("R [Kpc]") plt.yticks(yticks) plt.xticks(xticks) plt.grid(True) plt.show() if __name__ in ('__main__', '__plot__'): # Axisymmetric model of the Galaxy with default values MW = BarAndSpirals3D() MW.commit_parameters() r = numpy.arange(0.001, 15, 0.005) | units.kpc phi = numpy.pi / 4. # phi can take any value x, y, z = r * numpy.cos(phi), r * numpy.sin(phi), 0 | units.kpc circular_velocity = MW.get_velcirc(x, y, z) omega = circular_velocity / r # Angular velocity epicyclic_frecuency = MW.get_epifreq(x, y, z) kappa = epicyclic_frecuency / r # epicyclic velocity # Inner and Outer Lindblad resonances for 2,4 spiral arms ILRm2 = omega - kappa / 2. OLRm2 = omega + kappa / 2. ILRm4 = omega - kappa / 4.