예제 #1
0
def katz_mf(props_name,props,cond,h2o):	#calculates melt fraction as in Katz 2003. props_name=mineralogy of mantle 
	from scipy.optimize import fsolve
	import katz_melt_frac
	def fcpx_out(P,comp):
			
			#print comp
			Mcpx=comp["cpx"]
				
			#r0=0.446
			
			r0=0.45	
			r1=0.08
			return Mcpx/(r0+r1*P)
	if cond[0]!=0.0 or cond[1]!=0.0:# if not an empty P,T,H2O estimate in file
		if props_name=="Fo=92":
				A_val=1159.6#value from kelley 2010
		elif props_name=="Fo=91":
				A_val=1122.65#average of Fo=90,Fo=92
		elif props_name=="Fo=90":
				A_val=1085.7
		
		x0=fsolve(katz_melt_frac.mf_root_finding,0,(cond[1],cond[0],h2o,A_val))[0]


		if x0>fcpx_out(cond[1],props[props_name]):
			x0=katz_melt_frac.mf_opx(cond[1],cond[0],fcpx_out(cond[1],props[props_name]),h2o,A_val)
	else:
		return 0.0
	return x0
예제 #2
0
def katz_mf_new(
    mg_num, cpx_mode, cond, h2o
):  #calculates melt fraction as in Katz 2003. props_name=mineralogy of mantle
    cpx_mode = 0.15
    from scipy.optimize import fsolve
    import katz_melt_frac
    mg_nums = [0.893419654, 0.9010621194, 0.9184344261]
    A_vals = [1085.7, 1122.65, 1159.6]

    if cond[0] != 0.0 or cond[
            1] != 0.0:  # if not an empty P,T,H2O estimate in file
        A_val = 1085.7

        x0 = fsolve(katz_melt_frac.mf_root_finding, 0,
                    (cond[1], cond[0], h2o, A_val))[0]

        if x0 == 0:
            print "Katz_melt_frac_error", cond[1], cond[0], h2o, mg_num

        if x0 > fcpx_out(cond[1], {"cpx": cpx_mode}):

            x0 = katz_melt_frac.mf_opx(cond[1], cond[0],
                                       fcpx_out(cond[1], {"cpx": cpx_mode}),
                                       h2o, A_val)
    else:
        return 0.0
    return x0
예제 #3
0
        def katz_mf_kelley_solidus(
            self, mg_num, cpx_mode, cond, h2o
        ):  #calculates melt fraction as in Katz 2003. props_name=mineralogy of mantle
            from scipy.optimize import fsolve
            import katz_melt_frac
            if cond[0] != 0.0 or cond[
                    1] != 0.0:  # if not an empty P,T,H2O estimate in file

                A_val = 1159.66061

                self.x0 = fsolve(katz_melt_frac.mf_root_finding, 0,
                                 (cond[1], cond[0], h2o, A_val))[0]
                if self.x0 == 0:
                    print "Katz_melt_frac_error", self.name, cond[1], cond[
                        0], h2o, props_name

                if self.x0 > self.fcpx_out(cond[1], {"cpx": cpx_mode}):

                    self.x0 = katz_melt_frac.mf_opx(
                        cond[1], cond[0],
                        self.fcpx_out(cond[1], {"cpx": cpx_mode}), h2o, A_val)

            else:
                return 0.0
            return self.x0
		def katz_mf_kelley_solidus(self,mg_num,cpx_mode,cond,h2o):	#calculates melt fraction as in Katz 2003. props_name=mineralogy of mantle 
			from scipy.optimize import fsolve
			import katz_melt_frac
			if cond[0]!=0.0 or cond[1]!=0.0:# if not an empty P,T,H2O estimate in file
				
				A_val=1159.66061	
				
				self.x0=fsolve(katz_melt_frac.mf_root_finding,0,(cond[1],cond[0],h2o,A_val))[0]
				if self.x0==0:
					print "Katz_melt_frac_error",self.name,cond[1],cond[0],h2o,props_name
					
		
				if self.x0>self.fcpx_out(cond[1],{"cpx":cpx_mode}):
					
					self.x0=katz_melt_frac.mf_opx(cond[1],cond[0],self.fcpx_out(cond[1],{"cpx":cpx_mode}),h2o,A_val)
				
			else:
				return 0.0
			return self.x0
