| 1 |
<i> |
| 2 |
This program was contributed by Siarhei Uzunbajakau, <a href="https://www.cembooks.nl"> CEM Books</a>, 2025. |
| 3 |
</i> |
| 4 |
|
| 5 |
<a name="step_97-Intro"></a> |
| 6 |
<h1>Introduction</h1> |
| 7 |
|
| 8 |
<h3>Problem definition</h3> |
| 9 |
|
| 10 |
This tutorial illustrates application of the FE_Nedelec and FE_RaviartThomas |
| 11 |
finite elements to problems in electromagnetics. To this end, we will compute |
| 12 |
the magnetic field induced by a coil with a magnetic core and compare the |
| 13 |
result to an exact closed-form analytical expression of the magnetic field. We |
| 14 |
will repeat the comparison on a set of progressively refined meshes and observe |
| 15 |
that the $L^2$ error norm decreases with the size of mesh cells. We will |
| 16 |
also vary the degree of the finite elements and observe that the higher-degree |
| 17 |
finite elements imply faster convergence of the $L^2$ error norms. Experimenting |
| 18 |
with boundary conditions is suggested as a possibility for extension. |
| 19 |
|
| 20 |
The first figure below illustrates a cross section of the coil. The second |
| 21 |
figure illustrates the corresponding problem domain, coordinate system, and the |
| 22 |
relevant notations. The coil consists of two spherical shells. The inner shell, |
| 23 |
depicted in green, is the magnetic core. The walls of the core are |
| 24 |
filled with a soft magnetic material of permeability $\mu_1$. The magnetic |
| 25 |
material is assumed to be homogeneous, linear, lossless, and isotropic. The |
| 26 |
permeability of the rest of the space (the ball-shaped space inside the core and |
| 27 |
the space outside the core) equals to that of the free space, $\mu_0$. The |
| 28 |
permeability of the entire space can be expressed as |
| 29 |
\f{equation}{ |
| 30 |
\mu = \left\{ |
| 31 |
\begin{aligned} |
| 32 |
& \mu_0 &\text{if } \text{ } & r < a_1\\ |
| 33 |
& \mu_1 &\text{if } \text{ } & a_1 \le r \le b_1\\ |
| 34 |
& \mu_0 &\text{if } \text{ } & r > b_1. |
| 35 |
\end{aligned} |
| 36 |
\right. |
| 37 |
\f} |
| 38 |
The outer shell, depicted in blue, contains the current-carrying windings of |
| 39 |
the coil. The windings are modeled by a prescribed free-current density. The |
| 40 |
prescribed free-current density fills all the space available in the wall of |
| 41 |
the shell. In the figure below, however, only three cross sections of the |
| 42 |
free-current density are shown. The free-current density is the highest on the |
| 43 |
equator and equals zero at the two poles. It can be described as |
| 44 |
\f[ |
| 45 |
\vec{J}_f = \left\{ |
| 46 |
\begin{aligned} |
| 47 |
& 0 &&\text{if }&& r < a_2\\ |
| 48 |
& K_0 (-y\hat{i} + x\hat{j})&&\text{if }&& a_2 \le r \le b_2\\ |
| 49 |
& 0 &&\text{if }&& r > b_2\\ |
| 50 |
\end{aligned} |
| 51 |
\right. |
| 52 |
\f] |
| 53 |
in the Cartesian coordinate system. |
| 54 |
|
| 55 |
@htmlonly |
| 56 |
<p align="center"> |
| 57 |
<img src="https://www.dealii.org/images/steps/developer/step-97-coil.svg" alt="The coil" height="425"> |
| 58 |
</p> |
| 59 |
@endhtmlonly |
| 60 |
|
| 61 |
There is no consensus in the literature on what to call a magnetic field. |
| 62 |
On this page we adopt the nomenclature from @cite griffiths2017b. Consequently, |
| 63 |
we call a magnetic field the vector quantity $\vec{B}$ such that the Ampere's |
| 64 |
law in free space in static approximation reads |
| 65 |
\f[ |
| 66 |
\begin{equation} |
| 67 |
\vec{\nabla} \times\vec{B} = \mu_0\vec{J}, |
| 68 |
\end{equation} |
| 69 |
\f] |
| 70 |
where $\vec{J}$ is the total current density, free plus bound. |
| 71 |
|
| 72 |
<h3>Problem domain and coordinate systems</h3> |
| 73 |
|
| 74 |
We adopt the Cartesian coordinate system, the coordinates being $x$, $y$, and |
| 75 |
$z$, as shown in the figure below. We denote the corresponding unitary basis |
| 76 |
vectors as $\hat{i}$, $\hat{j}$, and $\hat{k}$. The problem domain consists |
| 77 |
of a ball centered at the origin and four spherical shells around it. |
| 78 |
The spheres $\Gamma_{I1}$ and $\Gamma_{I2}$ are interfaces between the magnetic |
| 79 |
material and free space. Strictly speaking, the magnetic field induced by the |
| 80 |
coil extends to infinity. Therefore, the problem we would like to solve |
| 81 |
is unbounded. As the mesh needs to have finite dimensions, we truncate the |
| 82 |
space with the sphere $\Gamma_{R1}$. This sphere will represent infinity. |
| 83 |
We denote the spherical coordinates as $r$, $\theta$, and $\phi$, with $\theta$ |
| 84 |
and $\phi$ being polar and azimuthal angles, respectively. The figure below |
| 85 |
illustrates the basis vectors of the spherical coordinate system, $\hat{r}$, |
| 86 |
$\hat{\theta}$, and $\hat{\phi}$. |
| 87 |
|
| 88 |
@htmlonly |
| 89 |
<p align="center"> |
| 90 |
<img src="https://www.dealii.org/images/steps/developer/step-97-domain.svg" alt="The domain" height="496"> |
| 91 |
</p> |
| 92 |
@endhtmlonly |
| 93 |
|
| 94 |
<h3>Exact solution</h3> |
| 95 |
|
| 96 |
The problem of a permeable spherical shell exposed to a uniform magnetic field |
| 97 |
is ubiquitous in the literature on electromagnetics. The problem of the magnetic |
| 98 |
field generated by a spherical coil can be found in the literature as well. |
| 99 |
Remarkably, the magnetic field inside the coil is uniform. Due to this fact one |
| 100 |
can combine the solution to these two problems to get the exact closed-form |
| 101 |
analytical expressions for the magnetic field generated by the coil described |
| 102 |
above. The exact solution presented below is a combination of the solutions to |
| 103 |
the problems of permeable shell and spherical coil. The derivation of the |
| 104 |
equations presented below can be found in @cite uzunbajakau2024b. |
| 105 |
|
| 106 |
We express the magnetic field induced by the coil as a sum of the magnetic |
| 107 |
field induced by the free-current density in free space, $\vec{B}_J$, |
| 108 |
and the magnetic field induced by the magnetization of the magnetic core, |
| 109 |
$\vec{B}_{\mu}$, |
| 110 |
\f[ |
| 111 |
\vec{B} = \vec{B}_J +\vec{B}_{\mu}. |
| 112 |
\f] |
| 113 |
|
| 114 |
It is convenient to express the term $\vec{B}_J$ in a spherical coordinate |
| 115 |
system, |
| 116 |
|
| 117 |
\f[ |
| 118 |
\vec{B}_J = \left\{ |
| 119 |
\begin{aligned} |
| 120 |
& \frac{1}{2} (b_2^2-a_2^2) \vec{F}_1(\theta) |
| 121 |
&&\text{if }&& r \le a_2\\ |
| 122 |
& \frac{1}{2} (b_2^2-r^2) \vec{F}_1(\theta) + |
| 123 |
\frac{1}{5} (r^5-a_2^5) \vec{F}_2(r, \theta) |
| 124 |
&& \text{if } && a_2 \le r \le b_2\\ |
| 125 |
& \frac{1}{5} (b_2^5-a_2^5) \vec{F}_2(r, \theta) &&\text{if }&& r \ge b_2,\\ |
| 126 |
\end{aligned} |
| 127 |
\right. |
| 128 |
\f] |
| 129 |
where |
| 130 |
\f[ |
| 131 |
\begin{aligned} |
| 132 |
&\vec{F}_1(\theta) = \dfrac{2}{3}\mu_0 |
| 133 |
K_0\big(\cos(\theta)\hat{r}-\sin(\theta)\hat{\theta}\big), \\ |
| 134 |
&\vec{F}_2(r, \theta) = \dfrac{2}{3}\mu_0 K_0 |
| 135 |
\frac{1}{r^3}\big(\cos(\theta)\hat{r}+\frac{1}{2}\sin(\theta)\hat{\theta}\big). |
| 136 |
\end{aligned} |
| 137 |
\f] |
| 138 |
|
| 139 |
We, however, need to program in the Cartesian coordinate system. The expressions |
| 140 |
above can be converted into the Cartesian coordinate system by invoking the |
| 141 |
following identities: |
| 142 |
\f[ |
| 143 |
r = \sqrt{x^2+y^2+z^2}, |
| 144 |
\f] |
| 145 |
\f[ |
| 146 |
\cos(\theta) = \frac{z}{r}, |
| 147 |
\f] |
| 148 |
\f[ |
| 149 |
\sin(\theta) = \frac{\sqrt{x^2+y^2}}{r}, |
| 150 |
\f] |
| 151 |
\f[ |
| 152 |
\cos(\phi) = \frac{x}{\sqrt{x^2+y^2}}, |
| 153 |
\f] |
| 154 |
\f[ |
| 155 |
\sin(\phi) = \frac{y}{\sqrt{x^2+y^2}}, |
| 156 |
\f] |
| 157 |
\f[ |
| 158 |
\hat{r} = \frac{1}{r} (x\hat{i}+y\hat{j}+z\hat{k}), |
| 159 |
\f] |
| 160 |
and |
| 161 |
\f[ |
| 162 |
\hat{\theta}= \cos(\theta)\cos{\phi}\hat{i} + \cos(\theta)\sin{\phi}\hat{j} - \sin(\theta) \hat{k}. |
| 163 |
\f] |
| 164 |
|
| 165 |
The magnetic field induced by the magnetic core can be expressed in Cartesian |
| 166 |
coordinates as |
| 167 |
\f[ |
| 168 |
\vec{B}_{\mu} = - \mu\vec{\nabla} \Psi - \mu_0 H_0 \hat{k}, |
| 169 |
\f] |
| 170 |
where |
| 171 |
\f[ |
| 172 |
H_0 = \frac{1}{3} K_0 (b_2^2-a_2^2), |
| 173 |
\f] |
| 174 |
\f{equation}{ |
| 175 |
\mu = \left\{ |
| 176 |
\begin{aligned} |
| 177 |
& \mu_0 &\text{if } \text{ } & r < a_1\\ |
| 178 |
& \mu_1 &\text{if } \text{ } & a_1 \le r \le b_1\\ |
| 179 |
& \mu_0 &\text{if } \text{ } & r > b_1, |
| 180 |
\end{aligned} |
| 181 |
\right. |
| 182 |
\f} |
| 183 |
and |
| 184 |
\f{equation}{ |
| 185 |
\vec{\nabla} \Psi = \left\{ |
| 186 |
\begin{aligned} |
| 187 |
&\delta_1 \hat{k} &\text{if } \text{ } & r \le a_1\\ |
| 188 |
&-3\gamma_1\frac{xz}{r^5}\hat{i} -3\gamma_1\frac{yz}{r^5}\hat{j} + |
| 189 |
\bigg(\beta_1 + \gamma_1\frac{1}{r^3} - 3\gamma_1\frac{z^2}{r^5} \bigg)\hat{k} |
| 190 |
&\text{if } \text{ } & a_1 \le r \le b_1\\ |
| 191 |
&-3\alpha_1\frac{xz}{r^5}\hat{i} -3\alpha_1\frac{yz}{r^5}\hat{j} + |
| 192 |
\bigg(-H_0 + \alpha_1\frac{1}{r^3} - 3\alpha_1\frac{z^2}{r^5} \bigg)\hat{k} |
| 193 |
&\text{if } \text{ } & r \ge b_1. |
| 194 |
\end{aligned} |
| 195 |
\right. |
| 196 |
\f} |
| 197 |
The following constants were used in the last equation: |
| 198 |
\f{equation}{ |
| 199 |
\begin{aligned} |
| 200 |
&\Omega = \frac{(\mu_r - 1)}{(\mu_r + 2)} \frac{a_1^3}{b_1^3}, \\ |
| 201 |
&\gamma_1 = \frac{-3b_1^3 H_0 \Omega}{(2\mu_r+1)-2 (\mu_r-1) \Omega}, \\ |
| 202 |
&\beta_1 = \frac{(2\mu_r+1) \gamma_1}{(\mu_r-1)a_1^3}, \\ |
| 203 |
&\alpha_1 = \frac{-b_1^3 H_0+2\mu_r\gamma_1-\mu_r b_1^3\beta_1}{2}, \\ |
| 204 |
&\delta_1 = \frac{\mu_r a_1^3\beta_1-2\mu_r\gamma_1}{a_1^3}. |
| 205 |
\end{aligned} |
| 206 |
\f} |
| 207 |
|
| 208 |
The relative permeability in the last five equations is computed as |
| 209 |
\f[ |
| 210 |
\mu_r = \frac{\mu_1}{\mu_0}. |
| 211 |
\f] |
| 212 |
|
| 213 |
<h3>Boundary value problems</h3> |
| 214 |
|
| 215 |
<h4>Magnetic vector potential - A</h4> |
| 216 |
|
| 217 |
Ampere's law in static approximation can be written in terms of the |
| 218 |
auxiliary vector field $\vec{H}$ as |
| 219 |
\f[ |
| 220 |
\vec{\nabla}\times\vec{H} = \vec{J}_f, |
| 221 |
\f] |
| 222 |
where $\vec{J}_f$ is the free current and $\vec{H}$ is given by |
| 223 |
\f{equation}{ |
| 224 |
\begin{array}{ll} |
| 225 |
\vec{H} = \dfrac{1}{\mu}\vec{B} & \text{(constitutive relation)}. |
| 226 |
\end{array} |
| 227 |
\f} |
| 228 |
We introduce the magnetic vector potential, $\vec{A}$, as |
| 229 |
\f{equation}{ |
| 230 |
\begin{array}{ll} |
| 231 |
\vec{B} = \vec{\nabla}\times\vec{A} & |
| 232 |
\text{(definition of magnetic vector potential)}. |
| 233 |
\end{array} |
| 234 |
\f} |
| 235 |
By combining the last three equations we arrive at |
| 236 |
\f[ |
| 237 |
\vec{\nabla}\times\bigg(\dfrac{1}{\mu} \vec{\nabla}\times\vec{A}\bigg) = |
| 238 |
\vec{J}_f, |
| 239 |
\f] |
| 240 |
which is the curl-curl partial differential equation we would like to solve. |
| 241 |
There are, however, two subtleties we need to address before solving any |
| 242 |
curl-curl equations: the gauge and compatibility condition. |
| 243 |
|
| 244 |
<h5>Gauge</h5> |
| 245 |
|
| 246 |
The Helmholtz decomposition theorem suggests that any vector field studied in |
| 247 |
electromagnetics, say $\vec{A}$, can be represented as a sum of a conservative |
| 248 |
and a solenoidal vector field, |
| 249 |
\f[ |
| 250 |
\vec{A} = |
| 251 |
\underbrace{- \vec{\nabla} V}_{\text{conservative}} + |
| 252 |
\underbrace{\vec{\nabla} \times \vec{W}}_{\text{solenoidal}} = |
| 253 |
\vec{C} + \vec{S}. |
| 254 |
\f] |
| 255 |
The curl of a conservative vector field always equals zero (conservative fields |
| 256 |
are curl free), |
| 257 |
\f[ |
| 258 |
\vec{\nabla} \times \vec{C} = |
| 259 |
-\vec{\nabla} \times \big( \vec{\nabla} V \big) = 0. |
| 260 |
\f] |
| 261 |
Consequently, any vector field derived by adding a conservative vector field to |
| 262 |
a solution to the curl-curl equation is also a solution, |
| 263 |
\f[ |
| 264 |
\vec{\nabla}\times\bigg(\dfrac{1}{\mu} \vec{\nabla}\times\Big(\vec{A} |
| 265 |
- \vec{\nabla} V'\Big)\bigg) = |
| 266 |
\vec{\nabla}\times\bigg(\dfrac{1}{\mu} \vec{\nabla}\times\vec{A}\bigg). |
| 267 |
\f] |
| 268 |
We can restrict this freedom by specifying the divergence of the solution. |
| 269 |
Indeed, the divergence of a solenoidal vector field always equals zero (solenoidal |
| 270 |
fields are divergence free), |
| 271 |
\f[ |
| 272 |
\vec{\nabla} \cdot \vec{S} = |
| 273 |
\vec{\nabla} \cdot \big(\vec{\nabla} \times \vec{W}\big) = 0. |
| 274 |
\f] |
| 275 |
Then the divergence of a solution can be expressed as |
| 276 |
\f[ |
| 277 |
\vec{\nabla} \cdot \vec{A} = |
| 278 |
\vec{\nabla} \cdot \big(\vec{C} + \vec{S}\big) = |
| 279 |
\vec{\nabla} \cdot \vec{C}. |
| 280 |
\f] |
| 281 |
By specifying the divergence of the solution, we specify the divergence of the |
| 282 |
conservative part of the solution, and, thus, we specify the conservative part |
| 283 |
of the solution itself. In short: the magnetic vector potential consists of |
| 284 |
conservative and solenoidal components; the curl-curl equation fixes the |
| 285 |
solenoidal component, the gauge fixes the conservative component. For example, |
| 286 |
the Coulomb gauge, |
| 287 |
\f[ |
| 288 |
\vec{\nabla} \cdot \vec{A} = 0, |
| 289 |
\f] |
| 290 |
specifies that there is no conservative component in $\vec{A}$. That is, the |
| 291 |
Coulomb gauge selects a purely solenoidal solution. We are interested in the |
| 292 |
magnetic field, $\vec{B}$. In the realm of classical electromagnetics, the |
| 293 |
magnetic vector potential, $\vec{A}$, has an instrumental value - we just use |
| 294 |
it to compute the magnetic field, $\vec{B}$. The magnetic vector potential is |
| 295 |
a useful mathematical tool but it has no physical meaning as it cannot be |
| 296 |
measured. On the contrary, the magnetic field, $\vec{B}$, can be measured and, |
| 297 |
as a consequence, has a distinctive physical meaning. From a physical |
| 298 |
perspective, there are (infinitely) many magnetic vector potentials that lead |
| 299 |
to the same physically measurable magnetic field and for a physicist, it doesn't |
| 300 |
matter which of these potentials we choose. But from a mathematical perspective, |
| 301 |
we need to pick one to make the problem well-posed. A gauge is a way to pick |
| 302 |
one. Because the magnetic field is computed as |
| 303 |
\f[ |
| 304 |
\vec{B} = \vec{\nabla}\times\vec{A} = |
| 305 |
\vec{\nabla}\times\big(\vec{C} + \vec{S} \big) = |
| 306 |
\vec{\nabla}\times\vec{S}, |
| 307 |
\f] |
| 308 |
we are interested in the solenoidal part of the solution. Which conservative |
| 309 |
component of the solution is brought by the gauge is not important. |
| 310 |
|
| 311 |
A good question is: how to enforce the gauge? The literature suggests that the |
| 312 |
best approach is not to gauge the magnetic vector potential explicitly. Instead, |
| 313 |
one should invoke an advanced linear solver (tree-cotree splitting, domain |
| 314 |
decomposition, geometric multigrid, algebraic multigrid, etc.). For example, |
| 315 |
in @cite manges1995a it is suggested that the tree-cotree splitting can be used |
| 316 |
us a gauge. The hypre AMS utilizes a more modern approach @cite hypre1998b. It |
| 317 |
can solve positive semidefinite linear systems yielded by the ungauged curl-curl |
| 318 |
equation. In general, if a solver is able to choose one solution out of many |
| 319 |
ungauged solutions, we can claim that such solution is implicitly gauged by |
| 320 |
the linear solver. The linear solver will not communicate to us which gauge has |
| 321 |
been applied, i.e., the conservative part of the solution will be fixed, but we |
| 322 |
will not be able to tell what it is, exactly. We will call such gauge an |
| 323 |
implicit gauge. An implicit gauge is good enough for our purpose. |
| 324 |
|
| 325 |
We will use the CG solver which is the next best choice to the advanced linear |
| 326 |
solvers mentioned above. The CG solver is designed to handle symmetric positive |
| 327 |
definite matrices. This means that all eigenvalues of the system matrix are |
| 328 |
expected to be positive. On the other hand, the curl-curl equation above |
| 329 |
being augmented with proper boundary conditions will always yield a symmetric |
| 330 |
positive semidefinite matrix. The last means that most of the eigenvalues of |
| 331 |
the system matrix will be positive but some of them will be zero. We elevate |
| 332 |
the zero eigenvalues above zero just a bit by adding a very small gauging |
| 333 |
term, $\eta^2\vec{A}$, to the partial differential equation, |
| 334 |
\f[ |
| 335 |
\vec{\nabla}\times\bigg(\dfrac{1}{\mu} \vec{\nabla}\times\vec{A}\bigg) + |
| 336 |
\eta^2\vec{A} = \vec{J}_f, |
| 337 |
\f] |
| 338 |
so all eigenvalues become positive. Formally, the system matrix with |
| 339 |
elevated eigenvalues is symmetric positive definite. We can feed it to |
| 340 |
the CG solver. The partial differential equation is different now. We can |
| 341 |
expect a different solution. Moreover, $\eta^2 \vec{A}$ belongs to the |
| 342 |
$H(\text{curl})$ function space, while the rest of the terms of the partial |
| 343 |
differential equation belong to the $H(\text{div})$ function space, see the |
| 344 |
Bossavit's diagram below. They exhibit different behavior on interfaces |
| 345 |
between dissimilar materials. Strictly speaking, we destroy the compatibility |
| 346 |
between the two sides of the curl-curl equation by adding the gauging term. |
| 347 |
However, by choosing the parameter $\eta^2$ to be small enough we can make |
| 348 |
these horrible crimes insignificant. In practice, we need to set $\eta^2$ |
| 349 |
to zero. If the CG solver chokes, we will increase $\eta^2$ just a bit. Setting |
| 350 |
$\eta^2=\dfrac{10^{-6}}{\mu_0}$ can save the day. The $\eta^2$-trick is an |
| 351 |
implicit gauge: it helps the CG solver to select one solution out of many, |
| 352 |
but it is impossible to predict what the conservative part of the solution |
| 353 |
will look like. The last is not important for the problem we would like to |
| 354 |
solve because, as mentioned above, the vector potential $\vec{A}$ has no |
| 355 |
physical reality and all choices of a gauge (including the implicit gauge used here) |
| 356 |
lead to the same physical fields. |
| 357 |
|
| 358 |
<h5>Compatibility condition</h5> |
| 359 |
|
| 360 |
To solve the curl-curl equation numerically, we need to feed to the solver the |
| 361 |
right-hand side of the equation, $\vec{J}_f$. Whatever we do, we will end up |
| 362 |
feeding to the solver a discretized version of $\vec{J}_f$ which will be a |
| 363 |
combination of conservative and solenoidal vector fields even if the problem |
| 364 |
we would like to solve specifies a closed-form analytical expression of a purely |
| 365 |
solenoidal $\vec{J}_f$. The conservative component will be added implicitly by |
| 366 |
discretization. On the other hand, the left-hand side of the curl-curl equation |
| 367 |
is purely solenoidal as the curl of any vector field is always solenoidal |
| 368 |
(assume $\eta^2 = 0$ for a moment). Therefore, the two sides of the equation |
| 369 |
will be somewhat incompatible: pure solenoidal vector field on the left-hand |
| 370 |
side and a combination of a conservative and solenoidal vector fields on the |
| 371 |
right-hand side. As a consequence, we cannot expect that we can get the norm |
| 372 |
of the residual to zero. In other words, the linear solver cannot converge |
| 373 |
to a solution that has zero residual. In practice, this means that CG will |
| 374 |
either not converge at all, or terminate only after an unreasonably large |
| 375 |
number of iterations. To make the two sides of the equation compatible, we derive |
| 376 |
the free-current density from a current vector potential, $\vec{T}$, as |
| 377 |
\f[ |
| 378 |
\vec{J}_f = \vec{\nabla}\times\vec{T}. |
| 379 |
\f] |
| 380 |
Consequently, the curl-curl equation becomes |
| 381 |
\f[ |
| 382 |
\vec{\nabla}\times\bigg(\dfrac{1}{\mu} \vec{\nabla}\times\vec{A}\bigg) + |
| 383 |
\eta^2\vec{A} = \vec{\nabla}\times\vec{T}. |
| 384 |
\f] |
| 385 |
This equation contains purely solenoidal vector fields on both sides if $\eta^2=0$. |
| 386 |
Now, however, we need to convert $\vec{J}_f$ into $\vec{T}$. There are a number |
| 387 |
of ways of doing so. One of them is solving another curl-curl equation as |
| 388 |
discussed below. For now we assume that $\vec{T}$ is known. |
| 389 |
|
| 390 |
<h5>Boundary and interface conditions</h5> |
| 391 |
|
| 392 |
Even if the magnetic vector potential is gauged and the compatibility issue |
| 393 |
is solved, one still needs to set up the boundary conditions to pick up one |
| 394 |
solution out of many gauged vector potentials that satisfy the curl-curl |
| 395 |
equation. Moreover, the behavior of the magnetic field on interfaces between |
| 396 |
dissimilar materials is defined by the Maxwell's equations. Consequently, the |
| 397 |
behavior of the magnetic vector potential on interfaces is defined by the |
| 398 |
Maxwell's equations as well. For this reason, we need to add the interface |
| 399 |
conditions next to the boundary conditions to ensure the correct behavior of |
| 400 |
the current vector potential on interfaces. The curl-curl partial differential |
| 401 |
equation augmented with the boundary and interface conditions constitutes the |
| 402 |
boundary value problem. We compose the following boundary value problem for the |
| 403 |
problem discussed above: |
| 404 |
|
| 405 |
\f{equation}{ |
| 406 |
\begin{array}{lrcll} |
| 407 |
\text{ } & \vec{\nabla}\times\bigg(\dfrac{1}{\mu} \vec{\nabla}\times\vec{A}\bigg) |
| 408 |
+ \eta^2 \vec{A} = \vec{\nabla}\times\vec{T} & \text{in} & \Omega & \text{(i)},\\ |
| 409 |
\text{(n)}& \dfrac{1}{\mu}\hat{n}\times\bigg(\vec{\nabla}\times\vec{A}\bigg) + |
| 410 |
\gamma \hat{n}\times\bigg(\hat{n}\times\vec{A}\bigg) |
| 411 |
=0 &\text{on} & \Gamma_{R1} & \text{(ii)}, \\ |
| 412 |
\text{(e)}&\hat{n}\times\vec{A}_{+} = |
| 413 |
\hat{n}\times\vec{A}_{-}&\text{on}&\Gamma_{I1}\cup\Gamma_{I2}&\text{(iii)},\\ |
| 414 |
\text{(n)}&\dfrac{1}{\mu}_{+}\hat{n}\times \bigg( \vec{\nabla} \times \vec{A}_{+} \bigg) - |
| 415 |
\dfrac{1}{\mu}_{-}\hat{n}\times \bigg( \vec{\nabla} \times \vec{A}_{-} \bigg) = 0 |
| 416 |
& \text{on} & \Gamma_{I1}\cup\Gamma_{I2} & \text{(iv)}, |
| 417 |
\end{array} |
| 418 |
\f} |
| 419 |
where |
| 420 |
\f[ |
| 421 |
\gamma = \frac{1}{\mu r}. |
| 422 |
\f] |
| 423 |
In this boundary value problem the vector $\hat{n}$ is the unit vector normal |
| 424 |
to the surface on which the boundary or interface condition is defined. By |
| 425 |
convention, $\hat{n}$ always points outside a closed surface. The subscript |
| 426 |
"+" refers to the space immediately next to the interface in the direction |
| 427 |
of vector $\hat{n}$. The subscript "-" refers to the space immediately next |
| 428 |
to the interface in the direction opposite to $\hat{n}$. |
| 429 |
|
| 430 |
Equation (i) in the boundary value problem has been discussed above and needs |
| 431 |
no further comments. |
| 432 |
|
| 433 |
The surface $\Gamma_{R1}$ represents infinity. As most problems in magnetics, |
| 434 |
the problem we would like to solve is unbounded. That is to say, the magnetic |
| 435 |
field as well as the magnetic vector potential extend to infinity. A |
| 436 |
straightforward modeling of an unbounded domain by means of finite elements is |
| 437 |
impossible as such modeling will require an infinite amount of cells. To |
| 438 |
overcome this unfortunate predicament, we artificially truncate the unbounded |
| 439 |
problem domain with the surface $\Gamma_{R1}$. This truncation will introduce a |
| 440 |
simulation error. We, however, will try to minimize this error by making the |
| 441 |
interior of the artificial surface $\Gamma_{R1}$ as spacious as possible. |
| 442 |
The magnetic field induced by the coil vanishes at infinity, so does the |
| 443 |
magnetic vector potential. For this reason, the homogeneous Dirichlet, |
| 444 |
\f{equation}{ |
| 445 |
\begin{array}{ll} |
| 446 |
\hat{n} \times \vec{A} = 0 & \text{(Dirichlet)}, |
| 447 |
\end{array} |
| 448 |
\f} |
| 449 |
and homogeneous Neumann, |
| 450 |
\f{equation}{ |
| 451 |
\begin{array}{ll} |
| 452 |
\dfrac{1}{\mu}\hat{n}\times\bigg(\vec{\nabla}\times\vec{A}\bigg) = 0 & |
| 453 |
\text{(Neumann)}, |
| 454 |
\end{array} |
| 455 |
\f} |
| 456 |
boundary conditions are used on $\Gamma_{R1}$ most often. For this approach to be |
| 457 |
efficient, one needs to choose the radius of the sphere $\Gamma_{R1}$ large enough so that |
| 458 |
the tangential component of the magnetic vector potential (Dirichlet) or the |
| 459 |
tangential component of the magnetic field (Neumann) is negligibly small on |
| 460 |
$\Gamma_{R1}$. There is, however, a more efficient approach. |
| 461 |
|
| 462 |
The first term of the multipole expansion of magnetic vector potential is |
| 463 |
the magnetic vector potential of a magnetic dipole moment unless the source |
| 464 |
of the magnetic field is explicitly configured as a higher-order multipole. |
| 465 |
For this reason, the magnetic vector potential induced by the coil looks more |
| 466 |
like that of a magnetic dipole at a sufficient distance. If a magnetic dipole |
| 467 |
is placed at the center of a sphere, the magnetic vector potential induced by |
| 468 |
the dipole on the sphere satisfies the following identity: |
| 469 |
|
| 470 |
\f[ |
| 471 |
\hat{n} \times \bigg( \vec{\nabla}\times \vec{A} \bigg) = - \frac{1}{r} |
| 472 |
\hat{n} \times \bigg( \hat{n} \times \vec{A} \bigg). |
| 473 |
\f] |
| 474 |
|
| 475 |
Note that this is a purely geometric statement. It does not depend on how we |
| 476 |
choose our coordinate system. Consequently, the identity given by the last |
| 477 |
equation is true for a magnetic dipole of any orientation as long as it is |
| 478 |
situated at the center of the sphere. By multiplying the last equation by |
| 479 |
$\dfrac{1}{\mu}$ and rearranging the terms we arrive into |
| 480 |
|
| 481 |
\f{equation}{ |
| 482 |
\begin{array}{ll} |
| 483 |
\dfrac{1}{\mu}\hat{n}\times\bigg(\vec{\nabla}\times\vec{A}\bigg) + |
| 484 |
\dfrac{1}{\mu r}\hat{n}\times\bigg(\hat{n}\times\vec{A}\bigg) |
| 485 |
=0 & \text{(Robin)}, |
| 486 |
\end{array} |
| 487 |
\f} |
| 488 |
which is, essentially, the Robin boundary condition (ii) in the boundary value |
| 489 |
problem above. The Robin boundary condition in the current context is also called |
| 490 |
the first-order asymptotic boundary condition, first-order ABC for short. |
| 491 |
The Robin boundary condition is expected to be superior to both Dirichlet and |
| 492 |
Neumann boundary conditions as it allows to reach the same level of simulation |
| 493 |
error with a sphere $\Gamma_{R1}$ of a smaller radius. |
| 494 |
|
| 495 |
All three boundary conditions, Dirichlet, Neumann, and Robin, guarantee the |
| 496 |
uniqueness of the curl of the solution, $\vec{\nabla}\times\vec{A}$. The |
| 497 |
uniqueness of the solution itself, $\vec{A}$, can only be guaranteed if |
| 498 |
one of the boundary conditions is applied in combination with a gauge, see the |
| 499 |
discussion above. The program uses the Robin boundary condition by default, |
| 500 |
but can easily be switched to Dirichlet or Robin boundary conditions. |
| 501 |
|
| 502 |
The behavior of the magnetic field on the interfaces between dissimilar |
| 503 |
materials can be described by |
| 504 |
\f{equation}{ |
| 505 |
\begin{array}{ll} |
| 506 |
\hat{n}\cdot\vec{B}_+ = \hat{n}\cdot\vec{B}_- ,\\ |
| 507 |
\hat{n}\times\vec{H}_+ - \hat{n}\times\vec{H}_- = \vec{K}_f, |
| 508 |
\end{array} |
| 509 |
\f} |
| 510 |
where $\vec{K}_f$ is a surface free-current density that can be present on an |
| 511 |
interface. No free currents flow on the surface of the magnetic core of the coil |
| 512 |
described above. Therefore, we set $\vec{K}_f = 0$. Then by substituting the |
| 513 |
constitutive relation for the magnetic field and the definition of the magnetic |
| 514 |
vector potential, see above, into the last two equations we get |
| 515 |
\f{equation}{ |
| 516 |
\begin{array}{ll} |
| 517 |
\hat{n}\cdot\bigg(\vec{\nabla}\times\vec{A}_+\bigg) = |
| 518 |
\hat{n}\cdot\bigg(\vec{\nabla}\times\vec{A}_-\bigg) &\text{(condition A)},\\ |
| 519 |
\hat{n}\times\bigg(\dfrac{1}{\mu_+}\vec{\nabla}\times\vec{A}_+\bigg) - |
| 520 |
\hat{n}\times\bigg(\dfrac{1}{\mu_-}\vec{\nabla}\times\vec{A}_-\bigg) = 0. |
| 521 |
\end{array} |
| 522 |
\f} |
| 523 |
Next, we simply replace the first condition with another condition |
| 524 |
and rearrange the terms of the second condition: |
| 525 |
\f{equation}{ |
| 526 |
\begin{array}{ll} |
| 527 |
\hat{n}\times\vec{A}_+ = \hat{n}\times\vec{A}_- & \text{(condition B)}, \\ |
| 528 |
\dfrac{1}{\mu_+}\hat{n}\times\bigg(\vec{\nabla}\times\vec{A}_+\bigg) - |
| 529 |
\dfrac{1}{\mu_-}\hat{n}\times\bigg(\vec{\nabla}\times\vec{A}_-\bigg) = 0, |
| 530 |
\end{array} |
| 531 |
\f} |
| 532 |
The last two equations are identical to equations (iii) and (iv) in the boundary |
| 533 |
value problem above. These are the interface conditions that must be observed on |
| 534 |
the inner and outer surfaces of the magnetic core, $\Gamma_{I1}\cup\Gamma_{I2}$. |
| 535 |
|
| 536 |
We have replaced condition A with condition B. This replacement deserves an |
| 537 |
explanation. The are two reasons for this replacement. The first reason is the |
| 538 |
following. A magnetic flux through an infinitesimally small closed loop must be |
| 539 |
infinitesimally small even if an interface between dissimilar magnetic materials |
| 540 |
passes through the loop. We can guarantee this only if we require that |
| 541 |
condition B holds. Condition A will not do. The second reason is the |
| 542 |
uniqueness of the curl of the solution. If we include condition A into the |
| 543 |
boundary value problem above, the uniqueness of the curl of the solution, |
| 544 |
$\vec{\nabla}\times\vec{A}$, cannot be guaranteed. It is possible |
| 545 |
to guarantee it if condition B is included instead. A good question is: |
| 546 |
does this replacement disturb the behavior of the magnetic field on the |
| 547 |
interfaces? Not at all. Consider the following. The normal component |
| 548 |
of the curl, $\hat{n}\cdot\big(\vec{\nabla}\times\vec{A}\big)$, is defined by |
| 549 |
the derivatives of the tangential components of the vector potential. If two |
| 550 |
vector potentials, $\vec{A}_-$ and $\vec{A}_+$, have the same tangential |
| 551 |
components on the interface, i.e., condition B, the derivatives of these |
| 552 |
tangential components along the interface will be the same as well. Therefore, |
| 553 |
condition B implicitly implies condition A and, thus, the replacement is |
| 554 |
justified. We can conclude that condition B is more restrictive than |
| 555 |
condition A, so the behavior of the magnetic vector potential on the |
| 556 |
interfaces is observed. Note, that the interface conditions (iii) and (iv) |
| 557 |
in the boundary value problem above have absolutely no influence on the |
| 558 |
uniqueness of the solution regardless which boundary condition, Dirichlet, |
| 559 |
Neumann, or Robin, is used. |
| 560 |
|
| 561 |
It remains to comment on the labels (e) and (n) in the boundary value problem |
| 562 |
above. They label (e)ssential and (n)atural boundary and interface conditions. |
| 563 |
How to sort conditions in these two categories and why it is important to do |
| 564 |
so is discussed below in the section on variational formulations. |
| 565 |
|
| 566 |
<h4>Current vector potential - T</h4> |
| 567 |
|
| 568 |
To be able to solve the boundary value problem above, we need to convert the |
| 569 |
free current density, $\vec{J}_f$, into current vector potential, $\vec{T}$. We |
| 570 |
define the current vector potential as |
| 571 |
\f[ |
| 572 |
\vec{J}_f = \vec{\nabla}\times\vec{T}. |
| 573 |
\f] |
| 574 |
|
| 575 |
By taking the curl of the last equation and rearranging the terms we arrive into |
| 576 |
|
| 577 |
\f[ |
| 578 |
\vec{\nabla}\times\bigg(\vec{\nabla}\times\vec{T}\bigg) |
| 579 |
= \vec{\nabla}\times\vec{J}_f. |
| 580 |
\f] |
| 581 |
We will compute the current vector potential by solving this equation. As soon |
| 582 |
as there are curls of vector fields on both sides of the equation, the |
| 583 |
compatibility condition is observed. We add to this equation a gauging term, |
| 584 |
\f[ |
| 585 |
\vec{\nabla}\times\bigg(\vec{\nabla}\times\vec{T}\bigg) + \eta^2 \vec{T} |
| 586 |
= \vec{\nabla}\times\vec{J}_f. |
| 587 |
\f] |
| 588 |
The discussion on the gauging term in the preceding section is valid in the |
| 589 |
current context as well. |
| 590 |
|
| 591 |
The current vector potential is computed in free space, i.e., $\mu = \mu_0$ |
| 592 |
everywhere. For this reason, there is no need for interface conditions as |
| 593 |
there are no interfaces in free space. |
| 594 |
|
| 595 |
We still need to apply a boundary condition to the surface $\Gamma_{R1}$. |
| 596 |
It is beneficial to apply the homogeneous Dirichlet boundary condition as it |
| 597 |
allows to nullify the integral $I_{b3-2}$ in the recipe for calculating the |
| 598 |
magnetic vector potential, see below. Consequently, we can neglect this |
| 599 |
integral when programming and this makes the code more efficient. |
| 600 |
|
| 601 |
We compose a boundary value problem by combining the curl-curl equation for |
| 602 |
the current vector potential with the Dirichlet boundary condition: |
| 603 |
|
| 604 |
\f{equation}{ |
| 605 |
\begin{array}{lrcll} |
| 606 |
\text{ } & \vec{\nabla}\times\bigg(\vec{\nabla}\times\vec{T}\bigg) |
| 607 |
+ \eta^2 \vec{T} = \vec{\nabla}\times\vec{J}_f & \text{in} & \Omega & |
| 608 |
\text{(i)},\\ |
| 609 |
\text{(e)}& \hat{n}\times\vec{T} = 0 &\text{on} & \Gamma_{R1} & \text{(ii)}. |
| 610 |
\end{array} |
| 611 |
\f} |
| 612 |
|
| 613 |
<h3>Variational formulations</h3> |
| 614 |
|
| 615 |
<h4>Magnetic vector potential</h4> |
| 616 |
|
| 617 |
The problem of solving the boundary value problem for the magnetic vector |
| 618 |
potential can be replaced by the problem of minimizing the following |
| 619 |
functional: |
| 620 |
\f{equation}{ |
| 621 |
\begin{aligned} |
| 622 |
&F(\vec{A}) = |
| 623 |
\iiint_{\Omega}\frac{1}{\mu}\bigg|\vec{\nabla}\times\vec{A}\bigg|^2 dV + |
| 624 |
\iint_{\Gamma_{R1}} \gamma \bigg|\hat{n}\times\vec{A}\bigg|^2 dS + |
| 625 |
\eta^2 \iiint_{\Omega}\mid\vec{A}\mid^2 dV |
| 626 |
-2\iiint_{\Omega} \vec{T} \cdot \bigg( \vec{\nabla} \times\vec{A} \bigg) dV |
| 627 |
+2\iint_{\Gamma_{R1}} \vec{T} \cdot \bigg(\hat{n}\times\vec{A}\bigg) dS. |
| 628 |
\end{aligned} |
| 629 |
\f} |
| 630 |
Any magnetic vector potential that minimizes this functional will satisfy |
| 631 |
the curl-curl equation (i), the boundary condition (ii) and the interface |
| 632 |
condition (iv). On the other hand, this functional is invariant to the |
| 633 |
interface condition (iii). This can be verified as follows: The |
| 634 |
first variation of the functional at the minimum vanishes, |
| 635 |
\f[ |
| 636 |
\delta F(\vec{A}) = 0. |
| 637 |
\f] |
| 638 |
We can express the first variation and deduce that the identities given by |
| 639 |
equations (i), (ii), and (iv) in the boundary value problem must be satisfied |
| 640 |
for the last equation to be true. The interface condition (iii), however, |
| 641 |
is not needed for the last equation to be satisfied. The boundary and |
| 642 |
interface conditions that are needed to drive the first variation of the |
| 643 |
functional to zero are called natural and are labeled by (n) in the boundary |
| 644 |
value problem. If a condition is not natural, it is essential. We label |
| 645 |
essential conditions by (e). |
| 646 |
|
| 647 |
The natural conditions are enforced by minimization of the functional. The |
| 648 |
essential boundary and interface conditions must be enforced by other means. |
| 649 |
The interface condition (iii) in the boundary value problem above is enforced |
| 650 |
by choosing the finite elements wisely. The FE_Nedelec finite elements ensure |
| 651 |
continuity of the tangential component of the vector field they model on the |
| 652 |
faces of the cells. Therefore, if we construct the mesh such that all interfaces |
| 653 |
are made of cell faces, i.e., no interface runs through a cell, and choose the |
| 654 |
FE_Nedelec finite elements to model the magnetic vector potential, the |
| 655 |
interface condition (iii) will be enforced automatically. The Dirichlet boundary |
| 656 |
condition is essential. It is enforced by constraining the degrees of freedom |
| 657 |
in the system of linear equations. This can be done by invoking the deal.II |
| 658 |
function VectorTools::project_boundary_values_curl_conforming_l2(). The other |
| 659 |
two boundary conditions, Neumann and Robin, are natural. |
| 660 |
|
| 661 |
Note that the homogeneous Neumann boundary condition is embedded into the |
| 662 |
first integral of the functional. This integral is present in all functionals |
| 663 |
related to the curl-curl equation, even in the most minimalistic ones. |
| 664 |
Therefore, application of no boundary condition is quite impossible: the |
| 665 |
homogeneous Neumann boundary condition, |
| 666 |
\f[ |
| 667 |
\frac{1}{\mu}\hat{n}\times\bigg(\vec{\nabla}\times\vec{A}\bigg) = 0, |
| 668 |
\f] |
| 669 |
will be applied implicitly by default as a result of the functional |
| 670 |
minimization. |
| 671 |
|
| 672 |
We can switch between the three boundary conditions as the following. |
| 673 |
- The functional above as it is corresponds to a boundary value problem with |
| 674 |
Robin boundary condition, i.e., the boundary value problem given above. |
| 675 |
- To switch to Neumann boundary condition, we need to discard the second |
| 676 |
integral from the functional. Such functional will correspond to the boundary |
| 677 |
value problem above with equation (ii) replaced by the Neumann boundary |
| 678 |
condition. |
| 679 |
- To switch to Dirichlet boundary condition, we use the functional with |
| 680 |
discarded second integral and use |
| 681 |
VectorTools::project_boundary_values_curl_conforming_l2() to constrain the |
| 682 |
system of linear equations. Such configuration will correspond to the |
| 683 |
boundary value problem above with equation (ii) replaced by the Dirichlet |
| 684 |
boundary condition. |
| 685 |
|
| 686 |
In general, we need to sort all boundary and interface conditions into two |
| 687 |
categories, natural and essential. The reason for doing so is simple: we need to |
| 688 |
know which conditions are not taken care of by the functional (the essential |
| 689 |
conditions), so we can take care of them by other means (choice of finite |
| 690 |
elements, restricting dofs). Interrogating the first variation of the functional |
| 691 |
as discussed above is a common method of sorting the conditions. A more detailed |
| 692 |
discussion on boundary conditions can be found in step-22. |
| 693 |
(@dealiiVideoLectureSeeAlso{21.5,21.55,21.6,21.65}) |
| 694 |
|
| 695 |
Next, we need to convert the functional above into a numerical recipe that can |
| 696 |
be programmed into a computer. To do so, we note that the final result, i.e., the |
| 697 |
magnetic vector potential computed by the finite element method, is represented |
| 698 |
as a sum, |
| 699 |
\f[ |
| 700 |
\vec{A}(\vec{r}) = \sum_{j=0}^{m-1} c_j \vec{N}_j(\vec{r}), |
| 701 |
\f] |
| 702 |
where $c_j$ are the degrees of freedom and $\vec{N}_j$ are the vector-valued |
| 703 |
shape functions of the FE_Nedelec finite elements. We convert the functional into a |
| 704 |
multivariate function by substituting the last equation into the functional, |
| 705 |
\f[ |
| 706 |
f(c_0, c_1, ..., c_{m-1}) = F\bigg(\sum_{j=0}^{m-1} c_j \vec{N}_j\bigg). |
| 707 |
\f] |
| 708 |
Then we compose the system of linear equations by computing the partial |
| 709 |
derivatives of the multivariate function: |
| 710 |
\f{equation}{ |
| 711 |
\begin{array}{lr} |
| 712 |
\dfrac{\partial}{\partial c_0} f(c_0, c_1, ..., c_{m-1})& = 0, \\ |
| 713 |
\dfrac{\partial}{\partial c_1} f(c_0, c_1, ..., c_{m-1})& = 0, \\ |
| 714 |
... & \\ |
| 715 |
\dfrac{\partial}{\partial c_{m-1}} f(c_0, c_1, ..., c_{m-1})& = 0. |
| 716 |
\end{array} |
| 717 |
\f} |
| 718 |
|
| 719 |
This system of linear equations can be written in matrix form as |
| 720 |
\f[ |
| 721 |
\boldsymbol{A} \boldsymbol{c} = \boldsymbol{b}, |
| 722 |
\f] |
| 723 |
where $\boldsymbol{c}$ is a column vector filled with the degrees of freedom, |
| 724 |
\f[ |
| 725 |
\boldsymbol{c} = [c_0, c_1, ... c_{m-1}]^T. |
| 726 |
\f] |
| 727 |
The system matrix and the right-hand side column vector are computed as |
| 728 |
\f{equation}{ |
| 729 |
\begin{aligned} |
| 730 |
& A_{ij} = |
| 731 |
\underbrace{\iiint_{\Omega}\frac{1}{\mu} |
| 732 |
\bigg(\vec{\nabla}\times\vec{N}_i\bigg) \cdot |
| 733 |
\bigg(\vec{\nabla}\times\vec{N}_j\bigg) dV}_{I_{a1}} |
| 734 |
+ |
| 735 |
\underbrace{\iint_{\Gamma_{R1}} \gamma |
| 736 |
\bigg(\hat{n}\times \vec{N}_i \bigg) \cdot |
| 737 |
\bigg(\hat{n}\times \vec{N}_j \bigg) dS}_{I_{a2}} |
| 738 |
+ |
| 739 |
\underbrace{\eta^2\iiint_{\Omega} \vec{N}_i \cdot \vec{N}_j dV}_{I_{a3}} |
| 740 |
\end{aligned} |
| 741 |
\f} |
| 742 |
and |
| 743 |
\f{equation}{ |
| 744 |
b_i = |
| 745 |
\underbrace{\iiint_{\Omega}\vec{T}\cdot\bigg(\vec{\nabla}\times\vec{N}_i\bigg) dV |
| 746 |
}_{I_{b3-1}} - |
| 747 |
\underbrace{\iint_{\Gamma_{R1}}\vec{T}\cdot\bigg(\hat{n}\times\vec{N}_i\bigg)dS |
| 748 |
}_{I_{b3-2} = 0}. |
| 749 |
\f} |
| 750 |
The last two equations are implemented by the computer code. The integral $I_{b3-2}$ |
| 751 |
equals zero as the tangential component of the current vector potential, |
| 752 |
$\hat{n} \times \vec{T}$, is forced to zero on the boundary $\Gamma_{R1}$ by |
| 753 |
the Dirichlet boundary condition. We will neglect this integral in the computer |
| 754 |
code. |
| 755 |
|
| 756 |
<h4>Current vector potential</h4> |
| 757 |
|
| 758 |
The problem of solving the boundary value problem |
| 759 |
for the current vector potential can be replaced by the problem of minimizing |
| 760 |
the following functional: |
| 761 |
\f{equation}{ |
| 762 |
\begin{aligned} |
| 763 |
&F(\vec{T}) = |
| 764 |
\iiint_{\Omega}\bigg|\vec{\nabla}\times\vec{T}\bigg|^2 dV |
| 765 |
+ \eta^2 \iiint_{\Omega}\mid\vec{T}\mid^2 dV |
| 766 |
-2\iiint_{\Omega} \vec{J}_f \cdot \bigg( \vec{\nabla} \times\vec{T} \bigg) dV |
| 767 |
+2\iint_{\Gamma_{R1}} \vec{J}_f \cdot \bigg(\hat{n}\times\vec{T}\bigg) dS, |
| 768 |
\end{aligned} |
| 769 |
\f} |
| 770 |
and constraining the system of linear equations with a help of |
| 771 |
VectorTools::project_boundary_values_curl_conforming_l2(). |
| 772 |
|
| 773 |
This functional is minimized by solving a system of linear equations with the |
| 774 |
following system matrix and right-hand side column vector: |
| 775 |
\f{equation}{ |
| 776 |
\begin{aligned} |
| 777 |
& A_{ij} = |
| 778 |
\underbrace{\iiint_{\Omega} |
| 779 |
\bigg(\vec{\nabla}\times\vec{N}_i\bigg) \cdot |
| 780 |
\bigg(\vec{\nabla}\times\vec{N}_j\bigg) dV}_{I_{a1}} |
| 781 |
+ |
| 782 |
\underbrace{\eta^2\iiint_{\Omega} \vec{N}_i \cdot \vec{N}_j dV}_{I_{a3}}, |
| 783 |
\end{aligned} |
| 784 |
\f} |
| 785 |
|
| 786 |
\f{equation}{ |
| 787 |
b_i = |
| 788 |
\underbrace{\iiint_{\Omega}\vec{J}_f\cdot\bigg(\vec{\nabla}\times\vec{N}_i\bigg) dV |
| 789 |
}_{I_{b3-1}} - |
| 790 |
\underbrace{\iint_{\Gamma_{R1}}\vec{J}_f\cdot\bigg(\hat{n}\times\vec{N}_i\bigg)dS |
| 791 |
}_{I_{b3-2}=0}. |
| 792 |
\f} |
| 793 |
Here again, the integral $I_{b3-2}$ equals zero as the free-current density, |
| 794 |
$\vec{J}_f$, equals zero at the boundary $\Gamma_{R1}$ by definition of the |
| 795 |
problem. We will neglect this integral in the computer code. |
| 796 |
|
| 797 |
<h4>Converting potentials into fields</h4> |
| 798 |
|
| 799 |
As discussed above, we are interested in the magnetic field induced by the coil. |
| 800 |
For this reason, we convert the numerically computed vector potential into magnetic |
| 801 |
field as |
| 802 |
\f[ |
| 803 |
\vec{B} = \vec{\nabla} \times \vec{A}. |
| 804 |
\f] |
| 805 |
The problem of computing this equation can be replaced by the problem of |
| 806 |
minimizing the following functional: |
| 807 |
\f[ |
| 808 |
F(\vec{B}) = \iiint_{\Omega} \big| \vec{B} \big|^2 dV - |
| 809 |
2 \iiint_{\Omega} \bigg( \vec{\nabla} \times \vec{A} \bigg) \cdot \vec{B} dV. |
| 810 |
\f] |
| 811 |
This functional is minimized by solving a system of linear equations with the |
| 812 |
system matrix |
| 813 |
\f[ |
| 814 |
A_{ij} = \underbrace{\iiint_{\Omega} \vec{N}_i \cdot \vec{N}_j dV}_{I_a} |
| 815 |
\f] |
| 816 |
and right-hand side column vector |
| 817 |
\f[ |
| 818 |
b_i = \underbrace{\iiint_{\Omega} \bigg( \vec{\nabla} \times \vec{A} \bigg) |
| 819 |
\cdot \vec{N}_i dS}_{I_b}. |
| 820 |
\f] |
| 821 |
This time, however, $\vec{N}_i$ are the shape functions of the FE_RaviartThomas |
| 822 |
finite elements. The vector field $\vec{A}$ in the last equation is the numerically |
| 823 |
computed magnetic vector potential, i.e., a linear combination of the shape |
| 824 |
functions of the FE_Nedelec finite elements. |
| 825 |
|
| 826 |
It is informative to verify the quality of the computed current vector potential, |
| 827 |
$\vec{T}$. We can do this by converting it back into the free-current |
| 828 |
density, $\vec{J}_f$, and comparing the result to the closed-form analytical |
| 829 |
expression given by the definition of the problem, see above. The current vector |
| 830 |
potential relates to the free-current density as |
| 831 |
\f[ |
| 832 |
\vec{J}_f = \vec{\nabla} \times \vec{T}. |
| 833 |
\f] |
| 834 |
This equation is, essentially, the same as the equation for converting |
| 835 |
$\vec{A}$ into $\vec{B}$, see the first equation of this section. Consequently, |
| 836 |
we can simply adapt the equations for the functional, system matrix, and the |
| 837 |
right-hand side given above by making the following substitutions: |
| 838 |
\f{equation}{ |
| 839 |
\begin{array}{lcr} |
| 840 |
\vec{A} \rightarrow \vec{T} &\text{ and }& \vec{B} \rightarrow \vec{J}_f. |
| 841 |
\end{array} |
| 842 |
\f} |
| 843 |
|
| 844 |
The two conversions, $\vec{A}$ into $\vec{B}$ and $\vec{T}$ into $\vec{J}_f$, |
| 845 |
can be done by the same piece of code. We will call it a projector from |
| 846 |
$H(\text{curl})$ to $H(\text{div})$. |
| 847 |
|
| 848 |
<h3>Selecting finite elements</h3> |
| 849 |
|
| 850 |
The preceding sections leave an impression that we are going to model $\vec{A}$ |
| 851 |
and $\vec{T}$ by the FE_Nedelec finite elements, while $\vec{B}$ and $\vec{J}_f$ |
| 852 |
by the FE_RaviartThomas finite elements. It makes sense to discuss how this |
| 853 |
kind of choice can be made. |
| 854 |
|
| 855 |
The simplest method of assigning a particular type of finite elements to a |
| 856 |
physical quantity studied in electromagnetics is a contemplation of the Bossavit's |
| 857 |
diagram. It is presented below. The Bossavit's diagram describes the relations |
| 858 |
between physical quantities as they are given by Maxwell's equations and |
| 859 |
constitutive relations. Most equations derived from Maxwell's equations |
| 860 |
can be captured by this diagram. |
| 861 |
|
| 862 |
@htmlonly |
| 863 |
<p align="center"> |
| 864 |
<img src="https://www.dealii.org/images/steps/developer/step-97-diagram.svg" alt="The Bossavit's diagram" height="283"> |
| 865 |
</p> |
| 866 |
@endhtmlonly |
| 867 |
|
| 868 |
Let us consider assigning the correct type of finite elements to the magnetic |
| 869 |
vector potential, $\vec{A}$. First, we contemplate the Bossavit's diagram and |
| 870 |
observe that $\vec{A}$ belongs to the $H(\text{curl})$ function space. Second, |
| 871 |
we look at the table below and conclude that the physical quantities that belong |
| 872 |
to the $H(\text{curl})$ function space are modeled by the FE_Nedelec finite |
| 873 |
elements. Therefore, we need to model the magnetic vector potential, $\vec{A}$, |
| 874 |
by the FE_Nedelec finite elements. The same assigning procedure can be applied |
| 875 |
to the rest of the physical quantities, $\vec{B}$, $\vec{T}$, and $\vec{J}_f$. |
| 876 |
|
| 877 |
|Funct. space |Finite elements | |
| 878 |
|-----------------|-------------------| |
| 879 |
|$H(\text{grad})$ | FE_Q | |
| 880 |
|$H(\text{curl})$ | FE_Nedelec | |
| 881 |
|$H(\text{div})$ | FE_RaviartThomas | |
| 882 |
|$L^2$ | FE_DGQ | |
| 883 |
|
| 884 |
Alternatively, one of the types of the finite elements listed in the table can |
| 885 |
be assigned to a physical quantity by considering the behavior of the physical |
| 886 |
quantity on the interfaces between dissimilar materials. Let us consider the |
| 887 |
magnetic field $\vec{B}$ as an example. The normal component of the magnetic |
| 888 |
field is continuous on interfaces. On the contrary, the tangential component is |
| 889 |
discontinuous, see the first figure on this page. This type of behavior can be |
| 890 |
modeled by the FE_RaviartThomas finite elements as they guarantee the continuity |
| 891 |
of the normal component of the vector field on the faces of mesh cells. |
| 892 |
|
| 893 |
<h3>Mesh</h3> |
| 894 |
|
| 895 |
The mesh is, essentially, a discretization of the problem domain shown above. |
| 896 |
The mesh is constructed such that all spherical surfaces of the problem domain |
| 897 |
are delineated by cell faces. That is, no spherical surface runs through a mesh |
| 898 |
cell. The figure below illustrates the mesh. The main elements of the mesh are |
| 899 |
listed below. |
| 900 |
|
| 901 |
- The cube with a side of $2d_1$ in the middle of the mesh. The purpose of |
| 902 |
this cube is instrumental. This is the only way to construct a mesh that has |
| 903 |
spherical interfaces and contains no tetrahedral cells as the cells around the |
| 904 |
origin must be hexahedral. |
| 905 |
- The spherical shell nr.1. This shell represents the magnetic core. The |
| 906 |
permeability of this region is $\mu_1$. The permeability outside this region |
| 907 |
is $\mu_0$. |
| 908 |
- The spherical shell nr.2. This region contains the free current. There is no |
| 909 |
free current outside this region. |
| 910 |
- Sphere nr.1. The $L^2$ error norms are computed inside the region delineated |
| 911 |
by this surface. |
| 912 |
- Sphere nr.2. The boundary of the problem domain. Represents infinity. The |
| 913 |
boundary condition is applied to this surface. |
| 914 |
|
| 915 |
The program uses four meshes created with a help of gmsh. Each mesh has a |
| 916 |
different degree of refinement. The degree of refinement in each mesh is |
| 917 |
defined by a number of mesh nodes on the transfinite lines, $r$. The figure |
| 918 |
below illustrates a mesh with $r=5$. The program uses four meshes with the |
| 919 |
amount of nodes on the transfinite lines in the interval $r = [6, 9]$. |
| 920 |
|
| 921 |
Note that this tutorial uses only globally refined meshes. There are no |
| 922 |
non-conforming cells, hanging nodes, and hanging node constrains in this |
| 923 |
tutorial. We will use constrains only for the purpose of enforcing the |
| 924 |
Dirichlet boundary condition. |
| 925 |
|
| 926 |
@htmlonly |
| 927 |
<p align="center"> |
| 928 |
<img src="https://www.dealii.org/images/steps/developer/step-97-mesh.svg" alt="The mesh" height="531"> |
| 929 |
</p> |
| 930 |
@endhtmlonly |
| 931 |
|
| 932 |
<h3>Overview of the program</h3> |
| 933 |
|
| 934 |
The program runs in a loop. In each iteration of the loop a different parameter |
| 935 |
$r$ (the mesh refinement parameter, i.e., the amount of nodes on transfinite |
| 936 |
lines) is assumed. Each iteration consists of four stages: |
| 937 |
|
| 938 |
- The current vector potential, $\vec{T}$, is computed given the closed-form |
| 939 |
analytical expression for the free-current density, $\vec{J}_f$, see above. |
| 940 |
No error norms are computed. The mesh is loaded at this stage. This mesh is |
| 941 |
simply reused at all other stages. |
| 942 |
- The current vector potential computed at the preceding stage, $\vec{T}$, is |
| 943 |
converted numerically back into free-current density, $\vec{J}_f$, for |
| 944 |
verification. The $L^2$ error norm is computed by comparing the numerical |
| 945 |
result with the closed-form analytical expression. The $L^2$ error norm is |
| 946 |
saved in a convergence table `table_Jf`. |
| 947 |
- The magnetic vector potential, $\vec{A}$, is computed given the current vector |
| 948 |
potential computed at the first stage, $\vec{T}$. No error norms are computed |
| 949 |
at this stage. |
| 950 |
- The magnetic vector potential computed at the preceding stage, $\vec{A}$, is |
| 951 |
converted into magnetic field, $\vec{B}$. The $L^2$ norm is computed by |
| 952 |
comparing the numerical result with the closed-form analytical solution. The |
| 953 |
$L^2$ error norm is saved in a convergence table `table_B`. |
| 954 |
|
| 955 |
The first stage is implemented by the code contained in the name space |
| 956 |
`SolverT`. The third stage is implemented by the code contained in the name |
| 957 |
space `SolverA`. The second and the fourth stages are implemented by the code |
| 958 |
contained in the name space `ProjectorHcurlToHdiv`. The name space |
| 959 |
`ExactSolutions` contains exact closed-form analytical expressions for |
| 960 |
$\vec{B}$ and $\vec{J}_f$. |
| 961 |
|
| 962 |
No error norms are computed at the first and the third stages. Computing error |
| 963 |
norms at these stages makes no sense as we apply implicit gauges and the |
| 964 |
conservative portion of the solution is unknown. We can, however, judge the |
| 965 |
quality of the simulations at these two stages indirectly by evaluating the |
| 966 |
quality of the simulations at the second and the fourth stages. |