Skip to content

Permanent Magnets

In this tutorial, the magnetic fields and magnetic forces resulting from a pair of small permanent magnets is simulated.

The model consists of two cylindrical 2 mm permanent magnets separated by a distance of 1.2 mm and an air box surrounding them.

A constant magnetic flux density is applied to the magnets. The resulting magnetic forces are determined with the Magnetism-φ formulation.

Tutorial image

Additional cylindrical force domain volumes are created around the magnets, so that the magnetic fields around the magnets can be integrated.

Element Geometric details
Magnet 1 Cylinder of 2 mm radius and 2 mm height centered at (0,0.0025,0)(0, 0.0025, 0)
Magnet 2 Cylinder of 2 mm radius and 2 mm height centered at (0,0.0025,0)(0, -0.0025, 0)
Force domain 1 Cylinder of 3 mm radius and 3 mm height centered at (0,0.0025,0)(0, 0.0025, 0)
Force domain 2 Cylinder of 3 mm radius and 3 mm height centered at (0,0.0025,0)(0, -0.0025, 0)
Air box Box of size 50 mm ×\times 50 mm ×\times 50 mm
  1. Magnetic field distribution.
  2. Magnetic forces between the magnets.
  • Air
Property Value
Magnetic permeability μ0=4π×107 H/m\mu_0 = 4 \pi \times 10^{-7} ~ \rm H/m
Type Value Target volume
Remanence [0, 1.35, 0] Magnet 1
Remanence [0,-1.35, 0] Magnet 2

Here you’ll find a detailed step-by-step tutorial on how to simulate a pair of permanent magnets and the resulting forces in Quanscient Allsolve.

  1. Create a new project and name it Permanent magnets.

  2. Start off with a cylinder element.

    Name Element type Center point [m] Size [m] Rotation [deg]
    magnet 1 Cylinder X: 0 Radius: 2e-3 X: 90
    Y: 2.5e-3 Height: 2e-3 Y: 0
    Z: 0 Z: 0
  3. Reset view after building magnet 1 to bring the small magnet cylinder back into view.

  4. Copy magnet 1 to build magnet 2.

    Name Element type Center point [m] Size [m] Rotation [deg]
    magnet 2 Cylinder X: 0 Radius: 2e-3 X: 90
    Y: -2.5e-3 Height: 2e-3 Y: 0
    Z: 0 Z: 0
  5. Copy magnet 1 to build force domain 1.

    Name Element type Center point [m] Size [m] Rotation [deg]
    force domain 1 Cylinder X: 0 Radius: 3e-3 X: 90
    Y: 2.5e-3 Height: 3e-3 Y: 0
    Z: 0 Z: 0
  6. Copy force domain 1 to build force domain 2.

    Name Element type Center point [m] Size [m] Rotation [deg]
    force domain 2 Cylinder X: 0 Radius: 3e-3 X: 90
    Y: -2.5e-3 Height: 3e-3 Y: 0
    Z: 0 Z: 0

    At this point, there are 4 cylinders in the model, so that the force domains envelop the magnets that are facing each other.

    Tutorial image

  7. Build the air box.

    Name Element type Center point [m] Size [m] Rotation [deg]
    box Box X: 0 X: 50e-3 X: 0
    Y: 0 Y: 50e-3 Y: 0
    Z: 0 Z: 50e-3 Z: 0

    Tutorial image

  1. Go to the Physics section.

  2. Assign the Air material to all volumes.

    Air is assigned to all volumes because in magnetostatics the relevant material property is the magnetic permeability (μ0\mu_0), which is the same for air and the magnets. The magnets are distinguished by their remanence boundary condition applied in the next step.

    Tutorial image

Step 3 - Define the physics and apply boundary conditions

Section titled “Step 3 - Define the physics and apply boundary conditions”
  1. Add the Magnetism ϕ interaction. Let the target default to all volumes.

    Physics Target
    Magnetism φ All volumes
  2. Add a Remanence interaction to Magnetism φ. Remanence introduces a B-field to a volume.

    Interaction name Interaction type Target Value
    Remanence left Remanence magnet 2 [0; 1.35; 0]

    Tutorial image

  3. Add another Remanence interaction to Magnetism φ.

    Interaction name Interaction type Target Value
    Remanence right Remanence magnet 1 [0; -1.35; 0]

    Tutorial image

  1. Go to the Simulations section.

  2. Create a new mesh.

  3. Open the collapsible menu for Mesh element size.

  4. Set Max size to 0.05.

  5. Under Customizations, add a Mesh refinement entity of type Volume.

  6. Select all cylindrical volumes to target and set its Max size to 0.0001.

    Tutorial image

  7. Generate the mesh and check the preview.

    Tutorial image

  1. Create a new simulation.

    Simulation name Analysis type Node count Node type
    Simulation 1 Static 5 1 CPU, 16 GB
  2. Select Mesh 1 as the mesh for your simulation.

  3. Add a B field output.

    Output name Output type Target Output expression
    B magnets Magnetic flux density (B) field output magnets 1 and 2 B
  4. Add another B field output.

    Output name Output type Target Output expression
    B air Magnetic flux density (B) field output Force domains 1 and 2, air box B
  5. Add a Magnetic force value output.

    Output name Output type Target
    Magnetic force left Magnetic force value output magnet 2 and force domain 2
  6. Add another Magnetic force value output.

    Output name Output type Target
    Magnetic force right Magnetic force value output magnet 1 and force domain 1
  7. Run the simulation.

  1. Check Summary for the magnetic force value outputs.

    Tutorial image

  2. Add a visualization to see field output results:

    Visualization name Fields Filters
    Visualization 1 B magnets
    B air Glyph
  3. Edit the Glyph settings:

    Filter Max sample points Scale factor
    Glyph 50000 0.001
  4. Render the visualization.

    Tutorial image

  5. The Glyph scale factor is reduced to 0.0005 here for a closer look:

    Tutorial image