RunMat
  • Pricing
RunMat
GitHub
GitHub
Sign inTry in browser
DesktopRuntimePhysicsCADAdministrationAgent

Get RunMat updates

New releases, guides and examples.

Product+
  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download
Math+
  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting
Physics+
  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA
Industries+
  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance
Learn+
  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students
Compare+
  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons
Company+
  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms

Product

  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download

Math

  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting

Physics

  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA

Industries

  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance

Learn

  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students

Compare

  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons

Company

  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms
GitHubXLinkedIn

© Dystr, Inc. · RunMat v0.7.1, Nov 17, 2026

RunMat® is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

/
    • Overview
    • Structural
    • Thermal
    • Electromagnetic
    • Trace impedance
    • Acoustics
    • Fluid flow
    • Thermal stress
    • Joule heating
    • Conjugate heat transfer
    • Fluid–structure
Docs>Physics>Physics

Electromagnetic

Electromagnetic analysis predicts electric potential, current flow, magnetic vector potential, flux density, field intensity, and frequency-dependent loss. RunMat uses typed quantities for volts, amperes, coulombs, current density, and vector potential; it never passes them to a solver as unitless numbers.

Four electromagnetic analyses run from a .fea study with runmat run:

AnalysisSelected byUnknownElements
Steady current flowelectromagnetic { equation = steady_conduction } + electromagnetic static {}electric potential VVVTet4 / Tet10 nodal
Electrostaticselectromagnetic { equation = electrostatics } + electromagnetic static {}electric potential VVVTet4 / Tet10 nodal
Magnetostaticselectromagnetic { equation = magnetostatics } + electromagnetic static {}magnetic vector potential A\mathbf AAlowest-order Nédélec edges
Time-harmonic fieldselectromagnetic harmonic { frequencies = [...] }electric field phasor E\mathbf EElowest-order Nédélec edges

A fifth analysis computes the impedance, delay and coupling of board traces from a 2D cross-section of the stackup: electromagnetic line_parameters {}. See trace impedance.

The loss of a steady-current or harmonic analysis can heat a thermal analysis of the same parts (see How does the loss heat the part? and electrothermal analysis).

What equations are solved?

Steady current flow and electrostatics. ∇⋅(a∇V)=−q\nabla\cdot(a\nabla V)=-q∇⋅(a∇V)=−q with a=σa=\sigmaa=σ (conduction) or a=εa=\varepsilona=ε (electrostatics), E=−∇V\mathbf E=-\nabla VE=−∇V, J=σE\mathbf J=\sigma\mathbf EJ=σE or D=εE\mathbf D=\varepsilon\mathbf ED=εE. Prescribed potentials are essential conditions; an injected terminal current is a natural condition with uniform normal current density over the terminal faces; every other face is insulated. Results: nodal potential, element electric field, current density or displacement, and Joule power density σ∣∇V∣2\sigma|\nabla V|^2σ∣∇V∣2 (or energy density). The Joule integral equals ∑ViIi\sum V_iI_i∑Vi​Ii​ over the terminals (checked on every solve).

Magnetostatics. ∇×(μ−1∇×A)=Js\nabla\times(\mu^{-1}\nabla\times\mathbf A)=\mathbf J_s∇×(μ−1∇×A)=Js​ with tangential A=0\mathbf A=0A=0 on grounded faces (magnetic.vector_potential_ground, the far field or a flux wall) and magnetic insulation, n×H=0\mathbf n\times\mathbf H=0n×H=0, on every other exterior face (a symmetry plane of the current). A weak Coulomb gauge (magnetic.coulomb_gauge) fixes the gradient part of A\mathbf AA in the whole field: in air, iron and conductors alike. Results: vector potential, flux density B=∇×A\mathbf B=\nabla\times\mathbf AB=∇×A and field intensity, at integration points and as element averages.

Time-harmonic fields. For each authored frequency, with eiωte^{i\omega t}eiωt phasors (peak values),

∇×(μ−1∇×E)+(iωσ−ω2ε)E=−iωJs,\nabla\times\left(\mu^{-1}\nabla\times\mathbf E\right) + \left(i\omega\sigma - \omega^2\varepsilon\right)\mathbf E = -i\omega\mathbf J_s,∇×(μ−1∇×E)+(iωσ−ω2ε)E=−iωJs​,

the full Maxwell equation in the temporal gauge (E=−iωA\mathbf E=-i\omega\mathbf AE=−iωA), including displacement current. Conductivity, permittivity and permeability are per material; zero conductivity is allowed, so air needs no artificial loss. Results at integration points and as element averages: E\mathbf EE, B=i∇×E/ω\mathbf B=i\nabla\times\mathbf E/\omegaB=i∇×E/ω, H\mathbf HH, D\mathbf DD, conduction current density, and the cycle-averaged Joule loss density 12σ∣E∣2\tfrac12\sigma|\mathbf E|^221​σ∣E∣2.

Boundary conditions for harmonic fields:

  • magnetic.vector_potential_ground (or electrical.perfect_conductor): tangential E=0\mathbf E=0E=0, the far field of an air region or a perfectly conducting wall.
  • every other exterior face: n×H=0\mathbf n\times\mathbf H=0n×H=0 (a symmetry plane of the current).

