# ElectromagneticModel

## Description

An `ElectromagneticModel`

object contains
information about an electromagnetic analysis problem: the geometry, material properties,
electromagnetic sources, boundary conditions, and mesh.

## Creation

To create a `ElectromagneticModel`

object, use the
`createpde`

function and specify `"electromagnetic"`

as its first
argument .

## Properties

`AnalysisType`

— Type of electromagnetic analysis

`'electrostatic'`

| `'magnetostatic'`

| `'harmonic'`

| `'conduction'`

| `'electrostatic-axisymmetric'`

| `'magnetostatic-axisymmetric'`

| `'harmonic-axisymmetric'`

Type of electromagnetic analysis, specified as `'electrostatic'`

,
`'magnetostatic'`

, `'harmonic'`

,
`'conduction'`

, `'electrostatic-axisymmetric'`

,
`'magnetostatic-axisymmetric'`

, or
`'harmonic-axisymmetric'`

.

To change an electromagnetic analysis type, assign a new type to
`model.AnalysisType`

. Ensure that all other properties of the model
are consistent with the new analysis type.

`Geometry`

— Geometry description

`AnalyticGeometry`

| `DiscreteGeometry`

Geometry description, specified as an `AnalyticGeometry`

or
`DiscreteGeometry`

object.

`MaterialProperties`

— Material properties within domain

object containing material property assignments

Material properties within the domain, specified as an object containing the material property assignments.

`Sources`

— Electromagnetic sources within the domain or subdomain

object containing heat source assignments

Electromagnetic source within the domain or subdomain, specified as an object containing electromagnetic source assignments.

`BoundaryConditions`

— Boundary conditions applied to geometry

object containing boundary condition assignments

Boundary conditions applied to the geometry, specified as an object containing the boundary condition assignments.

`VacuumPermittivity`

— Permittivity of vacuum for entire model

number

Permittivity of vacuum for the entire model, specified as a number. This value must be consistent with the units of the model. If the model parameters are in the SI system of units, then the permittivity of vacuum must be 8.8541878128E-12.

`VacuumPermeability`

— Permeability of vacuum for entire model

number

Permeability of vacuum for the entire model, specified as a number. This value must be consistent with the units of the model. If the model parameters are in the SI system of units, then the permeability of vacuum must be 1.2566370614E-6.

`Mesh`

— Mesh for solution

`FEMesh`

object

Mesh for the solution, specified as a `FEMesh`

object. See
FEMesh Properties. You create the mesh using the `generateMesh`

function. For a 3-D magnetostatic model, the mesh must be
linear.

`SolverOptions`

— Algorithm options for PDE solvers

`PDESolverOptions`

object

Algorithm options for the PDE solvers, specified as a
`PDESolverOptions`

object. The properties of a
`PDESolverOptions`

object include absolute and relative tolerances
for internal ODE solvers, maximum solver iterations, and so on. For details, see
PDESolverOptions Properties.

`FieldType`

— Type of field for harmonic analysis

`'electric'`

(default) | `'magnetic'`

Type of field for a harmonic analysis, specified as `'electric'`

or
`'magnetic'`

.

## Object Functions

`geometryFromEdges` | Create 2-D geometry from decomposed geometry matrix |

`geometryFromMesh` | Create 2-D or 3-D geometry from mesh |

`importGeometry` | Import geometry from STL or STEP file |

`generateMesh` | Create triangular or tetrahedral mesh |

`electromagneticProperties` | Assign properties of material for electromagnetic model |

`electromagneticSource` | Specify current density, charge density, and magnetization for electromagnetic model |

`electromagneticBC` | Apply boundary conditions to electromagnetic model |

`solve` | Solve structural analysis, heat transfer, or electromagnetic analysis problem |

## Examples

### Create Electromagnetic Model

Create a model for electrostatic analysis.

emagE = createpde("electromagnetic","electrostatic")

emagE = ElectromagneticModel with properties: AnalysisType: "electrostatic" Geometry: [] MaterialProperties: [] Sources: [] BoundaryConditions: [] VacuumPermittivity: [] Mesh: []

Create an axisymmetric model for magnetostatic analysis. An axisymmetric model simplifies a 3-D problem to a 2-D problem using symmetry around the axis of rotation.

emagMA = createpde("electromagnetic","magnetostatic-axisymmetric")

emagMA = ElectromagneticModel with properties: AnalysisType: "magnetostatic-axisymmetric" Geometry: [] MaterialProperties: [] Sources: [] BoundaryConditions: [] VacuumPermeability: [] Mesh: []

Create a model for harmonic analysis.

emagH = createpde("electromagnetic","harmonic")

emagH = ElectromagneticModel with properties: AnalysisType: "harmonic" Geometry: [] MaterialProperties: [] Sources: [] BoundaryConditions: [] VacuumPermittivity: [] VacuumPermeability: [] Mesh: [] FieldType: "electric"

Create a model for DC conduction analysis.

emagDC = createpde("electromagnetic","conduction")

emagDC = ElectromagneticModel with properties: AnalysisType: "conduction" Geometry: [] MaterialProperties: [] BoundaryConditions: [] Mesh: []

## Version History

**Introduced in R2021a**

### R2022b: DC conduction analysis and permanent magnets

The programmatic workflow for a DC conduction analysis enables you to analyze stationary current distribution in conductors due to applied voltage.

You can also specify magnetization using the `electromagneticSource`

function to account for materials generating their own
magnetic fields in a magnetostatic analysis workflow.

### R2022a: Harmonic analysis

The programmatic workflow for a harmonic electromagnetic analysis enables you to set up, solve, and analyze time-harmonic Maxwell’s equations (the Helmholtz equation).

### R2021b: Electrostatic and magnetostatic analysis for 3-D models

The programmatic workflow for electrostatic and magnetostatic analyses now enables you to set up, solve, and analyze 3-D problems in addition to previously supported 2-D problems.

## See Also

`electromagneticProperties`

| `electromagneticSource`

| `electromagneticBC`

| `solve`

## Open Example

You have a modified version of this example. Do you want to open this example with your edits?

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)