Main Content

findElectromagneticBC

Find electromagnetic boundary conditions assigned to geometric region

    Description

    example

    emBC = findElectromagneticBC(emagmodel.BoundaryConditions,RegionType,RegionID) returns the voltage or magnetic potential assigned to the specified region of the specified model.

    Examples

    collapse all

    Create an electromagnetic model for a 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.

    Assign magnetic potential values to edges 1 and 2.

    electromagneticBC(emagmodel,'Edge',1,'MagneticPotential',1);
    electromagneticBC(emagmodel,'Edge',2,'MagneticPotential',0);

    Check the boundary condition specifications for edge 1 and 2.

    emBC = findElectromagneticBC(emagmodel.BoundaryConditions,'Edge',1:2);
    emBC(1)
    ans = 
      ElectromagneticBCAssignment with properties:
    
               RegionType: 'Edge'
                 RegionID: 1
                  Voltage: []
        MagneticPotential: 1
               Vectorized: 'off'
    
    
    emBC(2)
    ans = 
      ElectromagneticBCAssignment with properties:
    
               RegionType: 'Edge'
                 RegionID: 2
                  Voltage: []
        MagneticPotential: 0
               Vectorized: 'off'
    
    

    Create an electromagnetic model for electrostatic analysis.

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

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

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

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

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

    electromagneticBC(emagmodel,'Voltage',0,'Face',3:6);
    electromagneticBC(emagmodel,'Voltage',1000,'Face',7);

    Check the boundary condition specifications for faces 4, 5, and 7.

    emBC = findElectromagneticBC(emagmodel.BoundaryConditions, ...
                                 'Face',[4 5 7]);
    emBC(1)
    ans = 
      ElectromagneticBCAssignment with properties:
    
               RegionType: 'Face'
                 RegionID: [3 4 5 6]
                  Voltage: 0
        MagneticPotential: []
               Vectorized: 'off'
    
    
    emBC(2)
    ans = 
      ElectromagneticBCAssignment with properties:
    
               RegionType: 'Face'
                 RegionID: [3 4 5 6]
                  Voltage: 0
        MagneticPotential: []
               Vectorized: 'off'
    
    
    emBC(3)
    ans = 
      ElectromagneticBCAssignment with properties:
    
               RegionType: 'Face'
                 RegionID: 7
                  Voltage: 1000
        MagneticPotential: []
               Vectorized: 'off'
    
    

    Input Arguments

    collapse all

    Boundary conditions of an electromagnetic model, specified as the BoundaryConditions property of the model.

    Example: findElectromagneticBC(emagmodel.BoundaryConditions,'Edge',1)

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

    Data Types: char | string

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

    Data Types: double

    Output Arguments

    collapse all

    Electromagnetic boundary condition assignment, returned as an ElectromagneticBCAssignment object. For more information, see ElectromagneticBCAssignment Properties.

    Introduced in R2021a