Main Content

electromagneticProperties

Assign properties of material for electromagnetic model

    Description

    example

    electromagneticProperties(emagmodel,"RelativePermittivity",epsilon) assigns the relative permittivity epsilon to the entire geometry. Specify the permittivity of vacuum using the electromagnetic model properties. The solver uses a relative permittivity for electrostatic and harmonic analyses.

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

    example

    electromagneticProperties(emagmodel,"RelativePermeability",mu) assigns the relative permeability to the entire geometry. Specify the permeability of vacuum using the electromagnetic model properties. The solver uses a relative permeability for magnetostatic and harmonic analyses.

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

    example

    electromagneticProperties(emagmodel,"RelativePermittivity",epsilon,"RelativePermeability",mu,"Conductivity",sigma) assigns the relative permittivity, relative permeability, and conductivity to the entire geometry. Specify the permittivity and permeability of vacuum using the electromagnetic model properties. The solver requires all three parameters for a harmonic analysis.

    For a nonconstant material, specify epsilon, mu, and sigma as function handles.

    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 argument combinations in the 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: []
                Conductivity: []
    
    

    Specify relative permeability for a magnetostatic analysis.

    Create an electromagnetic model for magnetostatic analysis.

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

    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.

    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
                Conductivity: []
    
    

    Specify relative permittivity, relative permeability, and conductivity of a material for harmonic analysis.

    Create an electromagnetic model for harmonic analysis.

    emagmodel = createpde("electromagnetic","harmonic");

    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 and permeability values in the SI system of units.

    emagmodel.VacuumPermeability = 1.2566370614E-6;
    emagmodel.VacuumPermittivity = 8.8541878128E-12;

    Specify the relative permittivity, relative permeability, and conductivity of the material.

    electromagneticProperties(emagmodel,"RelativePermittivity",2.25, ...
                                        "RelativePermeability",5000, ...
                                        "Conductivity",1)
    ans = 
      ElectromagneticMaterialAssignment with properties:
    
                  RegionType: 'Cell'
                    RegionID: 1
        RelativePermittivity: 2.2500
        RelativePermeability: 5000
                Conductivity: 1
    
    

    Specify relative permittivity for individual faces in an electrostatic model.

    Create an electromagnetic model for 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: []
                Conductivity: []
    
    
    electromagneticProperties(emagmodel,"RelativePermittivity",1, ...
                                        "Face",2)
    ans = 
      ElectromagneticMaterialAssignment with properties:
    
                  RegionType: 'Face'
                    RegionID: 2
        RelativePermittivity: 1
        RelativePermeability: []
                Conductivity: []
    
    

    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: []
                Conductivity: []
    
    

    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.

    Relative permittivity, specified as a positive or complex number or a function handle.

    • Use a positive number to specify a relative permittivity for an electrostatic analysis.

    • Use a complex number to specify a relative permittivity for a harmonic electromagnetic analysis.

    • Use a function handle to specify a relative permittivity that depends on the coordinates or, for a harmonic analysis, on the frequency.

    For details, see More About.

    Data Types: double | function_handle
    Complex Number Support: Yes

    Relative permeability, specified as a positive or complex number or a function handle.

    • Use a positive number to specify a relative permeability for a magnetostatic analysis.

    • Use a complex number to specify a relative permeability for а harmonic electromagnetic analysis.

    • Use a function handle to specify a relative permeability that depends on the coordinates or, for a harmonic analysis, on the frequency.

    For details, see More About.

    Data Types: double | function_handle
    Complex Number Support: Yes

    Conductivity, specified as a nonnegative number or a function handle. Use a function handle to specify a conductivity that depends on the coordinates or, for a harmonic analysis, on the frequency. 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 and, for a harmonic analysis, on the frequency:

    • Relative permittivity of the material

    • Relative permeability of the material

    • Conductivity of the material

    • Charge density as source (can depend on space only)

    • Current density as source (can depend on space only)

    • Voltage on the boundary (can depend on space only)

    • Magnetic potential on the boundary (can depend on space only)

    • Electric field on the boundary (can depend on space only)

    • Magnetic field on the boundary (can depend on space only)

    For example, use function handles to specify the relative permittivity, charge density, and voltage on the boundary for emagmodel.

    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,state)

    The solver computes and populates the data in the location and state structure arrays and passes this data to your function. You can define your function so that its output depends on this data. You can use any names in place of location and state.

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

    • location — A structure array 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

      Furthermore, for boundary conditions, the solver passes this data in the location structure:

      • location.nx — The x-component of the normal vector at the evaluation point or points

      • location.ny — The y-component of the normal vector at the evaluation point or points

      • location.nz — For a 3-D or an axisymmetric geometry, the z-component of the normal vector at the evaluation point or points

      • location.nr — For an axisymmetric geometry, the r-component of the normal vector at the evaluation point or points

    • state — A structure array containing this field for a harmonic electromagnetic problem:

      • state.frequency - Frequency at evaluation points

    Relative permittivity, relative permeability, and conductivity get this data from the solver:

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

    • state.frequency for a harmonic analysis

    • Subdomain ID

    Charge density, current density, electric or magnetic field on the boundary get this data from the solver:

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

    • Subdomain ID

    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

    When you solve an electrostatic or magnetostatic problem, the output returned by the function handle must be of the following size. Here, Np = numel(location.x) is the number of points.

    • 1-by-Np if a function specifies the nonconstant relative permittivity, relative permeability, and charge density. For the charge density, the output can also be Np-by-1.

    • 1-by-Np for a 2-D model and 3-by-Np for a 3-D model if a function specifies the nonconstant current density and magnetic potential on the boundary. For the current density, the output can also be Np-by-1 or Np-by-3.

    When you solve a harmonic problem, the output returned by the function handle must be of the following size. Here, Np = numel(location.x) is the number of points.

    • 1-by-Np if a function specifies the nonconstant relative permittivity, relative permeability, and conductivity.

    • 2-by-Np for a 2-D problem and 3-by-Np for a 3-D problem if a function specifies the nonconstant electric or magnetic field.

    • 2-by-Np or Np-by-2 for a 2-D problem and 3-by-Np or Np-by-3 for a 3-D problem if a function specifies the nonconstant current density and the field type is electric.

    • 1-by-Np or Np-by-1 for a 2-D problem and 3-by-Np or Np-by-3 for a 3-D problem if a function specifies the nonconstant current density and the field type is magnetic.

    If relative permittivity, relative permeability, or conductivity for a harmonic analysis depends on the frequency, ensure that your function returns a matrix of NaN values of the correct size when state.frequency is NaN. Solvers check whether a problem is nonlinear or time dependent by passing NaN state values and looking for returned NaN values.

    Additional Arguments in Functions for Nonconstant Electromagnetic Parameters

    To use additional arguments in your function, wrap your function (that takes additional arguments) with an anonymous function that takes only the location and state arguments. For example:

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

    Version History

    Introduced in R2021a