def dD_du(u, X, Y, gamma, Nz, Nx): num_term = 10 #in future will be global or define in a settings file hdt = HotDiTen(X, Y, gamma, Nz, Nx, num_term) dielTen = [ hdt.Kxx(), hdt.Kyy(), hdt.Kzz(), hdt.Cxy(), hdt.Cxz(), hdt.Cyz() ] ddt = DerivOfHotDiTen(X, Y, gamma, Nz, Nx, num_term) derivOfDielTen = [ ddt.dKxx_du(u), ddt.dKyy_du(u), ddt.dKzz_du(u), ddt.dCxy_du(u), ddt.dCxz_du(u), ddt.dCyz_du(u) ] val = dA_du(u, Nz, dielTen, derivOfDielTen) + dB_du( u, Nz, dielTen, derivOfDielTen) / Nx**2 - 2 / Nx**3 * B(Nz, dielTen) * H( u, "Nx") + dC_du(u, Nz, dielTen, derivOfDielTen) / Nx**4 - 4 * C( Nz, dielTen) / Nx**5 * H(u, "Nx") #print val,derivOfDielTen return val
def dB_du(u,Nz,dielTen, derivOfDielTen): Kxx,Kyy,Kzz,Cxy,Cxz,Cyz = dielTen dKxx_du, dKyy_du, dKzz_du, dCxy_du, dCxz_du, dCyz_du = derivOfDielTen T1 = Nz**3*dCxz_du+3*Nz**2*Cxz*H(u,"Nz") T2 = dKxx_du+dKzz_du+2*Cyz*dCyz_du+2*Cxz*dCxz_du #Nz**2 T3 = Kxx+Kzz+Cyz**2+Cxz**2 # H T4 = Cxy*dCyz_du + Cyz*dCxy_du+Kyy*dCxz_du+Cxz*dKyy_du #Nz T5 = Cxy*Cyz + Kyy*Cxz # H T6 = -Kxx*(dKyy_du+dKzz_du) - (Kyy+Kzz)*dKxx_du + 2*Cxy*dCxy_du\ -2*Kxx*Cyz*dCyz_du - Cyz**2*dKxx_du T7 = -2*(Cxz*Cyz*dCxy_du + Cxz*Cxy*dCyz_du + Cyz*Cxy*dCxz_du) - Cxz**2*dKyy_du - 2*Cxz*Kyy*dCxz_du #print "T",T1,T2,T3,T4,T5,T6,T7 return 2*T1 + T2*Nz**2 + 2*Nz*T3*H(u,"Nz") - 2*T4*Nz - 2*T5*H(u,"Nz")+T6 + T7
def dD_du(u,X,Y,gamma,Nz,Nx): num_term = 10 #in future will be global or define in a settings file hdt=HotDiTen(X,Y,gamma,Nz,Nx,num_term) dielTen = [hdt.Kxx(),hdt.Kyy(),hdt.Kzz(),hdt.Cxy(),hdt.Cxz(),hdt.Cyz()] ddt = DerivOfHotDiTen(X,Y,gamma,Nz,Nx,num_term) derivOfDielTen = [ddt.dKxx_du(u), ddt.dKyy_du(u), ddt.dKzz_du(u), ddt.dCxy_du(u), ddt.dCxz_du(u), ddt.dCyz_du(u)] #print( dielTen) #print dA_du(u,Nz,dielTen,derivOfDielTen),dB_du(u,Nz,dielTen,derivOfDielTen),dC_du(u,Nz,dielTen,derivOfDielTen) return Nx**4*dA_du(u,Nz,dielTen,derivOfDielTen) + 4*Nx**3*A(Nz,dielTen)*H(u,"Nx") + Nx**2*dB_du(u,Nz,dielTen,derivOfDielTen) + 2*Nx*B(Nz,dielTen)*H(u,"Nx") + dC_du(u,Nz,dielTen,derivOfDielTen)
def dD_du(u,X,Yabs,Nz,Nx,m): sin_theta=Nx/np.sqrt(Nx**2+Nz**2) return -2*( Nx*H(u,"Nx")+Nz*H(u,"Nz") + ( (1-2*X)*Q(X,Yabs,Nz,Nx,m)*H(u,"X")-X*(1-X)*dQ_du(u,X,Yabs,Nz,Nx,m) )/Q(X,Yabs,Nz,Nx,m)**2 )
def dG_du(u,X,Yabs,Nz,Nx): return ( 2*Yabs**3*sinTh(Nz,Nx)**4*H(u,"Y") + Yabs**4*sinTh(Nz,Nx)**2*dSin2Th_du(u,Nz,Nx)\ + 2*Yabs*(1-X) * ( 2*cosTh(Nz,Nx)**2*H(u,"Y")*(1-X)\ - Yabs*( 2*H(u,"X")*cosTh(Nz,Nx)**2\ + (1-X)*dSin2Th_du(u,Nz,Nx)) ) )/G(X,Yabs,Nz,Nx)
def dSin2Th_du(u,Nz,Nx): return 2*Nx*Nz*( Nz*H(u,"Nx")-Nx*H(u,"Nz") ) / ( Nx**2+Nz**2 )**2
def dQ_du(u,X,Yabs,Nz,Nx,m): if m=="Om": return -( 2*H(u,"X")+2*Yabs*sinTh(Nz,Nx)**2*H(u,"Y")+Yabs**2*dSin2Th_du(u,Nz,Nx) - dG_du(u,X,Yabs,Nz,Nx) ) else: return -( 2*H(u,"X")+2*Yabs*sinTh(Nz,Nx)**2*H(u,"Y")+Yabs**2*dSin2Th_du(u,Nz,Nx) + dG_du(u,X,Yabs,Nz,Nx) )
def pdByz_du(self, u): return 1 / self.X * H(u, "X") - self.dlam_du(u) - 1 / self.Yabs * H( u, "Y") - 1 / self.Nz * H(u, "Nz")
def pdBxy_du(self, u): return 1 / self.X * H(u, "X") + 1 / self.zeta(0) * self.dzetan_du( u, 0) - self.dlam_du(u)
def dzetan_du(self, u, n): zeta_n = self.zeta(n) #print (1+n*self.Yabs) #if (1+n*self.Yabs) return zeta_n * (n / (1 + n * self.Yabs) * H(u, "Y") - 1 / self.Nz * H(u, "Nz") - 1 / self.gamma * H(u, "gamma"))
def dlam_du(self, u): return 2 * self.l * (1 / self.Nx * H(u, "Nx") + 1 / self.gamma * H(u, "gamma") - 1 / self.Yabs * H(u, "Y"))
def dA_du(u,Nz,dielTen, derivOfDielTen): Kxx,Kyy,Kzz,Cxy,Cxz,Cyz = dielTen dKxx_du, dKyy_du, dKzz_du, dCxy_du, dCxz_du, dCyz_du = derivOfDielTen return 2*(Nz*dCxz_du+Cxz*H(u,"Nz"))+dKxx_du+2*Cxz*dCxz_du
def dC_du(u,Nz,dielTen, derivOfDielTen): Kxx,Kyy,Kzz,Cxy,Cxz,Cyz = dielTen dKxx_du, dKyy_du, dKzz_du, dCxy_du, dCxz_du, dCyz_du = derivOfDielTen return C(Nz,dielTen)/Kzz*dKzz_du + Kzz*( 4*Nz**3*H(u,"Nz") - 2*Nz*(Kxx+Kyy)*H(u,"Nz") - Nz**2*(dKxx_du+dKyy_du)+Kxx*dKyy_du+Kyy*dKxx_du-2*Cxy*dCxy_du )