def __init__(self): #Geometry Properties self.Geometry_type_name = read_data_string(tag_name='Geometry_type',file_name='parameters/parameters.xml') self.Cosmological_cosntant = read_data_float(tag_name='Cosmological_constant',file_name='parameters/parameters.xml') #Field Properties self.Potential_type_name = read_data_string(tag_name = 'Potential',file_name = 'parameters/parameters.xml') self.Potential_func = Gravity_Dictionary["Potential"][self.Potential_type_name][0] self.Potential_dfunc = Gravity_Dictionary["Potential"][self.Potential_type_name][1] #Initial Condition self.Initial_Condition_type_name = read_data_string(tag_name = 'Initial_Condition_Method',file_name = 'parameters/parameters.xml') self.Initial_Condition_type = Gravity_Dictionary["Initial_Condition"][self.Initial_Condition_type_name] #Numerical Method Setup self.Solver_type_name = read_data_string(tag_name = 'Solver_type',file_name = 'parameters/parameters.xml') self.Grid_size = read_data_int(tag_name = 'Grid_size',file_name = 'parameters/parameters.xml') #Ending Conditions self.Max_interation = read_data_int(tag_name = 'i_max',file_name = 'parameters/parameters.xml') #Horizon Condition self.A_min = read_data_float(tag_name = 'A_min',file_name = 'parameters/parameters.xml') #Initial Condition Setup if (self.Initial_Condition_type != Initial_Condition_Input_File): self.field.r = linspace(0.0,pi/2.0,self.Grid_size+1) (self.field.phi , self.field.Phi , self.field.Pi) = self.Initial_Condition_type(self.field.r) else: (self.field.r , self.field.phi , self.field.Phi , self.field.Pi) = self.Initial_Condition_type() print "The Gravity Object is initialized susseccfully."
def __init__(self): #Geometry Properties self.Geometry_type_name = read_data_string(tag_name='Geometry_type',file_name='parameters/parameters.xml') self.Cosmological_cosntant = read_data_float(tag_name='Cosmological_constant',file_name='parameters/parameters.xml') #Field Properties self.Potential_type_name = read_data_string(tag_name = 'Potential',file_name = 'parameters/parameters.xml') self.Potential_func = Gravity_Dictionary["Potential"][self.Potential_type_name][0] self.Potential_dfunc = Gravity_Dictionary["Potential"][self.Potential_type_name][1] #Initial Condition #reads in the name of the initial condition self.Initial_Condition_type_name = read_data_string(tag_name = 'Initial_Condition_Method',file_name = 'parameters/parameters.xml') #matches the name of the initial condition to the stuff in the Gravity dictionary try: self.Initial_Condition_type = Gravity_Dictionary["Initial_Condition"][self.Initial_Condition_type_name] except KeyError: print 'ERROR: Initial Condition name is wrong' sys.exit(1) #Numerical Method Setup self.Solver_type_name = read_data_string(tag_name = 'Solver_type',file_name = 'parameters/parameters.xml') self.Grid_size = read_data_int(tag_name = 'Grid_size',file_name = 'parameters/parameters.xml') #Ending Conditions self.Max_interation = read_data_int(tag_name = 'i_max',file_name = 'parameters/parameters.xml') #Horizon Condition self.A_min = read_data_float(tag_name = 'A_min',file_name = 'parameters/parameters.xml') #sets the initial conditions for generating end data try: print os.environ['PBS_ARRAYID'] self.pbs_arr = True except KeyError: print "not a pbs Array" self.pbs_arr = False if self.Initial_Condition_type_name =='Gaussian': #add the report checking before this is done. self.initial_eps = read_data_float(tag_name = 'epsilon' , file_name = 'parameters/Initial_Condition/Gaussian.xml') self.initial_sigma = read_data_float(tag_name = 'sigma' , file_name = 'parameters/Initial_Condition/Gaussian.xml') if self.pbs_arr: self.initial_eps = Change_eps(self.initial_eps) #Initial Condition Setup if (self.Initial_Condition_type != Initial_Condition_Input_File): self.field.r = linspace(0.0,pi/2.0,self.Grid_size+1) (self.field.phi , self.field.Phi , self.field.Pi) = self.Initial_Condition_type(self.field.r) else: (self.field.r , self.field.phi , self.field.Phi , self.field.Pi) = self.Initial_Condition_type() print "The Gravity Object is initialized susseccfully."
def Initial_Condition_Eigenfunction_modes_non_normalized(x): Phi = zeros(len(x)) Pi = zeros(len(x)) phi = zeros(len(x)) n = read_data_int(tag_name = 'number_of_modes' , file_name = 'parameters/Initial_Condition/Eigenfunction_modes_non_normalized.xml') a = read_data_float(tag_name = 'non_normalized_modes_amplitude' , file_name = 'parameters/Initial_Condition/Eigenfunction_modes_non_normalized.xml') for i in range(len(x)-1): for j in range(1,n+1): phi[i] += a*sqrt(16.0*float(j+1)*float(j+2)/pi) * cos(x[i])**3 * hyp2f1(-j,3+j,1.5,sin(x[i])**2) Phi[i] += -a*4.0*sqrt(float(2+3*j+j**2))/(3.0*sqrt(pi)) * (float(4*j*(j+3))*cos(x[i])**4*hyp2f1(1-j,4+j,2.5,sin(x[i])**2) + 9.0*cos(x[i])**2*hyp2f1(-j,3+j,1.5,sin(x[i])**2) )*sin(x[i]) print "Assigned Initial Condition is: Eigenfunction modes non-normalized" return (phi , Phi , Pi)