Main Content

electromagneticProperties

Assign properties of material for electromagnetic model

    Description

    example

    electromagneticProperties(emagmodel,'RelativePermittivity',epsilon) assigns relative permittivity epsilon to the entire geometry for an electrostatic model. Specify the permittivity of vacuum using the electromagnetic model properties.

    For a nonconstant material, specify epsilon as a function handle.

    example

    electromagneticProperties(emagmodel,'RelativePermeability',mu) assigns relative permeability to the entire geometry for a magnetostatic model. Specify the permeability of vacuum using the electromagnetic model properties.

    For a nonconstant material, specify mu as a function handle.

    example

    electromagneticProperties(___,RegionType,RegionID) assigns the material properties to specified faces of a 2-D geometry or cells of a 3-D geometry. Use this syntax with any of the input arguments from previous syntaxes.

    mtl = electromagneticProperties(___) returns the material properties object.

    Examples

    collapse all

    Specify relative permittivity for an electrostatic analysis.

    Create an electromagnetic model for electrostatic analysis.

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

    Import and plot a geometry of a plate with a hole in its center.

    gm = importGeometry(emagmodel,'PlateHoleSolid.stl');
    pdegplot(gm)

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

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

    emagmodel.VacuumPermittivity = 8.8541878128E-12;

    Specify the relative permittivity of the material.

    mtl = electromagneticProperties(emagmodel,'RelativePermittivity',2.25)
    mtl = 
      ElectromagneticMaterialAssignment with properties:
    
                  RegionType: 'Cell'
                    RegionID: 1
        RelativePermittivity: 2.2500
        RelativePermeability: []
    
    

    Specify relative permeability for a magnetostatic analysis.

    Create an electromagnetic model for a magnetostatic analysis.

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

    Import and plot a 2-D geometry.

    gm = importGeometry(emagmodel,'PlateHolePlanar.stl');
    pdegplot(gm,'EdgeLabels','on','FaceLabels','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.

    mtl = electromagneticProperties(emagmodel,'RelativePermeability',5000)
    mtl = 
      ElectromagneticMaterialAssignment with properties:
    
                  RegionType: 'Face'
                    RegionID: 1
        RelativePermittivity: []
        RelativePermeability: 5000
    
    

    Specify relative permittivity for individual faces in an electrostatic model.

    Create an electromagnetic model for an electrostatic analysis.

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

    Create a 2-D geometry with two faces. First, import and plot a 2-D geometry representing a plate with a hole.

    gm = importGeometry(emagmodel,'PlateHolePlanar.stl');
    pdegplot(gm,'EdgeLabels','on','FaceLabels','on')

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

    Then, fill the hole by adding a face and plot the resulting geometry.

    gm = addFace(gm,5);
    pdegplot(gm,'FaceLabels','on')

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

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

    emagmodel.VacuumPermittivity = 8.8541878128E-12;

    Specify relative permittivities separately for faces 1 and 2.

    electromagneticProperties(emagmodel,'RelativePermittivity',2.25, ...
                                        'Face',1)
    ans = 
      ElectromagneticMaterialAssignment with properties:
    
                  RegionType: 'Face'
                    RegionID: 1
        RelativePermittivity: 2.2500
        RelativePermeability: []
    
    
    electromagneticProperties(emagmodel,'RelativePermittivity',1, ...
                                        'Face',2)
    ans = 
      ElectromagneticMaterialAssignment with properties:
    
                  RegionType: 'Face'
                    RegionID: 2
        RelativePermittivity: 1
        RelativePermeability: []
    
    

    Use a function handle to specify a relative permittivity that depends on the spatial coordinates.

    Create an electromagnetic model for electrostatic analysis.

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

    Create a square geometry and include it in the model.

    geometryFromEdges(emagmodel,@squareg);

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

    emagmodel.VacuumPermittivity = 8.8541878128E-12;

    Specify the relative permittivity of the material as a function of the x-coordinate, ε=1+x2.

    perm = @(location,~)sqrt(1 + location.x.^2);
    electromagneticProperties(emagmodel,'RelativePermittivity',perm)
    ans = 
      ElectromagneticMaterialAssignment with properties:
    
                  RegionType: 'Face'
                    RegionID: 1
        RelativePermittivity: @(location,~)sqrt(1+location.x.^2)
        RelativePermeability: []
    
    

    Input Arguments

    collapse all

    Electromagnetic model, specified as an ElectromagneticModel object. The model contains a geometry, a mesh, the electromagnetic properties of the material, the electromagnetic sources, and the boundary conditions.

    Example: electromagneticmodel = createpde('electromagnetic','electrostatic')

    Relative permittivity, specified as a positive number or a function handle. Use a function handle to specify a relative permittivity that depends on the coordinates. For details, see More About.

    Data Types: double | function_handle

    Relative permeability, specified as a positive number or a function handle. Use a function handle to specify a relative permeability that depends on the coordinates. For details, see More About.

    Data Types: double | function_handle

    Geometric region type, specified as 'Face' for a 2-D geometry or 'Cell' for a 3-D geometry.

    Data Types: char | string

    Region ID, specified as a vector of positive integers. Find the face or cell IDs by using pdegplot with the 'FaceLabels' or 'CellLabels' name-value argument set to 'on'.

    Example: electromagneticProperties(emagmodel,'RelativePermeability',5000,'Face',1:3)

    Data Types: double

    Output Arguments

    collapse all

    Handle to material properties, returned as an ElectromagneticMaterialAssignment object. For more information, see ElectromagneticMaterialAssignment Properties.

    mtl associates material properties with the geometric faces.

    More About

    collapse all

    Specifying Nonconstant Parameters of Electromagnetic Model

    In Partial Differential Equation Toolbox™, use a function handle to specify these electromagnetic parameters when they depend on the coordinates:

    • Relative permittivity of the material

    • Relative permeability of the material

    • Charge density as source

    • Current density as source

    • Voltage at the boundary

    • Magnetic potential at the boundary

    For example, use function handles to specify the relative permittivity, charge density, and voltage at the boundary for this model.

    electromagneticProperties(emagmodel, ...
                             'RelativePermittivity', ...
                              @myfunPermittivity)
    electromagneticSource(emagmodel, ...
                          'ChargeDensity',@myfunCharge, ...
                          'Face',2)
    electromagneticBC(emagmodel, ...
                      'Voltage',@myfunBC, ...
                       'Edge',2)

    The function must be of the form:

    function emagVal = myfun(location,~)

    The solver computes and populates the data in the location structure array and passes this data to your function. You can define your function so that its output depends on this data. You can use any name instead of location. To use additional arguments in your function, wrap your function (that takes additional arguments) with an anonymous function that takes only the location argument. For example:

    emagVal = @(location,~) myfunWithAdditionalArgs(location,arg1,arg2...)
    electromagneticBC(model,'Edge',3,'Voltage',emagVal)
    

    If you call electromagneticBC with Vectorized set to 'on', then location can contain several evaluation points. If you do not set Vectorized or use Vectorized,'off', then solvers pass just one evaluation point in each call.

    The location data is a structure containing these fields:

    • location.x — The x-coordinate of the point or points

    • location.y — The y-coordinate of the point or points

    • location.z — For a 3-D or an axisymmetric geometry, the z-coordinate of the point or points

    • location.r — For an axisymmetric geometry, the r-coordinate of the point or points

    Electromagnetic material properties (relative permittivity or relative permeability) and electromagnetic source (charge density or current density) get these data from the solver:

    • location.x, location.y, location.z, location.r

    • Subdomain ID

    Boundary conditions (voltage or magnetic potential on the boundary) get these data from the solver:

    • location.x, location.y, location.z, location.r

    • location.nx, location.ny, location.nz, location.nr

    For the nonconstant relative permittivity, relative permeability, and charge density, the output returned by the function handle must be of size 1-by-Np, where Np = numel(location.x) is the number of points.

    For the nonconstant current density and magnetic potential on the boundary, the output returned by the function handle must be of size 1-by-Np for a 2-D problem and 3-by-Np for a 3-D problem.

    Introduced in R2021a