def initial_print(partial_state): print('The initial potential energy is:') print(np.average(Energy.potential_energy(partial_state))/pow(MPl, 4)) print('Initial Phi Gradient energy is:') print(np.average(Energy.phi_gradient_energy(partial_state))/pow(MPl, 4)) print('Initial Chi Gradient energy is:') print(np.average(Energy.chi_gradient_energy(partial_state))/pow(MPl, 4)) print('Initial Phi Kinetic energy is:') print(np.average(Energy.phi_kinetic_energy(partial_state))/pow(MPl, 4)) print('Initial Chi Kinetic energy is:') print(np.average(Energy.chi_kinetic_energy(partial_state))/pow(MPl, 4))
def write_curent_data(self, partial_state, step_num, h): self.files_with_data['energyData'].write(repr(partial_state.a)) self.files_with_data['energyData'].write(' ') self.files_with_data['energyData'].write( repr(np.average(Energy.phi_kinetic_energy(partial_state)) / pow(MPl, 4))) self.files_with_data['energyData'].write(' ') self.files_with_data['energyData'].write( repr(np.average(Energy.chi_kinetic_energy(partial_state)) / pow(MPl, 4))) self.files_with_data['energyData'].write(' ') self.files_with_data['energyData'].write( repr(np.average(Energy.phi_gradient_energy(partial_state)) / pow(MPl, 4))) self.files_with_data['energyData'].write(' ') self.files_with_data['energyData'].write( repr(np.average(Energy.chi_gradient_energy(partial_state)) / pow(MPl, 4))) self.files_with_data['energyData'].write(' ') if write_separate_potential_energy: self.files_with_data['energyData'].write( repr(np.average(Energy.inflaton_potential_energy(partial_state)) / pow(MPl, 4))) self.files_with_data['energyData'].write(' ') self.files_with_data['energyData'].write( repr(np.average(Energy.chi_potential_energy(partial_state)) / pow(MPl, 4))) self.files_with_data['energyData'].write('\n') else: self.files_with_data['energyData'].write( repr(np.average(Energy.potential_energy(partial_state)) / pow(MPl, 4))) self.files_with_data['energyData'].write('\n') # writing fields in program units: self.files_with_data['fieldData'].write(repr(partial_state.a)) self.files_with_data['fieldData'].write(' ') self.files_with_data['fieldData'].write(repr(partial_state.pa)) self.files_with_data['fieldData'].write(' ') self.files_with_data['fieldData'].write(repr(np.average(partial_state.phi))) self.files_with_data['fieldData'].write(' ') self.files_with_data['fieldData'].write(repr(np.average(partial_state.chi))) self.files_with_data['fieldData'].write(' ') self.files_with_data['fieldData'].write(repr(np.average(partial_state.phiPi))) self.files_with_data['fieldData'].write(' ') self.files_with_data['fieldData'].write(repr(np.average(partial_state.chiPi))) self.files_with_data['fieldData'].write('\n') self.files_with_data['chiMagnitudeData'].write(repr(partial_state.a)) self.files_with_data['chiMagnitudeData'].write(' ') self.files_with_data['chiMagnitudeData'].write(repr(np.sqrt(np.average(pw2(partial_state.chi))))) self.files_with_data['chiMagnitudeData'].write('\n') self.files_with_data['dtList'].write(repr(step_num)) self.files_with_data['dtList'].write(' ') self.files_with_data['dtList'].write(repr(h)) self.files_with_data['dtList'].write('\n')
def make_2nd_order_time_step(self, partial_state, h): partial_state.a += (h / 2.) * (-partial_state.pa / (6. * pow(N, 3) * pow(MPl, 2))) partial_state.pa += paFirstUpdate(h, partial_state.phiPi, partial_state.chi, partial_state.a) partial_state.phi += phiFirstUpdate(h, partial_state.a, partial_state.phiPi, partial_state.chi) partial_state.chiPi += chiPiFirstUpdate(h, partial_state.a, partial_state.phiPi, partial_state.chi) partial_state.pa += (h / 2.) * np.sum(pw2(partial_state.chiPi)) / pow(partial_state.a, 3) partial_state.chi += (h / (2. * pw2(partial_state.a))) * partial_state.chiPi partial_state.pa -= (h) * pow(N * partial_state.a, 3.) * (2. * (np.average(Energy.phi_gradient_energy(partial_state)) + np.average(Energy.chi_gradient_energy(partial_state))) + 4. * np.average(Model.potential(partial_state.phi, partial_state.chi))) partial_state.phiPi -= (h) * (pow(partial_state.a, 4) * Model.d_phi_potential(partial_state.phi, partial_state.chi) +pow(partial_state.a, 2) * dgradPhiTerm(partial_state.phi, partial_state.chi) / 2.) partial_state.chiPi -= (h) * (pow(partial_state.a, 4) * Model.d_chi_potential(partial_state.phi, partial_state.chi) +pow(partial_state.a, 2) * (dgradChiTerm(partial_state.chi)/ 2. + chiPiPartSecondUpdate(partial_state.chi) * Energy.grad2(partial_state.phi))) partial_state.chi += (h / (2. * pw2(partial_state.a))) * partial_state.chiPi partial_state.pa += (h / 2.) * np.sum(pw2(partial_state.chiPi)) / pow(partial_state.a, 3) partial_state.chiPi += chiPiFirstUpdate(h, partial_state.a, partial_state.phiPi, partial_state.chi) partial_state.phi += phiFirstUpdate(h, partial_state.a, partial_state.phiPi, partial_state.chi) partial_state.pa += paFirstUpdate(h, partial_state.phiPi, partial_state.chi, partial_state.a) partial_state.a += (h / 2.) * (-partial_state.pa / (6. * pow(N, 3) * pow(MPl, 2)))