calculator:field_of_cuboid_magnet_or_rectangular_solenoid
Magnetic field of a cuboid magnet or rectangular solenoid at arbitrary point in space
![]() | Stan Zurek, Magnetic field of a cuboid magnet or rectangular solenoid at arbitrary point in space, Encyclopedia Magnetica, https://www.e-magnetica.pl/doku.php/calculator/field_of_cuboid_magnet_or_rectangular_solenoid, {accessed: 2025-03-14} |
Geometry of rectangular solenoid as defined for the equations below
by S. Hampton, R. A. Lane, R. M. Hedlof, R. E. Phillips, C. A. Ordonez, published in AIP Advances, CC-BY-4.0

This calculator provides magnetic field strength H of a cuboid magnet or a “thin” rectangular solenoid in three-dimensions, at any point in space, inside or outside (apart from the points coinciding with the planes or edges of the cuboid).
For magnet the excitation is specified by the remanence Br and for solenoid by the current I and number of turns N.
Magnetic field of a cuboid magnet or rectangular solenoid | ||
---|---|---|
Source: [1] S. Hampton, R. A. Lane, R. M. Hedlof, R. E. Phillips, C. A. Ordonez; Closed-form expressions for the magnetic fields of rectangular and circular finite-length solenoids and current loops. AIP Advances 1 June 2020; 10 (6): 065320, https://doi.org/10.1063/5.0010982 | ||
[1], eq. (1) | $$ H_x = \frac{H_0}{8·π}·\sum_{i=0}^{1} \sum_{j=0}^{1} \sum_{k=0}^{1} \left\{ (-1)^{i+j+k} · ln \left( \frac { r_{ijk} - [y+a_y · (-1)^{j+1}] } { r_{ijk} + [y+a_y · (-1)^{j+1}] } \right) \right\} $$ | (A/m) |
[1], eq. (2) | $$ H_y = \frac{H_0}{8·π}·\sum_{i=0}^{1} \sum_{j=0}^{1} \sum_{k=0}^{1} \left\{ (-1)^{i+j+k} · ln \left( \frac { r_{ijk} - [x+a_x · (-1)^{i+1}] } { r_{ijk} + [x+a_x · (-1)^{i+1}] } \right) \right\} $$ | |
[1], eq. (3) | $$ H_z = \frac{H_0}{4·π}·\sum_{i=0}^{1} \sum_{j=0}^{1} \sum_{k=0}^{1} \left\{ (-1)^{i+j+k+1} · \left[ tan^{-1} \left( \frac { [x+a_x · (-1)^{i+1}] · [z+a_z · (-1)^{k+1}] } { r_{ijk} · [y+a_y · (-1)^{j+1}] } \right) + \\ + tan^{-1} \left( \frac { [y+a_y · (-1)^{j+1}] · [z+a_z · (-1)^{k+1}] } { r_{ijk} · [x+a_x · (-1)^{i+1}] } \right) \right] \right\} $$ |
where: $H_0$ - magnetic field strength of an ideal infinitely long solenoid (A/m), $B_r$ - remanence (T) of the permanent magnet, $μ_0$ - magnetic permeability of vacuum (H/m), $I$ - current (A) in the infinitesimally thin wire of the solenoid coil, $n$ - number of turns of the solenoid per unit length (1/m), $N$ - total number of turns in the solenoid coil (unitless), $L_{z}$ - length of the solenoid along its axis (m), and: | ||
(for permanent magnet) $ H_0 = B_r / μ_0 $ | (for solenoid) $ H_0 = I · n = I · N / L_{z} $ | (A/m) |
(for both) $ r_{ijk} = \sqrt{ [x+a_x · (-1)^{i+1}]^2 + [y+a_y · (-1)^{j+1}]^2 + [z+a_z · (-1)^{k+1}]^2 } $ | (m) |
Interactive calculator
S. Zurek, E-Magnetica.pl, CC-BY-4.0
Notes: The calculator uses equations for a rectangular solenoid, so for magnet its magnetic permeability is assumed to be that of vacuum, and therefore the output values can differ significantly from real magnets. However, reasonable order-of-magnitude of expected magnetic field can be estimated. Points coinciding with side walls or edges might fail to calculate a valid value (e.g. report “NaN”, not a number). |
↑
→ → → Helpful page? Support us! → → → | PayPal | ← ← ← Help us with just $0.10 per month? Come on… ← ← ← |
calculator/field_of_cuboid_magnet_or_rectangular_solenoid.txt · Last modified: 2025/01/19 19:16 by stan_zurek