Main Content

findElectromagneticSource

(To be removed) Find electromagnetic source assigned to geometric region

Since R2021a

    findElectromagneticSource will be removed. Use the CellLoad and FaceLoad properties of femodel instead. (since R2023a) For more information on updating your code, see Version History.

    Description

    emSource = findElectromagneticSource(sources,RegionType,RegionID) returns the change or current density emSource assigned to the specified region of the specified model.

    example

    Examples

    collapse all

    Create an electromagnetic model for magnetostatic analysis.

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

    Include the L-shaped membrane geometry in the model and plot it with the face labels.

    geometryFromEdges(emagmodel,@lshapeg);
    pdegplot(emagmodel,"FaceLabels","on")
    ylim([-1.1 1.1])
    axis equal

    Figure contains an axes object. The axes object contains 4 objects of type line, text.

    Specify a different current density for each face.

    electromagneticSource(emagmodel,"Face",1,"CurrentDensity",10);
    electromagneticSource(emagmodel,"Face",2,"CurrentDensity",20);
    electromagneticSource(emagmodel,"Face",3,"CurrentDensity",30);

    Check the electromagnetic source specification for each face.

    findElectromagneticSource(emagmodel.Sources,"Face",1)
    ans = 
      ElectromagneticSourceAssignment with properties:
    
            RegionType: 'Face'
              RegionID: 1
         ChargeDensity: []
        CurrentDensity: 10
         Magnetization: []
    
    
    findElectromagneticSource(emagmodel.Sources,"Face",2)
    ans = 
      ElectromagneticSourceAssignment with properties:
    
            RegionType: 'Face'
              RegionID: 2
         ChargeDensity: []
        CurrentDensity: 20
         Magnetization: []
    
    
    findElectromagneticSource(emagmodel.Sources,"Face",3)
    ans = 
      ElectromagneticSourceAssignment with properties:
    
            RegionType: 'Face'
              RegionID: 3
         ChargeDensity: []
        CurrentDensity: 30
         Magnetization: []
    
    

    Input Arguments

    collapse all

    Source in an electromagnetic model, specified as the Sources property of the model.

    Example: findElectromagneticSource(emagmodel.Sources,"Face",1)

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

    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".

    Data Types: double

    Output Arguments

    collapse all

    Electromagnetic source assignment, returned as an ElectromagneticSourceAssignment object. For more information, see ElectromagneticSourceAssignment Properties.

    Version History

    Introduced in R2021a

    collapse all