This thesis extends the electromagnetic field calculation capabilities of the open-source CFD software OpenFOAM. It develops new solvers within OpenFOAM to solve magnetostatic problems for materials like copper, steel, and permanent magnets. Two formulations (A-V and A-J) are derived from Maxwell's equations and implemented as OpenFOAM solvers through custom C++ code. Force calculation methods are also implemented to calculate Lorenz force and Maxwell stress. Simple test cases are modeled and solved to validate the new solvers. Results are compared to COMSOL Multiphysics and good agreement is found. The developed solvers could be applied to the design of electromagnetic devices like electric machines.