示例#1
0
文件: QSim_old.py 项目: temik42/QSim
def simulate(H, H0=5e5, P0=0.01, T0=5e5, dt=12):
    N = np.size(H)
    A = H0/P0#**2
    l = S.h_t(T0)
    #l=1e9
    
    P=P0
    
    I1 = np.zeros(N)  
    #I1[0] = 2*AIA.cresp(T0,'A171')*H0/lambda0*np.sqrt(T_tr)
    I1[0] = AIA.cresp(T0,'A171')*H0/(6*lambda0)#*q+AIA.tresp(T0,'A171')*(P0/(2*S.k_b*T0))**2*l*(1-q)
    
    #I2 = np.zeros(N)  
    #I2[0] = 2*AIA.cresp(T0,'A193')*H0/lambda0*np.sqrt(T_tr)
    #I2[0] = AIA.tresp(T0,'A193')*1e5*H0/(6*lambda0)#*q+AIA.tresp(T0,'A193')*(P0/(2*S.k_b*T0))**2*l*(1-q)   
    
    #I3 = np.zeros(N)      
    #I3[0] = 3*2.5e-20*H0/(6*lambda0)#*q+3*AIA.tresp(T0,'A131')*(P0/(2*S.k_b*T0))**2*l*(1-q)
    #I3[0] = 0#AIA.tresp(T0,'A193')*1e5*H0/(6*lambda0)    
    
    
    for i in range (1,N):        
        #dP = 2./3*(H[i] - A*P**2)/l*dt
        dP = 2./3*(H[i] - A*P)/l*dt
        P = P + dP
        #T = T0*(1+(P-P0)/P0*beta)
        T = T0*(P/P0)**beta        
        l = S.h_t(T)
        #I1[i] = 2*AIA.cresp(T, 'A171')*A*P**2/lambda0*np.sqrt(T_tr)
        #I2[i] = 2*AIA.cresp(T, 'A193')*A*P**2/lambda0*np.sqrt(T_tr)
        I1[i] = AIA.cresp(T,'A171')*A*P/(6*lambda0)
        #I2[i] = AIA.tresp(T,'A193')*1e5*A*P/(6*lambda0)
        #I3[i] = 3*2.5e-20*A*P/(6*lambda0)
        #I3[i] = 0#AIA.tresp(T,'A193')*1e5*A*P/(6*lambda0)
    return (I1)
示例#2
0
文件: hydropy1.py 项目: temik42/QSim
    def run(self):     
        self.status = 'in progress'
        if (self.each != 0):
            import matplotlib
            matplotlib.use('Agg')
            import matplotlib.pyplot as plt
            fig = plt.figure()
        
        for i in range(0,self.maxiter):
            self.hydrostep()
            self.time += self.dt
            if (self.each != 0):
                if (i % self.each == 0):
                    I1 = (self.rho/self.m)**2*AIA.t171(self.T)*1e8
                    I2 = (self.rho/self.m)**2*AIA.t193(self.T)*1e8
                    I3 = (self.rho/self.m)**2*AIA.t211(self.T)*1e8
                    self.I171 += [np.sum((I1*self.dx)[np.where(np.abs(self.s-self.L*0.5) < self.L*0.5-self.L*0.15)])/self.L]
                    self.I193 += [np.sum((I2*self.dx)[np.where(np.abs(self.s-self.L*0.5) < self.L*0.5-self.L*0.15)])/self.L]
                    self.I211 += [np.sum((I3*self.dx)[np.where(np.abs(self.s-self.L*0.5) < self.L*0.5-self.L*0.15)])/self.L]
                    
                    plt.subplot(211)
                    plt.title('Density 10^4 / Temperature', size = 18)
                    plt.plot(self.s, np.log10(self.rho/self.m)-4)
                    plt.plot(self.s, np.log10(self.T))
                    plt.axis([0,np.max(self.s),4,7])
                    #plt.axis([0,1e9,4,7])
                    plt.subplot(212)
                    #plt.plot(self.s, self.rhou)
                    #plt.axis([0,1e9,-1e-8,1e-8])
                    plt.title('AIA 171/193/211 intensity', size = 18)
                    plt.plot(self.s,np.log10(I1))
                    plt.plot(self.s,np.log10(I2))
                    plt.plot(self.s,np.log10(I3))
                    plt.axis([0,np.max(self.s),-2,4])
                    
                    fname = (img_dir + str(np.int(i/self.each)).zfill(np.ceil(np.log10(self.maxiter/self.each)).astype(np.int)) + '.png')
                    fig.savefig(fname)
                    fig.clf()

        self.status = 'done'