def computeL(ld, so, T, c): if T == (): T = so.BX allpsi = dpb.mapNtoD(so, ld, T, c, so.s0) # --------------------------------------- Lo = ly.layerpotS(s=so) Ld = ly.layerpotS(s=ld, t=so) L = Lo.dot(allpsi[0:so.n]) + Ld.dot(allpsi[so.n::]) # means = sum(np.diagflat(so.w).dot(L)) / sum(so.w) # correct? strange sum by rows means = np.ones(so.n).dot(np.diagflat(so.w).dot(L)) / sum(so.w) L = L - np.array([means for k in range(so.n)]) return L
def computeU(allpsi, ld, so, sb): kerS = ly.layerpotS(s=ld, t=so) kerSD = ly.layerpotSD(s=ld, t=so) U_psi = kerS.dot(allpsi) U_psi_nu = kerSD.dot(allpsi) U_psi = U_psi.T.dot(np.diag(so.w)) U_psi_nu = U_psi_nu.T.dot(np.diag(so.w)) U = ly.layerpotS(s=so, t=sb) U_nu = ly.layerpotD(s=so, t=sb) U = U + U_psi U_nu = U_nu + U_psi_nu return (U, U_nu)
def computeL0(so, T): if T == (): T = so.BX allpsi = dpb.mapNtoD0(so, T, so.s0) # --------------------------------------- Lo = ly.layerpotS(s=so) L0 = Lo.dot(allpsi) means = np.ones(so.n).dot(np.diagflat(so.w).dot(L0)) / sum(so.w) L0 = L0 - np.array([means for k in range(so.n)]) return L0
def plotdpb(l, z0, x1_x2_xn, y1_y2_yn=((), (), ()), psi=(), t='im', l2=()): x, y, pp = plot.meshgrid(x1_x2_xn, y1_y2_yn) lPsi = sg.Layer(b=l.b, exp=ly.layerpotS, dns=l.dns) if psi != (): lPsi.dns = psi pp = sg.Pointset(pp) #uPsi = sg.eval_layer(lPsi, pp) uPsi = ly.layerpotS(s=l.b[0], t=pp).dot(lPsi.dns) if z0 != (): uPhi = ly.fundsol(abs(pp.x - z0), 0) else: uPhi = np.zeros(uPsi.shape) if l2 != (): l2Psi = sg.Layer(b=l2.b, exp=ly.layerpotS, dns=l2.dns) uPsi = uPsi + ly.layerpotS(s=l2.b[0], t=pp).dot(l2Psi.dns) plot.plot(x, y, uPsi + uPhi, t=t, show=0) # l.plot(p=True) # so.plot(p=True) # sb.plot(p=True) # print('z0', z0 ) plt.show(block=False) return
def computeR(allpsi, ld, so, sb, sv=(), testset=1): if sv == (): sv = sb nso, nsb = so.n, sb.n U, U_nu = computeU(allpsi, ld, so, sb) testset = 1 if testset == 1 or testset == 3: V1 = ly.layerpotS(s=sv, t=so) V1_nu = ly.layerpotSD(s=sv, t=so) R1 = U.dot(V1_nu) - U_nu.dot(V1) R = R1 if testset == 2 or testset == 3: V2 = ly.layerpotD(s=sv, t=so) V2_nu = ly.layerpotDD(s=sv, t=so) R2 = U.dot(V2_nu) - U_nu.dot(V2) R = R2 if testset == 3: R = np.concatenate((R1.T, R2.T)).T if verbose: print(' R.shape = ', R.shape) return (R, U, U_nu)