def covariance_wind(f, c0, rho, distance, L, Cv, steps=10, initial=0.001): """Covariance. Wind fluctuations only. :param f: Frequency :param c0: Speed of sound :param rho: Spatia separation :param distance: Distance :param L: Correlation length :param Cv: Variance of wind speed :param initial: Initial value """ f = np.asarray(f) k = 2.*np.pi*f / c0 K0 = 2.*np.pi / L A = 5.0/(18.0*np.pi*gamma(1./3.)) # Equation 11, see text below. Approximate result is 0.033 gamma_v = 3./10.*np.pi**2.*A*k**2.*K0**(-5./3.)*4.*(Cv/c0)**2. # Equation 28, only wind fluctuations krho = k * rho t = krho[:, None] * np.linspace(0.00000000001, 1., steps) # Fine discretization for integration #t[t==0.0] = 1.e-20 gamma56 = gamma(5./6.) bessel56 = besselk(5./6., t) bessel16 = besselk(1./6., t) integration = cumtrapz(ne.evaluate("2.0**(1./6.)*t**(5./6.)/gamma56 * (bessel56 - t/2.0 * bessel16 )"), initial=initial)[:,-1] B = ne.evaluate("2.0*gamma_v * distance / krho * integration") #B = 2.0*gamma_v * distance / krho * cumtrapz((2.0**(1./6.)*t**(5./6.)/gamma(5./6.) * (besselk(5./6., t) - t/2.0*besselk(1./6., t)) ), initial=initial)[:,-1] return B
def grad2Vg_64(x, y, z, sigma, g, gi, gj, bi, bj): return (g**2 * sigma**4 * (-120 * g * z**6 * (g * z * besselk(0, g * z) + 8 * besselk(1, g * z)) + z * (19 * g**4 * sigma**6 * z**2 + 480 * z**4 * (-6 + (gi**2 + gj**2) * z**2) - 8 * g**2 * (45 * z**6 + sigma**6 * (-110 + (gi**2 + gj**2) * z**2))) * besselk(2, g * z) + g * (-1680 * z**6 + sigma**6 * (5280 + z**2 * (-48 * (gi**2 + gj**2) + g**4 * z**2 + g**2 * (224 - (gi**2 + gj**2) * z**2)))) * besselk(3, g * z)) * cos(gi * (bi + x) + gj * (bj + y))) / (960 * z**9)
def trapes_analytical(h): N=int(round(1.0/h)) # number of unknowns, assuming the RHS boundary value is known x=np.arange(N+1)*h # x = np.linspace(0, 1, N) z0 = 4*sqrt(2) z1 = 8 g = sqrt(2)/8 k1z0, i0z1 = besselk(1, z0), besseli(0, z1) k0z1, i1z0 = besselk(0, z1), besseli(1, z0) k0z0, i0z0 = besselk(0, z0), besseli(0, z0) J = k1z0*i0z1 + k0z1*i1z0 + g*(k0z0*i0z1 - k0z1*i0z0) A = (k1z0 + g*k0z0)/J B = (i1z0 - g*i0z0)/J z = sqrt(32.*(1 + x)) theta = A* besseli(0, z) + B* besselk(0, z) dtheta = 16*(A*besseli(1, z) - B*besselk(1, z))/z return x, theta, dtheta
def set_qpabsb_eff(self, l_fin, h_fin, loverlap, l_TES, eff_absb=1.22e-4): ci = 2 * l_TES ri = ci / (2 * np.pi) a = (l_fin + l_TES) / 2 b = l_fin co1 = 2 * l_TES + 2 * np.pi * l_fin h = ((a - b) / (a + b)) ** 2 co = np.pi * (a + b) * (1 + 3 * h / (10 + np.sqrt(4 - 3 * h))) ro = co1 / (2 * np.pi) # -------- Relevant length scales # Diffusion length ld = 567 * h_fin # µm # Surface impedance length la = 1 /eff_absb*h_fin**2/loverlap # µm la_chk = (1e6 + 1600 / (900 ** 2) * 5) * (h_fin ** 2) # µm # -------- Dimensionless Scales rhoi = ri / ld rhoo = ro / ld lambdaA = la / ld # QP collection coefficient """fQP = 2 * rhoi / (rhoo ** 2 - rhoi ** 2) * \ (iv(1, rhoo) * kv(1, rhoi) - iv(1, rhoi) * kv(1, rhoo)) / \ (iv(1, rhoo) * kv(0, rhoi) + lambdaA * kv(1, rhoi) + (iv(0, rhoi) - lambdaA * iv(1, rhoi)) * kv(1, rhoo)) fQP = 2 * rhoi / (rhoo**2 - rhoi**2) * (iv(1, rhoo) * kv(1, rhoi) - iv(1, rhoi) * kv(1, rhoo)) / \ (iv(1, rhoo) * (kv(0, rhoi) + lambdaA * kv(1, rhoi)) + (iv(0, rhoi) - lambdaA*iv(1, rhoi))*kv(1, rhoo))""" fQP = 2 * rhoi / (rhoo ** 2 - rhoi ** 2) \ *(besseli(1, rhoo) * besselk(1, rhoi) - besseli(1, rhoi) * besselk(1, rhoo)) \ / (besseli(1, rhoo) * (besselk(0, rhoi) + lambdaA * besselk(1, rhoi)) + (besseli(0, rhoi) - lambdaA * besseli(1, rhoi)) * besselk(1, rhoo)) self._eQPabsb = fQP
def matern(d, rho, nu, phi=1): ''' Modified from matern.m in the BFDA package for Matlab (Yang & Ren, 206) Downloaded 2020-12-11 Yang J, Ren P (2019). BFDA: A matlab toolbox for bayesian functional data analysis. J Stat Soft 89(2): doi: 10.18637/jss.v089.i02 10.18637/jss.v089.i02 https://www.jstatsoft.org/article/view/v089i02 ''' dm = (d * sqrt(2*nu)) / rho dm[dm==0] = 1e-10 con = 1 / ( 2**(nu-1) * gamma(nu) ) cov = phi * con * (dm**nu) * besselk(nu, dm) return cov
def gradVg_z_64(x, y, z, sigma, g, gi, gj, bi, bj): return -(g**3 * sigma**4 * ( 10 * (g**2 * sigma**6 * z - 48 * z**5) * besselk(3, g * z) + g * sigma**6 * (80 + g**2 * z**2) * besselk(4, g * z)) * cos(gi * (bi + x) + gj * (bj + y))) / (960 * z**7)
def gradVg_y_64(x, y, z, sigma, g, gi, gj, bi, bj): return -(g**2 * gj * sigma**4 * (-480 * z**3 * besselk(2, g * z) + g**3 * sigma**6 * besselk(5, g * z)) * sin(gi * (bi + x) + gj * (bj + y))) / (960 * z**5)
def Vg_64(x, y, z, sigma, g, gi, gj, bi, bj): return (g**2 * sigma**4 * (-480 * z**3 * besselk(2, g * z) + g**3 * sigma**6 * besselk(5, g * z)) * np.cos(gi * (bi + x) + gj * (bj + y))) / (960 * z**5)
def set_qpabsb_eff_matt(self): """ Calculate the QP collection efficiciency using Matt's method. Sets class atribute slef.eQPabsb Parameters: ----------- eff_absb : float, optional W/Al transmition/trapping probability """ # From Effqp_2D_moffatt.m in Matt's dropbox # Here we are using Robert Moffatt's full QP model. There are some pretty big assumptions: # 1) Diffusion length scales with Al thickness (trapping surface dominated and diffusion thickness limited) # 2) Absorption length scales with Al thickness**2/l_overlap # Future: scale boundary impedance with W thickness # INPUTS: # 1) fin length [um] # 2) fin height [um] # 3) W/Al overlap [um] # 4) TES length [um] # 5) W/Al transmition/trapping probability # OUTPUTS: # 1) Quasi-Particle Collection Efficiency # 2) Diffusion Length # 3) W/Al Surface Absorption Length # 4) W/Al Transmission Probability # https://www.stanford.edu/~rmoffatt/Papers/Diffusion%20and%20Absorption%20with%201D%20and%202D%20Solutions.pdf # DOI: 10.1007/s10909-015-1406-7 # ------------------------------------------------------------------------------------------------------------- l_tes = self.TES.l * 1e6 #convert to [um] l_fin = self.l_fin * 1e6 #convert to [um] h_fin = self.h_fin * 1e6 #convert to [um] l_overlap = self.TES.l_overlap * 1e6 #convert to [um] n_fin = self.TES.n_fin eff_absb = self.eff_absb # We assume pie shaped QP collection fins ci = 2 * l_tes # inner circle circumferance ri = ci / (2 * np.pi) # inner radius # Outer circumferance of "very simplified" ellipse co1 = 2 * l_tes + 2 * np.pi * l_fin # Another approximation... a = (l_fin + l_tes) / 2 b = l_fin # https://www.mathsisfun.com/geometry/ellipse-perimeter.html h = ((a - b) / (a + b))**2 co = np.pi * (a + b) * (1 + 3 * h / (10 + np.sqrt(4 - 3 * h))) ro = co1 / (2 * np.pi) # -------- Relevant length scales ------------ # Diffusion length ld = 567 * h_fin # [µm] this is the fit in Jeff's published LTD 16 data self.ld = ld # Surface impedance length la = (1 / eff_absb) * (h_fin**2 / l_overlap ) # [µm] these match the values used by Noah la_chk = (1e6 + 1600 / (900**2) * 5) * (h_fin**2) # µm self.la = la # -------- Dimensionless Scales ------- rhoi = ri / ld rhoo = ro / ld lambdaA = la / ld # QP collection coefficient fQP = (2 * rhoi / (rhoo ** 2 - rhoi ** 2)) \ *(besseli(1, rhoo) * besselk(1, rhoi) - besseli(1, rhoi) * besselk(1, rhoo)) \ / (besseli(1, rhoo) * (besselk(0, rhoi) + lambdaA * besselk(1, rhoi)) + (besseli(0, rhoi) - lambdaA * besseli(1, rhoi)) * besselk(1, rhoo)) self.eQPabsb = fQP