# Magnetostatics

`MAGNETOSTATICS` solves the static magnetic field of magnets, steel and coil drives. A solid frame solves it in 3D, and an axisymmetric or Cartesian 2D frame solves it as `MAGNETOSTATICS_2D` on the r-z half-plane or a planar section. See [Conditions and physics](<https://docs.femforge.io/user-guide/conditions/index.md>) for how conditions attach and where they land.

| Frame | Solves as | Solver stack |
| --- | --- | --- |
| [Solid](<https://docs.femforge.io/user-guide/frames/solid/index.md>) | `MAGNETOSTATICS` | MagnetoDynamicsSolver, MagnetoDynamicsCalcFieldsSolver, SaveScalarsSolver, ResultOutputSolver |
| [Axisymmetric](<https://docs.femforge.io/user-guide/frames/axisymmetric/index.md>) | `MAGNETOSTATICS_2D` | MagnetoDynamics2DSolver, MagnetoDynamicsCalcFieldsSolver, SaveScalarsSolver, ResultOutputSolver |
| [Cartesian2D](<https://docs.femforge.io/user-guide/frames/cartesian-2d/index.md>) | `MAGNETOSTATICS_2D` | MagnetoDynamics2DSolver, MagnetoDynamicsCalcFieldsSolver, SaveScalarsSolver, ResultOutputSolver |

## Material-wired conditions

| Condition | Target | Sets | Frames |
| --- | --- | --- | --- |
| [`Magnetization`](<https://docs.femforge.io/user-guide/conditions/magnetostatics/#magnetization>) | body | `direction` | [Solid](<https://docs.femforge.io/user-guide/frames/solid/index.md>), [Axisymmetric](<https://docs.femforge.io/user-guide/frames/axisymmetric/index.md>), [Cartesian2D](<https://docs.femforge.io/user-guide/frames/cartesian-2d/index.md>) |

### Magnetization

**Physics** `MAGNETOSTATICS` · **Target** body · **Section** Material · **Kind** `magnetization` · **API** Magnetization

The magnetization direction of a permanent magnet.

| Field | Symbol | Unit | Meaning | Sif keyword | Default |
| --- | --- | --- | --- | --- | --- |
| `direction` |  |  | Magnetization direction in the authored model's frame, None for an unmagnetized body; magnitude comes from the material. |  | required |

Writes: The `Magnetization` components of `magnitude` (A/m) along the direction, in `frame`'s solve coordinates.

The material's remanence sets the strength, so a magnet body needs both a magnet material, such as `N52`, and a `Magnetization` with a direction.

## Body forces

| Condition | Target | Sets | Frames |
| --- | --- | --- | --- |
| [`CurrentDensity`](<https://docs.femforge.io/user-guide/conditions/magnetostatics/#currentdensity>) | body | `value` \[A/m²\] | [Axisymmetric](<https://docs.femforge.io/user-guide/frames/axisymmetric/index.md>), [Cartesian2D](<https://docs.femforge.io/user-guide/frames/cartesian-2d/index.md>) |

### CurrentDensity

**Physics** `MAGNETOSTATICS_2D` · **Target** body · **Section** Body Force · **Kind** `current_density` · **API** CurrentDensity

A uniform signed out-of-plane current density J = N·I/A over a winding window, the homogenized drive of a stranded coil in a 2D solve.

| Field | Symbol | Unit | Meaning | Sif keyword | Default |
| --- | --- | --- | --- | --- | --- |
| `value` | `J` | A/m² | Signed out-of-plane current density imposed uniformly over the body: azimuthal under Axisymmetric, along +normal under Cartesian2D. | `Current Density` | required |

`CurrentDensity` drives only the 2D solve, azimuthal under an axisymmetric frame and along the normal under a Cartesian 2D one; a solid frame rejects it. See [Axisymmetric](<https://docs.femforge.io/user-guide/frames/axisymmetric/index.md>) and [Cartesian 2D](<https://docs.femforge.io/user-guide/frames/cartesian-2d/index.md>).

## Components

| Condition | Target | Sets | Frames |
| --- | --- | --- | --- |
| [`CalculateMagneticForce`](<https://docs.femforge.io/user-guide/conditions/magnetostatics/#calculatemagneticforce>) | body | `label`, `calculate_magnetic_force`, `calculate_magnetic_torque`, `torque_origin` \[m\], `torque_axis` | [Solid](<https://docs.femforge.io/user-guide/frames/solid/index.md>), [Axisymmetric](<https://docs.femforge.io/user-guide/frames/axisymmetric/index.md>), [Cartesian2D](<https://docs.femforge.io/user-guide/frames/cartesian-2d/index.md>) |

### CalculateMagneticForce

**Physics** `MAGNETOSTATICS` · **Target** body · **Section** Component · **Kind** `calculate_magnetic_force` · **API** CalculateMagneticForce

Lumps the magnetic force, and optionally the torque, over the bodies its tag matches into one Elmer `Component`.

| Field | Symbol | Unit | Meaning | Sif keyword | Default |
| --- | --- | --- | --- | --- | --- |
| `label` |  |  | The Component's `Name`; None uses the authoring tag's name. |  | `None` |
| `calculate_magnetic_force` |  |  | Lump the nodal magnetic force over the master bodies. |  | `True` |
| `calculate_magnetic_torque` |  |  | Also lump the magnetic torque (requires `torque_origin`/`torque_axis`). |  | `False` |
| `torque_origin` | `r_0` | m | Torque pivot point. |  | `None` |
| `torque_axis` |  |  | Torque axis direction. |  | `None` |

Writes: The CalcFields force and torque flags, plus the torque origin and axis when set.

The result reads the lumped force and torque back by the Component's name, as `result.component_forces[label]` and `result.component_torques[label]`. An axisymmetric or Cartesian 2D frame lumps no torque, so it rejects the torque fields.
