Classes:
1) BatchSSOLIIAXI
2) SolverSSOLIIAXI
3) ExactSolutionSSOLIIAXI_A
4) ExactSolutionSSOLIIAXI_B
5) ExactSolutionSSOLIIAXI_H
6) SettingsSSOLIIAXI
Files:
1) ssol-ii-axi/src/main.cpp
2) ssol-ii-axi/include/solver.hpp
3) ssol-ii-axi/src/solver.cpp
4) ssol-ii-axi/include/exact_solution.hpp
5) ssol-ii-axi/src/exact_solution.cpp
6) ssol-ii-axi/src/static_scalar_input.cpp
7) ssol-ii-axi/include/settings.hpp
In the most general case, a three-dimensional problem formulated in terms of the vector magnetic potential, \(\vec{A}\), is described by the curl-curl partial differential equation,
\[ \vec{\nabla} \times \bigg( \frac{1}{\mu} \vec{\nabla} \times \vec{A} \bigg) = \vec{J}_f. \]
If, however, a problem exhibits a rotation symmetry and the magnetic vector potential is expected to have the following form in the cylindrical coordinate system:
\[ \vec{A}(r,z) = 0\hat{r} + A(r,z) \hat{\phi} + 0 \hat{z}, \]
the curl-curl equation can be replaced by the following div-grad equation:
\[ - \vec{\nabla} \cdot \bigg(\frac{1}{\mu'} \vec{\nabla} A' \bigg) = J_f, \]
where
\[ \mu' = r \mu \]
and
\[ A' = r A, \]
see Section 3.4.2 Scalar axisymmetric problem.
This numerical experiment illustrates the application of the StaticScalarSolver::Solver to a problem formulated in terms of the scaled magnetic vector potential, \(A'\). To this end, we will obtain numerical solutions to a problem on a set of progressively refined meshes and compare them to the closed-form analytical solution.
In this numerical experiment the problem of the ssol-ii numerical experiment is reused. This time, however, we do not use the three-dimensional problem domain and construct a two-dimensional axisymmetric domain as shown in the figure below.
We would like to calculate the scaled magnetic vector potential, \(A'\), scaled auxiliary field \(\vec{H}'\), and scaled magnetic field, \(\vec{B}'\).
We will apply the first-order asymptotic boundary condition (ABC). To this end, we split the boundary on two segments, \(\Gamma_{D1}\) and \(\Gamma_{R1}\), see the figure above, and apply the homogeneous Dirichlet boundary condition,
\[ A' = 0, \]
and the first-order ABC,
\[ \dfrac{1}{\mu'_0} \hat{n} \cdot \bigg( \vec{\nabla} A' \bigg)+ \dfrac{1}{\mu'_0 d_3} A'\ = 0, \]
to \(\Gamma_{D1}\) and \(\Gamma_{R1}\), respectively.
To derive a closed-form analytical expression for the scaled magnetic field we make the following substitution into the analytical solution to the problem of ssol-ii numerical experiment:
\[ r \rightarrow s \]
and multiply the result by the distance to the axis of rotation symmetry, \(r\),
\[ \vec{B}' = r \vec{B}(s,\theta)= \left\{ \begin{aligned} & r\bigg[ \frac{1}{2} (b^2-a^2) \vec{F}_1(\theta)\bigg] &&\text{if }&& s \le a\\ & r\bigg[ \frac{1}{2} (b^2-s^2) \vec{F}_1(\theta) + \frac{1}{5} (s^5-a^5) \vec{F}_2(s, \theta) \bigg] && \text{if } && a \le s \le b\\ & r\bigg[ \frac{1}{5} (b^5-a^5) \vec{F}_2(s, \theta)\bigg] &&\text{if }&& s \ge b,\\ \end{aligned} \right. \]
In the last equation \(a\) is the inner radius of the coil, \(b\) is the outer radius of the coil, \(s\) is the distance to the origin, and \(\theta\) is the polar angle. That is, here \(s\) and \(\theta\) are spherical coordinates while \(r\) and \(z\) are cylindrical coordinates. The expressions for the functions \(F_1\) and \(F_2\) read
\[ \begin{aligned} &\vec{F}_1(\theta) = \dfrac{2}{3}\mu_0 K_0\big(\cos{\theta}\hat{s}-\sin{\theta}\hat{\theta}\big), \\ &\vec{F}_2(s,\theta) = \dfrac{2}{3}\mu_0 K_0 \frac{1}{s^3}\big(\cos{\theta}\hat{s}+\frac{1}{2}\sin{\theta}\hat{\theta}\big). \end{aligned} \]
This time around the magnetic vector potential is gauged implicitly by the rotation symmetry of the problem. For this reason, we can expect a unique solution in terms of \(A'\). Consequently, we can compute the \(L^2\) and \(H^1\) error norms. To do so, we need close-form expressions for \(A'\) and its gradient. Note that in the current context by the gradient we mean the following differential operator:
\[ \vec{\nabla} = \dfrac{\partial}{\partial r} \hat{r} + \dfrac{\partial}{\partial z} \hat{z}. \]
The scaled magnetic vector potential can be expressed as
\[ A' = r A(s,\theta)= \left\{ \begin{aligned} & r\bigg[\frac{1}{2} (b^2-a^2) G_1(\theta)\bigg] &&\text{if }&& s \le a\\ &r\bigg[ \frac{1}{2} (b^2-s^2) G_1(\theta) + \frac{1}{5} (s^5-a^5) G_2(s, \theta) \bigg] && \text{if } && a \le s \le b\\ & r\bigg[\frac{1}{5} (b^5-a^5)G_2(s, \theta)\bigg] &&\text{if }&& s \ge b,\\ \end{aligned} \right. \]
where
\[ \begin{aligned} &G_1(\theta) = \dfrac{1}{3}\mu_0 K_0 s \sin{\theta}, \\ &G_2(s,\theta) = \dfrac{1}{3}\mu_0 K_0 \frac{1}{s^2}\sin{\theta}. \end{aligned} \]
Next, we note that
\[ \sin(\theta) = \dfrac{r}{s} \]
and, thus,
\[ \begin{aligned} &G_1 = \dfrac{1}{3}\mu_0 K_0 r, \\ &G_2 = \dfrac{1}{3}\mu_0 K_0 \frac{r}{s^3}. \end{aligned} \]
Then by observing that
\[ \begin{aligned} &rG_1 = \dfrac{1}{3}\mu_0 K_0 r^2, \\ &rG_2 = \dfrac{1}{3}\mu_0 K_0 \dfrac{r^2}{s^3}, \end{aligned} \]
and
\[ \dfrac{\partial}{\partial r} \dfrac{r^2}{s^3} = \dfrac{\partial}{\partial r} r^2(r^2+z^2)^{-\frac{3}{2}} = 2r(r^2+z^2)^{-\frac{3}{2}} -\dfrac{3}{2} r^2(r^2+z^2)^{-\frac{5}{2}}2r= 2r(r^2+z^2)^{-\frac{3}{2}} -3 r^3(r^2+z^2)^{-\frac{5}{2}} = \dfrac{2r}{s^3} - \dfrac{3r^3}{s^5}, \]
\[ \dfrac{\partial}{\partial z} \dfrac{r^2}{s^3} = \dfrac{\partial}{\partial z} r^2(r^2+z^2)^{-\frac{3}{2}} = -\dfrac{3}{2} r^2(r^2+z^2)^{-\frac{5}{2}}2z = - \dfrac{3r^2 z}{s^5}, \]
we introduce the following two notations:
\[ \vec{L}_1 = \vec{\nabla} (rG_1) = \dfrac{2}{3}\mu_0 K_0 r \hat{r}, \]
\[ \vec{L}_2 = \vec{\nabla} (rG_2) = \dfrac{1}{3}\mu_0 K_0 \bigg[ \bigg(\dfrac{2r}{s^3}-\dfrac{3r^3}{s^5}\bigg)\hat{r} -\dfrac{3r^2 z}{s^5}\hat{z} \bigg]. \]
Then the gradient of the scaled magnetic vector potential can be expressed as
\[ \vec{\nabla} A' = \left\{ \begin{aligned} & \frac{1}{2} (b^2-a^2) \vec{L}_1 &&\text{if }&& s \le a\\ & \frac{1}{2} (b^2-s^2) \vec{L}_1 + \frac{1}{5} (s^5-a^5) \vec{L}_2 && \text{if } && a \le s \le b\\ & \frac{1}{5} (b^5-a^5)\vec{L}_2 &&\text{if }&& s \ge b.\\ \end{aligned} \right. \]
The figure below illustrates the mesh.
The half-circle of a radius of \(d_2\) delineates the local mesh. The error norms are computed within the local mesh.
The following boundary value problem is solved in this numerical experiment:
\begin{equation} \begin{array}{lrcll} \text{ }&- \vec{\nabla} \cdot \bigg(\dfrac{1}{\mu'_{0}} \vec{\nabla} A' \bigg)= J_f & \text{in} & \Omega & \text{(i)},\\ \text{(e)} & A' = 0 & \text{on} & \Gamma_{D1} & \text{(ii)},\\ \text{(n)} & \dfrac{1}{\mu'_0} \hat{n} \cdot \bigg( \vec{\nabla} A' \bigg)+ \dfrac{1}{\mu'_0 d_3} A'\ = 0 & \text{on} & \Gamma_{R1} & \text{(iii)},\\ \end{array} \end{equation}
where
\begin{equation} \mu'_0 = r \mu_0 \end{equation}
First, a class template (SolverSSOLIIAXI) derived from StaticScalarSolver::Solver is used to obtain the numerical solution, \(A'\). After that, the numerical solution is fed to objects derived from the class templates StaticScalarSolver::ProjectAphiToHrz and StaticScalarSolver::ProjectAphiToBrz to calculate the scaled auxiliary vector field \(\vec{H}'\) and magnetic field \(\vec{B}'\) as
\[ \vec{H}' = - \frac{1}{\mu_0} \vec{\nabla}\overset{V}{\times} A' \]
and
\[ \vec{B}' = - \vec{\nabla}\overset{V}{\times} A', \]
respectively.
The SSOLIIAXI experiment is implemented in accordance with the base code structure. The build process generates one executable file: ssol-ii-axi-circle. To rebuild it change into ssol-ii-axi/build/Release directory and execute the following:
Then the executable file must be executed again. This can be done by changing into the ssol-ii-axi/bin/Release directory and executing ssol-ii-axi-circle,
This will generate various files in the ssol-ii-axi/bin/Release/Data directory. Among the generated files there are vtu files that can be viewed with a help of ParaView software package of the Kitware, Inc. The data files in tex and txt format contain the convergence tables. The ssol-ii-axi/bin/Release directory also contains circle.gpi file. It can be used to visualize the calculated potential along the \(r\) axis.
Note that executable files require a set of meshes to be present in the ssol-ii-axi/gmsh/data directory. If they are missing, they can be generated anew. This can be done by changing into ssol-ii-axi/gmsh directory and executing the following:
This will generate a set of globally refined meshes in ssol-ii-axi/gmsh/data.
The SettingsSSOLIIAXI class allows switching on three useful features: printing time tables on the computer screen, logging convergence data of the conjugate gradient solver, and saving the exact solution into the vtu files next to the numerical solution.
The experiment was executed under the following conditions: \(a = 0.3[m]\), \(b=0.6[m]\), \(d_2 = 1.0\), \(d_3=2.0\), and \(K_0 = 1.0[A \cdot m^{-1}]\).
The figure below illustrates a plot of the scaled magnetic vector potential, \(A'\), the output of an object of the SolverSSOLIIAXI type.
The corresponding convergence table is presented below.
p | r | cells | dofs | \(\|e\|_{L^2}/\mu_0\) | \(\alpha_{L^2}\) | \(\|e\|_{H^1}/\mu_0\) | \(\alpha_{H^1}\) |
---|---|---|---|---|---|---|---|
1 | 15 | 4368 | 4482 | 1.20e-05 | - | 5.64e-04 | - |
1 | 16 | 5010 | 5132 | 1.06e-05 | 1.77 | 5.26e-04 | 1.01 |
1 | 17 | 5696 | 5826 | 9.49e-06 | 1.79 | 4.93e-04 | 1.01 |
1 | 18 | 6426 | 6564 | 8.52e-06 | 1.78 | 4.64e-04 | 1.01 |
2 | 15 | 4368 | 17699 | 3.16e-08 | - | 8.50e-06 | - |
2 | 16 | 5010 | 20283 | 2.57e-08 | 3.02 | 7.41e-06 | 2.01 |
2 | 17 | 5696 | 23043 | 2.12e-08 | 3.02 | 6.51e-06 | 2.01 |
2 | 18 | 6426 | 25979 | 1.77e-08 | 3.02 | 5.77e-06 | 2.01 |
3 | 15 | 4368 | 39652 | 2.58e-10 | - | 4.50e-08 | - |
3 | 16 | 5010 | 45454 | 1.96e-10 | 4.03 | 3.66e-08 | 3.02 |
3 | 17 | 5696 | 51652 | 1.51e-10 | 4.02 | 3.01e-08 | 3.02 |
3 | 18 | 6426 | 58246 | 1.19e-10 | 4.02 | 2.51e-08 | 3.02 |
The following notations were used in the table header:
The figure below illustrates a plot of the calculated scaled auxiliary H-field, \(\vec{H}'\), the output of an object of the StaticScalarSolver::ProjectAphiToHrz type.
The corresponding convergence table is presented below.
p | r | cells | dofs | \(\|e\|_{L^2}\) | \(\alpha_{L^2}\) |
---|---|---|---|---|---|
1 | 15 | 4368 | 8849 | 2.57e-04 | - |
1 | 16 | 5010 | 10141 | 2.38e-04 | 1.11 |
1 | 17 | 5696 | 11521 | 2.22e-04 | 1.10 |
1 | 18 | 6426 | 12989 | 2.08e-04 | 1.09 |
2 | 15 | 4368 | 35170 | 9.20e-06 | - |
2 | 16 | 5010 | 40322 | 8.02e-06 | 2.00 |
2 | 17 | 5696 | 45826 | 7.06e-06 | 2.00 |
2 | 18 | 6426 | 51682 | 6.25e-06 | 2.00 |
3 | 15 | 4368 | 78963 | 4.35e-08 | - |
3 | 16 | 5010 | 90543 | 3.53e-08 | 3.04 |
3 | 17 | 5696 | 102915 | 2.91e-08 | 3.04 |
3 | 18 | 6426 | 116079 | 2.42e-08 | 3.04 |
The following notations were used in the table header:
The figure below illustrates a plot of the calculated scaled magnetic field, \(\vec{B}'\), the output of an object of the StaticScalarSolver::ProjectArToBrz type.
The corresponding convergence table is presented below.
p | r | cells | dofs | \(\|e\|_{L^2}/\mu_0\) | \(\alpha_{L^2}\) |
---|---|---|---|---|---|
1 | 15 | 4368 | 8849 | 5.64e-04 | - |
1 | 16 | 5010 | 10141 | 5.26e-04 | 1.01 |
1 | 17 | 5696 | 11521 | 4.93e-04 | 1.01 |
1 | 18 | 6426 | 12989 | 4.64e-04 | 1.01 |
2 | 15 | 4368 | 35170 | 8.50e-06 | - |
2 | 16 | 5010 | 40322 | 7.41e-06 | 2.01 |
2 | 17 | 5696 | 45826 | 6.51e-06 | 2.01 |
2 | 18 | 6426 | 51682 | 5.77e-06 | 2.01 |
3 | 15 | 4368 | 78963 | 4.50e-08 | - |
3 | 16 | 5010 | 90543 | 3.66e-08 | 3.02 |
3 | 17 | 5696 | 102915 | 3.01e-08 | 3.02 |
3 | 18 | 6426 | 116079 | 2.51e-08 | 3.02 |
The following notations were used in the table header:
The convergence tables above suggest that the order of convergence of the \(L^2\) and \(H^1\) error norms of the scaled magnetic vector potential, \(A'\), can be described by the following expressions:
\[ \alpha_{L^2} \approx p + 1 \]
and
\[ \alpha_{H^1} \approx p, \]
where \(p\) is the order of the interpolating Lagrange polynomials. This corresponds to the upper boundary of the expected convergence order.
The convergence order computed for the scaled H-field, \(\vec{H}'\), and for the scaled magnetic field, \(\vec{B}'\) equals
\[ \alpha_{L^2} \approx p. \]
This is to be expected as \(\vec{B}'\) and \(\vec{H}'\) are related to \(A'\) by a first-order derivative.