Sources for harmonic fields:

  • magnetic_volume_current_density on a body: an impressed (stranded) current density.
  • a driven solid conductor: electric_current on <terminal face> = I with electrical.potential { value = 0 V } on its return terminal (current drive), or two electrical.potential terminals (voltage drive). Inside the conductor the field is E−U∇v0\mathbf E-U\nabla v_0E−U∇v0​, where v0v_0v0​ is the conductor's electrokinetic unit potential and UUU the terminal voltage (an unknown for current drive). Skin and proximity effect in the driven conductor are solved, not assumed. Terminals that lie on a grounded face return their current through it; terminals inside the model (a gap-fed coil) are joined by the discrete potential flow of the terminal current through the electrically transparent medium, so no artificial charge builds up across the gap. A medium is electrically transparent at a frequency when its skin depth exceeds the model size (ωμσL2<1\omega\mu\sigma L^2<1ωμσL2<1, LLL the model diagonal).

Each terminal drive reports its voltage, current and complex power 12UIˉ\tfrac12 U\bar I21​UIˉ; the Joule loss in the conductors equals the real power delivered, and the complex Poynting balance and weak charge continuity are checked on every frequency.

Every authored frequency is an independent solve. A study with several frequencies runs one case per frequency (frequency=<f>Hz), in parallel, and each case publishes its own fields.

The harmonic and magnetostatic systems are factored with a sparse direct solver (LU with partial pivoting); the residual of the original equations is measured after the solve.

How do I describe a harmonic electromagnetic study?

model hardening_cell {
    assign material.steel_4140 to geometry.cell.region.gear
    assign material.copper to geometry.cell.region.coil
    assign material.air to geometry.cell.region.air
    constraint coil_return {
        electrical.potential { target = geometry.cell.region.coil_out; value = 0 V }
    }
    constraint far_field {
        magnetic.vector_potential_ground { target = geometry.cell.region.outer_boundary }
    }
    load coil_drive {
        electric_current on geometry.cell.region.coil_in = 2000 A
    }
}

study gear_hardening {
    geometry = geometry.cell
    mesh = mesh.cell
    model = model.hardening_cell
    analysis field {
        electromagnetic harmonic { frequencies = [3, 10, 30] kHz }
        retain loss
    }
    analysis heating after analysis.field {
        thermal transient {
            start_time = 0 s
            end_time = 3 s
            time_step = 0.05 s
            heat_source = analysis.field.state.loss
        }
    }
}

No electromagnetic { equation = ... } block is needed for a harmonic analysis: the analysis's frequencies define it. A harmonic_maxwell model domain with a reference_frequency is also accepted; the analysis frequencies, not the reference, set what is solved.

How does the loss heat the part?

heat_source = analysis.<harmonic>.state.<name> in a thermal steady or thermal transient analysis binds the harmonic analysis's retained state as the thermal heat source. For each frequency the cycle-averaged Joule loss density of every element, 1‘Ve‘∫e12σ∣E∣2dV\tfrac1`{V_e}`\int_e\tfrac12\sigma|\mathbf E|^2dV‘1​Ve​‘∫e​21​σ∣E∣2dV, becomes the element heat generation of the thermal analysis on the same mesh, so the total heat equals the electromagnetic loss. The run publishes the harmonic case and then the heating case (frequency=<f>Hz/field, frequency=<f>Hz/heating).

For steady current flow with temperature-dependent conductivity, use an electrothermal analysis, which iterates current and temperature.

How do I apply voltage, current, charge, or current density?

  • electrical.potential prescribes a terminal potential (static and harmonic).
  • electric_current injects a total current through terminal faces (uniform normal density).
  • electric_charge_density is a volume charge for electrostatics.
  • magnetic_volume_current_density is an impressed current density in a body (magnetostatics and harmonic fields).
  • magnetic_vector_potential holds exterior faces at a known tangential vector potential (magnetostatics), for example an imposed external field; those faces count as grounded.

Use direct load syntax for constant data and signal plus excitation for frequency- or time-dependent data.

What electrical and magnetic references are required?

  • Steady current flow and electrostatics: at least one prescribed potential on each connected conductor.
  • Magnetostatics: magnetic.vector_potential_ground on one connected set of exterior faces (normally the far field; include the ends of a conductor whose current leaves the model, since current cannot cross an insulated face), and one magnetic.coulomb_gauge.
  • Harmonic fields: a grounded far field (magnetic.vector_potential_ground). A Coulomb gauge is not used: conductivity and permittivity fix the field.

RunMat reports a missing reference instead of adding one.

What material properties does electromagnetic analysis need?

Electrical conductivity, relative permittivity and relative permeability per material. A resistive_heating_coefficient α\alphaα defines σ(T)=σref/(1+α(T−Tref))\sigma(T)=\sigma_{ref}/(1+\alpha(T-T_{ref}))σ(T)=σref​/(1+α(T−Tref​)); standalone electromagnetic analyses use σref\sigma_{ref}σref​, electrothermal analyses the solved temperature.

How accurate are the results?

See electromagnetic validation for the analytic checks (wire resistance, parallel-plate and coaxial capacitance, conductor field, skin-effect impedance). Resolve the skin depth δ=2/(ωμσ)\delta=\sqrt{2/(\omega\mu\sigma)}δ=2/(ωμσ)​ with several elements where loss matters.

See electromagnetic constraints, electromagnetic loads, electrothermal analysis, typed units, and current status.

On this page
  • What equations are solved?
  • How do I describe a harmonic electromagnetic study?
  • How does the loss heat the part?
  • How do I apply voltage, current, charge, or current density?
  • What electrical and magnetic references are required?
  • What material properties does electromagnetic analysis need?
  • How accurate are the results?