예제 #1
0
      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."
예제 #2
0
파일: Gravity_Tasks.py 프로젝트: snysly/AdS
def Gravity_Solver():
    #Solver Type
    Geometry_type_name = read_data_string(tag_name='Geometry_type',file_name='parameters/parameters.xml')
    Solver_type_name   = read_data_string(tag_name ='Solver_type',file_name ='parameters/parameters.xml')
    Solver_type        = Geometry_type_name + "+" + Solver_type_name
    if (Solver_type == "AdS4+RK4"):
       return AdS4_RK4_solver
    else:
       print "ERROR : THE SOLVER IS NOT DEFINED FOR THIS GEOMETRY + SOLVER TYPE"
       return NO_SOLVER
      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_Input_File():
    #Bayad input time ezafe shavad !!! NOTICE
    name = read_data_string(tag_name = 'File_name' , file_name = 'parameters/Initial_Condition/Input_File.xml')
    file_address = 'parameters/Initial_Condition/Input_File/' + name
    (r , phi , Phi , Pi , Ricci) = loadtxt(file_address,dtype='float',comments='#',unpack=True)
    print "Assigned Initial Condition is: Input File"
    return (r , phi , Phi , Pi)
from scipy            import *
from scipy.special    import *
from Objects          import Gravity_Dictionary
from Utilities        import read_data_string

Potential_type_name    = read_data_string(tag_name = 'Potential',file_name = 'parameters/parameters.xml')
Potential_func         = Gravity_Dictionary["Potential"][Potential_type_name][0]
Potential_dfunc        = Gravity_Dictionary["Potential"][Potential_type_name][1]

#Potential Definition
def Potential(phi):
    return Potential_func(phi)

#Derivative of Potential Definition
def dPotential(phi):
    return Potential_dfunc(phi)

#Right handside constractor of Phi
def RH_cons_Phi(x,Pi,delta,A):
    phipp = zeros(len(A))
    h     = x[1]-x[0]
    phipp[0] = 0.0
    for i in range(1,len(A)-1):
       phipp[i] = (A[i+1]*exp(-delta[i+1])*Pi[i+1] - A[i-1]*exp(-delta[i-1])*Pi[i-1])/(2.0*h)
    phipp[len(A)-1] = 0.0
    return phipp

#Right handside constractor of Pi
def RH_cons_Pi(x,Phi,phi,delta,A):
    pipp = zeros(len(A))
    h     = x[1]-x[0]