Main Content

MagnetostaticResults

Magnetostatic solution and derived quantities

    Description

    A MagnetostaticResults object contains the magnetic potential, magnetic field, and magnetic flux density values in a form convenient for plotting and postprocessing.

    The magnetic potential, magnetic field, and magnetic flux density are calculated at the nodes of the triangular or tetrahedral mesh generated by generateMesh. Magnetic potential values at the nodes appear in the MagneticPotential property. Magnetic field values at the nodes appear in the MagneticField property. Magnetic flux density at the nodes appear in the MagneticFluxDensity property.

    To interpolate the magnetic potential, magnetic field, and magnetic flux density to a custom grid, such as the one specified by meshgrid, use the interpolateMagneticPotential, interpolateMagneticField, and interpolateMagneticFlux functions.

    Creation

    Solve a magnetostatic problem using the solve function. This function returns a solution as a MagnetostaticResults object.

    Properties

    expand all

    Magnetic potential values at nodes, returned as a vector for a 2-D problem or an FEStruct object for a 3-D problem. The properties of this object contain the components of the magnetic potential at nodes.

    Data Types: double

    Magnetic field values at nodes, returned as an FEStruct object. The properties of this object contain the components of the magnetic field at nodes.

    Magnetic flux density values at nodes, returned as an FEStruct object. The properties of this object contain the components of the magnetic flux density at nodes.

    Finite element mesh, returned as an FEMesh Properties object. For details, see FEMesh Properties. For a 3-D model, the mesh must be linear.

    Object Functions

    interpolateMagneticPotentialInterpolate magnetic potential in magnetostatic result at arbitrary spatial locations
    interpolateMagneticFieldInterpolate magnetic field in magnetostatic result at arbitrary spatial locations
    interpolateMagneticFluxInterpolate magnetic flux density in magnetostatic result at arbitrary spatial locations

    Examples

    collapse all

    Solve a 2-D electromagnetic problem.

    Create an electromagnetic model for magnetostatic analysis.

    emagmodel = createpde('electromagnetic','magnetostatic');

    Import and plot the geometry representing a plate with a hole.

    importGeometry(emagmodel,'PlateHolePlanar.stl')
    ans = 
      DiscreteGeometry with properties:
    
           NumCells: 0
           NumFaces: 1
           NumEdges: 5
        NumVertices: 5
           Vertices: [5x3 double]
    
    
    pdegplot(emagmodel,'EdgeLabels','on')

    Figure contains an axes object. The axes object contains an object of type line.

    Specify the vacuum permeability value in the SI system of units.

    emagmodel.VacuumPermeability = 1.2566370614E-6;

    Specify the relative permeability of the material.

    electromagneticProperties(emagmodel,'RelativePermeability',5000);

    Apply the magnetic potential boundary conditions on the edges framing the rectangle and the circle.

    electromagneticBC(emagmodel,'MagneticPotential',0,'Edge',1:4); 
    electromagneticBC(emagmodel,'MagneticPotential',0.01,'Edge',5);

    Specify the current density for the entire geometry.

    electromagneticSource(emagmodel,'CurrentDensity',0.5);

    Generate the mesh.

    generateMesh(emagmodel);

    Solve the model.

    R = solve(emagmodel)
    R = 
      MagnetostaticResults with properties:
    
          MagneticPotential: [1218x1 double]
              MagneticField: [1x1 FEStruct]
        MagneticFluxDensity: [1x1 FEStruct]
                       Mesh: [1x1 FEMesh]
    
    

    Plot the magnetic potential and field.

    pdeplot(emagmodel,'XYData',R.MagneticPotential, ...
                      'FlowData',[R.MagneticField.Hx ...
                                  R.MagneticField.Hy])
    axis equal

    Figure contains an axes object. The axes object contains 2 objects of type patch, quiver.

    Solve an electromagnetic problem and find the magnetic potential and field distribution for a 3-D geometry representing a plate with a hole.

    Create an electromagnetic model for magnetostatic analysis.

    emagmodel = createpde('electromagnetic','magnetostatic');

    Import and plot the geometry representing a plate with a hole.

    importGeometry(emagmodel,'PlateHoleSolid.stl');
    pdegplot(emagmodel,'FaceLabels','on','FaceAlpha',0.3)

    Figure contains an axes object. The axes object contains 3 objects of type quiver, patch, line.

    Specify the vacuum permeability value in the SI system of units.

    emagmodel.VacuumPermeability = 1.2566370614E-6;

    Specify the relative permeability of the material.

    electromagneticProperties(emagmodel,'RelativePermeability',5000);

    Specify the current density for the entire geometry.

    electromagneticSource(emagmodel,'CurrentDensity',[0;0;0.5]);

    Apply the magnetic potential boundary conditions on the side faces and the face bordering the hole.

    electromagneticBC(emagmodel,'MagneticPotential',[0;0;0],'Face',3:6); 
    electromagneticBC(emagmodel,'MagneticPotential',[0;0;0.01],'Face',7);

    Generate a mesh.

    generateMesh(emagmodel);

    Solve the model.

    R = solve(emagmodel)
    R = 
      MagnetostaticResults with properties:
    
          MagneticPotential: [1x1 FEStruct]
              MagneticField: [1x1 FEStruct]
        MagneticFluxDensity: [1x1 FEStruct]
                       Mesh: [1x1 FEMesh]
    
    

    Plot the z-component of the magnetic potential.

    pdeplot3D(emagmodel,'ColormapData',R.MagneticPotential.Az)

    Plot the magnetic field.

    pdeplot3D(emagmodel,'FlowData',[R.MagneticField.Hx ...
                                    R.MagneticField.Hy ...
                                    R.MagneticField.Hz])

    Introduced in R2021a