# Convergence of axisymmetric EHD stresses

We wish to test the accuracy of the EHD stresses in case of axisymmetric coordinates. To do so, we create an “ad hoc” solution for the electric poisson equation, $\frac{{\partial }_{y}\left(y\epsilon {\partial }_{y}\varphi \right)}{y}+{\partial }_{x}\left(\epsilon {\partial }_{x}\varphi \right)=-{\rho }_{e}$ with ${\rho }_{e}$ the electric charge density. If we look for a solution of the form, $\varphi \left(x,y\right)={y}^{a}\mathrm{cos}x\mathrm{sin}y$ the charge density must then be (for $\epsilon =1$), ${\rho }_{e}=-{y}^{-2+a}\mathrm{cos}x\left(\left(1+2a\right)y\mathrm{cos}y+\left({a}^{2}-2{y}^{2}\right)\mathrm{sin}y\right)$

The corresponding electrical stresses $\mathbf{\text{F}}$ are calculated from the divergence of the Maxwell stress tensor, $\mathbf{\text{F}}=\nabla \cdot \mathbf{\text{M}}$ Their components in the x- and y- directions are, $\mathbf{\text{F}}{\mid }_{y}=\frac{{\partial }_{y}\left(y{M}_{yy}\right)}{y}+{\partial }_{x}{M}_{yx}-\frac{{M}_{\theta \theta }}{y}$ and $\mathbf{\text{F}}{\mid }_{x}=\frac{{\partial }_{y}\left(y{\partial }_{y}{M}_{xy}\right)}{y}+{\partial }_{x}{M}_{xx}$ with ${M}_{xx}=\epsilon \left({E}_{x}^{2}-{E}_{y}^{2}\right)/2$ ${M}_{yy}=\epsilon \left({E}_{y}^{2}-{E}_{x}^{2}\right)/2$ ${M}_{xy}={M}_{yx}=\epsilon \left({E}_{y}{E}_{x}\right)$ and ${M}_{\theta \theta }=-\epsilon \left({E}_{y}^{2}+{E}_{x}^{2}\right)/2$

${E}_{x/y}=-{\partial }_{x/y}\varphi$ are the axial and radial components of the electric field.

In this test we will set the charge density to check how the electric potential $\varphi$ and the electrical stresses are recovered.

``````#include "grid/multigrid.h"
#include "axi.h"
#include "run.h"
#include "poisson.h"

mgstats mg;
scalar φ[];
face vector ε[];
face vector a[], α[];``````

We solve only for the case $a=1$. The case $a=0$ is ill-posed because the forcing terms diverge near the axis of symmetry.

``````#define PHI(x,y) y*cos(x)*sin(y)
#define RHOE(x,y) cos(x)*(-3*cos(y) + (2*y-1/y)*sin(y))

#define FY(x,y) (y == 0. ? 0. : sq(cos(x))/y*(sq(sin(y)) + \
y/2*(y + 5*y*cos(2*y)	\
- 2*(-2+sq(y))*sin(2*y))))

#define FX(x,y) cos(x)*sin(x)*sin(y)*(-3*y*cos(y)+(2*sq(y)-1)*sin(y))

φ[top] = dirichlet(0.);
φ[bottom] = dirichlet(0.);

int main()
{
L0 = 2.*π;
periodic (right);
for (N = 16; N <= 128; N *= 2)
run();
}

event init (i = 0) {
scalar rhoe[], rhs[];
foreach() {
rhoe[] = RHOE(x,y);
rhs[] = -rhoe[]*cm[];
φ[] = 0.;
}

foreach_face() {
ε.x[] = fm.x[];
α.x[] = fm.x[];
a.x[] = 0.;
}
boundary ((scalar *){rhoe, φ, ε, α, a});

mg = poisson (φ, rhs, ε);
}

#include "ehd/stress.h"

event plot_err (i = 0)
{
face vector err[];

foreach_face (x) {
err.x[] = a.x[] - FX(x,y);
printf ("x: %g %g %g %g %g  \n", x, y, a.x[], FX(x,y), err.x[]);
}

foreach_face (y) {
err.y[] = a.y[] - FY(x,y);
printf ("y: %g %g %g %g %g \n", x, y, a.y[], FY(x,y),err.y[]);
}

norm nx = normf (err.x), ny = normf (err.y);

fprintf (stderr, "%d %g %g %g %g %g %g\n", N,
nx.avg, nx.rms, nx.max,
ny.avg, ny.rms, ny.max);
}``````

As expected we get second-order convergence.