Пример #1
0
 def calc_line_current(self, variation, junc_line_name):
     lv = self.get_lv(variation)
     calc = CalcObject([], self.setup)
     calc = calc.getQty("H").imag().integrate_line_tangent(
         name=junc_line_name)
     #self.design.Clear_Field_Clac_Stack()
     return calc.evaluate(lv=lv)
Пример #2
0
    def get_Qsurface(self, mode, variation):
        '''
        caculate the contribution to Q of a dieletric layer of dirt on all surfaces
        set the dirt thickness and loss tangent in the config file
        ref: http://arxiv.org/pdf/1509.01854.pdf
        '''
        lv = self.get_lv(variation)
        Qsurf = {}
        print 'Calculating Qsurface for mode ' + str(mode) + ' (' + str(mode) + '/' + str(self.nmodes-1) + ')'
#        A = self.fields.Mag_E**2
#        A = A.integrate_vol(name='AllObjects')
#        U_surf = A.evaluate(lv=lv)
        calcobject=CalcObject([],self.setup)
        vecE=calcobject.getQty("E")
        A=vecE
        B=vecE.conj()
        A=A.dot(B)
        A=A.real()
        A=A.integrate_surf(name='AllObjects')
        U_surf = A.evaluate(lv=lv)
        U_surf *= th*epsilon_0*eps_r
        p_surf = U_surf/self.U_E
        Qsurf['Qsurf_'+str(mode)] = 1/(p_surf*tan_delta_surf)
        print 'p_surf'+'_'+str(mode)+' = ' + str(p_surf)
        return Series(Qsurf)
Пример #3
0
 def get_Qsurface(self, mode, variation):
     '''
     caculate the contribution to Q of a dieletric layer of dirt on all surfaces
     set the dirt thickness and loss tangent in the config file
     ref: http://arxiv.org/pdf/1509.01854.pdf
     '''
     lv = self.get_lv(variation)
     Qsurf = {}
     print 'Calculating Qsurface for mode ' + str(mode) + ' (' + str(
         mode) + '/' + str(self.nmodes - 1) + ')'
     #        A = self.fields.Mag_E**2
     #        A = A.integrate_vol(name='AllObjects')
     #        U_surf = A.evaluate(lv=lv)
     calcobject = CalcObject([], self.setup)
     vecE = calcobject.getQty("E")
     A = vecE
     B = vecE.conj()
     A = A.dot(B)
     A = A.real()
     A = A.integrate_surf(name='AllObjects')
     U_surf = A.evaluate(lv=lv)
     U_surf *= th * epsilon_0 * eps_r
     p_surf = U_surf / self.U_E
     Qsurf['Qsurf_' + str(mode)] = 1 / (p_surf * tan_delta_surf)
     print 'p_surf' + '_' + str(mode) + ' = ' + str(p_surf)
     return Series(Qsurf)
Пример #4
0
 def calc_avg_current_J_surf_mag(self, variation, junc_rect, junc_len):
     ''' Peak current I_max for mdoe J in junction J  
         The avg. is over the surface of the junction. I.e., spatial. '''
     lv   = self.get_lv(variation)
     calc = CalcObject([],self.setup)
     calc = calc.getQty("Jsurf").mag().integrate_surf(name = junc_rect)
     I    = calc.evaluate(lv=lv) / junc_len #phase = 90
     #self.design.Clear_Field_Clac_Stack()
     return  I
Пример #5
0
 def calc_avg_current_J_surf_mag(self, variation, junc_rect, junc_len):
     ''' Peak current I_max for mdoe J in junction J  
         The avg. is over the surface of the junction. I.e., spatial. '''
     lv = self.get_lv(variation)
     calc = CalcObject([], self.setup)
     calc = calc.getQty("Jsurf").mag().integrate_surf(name=junc_rect)
     I = calc.evaluate(lv=lv) / junc_len  #phase = 90
     #self.design.Clear_Field_Clac_Stack()
     return I
Пример #6
0
 def calc_U_H(self, variation, volume=None):
     lv = self.get_lv(variation)
     if volume is None:
         volume = 'AllObjects'
     else:
         pass
     calcobject=CalcObject([],self.setup)
     vecH=calcobject.getQty("H")
     A=vecH.times_mu()
     B=vecH.conj()
     A=A.dot(B)
     A=A.real()
     A=A.integrate_vol(name=volume)
     return A.evaluate(lv=lv)
Пример #7
0
 def calc_U_H(self, variation, volume=None):
     lv = self.get_lv(variation)
     if volume is None:
         volume = 'AllObjects'
     else:
         pass
     calcobject=CalcObject([],self.setup)
     vecH=calcobject.getQty("H")
     A=vecH.times_mu()
     B=vecH.conj()
     A=A.dot(B)
     A=A.real()
     A=A.integrate_vol(name=volume)
     return A.evaluate(lv=lv)
