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.

ElementGeometric details
Magnet 1Cylinder of 2 mm radius and 2 mm height centered at (0,0.0025,0)(0, 0.0025, 0)
Magnet 2Cylinder of 2 mm radius and 2 mm height centered at (0,0.0025,0)(0, -0.0025, 0)
Force domain 1Cylinder of 3 mm radius and 3 mm height centered at (0,0.0025,0)(0, 0.0025, 0)
Force domain 2Cylinder of 3 mm radius and 3 mm height centered at (0,0.0025,0)(0, -0.0025, 0)
Air boxBox of size 50 mm ×\times 50 mm ×\times 50 mm
  1. Magnetic field distribution.
  2. Magnetic forces between the magnets.
  • Air
PropertyValue
Magnetic permeabilityμ0=4π×107 H/m\mu_0 = 4 \pi \times 10^{-7} ~ \rm H/m
TypeValueTarget 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.

    NameElement typeCenter point [m]Size [m]Rotation [deg]
    magnet 1CylinderX: 0Radius: 2e-3X: 0
    Y: 2.5e-3Height: 2e-3Y: 0
    Z: 0Z: 0

    Note, that rotation in the X-direction is 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.

    NameElement typeCenter point [m]Size [m]Rotation [deg]
    magnet 2CylinderX: 0Radius: 2e-3X: 0
    Y: -2.5e-3Height: 2e-3Y: 0
    Z: 0Z: 0
  5. Copy magnet 1 to build force domain 1.

    NameElement typeCenter point [m]Size [m]Rotation [deg]
    force domain 1CylinderX: 0Radius: 3e-3X: 0
    Y: 2.5e-3Height: 3e-3Y: 0
    Z: 0Z: 0
  6. Copy force domain 1 to build force domain 2.

    NameElement typeCenter point [m]Size [m]Rotation [deg]
    force domain 2CylinderX: 0Radius: 3e-3X: 0
    Y: -2.5e-3Height: 3e-3Y: 0
    Z: 0Z: 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.

    NameElement typeCenter point [m]Size [m]Rotation [deg]
    boxBoxX: 0X: 50e-3X: 0
    Y: 0Y: 50e-3Y: 0
    Z: 0Z: 50e-3Z: 0

    Tutorial image

  1. Go to the Physics section.

  2. tosign the Air material to all volumes.

    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.

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

    Interaction nameInteraction typeTargetValue
    Remanence leftRemanencemagnet 2 (volume 4)[0; 1.35; 0]

    Tutorial image

  3. Add another Remanence interaction to Magnetism φ.

    Interaction nameInteraction typeTargetValue
    Remanence rightRemanencemagnet 1 (volume 1)[0; -1.35; 0]

    Tutorial image

  1. Go to the Simulations section.

  2. Create a new mesh.

  3. Set Mesh quality to Expert Settings.

  4. Set the mesh element Max size to 0.05.

  5. Scroll down to Mesh Refinement and create a Volume mesh refinement entity.

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

    Tutorial image

  7. Generate the mesh and check the preview.

    Tutorial image

  1. Create a new simulation.

    Simulation nameAnalysis typeNode countNode type
    Simulation 1Steady state51 CPU, 16 GB
  2. Select Mesh 1 as the mesh for your simulation.

  3. Add a B field output.

    Output nameOutput typeTargetOutput expression
    B magnetsMagnetic flux density (B) field outputmagnets 1 and 2 (volumes 1, 4)B
  4. Add another B field output.

    Output nameOutput typeTargetOutput expression
    B airMagnetic flux density (B) field outputForce domains 1 and 2, air box (volumes 5, 6, 7)B
  5. Add a Magnetic force value output.

    Output nameOutput typeTarget
    Magnetic force leftMagnetic force value outputmagnet 2 and force domain 2 (volumes 4, 6)
  6. Add another Magnetic force value output.

    Output nameOutput typeTarget
    Magnetic force rightMagnetic force value outputmagnet 1 and force domain 1 (volumes 1, 5)
  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 nameFieldsFilters
    Visualization 1B magnets
    B airGlyph
  3. Edit the Glyph settings:

    FilterMax sample pointsScale factor
    Glyph500000.001
  4. Render the visualization.

    Tutorial image

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

    Tutorial image