def infoR(doftotal, val): if r.topt == 1: pthick = [thick[i] * doftotal[i] for i in range(Nlayer)] dofold = doftotal[Nlayer:] else: pthick = thick dofold = doftotal df = f_symmetry(dofold, Mx, My, xsym, ysym, Nlayer=Nlayer) dof = b_filter(df, bproj) if r.inverse == 1: val = 1 / val rho = mload rhor = mload for i in range(Nlayer): mtmp = lam0 * pthick[i] * mstruct[i].density * np.mean( dof[i * Nx * Ny:(i + 1) * Nx * Ny]) rho = rho + mtmp rhor = rhor + mtmp rho = rho**r.mpower F = np.mean(gamma * beta / (1 - beta)**2) R = 1. / (1e9 * val * 2 * laserP / cons.c**3 / rho / F / beta[-1]) return (R, np.mean(dof), (rhor - mload) / mload, [pthick[i] * lam0 * 1e9 for i in range(Nlayer)])
def infoR(dofold,val): df = f_symmetry(dofold,Mx,My,xsym,ysym,Nlayer=Nlayer) dof = b_filter(df,bproj) rho = 0. mT = mload for i in range(Nlayer): mT = mT + thickness[i]*area*mstruct[i].density*np.mean(dof[i*Nx*Ny:(i+1)*Nx*Ny]) rho = rho + 1e3*thickness[i]*mstruct[i].density*np.mean(dof[i*Nx*Ny:(i+1)*Nx*Ny]) F = np.mean(gamma*beta*cons.c/(1-beta)**2) if RTmethod == 'D': R = 1./(1e9*val*2*laserP*area/cons.c**2/mT/F/beta[-1]) elif RTmethod == 'W': R = np.sqrt(rho)/val*(F/cons.c)*beta[-1] else: raise Exception('RTmethod undefined') return (R,np.mean(dof))
def rcwa_assembly(dofold,freq,theta,phi,planewave): ''' planewave:{'p_amp',...} ''' df = f_symmetry(dofold,Mx,My,xsym,ysym,Nlayer=Nlayer) dof = b_filter(df,bproj) obj = rcwa.RCWA_obj(nG,L1,L2,freq,theta,phi,verbose=0) obj.Add_LayerUniform(thick0,epsuniform) epsdiff=[] for i in range(Nlayer): epsdiff.append(mstruct[i].epsilon(lam0/np.real(freq),x_type = 'lambda')-epsbkg) obj.Add_LayerGrid(thick[i],epsdiff[i],epsbkg,Nx,Ny) obj.Add_LayerUniform(thickN,epsuniform) obj.Init_Setup(Gmethod=0) obj.MakeExcitationPlanewave(planewave['p_amp'],planewave['p_phase'],planewave['s_amp'],planewave['s_phase'],order = 0) obj.GridLayer_getDOF(dof) return obj,dof,epsdiff
def infoR(doftotal, val): if r.topt == 1 and r.Popt == 0: pthick = [ r.tmin / lam0 + (thick[i] - r.tmin / lam0) * doftotal[i] for i in range(Nlayer) ] pscale = 1. dofold = doftotal[Nlayer:] elif r.topt == 0 and r.Popt == 1: pthick = thick pscale = 1. + (r.Periodmax - r.Period) / r.Period * doftotal[0] dofold = doftotal[1:] elif r.topt == 1 and r.Popt == 1: pscale = 1. + (r.Periodmax - r.Period) / r.Period * doftotal[0] pthick = [ r.tmin / lam0 + (thick[i] - r.tmin / lam0) * doftotal[1 + i] for i in range(Nlayer) ] dofold = doftotal[Nlayer + 1:] else: pscale = 1. pthick = thick dofold = doftotal df = f_symmetry(dofold, Mx, My, xsym, ysym, Nlayer=Nlayer) dof = b_filter(df, bproj) if r.inverse == 1: val = 1 / val rho = mload rhor = mload for i in range(Nlayer): mtmp = lam0 * pthick[i] * mstruct[i].density * np.mean( dof[i * Nx * Ny:(i + 1) * Nx * Ny]) rho = rho + mtmp rhor = rhor + mtmp rho = rho**r.mpower F = np.mean(gamma * beta / (1 - beta)**2) R = 1. / (1e9 * val * 2 * laserP / cons.c**3 / rho / F / beta[-1]) return (R, np.mean(dof), (rhor - mload) / mload, 1e6 * pscale * r.Period, [pthick[i] * lam0 * 1e9 for i in range(Nlayer)])