A novel field-based formulation of magnetostatic