def kelley_mf_arc_with_cpx_out(props_name,cond,h2o):#finds melt fraction using eqn 4 from kelley 2010. cond in format [T,P], using the more "refractory" constants
			import math
			
			import katz_melt_frac
			a=-5.1404654
			b=132.899012
			
			
				
			c=1159.66061#value from kelley 2010
			x=-136.88
			y=332.01
		
			print  cond[1],math.log(cond[1])
			x0= (-60.0*h2o**(1./1.85)-cond[0]+(a*cond[1]**2+b*cond[1]+c))/(-1*(x*math.log(cond[1])+y))
			if x0>0.1:
					
				x0=katz_melt_frac.mf_opx(cond[1],cond[0],0.1,h2o,1159)
			
			return x0
		def katz_mf(self,props):	#calculates melt fraction as in Katz 2003. props_name=mineralogy of mantle 
			from scipy.optimize import fsolve
			import katz_melt_frac
			self.fracs={}
			for props_name in props:
				
				for self.con,self.est in self.pts.iteritems():#looping through conditions(fo,h2o,fo2) - self.con and corresponding P,T,Estimate - self.est
					if self.est!=0.0:# if not an empty P,T,H2O estimate in file
						if props_name=="Fo=92":
							A_val=1159.6#value from kelley 2010
						else:
							A_val=1085.7
			
						self.x0=fsolve(katz_melt_frac.mf_root_finding,0,(self.est[0],self.est[1],self.est[2],A_val))[0]
		
		
						if self.x0>self.fcpx_out(self.est[0],props[props_name]):
			
							self.x0=katz_melt_frac.mf_opx(self.est[0],self.est[1],self.fcpx_out(self.est[0],props[props_name]),self.est[2],A_val)
						self.fracs[self.con]=self.x0
def kelley_mf_arc_with_cpx_out(props_name,cond,h2o):#finds melt fraction using eqn 4 from kelley 2010. cond in format [T,P], using the more "refractory" constants
			import math
			
			import katz_melt_frac
			a=-5.1404654
			b=132.899012
			
			
				
			c=1159.66061#value from kelley 2010
			x=-136.88
			y=332.01
		
			print  cond[1],math.log(cond[1])
			x0= (-60.0*h2o**(1./1.85)-cond[0]+(a*cond[1]**2+b*cond[1]+c))/(-1*(x*math.log(cond[1])+y))
			if x0>0.1:
					
				x0=katz_melt_frac.mf_opx(cond[1],cond[0],0.1,h2o,1159)
			
			return x0
		def katz_mf_new(self,mg_num,cpx_mode,cond,h2o):	#calculates melt fraction as in Katz 2003. props_name=mineralogy of mantle 
			from scipy.optimize import fsolve
			import katz_melt_frac
			mg_nums=[0.893419654,0.9010621194,0.9184344261]
			A_vals=[1085.7,1122.65,1159.6]
			
			if cond[0]!=0.0 or cond[1]!=0.0:# if not an empty P,T,H2O estimate in file
				A_val=np.interp(mg_num,mg_nums,A_vals)
				
				self.x0=fsolve(katz_melt_frac.mf_root_finding,0,(cond[1],cond[0],h2o,A_val))[0]
				
				if self.x0==0:
					print "Katz_melt_frac_error",self.name,cond[1],cond[0],h2o,mg_num
					
		
				if self.x0>self.fcpx_out(cond[1],{"cpx":cpx_mode}):
					
					self.x0=katz_melt_frac.mf_opx(cond[1],cond[0],self.fcpx_out(cond[1],{"cpx":cpx_mode}),h2o,A_val)
			else:
				return 0.0
			return self.x0
		def katz_mf(self,props_name,props,cond,h2o):	#calculates melt fraction as in Katz 2003. props_name=mineralogy of mantle 
			from scipy.optimize import fsolve
			import katz_melt_frac
			if cond[0]!=0.0 or cond[1]!=0.0:# if not an empty P,T,H2O estimate in file
				if props_name=="Fo=92":
						A_val=1159.6#value from kelley 2010
				elif props_name=="Fo=91":
						A_val=1122.65#average of Fo=90,Fo=92
				elif props_name=="Fo=90":
						A_val=1085.7	
				
				self.x0=fsolve(katz_melt_frac.mf_root_finding,0,(cond[1],cond[0],h2o,A_val))[0]
				if self.x0==0:
					print "Katz_melt_frac_error",self.name,cond[1],cond[0],h2o,props_name
					
		
				if self.x0>self.fcpx_out(cond[1],props[props_name]):
					self.x0=katz_melt_frac.mf_opx(cond[1],cond[0],self.fcpx_out(cond[1],props[props_name]),h2o,A_val)
			else:
				return 0.0
			return self.x0
예제 #10
0
def katz_mf(
    props_name, props, cond, h2o
):  #calculates melt fraction as in Katz 2003. props_name=mineralogy of mantle
    from scipy.optimize import fsolve
    import katz_melt_frac

    def fcpx_out(P, comp):

        #print comp
        Mcpx = comp["cpx"]

        #r0=0.446

        r0 = 0.45
        r1 = 0.08
        return Mcpx / (r0 + r1 * P)

    if cond[0] != 0.0 or cond[
            1] != 0.0:  # if not an empty P,T,H2O estimate in file
        if props_name == "Fo=92":
            A_val = 1159.6  #value from kelley 2010
        elif props_name == "Fo=91":
            A_val = 1122.65  #average of Fo=90,Fo=92
        elif props_name == "Fo=90":
            A_val = 1085.7

        x0 = fsolve(katz_melt_frac.mf_root_finding, 0,
                    (cond[1], cond[0], h2o, A_val))[0]

        if x0 > fcpx_out(cond[1], props[props_name]):
            x0 = katz_melt_frac.mf_opx(cond[1], cond[0],
                                       fcpx_out(cond[1], props[props_name]),
                                       h2o, A_val)
    else:
        return 0.0
    return x0