public static Complex CalculateFieldE(OmegaModel model, decimal recieverDepth, decimal recieverThick = 0) { // c.CorrBackgroundTr is always layer with air boundary var c = PrepareContainer(model, recieverDepth); var kkr = Complex.ImaginaryOne * model.Omega * Mu0 * model.Section1D[c.CorrBackgroundRc].Zeta; var ikr = Complex.ImaginaryOne * Complex.Sqrt(kkr); var kk1 = Complex.ImaginaryOne * model.Omega * Mu0 * model.Section1D[c.CorrBackgroundTr].Zeta; var ik1 = Complex.ImaginaryOne * Complex.Sqrt(kk1); var dr1 = (double)model.GetLayerDepth(c.CorrBackgroundRc + 1); var d2 = (double)model.GetLayerDepth(c.CorrBackgroundTr + 1); var zr = (double)recieverDepth; var a = c.A[c.CorrBackgroundRc, c.CorrBackgroundTr] / c.A[c.CorrBackgroundTr, c.CorrBackgroundTr]; Complex upper; if (recieverThick == 0) { upper = Complex.Exp(ikr * zr) + c.Q [c.CorrBackgroundRc] * Complex.Exp(ikr * (2 * dr1 - zr)); } else { var z1 = zr - (double)recieverThick / 2; var z2 = zr + (double)recieverThick / 2; var u1 = Complex.Exp(ikr * z1) - c.Q [c.CorrBackgroundRc] * Complex.Exp(ikr * (2 * dr1 - z1)); var u2 = Complex.Exp(ikr * z2) - c.Q [c.CorrBackgroundRc] * Complex.Exp(ikr * (2 * dr1 - z2)); upper = (u2 - u1) / (z2 - z1) / ikr; } var lower = 1 + c.Q[c.CorrBackgroundTr] * Complex.Exp(ik1 * (2 * d2)); return(a * (upper / lower)); }
private static Complex[,] CalculateA(OmegaModel model, AuxContainer c) { var result = new Complex[c.P.Length, c.P.Length]; int s = System.Math.Max(c.CorrBackgroundRc, c.CorrBackgroundTr); int r = System.Math.Min(c.CorrBackgroundRc, c.CorrBackgroundTr); for (int n = s; n >= r; n--) { Complex prevA = 1.0 / (c.Eta[n] * (1 - c.P[n] * c.Q[n] * c.Exp[n])); result[n, n] = prevA; for (int k = n - 1; k >= r; k--) { var dk1 = (double)model.GetLayerDepth(k + 1); var q = ((1 + c.P[k + 1]) / (1 + c.P[k] * c.Exp[k])) * Complex.Exp((c.Eta[k + 1] - c.Eta[k]) * dk1); Complex nextA = q * prevA; result[k, n] = nextA; result[n, k] = nextA; prevA = nextA; } } return(result); }
private NativeEnvelop GetNativeEnvelop(AuxContainerFast c) { var ne = new NativeEnvelop() { length = c.Eta.GetLength(1), r = c.CorrBackgroundRc, s = c.CorrBackgroundTr, r1 = (double)c.Rc.StartingDepth, r2 = (double)c.Rc.GetEndDepth(), s1 = (double)c.Tr.StartingDepth, s2 = (double)c.Tr.GetEndDepth(), }; ne.t = System.Math.Min(ne.r, ne.s); ne.b = System.Math.Max(ne.r, ne.s); ne.dt = (double)_model.GetLayerDepth(ne.t); ne.db1 = (double)_model.GetLayerDepth(ne.b + 1); return(ne); }
private Complex CalculateT(Z z, Complex[] eta, int r, int s) { int t = System.Math.Min(r, s); var dt = (double)_model.GetLayerDepth(t); return(exp(-eta[r] * z.r1 - eta[s] * z.s1 + 2 * eta[t] * dt) - exp(-eta[r] * z.r1 - eta[s] * z.s2 + 2 * eta[t] * dt) - exp(-eta[r] * z.r2 - eta[s] * z.s1 + 2 * eta[t] * dt) + exp(-eta[r] * z.r2 - eta[s] * z.s2 + 2 * eta[t] * dt)); }
public static Complex CalculateFieldH(OmegaModel model, decimal recieverDepth) { // c.CorrBackgroundTr is always layer with air boundary var c = PrepareContainer(model, recieverDepth); var kkr = Complex.ImaginaryOne * model.Omega * Mu0 * model.Section1D[c.CorrBackgroundRc].Zeta; var ikr = Complex.ImaginaryOne * Complex.Sqrt(kkr); var kk1 = Complex.ImaginaryOne * model.Omega * Mu0 * model.Section1D[c.CorrBackgroundTr].Zeta; var ik1 = Complex.ImaginaryOne * Complex.Sqrt(kk1); var dr1 = (double)model.GetLayerDepth(c.CorrBackgroundRc + 1); var d2 = (double)model.GetLayerDepth(c.CorrBackgroundTr + 1); var zr = (double)recieverDepth; var a = c.A[c.CorrBackgroundRc, c.CorrBackgroundTr] / c.A[c.CorrBackgroundTr, c.CorrBackgroundTr]; var upper = Complex.Exp(ikr * zr) - c.Q[c.CorrBackgroundRc] * Complex.Exp(ikr * (2 * dr1 - zr)); var lower = 1 + c.Q[c.CorrBackgroundTr] * Complex.Exp(ik1 * (2 * d2)); return((Complex.Sqrt(kkr) / (model.Omega * Mu0)) * a * (upper / lower)); }
private Complex CalculateT(double zWork, double z1, double z2, Complex[] eta, int r, int s) { int t = System.Math.Min(r, s); var dt = (double)_model.GetLayerDepth(t); var result = Complex.Exp(-eta[r] * zWork - eta[s] * z1 + 2 * eta[t] * dt) - Complex.Exp(-eta[r] * zWork - eta[s] * z2 + 2 * eta[t] * dt); return(result); }
private Complex[, ][] CalculateA(AuxContainerFast c) { var length0 = c.P.GetLength(0); var length1 = c.P.GetLength(1); var result = new Complex[length0, length0][]; for (int i = 0; i < length0; i++) { for (int j = 0; j < length0; j++) { result[i, j] = new Complex[length1]; } } int s = System.Math.Max(c.CorrBackgroundRc, c.CorrBackgroundTr); int r = System.Math.Min(c.CorrBackgroundRc, c.CorrBackgroundTr); for (int n = s; n >= r; n--) { for (int m = 0; m < length1; m++) { Complex prevA = 1.0 / (c.Eta[n, m] * (1 - c.P[n, m] * c.Q[n, m] * c.Exp[n, m])); result[n, n][m] = prevA; for (int k = n - 1; k >= r; k--) { var dk1 = (double)_model.GetLayerDepth(k + 1); var q = ((1 + c.P[k + 1, m]) / (1 + c.P[k, m] * c.Exp[k, m])) * Complex.Exp((c.Eta[k + 1, m] - c.Eta[k, m]) * dk1); Complex nextA = q * prevA; result[k, n][m] = nextA; result[n, k][m] = nextA; prevA = nextA; } } } return(result); }