Пример #8
0
 def calc_U_E(self, variation, volume=None):
     ''' This is 2 * the peak electric energy.(since we do not divide by 2, and use the peak phasors) '''
     lv = self.get_lv(variation)
     if volume is None:
         volume = 'AllObjects'
     else:
         pass
     calcobject=CalcObject([],self.setup)
     vecE=calcobject.getQty("E")
     A=vecE.times_eps()
     B=vecE.conj()
     A=A.dot(B)
     A=A.real()
     A=A.integrate_vol(name=volume)
     return A.evaluate(lv=lv)
Пример #9
0
 def calc_U_E(self, variation, volume=None):
     ''' This is 2 * the peak electric energy.(since we do not divide by 2, and use the peak phasors) '''
     lv = self.get_lv(variation)
     if volume is None:
         volume = 'AllObjects'
     else:
         pass
     calcobject=CalcObject([],self.setup)
     vecE=calcobject.getQty("E")
     A=vecE.times_eps()
     B=vecE.conj()
     A=A.dot(B)
     A=A.real()
     A=A.integrate_vol(name=volume)
     return A.evaluate(lv=lv)
Пример #10
0
             **args)
    ax9.set_ylabel('$\\chi_{DC}$ (MHz)')
    ax8.plot(SWP, [r[ID][1, 2] for r in RES],
             label='$\\chi_{BC}$',
             c='r',
             **args)
    ax8.set_ylabel('$\\chi_{BC}$ (MHz)')
    ax9.set_xlabel(swpvar)
    ax7.set_title('cross-Kerr')
    #ax7.axhspan(85,150,  alpha =0.4, color= 'b')
    ax8.axhspan(5.5, 6.5, alpha=0.4, color='b')
    ax9.axhline(0.5, alpha=0.4, color='b')
    fig.tight_layout()
#%%
if 0:
    variation = '0'
    pJ_method = 'J_surf_mag'
    #pJ_mj_series = bbp.calc_Pjs_from_I_for_mode(variation, bbp.U_H,bbp.U_E, bbp.LJs, junc_rects, junc_lens, method = pJ_method) # to be implemented
    res = bbp.calc_avg_current_J_surf_mag(variation, junc_rects[0],
                                          junc_lens[0])

if 0:  # for debug
    variation = '0'
    junc_rect = 'juncV'
    print_color(' Setup: ' + bbp.setup.name)
    lv = bbp.get_lv(variation)
    calc = CalcObject([], bbp.setup)
    calc = calc.getQty("Jsurf").mag().integrate_surf(name=junc_rect)

    #bbp.calc_avg_current_J_surf_mag('0','juncV',1)
Пример #11
0
 def calc_line_current(self, variation, junc_line_name):
     lv   = self.get_lv(variation)
     calc = CalcObject([],self.setup)
     calc = calc.getQty("H").imag().integrate_line_tangent(name = junc_line_name)
     #self.design.Clear_Field_Clac_Stack()
     return calc.evaluate(lv=lv)
Пример #12
0
    Y = {}
    for key in tets.keys():
        Y[varsz[key]] = tets[key]
    y =  pd.Series(Y ) #.values(), index = varsz.values())
    y.plot(marker = '*', ms = 20)
    ax7t = ax7.twinx()
    ax7t.plot(y, marker = '*', ms = 10, c = 'g')
#%%
if 1:
    fig = plt.figure(21); fig.clf()
    tts = bba.get_convergences_Tets_vs_pass()
    for key, x in tts.iteritems():
        #np.log10(x).plot(label = varsz[key])
        x.plot(label = varsz[key])
    plt.legend(loc = 0)        
    
#%%
if 0: 
    variation = '0';  pJ_method = 'J_surf_mag';
    #pJ_mj_series = bbp.calc_Pjs_from_I_for_mode(variation, bbp.U_H,bbp.U_E, bbp.LJs, junc_rects, junc_lens, method = pJ_method) # to be implemented          
    res = bbp.calc_avg_current_J_surf_mag(variation,junc_rects[0], junc_lens[0])
    
if 0: # for debug 
    variation = '0'; junc_rect = 'juncV';
    print_color(' Setup: ' + bbp.setup.name)
    lv = bbp.get_lv(variation)
    calc = CalcObject([],bbp.setup)
    calc = calc.getQty("Jsurf").mag().integrate_surf(name = junc_rect)
 
    #bbp.calc_avg_current_J_surf_mag('0','juncV',1)