网页
综合
更新时间 2026-11-14 16:52:23
MFEM - Finite Element Discretization Library
自动蜘蛛
mfem.org
正文约 6000 字
$\newcommand{\A}{\vec{A}}\newcommand{\B}{\vec{B}} \newcommand{\D}{\vec{D}}\newcommand{\E}{\vec{E}} \newcommand{\H}{\vec{H}}\newcommand{\J}{\vec{J}} \newcommand{\M}{\vec{M}}\newcommand{\P}{\vec{P}} \newcommand{\F}{\vec{F}} \newcommand{\dd}[2]{\frac{\partial #1}{\partial #2}} \newcommand{\cross}{\times}\newcommand{\inner}{\cdot} \newcommand{\div}{\nabla\cdot}\newcommand{\curl}{\nabla\times} \newcommand{\grad}{\nabla}$
The miniapps/electromagnetics directory contains a collection of electromagnetic miniapps based on MFEM.
Compared to the example codes, the miniapps are more complex, demonstrating more advanced usage of the library. They are intended to be more representative of MFEM-based application codes. We recommend that new users start with the example codes before moving to the miniapps.
The current electromagnetic miniapps are described below.
The equations describing electromagnetic phenomena are known collectively as the Maxwell Equations. They are usually given as:
$$\begin{align} \curl\H - \dd{\D}{t} & = \J \label{ampere} \\ \curl\E + \dd{\B}{t} & = 0 \label{faraday} \\ \div\D & = \rho \label{gauss} \\ \div\B & = 0 \label{divb} \end{align}$$
Where equation \eqref{ampere} can be referred to as Ampère's Law, equation \eqref{faraday} is called Faraday's Law, equation \eqref{gauss} is Gauss's Law, and equation \eqref{divb} doesn't generally have a name but is related to the nonexistence of magnetic monopoles. The various fields in these equations are:
In the literature these names do vary, particularly those for $\H$ and $\B$, but in this document we will try to adhere to the convention laid out above.
Generally we also need constitutive relations between $\E$ and $\D$ and/or between $\H$ and $\B$. These relations start with the definitions:
$$\begin{align} \D & = \epsilon_0\E + \P \label{const_d} \\ \B & = \mu_0(\H + \M) \label{const_b} \end{align}$$
Where $\P$ is the polarization density, and $\M$ is the magnetization. Also, $\epsilon_0$ is the permittivity of free space and $\mu_0$ is the permeability of free space which are both constants of nature. In many common materials the polarization density can be approximated as a scalar multiple of the electric field, i.e., $\P = \epsilon_0\chi\E$, where $\chi$ is called the electric susceptibility. In such cases we usually use the relation $\D = \epsilon\E$ with $\epsilon = \epsilon_0(1 + \chi)$ and call $\epsilon$ the permittivity of the material.
The nature of magnetization is more complicated but we will take a very simplified view which is valid in many situations. Specifically, we will assume that either $\M$ is proportional to $\H$ yielding the relation $\B = \mu\H$ where $\mu = \mu_0(1 + \chi_M)$ and $\chi_M$ is the magnetic susceptibility or that $\M$ is independent of the applied field. The former case pertains to both diamagnetic and paramagnetic materials and the latter to ferromagnetic materials.
Finally we should note that equations \eqref{ampere} and \eqref{gauss} can be combined to yield the equation of charge continuity $\dd{\rho}{t} + \div\J = 0$ which can be important in plasma physics and magnetohydrodynamics (MHD).
Electrostatic problems come in a variety of subtypes but they all derive from Gauss's Law and Faraday's Law (equations \eqref{gauss} and \eqref{faraday}). When we assume no time variation, Faraday's Law becomes simply $\curl\E = 0$. This suggests that the electric field can be expressed as the gradient of a scalar field which is traditionally taken to be $-\varphi$, i.e.
$$\E = -\grad\varphi \label{gradphi}$$
where $\varphi$ is called the electric potential and has units of Volts in the SI system. Inserting this definition into equation \eqref{gauss} gives:
$$-\div\epsilon\grad\varphi = \rho - \div\P \label{poisson}$$
which is Poisson's equation for the electric potential, where we have assumed a linear constitutive relation between $\D$ and $\E$ of the form $\D = \epsilon\E + \P$. This allows a polarization which is proportional to $\E$ as well as a polarization independent of $\E$. If this relation happens to be nonlinear then Poisson's equation would need to be replaced with a more complicated nonlinear expression.
The solutions to equation \eqref{poisson} are non unique because they can be shifted by any additive constant. This means that we must apply a Dirichlet boundary condition at least at one point in the problem domain in order to obtain a solution. Typically this point will be on the boundary but it need not be so. Such a Dirichlet value is equivalent to fixing the voltage (a.k.a. potential) at one or more locations. Additionally, this equation admits a normal derivative boundary condition. This corresponds to setting $\hat{n}\cdot\D$ to a prescribed value on some portion of the boundary. This is equivalent to defining a surface charge density on that portion of the boundary.
The electrostatics mini application, named volta after the inventor of the voltaic pile, is intended to demonstrate how to solve standard electrostatics problems in MFEM. Its source terms and boundary conditions are simple but they should indicate how more specialized sources or boundary conditions could be implemented.
Note that this application assumes the mesh coordinates are given in meters.
Permittivity: The permittivity, $\epsilon$, is assumed to be that of free space except for an optional sphere of dielectric material which can be defined by the user. The command line option -ds can be used to set the parameters for this dielectric sphere. For example, to produce a sphere at the origin with a radius of 0.5 and a relative permittivity of 3 the user would specify: -ds '0 0 0 0.5 3'.
Charge Density: The charge density, $\rho$, is assumed to be zero except for an optional sphere of uniform charge density which can be defined by the user. The command line option for this is -cs which follows the same pattern as the dielectric sphere. Note that the last entry is the total charge of the sphere and not its charge density.
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。