Skip to content

NeBEM/Isles

Heinrich Schindler requested to merge nebem into master

Isles.c

Simplify the expressions for calculating the potential and field for triangular elements (function ExactTriSurf).

  • Combining the complex logarithmic terms
LP_1 = \frac{1}{G - \text{i}z_{M}\left|Y\right|}\ln{A} = \frac{1}{G - \text{i}z_{M}\left|Y\right|}\left(\ln\left|A\right| + \text{i}\text{Arg}A\right)\\
LM_1 = \frac{1}{G + \text{i}z_{M}\left|Y\right|}\ln{\overline{A}} = \frac{1}{G - \text{i}z_{M}\left|Y\right|}\left(\ln\left|A\right| - \text{i}\text{Arg}A\right)\\
LP_2 = \frac{1}{G - \text{i}z_{M}\left|Y\right|}\ln{B} = \frac{1}{G - \text{i}z_{M}\left|Y\right|}\left(\ln\left|B\right| + \text{i}\text{Arg}B\right)\\
LM_2 = \frac{1}{G + \text{i}z_{M}\left|Y\right|}\ln{\overline{B}} = \frac{1}{G - \text{i}z_{M}\left|Y\right|}\left(\ln\left|B\right| - \text{i}\text{Arg}B\right)

gives

LP_1 + LM_1 - LP_2 - LM_2 = \frac{2}{G^2 + z_{M}^2\left|Y\right|^2}\left[G\ln\frac{\left|A\right|}{\left|B\right|} - z{M}\left|Y\right|\left(\text{Arg}A - \text{Arg}B\right)\right]

and

LP_1 - LM_1 - LP_2 + LM_2 = \frac{2\text{i}}{G^2 + z_{M}^2\left|Y\right|^2}\left[z_{M}\left|Y\right|\ln\frac{\left|A\right|}{\left|B\right|} + G\left(\text{Arg}A - \text{Arg}B\right)\right]

Instead of four complex logarithms, we only need to evaluate one real-valued log and two atan2.

  • Using the logarithmic representation of the inverse hyperbolic tangent,
\text{atanh}\left(\frac{R1 + \text{i}I_1}{D_{11}\left|Z\right|}\right) + \text{atanh}\left(\frac{R1 - \text{i}I_1}{D_{11}\left|Z\right|}\right) - \text{atanh}\left(\frac{R1 + \text{i}I_2}{D_{11}\left|Z\right|}\right) - \text{atanh}\left(\frac{R1 - \text{i}I_2}{D_{11}\left|Z\right|}\right)

becomes

\frac{1}{2}\ln\frac{\left(I_1^2 + \left(D_{11}\left|Z\right| + R_1\right)^2\right)}{\left(I_1^2 + \left(D_{11}\left|Z\right| - R_1\right)^2\right)}\frac{\left(I_2^2 + \left(D_{21}\left|Z\right| - R_1\right)^2\right)}{\left(I_2^2 + \left(D_{21}\left|Z\right| + R_1\right)^2\right)}
  • Since the argument of
\text{atanh}\left(\frac{R1 + \text{i}I_1}{D_{11}\left|Z\right|}\right) - \text{atanh}\left(\frac{R1 - \text{i}I_1}{D_{11}\left|Z\right|}\right) = \text{atanh}\left(\frac{\text{i}2I_{1}D_{11}\left|Z\right|}{D_{11}^2\left|Z\right|^2 - \left(R_1^2 + I_1^2\right)}\right)

is purely imaginary, we can use

\text{atanh}\left(z\right) = -\text{i}\,\text{atan}\left(\text{i}z\right)

to convert it to a real-valued atan.

ComputeProperties.c

Pass the dimensions of an element as doubles to GetPF, RecPF, etc. instead of a pointer to the element.

Edited by Heinrich Schindler

Merge request reports