def _getCasingHertzMagDipole2Deriv_z_r(srcloc, obsloc, freq, sigma, a, b, mu=mu_0 * np.ones(3), eps=epsilon_0, moment=1.): HertzZ = _getCasingHertzMagDipole(srcloc, obsloc, freq, sigma, a, b, mu, eps, moment) dHertzZdr = _getCasingHertzMagDipoleDeriv_r(srcloc, obsloc, freq, sigma, a, b, mu, eps, moment) nobs = obsloc.shape[0] dxyz = obsloc - np.c_[np.ones(nobs)] * np.r_[srcloc] r2 = _r2(dxyz[:, :2]) r = np.sqrt(r2) z = dxyz[:, 2] sqrtr2z2 = np.sqrt(r2 + z**2) k2 = k(freq, sigma[2], mu[2], eps) return dHertzZdr * (-z / sqrtr2z2) * (1j * k2 + 1. / sqrtr2z2) + HertzZ * ( z * r / sqrtr2z2**3) * (1j * k2 + 2. / sqrtr2z2)
def _getCasingHertzMagDipoleDeriv_z(srcloc,obsloc,freq,sigma,a,b,mu=mu_0*np.ones(3),eps=epsilon_0,moment=1.): HertzZ = _getCasingHertzMagDipole(srcloc,obsloc,freq,sigma,a,b,mu,eps,moment) nobs = obsloc.shape[0] dxyz = obsloc - np.c_[np.ones(nobs)]*np.r_[srcloc] r2z2 = _r2(dxyz) sqrtr2z2 = np.sqrt(r2z2) k2 = k(freq,sigma[2],mu[2],eps) return -HertzZ*dxyz[:,2] /sqrtr2z2 * (1j*k2 + 1./sqrtr2z2)
def _getCasingHertzMagDipole(srcloc,obsloc,freq,sigma,a,b,mu=mu_0*np.ones(3),eps=epsilon_0,moment=1.): Kc1 = getKc(freq,sigma[1],a,b,mu[1],eps) nobs = obsloc.shape[0] dxyz = obsloc - np.c_[np.ones(nobs)]*np.r_[srcloc] r2 = _r2(dxyz[:,:2]) sqrtr2z2 = np.sqrt(r2 + dxyz[:,2]**2) k2 = k(freq,sigma[2],mu[2],eps) return Kc1 * moment / (4.*np.pi) *np.exp(-1j*k2*sqrtr2z2) / sqrtr2z2
def _getCasingHertzMagDipole2Deriv_z_z(srcloc,obsloc,freq,sigma,a,b,mu=mu_0*np.ones(3),eps=epsilon_0,moment=1.): HertzZ = _getCasingHertzMagDipole(srcloc,obsloc,freq,sigma,a,b,mu,eps,moment) dHertzZdz = _getCasingHertzMagDipoleDeriv_z(srcloc,obsloc,freq,sigma,a,b,mu,eps,moment) nobs = obsloc.shape[0] dxyz = obsloc - np.c_[np.ones(nobs)]*np.r_[srcloc] r2 = _r2(dxyz[:,:2]) r = np.sqrt(r2) z = dxyz[:,2] sqrtr2z2 = np.sqrt(r2 + z**2) k2 = k(freq,sigma[2],mu[2],eps) return (dHertzZdz*z + HertzZ)/sqrtr2z2*(-1j*k2 - 1./sqrtr2z2) + HertzZ*z/sqrtr2z2**3*(1j*k2*z + 2.*z/sqrtr2z2)
def getCasingHzMagDipole(srcloc, obsloc, freq, sigma, a, b, mu=mu_0 * np.ones(3), eps=epsilon_0, moment=1.): d2HertzZdz2 = _getCasingHertzMagDipole2Deriv_z_z(srcloc, obsloc, freq, sigma, a, b, mu, eps, moment) k2 = k(freq, sigma[2], mu[2], eps) HertzZ = _getCasingHertzMagDipole(srcloc, obsloc, freq, sigma, a, b, mu, eps, moment) return d2HertzZdz2 + k2**2 * HertzZ
def _Propagate(f, thickness, sig, chg, taux, c, mu_r, eps_r, n): if isinstance(eps_r, float): epsmodel = np.ones_like(sig) * eps_r else: epsmodel = eps_r if isinstance(mu_r, float): mumodel = np.ones_like(sig) * mu_r else: epsmodel = mu_r sigcm = np.zeros_like(sig, dtype='complex_') if chg == 0. or taux == 0. or c == 0.: sigcm = sig else: for j in range(1, len(sigcm)): sigcm[j] = _PCC(sig[j], chg[j], taux[j], c[j], f) sigcm = np.append(np.r_[0.], sigcm) mu = np.append(np.r_[1.], mumodel) * mu_0 eps = np.append(np.r_[1.], epsmodel) * epsilon_0 H = np.append(np.r_[1.2 * (1e5)], thickness) K = k(f, sigcm, mu, eps) Z = _ImpZ(f, mu, K) EH = np.matrix(np.zeros((2, n + 1), dtype='complex_'), dtype='complex_') UD = np.matrix(np.zeros((2, n + 1), dtype='complex_'), dtype='complex_') UD[1, -1] = 1. for i in range(-2, -(n + 2), -1): UD[:, i] = _Tinv(H[i + 1], K[i]) * _Pinv(Z[i]) * _P( Z[i + 1]) * UD[:, i + 1] UD = UD / ((np.abs(UD[0, :] + UD[1, :])).max()) for j in range(0, n + 1): EH[:, j] = np.matrix([[ 1., 1, ], [-1. / Z[j], 1. / Z[j]]]) * UD[:, j] return UD, EH, Z, K
def _getCasingHertzMagDipole(srcloc, obsloc, freq, sigma, a, b, mu=mu_0 * np.ones(3), eps=epsilon_0, moment=1.): Kc1 = getKc(freq, sigma[1], a, b, mu[1], eps) nobs = obsloc.shape[0] dxyz = obsloc - np.c_[np.ones(nobs)] * np.r_[srcloc] r2 = _r2(dxyz[:, :2]) sqrtr2z2 = np.sqrt(r2 + dxyz[:, 2]**2) k2 = k(freq, sigma[2], mu[2], eps) return Kc1 * moment / (4. * np.pi) * np.exp(-1j * k2 * sqrtr2z2) / sqrtr2z2
def _getCasingHertzMagDipoleDeriv_z(srcloc, obsloc, freq, sigma, a, b, mu=mu_0 * np.ones(3), eps=epsilon_0, moment=1.): HertzZ = _getCasingHertzMagDipole(srcloc, obsloc, freq, sigma, a, b, mu, eps, moment) nobs = obsloc.shape[0] dxyz = obsloc - np.c_[np.ones(nobs)] * np.r_[srcloc] r2z2 = _r2(dxyz) sqrtr2z2 = np.sqrt(r2z2) k2 = k(freq, sigma[2], mu[2], eps) return -HertzZ * dxyz[:, 2] / sqrtr2z2 * (1j * k2 + 1. / sqrtr2z2)
def _Propagate(f, thickness, sig, chg, taux, c, mu_r, eps_r, n): if isinstance(eps_r, float): epsmodel = np.ones_like(sig)*eps_r else: epsmodel = eps_r if isinstance(mu_r, float): mumodel = np.ones_like(sig)*mu_r else: epsmodel = mu_r sigcm = np.zeros_like(sig, dtype='complex_') if chg == 0. or taux == 0. or c == 0.: sigcm = sig else: for j in range(1, len(sigcm)): sigcm[j] = _PCC(sig[j], chg[j], taux[j], c[j], f) sigcm = np.append(np.r_[0.], sigcm) mu = np.append(np.r_[1.], mumodel)*mu_0 eps = np.append(np.r_[1.], epsmodel)*epsilon_0 H = np.append(np.r_[1.2*(1e5)], thickness) K = k(f, sigcm, mu, eps) Z = _ImpZ(f, mu, K) EH = np.matrix(np.zeros((2, n+1), dtype='complex_'), dtype='complex_') UD = np.matrix(np.zeros((2, n+1), dtype='complex_'), dtype='complex_') UD[1, -1] = 1. for i in range(-2, -(n+2), -1): UD[:, i] = _Tinv(H[i+1], K[i])*_Pinv(Z[i])*_P(Z[i+1])*UD[:, i+1] UD = UD/((np.abs(UD[0, :]+UD[1, :])).max()) for j in range(0, n+1): EH[:, j] = np.matrix([[1., 1, ], [-1./Z[j], 1./Z[j]]])*UD[:, j] return UD, EH, Z, K
def getKc(freq, sigma, a, b, mu=mu_0, eps=epsilon_0): a = float(a) b = float(b) # return 1./(2*np.pi) * np.sqrt(b / a) * np.exp(-1j*k(freq,sigma,mu,eps)*(b-a)) return np.sqrt(b / a) * np.exp(-1j * k(freq, sigma, mu, eps) * (b - a))
def getCasingHzMagDipole(srcloc,obsloc,freq,sigma,a,b,mu=mu_0*np.ones(3),eps=epsilon_0,moment=1.): d2HertzZdz2 = _getCasingHertzMagDipole2Deriv_z_z(srcloc,obsloc,freq,sigma,a,b,mu,eps,moment) k2 = k(freq,sigma[2],mu[2],eps) HertzZ = _getCasingHertzMagDipole(srcloc,obsloc,freq,sigma,a,b,mu,eps,moment) return d2HertzZdz2 + k2**2 * HertzZ
def getKc(freq,sigma,a,b,mu=mu_0,eps=epsilon_0): a = float(a) b = float(b) # return 1./(2*np.pi) * np.sqrt(b / a) * np.exp(-1j*k(freq,sigma,mu,eps)*(b-a)) return np.sqrt(b / a) * np.exp(-1j*k(freq,sigma,mu,eps)*(b-a))