A set of routines to compute the magnetic vector potential and magnetic field of two types of current carriers is presented. The (infinitely thin) current carrier types are a straight wire segment and a circular wire loop. The routines are highly accurate and exhibit the correct asymptotic behavior far away from and close to the current carrier. A suitable global set of test points is introduced and the methods presented in this work are tested against results obtained using arbitrary-precision arithmetic on all test points. The results are accurate to approximately 16 decimal digits of precision when computed using 64 bit floating point arithmetic. There are a few exceptions where accuracy drops to 13 digits. These primitive current carrier types can be used to assemble more complex arrangements, such as a current along a polygon (by means of defining straight wire segments from point to point along the polygon) and a multi-winding coil with circular cross-section. Reference data is provided along with the code for benchmarks with other implementations. Program summaryProgram Title: Biot-Savart Routines with Minimal Floating Point ErrorCPC Library link to program files:https://doi.org/10.17632/zcwk7zzt9y.1Developer's repository link:https://github.com/jonathanschilling/abscabLicensing provisions: Apache-2.0Programming language: C, Python, Java, FortranSupplementary material: Reference output data for all methods described in this article.Nature of problem: A common task in computational physics is to compute the magnetic field and magnetic vector potential originating from current-carrying wire arrangements. These current carriers are often approximated for computational simplicity as infinitely thin filaments following the center lines of the real current carrier. Computational methods are thus needed to compute the magnetic field and the magnetic vector potential of a single straight wire segment or a single circular wire loop as basis for modeling more complex current carrier arrangements by superposition of the current carrier primitives. A current carrier path specified by (x,y,z) coordinates can be modeled as a set of straight wire segments from point to point along the polygon describing the current carrier geometry. Closed circular wire loops are also commonly used as a proxy for a physical coil with helical windings.Solution method: Analytical expressions are derived in this work to accurately compute the magnetic field and the magnetic vector potential of a straight wire segment and a circular wire loop. The expressions consist of several special cases, which are automatically switched between depending on the location of the evaluation location in the coordinate system of the current carrier primitive. This approach guarantees that always the most accurate formulation available for a given evaluation location is used, including explicit use of simplifications in certain special cases for speed and accuracy.Additional comments including restrictions and unusual features: For most test cases, the full relative accuracy of the floating point arithmetic chosen for implementation is retained throughout the computations (16 digits of precision in the IEEE-754 binary64 implementation). There are a few exceptions where accuracy drops by up to 3 digits of precision (in the binary64 case). The provided implementations have not been optimized for speed.
Read full abstract