bFieldFromSurfaceCurrent
    :: VectorField  -- ^ surface current density
    -> Surface      -- ^ geometry of the surface current
    -> VectorField  -- ^ magnetic field (in T)
bFieldFromSurfaceCurrent kCurrent c r
    = k *^ surfaceIntegral 100 100 integrand c
      where
        k = 1e-7  -- mu0 / (4 * pi)
        integrand r' = (kCurrent r' >< d) ^/ magnitude d ** 3
            where
              d = displacement r' r

-- | Magnetic field produced by a volume current.
--   The function 'bField' calls this function
--   to evaluate the magnetic field produced by a volume current.
bFieldFromSurfaceCurrent
    :: VectorField  -- ^ surface current density
    -> Surface      -- ^ geometry of the surface current
    -> VectorField
bFieldFromSurfaceCurrent kCurrent c r
    = k *^ surfaceIntegral 100 100 integrand c
      where
        k = 1e-7  -- mu0 / (4 * pi)
        integrand r' = (kCurrent r' >< d) ^/ magnitude d ** 3
            where
              d = displacement r' r

-- | Magnetic field produced by a volume current.
--   The function 'bField' calls this function
--   to evaluate the magnetic field produced by a volume current.
bFieldFromSurfaceCurrent kCurrent c r
    = k *^ surfaceIntegral 100 100 integrand c
      where
        k = 1e-7  -- mu0 / (4 * pi)
        integrand r' = (kCurrent r' >< d) ^/ magnitude d ** 3
            where
              d = displacement r' r

-- | Magnetic field produced by a volume current.
--   The function 'bField' calls this function
--   to evaluate the magnetic field produced by a volume current.