diff --git a/docs/fortran-c.rst b/docs/fortran-c.rst index ecb0e6b..d6ea3b6 100644 --- a/docs/fortran-c.rst +++ b/docs/fortran-c.rst @@ -20,7 +20,7 @@ gradient .. math:: - u(x) = \sum_{j=1}^{N} \frac{c_{j}}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|} \right) \, . + u(x) = \sum_{j=1}^{N} \frac{c_{j}}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|} \right) \, . Here $x_{j}$ are the source locations, $c_{j}$ are the charge strengths and $v_{j}$ are the dipole strengths, @@ -52,7 +52,7 @@ In general, the subroutine names take the following form:: - t: Evaluate $u$ and its gradient at $t_{i}$, a collection of target locations specified by the user. - st: Evaluate $u$ and its gradient at both source and target locations $x_{i}$ and $t_{i}$. -- : kernel of interaction (charges/dipoles/both). The charge interactions are given by $c_{j}/\|x-x_{j}\| $, and the dipole interactions are given by $-v_{j} \cdot \nabla (1/\|x-x_{j}\|)$ +- : kernel of interaction (charges/dipoles/both). The charge interactions are given by $c_{j}/4\pi\|x-x_{j}\| $, and the dipole interactions are given by $-v_{j} \cdot \nabla (1/4\pi\|x-x_{j}\|)$ - c: charges - d: dipoles @@ -175,7 +175,7 @@ gradient .. math:: - u(x) = \sum_{j=1}^{N} \frac{c_{j} e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} \right) \, . + u(x) = \sum_{j=1}^{N} \frac{c_{j} e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} \right) \, . Here $x_{j}$ are the source locations, $c_{j}$ are the charge strengths and $v_{j}$ are the dipole strengths, @@ -207,7 +207,7 @@ In general, the subroutine names take the following form:: - t: Evaluate $u$ and its gradient at $t_{i}$, a collection of target locations specified by the user. - st: Evaluate $u$ and its gradient at both source and target locations $x_{i}$ and $t_{i}$. -- : kernel of interaction (charges/dipoles/both). The charge interactions are given by $c_{j}/\|x-x_{j}\| $, and the dipole interactions are given by $-v_{j} \cdot \nabla (1/\|x-x_{j}\|)$ +- : kernel of interaction (charges/dipoles/both). The charge interactions are given by $c_{j}/4\pi\|x-x_{j}\| $, and the dipole interactions are given by $-v_{j} \cdot \nabla (1/4\pi\|x-x_{j}\|)$ - c: charges - d: dipoles @@ -320,7 +320,7 @@ denote the Stokeslet given by .. math:: - \mathcal{G}^{\textrm{stok}}(x,y)=\frac{1}{2 \|x-y\|^3} + \mathcal{G}^{\textrm{stok}}(x,y)=\frac{1}{8\pi \|x-y\|^3} \begin{bmatrix} (x_{1}-y_{1})^2 + \|x-y \|^2 & (x_{1}-y_{1})(x_{2}-y_{2}) & (x_{1}-y_{1})(x_{3}-y_{3}) \\ @@ -335,7 +335,7 @@ a vector $v$ is given by .. math:: v\cdot \mathcal{T}^{\textrm{stok}}(x,y) = - \frac{3 v \cdot (x-y)}{\|x-y \|^5} + \frac{3 v \cdot (x-y)}{4\pi\|x-y \|^5} \begin{bmatrix} (x_{1}-y_{1})^2 & (x_{1}-y_{1})(x_{2}-y_{2}) & (x_{1}-y_{1})(x_{3}-y_{3}) \\ @@ -451,7 +451,7 @@ divergence .. math:: - E(x) = \sum_{j=1}^{N} \nabla \times \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} M_{j} + \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} J_{j} + \nabla \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} \rho_{j} \, . + E(x) = \sum_{j=1}^{N} \nabla \times \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} M_{j} + \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} J_{j} + \nabla \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} \rho_{j} \, . Here $x_{j}$ are the source locations, $M_{j}$ are the magnetic current densities, diff --git a/docs/fortrandocs_helm.raw b/docs/fortrandocs_helm.raw index 82cee92..13e2b08 100644 --- a/docs/fortrandocs_helm.raw +++ b/docs/fortrandocs_helm.raw @@ -18,7 +18,7 @@ This subroutine evaluates the potential .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} + u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -57,7 +57,7 @@ This subroutine evaluates the potential .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -106,7 +106,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} + u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -147,7 +147,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -198,7 +198,7 @@ This subroutine evaluates the potential .. math:: - u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -237,7 +237,7 @@ This subroutine evaluates the potential .. math:: - u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -286,7 +286,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -327,7 +327,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -378,7 +378,7 @@ This subroutine evaluates the potential .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -419,7 +419,7 @@ This subroutine evaluates the potential .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -470,7 +470,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -513,7 +513,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -566,7 +566,7 @@ This subroutine evaluates the potential .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} + u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -609,7 +609,7 @@ This subroutine evaluates the potential .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -658,7 +658,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} + u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -703,7 +703,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -754,7 +754,7 @@ This subroutine evaluates the potential .. math:: - u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -797,7 +797,7 @@ This subroutine evaluates the potential .. math:: - u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -846,7 +846,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -891,7 +891,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -942,7 +942,7 @@ This subroutine evaluates the potential .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -987,7 +987,7 @@ This subroutine evaluates the potential .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1038,7 +1038,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1085,7 +1085,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1138,7 +1138,7 @@ This subroutine evaluates the potential .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} + u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1183,7 +1183,7 @@ This subroutine evaluates the potential .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1234,7 +1234,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} + u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1283,7 +1283,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1338,7 +1338,7 @@ This subroutine evaluates the potential .. math:: - u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1383,7 +1383,7 @@ This subroutine evaluates the potential .. math:: - u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1434,7 +1434,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1483,7 +1483,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1538,7 +1538,7 @@ This subroutine evaluates the potential .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1585,7 +1585,7 @@ This subroutine evaluates the potential .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1638,7 +1638,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1689,7 +1689,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. diff --git a/docs/fortrandocs_helm2.raw b/docs/fortrandocs_helm2.raw index 10a25d4..2066af7 100644 --- a/docs/fortrandocs_helm2.raw +++ b/docs/fortrandocs_helm2.raw @@ -1,7 +1,7 @@ c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -34,7 +34,7 @@ c c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -70,7 +70,7 @@ c------------------------------------- c c This subroutine evaluates the potential c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -104,7 +104,7 @@ c------------------------------------- c c This subroutine evaluates the potential and its gradient c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -139,9 +139,9 @@ c c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - c v_{j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -176,9 +176,9 @@ c c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - c v_{j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -215,7 +215,7 @@ c c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -252,7 +252,7 @@ c c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -292,7 +292,7 @@ c------------------------------------- c c This subroutine evaluates the potential c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -330,7 +330,7 @@ c------------------------------------- c c This subroutine evaluates the potential and its gradient c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -369,9 +369,9 @@ c c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - c v_{j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -410,9 +410,9 @@ c c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - c v_{j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -453,7 +453,7 @@ c c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -492,7 +492,7 @@ c c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -536,7 +536,7 @@ c------------------------------------- c c This subroutine evaluates the potential c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -576,7 +576,7 @@ c------------------------------------- c c This subroutine evaluates the potential and its gradient c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -619,9 +619,9 @@ c c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - c v_{j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -662,9 +662,9 @@ c c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - c v_{j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is diff --git a/docs/fortrandocs_helm2_vec.raw b/docs/fortrandocs_helm2_vec.raw index 16ae30a..f59a9e0 100644 --- a/docs/fortrandocs_helm2_vec.raw +++ b/docs/fortrandocs_helm2_vec.raw @@ -2,7 +2,7 @@ c------------------------------------- c c This subroutine evaluates the potential c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} -c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} +c \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -38,7 +38,7 @@ c------------------------------------- c c This subroutine evaluates the potential and its gradient c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} -c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} +c \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -76,7 +76,7 @@ c------------------------------------- c c This subroutine evaluates the potential c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -112,7 +112,7 @@ c------------------------------------- c c This subroutine evaluates the potential and its gradient c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -150,9 +150,9 @@ c------------------------------------- c c This subroutine evaluates the potential c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} -c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - c v_{\ell,j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -190,9 +190,9 @@ c------------------------------------- c c This subroutine evaluates the potential and its gradient c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} -c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - c v_{\ell,j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -232,7 +232,7 @@ c------------------------------------- c c This subroutine evaluates the potential c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} -c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} +c \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -272,7 +272,7 @@ c------------------------------------- c c This subroutine evaluates the potential and its gradient c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} -c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} +c \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -314,7 +314,7 @@ c------------------------------------- c c This subroutine evaluates the potential c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -354,7 +354,7 @@ c------------------------------------- c c This subroutine evaluates the potential and its gradient c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -396,9 +396,9 @@ c------------------------------------- c c This subroutine evaluates the potential c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} -c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - c v_{\ell,j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -440,9 +440,9 @@ c------------------------------------- c c This subroutine evaluates the potential and its gradient c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} -c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - c v_{\ell,j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -486,7 +486,7 @@ c------------------------------------- c c This subroutine evaluates the potential c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} -c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} +c \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -528,7 +528,7 @@ c------------------------------------- c c This subroutine evaluates the potential and its gradient c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} -c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} +c \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -574,7 +574,7 @@ c------------------------------------- c c This subroutine evaluates the potential c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -616,7 +616,7 @@ c------------------------------------- c c This subroutine evaluates the potential and its gradient c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -662,9 +662,9 @@ c------------------------------------- c c This subroutine evaluates the potential c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} -c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - c v_{\ell,j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -708,9 +708,9 @@ c------------------------------------- c c This subroutine evaluates the potential and its gradient c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} -c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c \frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|} - c v_{\ell,j} \cdot \nabla \left( -c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +c \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is diff --git a/docs/fortrandocs_lap.raw b/docs/fortrandocs_lap.raw index 102b3f9..50e4e91 100644 --- a/docs/fortrandocs_lap.raw +++ b/docs/fortrandocs_lap.raw @@ -18,7 +18,7 @@ This subroutine evaluates the potential .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -55,7 +55,7 @@ This subroutine evaluates the potential .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -104,7 +104,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -143,7 +143,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -194,7 +194,7 @@ This subroutine evaluates the potential, its gradient and its hessian .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -235,7 +235,7 @@ This subroutine evaluates the potential, its gradient and its hessian .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -288,7 +288,7 @@ This subroutine evaluates the potential .. math:: - u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -325,7 +325,7 @@ This subroutine evaluates the potential .. math:: - u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -374,7 +374,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -413,7 +413,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -464,7 +464,7 @@ This subroutine evaluates the potential, its gradient and its hessian .. math:: - u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -505,7 +505,7 @@ This subroutine evaluates the potential, its gradient and its hessian .. math:: - u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -558,7 +558,7 @@ This subroutine evaluates the potential .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -597,7 +597,7 @@ This subroutine evaluates the potential .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -648,7 +648,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -689,7 +689,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -742,7 +742,7 @@ This subroutine evaluates the potential, its gradient and its hessian .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -785,7 +785,7 @@ This subroutine evaluates the potential, its gradient and its hessian .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source locations $x=x_{j}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -840,7 +840,7 @@ This subroutine evaluates the potential .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -881,7 +881,7 @@ This subroutine evaluates the potential .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -930,7 +930,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -975,7 +975,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1026,7 +1026,7 @@ This subroutine evaluates the potential, its gradient and its hessian .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1071,7 +1071,7 @@ This subroutine evaluates the potential, its gradient and its hessian .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1124,7 +1124,7 @@ This subroutine evaluates the potential .. math:: - u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1165,7 +1165,7 @@ This subroutine evaluates the potential .. math:: - u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1214,7 +1214,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1259,7 +1259,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1310,7 +1310,7 @@ This subroutine evaluates the potential, its gradient and its hessian .. math:: - u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1355,7 +1355,7 @@ This subroutine evaluates the potential, its gradient and its hessian .. math:: - u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1408,7 +1408,7 @@ This subroutine evaluates the potential .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1451,7 +1451,7 @@ This subroutine evaluates the potential .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1502,7 +1502,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1549,7 +1549,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1602,7 +1602,7 @@ This subroutine evaluates the potential, its gradient and its hessian .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1649,7 +1649,7 @@ This subroutine evaluates the potential, its gradient and its hessian .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the target locations $x=t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1704,7 +1704,7 @@ This subroutine evaluates the potential .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1747,7 +1747,7 @@ This subroutine evaluates the potential .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1798,7 +1798,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1847,7 +1847,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1902,7 +1902,7 @@ This subroutine evaluates the potential, its gradient and its hessian .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -1953,7 +1953,7 @@ This subroutine evaluates the potential, its gradient and its hessian .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -2012,7 +2012,7 @@ This subroutine evaluates the potential .. math:: - u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -2055,7 +2055,7 @@ This subroutine evaluates the potential .. math:: - u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -2106,7 +2106,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -2155,7 +2155,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -2210,7 +2210,7 @@ This subroutine evaluates the potential, its gradient and its hessian .. math:: - u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -2261,7 +2261,7 @@ This subroutine evaluates the potential, its gradient and its hessian .. math:: - u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -2320,7 +2320,7 @@ This subroutine evaluates the potential .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -2365,7 +2365,7 @@ This subroutine evaluates the potential .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -2418,7 +2418,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -2469,7 +2469,7 @@ This subroutine evaluates the potential and its gradient .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -2526,7 +2526,7 @@ This subroutine evaluates the potential, its gradient and its hessian .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -2579,7 +2579,7 @@ This subroutine evaluates the potential, its gradient and its hessian .. math:: - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) at the source and target locations $x=x_{j},t_{i}$. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. diff --git a/docs/fortrandocs_lap2.raw b/docs/fortrandocs_lap2.raw index 35a4903..da9c05d 100644 --- a/docs/fortrandocs_lap2.raw +++ b/docs/fortrandocs_lap2.raw @@ -1,7 +1,7 @@ c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -32,7 +32,7 @@ c c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -65,7 +65,7 @@ c c------------------------------------- c c This subroutine evaluates the potential, its gradient and its hessian -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -101,7 +101,7 @@ c------------------------------------- c c This subroutine evaluates the potential c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -133,7 +133,7 @@ c------------------------------------- c c This subroutine evaluates the potential and its gradient c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -167,7 +167,7 @@ c------------------------------------- c c This subroutine evaluates the potential, its gradient and its hessian c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -202,9 +202,9 @@ c c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - +c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - c v_{j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -237,9 +237,9 @@ c c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - +c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - c v_{j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -274,9 +274,9 @@ c c------------------------------------- c c This subroutine evaluates the potential, its gradient and its hessian -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - +c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - c v_{j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -313,7 +313,7 @@ c c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -348,7 +348,7 @@ c c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -385,7 +385,7 @@ c c------------------------------------- c c This subroutine evaluates the potential, its gradient and its hessian -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -425,7 +425,7 @@ c------------------------------------- c c This subroutine evaluates the potential c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -461,7 +461,7 @@ c------------------------------------- c c This subroutine evaluates the potential and its gradient c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -499,7 +499,7 @@ c------------------------------------- c c This subroutine evaluates the potential, its gradient and its hessian c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -538,9 +538,9 @@ c c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - +c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - c v_{j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -577,9 +577,9 @@ c c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - +c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - c v_{j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -618,9 +618,9 @@ c c------------------------------------- c c This subroutine evaluates the potential, its gradient and its hessian -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - +c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - c v_{j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -661,7 +661,7 @@ c c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -698,7 +698,7 @@ c c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -739,7 +739,7 @@ c c------------------------------------- c c This subroutine evaluates the potential, its gradient and its hessian -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -785,7 +785,7 @@ c------------------------------------- c c This subroutine evaluates the potential c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -823,7 +823,7 @@ c------------------------------------- c c This subroutine evaluates the potential and its gradient c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -865,7 +865,7 @@ c------------------------------------- c c This subroutine evaluates the potential, its gradient and its hessian c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -910,9 +910,9 @@ c c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - +c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - c v_{j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -951,9 +951,9 @@ c c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - +c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - c v_{j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -996,9 +996,9 @@ c c------------------------------------- c c This subroutine evaluates the potential, its gradient and its hessian -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - +c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - c v_{j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is diff --git a/docs/fortrandocs_lap2_vec.raw b/docs/fortrandocs_lap2_vec.raw index c42a062..12c345a 100644 --- a/docs/fortrandocs_lap2_vec.raw +++ b/docs/fortrandocs_lap2_vec.raw @@ -1,7 +1,7 @@ c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} +c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -34,7 +34,7 @@ c c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} +c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -69,7 +69,7 @@ c c------------------------------------- c c This subroutine evaluates the potential, its gradient and its hessian -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} +c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -107,7 +107,7 @@ c------------------------------------- c c This subroutine evaluates the potential c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -141,7 +141,7 @@ c------------------------------------- c c This subroutine evaluates the potential and its gradient c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -177,7 +177,7 @@ c------------------------------------- c c This subroutine evaluates the potential, its gradient and its hessian c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -214,9 +214,9 @@ c c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - +c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} - c v_{\ell,j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -251,9 +251,9 @@ c c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - +c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} - c v_{\ell,j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -290,9 +290,9 @@ c c------------------------------------- c c This subroutine evaluates the potential, its gradient and its hessian -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - +c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} - c v_{\ell,j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -331,7 +331,7 @@ c c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} +c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -368,7 +368,7 @@ c c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} +c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -407,7 +407,7 @@ c c------------------------------------- c c This subroutine evaluates the potential, its gradient and its hessian -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} +c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -449,7 +449,7 @@ c------------------------------------- c c This subroutine evaluates the potential c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -487,7 +487,7 @@ c------------------------------------- c c This subroutine evaluates the potential and its gradient c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -527,7 +527,7 @@ c------------------------------------- c c This subroutine evaluates the potential, its gradient and its hessian c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -568,9 +568,9 @@ c c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - +c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} - c v_{\ell,j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -609,9 +609,9 @@ c c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - +c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} - c v_{\ell,j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -652,9 +652,9 @@ c c------------------------------------- c c This subroutine evaluates the potential, its gradient and its hessian -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - +c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} - c v_{\ell,j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -697,7 +697,7 @@ c c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} +c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -736,7 +736,7 @@ c c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} +c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -779,7 +779,7 @@ c c------------------------------------- c c This subroutine evaluates the potential, its gradient and its hessian -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} +c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -827,7 +827,7 @@ c------------------------------------- c c This subroutine evaluates the potential c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -867,7 +867,7 @@ c------------------------------------- c c This subroutine evaluates the potential and its gradient c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -911,7 +911,7 @@ c------------------------------------- c c This subroutine evaluates the potential, its gradient and its hessian c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -958,9 +958,9 @@ c c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - +c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} - c v_{\ell,j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -1001,9 +1001,9 @@ c c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - +c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} - c v_{\ell,j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -1048,9 +1048,9 @@ c c------------------------------------- c c This subroutine evaluates the potential, its gradient and its hessian -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - +c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{4\pi\|x-x_{j}\|} - c v_{\ell,j} \cdot \nabla \left( -c \frac{1}{\|x-x_{j}\|}\right) +c \frac{1}{4\pi\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is diff --git a/docs/genfortdocumentation_helm.py b/docs/genfortdocumentation_helm.py index 29782e0..6394dd4 100644 --- a/docs/genfortdocumentation_helm.py +++ b/docs/genfortdocumentation_helm.py @@ -6,15 +6,15 @@ eq_start = "u(x) = " eq_start2 = "\sum_{j=1}^{N} " -str1 = "c_{j} \\frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|}" -str2 = "v_{j} \cdot \\nabla \\left( \\frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\\right)" +str1 = "c_{j} \\frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|}" +str2 = "v_{j} \cdot \\nabla \\left( \\frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\\right)" str3 = str1+" - "+str2 eq_cjs = [eq_start+eq_start2+str1,eq_start+"-"+eq_start2+str2,eq_start+eq_start2+str3] eq_start = "u_{\ell}(x) = " eq_start2 = "\sum_{j=1}^{N} " -str1 = "c_{\ell,j} \\frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|}" -str2 = "v_{\ell,j} \cdot \\nabla \\left( \\frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\\right)" +str1 = "c_{\ell,j} \\frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|}" +str2 = "v_{\ell,j} \cdot \\nabla \\left( \\frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\\right)" str3 = str1+" - "+str2 eq_nd_cjs = [eq_start+eq_start2+str1,eq_start+"-"+eq_start2+str2,eq_start+eq_start2+str3] @@ -163,15 +163,15 @@ # eq_start = "u(x) = " eq_start2 = "\sum_{j=1}^{N} " -str1 = "c_{j} \\frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|}" -str2 = "v_{j} \cdot \\nabla \\left( \nc \\frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\\right)" +str1 = "c_{j} \\frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|}" +str2 = "v_{j} \cdot \\nabla \\left( \nc \\frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\\right)" str3 = str1+" - \nc "+str2 eq_cjs_fort = [eq_start+eq_start2+str1,eq_start+"-"+eq_start2+str2,eq_start+eq_start2+str3] eq_start = "u_{\ell}(x) = " eq_start2 = "\sum_{j=1}^{N} " -str1 = "c_{\ell,j}\nc \\frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|}" -str2 = "v_{\ell,j} \cdot \\nabla \\left( \nc \\frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\\right)" +str1 = "c_{\ell,j}\nc \\frac{e^{ik\|x- x_{j}\|}}{4\pi\|x-x_{j}\|}" +str2 = "v_{\ell,j} \cdot \\nabla \\left( \nc \\frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\\right)" str3 = str1+" - \nc "+str2 eq_cjs_fort_nd = [eq_start+eq_start2+str1,eq_start+"-"+eq_start2+str2,eq_start+eq_start2+str3] diff --git a/docs/genfortdocumentation_lap.py b/docs/genfortdocumentation_lap.py index f2f0877..f6170e6 100644 --- a/docs/genfortdocumentation_lap.py +++ b/docs/genfortdocumentation_lap.py @@ -6,15 +6,15 @@ eq_start = "u(x) = " eq_start2 = "\sum_{j=1}^{N} " -str1 = "c_{j} \\frac{1}{\|x-x_{j}\|}" -str2 = "v_{j} \cdot \\nabla \\left( \\frac{1}{\|x-x_{j}\|}\\right)" +str1 = "c_{j} \\frac{1}{4\pi\|x-x_{j}\|}" +str2 = "v_{j} \cdot \\nabla \\left( \\frac{1}{4\pi\|x-x_{j}\|}\\right)" str3 = str1+" - "+str2 eq_cjs = [eq_start+eq_start2+str1,eq_start+"-"+eq_start2+str2,eq_start+eq_start2+str3] eq_start = "u_{\ell}(x) = " eq_start2 = "\sum_{j=1}^{N} " -str1 = "c_{\ell,j} \\frac{1}{\|x-x_{j}\|}" -str2 = "v_{\ell,j} \cdot \\nabla \\left( \\frac{1}{\|x-x_{j}\|}\\right)" +str1 = "c_{\ell,j} \\frac{1}{4\pi\|x-x_{j}\|}" +str2 = "v_{\ell,j} \cdot \\nabla \\left( \\frac{1}{4\pi\|x-x_{j}\|}\\right)" str3 = str1+" - "+str2 eq_nd_cjs = [eq_start+eq_start2+str1,eq_start+"-"+eq_start2+str2,eq_start+eq_start2+str3] @@ -179,15 +179,15 @@ # eq_start = "u(x) = " eq_start2 = "\sum_{j=1}^{N} " -str1 = "c_{j} \\frac{1}{\|x-x_{j}\|}" -str2 = "v_{j} \cdot \\nabla \\left( \nc \\frac{1}{\|x-x_{j}\|}\\right)" +str1 = "c_{j} \\frac{1}{4\pi\|x-x_{j}\|}" +str2 = "v_{j} \cdot \\nabla \\left( \nc \\frac{1}{4\pi\|x-x_{j}\|}\\right)" str3 = str1+" - \nc "+str2 eq_cjs_fort = [eq_start+eq_start2+str1,eq_start+"-"+eq_start2+str2,eq_start+eq_start2+str3] eq_start = "u_{\ell}(x) = " eq_start2 = "\sum_{j=1}^{N} " -str1 = "c_{\ell,j} \\frac{1}{\|x-x_{j}\|}" -str2 = "v_{\ell,j} \cdot \\nabla \\left( \nc \\frac{1}{\|x-x_{j}\|}\\right)" +str1 = "c_{\ell,j} \\frac{1}{4\pi\|x-x_{j}\|}" +str2 = "v_{\ell,j} \cdot \\nabla \\left( \nc \\frac{1}{4\pi\|x-x_{j}\|}\\right)" str3 = str1+" - \nc "+str2 eq_cjs_fort_nd = [eq_start+eq_start2+str1,eq_start+"-"+eq_start2+str2,eq_start+eq_start2+str3] diff --git a/docs/index.rst b/docs/index.rst index 990b037..ae0d7ce 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -22,7 +22,7 @@ with corresponding real numbers $c_j$, and $N$ arbitrary points $x_{j} \in \mathbb{R}^{3}$, the Laplace FMM evaluates the $N$ real numbers -.. math:: u_{\ell} = \sum_{j=1}^M \frac{c_j}{\| x_{\ell} - y_{j}\|} ~, +.. math:: u_{\ell} = \sum_{j=1}^M \frac{c_j}{4\pi\| x_{\ell} - y_{j}\|} ~, \qquad \mbox{ for } \; \ell=1,2,\ldots N ~. :label: lapcp diff --git a/docs/julia.rst b/docs/julia.rst index 82c636a..521af4f 100644 --- a/docs/julia.rst +++ b/docs/julia.rst @@ -20,11 +20,11 @@ Laplace wrappers This subroutine computes the N-body Laplace interactions and its gradients in three dimensions where -the interaction kernel is given by $1/r$ +the interaction kernel is given by $1/(4\pi r)$ .. math:: - u(x) = \sum_{j=1}^{N} \frac{c_{j}}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} \frac{c_{j}}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) where $c_{j}$ are the charge densities $v_{j}$ are the dipole orientation vectors, and @@ -110,7 +110,7 @@ the interaction kernel is given by $e^{ikr}/r$ .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) where $c_{j}$ are the charge densities $v_{j}$ are the dipole orientation vectors, and @@ -194,7 +194,7 @@ denote the Stokeslet given by .. math:: - \mathcal{G}^{\textrm{stok}}(x,y)=\frac{1}{2 \|x-y\|^3} + \mathcal{G}^{\textrm{stok}}(x,y)=\frac{1}{8\pi \|x-y\|^3} \begin{bmatrix} (x_{1}-y_{1})^2 + \|x-y \|^2 & (x_{1}-y_{1})(x_{2}-y_{2}) & (x_{1}-y_{1})(x_{3}-y_{3}) \\ @@ -209,7 +209,7 @@ a vector $v$ is given by .. math:: v\cdot \mathcal{T}^{\textrm{stok}}(x,y) = - \frac{3 v \cdot (x-y)}{\|x-y \|^5} + \frac{3 v \cdot (x-y)}{4\pi\|x-y \|^5} \begin{bmatrix} (x_{1}-y_{1})^2 & (x_{1}-y_{1})(x_{2}-y_{2}) & (x_{1}-y_{1})(x_{3}-y_{3}) \\ @@ -309,7 +309,7 @@ given by .. math:: - E(x) = \sum_{j=1}^{N} \nabla \times \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} M_{j} + \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} J_{j} + \nabla \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} \rho_{j} + E(x) = \sum_{j=1}^{N} \nabla \times \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} M_{j} + \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} J_{j} + \nabla \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} \rho_{j} where $M_{j}$ are the magnetic current densities, $J_{j}$ are the electric current densities, diff --git a/docs/legacy.rst b/docs/legacy.rst index 53d4c4d..cafc5c2 100644 --- a/docs/legacy.rst +++ b/docs/legacy.rst @@ -66,7 +66,7 @@ and field .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - d_{j}\left(v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) \right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - d_{j}\left(v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) \right) at the source locations $x=x_{j}$. When $x=x_{m}$, the term corresponding to $x_{m}$ is dropped from the sum. @@ -144,7 +144,7 @@ and field .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - d_{j}\left(v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) \right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - d_{j}\left(v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) \right) at the source locations $x=x_{j}$/target locations $x=t_{j}$/ source and target locations. When $x=x_{m}$, the term @@ -252,7 +252,7 @@ and field .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - d_{j}\left(v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) \right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - d_{j}\left(v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) \right) at the source locations $x=x_{j}$/target locations $x=t_{j}$/ source and target locations. When $x=x_{m}$, the term @@ -356,7 +356,7 @@ and field .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} - d_{j}\left(v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) \right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} - d_{j}\left(v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) \right) at the source locations $x=x_{j}$. When $x=x_{m}$, the term corresponding to $x_{m}$ is dropped from the sum. @@ -436,7 +436,7 @@ and field .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} - d_{j}\left(v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) \right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} - d_{j}\left(v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) \right) at the source locations $x=x_{j}$/target locations $x=t_{j}$/ source and target locations. When $x=x_{m}$, the term @@ -546,7 +546,7 @@ and field .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - d_{j}\left(v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) \right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - d_{j}\left(v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) \right) at the source locations $x=x_{j}$/target locations $x=t_{j}$/ source and target locations. When $x=x_{m}$, the term diff --git a/docs/math.rst b/docs/math.rst index 2e758df..157277f 100644 --- a/docs/math.rst +++ b/docs/math.rst @@ -20,7 +20,7 @@ given by .. math:: :label: lap_nbody - u(x) = \sum_{j=1}^{N} \frac{c_{j}}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) \, , + u(x) = \sum_{j=1}^{N} \frac{c_{j}}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) \, , at the source and target locations. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -42,7 +42,7 @@ given by .. math:: :label: helm_nbody - u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) \, , + u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) \, , at the source and target locations. When $x=x_{j}$, the term corresponding to $x_{j}$ is dropped from the sum. @@ -64,7 +64,7 @@ and its gradients $\nabla u_{\ell}(x)$ defined by the formula .. math:: :label: lap_nbody_vec - u_{\ell}(x) = \sum_{j=1}^{N} \frac{c_{\ell,j}}{\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) \, , \quad \ell=1,2,\ldots n_{d}\, + u_{\ell}(x) = \sum_{j=1}^{N} \frac{c_{\ell,j}}{4\pi\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) \, , \quad \ell=1,2,\ldots n_{d}\, at the source and target locations. @@ -78,7 +78,7 @@ and its gradients $\nabla u_{\ell}(x)$ defined by the formula .. math:: :label: helm_nbody_vec - u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) \, ,\quad \ell =1,2,\ldots n_{d} + u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{\ell,j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) \, ,\quad \ell =1,2,\ldots n_{d} at the source and target locations. diff --git a/docs/matlab.rst b/docs/matlab.rst index 925a78a..45d9782 100644 --- a/docs/matlab.rst +++ b/docs/matlab.rst @@ -23,7 +23,7 @@ the interaction kernel is given by $1/r$ .. math:: - u(x) = \sum_{j=1}^{N} \frac{c_{j}}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} \frac{c_{j}}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) where $c_{j}$ are the charge densities $v_{j}$ are the dipole orientation vectors, and @@ -109,7 +109,7 @@ the interaction kernel is given by $e^{ikr}/r$ .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) where $c_{j}$ are the charge densities $v_{j}$ are the dipole orientation vectors, and @@ -195,7 +195,7 @@ denote the Stokeslet given by .. math:: - \mathcal{G}^{\textrm{stok}}(x,y)=\frac{1}{2 \|x-y\|^3} + \mathcal{G}^{\textrm{stok}}(x,y)=\frac{1}{8\pi \|x-y\|^3} \begin{bmatrix} (x_{1}-y_{1})^2 + \|x-y \|^2 & (x_{1}-y_{1})(x_{2}-y_{2}) & (x_{1}-y_{1})(x_{3}-y_{3}) \\ @@ -210,7 +210,7 @@ a vector $v$ is given by .. math:: v\cdot \mathcal{T}^{\textrm{stok}}(x,y) = - \frac{3 v \cdot (x-y)}{\|x-y \|^5} + \frac{3 v \cdot (x-y)}{4\pi\|x-y \|^5} \begin{bmatrix} (x_{1}-y_{1})^2 & (x_{1}-y_{1})(x_{2}-y_{2}) & (x_{1}-y_{1})(x_{3}-y_{3}) \\ @@ -320,7 +320,7 @@ given by .. math:: - E(x) = \sum_{j=1}^{N} \nabla \times \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} M_{j} + \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} J_{j} + \nabla \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} \rho_{j} + E(x) = \sum_{j=1}^{N} \nabla \times \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} M_{j} + \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} J_{j} + \nabla \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} \rho_{j} where $M_{j}$ are the magnetic current densities, $J_{j}$ are the electric current densities, diff --git a/docs/python.rst b/docs/python.rst index 4318a0d..6feee26 100644 --- a/docs/python.rst +++ b/docs/python.rst @@ -19,11 +19,11 @@ Laplace wrappers This subroutine computes the N-body Laplace interactions and its gradients in three dimensions where -the interaction kernel is given by $1/r$ +the interaction kernel is given by $\frac{1}/{4\pi r}$ .. math:: - u(x) = \sum_{j=1}^{N} \frac{c_{j}}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} \frac{c_{j}}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) where $c_{j}$ are the charge densities $v_{j}$ are the dipole orientation vectors, and @@ -99,11 +99,11 @@ Helmholtz wrappers This subroutine computes the N-body Helmholtz interactions and its gradients in three dimensions where -the interaction kernel is given by $e^{ikr}/r$ +the interaction kernel is given by $\frac{e^{ikr}}{4\pi r}$ .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) + u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) where $c_{j}$ are the charge densities $v_{j}$ are the dipole orientation vectors, and @@ -184,7 +184,7 @@ denote the Stokeslet given by .. math:: - \mathcal{G}^{\textrm{stok}}(x,y)=\frac{1}{2 \|x-y\|^3} + \mathcal{G}^{\textrm{stok}}(x,y)=\frac{1}{8\pi \|x-y\|^3} \begin{bmatrix} (x_{1}-y_{1})^2 + \|x-y \|^2 & (x_{1}-y_{1})(x_{2}-y_{2}) & (x_{1}-y_{1})(x_{3}-y_{3}) \\ @@ -199,7 +199,7 @@ a vector $v$ is given by .. math:: v\cdot \mathcal{T}^{\textrm{stok}}(x,y) = - \frac{3 v \cdot (x-y)}{\|x-y \|^5} + \frac{3 v \cdot (x-y)}{4\pi\|x-y \|^5} \begin{bmatrix} (x_{1}-y_{1})^2 & (x_{1}-y_{1})(x_{2}-y_{2}) & (x_{1}-y_{1})(x_{3}-y_{3}) \\ @@ -299,7 +299,7 @@ given by .. math:: - E(x) = \sum_{j=1}^{N} \nabla \times \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} M_{j} + \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} J_{j} + \nabla \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} \rho_{j} + E(x) = \sum_{j=1}^{N} \nabla \times \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} M_{j} + \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} J_{j} + \nabla \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} \rho_{j} where $M_{j}$ are the magnetic current densities, $J_{j}$ are the electric current densities, diff --git a/julia/src/FMM3D.jl b/julia/src/FMM3D.jl index fe642d4..c5bece7 100644 --- a/julia/src/FMM3D.jl +++ b/julia/src/FMM3D.jl @@ -1239,20 +1239,19 @@ For a source ``y`` and target ``x``, let ``r_i = x_i-y_i`` and let ``r = \\sqrt{r_1^2 + r_2^2 + r_3^2}`` The Stokeslet, ``G_{ij}``, and its associated pressure tensor, -``P_j``, (without the ``1/4\\pi`` scaling) are +``P_j``, are ```math -G_{ij}(x,y) = (r_i r_j)/(2r^3) + \\delta_{ij}/(2r) \\; , +G_{ij}(x,y) = (r_i r_j)/(8\pi r^3) + \\delta_{ij}/(8\pi r) \\; , \\quad -P_j(x,y) = r_j/r^3 +P_j(x,y) = r_j/(4\pi r^3) ``` The (Type I) stresslet, ``T_{ijk}``, and its associated -pressure tensor, ``\\Pi_{jk}``, (without the ``1/4\\pi`` - scaling) are +pressure tensor, ``\\Pi_{jk}``, are ```math - T_{ijk}(x,y) = -3 r_i r_j r_k/ r^5 \\; , \\quad - PI_{jk} = -2 \\delta_{jk} + 6 r_j r_k/r^5 + T_{ijk}(x,y) = -3 r_i r_j r_k/ (4\pi r^5) \\; , \\quad + PI_{jk} = 1/2\pi \\delta_{jk} - 3 r_j r_k/(2\pi r^5) ``` The output of this routine gives the velocity @@ -1464,20 +1463,19 @@ For a source ``y`` and target ``x``, let ``r_i = x_i-y_i`` and let ``r = \\sqrt{r_1^2 + r_2^2 + r_3^2}`` The Stokeslet, ``G_{ij}``, and its associated pressure tensor, -``P_j``, (without the ``1/4\\pi`` scaling) are +``P_j``, are ```math -G_{ij}(x,y) = (r_i r_j)/(2r^3) + \\delta_{ij}/(2r) \\; , +G_{ij}(x,y) = (r_i r_j)/(8\pi r^3) + \\delta_{ij}/(8\pi r) \\; , \\quad P_j(x,y) = r_j/r^3 ``` The (Type I) stresslet, ``T_{ijk}``, and its associated -pressure tensor, ``\\Pi_{jk}``, (without the ``1/4\\pi`` - scaling) are +pressure tensor, ``\\Pi_{jk}``, are ```math - T_{ijk}(x,y) = -3 r_i r_j r_k/ r^5 \\; , \\quad - PI_{jk} = -2 \\delta_{jk} + 6 r_j r_k/r^5 + T_{ijk}(x,y) = -3 r_i r_j r_k/ (4\pi r^5) \\; , \\quad + PI_{jk} = 1/2\pi \\delta_{jk} - 3 r_j r_k/(2\pi r^5) ``` The output of this routine gives the velocity @@ -1753,10 +1751,10 @@ the Helmholtz kernel and its curl and gradient (see below). This is the ``O(N)`` fast multipole code which computes the interactions to the requested precision. -The Helmholtz Green's function (without the ``1/4 \\pi`` scaling) +The Helmholtz Green's function is ```math - G_k(x,y) = \\frac{e^{ik \\|x-y\\|}}{\\|x-y\\|} \\, , + G_k(x,y) = \\frac{e^{ik \\|x-y\\|}}{4\\pi\\|x-y\\|} \\, , ``` This routine computes the sum @@ -1962,10 +1960,10 @@ the effect of sources on targets. If the value at sources is also needed, the routine can be called again with targets equal to the source locations. -The Helmholtz Green's function (without the ``1/4 \\pi`` scaling) +The Helmholtz Green's function is ```math - G_k(x,y) = \\frac{e^{ik \\|x-y\\|}}{\\|x-y\\|} \\, , + G_k(x,y) = \\frac{e^{ik \\|x-y\\|}}{4\\pi\\|x-y\\|} \\, , ``` This routine computes the sum diff --git a/matlab/emfmm3d.m b/matlab/emfmm3d.m index 4c2953d..2958559 100644 --- a/matlab/emfmm3d.m +++ b/matlab/emfmm3d.m @@ -16,10 +16,9 @@ % % for each requested evaluation point x, where h_current and e_current % are 3-vector densities and e_charge is a scalar density supplied -% at each source point y^{(m)}. G_k is the Helmholtz Green function -% without the 1/(4pi) scaling: +% at each source point y^{(m)}. G_k is the Helmholtz Green function: % -% G_k(x,y) = e^(ik|x-y|)/|x-y|. +% G_k(x,y) = e^(ik|x-y|)/(4\pi |x-y|). % % In contrast with other FMM routines in the library, this routine % has only 1 option for the evaluation points: they are specified diff --git a/matlab/fmm3d.c b/matlab/fmm3d.c index c06509a..13e2c7f 100644 --- a/matlab/fmm3d.c +++ b/matlab/fmm3d.c @@ -5373,7 +5373,7 @@ void mexStub19(int nlhs, mxArray* plhs[], mexErrMsgTxt(mw_err_txt_); } -/* ---- fmm3d.mw: 780 ---- +/* ---- fmm3d.mw: 779 ---- * emfmm3d(int64_t[1] nd, double[1] eps, dcomplex[1] zk, int64_t[1] ns, double[3, ns] sources, int64_t[1] ifh_current, dcomplex[nd3, ns_h_current] h_current, int64_t[1] ife_current, dcomplex[nd3, ns_e_current] e_current, int64_t[1] ife_charge, dcomplex[nd, ns_e_charge] e_charge, int64_t[1] nt, double[3, nt] targ, int64_t[1] ifE, inout dcomplex[nd3, nt_E] E, int64_t[1] ifcurlE, inout dcomplex[nd3, nt_curlE] curlE, int64_t[1] ifdivE, inout dcomplex[nd, nt_divE] divE, inout int64_t[1] ier); */ static const char* stubids20_ = "emfmm3d(i int64_t[x], i double[x], i dcomplex[x], i int64_t[x], i double[xx], i int64_t[x], i dcomplex[xx], i int64_t[x], i dcomplex[xx], i int64_t[x], i dcomplex[xx], i int64_t[x], i double[xx], i int64_t[x], io dcomplex[xx], i int64_t[x], io dcomplex[xx], i int64_t[x], io dcomplex[xx], io int64_t[x])"; @@ -5746,7 +5746,7 @@ void mexStub20(int nlhs, mxArray* plhs[], mexErrMsgTxt(mw_err_txt_); } -/* ---- fmm3d.mw: 887 ---- +/* ---- fmm3d.mw: 886 ---- * em3ddirect(int64_t[1] nd, dcomplex[1] zk, int64_t[1] ns, double[3, ns] sources, int64_t[1] ifh_current, dcomplex[nd3, ns_h_current] h_current, int64_t[1] ife_current, dcomplex[nd3, ns_e_current] e_current, int64_t[1] ife_charge, dcomplex[nd, ns_e_charge] e_charge, int64_t[1] nt, double[3, nt] targ, int64_t[1] ifE, inout dcomplex[nd3, nt_E] E, int64_t[1] ifcurlE, inout dcomplex[nd3, nt_curlE] curlE, int64_t[1] ifdivE, inout dcomplex[nd, nt_divE] divE, double[1] thresh); */ static const char* stubids21_ = "em3ddirect(i int64_t[x], i dcomplex[x], i int64_t[x], i double[xx], i int64_t[x], i dcomplex[xx], i int64_t[x], i dcomplex[xx], i int64_t[x], i dcomplex[xx], i int64_t[x], i double[xx], i int64_t[x], io dcomplex[xx], i int64_t[x], io dcomplex[xx], i int64_t[x], io dcomplex[xx], i double[x])"; @@ -6103,7 +6103,7 @@ void mexStub21(int nlhs, mxArray* plhs[], mexErrMsgTxt(mw_err_txt_); } -/* ---- fmm3d.mw: 1082 ---- +/* ---- fmm3d.mw: 1078 ---- * stfmm3d(int64_t[1] nd, double[1] eps, int64_t[1] ns, double[3, ns] sources, int64_t[1] ifstoklet, double[nd3, ns_stok] stoklet, int64_t[1] ifstrslet, double[nd3, ns_strs] strslet, double[nd3, ns_strs] strsvec, int64_t[1] ifppreg, inout double[nd3, ns_pot] pot, inout double[nd, ns_pre] pre, inout double[nd9, ns_grad] grad, int64_t[1] nt, double[3, nt] targ, int64_t[1] ifppregtarg, inout double[nd3, nt_pot] pottarg, inout double[nd, nt_pre] pretarg, inout double[nd9, nt_grad] gradtarg, inout int64_t[1] ier); */ static const char* stubids22_ = "stfmm3d(i int64_t[x], i double[x], i int64_t[x], i double[xx], i int64_t[x], i double[xx], i int64_t[x], i double[xx], i double[xx], i int64_t[x], io double[xx], io double[xx], io double[xx], i int64_t[x], i double[xx], i int64_t[x], io double[xx], io double[xx], io double[xx], io int64_t[x])"; @@ -6485,7 +6485,7 @@ void mexStub22(int nlhs, mxArray* plhs[], mexErrMsgTxt(mw_err_txt_); } -/* ---- fmm3d.mw: 1179 ---- +/* ---- fmm3d.mw: 1175 ---- * st3ddirectstokg(int64_t[1] nd, double[3, ns] sources, double[nd3, ns_stok] stoklet, int64_t[1] ns, double[3, nt] targ, int64_t[1] nt, inout double[nd3, nt] pottarg, inout double[nd, nt] pretarg, inout double[nd9, nt] gradtarg, double[1] thresh); */ static const char* stubids23_ = "st3ddirectstokg(i int64_t[x], i double[xx], i double[xx], i int64_t[x], i double[xx], i int64_t[x], io double[xx], io double[xx], io double[xx], i double[x])"; @@ -6691,7 +6691,7 @@ void mexStub23(int nlhs, mxArray* plhs[], mexErrMsgTxt(mw_err_txt_); } -/* ---- fmm3d.mw: 1182 ---- +/* ---- fmm3d.mw: 1178 ---- * st3ddirectstokstrsg(int64_t[1] nd, double[3, ns] sources, double[nd3, ns_stok] stoklet, int64_t[1] istress, double[nd3, ns_strs] strslet, double[nd3, ns_strs] strsvec, int64_t[1] ns, double[3, nt] targ, int64_t[1] nt, inout double[nd3, nt] pottarg, inout double[nd, nt] pretarg, inout double[nd9, nt] gradtarg, double[1] thresh); */ static const char* stubids24_ = "st3ddirectstokstrsg(i int64_t[x], i double[xx], i double[xx], i int64_t[x], i double[xx], i double[xx], i int64_t[x], i double[xx], i int64_t[x], io double[xx], io double[xx], io double[xx], i double[x])"; @@ -7050,11 +7050,11 @@ void mexFunction(int nlhs, mxArray* plhs[], mexPrintf("%d calls to fmm3d.mw:612\n", mexprofrecord_[17]); mexPrintf("%d calls to fmm3d.mw:615\n", mexprofrecord_[18]); mexPrintf("%d calls to fmm3d.mw:618\n", mexprofrecord_[19]); - mexPrintf("%d calls to fmm3d.mw:780\n", mexprofrecord_[20]); - mexPrintf("%d calls to fmm3d.mw:887\n", mexprofrecord_[21]); - mexPrintf("%d calls to fmm3d.mw:1082\n", mexprofrecord_[22]); - mexPrintf("%d calls to fmm3d.mw:1179\n", mexprofrecord_[23]); - mexPrintf("%d calls to fmm3d.mw:1182\n", mexprofrecord_[24]); + mexPrintf("%d calls to fmm3d.mw:779\n", mexprofrecord_[20]); + mexPrintf("%d calls to fmm3d.mw:886\n", mexprofrecord_[21]); + mexPrintf("%d calls to fmm3d.mw:1078\n", mexprofrecord_[22]); + mexPrintf("%d calls to fmm3d.mw:1175\n", mexprofrecord_[23]); + mexPrintf("%d calls to fmm3d.mw:1178\n", mexprofrecord_[24]); } else if (strcmp(id, "*profile log*") == 0) { FILE* logfp; if (nrhs != 2 || mxGetString(prhs[1], id, sizeof(id)) != 0) @@ -7083,11 +7083,11 @@ void mexFunction(int nlhs, mxArray* plhs[], fprintf(logfp, "%d calls to fmm3d.mw:612\n", mexprofrecord_[17]); fprintf(logfp, "%d calls to fmm3d.mw:615\n", mexprofrecord_[18]); fprintf(logfp, "%d calls to fmm3d.mw:618\n", mexprofrecord_[19]); - fprintf(logfp, "%d calls to fmm3d.mw:780\n", mexprofrecord_[20]); - fprintf(logfp, "%d calls to fmm3d.mw:887\n", mexprofrecord_[21]); - fprintf(logfp, "%d calls to fmm3d.mw:1082\n", mexprofrecord_[22]); - fprintf(logfp, "%d calls to fmm3d.mw:1179\n", mexprofrecord_[23]); - fprintf(logfp, "%d calls to fmm3d.mw:1182\n", mexprofrecord_[24]); + fprintf(logfp, "%d calls to fmm3d.mw:779\n", mexprofrecord_[20]); + fprintf(logfp, "%d calls to fmm3d.mw:886\n", mexprofrecord_[21]); + fprintf(logfp, "%d calls to fmm3d.mw:1078\n", mexprofrecord_[22]); + fprintf(logfp, "%d calls to fmm3d.mw:1175\n", mexprofrecord_[23]); + fprintf(logfp, "%d calls to fmm3d.mw:1178\n", mexprofrecord_[24]); fclose(logfp); } else mexErrMsgTxt("Unknown identifier"); diff --git a/matlab/fmm3d.mw b/matlab/fmm3d.mw index 5c499e6..93f8588 100644 --- a/matlab/fmm3d.mw +++ b/matlab/fmm3d.mw @@ -11,10 +11,10 @@ % % This subroutine computes the N-body Helmholtz % interactions and its gradients in three dimensions, where -% the interaction kernel is given by $e^{ikr}/r$, +% the interaction kernel is given by $e^{ikr}/(4\pi r)$, % -% u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} - -% v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +% u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} - +% v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) % % where $c_{j}$ are the charge densities % $v_{j}$ are the dipole orientation vectors, and @@ -313,10 +313,10 @@ end % % This subroutine computes the N-body Laplace % interactions and its gradients in three dimensions where -% the interaction kernel is given by $1/r$, namely +% the interaction kernel is given by $1/(4\pi r)$, namely % -% u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - -% v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) +% u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - +% v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) % % where $c_{j}$ are the charge densities, % $v_{j}$ are the dipole orientation vectors, and @@ -642,10 +642,9 @@ end % % for each requested evaluation point x, where h_current and e_current % are 3-vector densities and e_charge is a scalar density supplied -% at each source point y^{(m)}. G_k is the Helmholtz Green function -% without the 1/(4pi) scaling: +% at each source point y^{(m)}. G_k is the Helmholtz Green function: % -% G_k(x,y) = e^(ik|x-y|)/|x-y|. +% G_k(x,y) = e^(ik|x-y|)/(4\pi |x-y|). % % In contrast with other FMM routines in the library, this routine % has only 1 option for the evaluation points: they are specified @@ -943,10 +942,7 @@ end % % We use the following as the kernel definitions, noting that: % 1) The dynamic viscosity (mu) is assumed to be 1. -% 2) All kernels are a factor 4pi larger than standard definitions -% (this is for historical reasons). -% Thus, in general, divide the velocity (potential or grad) outputs -% by 4pi.mu, and pressure by 4pi, to recover standard definitions. +% 2) All kernels are using the standard definitions with 1/4pi scaling. % % For a source y and target x, let r_i = x_i-y_i (note sign) % and let r = sqrt(r_1^2 + r_2^2 + r_3^2) @@ -954,14 +950,14 @@ end % The Stokeslet, G_{ij}, and its associated pressure tensor, P_j, % we define as % -% G_{ij}(x,y) = ( delta_{ij}/r + r_i r_j / r^3 )/2 -% P_j(x,y) = r_j/r^3 +% G_{ij}(x,y) = ( delta_{ij}/r + r_i r_j / r^3 )/(8\pi) +% P_j(x,y) = r_j/(4\pi r^3) % % The (Type I) stresslet, T_{ijk}, and its associated pressure % tensor, PI_{jk}, we define as % -% T_{ijk}(x,y) = -3 r_i r_j r_k/ r^5 -% PI_{jk}(x,y) = -2 delta_{jk}/r^3 + 6 r_j r_k/r^5 +% T_{ijk}(x,y) = -3 r_i r_j r_k/ (4\pi r^5) +% PI_{jk}(x,y) = 1/2\pi delta_{jk}/r^3 - 3 r_j r_k/ (2\pi r^5) % % Args: % diff --git a/matlab/fmm3d_legacy.mw b/matlab/fmm3d_legacy.mw index afcf6de..be1f6f6 100644 --- a/matlab/fmm3d_legacy.mw +++ b/matlab/fmm3d_legacy.mw @@ -20,8 +20,8 @@ % % % This subroutine evaluates the Helmholtz potential and field due -% to a collection of charges and dipoles. We use (exp(ikr)/r) for the -% Green's function, without the (1/4 pi) scaling. +% to a collection of charges and dipoles. We use (exp(ikr)/(4\pi r)) for the +% Green's function. % Self-interactions are not-included. % % Input parameters: @@ -154,8 +154,8 @@ end % % % This subroutine evaluates the Helmholtz potential and field due -% to a collection of charges and dipoles. We use (exp(ikr)/r) for the -% Green's function, without the (1/4 pi) scaling. +% to a collection of charges and dipoles. We use (exp(ikr)/(4\pi r)) for the +% Green's function. % Self-interactions are not-included. % % Input parameters: @@ -271,8 +271,8 @@ end % % % This subroutine evaluates the Laplace potential and field due -% to a collection of charges and dipoles. We use (1/r) for the -% Green's function, without the (1/4 pi) scaling. +% to a collection of charges and dipoles. We use (1/(4\pi r)) for the +% Green's function. % Self-interactions are not-included. % % Input parameters: @@ -406,8 +406,8 @@ end % % % This subroutine evaluates the Laplace potential and field due -% to a collection of charges and dipoles. We use (1/r) for the -% Green's function, without the (1/4 pi) scaling. +% to a collection of charges and dipoles. We use (1/(4\pi r)) for the +% Green's function. % Self-interactions are not-included. % % Input parameters: diff --git a/matlab/h3dpartdirect.m b/matlab/h3dpartdirect.m index bb2b2f4..1478600 100644 --- a/matlab/h3dpartdirect.m +++ b/matlab/h3dpartdirect.m @@ -20,8 +20,8 @@ % % % This subroutine evaluates the Helmholtz potential and field due -% to a collection of charges and dipoles. We use (exp(ikr)/r) for the -% Green's function, without the (1/4 pi) scaling. +% to a collection of charges and dipoles. We use (exp(ikr)/(4\pi r)) for the +% Green's function. % Self-interactions are not-included. % % Input parameters: diff --git a/matlab/hfmm3d.m b/matlab/hfmm3d.m index 9a47903..48b28c0 100644 --- a/matlab/hfmm3d.m +++ b/matlab/hfmm3d.m @@ -10,10 +10,10 @@ % % This subroutine computes the N-body Helmholtz % interactions and its gradients in three dimensions, where -% the interaction kernel is given by $e^{ikr}/r$, +% the interaction kernel is given by $e^{ikr}/(4\pi r)$, % -% u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|} - -% v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) +% u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|} - +% v_{j} \cdot \nabla \left( \frac{e^{ik\|x-x_{j}\|}}{4\pi\|x-x_{j}\|}\right) % % where $c_{j}$ are the charge densities % $v_{j}$ are the dipole orientation vectors, and diff --git a/matlab/hfmm3dLegacyTest.m b/matlab/hfmm3dLegacyTest.m index 1bdd04f..9aac79a 100644 --- a/matlab/hfmm3dLegacyTest.m +++ b/matlab/hfmm3dLegacyTest.m @@ -79,11 +79,11 @@ total_time=toc -if( ifpot ), U.pot=U.pot/(4*pi); end -if( iffld ), U.fld=U.fld/(4*pi); end +if( ifpot ), U.pot=U.pot; end +if( iffld ), U.fld=U.fld; end -if( ifpot ), F.pot=F.pot/(4*pi); end -if( iffld ), F.fld=F.fld/(4*pi); end +if( ifpot ), F.pot=F.pot; end +if( iffld ), F.fld=F.fld; end if( ifpot ), %rms_pot = norm((F.pot),2)/sqrt(nsource) @@ -98,11 +98,11 @@ end %%%break; -if( ifpottarg ), U.pottarg=U.pottarg/(4*pi); end -if( iffldtarg ), U.fldtarg=U.fldtarg/(4*pi); end +if( ifpottarg ), U.pottarg=U.pottarg; end +if( iffldtarg ), U.fldtarg=U.fldtarg; end -if( ifpottarg ), F.pottarg=F.pottarg/(4*pi); end -if( iffldtarg ), F.fldtarg=F.fldtarg/(4*pi); end +if( ifpottarg ), F.pottarg=F.pottarg; end +if( iffldtarg ), F.fldtarg=F.fldtarg; end if( ifpottarg ), %rms_pottarg = norm((F.pottarg),2)/sqrt(nsource) diff --git a/matlab/hfmm3dpart.m b/matlab/hfmm3dpart.m index 40d98da..2c620eb 100644 --- a/matlab/hfmm3dpart.m +++ b/matlab/hfmm3dpart.m @@ -20,8 +20,8 @@ % % % This subroutine evaluates the Helmholtz potential and field due -% to a collection of charges and dipoles. We use (exp(ikr)/r) for the -% Green's function, without the (1/4 pi) scaling. +% to a collection of charges and dipoles. We use (exp(ikr)/(4\pi r)) for the +% Green's function. % Self-interactions are not-included. % % Input parameters: diff --git a/matlab/l3dpartdirect.m b/matlab/l3dpartdirect.m index b7c3e34..09d5365 100644 --- a/matlab/l3dpartdirect.m +++ b/matlab/l3dpartdirect.m @@ -20,8 +20,8 @@ % % % This subroutine evaluates the Laplace potential and field due -% to a collection of charges and dipoles. We use (1/r) for the -% Green's function, without the (1/4 pi) scaling. +% to a collection of charges and dipoles. We use (1/(4\pi r)) for the +% Green's function. % Self-interactions are not-included. % % Input parameters: diff --git a/matlab/lfmm3d.m b/matlab/lfmm3d.m index cb87092..29a3a7d 100644 --- a/matlab/lfmm3d.m +++ b/matlab/lfmm3d.m @@ -10,10 +10,10 @@ % % This subroutine computes the N-body Laplace % interactions and its gradients in three dimensions where -% the interaction kernel is given by $1/r$, namely +% the interaction kernel is given by $1/(4\pi r)$, namely % -% u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - -% v_{j} \cdot \nabla \left( \frac{1}{\|x-x_{j}\|}\right) +% u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{4\pi\|x-x_{j}\|} - +% v_{j} \cdot \nabla \left( \frac{1}{4\pi\|x-x_{j}\|}\right) % % where $c_{j}$ are the charge densities, % $v_{j}$ are the dipole orientation vectors, and diff --git a/matlab/lfmm3dLegacyTest.m b/matlab/lfmm3dLegacyTest.m index 4ac9def..b29066f 100644 --- a/matlab/lfmm3dLegacyTest.m +++ b/matlab/lfmm3dLegacyTest.m @@ -72,11 +72,11 @@ total_time=toc -if( ifpot ), U.pot=U.pot/(4*pi); end -if( iffld ), U.fld=U.fld/(4*pi); end +if( ifpot ), U.pot=U.pot; end +if( iffld ), U.fld=U.fld; end -if( ifpot ), F.pot=F.pot/(4*pi); end -if( iffld ), F.fld=F.fld/(4*pi); end +if( ifpot ), F.pot=F.pot; end +if( iffld ), F.fld=F.fld; end if( ifpot ), %rms_pot = norm((F.pot),2)/sqrt(nsource) @@ -91,11 +91,11 @@ end %%%break; -if( ifpottarg ), U.pottarg=U.pottarg/(4*pi); end -if( iffldtarg ), U.fldtarg=U.fldtarg/(4*pi); end +if( ifpottarg ), U.pottarg=U.pottarg; end +if( iffldtarg ), U.fldtarg=U.fldtarg; end -if( ifpottarg ), F.pottarg=F.pottarg/(4*pi); end -if( iffldtarg ), F.fldtarg=F.fldtarg/(4*pi); end +if( ifpottarg ), F.pottarg=F.pottarg; end +if( iffldtarg ), F.fldtarg=F.fldtarg; end if( ifpottarg ), %rms_pottarg = norm((F.pottarg),2)/sqrt(nsource) diff --git a/matlab/lfmm3dpart.m b/matlab/lfmm3dpart.m index 53eb0cf..094adb7 100644 --- a/matlab/lfmm3dpart.m +++ b/matlab/lfmm3dpart.m @@ -20,8 +20,8 @@ % % % This subroutine evaluates the Laplace potential and field due -% to a collection of charges and dipoles. We use (1/r) for the -% Green's function, without the (1/4 pi) scaling. +% to a collection of charges and dipoles. We use (1/(4\pi r)) for the +% Green's function. % Self-interactions are not-included. % % Input parameters: diff --git a/matlab/stfmm3d.m b/matlab/stfmm3d.m index 3b0dd88..f52c51a 100644 --- a/matlab/stfmm3d.m +++ b/matlab/stfmm3d.m @@ -42,10 +42,7 @@ % % We use the following as the kernel definitions, noting that: % 1) The dynamic viscosity (mu) is assumed to be 1. -% 2) All kernels are a factor 4pi larger than standard definitions -% (this is for historical reasons). -% Thus, in general, divide the velocity (potential or grad) outputs -% by 4pi.mu, and pressure by 4pi, to recover standard definitions. +% 2) All kernels are using the standard definitions with 1/4pi scaling. % % For a source y and target x, let r_i = x_i-y_i (note sign) % and let r = sqrt(r_1^2 + r_2^2 + r_3^2) @@ -53,14 +50,14 @@ % The Stokeslet, G_{ij}, and its associated pressure tensor, P_j, % we define as % -% G_{ij}(x,y) = ( delta_{ij}/r + r_i r_j / r^3 )/2 -% P_j(x,y) = r_j/r^3 +% G_{ij}(x,y) = ( delta_{ij}/r + r_i r_j / r^3 )/(8\pi) +% P_j(x,y) = r_j/(4\pi r^3) % % The (Type I) stresslet, T_{ijk}, and its associated pressure % tensor, PI_{jk}, we define as % -% T_{ijk}(x,y) = -3 r_i r_j r_k/ r^5 -% PI_{jk}(x,y) = -2 delta_{jk}/r^3 + 6 r_j r_k/r^5 +% T_{ijk}(x,y) = -3 r_i r_j r_k/ (4\pi r^5) +% PI_{jk}(x,y) = 1/2\pi delta_{jk}/r^3 - 3 r_j r_k/ (2\pi r^5) % % Args: % diff --git a/matlab/stfmm3dPerfTest.m b/matlab/stfmm3dPerfTest.m index d14bcb8..6ed130b 100644 --- a/matlab/stfmm3dPerfTest.m +++ b/matlab/stfmm3dPerfTest.m @@ -43,7 +43,7 @@ ui = ui - (6/r^5)*R*dot(mu,R)*dot(nu,R); % apply T_{ijk}, sign matches end end -ui = 0.5 * ui; % FMM3D is 1/4pi off from true 1/8pi prefactor +ui = 0.125/pi * ui; % FMM3D is now true 1/8pi prefactor fprintf("rel err vs direct at ith targ: %.3g\n\n",norm(u(:,i)-ui)/norm(ui)) @@ -77,6 +77,6 @@ f = srcinfo.stoklet(:,j); % strength Ti = Ti - (3/(4*pi))*(1/r^5)*R*dot(nori,R)*dot(f,R); % true T_{ijk} n_j f_k end -Ti = Ti * (4*pi); % FMM3D has 1/4pi missing in prefactor +%Ti = Ti * (4*pi); % FMM3D has 1/4pi missing in prefactor fprintf("rel err vs direct at ith targ: %.3g\n",norm(T(:,i)-Ti)/norm(Ti)) diff --git a/python/fmm3dpy/fmm3d.py b/python/fmm3dpy/fmm3d.py index bd24d4a..1ba0b82 100644 --- a/python/fmm3dpy/fmm3d.py +++ b/python/fmm3dpy/fmm3d.py @@ -27,12 +27,12 @@ def hfmm3d(*,eps,zk,sources,charges=None,dipvec=None, targets=None,pg=0,pgt=0,nd=1): r""" This subroutine computes the N-body Helmholtz interactions - in three dimensions where the interaction kernel is given by e^{ikr}/r + in three dimensions where the interaction kernel is given by e^{ikr}/(4\pi r) and its gradients. .. math:: - u(x) = \sum_{j=1}^{N} c_{j} \\frac{e^{ik \|x-x_{j}\|}}{\|x-x_{j}\|} - v_{j} \cdot \\nabla \left( \\frac{e^{ik \|x-x_{j}\|}}{\|x-x_{j}\|} \\right) \, , + u(x) = \sum_{j=1}^{N} c_{j} \\frac{e^{ik \|x-x_{j}\|}}{4\pi\|x-x_{j}\|} - v_{j} \cdot \\nabla \left( \\frac{e^{ik \|x-x_{j}\|}}{4\pi\|x-x_{j}\|} \\right) \, , where $c_{j}$ are the charge densities, $v_{j}$ are the dipole orientation vectors, and @@ -201,13 +201,13 @@ def lfmm3d(*,eps,sources,charges=None,dipvec=None, targets=None,pg=0,pgt=0,nd=1): r""" This subroutine computes the N-body Laplace interactions - in three dimensions where the interaction kernel is given by 1/r + in three dimensions where the interaction kernel is given by 1/(4\pi r) and its gradients. .. math:: - u(x) = \sum_{j=1}^{N} c_{j} / \|x-x_{j}\| + v_{j} \cdot \\nabla( 1/\|x-x_{j}\|) \, , + u(x) = \sum_{j=1}^{N} c_{j} / 4\pi\|x-x_{j}\| + v_{j} \cdot \\nabla( 1/4\pi\|x-x_{j}\|) \, , where $c_{j}$ are the charge densities, $v_{j}$ are the dipole orientation vectors, and @@ -713,13 +713,13 @@ def h3ddir(*,zk,sources,targets,charges=None,dipvec=None, pgt=0,nd=1,thresh=1e-16): r""" This subroutine computes the N-body Helmholtz interactions - in three dimensions where the interaction kernel is given by $e^{ikr}/r$ + in three dimensions where the interaction kernel is given by $e^{ikr}/(4\pi r)$ and its gradients. .. math:: - u(x) = \sum_{j=1}^{N} c_{j} e^{ik |x-x_{j}|}/|x-x_{j}| - \\nabla( e^{ik |x-x_{j}|}/|x-x_{j}|) \cdot v_{j} \, , + u(x) = \sum_{j=1}^{N} c_{j} e^{ik |x-x_{j}|}/4\pi|x-x_{j}| - \\nabla( e^{ik |x-x_{j}|}/4\pi|x-x_{j}|) \cdot v_{j} \, , where $c_{j}$ are the charge densities, $v_{j}$ are the dipole orientation vectors, and @@ -823,13 +823,13 @@ def l3ddir(*,sources,targets,charges=None,dipvec=None, pgt=0,nd=1,thresh=1e-16): r""" This subroutine computes the N-body Laplace interactions - in three dimensions where the interaction kernel is given by $1/r$ + in three dimensions where the interaction kernel is given by $1/(4\pi r)$ and its gradients. .. math:: - u(x) = \sum_{j=1}^{N} c_{j} /|x-x_{j}| - \\nabla( 1/|x-x_{j}|) \cdot v_{j} \, , + u(x) = \sum_{j=1}^{N} c_{j} /4\pi|x-x_{j}| - \\nabla( 1/4\pi|x-x_{j}|) \cdot v_{j} \, , where $c_{j}$ are the charge densities, $v_{j}$ are the dipole orientation vectors, and diff --git a/src/Helmholtz/helmkernels.f b/src/Helmholtz/helmkernels.f index 8aa958b..b324224 100644 --- a/src/Helmholtz/helmkernels.f +++ b/src/Helmholtz/helmkernels.f @@ -36,7 +36,7 @@ subroutine h3ddirectcp(nd,zk,sources,charge,ns,ztarg,nt, c of sources and adds to existing c quantities. c -c pot(x) = pot(x) + sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| c j c c where q_{j} is the charge strength @@ -84,6 +84,7 @@ subroutine h3ddirectcp(nd,zk,sources,charge,ns,ztarg,nt, cc temporary variables c real *8 zdiff(3),dd,d + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 zkeye,eye,ztmp integer *8 i,j,idim data eye/(0.0d0,1.0d0)/ @@ -102,7 +103,7 @@ subroutine h3ddirectcp(nd,zk,sources,charge,ns,ztarg,nt, d = sqrt(dd) if(d.lt.thresh) goto 1000 - ztmp = exp(zkeye*d)/d + ztmp = exp(zkeye*d)/d*inv4pi do idim=1,nd pot(idim,i) = pot(idim,i) + charge(idim,j)*ztmp enddo @@ -125,13 +126,13 @@ subroutine h3ddirectcg(nd,zk,sources,charge,ns,ztarg,nt, 1 pot,grad,thresh) c********************************************************************** c -c This subroutine evaluates the potential and gradient due to a +c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| c j c -c grad(x) = grad(x) + Gradient(sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}|) +c grad(x) = grad(x) + Gradient(sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}|) c j c where q_{j} is the charge strength c If |r| < thresh @@ -179,6 +180,7 @@ subroutine h3ddirectcg(nd,zk,sources,charge,ns,ztarg,nt, cc temporary variables c real *8 zdiff(3),dd,d + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 zkeye,eye,cd,cd1,ztmp complex *16 ztmp1,ztmp2,ztmp3 integer *8 i,j,idim @@ -198,7 +200,7 @@ subroutine h3ddirectcg(nd,zk,sources,charge,ns,ztarg,nt, dd = zdiff(1)**2 + zdiff(2)**2 + zdiff(3)**2 d = sqrt(dd) if(d.lt.thresh) goto 1000 - cd = exp(zkeye*d)/d + cd = exp(zkeye*d)/d*inv4pi cd1 = (zkeye*d-1)*cd/dd ztmp1 = cd1*zdiff(1) ztmp2 = cd1*zdiff(2) @@ -233,7 +235,7 @@ subroutine h3ddirectdp(nd,zk,sources, c of sources and adds to existing c quantities. c -c pot(x) = pot(x) + sum \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c pot(x) = pot(x) + sum 1/(4\pi) \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c j c c @@ -286,6 +288,7 @@ subroutine h3ddirectdp(nd,zk,sources, cc temporary variables c real *8 zdiff(3),dd,d,dinv + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 zkeye,eye,cd,cd1,dotprod integer *8 i,j,idim data eye/(0.0d0,1.0d0)/ @@ -305,7 +308,7 @@ subroutine h3ddirectdp(nd,zk,sources, if(d.lt.thresh) goto 1000 dinv = 1/d - cd = exp(zkeye*d)*dinv + cd = exp(zkeye*d)*dinv*inv4pi cd1 = (1-zkeye*d)*cd/dd do idim=1,nd @@ -337,7 +340,7 @@ subroutine h3ddirectdg(nd,zk,sources,dipvec,ns,ztarg,nt,pot, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c pot(x) = pot(x) + sum 1/(4\pi) d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c j c c @@ -345,7 +348,7 @@ subroutine h3ddirectdg(nd,zk,sources,dipvec,ns,ztarg,nt,pot, c grad(x) = grad(x) + Gradient( sum c j c -c \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c ) c c where v_{j} is the dipole orientation vector, @@ -398,6 +401,7 @@ subroutine h3ddirectdg(nd,zk,sources,dipvec,ns,ztarg,nt,pot, cc temporary variables c real *8 zdiff(3),dd,d,dinv,dinv2 + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 zkeye,eye,cd,cd2,cd3,cd4,dotprod integer *8 i,j,idim data eye/(0.0d0,1.0d0)/ @@ -419,7 +423,7 @@ subroutine h3ddirectdg(nd,zk,sources,dipvec,ns,ztarg,nt,pot, dinv = 1/d dinv2 = dinv**2 - cd = exp(zkeye*d)*dinv + cd = exp(zkeye*d)*dinv*inv4pi cd2 = (zkeye*d-1)*cd*dinv2 cd3 = cd*dinv2*(-zkeye*zkeye-3*dinv2+3*zkeye*dinv) @@ -459,10 +463,10 @@ subroutine h3ddirectcdp(nd,zk,sources,charge, c of sources and adds to existing c quantities. c -c pot(x) = pot(x) + sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + c j c -c \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c c where q_{j} is the charge strength, c and v_{j} is the dipole orientation vector, @@ -514,6 +518,7 @@ subroutine h3ddirectcdp(nd,zk,sources,charge, cc temporary variables c real *8 zdiff(3),dd,d,dinv + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 zkeye,eye,cd,cd1,dotprod integer *8 i,j,idim data eye/(0.0d0,1.0d0)/ @@ -533,7 +538,7 @@ subroutine h3ddirectcdp(nd,zk,sources,charge, if(d.lt.thresh) goto 1000 dinv = 1/d - cd = exp(zkeye*d)*dinv + cd = exp(zkeye*d)*dinv*inv4pi cd1 = (1-zkeye*d)*cd/dd do idim=1,nd @@ -568,15 +573,15 @@ subroutine h3ddirectcdg(nd,zk,sources,charge, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + c j c -c \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c -c grad(x) = grad(x) + Gradient( sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + +c grad(x) = grad(x) + Gradient( sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + c j c -c d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c ) c c where q_{j} is the charge strength @@ -630,6 +635,7 @@ subroutine h3ddirectcdg(nd,zk,sources,charge, cc temporary variables c real *8 zdiff(3),dd,d,dinv,dinv2 + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 zkeye,eye,cd,cd2,cd3,cd4,dotprod integer *8 i,j,idim data eye/(0.0d0,1.0d0)/ @@ -651,7 +657,7 @@ subroutine h3ddirectcdg(nd,zk,sources,charge, dinv = 1/d dinv2 = dinv**2 - cd = exp(zkeye*d)*dinv + cd = exp(zkeye*d)*dinv*inv4pi cd2 = (zkeye*d-1)*cd*dinv2 cd3 = cd*dinv2*(-zkeye*zkeye-3*dinv2+3*zkeye*dinv) diff --git a/src/Helmholtz/helmkernels_dr.f b/src/Helmholtz/helmkernels_dr.f index b8ce037..fe7df52 100644 --- a/src/Helmholtz/helmkernels_dr.f +++ b/src/Helmholtz/helmkernels_dr.f @@ -1,6 +1,7 @@ implicit real *8 (a-h,o-z) - parameter (nd = 1) - parameter (nt = 3) + integer *8, parameter :: nd = 1 + integer *8, parameter :: nt = 3 + integer *8 i,icomp,ns real *8 ztarg(3,nt),sources(3,10) complex *16 charge(nd,10),pot(nd,nt),grad(nd,3,nt) complex *16 hess(nd,6,nt) @@ -287,7 +288,8 @@ end subroutine setzero(pot,grad,hess,nd,nt) - implicit real *8 (a-h,o-z) + implicit none + integer *8 nd,nt,ii,jj complex *16 pot(nd,nt),grad(nd,3,nt) complex *16 hess(nd,6,nt) diff --git a/src/Helmholtz/helmkernels_fast.f b/src/Helmholtz/helmkernels_fast.f index ae83a28..8fc8e03 100644 --- a/src/Helmholtz/helmkernels_fast.f +++ b/src/Helmholtz/helmkernels_fast.f @@ -37,7 +37,7 @@ subroutine h3ddirectcp(nd,zk,sources,charge,ns,ztarg,nt, c of sources and adds to existing c quantities. c -c pot(x) = pot(x) + sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| c j c c where q_{j} is the charge strength @@ -100,10 +100,10 @@ subroutine h3ddirectcg(nd,zk,sources,charge,ns,ztarg,nt, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| c j c -c grad(x) = grad(x) + Gradient(sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}|) +c grad(x) = grad(x) + Gradient(sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}|) c j c where q_{j} is the charge strength c If |r| < thresh @@ -167,12 +167,12 @@ subroutine h3ddirectch(nd,zk,sources,charge,ns,ztarg,nt, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| c j c -c grad(x)=grad(x)+Gradient(sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}|) +c grad(x)=grad(x)+Gradient(sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}|) c j -c hess(x)=hess(x)+Hessian(sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}|) +c hess(x)=hess(x)+Hessian(sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}|) c j c where q_{j} is the charge strength c If |r| < thresh @@ -240,7 +240,7 @@ subroutine h3ddirectdp(nd,zk,sources, c of sources and adds to existing c quantities. c -c pot(x) = pot(x) + sum \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c pot(x) = pot(x) + sum 1/(4\pi) \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c j c c @@ -309,15 +309,15 @@ subroutine h3ddirectdg(nd,zk,sources,dipvec,ns,ztarg,nt,pot, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c pot(x) = pot(x) + sum 1/(4\pi) d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c j c c c -c grad(x) = grad(x) + Gradient( sum +c grad(x) = grad(x) + Gradient( sum c j c -c \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c ) c c where v_{j} is the dipole orientation vector, @@ -389,13 +389,13 @@ subroutine h3ddirectdh(nd,zk,sources,dipvec,ns,ztarg,nt,pot, c grad(x)=grad(x)+Gradient( sum c j c -c \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c ) c c hess(x)=hess(x)+Hessian( sum c j c -c \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c ) c c where v_{j} is the dipole orientation vector, @@ -465,10 +465,10 @@ subroutine h3ddirectcdp(nd,zk,sources,charge, c of sources and adds to existing c quantities. c -c pot(x) = pot(x) + sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + c j c -c \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c c where q_{j} is the charge strength, c and v_{j} is the dipole orientation vector, @@ -536,15 +536,15 @@ subroutine h3ddirectcdg(nd,zk,sources,charge, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + c j c -c \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c -c grad(x) = grad(x) + Gradient( sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + +c grad(x) = grad(x) + Gradient( sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + c j c -c d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c ) c c where q_{j} is the charge strength @@ -612,21 +612,21 @@ subroutine h3ddirectcdh(nd,zk,sources,charge, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + c j c -c \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c -c grad(x)=grad(x)+Gradient( sumq_{j} e^{i k |x-x_{j}|}/|x-x_{j}|+ +c grad(x)=grad(x)+Gradient( sumq_{j} 1/(4\pi) e^{i k |x-x_{j}|}/|x-x_{j}|+ c j c -c d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c ) c -c hess(x)=hess(x)+Hessian( sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + +c hess(x)=hess(x)+Hessian( sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + c j c -c d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c ) c c where q_{j} is the charge strength diff --git a/src/Helmholtz/helmkernels_hess.f b/src/Helmholtz/helmkernels_hess.f index 67b0afb..ac9a643 100644 --- a/src/Helmholtz/helmkernels_hess.f +++ b/src/Helmholtz/helmkernels_hess.f @@ -43,7 +43,7 @@ subroutine h3ddirectcp(nd,zk,sources,charge,ns,ztarg,nt, c of sources and adds to existing c quantities. c -c pot(x) = pot(x) + sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| c j c c where q_{j} is the charge strength @@ -91,6 +91,7 @@ subroutine h3ddirectcp(nd,zk,sources,charge,ns,ztarg,nt, cc temporary variables c real *8 zdiff(3),dd,d + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 zkeye,eye,ztmp integer *8 i,j,idim data eye/(0.0d0,1.0d0)/ @@ -107,7 +108,7 @@ subroutine h3ddirectcp(nd,zk,sources,charge,ns,ztarg,nt, d = sqrt(dd) if(d.lt.thresh) goto 1000 - ztmp = exp(zkeye*d)/d + ztmp = exp(zkeye*d)/d*inv4pi do idim=1,nd pot(idim,i) = pot(idim,i) + charge(idim,j)*ztmp enddo @@ -132,10 +133,10 @@ subroutine h3ddirectcg(nd,zk,sources,charge,ns,ztarg,nt, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x)=pot(x)+sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| +c pot(x)=pot(x)+sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| c j c -c grad(x)=grad(x)+Gradient(sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}|) +c grad(x)=grad(x)+Gradient(sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}|) c j c where q_{j} is the charge strength c If |r| < thresh @@ -183,6 +184,7 @@ subroutine h3ddirectcg(nd,zk,sources,charge,ns,ztarg,nt, cc temporary variables c real *8 zdiff(3),dd,d + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 zkeye,eye,cd,cd1,ztmp complex *16 ztmp1,ztmp2,ztmp3 integer *8 i,j,idim @@ -199,7 +201,7 @@ subroutine h3ddirectcg(nd,zk,sources,charge,ns,ztarg,nt, dd = zdiff(1)**2 + zdiff(2)**2 + zdiff(3)**2 d = sqrt(dd) if(d.lt.thresh) goto 1000 - cd = exp(zkeye*d)/d + cd = exp(zkeye*d)/d*inv4pi cd1 = (zkeye*d-1)*cd/dd ztmp1 = cd1*zdiff(1) ztmp2 = cd1*zdiff(2) @@ -231,12 +233,12 @@ subroutine h3ddirectch(nd,zk,sources,charge,ns,ztarg,nt, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| c j c -c grad(x)=grad(x)+Gradient(sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}|) +c grad(x)=grad(x)+Gradient(sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}|) c j -c hess(x)=hess(x)+Hessian(sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}|) +c hess(x)=hess(x)+Hessian(sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}|) c j c where q_{j} is the charge strength c If |r| < thresh @@ -287,6 +289,7 @@ subroutine h3ddirectch(nd,zk,sources,charge,ns,ztarg,nt, cc temporary variables c real *8 zdiff(3),dd,d + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 zkeye,zkeyed,eye,cd,cd1,cd2,ztmp complex *16 ztmp1,ztmp2,ztmp3 complex *16 htmp1,htmp2,htmp3,htmp4,htmp5,htmp6 @@ -305,7 +308,7 @@ subroutine h3ddirectch(nd,zk,sources,charge,ns,ztarg,nt, d = sqrt(dd) if(d.lt.thresh) goto 1000 zkeyed = zkeye*d - cd = exp(zkeyed)/d + cd = exp(zkeyed)/d*inv4pi cd1 = (zkeyed-1)*cd/dd cd2 = (zkeyed*zkeyed - 3*(zkeyed-1))*cd/(dd*dd) ztmp1 = cd1*zdiff(1) @@ -350,7 +353,7 @@ subroutine h3ddirectdp(nd,zk,sources, c of sources and adds to existing c quantities. c -c pot(x)=pot(x)+sum \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c pot(x)=pot(x)+sum 1/(4\pi) \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c j c c @@ -403,6 +406,7 @@ subroutine h3ddirectdp(nd,zk,sources, cc temporary variables c real *8 zdiff(3),dd,d,dinv + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 zkeye,eye,cd,cd1,dotprod integer *8 i,j,idim data eye/(0.0d0,1.0d0)/ @@ -420,7 +424,7 @@ subroutine h3ddirectdp(nd,zk,sources, if(d.lt.thresh) goto 1000 dinv = 1/d - cd = exp(zkeye*d)*dinv + cd = exp(zkeye*d)*dinv*inv4pi cd1 = (1-zkeye*d)*cd/dd do idim=1,nd @@ -451,14 +455,14 @@ subroutine h3ddirectdg(nd,zk,sources,dipvec,ns,ztarg,nt,pot, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x)=pot(x)+sum d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c pot(x)=pot(x)+sum 1/(4\pi) d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c j c c c grad(x)=grad(x)+Gradient( sum c j c -c \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c ) c c where v_{j} is the dipole orientation vector, @@ -511,6 +515,7 @@ subroutine h3ddirectdg(nd,zk,sources,dipvec,ns,ztarg,nt,pot, cc temporary variables c real *8 zdiff(3),dd,d,dinv,dinv2 + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 zkeye,eye,cd,cd2,cd3,cd4,dotprod integer *8 i,j,idim data eye/(0.0d0,1.0d0)/ @@ -529,7 +534,7 @@ subroutine h3ddirectdg(nd,zk,sources,dipvec,ns,ztarg,nt,pot, dinv = 1/d dinv2 = dinv**2 - cd = exp(zkeye*d)*dinv + cd = exp(zkeye*d)*dinv*inv4pi cd2 = (zkeye*d-1)*cd*dinv2 cd3 = cd*dinv2*(-zkeye*zkeye-3*dinv2+3*zkeye*dinv) @@ -567,19 +572,19 @@ subroutine h3ddirectdh(nd,zk,sources,dipvec,ns,ztarg,nt,pot, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x)=pot(x)+sum d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c pot(x)=pot(x)+sum 1/(4\pi) d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c j c c grad(x)=grad(x)+Gradient( sum c j c -c \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c ) c c hess(x)=hess(x)+Hessian( sum c j c -c \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c ) c c where v_{j} is the dipole orientation vector, @@ -635,6 +640,7 @@ subroutine h3ddirectdh(nd,zk,sources,dipvec,ns,ztarg,nt,pot, cc temporary variables c real *8 zdiff(3),dd,d,dinv,dinv2,dx,dy,dz,dinv5 + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 zkeye,eye,cd,cd2,cd3,cd4,dotprod complex *16 cross12,cross13,cross23,zt0,zf1,zf0 complex *16 cdcommon,cdcommon2,cdcommon3,cdcommon4 @@ -659,7 +665,7 @@ subroutine h3ddirectdh(nd,zk,sources,dipvec,ns,ztarg,nt,pot, dinv = 1/d dinv2 = dinv**2 dinv5 = dinv2*dinv2*dinv - cd = exp(zkeye*d)*dinv + cd = exp(zkeye*d)*dinv*inv4pi zf1 = (zkeye*d-1) zf0 = zkeye*d cd2 = (zkeye*d-1)*cd*dinv2 @@ -724,10 +730,10 @@ subroutine h3ddirectcdp(nd,zk,sources,charge, c of sources and adds to existing c quantities. c -c pot(x) = pot(x) + sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + c j c -c \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c c where q_{j} is the charge strength, c and v_{j} is the dipole orientation vector, @@ -779,6 +785,7 @@ subroutine h3ddirectcdp(nd,zk,sources,charge, cc temporary variables c real *8 zdiff(3),dd,d,dinv + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 zkeye,eye,cd,cd1,dotprod integer *8 i,j,idim data eye/(0.0d0,1.0d0)/ @@ -796,7 +803,7 @@ subroutine h3ddirectcdp(nd,zk,sources,charge, if(d.lt.thresh) goto 1000 dinv = 1/d - cd = exp(zkeye*d)*dinv + cd = exp(zkeye*d)*dinv*inv4pi cd1 = (1-zkeye*d)*cd/dd do idim=1,nd @@ -830,15 +837,15 @@ subroutine h3ddirectcdg(nd,zk,sources,charge, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + c j c -c \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c -c grad(x)=grad(x)+Gradient( sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}|+ +c grad(x)=grad(x)+Gradient( sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}|+ c j c -c d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c ) c c where q_{j} is the charge strength @@ -892,6 +899,7 @@ subroutine h3ddirectcdg(nd,zk,sources,charge, cc temporary variables c real *8 zdiff(3),dd,d,dinv,dinv2 + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 zkeye,eye,cd,cd2,cd3,cd4,dotprod integer *8 i,j,idim data eye/(0.0d0,1.0d0)/ @@ -910,7 +918,7 @@ subroutine h3ddirectcdg(nd,zk,sources,charge, dinv = 1/d dinv2 = dinv**2 - cd = exp(zkeye*d)*dinv + cd = exp(zkeye*d)*dinv*inv4pi cd2 = (zkeye*d-1)*cd*dinv2 cd3 = cd*dinv2*(-zkeye*zkeye-3*dinv2+3*zkeye*dinv) @@ -950,21 +958,21 @@ subroutine h3ddirectcdh(nd,zk,sources,charge, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + c j c -c \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c -c grad(x)=grad(x)+Gradient( sumq_{j} e^{i k |x-x_{j}|}/|x-x_{j}|+ +c grad(x)=grad(x)+Gradient( sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}|+ c j c -c d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c ) c -c hess(x)=hess(x)+Hessian( sum q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + +c hess(x)=hess(x)+Hessian( sum 1/(4\pi) q_{j} e^{i k |x-x_{j}|}/|x-x_{j}| + c j c -c d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) d_{j} \nabla e^{ik |x-x_{j}|/|x-x_{j}| \cdot v_{j} c ) c c where q_{j} is the charge strength @@ -1021,6 +1029,7 @@ subroutine h3ddirectcdh(nd,zk,sources,charge, cc temporary variables c real *8 zdiff(3),dd,d,dinv,dinv2,dx,dy,dz,dinv5 + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 zkeye,eye,cd,cd1,cd2,cd3,cd4,dotprod complex *16 cross12,cross13,cross23,zt0,zf1,zf0 complex *16 ztmp1,ztmp2,ztmp3 @@ -1047,7 +1056,7 @@ subroutine h3ddirectcdh(nd,zk,sources,charge, dinv = 1/d dinv2 = dinv**2 dinv5 = dinv2*dinv2*dinv - cd = exp(zkeye*d)*dinv + cd = exp(zkeye*d)*dinv*inv4pi cd1 = (zkeye*d-1)*cd/dd zf1 = (zkeye*d-1) zf0 = zkeye*d diff --git a/src/Helmholtz/helmrouts3d.f b/src/Helmholtz/helmrouts3d.f index 86b0e5d..f815362 100644 --- a/src/Helmholtz/helmrouts3d.f +++ b/src/Helmholtz/helmrouts3d.f @@ -38,8 +38,8 @@ c Using our standard definition, the addition theorem takes c the simple form c -c e^( i k r}/(ikr) = -c \sum_n \sum_m j_n(k|S|) Y_l^m*(S) h_n(k|T|) Y_l^m(T) +c 1/(4\pi) e^( i k r}/(ikr) = +c \sum_n \sum_m 1/(4\pi) j_n(k|S|) Y_l^m*(S) h_n(k|T|) Y_l^m(T) c c c----------------------------------------------------------------------- @@ -454,6 +454,7 @@ subroutine h3dformmpc(nd,zk,rscale,sources,charge, real *8, allocatable :: ynm(:,:) real *8 r,theta,phi real *8 ctheta,stheta,cphi,sphi + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16, allocatable :: fjs(:),fjder(:),ephi(:) complex *16 ephi1,ephi1inv complex *16 z,ztmp,zkeye,eye @@ -465,7 +466,7 @@ subroutine h3dformmpc(nd,zk,rscale,sources,charge, allocate(fjs(0:nterms),fjder(0:nterms),ephi(-nterms:nterms)) allocate(ynm(0:nterms,0:nterms)) - zkeye = eye*zk + zkeye = eye*zk*inv4pi do isrc=1,ns @@ -514,10 +515,10 @@ subroutine h3dformmpc(nd,zk,rscale,sources,charge, c Ylm. Using our standard definition, c the addition theorem takes the simple form c -c e^( i k r}/r = -c (ik) \sum_n \sum_m j_n(k|S|) Ylm*(S) h_n(k|T|)Ylm(T) +c 1/(4\pi) e^( i k r}/r = +c (ik) \sum_n \sum_m 1/(4\pi) j_n(k|S|) Ylm*(S) h_n(k|T|)Ylm(T) c -c so contribution is j_n(k|S|) times +c so contribution is 1/(4\pi) j_n(k|S|) times c c Ylm*(S) = P_l,m * dconjg(ephi(m)) for m > 0 c Yl,m*(S) = P_l,|m| * dconjg(ephi(m)) for m < 0 @@ -600,6 +601,7 @@ subroutine h3dformmpd(nd,zk,rscale,sources, real *8 r,theta,phi real *8 ctheta,stheta,cphi,sphi real *8 rx,thetax,phix,ry,thetay,phiy,rz,thetaz,phiz + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 ux,uy,uz,ur,utheta,uphi,zzz data eye/(0.0d0,1.0d0)/ @@ -610,7 +612,7 @@ subroutine h3dformmpd(nd,zk,rscale,sources, allocate(fjs(0:nterms+1),fjder(0:nterms+1),ephi(-nterms:nterms)) allocate(ynm(0:nterms,0:nterms),ynmd(0:nterms,0:nterms)) - zkeye = eye*zk + zkeye = eye*zk*inv4pi do isrc=1,ns @@ -693,10 +695,10 @@ subroutine h3dformmpd(nd,zk,rscale,sources, c Ylm. Using our standard definition, c the addition theorem takes the simple form c -c e^( i k r}/r = -c (ik) \sum_n \sum_m j_n(k|S|) Ylm*(S) h_n(k|T|)Ylm(T) +c 1/(4\pi) e^( i k r}/r = +c (ik) \sum_n \sum_m 1/(4\pi) j_n(k|S|) Ylm*(S) h_n(k|T|)Ylm(T) c -c so contribution is j_n(k|S|) times +c so contribution is 1/(4\pi) j_n(k|S|) times c c Ylm*(S) = P_l,m * dconjg(ephi(m)) for m > 0 c Yl,m*(S) = P_l,|m| * dconjg(ephi(m)) for m < 0 @@ -814,6 +816,7 @@ subroutine h3dformmpcd(nd,zk,rscale,sources,charge, real *8 r,theta,phi real *8 ctheta,stheta,cphi,sphi real *8 rx,thetax,phix,ry,thetay,phiy,rz,thetaz,phiz + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 ux,uy,uz,ur,utheta,uphi,zzz data eye/(0.0d0,1.0d0)/ @@ -824,7 +827,7 @@ subroutine h3dformmpcd(nd,zk,rscale,sources,charge, allocate(fjs(0:nterms+1),fjder(0:nterms+1),ephi(-nterms:nterms)) allocate(ynm(0:nterms,0:nterms),ynmd(0:nterms,0:nterms)) - zkeye = eye*zk + zkeye = eye*zk*inv4pi do isrc=1,ns @@ -907,10 +910,10 @@ subroutine h3dformmpcd(nd,zk,rscale,sources,charge, c Ylm. Using our standard definition, c the addition theorem takes the simple form c -c e^( i k r}/r = -c (ik) \sum_n \sum_m j_n(k|S|) Ylm*(S) h_n(k|T|)Ylm(T) +c 1/(4\pi) e^( i k r}/r = +c (ik) \sum_n \sum_m 1/(4\pi) j_n(k|S|) Ylm*(S) h_n(k|T|)Ylm(T) c -c so contribution is j_n(k|S|) times +c so contribution is 1/(4\pi) j_n(k|S|) times c c Ylm*(S) = P_l,m * dconjg(ephi(m)) for m > 0 c Yl,m*(S) = P_l,|m| * dconjg(ephi(m)) for m < 0 @@ -1340,6 +1343,7 @@ subroutine h3dformtac(nd,zk,rscale,sources,charge, real *8, allocatable :: ynm(:,:) real *8 r,theta,phi real *8 ctheta,stheta,cphi,sphi + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16, allocatable :: fhs(:),fhder(:),ephi(:) complex *16 ephi1,ephi1inv complex *16 z,ztmp,zkeye,eye @@ -1351,7 +1355,7 @@ subroutine h3dformtac(nd,zk,rscale,sources,charge, allocate(fhs(0:nterms),fhder(0:nterms),ephi(-nterms:nterms)) allocate(ynm(0:nterms,0:nterms)) - zkeye = eye*zk + zkeye = eye*zk*inv4pi do isrc=1,ns @@ -1387,7 +1391,7 @@ subroutine h3dformtac(nd,zk,rscale,sources,charge, call h3dall(nterms,z,rscale,fhs,ifder,fhder) c c -c multiply all hn by charge strength and (i*k). +c multiply all hn by charge strength and 1/(4\pi)*(i*k). c do n = 0,nterms fhs(n) = fhs(n)*zkeye @@ -1469,6 +1473,7 @@ subroutine h3dformtad(nd,zk,rscale,sources, real *8 r,theta,phi real *8 ctheta,stheta,cphi,sphi real *8 rx,thetax,phix,ry,thetay,phiy,rz,thetaz,phiz + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 ux,uy,uz,ur,utheta,uphi,zzz integer *8 idim data eye/(0.0d0,1.0d0)/ @@ -1480,7 +1485,7 @@ subroutine h3dformtad(nd,zk,rscale,sources, allocate(fhs(0:nterms),fhder(0:nterms),ephi(-nterms:nterms)) allocate(ynm(0:nterms,0:nterms),ynmd(0:nterms,0:nterms)) - zkeye = eye*zk + zkeye = eye*zk*inv4pi do isrc=1,ns @@ -1538,7 +1543,7 @@ subroutine h3dformtad(nd,zk,rscale,sources, call h3dall(nterms,z,rscale,fhs,ifder,fhder) c c -c multiply all hn by (i*k). +c multiply all hn by 1/(4\pi) (i*k). c do n = 0,nterms fhs(n) = fhs(n)*zkeye @@ -1552,10 +1557,10 @@ subroutine h3dformtad(nd,zk,rscale,sources, c Ylm. Using our standard definition, c the addition theorem takes the simple form c -c e^( i k r}/r = -c (ik) \sum_n \sum_m j_n(k|T|) Ylm*(T) h_n(k|S|)Ylm(S) +c 1/(4\pi) e^( i k r}/r = +c (ik) \sum_n \sum_m 1/(4\pi) j_n(k|T|) Ylm*(T) h_n(k|S|)Ylm(S) c -c so contribution is j_n(k|S|) times +c so contribution is 1/(4\pi) j_n(k|S|) times c c Ylm*(S) = P_l,m * dconjg(ephi(m)) for m > 0 c Yl,m*(S) = P_l,|m| * dconjg(ephi(m)) for m < 0 @@ -1668,6 +1673,7 @@ subroutine h3dformtacd(nd,zk,rscale,sources,charge, real *8 r,theta,phi real *8 ctheta,stheta,cphi,sphi real *8 rx,thetax,phix,ry,thetay,phiy,rz,thetaz,phiz + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 ux,uy,uz,ur,utheta,uphi,zzz integer *8 idim data eye/(0.0d0,1.0d0)/ @@ -1679,7 +1685,7 @@ subroutine h3dformtacd(nd,zk,rscale,sources,charge, allocate(fhs(0:nterms),fhder(0:nterms),ephi(-nterms:nterms)) allocate(ynm(0:nterms,0:nterms),ynmd(0:nterms,0:nterms)) - zkeye = eye*zk + zkeye = eye*zk*inv4pi do isrc=1,ns @@ -1737,7 +1743,7 @@ subroutine h3dformtacd(nd,zk,rscale,sources,charge, call h3dall(nterms,z,rscale,fhs,ifder,fhder) c c -c multiply all hn by (i*k). +c multiply all hn by 1/(4\pi) (i*k). c do n = 0,nterms fhs(n) = fhs(n)*zkeye @@ -1751,10 +1757,10 @@ subroutine h3dformtacd(nd,zk,rscale,sources,charge, c Ylm. Using our standard definition, c the addition theorem takes the simple form c -c e^( i k r}/r = -c (ik) \sum_n \sum_m j_n(k|T|) Ylm*(T) h_n(k|S|)Ylm(S) +c 1/(4\pi) e^( i k r}/r = +c (ik) \sum_n \sum_m 1/(4\pi) j_n(k|T|) Ylm*(T) h_n(k|S|)Ylm(S) c -c so contribution is j_n(k|S|) times +c so contribution is 1/(4\pi) j_n(k|S|) times c c Ylm*(S) = P_l,m * dconjg(ephi(m)) for m > 0 c Yl,m*(S) = P_l,|m| * dconjg(ephi(m)) for m < 0 diff --git a/src/Helmholtz/hfmm3d.f b/src/Helmholtz/hfmm3d.f index c44f5b6..985d78e 100644 --- a/src/Helmholtz/hfmm3d.f +++ b/src/Helmholtz/hfmm3d.f @@ -4,8 +4,7 @@ c interactions (ignoring self-interaction) c and interactions with targets c -c We use exp(ikr)/r for the Green's function., without -c the 1/(4\pi ) scaling. +c We use 1/(4\pi) * exp(ikr)/r for the Green's function. c c c----------------------------------------------------------- diff --git a/src/Helmholtz/hfmm3d_mps.f90 b/src/Helmholtz/hfmm3d_mps.f90 index 25731af..c12a911 100644 --- a/src/Helmholtz/hfmm3d_mps.f90 +++ b/src/Helmholtz/hfmm3d_mps.f90 @@ -16,8 +16,7 @@ ! It is assume that all multipole expansions are well-separated, so ! that even those in LIST 1 can be translated. ! -! We use exp(ikr)/r for the Green's function., without the 1/4\pi -! scaling. +! We use 1/(4\pi) exp(ikr)/r for the Green's function. ! !-------------------------------------------------------------------- ! diff --git a/src/Helmholtz/hfmm3d_ndiv.f b/src/Helmholtz/hfmm3d_ndiv.f index 26b42f8..356fae8 100644 --- a/src/Helmholtz/hfmm3d_ndiv.f +++ b/src/Helmholtz/hfmm3d_ndiv.f @@ -4,8 +4,7 @@ c interactions (ignoring self-interaction) c and interactions with targets c -c We use exp(ikr)/r for the Green's function., without -c the 1/(4\pi ) scaling. +c We use 1/(4\pi) exp(ikr)/r for the Green's function. c c c----------------------------------------------------------- diff --git a/src/Helmholtz/hfmm3dwrap.f b/src/Helmholtz/hfmm3dwrap.f index b8f0722..534ff98 100644 --- a/src/Helmholtz/hfmm3dwrap.f +++ b/src/Helmholtz/hfmm3dwrap.f @@ -3,8 +3,8 @@ c The Helmholtz FMM evaluates the following potential c and its gradient c -c u(x) = \sum_{j=1}^{N} c_{j}e^{ik|x-x_{j}|}/|x-x_{j}| -c - v_{j}.\nabla (e^{ik|x-x_{j}|}/|x-x_{j}|) +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j}e^{ik|x-x_{j}|}/|x-x_{j}| +c - 1/(4\pi) v_{j}.\nabla (e^{ik|x-x_{j}|}/|x-x_{j}|) c c Here x_{j} are the source locations, c_{j} are the charge strengths, c v_{j} are the dipole strengths. We refer to the collection of @@ -133,7 +133,7 @@ subroutine hfmm3d_s_c_p(eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -215,7 +215,7 @@ subroutine hfmm3d_s_c_g(eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -298,7 +298,7 @@ subroutine hfmm3d_s_d_p(eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( +c u(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -381,7 +381,7 @@ subroutine hfmm3d_s_d_g(eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( +c u(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -465,8 +465,8 @@ subroutine hfmm3d_s_cd_p(eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - -c v_{j} \cdot \nabla \left( +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -555,8 +555,8 @@ subroutine hfmm3d_s_cd_g(eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - -c v_{j} \cdot \nabla \left( +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -643,7 +643,7 @@ subroutine hfmm3d_t_c_p(eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -729,7 +729,7 @@ subroutine hfmm3d_t_c_g(eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -814,7 +814,7 @@ subroutine hfmm3d_t_d_p(eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( +c u(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -901,7 +901,7 @@ subroutine hfmm3d_t_d_g(eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( +c u(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -988,8 +988,8 @@ subroutine hfmm3d_t_cd_p(eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - -c v_{j} \cdot \nabla \left( +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -1078,8 +1078,8 @@ subroutine hfmm3d_t_cd_g(eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - -c v_{j} \cdot \nabla \left( +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -1168,7 +1168,7 @@ subroutine hfmm3d_st_c_p(eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -1256,7 +1256,7 @@ subroutine hfmm3d_st_c_g(eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -1347,7 +1347,7 @@ subroutine hfmm3d_st_d_p(eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( +c u(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. @@ -1437,7 +1437,7 @@ subroutine hfmm3d_st_d_g(eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( +c u(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. @@ -1528,8 +1528,8 @@ subroutine hfmm3d_st_cd_p(eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - -c v_{j} \cdot \nabla \left( +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. @@ -1620,8 +1620,8 @@ subroutine hfmm3d_st_cd_g(eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - -c v_{j} \cdot \nabla \left( +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. diff --git a/src/Helmholtz/hfmm3dwrap_legacy.f b/src/Helmholtz/hfmm3dwrap_legacy.f index 3d4d4fe..02a9bd6 100644 --- a/src/Helmholtz/hfmm3dwrap_legacy.f +++ b/src/Helmholtz/hfmm3dwrap_legacy.f @@ -34,8 +34,8 @@ subroutine hfmm3dpart(ier,iprec,zk,nsource,source, c c Helmholtz FMM in R^3: evaluate all pairwise particle c interactions (ignoring self-interaction). -c We use (exp(ikr)/r) for the Green's function, without the -c (1/4 pi) scaling. Self-interactions are not included. +c We use 1/(4\pi) (exp(ikr)/r) for the Green's function. +c Self-interactions are not included. c c The main FMM routine permits both evaluation at sources c and at a collection of targets. @@ -84,9 +84,9 @@ subroutine hfmm3dpartself(ier,iprec,zk,nsource,source, c c c Helmholtz FMM in R^3: evaluate all pairwise particle -c interactions (ignoring self-interaction). -c We use (exp(ikr)/r) for the Green's function, without the -c (1/4 pi) scaling. Self-interactions are not included. +c interactions (ignoring self-interaction). +c We use 1/(4\pi) (exp(ikr)/r) for the Green's function. +c Self-interactions are not included. c c The main FMM routine permits both evaluation at sources c and at a collection of targets. @@ -141,8 +141,8 @@ subroutine hfmm3dparttarg(ier,iprec,zk,nsource,source, c interactions (ignoring self-interaction) c and interactions with targets. c -c We use (exp(ikr)/r) for the Green's function, -c without the (1/4 pi) scaling. Self-interactions are not included. +c We use 1/(4\pi) (exp(ikr)/r) for the Green's function. +c Self-interactions are not included. c c This is primarily a memory management code. c The actual work is carried out in subroutine hfmm3dparttargmain. @@ -350,8 +350,8 @@ subroutine h3dpartdirect(zk,ns, c interactions (ignoring self-interaction) c and interactions with targets via direct O(N^2) algorithm. c -c We use (exp(ikr)/r) for the Green's function, -c without the (1/4 pi) scaling. Self-interactions are not-included. +c We use 1/(4\pi) (exp(ikr)/r) for the Green's function. +c Self-interactions are not-included. c c INPUT PARAMETERS: c diff --git a/src/Helmholtz/hfmm3dwrap_vec.f b/src/Helmholtz/hfmm3dwrap_vec.f index 8647dad..d602cb2 100644 --- a/src/Helmholtz/hfmm3dwrap_vec.f +++ b/src/Helmholtz/hfmm3dwrap_vec.f @@ -4,8 +4,8 @@ c The Helmholtz FMM evaluates the following potential c and its gradient c -c u_{l}(x) = \sum_{j=1}^{N} c_{l,j}e^{ik|x-x_{j}|}/|x-x_{j}| - -c v_{l,j}.\nabla (e^{ik|x-x_{j}|/|x-x_{j}|) +c u_{l}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{l,j}e^{ik|x-x_{j}|}/|x-x_{j}| - +c 1/(4\pi) v_{l,j}.\nabla (e^{ik|x-x_{j}|/|x-x_{j}|) c c Here x_{j} are the source locations, c_{l,j} are the charge strengths, c v_{l,j} are the dipole strengths. We refer to the collection of @@ -136,7 +136,7 @@ subroutine hfmm3d_s_c_p_vec(nd,eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} c c at the source locations $x=x_{j}$. @@ -220,7 +220,7 @@ subroutine hfmm3d_s_c_g_vec(nd,eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} c c at the source locations $x=x_{j}$. @@ -307,7 +307,7 @@ subroutine hfmm3d_s_d_p_vec(nd,eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -393,7 +393,7 @@ subroutine hfmm3d_s_d_g_vec(nd,eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -480,9 +480,9 @@ subroutine hfmm3d_s_cd_p_vec(nd,eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} -c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - -c v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} +c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - +c 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -574,9 +574,9 @@ subroutine hfmm3d_s_cd_g_vec(nd,eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - -c v_{\ell,j} \cdot \nabla \left( +c 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -666,7 +666,7 @@ subroutine hfmm3d_t_c_p_vec(nd,eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} c c at the target locations $x=t_{i}$. @@ -756,7 +756,7 @@ subroutine hfmm3d_t_c_g_vec(nd,eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} c c at the target locations $x=t_{i}$. @@ -845,7 +845,7 @@ subroutine hfmm3d_t_d_p_vec(nd,eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -936,7 +936,7 @@ subroutine hfmm3d_t_d_g_vec(nd,eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -1027,9 +1027,9 @@ subroutine hfmm3d_t_cd_p_vec(nd,eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - -c v_{\ell,j} \cdot \nabla \left( +c 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -1122,9 +1122,9 @@ subroutine hfmm3d_t_cd_g_vec(nd,eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - -c v_{\ell,j} \cdot \nabla \left( +c 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -1217,7 +1217,7 @@ subroutine hfmm3d_st_c_p_vec(nd,eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. @@ -1310,7 +1310,7 @@ subroutine hfmm3d_st_c_g_vec(nd,eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. @@ -1405,7 +1405,7 @@ subroutine hfmm3d_st_d_p_vec(nd,eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. @@ -1498,7 +1498,7 @@ subroutine hfmm3d_st_d_g_vec(nd,eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. @@ -1593,9 +1593,9 @@ subroutine hfmm3d_st_cd_p_vec(nd,eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - -c v_{\ell,j} \cdot \nabla \left( +c 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. @@ -1689,9 +1689,9 @@ subroutine hfmm3d_st_cd_g_vec(nd,eps,zk,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} c \frac{e^{ik\|x- x_{j}\|}}{\|x-x_{j}\|} - -c v_{\ell,j} \cdot \nabla \left( +c 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{e^{ik\|x-x_{j}\|}}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. diff --git a/src/Laplace/lapkernels.f b/src/Laplace/lapkernels.f index 5b8250f..6e77358 100644 --- a/src/Laplace/lapkernels.f +++ b/src/Laplace/lapkernels.f @@ -48,7 +48,7 @@ subroutine l3ddirectcp(nd,sources,charge,ns,ztarg,nt, c of sources and adds to existing c quantities. c -c pot(x) = pot(x) + sum q_{j} /|x-x_{j}| +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} /|x-x_{j}| c j c c where q_{j} is the charge strength @@ -93,9 +93,9 @@ subroutine l3ddirectcp(nd,sources,charge,ns,ztarg,nt, cc temporary variables c real *8 zdiff(3),dd,d,ztmp,threshsq + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 integer *8 i,j,idim - threshsq = thresh**2 do i=1,nt do j=1,ns @@ -106,7 +106,7 @@ subroutine l3ddirectcp(nd,sources,charge,ns,ztarg,nt, dd = zdiff(1)**2 + zdiff(2)**2 + zdiff(3)**2 if(dd.lt.threshsq) goto 1000 - ztmp = 1.0d0/sqrt(dd) + ztmp = inv4pi/sqrt(dd) do idim=1,nd pot(idim,i) = pot(idim,i) + charge(idim,j)*ztmp enddo @@ -130,10 +130,10 @@ subroutine l3ddirectcg(nd,sources,charge,ns,ztarg,nt, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum q_{j} /|x-x_{j}| +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} /|x-x_{j}| c j c -c grad(x) = grad(x) + Gradient(sum q_{j} /|x-x_{j}|) +c grad(x) = grad(x) + Gradient(sum 1/(4\pi) q_{j} /|x-x_{j}|) c j c where q_{j} is the charge strength c If |r| < thresh @@ -179,6 +179,7 @@ subroutine l3ddirectcg(nd,sources,charge,ns,ztarg,nt, c real *8 zdiff(3),dd,d,cd,cd1,ztmp1,ztmp2,ztmp3 real *8 threshsq + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 integer *8 i,j,idim @@ -191,7 +192,7 @@ subroutine l3ddirectcg(nd,sources,charge,ns,ztarg,nt, dd = zdiff(1)**2 + zdiff(2)**2 + zdiff(3)**2 if(dd.lt.threshsq) goto 1000 - cd = 1/sqrt(dd) + cd = inv4pi/sqrt(dd) cd1 = -cd/dd ztmp1 = cd1*zdiff(1) ztmp2 = cd1*zdiff(2) @@ -224,12 +225,12 @@ subroutine l3ddirectch(nd,sources,charge,ns,ztarg,nt, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum q_{j} /|x-x_{j}| +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} /|x-x_{j}| c j c -c grad(x) = grad(x) + Gradient(sum q_{j} /|x-x_{j}|) +c grad(x) = grad(x) + Gradient(sum 1/(4\pi) q_{j} /|x-x_{j}|) c -c hess(x) = hess(x) + Hessian(sum q_{j} /|x-x_{j}|) +c hess(x) = hess(x) + Hessian(sum 1/(4\pi) q_{j} /|x-x_{j}|) c j c where q_{j} is the charge strength c If |r| < thresh @@ -279,6 +280,7 @@ subroutine l3ddirectch(nd,sources,charge,ns,ztarg,nt, real *8 zdiff(3),dd,d,cd,cd1,cd2,ztmp1,ztmp2,ztmp3 real *8 htmp1,htmp2,htmp3,htmp4,htmp5,htmp6 real *8 threshsq + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 integer *8 i,j,idim @@ -291,7 +293,7 @@ subroutine l3ddirectch(nd,sources,charge,ns,ztarg,nt, dd = zdiff(1)**2 + zdiff(2)**2 + zdiff(3)**2 if(dd.lt.threshsq) goto 1000 - cd = 1/sqrt(dd) + cd = inv4pi/sqrt(dd) cd1 = -cd/dd cd2 = -cd1/dd ztmp1 = cd1*zdiff(1) @@ -338,7 +340,7 @@ subroutine l3ddirectdp(nd,sources, c of sources and adds to existing c quantities. c -c pot(x) = pot(x) + sum \nabla 1/|x-x_{j}| \cdot v_{j} +c pot(x) = pot(x) + sum 1/(4\pi) \nabla 1/|x-x_{j}| \cdot v_{j} c c where v_{j} is the dipole orientation vector, c \nabla denotes the gradient is with respect to the x_{j} @@ -385,6 +387,7 @@ subroutine l3ddirectdp(nd,sources, c real *8 zdiff(3),dd,d,cd,dotprod real *8 threshsq + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 integer *8 i,j,idim threshsq = thresh**2 @@ -398,7 +401,7 @@ subroutine l3ddirectdp(nd,sources, dd = zdiff(1)**2 + zdiff(2)**2 + zdiff(3)**2 if(dd.lt.threshsq) goto 1000 - cd = 1/sqrt(dd)/dd + cd = inv4pi/sqrt(dd)/dd do idim=1,nd dotprod = zdiff(1)*dipvec(idim,1,j) + @@ -429,13 +432,13 @@ subroutine l3ddirectdg(nd,sources, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum d_{j} \nabla 1/|x-x_{j}| \cdot v_{j} +c pot(x) = pot(x) + sum 1/(4\pi) d_{j} \nabla 1/|x-x_{j}| \cdot v_{j} c j c c grad(x) = grad(x) + Gradient( sum c j c -c \nabla 1|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla 1|/|x-x_{j}| \cdot v_{j} c ) c c where v_{j} is the dipole orientation vector, @@ -486,6 +489,7 @@ subroutine l3ddirectdg(nd,sources, real *8 zdiff(3),dd,d,dinv,dinv2,dotprod real *8 cd,cd2,cd3,cd4 real *8 threshsq + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 integer *8 i,j,idim threshsq = thresh**2 @@ -501,7 +505,7 @@ subroutine l3ddirectdg(nd,sources, dinv2 = 1/dd dinv = sqrt(dinv2) - cd = dinv + cd = inv4pi*dinv cd2 = -cd*dinv2 cd3 = -3*cd*dinv2*dinv2 @@ -539,19 +543,19 @@ subroutine l3ddirectdh(nd,sources, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum d_{j} \nabla 1/|x-x_{j}| \cdot v_{j} +c pot(x) = pot(x) + sum 1/(4\pi) d_{j} \nabla 1/|x-x_{j}| \cdot v_{j} c j c c grad(x) = grad(x) + Gradient( sum c j c -c \nabla 1|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla 1|/|x-x_{j}| \cdot v_{j} c ) c c hess(x) = hess(x) + Hessian( sum c j c -c \nabla 1|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla 1|/|x-x_{j}| \cdot v_{j} c ) c c where v_{j} is the dipole orientation vector, @@ -604,6 +608,7 @@ subroutine l3ddirectdh(nd,sources, real *8 zdiff(3),dd,d,dinv,dinv2,dotprod real *8 cd,cd2,cd3,cd4,cd5,dx,dy,dz real *8 threshsq + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 integer *8 i,j,idim threshsq = thresh**2 @@ -619,7 +624,7 @@ subroutine l3ddirectdh(nd,sources, dinv2 = 1/dd dinv = sqrt(dinv2) - cd = dinv + cd = inv4pi*dinv cd2 = -cd*dinv2 cd3 = -3*cd*dinv2*dinv2 cd5 = -cd3 @@ -681,10 +686,10 @@ subroutine l3ddirectcdp(nd,sources,charge, c of sources and adds to existing c quantities. c -c pot(x) = pot(x) + sum q_{j} 1/|x-x_{j}| + +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} 1/|x-x_{j}| + c j c -c \nabla 1/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla 1/|x-x_{j}| \cdot v_{j} c c where q_{j} is the charge strength, c and v_{j} is the dipole orientation vector, @@ -734,6 +739,7 @@ subroutine l3ddirectcdp(nd,sources,charge, real *8 zdiff(3),dd,d,dinv2,dotprod,cd,cd1 integer *8 i,j,idim real *8 threshsq + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 threshsq = thresh**2 @@ -747,7 +753,7 @@ subroutine l3ddirectcdp(nd,sources,charge, if(dd.lt.threshsq) goto 1000 dinv2 = 1/dd - cd = sqrt(dinv2) + cd = inv4pi*sqrt(dinv2) cd1 = cd*dinv2 do idim=1,nd @@ -780,15 +786,15 @@ subroutine l3ddirectcdg(nd,sources,charge, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum q_{j} 1/|x-x_{j}| + +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} 1/|x-x_{j}| + c j c -c \nabla 1/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla 1/|x-x_{j}| \cdot v_{j} c -c grad(x) = grad(x) + Gradient( sum q_{j} 1/|x-x_{j}| + +c grad(x) = grad(x) + Gradient( sum 1/(4\pi) q_{j} 1/|x-x_{j}| + c j c -c \nabla 1/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla 1/|x-x_{j}| \cdot v_{j} c ) c c where q_{j} is the charge strength, @@ -841,6 +847,7 @@ subroutine l3ddirectcdg(nd,sources,charge, real *8 zdiff(3),dd,d,dinv,dinv2,dotprod,cd,cd2,cd3,cd4 integer *8 i,j,idim real *8 threshsq + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 threshsq = thresh**2 @@ -854,7 +861,7 @@ subroutine l3ddirectcdg(nd,sources,charge, if(dd.lt.threshsq) goto 1000 dinv2 = 1/dd - cd = sqrt(dinv2) + cd = inv4pi*sqrt(dinv2) cd2 = -cd*dinv2 cd3 = -3*cd*dinv2*dinv2 @@ -895,15 +902,15 @@ subroutine l3ddirectcdh(nd,sources,charge, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum q_{j} 1/|x-x_{j}| + +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} 1/|x-x_{j}| + c j c -c \nabla 1/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla 1/|x-x_{j}| \cdot v_{j} c -c grad(x) = grad(x) + Gradient( sum q_{j} 1/|x-x_{j}| + +c grad(x) = grad(x) + Gradient( sum 1/(4\pi) q_{j} 1/|x-x_{j}| + c j c -c \nabla 1/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla 1/|x-x_{j}| \cdot v_{j} c ) c c where q_{j} is the charge strength, @@ -960,6 +967,7 @@ subroutine l3ddirectcdh(nd,sources,charge, real *8 zdiff(3),dd,d,dinv,dinv2,dotprod,cd,cd2,cd3,cd4,cd5 real *8 htmp1,htmp2,htmp3,htmp4,htmp5,htmp6,dx,dy,dz real *8 threshsq + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 threshsq = thresh**2 @@ -973,16 +981,17 @@ subroutine l3ddirectcdh(nd,sources,charge, if(dd.lt.threshsq) goto 1000 dinv2 = 1/dd - cd = sqrt(dinv2) + dinv = sqrt(dinv2) + cd = inv4pi*dinv cd2 = -cd*dinv2 cd3 = -3*cd*dinv2*dinv2 c cd4 = -cd2/dd c cd5 = -cd3 - dx = zdiff(1)*cd - dy = zdiff(2)*cd - dz = zdiff(3)*cd + dx = zdiff(1)*dinv + dy = zdiff(2)*dinv + dz = zdiff(3)*dinv c htmp1 = cd4*(3*zdiff(1)*zdiff(1)-dd) htmp2 = cd4*(3*zdiff(2)*zdiff(2)-dd) diff --git a/src/Laplace/lapkernels_dr.f b/src/Laplace/lapkernels_dr.f index a06e9f4..3181278 100644 --- a/src/Laplace/lapkernels_dr.f +++ b/src/Laplace/lapkernels_dr.f @@ -1,6 +1,7 @@ implicit real *8 (a-h,o-z) - parameter (nd = 1) - parameter (nt = 3) + integer *8, parameter :: nd = 1 + integer *8, parameter :: nt = 3 + integer *8 ns real *8 ztarg(3,nt),sources(3,10) real *8 charge(nd,10),pot(nd,nt),grad(nd,3,nt) real *8 hess(nd,6,nt) @@ -140,6 +141,7 @@ subroutine setzero(pot,grad,hess,nd,nt) implicit real *8 (a-h,o-z) + integer *8 nd,nt,ii,jj real *8 pot(nd,nt),grad(nd,3,nt) real *8 hess(nd,6,nt) diff --git a/src/Laplace/lapkernels_fast.f b/src/Laplace/lapkernels_fast.f index 340c737..8302a8e 100644 --- a/src/Laplace/lapkernels_fast.f +++ b/src/Laplace/lapkernels_fast.f @@ -49,7 +49,7 @@ subroutine l3ddirectcp(nd,sources,charge,ns,ztarg,nt, c of sources and adds to existing c quantities. c -c pot(x) = pot(x) + sum q_{j} /|x-x_{j}| +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} /|x-x_{j}| c j c c where q_{j} is the charge strength @@ -109,10 +109,10 @@ subroutine l3ddirectcg(nd,sources,charge,ns,ztarg,nt, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum q_{j} /|x-x_{j}| +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} /|x-x_{j}| c j c -c grad(x) = grad(x) + Gradient(sum q_{j} /|x-x_{j}|) +c grad(x) = grad(x) + Gradient(sum 1/(4\pi) q_{j} /|x-x_{j}|) c j c where q_{j} is the charge strength c If |r| < thresh @@ -174,12 +174,12 @@ subroutine l3ddirectch(nd,sources,charge,ns,ztarg,nt, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum q_{j} /|x-x_{j}| +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} /|x-x_{j}| c j c -c grad(x) = grad(x) + Gradient(sum q_{j} /|x-x_{j}|) +c grad(x) = grad(x) + Gradient(sum 1/(4\pi) q_{j} /|x-x_{j}|) c -c hess(x) = hess(x) + Hessian(sum q_{j} /|x-x_{j}|) +c hess(x) = hess(x) + Hessian(sum 1/(4\pi) q_{j} /|x-x_{j}|) c j c where q_{j} is the charge strength c If |r| < thresh @@ -244,7 +244,7 @@ subroutine l3ddirectdp(nd,sources, c of sources and adds to existing c quantities. c -c pot(x) = pot(x) + sum \nabla 1/|x-x_{j}| \cdot v_{j} +c pot(x) = pot(x) + sum 1/(4\pi) \nabla 1/|x-x_{j}| \cdot v_{j} c c where v_{j} is the dipole orientation vector, c \nabla denotes the gradient is with respect to the x_{j} @@ -305,13 +305,13 @@ subroutine l3ddirectdg(nd,sources, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum d_{j} \nabla 1/|x-x_{j}| \cdot v_{j} +c pot(x) = pot(x) + sum 1/(4\pi) d_{j} \nabla 1/|x-x_{j}| \cdot v_{j} c j c c grad(x) = grad(x) + Gradient( sum c j c -c \nabla 1|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla 1|/|x-x_{j}| \cdot v_{j} c ) c c where v_{j} is the dipole orientation vector, @@ -374,19 +374,19 @@ subroutine l3ddirectdh(nd,sources, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum d_{j} \nabla 1/|x-x_{j}| \cdot v_{j} +c pot(x) = pot(x) + sum 1/(4\pi) d_{j} \nabla 1/|x-x_{j}| \cdot v_{j} c j c c grad(x) = grad(x) + Gradient( sum c j c -c \nabla 1|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla 1|/|x-x_{j}| \cdot v_{j} c ) c c hess(x) = hess(x) + Hessian( sum c j c -c \nabla 1|/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla 1|/|x-x_{j}| \cdot v_{j} c ) c c where v_{j} is the dipole orientation vector, @@ -451,10 +451,10 @@ subroutine l3ddirectcdp(nd,sources,charge, c of sources and adds to existing c quantities. c -c pot(x) = pot(x) + sum q_{j} 1/|x-x_{j}| + +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} 1/|x-x_{j}| + c j c -c \nabla 1/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla 1/|x-x_{j}| \cdot v_{j} c c where q_{j} is the charge strength, c and v_{j} is the dipole orientation vector, @@ -518,15 +518,15 @@ subroutine l3ddirectcdg(nd,sources,charge, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum q_{j} 1/|x-x_{j}| + +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} 1/|x-x_{j}| + c j c -c \nabla 1/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla 1/|x-x_{j}| \cdot v_{j} c -c grad(x) = grad(x) + Gradient( sum q_{j} 1/|x-x_{j}| + +c grad(x) = grad(x) + Gradient( sum 1/(4\pi) q_{j} 1/|x-x_{j}| + c j c -c \nabla 1/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla 1/|x-x_{j}| \cdot v_{j} c ) c c where q_{j} is the charge strength, @@ -591,15 +591,15 @@ subroutine l3ddirectcdh(nd,sources,charge, c This subroutine evaluates the potential and gradient due to a c collection of sources and adds to existing quantities. c -c pot(x) = pot(x) + sum q_{j} 1/|x-x_{j}| + +c pot(x) = pot(x) + sum 1/(4\pi) q_{j} 1/|x-x_{j}| + c j c -c \nabla 1/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla 1/|x-x_{j}| \cdot v_{j} c -c grad(x) = grad(x) + Gradient( sum q_{j} 1/|x-x_{j}| + +c grad(x) = grad(x) + Gradient( sum 1/(4\pi) q_{j} 1/|x-x_{j}| + c j c -c \nabla 1/|x-x_{j}| \cdot v_{j} +c 1/(4\pi) \nabla 1/|x-x_{j}| \cdot v_{j} c ) c c where q_{j} is the charge strength, diff --git a/src/Laplace/laprouts3d.f b/src/Laplace/laprouts3d.f index 806842e..4e265fc 100644 --- a/src/Laplace/laprouts3d.f +++ b/src/Laplace/laprouts3d.f @@ -42,13 +42,13 @@ c using our standard definition, the addition theorem takes c the simple form c -c 1/r = -c \sum_n 1/(2n+1) \sum_m |s|^n ylm*(s) ylm(t)/ (|t|^(n+1)) +c 1/(4\pi) 1/r = +c \sum_n 1/(2n+1) \sum_m 1/(4\pi) |s|^n ylm*(s) ylm(t)/ (|t|^(n+1)) c -c 1/r = -c \sum_n \sum_m |s|^n ylm*(s) ylm(t) / (|t|^(n+1)) -c ------- ------ -c sqrt(2n+1) sqrt(2n+1) +c 1/(4\pi) 1/r = +c \sum_n \sum_m 1/(4\pi) |s|^n ylm*(s) ylm(t) / (|t|^(n+1)) +c ------- ------ +c sqrt(2n+1) sqrt(2n+1) c c in the laplace library (this library), we incorporate the c sqrt(2n+1) factor in both forming and evaluating multipole @@ -478,6 +478,7 @@ subroutine l3dformmpc(nd,rscale,sources,charge,ns,center, real *8 zdiff(3) real *8, allocatable :: ynm(:,:),fr(:),rfac(:) real *8 theta,stheta,ctheta,phi,sphi,cphi,dtmp,d,r + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16, allocatable :: ephi(:) complex *16 ephi1 complex *16 eye @@ -508,9 +509,9 @@ subroutine l3dformmpc(nd,rscale,sources,charge,ns,center, ephi(0)=1.0d0 ephi(1)=ephi1 ephi(-1)=dconjg(ephi1) - fr(0) = 1.0d0 + fr(0) = inv4pi d = r/rscale - fr(1) = d + fr(1) = inv4pi*d do i=2,nterms+1 fr(i) = fr(i-1)*d ephi(i)=ephi(i-1)*ephi1 @@ -535,10 +536,10 @@ subroutine l3dformmpc(nd,rscale,sources,charge,ns,center, c Ylm. Using our standard definition, c the addition theorem takes the simple form c -c 1/r = -c \sum_n 1/(2n+1) \sum_m |S|^n Ylm*(S) Ylm(T) / (|T|)^{n+1} +c 1/(4\pi) 1/r = +c \sum_n 1/(2n+1) \sum_m 1/(4\pi) |S|^n Ylm*(S) Ylm(T) / (|T|)^{n+1} c -c so contribution is |S|^n times +c so contribution is 1/(4\pi) |S|^n times c c Ylm*(S) = P_l,m * dconjg(ephi(m)) for m > 0 c Yl,m*(S) = P_l,|m| * dconjg(ephi(m)) for m < 0 @@ -624,6 +625,7 @@ subroutine l3dformmpd(nd,rscale,sources,dipvec,ns,center, real *8 stheta,sphi,rx,ry,rz,r real *8 ctheta,cphi real *8 phix,phiy,phiz,phi,fruse,d + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 ur,utheta,uphi,ux,uy,uz,zzz complex *16, allocatable :: ephi(:) @@ -657,9 +659,9 @@ subroutine l3dformmpd(nd,rscale,sources,dipvec,ns,center, ephi(0)=1.0d0 ephi(1)=ephi1 ephi(-1)=dconjg(ephi1) - fr(0) = 1.0d0 + fr(0) = inv4pi d = r/rscale - fr(1) = d + fr(1) = inv4pi*d do i=2,nterms+1 fr(i) = fr(i-1)*d ephi(i)=ephi(i-1)*ephi1 @@ -711,10 +713,10 @@ subroutine l3dformmpd(nd,rscale,sources,dipvec,ns,center, c Ylm. Using our standard definition, c the addition theorem takes the simple form c -c 1/r = -c \sum_n 1/(2n+1) \sum_m |S|^n Ylm*(S) Ylm(T)/ (|T|^(n+1)) +c 1/(4\pi) 1/r = +c \sum_n 1/(2n+1) \sum_m 1/(4\pi) |S|^n Ylm*(S) Ylm(T)/ (|T|^(n+1)) c -c so contribution is |S|^n times +c so contribution is 1/(4\pi) |S|^n times c c Ylm*(S) = P_l,m * dconjg(ephi(m)) for m > 0 c Yl,m*(S) = P_l,|m| * dconjg(ephi(m)) for m < 0 @@ -831,6 +833,7 @@ subroutine l3dformmpcd(nd,rscale,sources,charge,dipvec,ns, real *8 stheta,sphi,rx,ry,rz,r real *8 ctheta,cphi real *8 phix,phiy,phiz,phi,fruse,d,dtmp + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 ur,utheta,uphi,ux,uy,uz,zzz complex *16, allocatable :: ephi(:) @@ -863,9 +866,9 @@ subroutine l3dformmpcd(nd,rscale,sources,charge,dipvec,ns, ephi(0)=1.0d0 ephi(1)=ephi1 ephi(-1)=dconjg(ephi1) - fr(0) = 1.0d0 + fr(0) = inv4pi d = r/rscale - fr(1) = d + fr(1) = inv4pi*d do i=2,nterms+1 fr(i) = fr(i-1)*d ephi(i)=ephi(i-1)*ephi1 @@ -917,10 +920,10 @@ subroutine l3dformmpcd(nd,rscale,sources,charge,dipvec,ns, c Ylm. Using our standard definition, c the addition theorem takes the simple form c -c 1/r = -c \sum_n 1/(2n+1) \sum_m |S|^n Ylm*(S) Ylm(T)/ (|T|^(n+1)) +c 1/(4\pi) 1/r = +c \sum_n 1/(2n+1) \sum_m 1/(4\pi) |S|^n Ylm*(S) Ylm(T)/ (|T|^(n+1)) c -c so contribution is |S|^n times +c so contribution is 1/(4\pi) |S|^n times c c Ylm*(S) = P_l,m * dconjg(ephi(m)) for m > 0 c Yl,m*(S) = P_l,|m| * dconjg(ephi(m)) for m < 0 @@ -1342,6 +1345,7 @@ subroutine l3dformtac(nd,rscale,sources,charge,ns,center, real *8 zdiff(3) real *8, allocatable :: ynm(:,:),fr(:),rfac(:) real *8 theta,stheta,ctheta,phi,sphi,cphi,dtmp,d,r + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16, allocatable :: ephi(:) complex *16 ephi1 complex *16 eye @@ -1373,7 +1377,7 @@ subroutine l3dformtac(nd,rscale,sources,charge,ns,center, ephi(1)=ephi1 ephi(-1)=dconjg(ephi1) d = 1.0d0/r - fr(0) = d + fr(0) = inv4pi d = d*rscale fr(1) = fr(0)*d do i=2,nterms+1 @@ -1400,10 +1404,10 @@ subroutine l3dformtac(nd,rscale,sources,charge,ns,center, c Ylm. Using our standard definition, c the addition theorem takes the simple form c -c 1/r = -c \sum_n 1/(2n+1) \sum_m |S|^n Ylm*(S) Ylm(T) / (|T|)^{n+1} +c 1/(4\pi) 1/r = +c \sum_n 1/(2n+1) \sum_m 1/(4\pi) |S|^n Ylm*(S) Ylm(T) / (|T|)^{n+1} c -c so contribution is |S|^n times +c so contribution is 1/(4\pi) |S|^n times c c Ylm*(S) = P_l,m * dconjg(ephi(m)) for m > 0 c Yl,m*(S) = P_l,|m| * dconjg(ephi(m)) for m < 0 @@ -1489,6 +1493,7 @@ subroutine l3dformtad(nd,rscale,sources,dipvec,ns,center, real *8 stheta,sphi,rx,ry,rz,r real *8 ctheta,cphi real *8 phix,phiy,phiz,phi,d + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 ur,utheta,uphi,ux,uy,uz,zzz complex *16, allocatable :: ephi(:) @@ -1522,7 +1527,7 @@ subroutine l3dformtad(nd,rscale,sources,dipvec,ns,center, ephi(1)=ephi1 ephi(-1)=dconjg(ephi1) d = 1.0d0/r - fr(0) = d + fr(0) = inv4pi*d d = d*rscale fr(1) = fr(0)*d do i=2,nterms+1 @@ -1569,10 +1574,10 @@ subroutine l3dformtad(nd,rscale,sources,dipvec,ns,center, c Ylm. Using our standard definition, c the addition theorem takes the simple form c -c 1/r = -c \sum_n 1/(2n+1) \sum_m |S|^n Ylm*(S) Ylm(T)/ (|T|^(n+1)) +c 1/(4\pi) 1/r = +c \sum_n 1/(2n+1) \sum_m 1/(4\pi) |S|^n Ylm*(S) Ylm(T)/ (|T|^(n+1)) c -c so contribution is |S|^n times +c so contribution is 1/(4\pi) |S|^n times c c Ylm*(S) = P_l,m * dconjg(ephi(m)) for m > 0 c Yl,m*(S) = P_l,|m| * dconjg(ephi(m)) for m < 0 @@ -1688,6 +1693,7 @@ subroutine l3dformtacd(nd,rscale,sources,charge,dipvec,ns, real *8 stheta,sphi,rx,ry,rz,r real *8 ctheta,cphi real *8 phix,phiy,phiz,phi,fruse,d,dtmp + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 complex *16 ur,utheta,uphi,ux,uy,uz,zzz complex *16, allocatable :: ephi(:) @@ -1721,7 +1727,7 @@ subroutine l3dformtacd(nd,rscale,sources,charge,dipvec,ns, ephi(1)=ephi1 ephi(-1)=dconjg(ephi1) d = 1.0d0/r - fr(0) = d + fr(0) = inv4pi*d d = d*rscale fr(1) = fr(0)*d do i=2,nterms+1 @@ -1774,10 +1780,10 @@ subroutine l3dformtacd(nd,rscale,sources,charge,dipvec,ns, c Ylm. Using our standard definition, c the addition theorem takes the simple form c -c 1/r = -c \sum_n 1/(2n+1) \sum_m |S|^n Ylm*(S) Ylm(T)/ (|T|^(n+1)) +c 1/(4\pi) 1/r = +c \sum_n 1/(2n+1) \sum_m 1/(4\pi) |S|^n Ylm*(S) Ylm(T)/ (|T|^(n+1)) c -c so contribution is |S|^n times +c so contribution is 1/(4\pi) |S|^n times c c Ylm*(S) = P_l,m * dconjg(ephi(m)) for m > 0 c Yl,m*(S) = P_l,|m| * dconjg(ephi(m)) for m < 0 diff --git a/src/Laplace/lfmm3d.f b/src/Laplace/lfmm3d.f index 416a7b8..4cbd01c 100644 --- a/src/Laplace/lfmm3d.f +++ b/src/Laplace/lfmm3d.f @@ -7,8 +7,7 @@ subroutine lfmm3d(nd,eps,nsource,source,ifcharge, c interactions (ignoring self-interactions) and interactions c with targs. c -c We use (1/r) for the Green's function, without the -c 1/(4 \pi) scaling. +c We use 1/(4\pi)*(1/r) for the Green's function. c c c Input parameters: diff --git a/src/Laplace/lfmm3d_ndiv.f b/src/Laplace/lfmm3d_ndiv.f index 8eb5627..6500bb7 100644 --- a/src/Laplace/lfmm3d_ndiv.f +++ b/src/Laplace/lfmm3d_ndiv.f @@ -8,8 +8,7 @@ subroutine lfmm3d_ndiv(nd,eps,nsource,source,ifcharge, c interactions (ignoring self-interactions) and interactions c with targs. c -c We use (1/r) for the Green's function, without the -c 1/(4 \pi) scaling. +c We use 1/(4\pi)*(1/r) for the Green's function. c c c Input parameters: diff --git a/src/Laplace/lfmm3dwrap.f b/src/Laplace/lfmm3dwrap.f index 8a92b19..caa1d93 100644 --- a/src/Laplace/lfmm3dwrap.f +++ b/src/Laplace/lfmm3dwrap.f @@ -3,7 +3,7 @@ c The laplace FMM evaluates the following potential c and its gradient c -c u(x) = \sum_{j=1}^{N} c_{j}/|x-x_{j}| - v_{j}.\nabla (1/|x-x_{j}|) +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j}/|x-x_{j}| - 1/(4\pi) v_{j}.\nabla (1/|x-x_{j}|) c c Here x_{j} are the source locations, c_{j} are the charge strengths, c v_{j} are the dipole strengths. We refer to the collection of @@ -179,7 +179,7 @@ subroutine lfmm3d_s_c_p(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{1}{\|x-x_{j}\|} c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -259,7 +259,7 @@ subroutine lfmm3d_s_c_g(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{1}{\|x-x_{j}\|} c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -343,7 +343,7 @@ subroutine lfmm3d_s_c_h(eps,nsource,source, c c This subroutine evaluates the potential, its gradient, c and its hessian -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{1}{\|x-x_{j}\|} c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -427,7 +427,7 @@ subroutine lfmm3d_s_d_p(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( +c u(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -508,7 +508,7 @@ subroutine lfmm3d_s_d_g(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( +c u(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -591,7 +591,7 @@ subroutine lfmm3d_s_d_h(eps,nsource,source, c c This subroutine evaluates the potential, its gradient, c and its hessian -c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( +c u(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -676,8 +676,8 @@ subroutine lfmm3d_s_cd_p(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - -c v_{j} \cdot \nabla \left( +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{1}{\|x-x_{j}\|} - +c 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -763,8 +763,8 @@ subroutine lfmm3d_s_cd_g(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - -c v_{j} \cdot \nabla \left( +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{1}{\|x-x_{j}\|} - +c 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -849,8 +849,8 @@ subroutine lfmm3d_s_cd_h(eps,nsource,source, c c This subroutine evaluates the potential, its gradient c and its hessian -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - -c v_{j} \cdot \nabla \left( +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{1}{\|x-x_{j}\|} - +c 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -933,7 +933,7 @@ subroutine lfmm3d_t_c_p(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{1}{\|x-x_{j}\|} c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -1016,7 +1016,7 @@ subroutine lfmm3d_t_c_g(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{1}{\|x-x_{j}\|} c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -1101,7 +1101,7 @@ subroutine lfmm3d_t_c_h(eps,nsource,source, c c This subroutine evaluates the potential, its gradient, c and its hessian -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{1}{\|x-x_{j}\|} c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -1184,7 +1184,7 @@ subroutine lfmm3d_t_d_p(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( +c u(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -1268,7 +1268,7 @@ subroutine lfmm3d_t_d_g(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( +c u(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -1354,7 +1354,7 @@ subroutine lfmm3d_t_d_h(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( +c u(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -1441,8 +1441,8 @@ subroutine lfmm3d_t_cd_p(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - -c v_{j} \cdot \nabla \left( +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{1}{\|x-x_{j}\|} - +c 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -1528,8 +1528,8 @@ subroutine lfmm3d_t_cd_g(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - -c v_{j} \cdot \nabla \left( +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{1}{\|x-x_{j}\|} - +c 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -1617,8 +1617,8 @@ subroutine lfmm3d_t_cd_h(eps,nsource,source, c c This subroutine evaluates the potential, its gradient c and its hessian -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - -c v_{j} \cdot \nabla \left( +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{1}{\|x-x_{j}\|} - +c 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -1706,7 +1706,7 @@ subroutine lfmm3d_st_c_p(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{1}{\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -1792,7 +1792,7 @@ subroutine lfmm3d_st_c_g(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{1}{\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -1882,7 +1882,7 @@ subroutine lfmm3d_st_c_h(eps,nsource,source, c c This subroutine evaluates the potential, its gradient, c and its hessian -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{1}{\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -1977,7 +1977,7 @@ subroutine lfmm3d_st_d_p(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( +c u(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. @@ -2064,7 +2064,7 @@ subroutine lfmm3d_st_d_g(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( +c u(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. @@ -2156,7 +2156,7 @@ subroutine lfmm3d_st_d_h(eps,nsource,source, c c This subroutine evaluates the potential, its gradient, c and its hessian -c u(x) = -\sum_{j=1}^{N} v_{j} \cdot \nabla \left( +c u(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. @@ -2246,8 +2246,8 @@ subroutine lfmm3d_st_cd_p(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - -c v_{j} \cdot \nabla \left( +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{1}{\|x-x_{j}\|} - +c 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. @@ -2335,8 +2335,8 @@ subroutine lfmm3d_st_cd_g(eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - -c v_{j} \cdot \nabla \left( +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{1}{\|x-x_{j}\|} - +c 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. @@ -2429,8 +2429,8 @@ subroutine lfmm3d_st_cd_h(eps,nsource,source, c c This subroutine evaluates the potential, its gradient, c and its hessian -c u(x) = \sum_{j=1}^{N} c_{j} \frac{1}{\|x-x_{j}\|} - -c v_{j} \cdot \nabla \left( +c u(x) = \sum_{j=1}^{N} 1/(4\pi) c_{j} \frac{1}{\|x-x_{j}\|} - +c 1/(4\pi) v_{j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. diff --git a/src/Laplace/lfmm3dwrap_legacy.f b/src/Laplace/lfmm3dwrap_legacy.f index d947e0a..3dccc36 100644 --- a/src/Laplace/lfmm3dwrap_legacy.f +++ b/src/Laplace/lfmm3dwrap_legacy.f @@ -32,8 +32,8 @@ subroutine lfmm3dpart(ier,iprec,nsource,source, c c Laplace FMM in R^3: evaluate all pairwise particle c interactions (ignoring self-interaction). -c We use (1/r) for the Green's function, without the -c (1/4 pi) scaling. Self-interactions are not included. +c We use 1/(4\pi)*(1/r) for the Green's function. +c Self-interactions are not included. c c The main FMM routine permits both evaluation at sources c and at a collection of targets. @@ -85,8 +85,8 @@ subroutine lfmm3dpartself(ier,iprec,nsource,source, c c Laplace FMM in R^3: evaluate all pairwise particle c interactions (ignoring self-interaction). -c We use (1/r) for the Green's function, without the -c (1/4 pi) scaling. Self-interactions are not included. +c We use 1/(4\pi)*(1/r) for the Green's function. +c Self-interactions are not included. c c The main FMM routine permits both evaluation at sources c and at a collection of targets. @@ -141,8 +141,8 @@ subroutine lfmm3dparttarg(ier,iprec,nsource,source, c interactions (ignoring self-interaction) c and interactions with targets. c -c We use (1/r) for the Green's function, -c without the (1/4 pi) scaling. Self-interactions are not included. +c We use 1/(4\pi)*(1/r) for the Green's function. +c Self-interactions are not included. c c This is primarily a memory management code. c The actual work is carried out in subroutine lfmm3dparttargmain. @@ -348,8 +348,8 @@ subroutine l3dpartdirect(nsource, c interactions (ignoring self-interaction) c and interactions with targets via direct O(N^2) algorithm. c -c We use (1/r) for the Green's function, -c without the (1/4 pi) scaling. Self-interactions are not-included. +c We use 1/(4\pi)*(1/r) for the Green's function. +c Self-interactions are not-included. c c INPUT PARAMETERS: c diff --git a/src/Laplace/lfmm3dwrap_vec.f b/src/Laplace/lfmm3dwrap_vec.f index edcbf33..02b2b9b 100644 --- a/src/Laplace/lfmm3dwrap_vec.f +++ b/src/Laplace/lfmm3dwrap_vec.f @@ -4,8 +4,8 @@ c The laplace FMM evaluates the following potential c and its gradient c -c u_{l}(x) = \sum_{j=1}^{N} c_{l,j}/|x-x_{j}| - -c v_{l,j}.\nabla (1/|x-x_{j}|) +c u_{l}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{l,j}/|x-x_{j}| - +c 1/(4\pi) v_{l,j}.\nabla (1/|x-x_{j}|) c c Here x_{j} are the source locations, c_{l,j} are the charge strengths, c v_{l,j} are the dipole strengths. We refer to the collection of @@ -181,7 +181,7 @@ subroutine lfmm3d_s_c_p_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} \frac{1}{\|x-x_{j}\|} c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -261,7 +261,7 @@ subroutine lfmm3d_s_c_g_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} \frac{1}{\|x-x_{j}\|} c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -345,7 +345,7 @@ subroutine lfmm3d_s_c_h_vec(nd,eps,nsource,source, c c This subroutine evaluates the potential, its gradient, c and its hessian -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} \frac{1}{\|x-x_{j}\|} c c at the source locations $x=x_{j}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -433,7 +433,7 @@ subroutine lfmm3d_s_d_p_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -514,7 +514,7 @@ subroutine lfmm3d_s_d_g_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -597,7 +597,7 @@ subroutine lfmm3d_s_d_h_vec(nd,eps,nsource,source, c c This subroutine evaluates the potential, its gradient, and c its Hessians -c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -682,8 +682,8 @@ subroutine lfmm3d_s_cd_p_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - -c v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} \frac{1}{\|x-x_{j}\|} - +c 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -770,8 +770,8 @@ subroutine lfmm3d_s_cd_g_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - -c v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} \frac{1}{\|x-x_{j}\|} - +c 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -857,8 +857,8 @@ subroutine lfmm3d_s_cd_h_vec(nd,eps,nsource,source, c c This subroutine evaluates the potential, its gradient, and c its hessian -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - -c v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} \frac{1}{\|x-x_{j}\|} - +c 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source locations $x=x_{j}$. @@ -946,7 +946,7 @@ subroutine lfmm3d_t_c_p_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} \frac{1}{\|x-x_{j}\|} c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -1030,7 +1030,7 @@ subroutine lfmm3d_t_c_g_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} \frac{1}{\|x-x_{j}\|} c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -1116,7 +1116,7 @@ subroutine lfmm3d_t_c_h_vec(nd,eps,nsource,source, c c This subroutine evaluates the potential, its gradient, and c its hessian -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} \frac{1}{\|x-x_{j}\|} c c at the target locations $x=t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -1203,7 +1203,7 @@ subroutine lfmm3d_t_d_p_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -1288,7 +1288,7 @@ subroutine lfmm3d_t_d_g_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -1376,7 +1376,7 @@ subroutine lfmm3d_t_d_h_vec(nd,eps,nsource,source, c c This subroutine evaluates the potential, its gradient, c and its hessian -c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -1464,8 +1464,8 @@ subroutine lfmm3d_t_cd_p_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - -c v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} \frac{1}{\|x-x_{j}\|} - +c 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -1552,8 +1552,8 @@ subroutine lfmm3d_t_cd_g_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - -c v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} \frac{1}{\|x-x_{j}\|} - +c 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -1642,8 +1642,8 @@ subroutine lfmm3d_t_cd_h_vec(nd,eps,nsource,source, c c This subroutine evaluates the potential, its gradient, c and its hessian -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - -c v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} \frac{1}{\|x-x_{j}\|} - +c 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the target locations $x=t_{i}$. @@ -1732,7 +1732,7 @@ subroutine lfmm3d_st_c_p_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} \frac{1}{\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -1818,7 +1818,7 @@ subroutine lfmm3d_st_c_g_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} \frac{1}{\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -1910,7 +1910,7 @@ subroutine lfmm3d_st_c_h_vec(nd,eps,nsource,source, c c This subroutine evaluates the potential, its gradient, c and its hessian -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} \frac{1}{\|x-x_{j}\|} c c at the source and target locations $x=x_{j},t_{i}$. c When $x=x_{j}$, the term corresponding to $x_{j}$ is @@ -2006,7 +2006,7 @@ subroutine lfmm3d_st_d_p_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. @@ -2094,7 +2094,7 @@ subroutine lfmm3d_st_d_g_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. @@ -2186,7 +2186,7 @@ subroutine lfmm3d_st_d_h_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = -\sum_{j=1}^{N} v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = -\sum_{j=1}^{N} 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. @@ -2282,8 +2282,8 @@ subroutine lfmm3d_st_cd_p_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - -c v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} \frac{1}{\|x-x_{j}\|} - +c 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. @@ -2372,8 +2372,8 @@ subroutine lfmm3d_st_cd_g_vec(nd,eps,nsource,source, c------------------------------------- c c This subroutine evaluates the potential and its gradient -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - -c v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} \frac{1}{\|x-x_{j}\|} - +c 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. @@ -2467,8 +2467,8 @@ subroutine lfmm3d_st_cd_h_vec(nd,eps,nsource,source, c c This subroutine evaluates the potential, its gradient, c and its hessian -c u_{\ell}(x) = \sum_{j=1}^{N} c_{\ell,j} \frac{1}{\|x-x_{j}\|} - -c v_{\ell,j} \cdot \nabla \left( +c u_{\ell}(x) = \sum_{j=1}^{N} 1/(4\pi) c_{\ell,j} \frac{1}{\|x-x_{j}\|} - +c 1/(4\pi) v_{\ell,j} \cdot \nabla \left( c \frac{1}{\|x-x_{j}\|}\right) c c at the source and target locations $x=x_{j},t_{i}$. diff --git a/src/Stokes/stfmm3d.f b/src/Stokes/stfmm3d.f index fbc5c1b..7edddbb 100644 --- a/src/Stokes/stfmm3d.f +++ b/src/Stokes/stfmm3d.f @@ -6,10 +6,7 @@ c We take the following conventions for the Stokes kernels. c c 1) The dynamic viscosity (mu) is assumed to be 1. -c 2) All kernels are a factor 4pi larger than standard definitions -c (this is for historical reasons). -c Thus, in general, divide the velocity (potential or grad) outputs -c by 4pi.mu, and pressure by 4pi, to recover standard definitions. +c 2) All kernels are using standard definitions. c c For a source y and target x, let r_i = x_i-y_i (note sign) c and let r = sqrt(r_1^2 + r_2^2 + r_3^2) @@ -17,14 +14,14 @@ c The Stokeslet, G_{ij}, and its associated pressure tensor, P_j, c we define as c -c G_{ij}(x,y) = ( delta_{ij}/r + r_i r_j / r^3 )/2 -c P_j(x,y) = r_j/r^3 +c G_{ij}(x,y) = ( delta_{ij}/r + r_i r_j / r^3 )/(8\pi) +c P_j(x,y) = 1/(4\pi) * r_j/r^3 c c The (Type I) stresslet, T_{ijk}, and its associated pressure c tensor, PI_{jk}, we define as c -c T_{ijk}(x,y) = -3 r_i r_j r_k/ r^5 -c PI_{jk}(x,y) = -2 delta_{jk}/r^3 + 6 r_j r_k/r^5 +c T_{ijk}(x,y) = -3/(4\pi) r_i r_j r_k/ r^5 +c PI_{jk}(x,y) = 1/(2\pi) delta_{jk}/r^3 - 3/(2\pi) r_j r_k/r^5 subroutine stfmm3d(nd, eps, diff --git a/src/Stokes/stokkernels.f b/src/Stokes/stokkernels.f index 140023d..4fdd5b6 100644 --- a/src/Stokes/stokkernels.f +++ b/src/Stokes/stokkernels.f @@ -9,16 +9,16 @@ c and let r = sqrt(r_1^2 + r_2^2 + r_3^2) c c The Stokeslet, G_{ij}, and its associated pressure tensor, P_j, -c (without the 1/4pi scaling) are +c are c -c G_{ij}(x,y) = (r_i r_j)/(2r^3) + delta_{ij}/(2r) -c P_j(x,y) = r_j/r^3 +c G_{ij}(x,y) = 1/(8\pi)*(r_i r_j)/r^3 + 1/(8\pi)*delta_{ij}/r +c P_j(x,y) = 1/(4\pi) * r_j/r^3 c c The (Type I) stresslet, T_{ijk}, and its associated pressure -c tensor, PI_{jk}, (without the 1/4pi scaling) are +c tensor, PI_{jk}, are c -c T_{ijk}(x,y) = -3 r_i r_j r_k/ r^5 -c PI_{jk} = -2 delta_{jk} + 6 r_j r_k/r^5 +c T_{ijk}(x,y) = -3/(4\pi) r_i r_j r_k/ r^5 +c PI_{jk} = 1/(2\pi) delta_{jk} - 3/(2\pi) r_j r_k/r^5 c subroutine st3ddirectstokg(nd,sources,stoklet,ns,targ,nt, @@ -110,6 +110,7 @@ subroutine st3ddirectstokg(nd,sources,stoklet,ns,targ,nt, real *8 pl, pv, dmu(3), dnu(3), temp, r, r2, r3, r5 real *8 dmunu real *8 threshsq + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 integer *8 i, j, idim, l @@ -132,14 +133,18 @@ subroutine st3ddirectstokg(nd,sources,stoklet,ns,targ,nt, do idim = 1,nd - pot(idim,1,i) = pot(idim,1,i) + stoklet(idim,1,j)/(2*r) - pot(idim,2,i) = pot(idim,2,i) + stoklet(idim,2,j)/(2*r) - pot(idim,3,i) = pot(idim,3,i) + stoklet(idim,3,j)/(2*r) + pot(idim,1,i) = pot(idim,1,i) + + 1 stoklet(idim,1,j)/(2*r)*inv4pi + pot(idim,2,i) = pot(idim,2,i) + + 1 stoklet(idim,2,j)/(2*r)*inv4pi + pot(idim,3,i) = pot(idim,3,i) + + 1 stoklet(idim,3,j)/(2*r)*inv4pi pl = (zdiff(1)*stoklet(idim,1,j) + 1 zdiff(2)*stoklet(idim,2,j) + 2 zdiff(3)*stoklet(idim,3,j))/(r3*2) + pl = pl * inv4pi pot(idim,1,i) = pot(idim,1,i) + zdiff(1)*pl pot(idim,2,i) = pot(idim,2,i) + zdiff(2)*pl pot(idim,3,i) = pot(idim,3,i) + zdiff(3)*pl @@ -148,9 +153,12 @@ subroutine st3ddirectstokg(nd,sources,stoklet,ns,targ,nt, grad(idim,2,2,i) = grad(idim,2,2,i) + pl grad(idim,3,3,i) = grad(idim,3,3,i) + pl - d1 = stoklet(idim,1,j)/(r3*2) - zdiff(1)*pl*3.0d0/r2 - d2 = stoklet(idim,2,j)/(r3*2) - zdiff(2)*pl*3.0d0/r2 - d3 = stoklet(idim,3,j)/(r3*2) - zdiff(3)*pl*3.0d0/r2 + d1 = stoklet(idim,1,j)/(r3*2)*inv4pi - + 1 zdiff(1)*pl*3.0d0/r2 + d2 = stoklet(idim,2,j)/(r3*2)*inv4pi - + 1 zdiff(2)*pl*3.0d0/r2 + d3 = stoklet(idim,3,j)/(r3*2)*inv4pi - + 1 zdiff(3)*pl*3.0d0/r2 grad(idim,1,1,i) = grad(idim,1,1,i) + d1*zdiff(1) grad(idim,2,1,i) = grad(idim,2,1,i) + d2*zdiff(1) @@ -162,9 +170,9 @@ subroutine st3ddirectstokg(nd,sources,stoklet,ns,targ,nt, grad(idim,2,3,i) = grad(idim,2,3,i) + d2*zdiff(3) grad(idim,3,3,i) = grad(idim,3,3,i) + d3*zdiff(3) - d1 = -stoklet(idim,1,j)/(2*r3) - d2 = -stoklet(idim,2,j)/(2*r3) - d3 = -stoklet(idim,3,j)/(2*r3) + d1 = -stoklet(idim,1,j)/(2*r3)*inv4pi + d2 = -stoklet(idim,2,j)/(2*r3)*inv4pi + d3 = -stoklet(idim,3,j)/(2*r3)*inv4pi grad(idim,1,1,i) = grad(idim,1,1,i) + zdiff(1)*d1 grad(idim,2,1,i) = grad(idim,2,1,i) + zdiff(2)*d1 @@ -300,6 +308,7 @@ subroutine st3ddirectstokstrsg(nd,sources,stoklet,istress, real *8 pl, pv, dmu(3), dnu(3), temp, r, r2, r3, r5 real *8 dmunu real *8 threshsq + real *8, parameter :: inv4pi = 7.957747154594766788444188168626d-2 integer *8 i, j, idim, l @@ -341,6 +350,7 @@ subroutine st3ddirectstokstrsg(nd,sources,stoklet,istress, pv = zdiff(1)*dnu(1) + zdiff(2)*dnu(2) + zdiff(3)*dnu(3) temp = -3.0d0*pl*pv/r5 + temp = temp * inv4pi pot(idim,1,i) = pot(idim,1,i) + zdiff(1)*temp pot(idim,2,i) = pot(idim,2,i) + zdiff(2)*temp @@ -353,6 +363,10 @@ subroutine st3ddirectstokstrsg(nd,sources,stoklet,istress, tempx3 = -3.0d0*(dmu(3)*pv + dnu(3)*pl - 1 5.0d0*zdiff(3)*pl*pv/r2)/ r5 + tempx1 = tempx1 * inv4pi + tempx2 = tempx2 * inv4pi + tempx3 = tempx3 * inv4pi + grad(idim,1,1,i) = grad(idim,1,1,i) + temp grad(idim,1,1,i) = grad(idim,1,1,i) + zdiff(1)*tempx1 grad(idim,2,1,i) = grad(idim,2,1,i) + zdiff(1)*tempx2 @@ -369,8 +383,9 @@ subroutine st3ddirectstokstrsg(nd,sources,stoklet,istress, grad(idim,3,3,i) = grad(idim,3,3,i) + zdiff(3)*tempx3 dmunu = dmu(1)*dnu(1) + dmu(2)*dnu(2) + dmu(3)*dnu(3) + dmunu = dmunu * inv4pi - pre(idim,i) = pre(idim,i) + 2.0d0*dmunu/r3-6.0d0*pl*pv/r5 + pre(idim,i) = pre(idim,i) + 2.0d0*dmunu/r3 + 2.0d0*temp enddo 20 continue diff --git a/vec-kernels/include/template-kernels.hpp b/vec-kernels/include/template-kernels.hpp index 2337641..adfe493 100644 --- a/vec-kernels/include/template-kernels.hpp +++ b/vec-kernels/include/template-kernels.hpp @@ -218,7 +218,7 @@ template ()); } template static inline void uKerMatrix(VecType (&M)[chrg+dipo][poten+grad][2], const VecType (&dX)[3], const CtxType& ctx) { using RealType = typename VecType::ScalarType; @@ -341,7 +341,7 @@ template ()); } template static inline void uKerMatrix(VecType (&M)[chrg+dipo][poten+grad][1], const VecType (&dX)[3], const CtxType& ctx) { using RealType = typename VecType::ScalarType; @@ -444,6 +444,8 @@ template ()> void +template inline constexpr Real const_inv4pi() { return 1 / (4 * sctl::template const_pi()); } + template void h3ddirectcp_cpp(const int64_t* nd, const Real* zk, const Real* sources, const Real* charge, const int64_t* ns, const Real* ztarg, const int64_t* nt, Real* pot, const Real* thresh) { static constexpr sctl::Integer COORD_DIM = 3; static constexpr sctl::Integer KDIM0 = 2; @@ -467,6 +469,7 @@ template void h3ddirectcp_cpp(const int64_t* nd, const Real* zk, co Real Rinv = (R2 > thresh2 ? 1/sqrt(R2) : 0); Real R = R2 * Rinv; + Rinv = Rinv * const_inv4pi(); Real G0 = cos(zk[0]*R) * exp(-zk[1]*R) * Rinv; Real G1 = sin(zk[0]*R) * exp(-zk[1]*R) * Rinv; @@ -559,6 +562,7 @@ template ()> void Vec sin_izkR, cos_izkR, exp_izkR; sctl::approx_sincos<-1>(sin_izkR, cos_izkR, izkR[1]); exp_izkR = sctl::approx_exp<-1>(izkR[0]); + Rinv = Rinv * const_inv4pi(); Vec G0 = cos_izkR * exp_izkR * Rinv; Vec G1 = sin_izkR * exp_izkR * Rinv; @@ -667,6 +671,7 @@ template ()> void Vec R = R2 * Rinv; Vec Rinv2 = Rinv * Rinv; + Rinv = Rinv * const_inv4pi(); Vec izkR[2] = {-zk[1]*R, zk[0]*R}; Vec sin_izkR, cos_izkR, exp_izkR; sctl::approx_sincos<-1>(sin_izkR, cos_izkR, izkR[1]); @@ -817,8 +822,8 @@ template ()> void sctl::approx_sincos<-1>(sin_izkR, cos_izkR, izkR[1]); exp_izkR = sctl::approx_exp<-1>(izkR[0]); // exp(ikr)/r - Vec G0 = cos_izkR * exp_izkR * Rinv; - Vec G1 = sin_izkR * exp_izkR * Rinv; + Vec G0 = cos_izkR * exp_izkR * Rinv * const_inv4pi(); + Vec G1 = sin_izkR * exp_izkR * Rinv * const_inv4pi(); // (ikr-1)*exp(ikr)/r^3 Vec H0 = (izkR[0] - (1.0))*G0 - izkR[1]*G1; Vec H1 = izkR[1]*G0 + (izkR[0] - (1.0))*G1; @@ -987,12 +992,13 @@ template ()> void Vec sin_izkR, cos_izkR, exp_izkR; sctl::approx_sincos<-1>(sin_izkR, cos_izkR, izkR[1]); exp_izkR = sctl::approx_exp<-1>(izkR[0]); - // exp(ikr)/r + // 1/4\pi * exp(ikr)/r + Rinv = Rinv * const_inv4pi(); Vec G0 = cos_izkR * exp_izkR * Rinv; Vec G1 = sin_izkR * exp_izkR * Rinv; Vec tmp0 = (1.0)-izkR[0]; Vec tmp1 = -izkR[1]; - // (1-ikr)*exp(ikr)/r^3 + // 1/4\pi * (1-ikr)*exp(ikr)/r^3 Vec H0 = (tmp0*G0 - tmp1*G1) * Rinv2; Vec H1 = (tmp1*G0 + tmp0*G1) * Rinv2; @@ -1116,8 +1122,8 @@ template ()> void sctl::approx_sincos<-1>(sin_izkR, cos_izkR, izkR[1]); exp_izkR = sctl::approx_exp<-1>(izkR[0]); // exp(ikr)/r - Vec G0 = cos_izkR * exp_izkR * Rinv; - Vec G1 = sin_izkR * exp_izkR * Rinv; + Vec G0 = cos_izkR * exp_izkR * Rinv * const_inv4pi(); + Vec G1 = sin_izkR * exp_izkR * Rinv * const_inv4pi(); Vec tmp0 = (1.0) - izkR[0]; Vec tmp1 = -izkR[1]; // (1-ikr)*exp(ikr)/r^3 @@ -1281,8 +1287,8 @@ template ()> void sctl::approx_sincos<-1>(sin_izkR, cos_izkR, izkR[1]); exp_izkR = sctl::approx_exp<-1>(izkR[0]); // exp(ikr)/r - Vec G0 = cos_izkR * exp_izkR * Rinv; - Vec G1 = sin_izkR * exp_izkR * Rinv; + Vec G0 = cos_izkR * exp_izkR * Rinv * const_inv4pi(); + Vec G1 = sin_izkR * exp_izkR * Rinv * const_inv4pi(); Vec zf1[2]; zf1[0] = izkR[0]-(1.0); zf1[1] = izkR[1]; @@ -1518,6 +1524,7 @@ template ()> void sctl::approx_sincos<-1>(sin_izkR, cos_izkR, izkR[1]); exp_izkR = sctl::approx_exp<-1>(izkR[0]); // exp(ikr)/r + Rinv = Rinv * const_inv4pi(); Vec G0 = cos_izkR * exp_izkR * Rinv; Vec G1 = sin_izkR * exp_izkR * Rinv; Vec tmp0 = (1.0)-izkR[0]; @@ -1656,8 +1663,8 @@ template ()> void sctl::approx_sincos<-1>(sin_izkR, cos_izkR, izkR[1]); exp_izkR = sctl::approx_exp<-1>(izkR[0]); // exp(ikr)/r - Vec G0 = cos_izkR * exp_izkR * Rinv; - Vec G1 = sin_izkR * exp_izkR * Rinv; + Vec G0 = cos_izkR * exp_izkR * Rinv * const_inv4pi(); + Vec G1 = sin_izkR * exp_izkR * Rinv * const_inv4pi(); Vec tmp0 = (1.0)-izkR[0]; Vec tmp1 = -izkR[1]; // (1-ikr)*exp(ikr)/r^3 @@ -1847,8 +1854,8 @@ template ()> void sctl::approx_sincos<-1>(sin_izkR, cos_izkR, izkR[1]); exp_izkR = sctl::approx_exp<-1>(izkR[0]); // exp(ikr)/r - Vec G0 = cos_izkR * exp_izkR * Rinv; - Vec G1 = sin_izkR * exp_izkR * Rinv; + Vec G0 = cos_izkR * exp_izkR * Rinv * const_inv4pi(); + Vec G1 = sin_izkR * exp_izkR * Rinv * const_inv4pi(); Vec zf1[2]; zf1[0] = izkR[0]-(1.0); zf1[1] = izkR[1]; @@ -2101,7 +2108,7 @@ template ()> void R2 += dX[k]*dX[k]; } - Vec Rinv = sctl::approx_rsqrt<-1>(R2, (R2 > thresh2)); + Vec Rinv = sctl::approx_rsqrt<-1>(R2, (R2 > thresh2)) * const_inv4pi(); for (long i = 0; i < nd_; i++) { Vtrg[i] += Vsrc[s*nd_+i]*Rinv; @@ -2199,8 +2206,9 @@ template ()> void Vec Rinv = sctl::approx_rsqrt<-1>(R2, (R2 > thresh2)); - Vec nRinv3 = -Rinv*Rinv*Rinv; + Vec nRinv3 = -Rinv*Rinv*Rinv * const_inv4pi(); Vec ztmp[COORD_DIM] = {nRinv3*dX[0], nRinv3*dX[1], nRinv3*dX[2]}; + Rinv = Rinv * const_inv4pi(); for (long i = 0; i < nd_; i++) { Vtrg[i] += Vsrc[s*nd_+i]*Rinv; Gtrg[i][0] += Vsrc[s*nd_+i]*ztmp[0]; @@ -2311,7 +2319,7 @@ template ()> void Vec Rinv = sctl::approx_rsqrt<-1>(R2, (R2 > thresh2)); - Vec nRinv3 = -Rinv*Rinv*Rinv; + Vec nRinv3 = -Rinv*Rinv*Rinv * const_inv4pi(); Vec Rinv5 = -nRinv3*Rinv*Rinv; Vec htmp1 = Rinv5*(3.0*dX[0]*dX[0]-R2); Vec htmp2 = Rinv5*(3.0*dX[1]*dX[1]-R2); @@ -2320,6 +2328,7 @@ template ()> void Vec htmp5 = 3.0*Rinv5*dX[0]*dX[2]; Vec htmp6 = 3.0*Rinv5*dX[1]*dX[2]; Vec ztmp[COORD_DIM] = {nRinv3*dX[0], nRinv3*dX[1], nRinv3*dX[2]}; + Rinv = Rinv * const_inv4pi(); for (long i = 0; i < nd_; i++) { Vtrg[i] += Vsrc[s*nd_+i]*Rinv; Gtrg[i][0] += Vsrc[s*nd_+i]*ztmp[0]; @@ -2434,7 +2443,7 @@ template ()> void Vec Rinv = sctl::approx_rsqrt<-1>(R2, (R2 > thresh2)); - Vec Rinv3 = Rinv * Rinv * Rinv; + Vec Rinv3 = Rinv * Rinv * Rinv * const_inv4pi(); // TODO: test move Dprod out, faster? for (long i = 0; i < nd_; i++) { Vec Dprod = dX[0]*Gsrc[s*nd_*COORD_DIM+i*COORD_DIM+0] + dX[1]*Gsrc[s*nd_*COORD_DIM+i*COORD_DIM+1] + dX[2]*Gsrc[s*nd_*COORD_DIM+i*COORD_DIM+2]; @@ -2538,6 +2547,8 @@ template ()> void Vec Rinv2 = Rinv * Rinv; Vec Rinv3 = Rinv * Rinv2; Vec Rinv5 = -3.0*Rinv2*Rinv3; + Rinv3 = Rinv3 * const_inv4pi(); + Rinv5 = Rinv5 * const_inv4pi(); for (long i = 0; i < nd_; i++) { Vec Dprod = dX[0]*Gsrc[s*nd_*COORD_DIM+i*COORD_DIM+0] + dX[1]*Gsrc[s*nd_*COORD_DIM+i*COORD_DIM+1] + dX[2]*Gsrc[s*nd_*COORD_DIM+i*COORD_DIM+2]; Vec RinvDprod = Rinv5*Dprod; @@ -2655,6 +2666,8 @@ template ()> void Vec Rinv2 = Rinv * Rinv; Vec Rinv3 = Rinv * Rinv2; Vec Rinv5 = Rinv2 * Rinv3; + Rinv3 = Rinv3 * const_inv4pi(); + Rinv5 = Rinv5 * const_inv4pi(); Vec nRinv5 = -3.0*Rinv5; Vec dx = dX[0]*Rinv; Vec dy = dX[1]*Rinv; @@ -2786,6 +2799,8 @@ template ()> void Vec Rinv = sctl::approx_rsqrt<-1>(R2, (R2 > thresh2)); Vec Rinv3 = Rinv * Rinv * Rinv; + Rinv = Rinv * const_inv4pi(); + Rinv3 = Rinv3 * const_inv4pi(); for (long i = 0; i < nd_; i++) { Vec Dprod = dX[0]*Gsrc[s*nd_*COORD_DIM+i*COORD_DIM+0] + dX[1]*Gsrc[s*nd_*COORD_DIM+i*COORD_DIM+1] + dX[2]*Gsrc[s*nd_*COORD_DIM+i*COORD_DIM+2]; Vtrg[i] += Dprod*Rinv3; @@ -2892,8 +2907,11 @@ template ()> void Vec Rinv2 = Rinv * Rinv; Vec Rinv3 = Rinv * Rinv2; - Vec nRinv3 = -Rinv*Rinv*Rinv; Vec Rinv5 = -3.0*Rinv2*Rinv3; + Rinv = Rinv * const_inv4pi(); + Rinv3 = Rinv3 * const_inv4pi(); + Rinv5 = Rinv5 * const_inv4pi(); + Vec nRinv3 = -Rinv3; Vec ztmp[COORD_DIM] = {nRinv3*dX[0], nRinv3*dX[1], nRinv3*dX[2]}; for (long i = 0; i < nd_; i++) { Vec Dprod = dX[0]*Gsrc[s*nd_*COORD_DIM+i*COORD_DIM+0] + dX[1]*Gsrc[s*nd_*COORD_DIM+i*COORD_DIM+1] + dX[2]*Gsrc[s*nd_*COORD_DIM+i*COORD_DIM+2]; @@ -3016,13 +3034,16 @@ template ()> void Vec Rinv2 = Rinv * Rinv; Vec Rinv3 = Rinv * Rinv2; - Vec nRinv3 = -Rinv*Rinv*Rinv; Vec Rinv5 = Rinv2*Rinv3; + Rinv3 = Rinv3 * const_inv4pi(); + Rinv5 = Rinv5 * const_inv4pi(); + Vec nRinv3 = -Rinv3; Vec nRinv5 = -3.0*Rinv5; Vec ztmp[COORD_DIM] = {nRinv3*dX[0], nRinv3*dX[1], nRinv3*dX[2]}; Vec dx = dX[0]*Rinv; Vec dy = dX[1]*Rinv; Vec dz = dX[2]*Rinv; + Rinv = Rinv * const_inv4pi(); Vec htmp1 = Rinv5*(3.0*dX[0]*dX[0]-R2); Vec htmp2 = Rinv5*(3.0*dX[1]*dX[1]-R2); Vec htmp3 = Rinv5*(3.0*dX[2]*dX[2]-R2);