Visualizing magnetic vector potential A

Hello,

I have a question about the magnetic vector potential A not being displayed correctly.

The A is needed to calculate magnetic flux through a region of space enclosed by a coil.
I have tried to display A in the following two tutorials using ver. 6.2.2304.

An attempt to do this can be easily accomplished by modifying the Draw command as follows.

Draw (u, mesh, "A-field")

The direction of A must be equal to the direction of I or curl M, correct?
In “2.4 Maxwell’s Equations”, the direction is displayed correctly.
In “Symbolic definition of forms : magnetic field”, the direction is not displayed correctly.

It seems that A may not be displayed correctly when “f” is given in terms of current density.

I could be wrong.
Because B is displayed correctly in the two tutorials.
I must be grateful if anyone would be send comments.

Thank you, Daigo

Hello,

To obtain the correct A, I found that it was important that the value of order in the following command be greater than 1.

with TaskManager():
    mesh = Mesh(ngmesh)
############################################################################
mesh.Curve(order=5) # Important command for getting A
############################################################################

However, I don’t understand why this command has so much less impact on B than it does on A.
Even if the order is 1, good B is obtained.

I hope this helps you.

Best, Daigo

What you see here is gradient fields. since curl(grad(u)) = 0 they are unseen by B.
If your right hand side is not numerically div free these gradient fields are large due to the regularization mass term on the left hand side. By curving the geometry the right hand side becomes numerically div free.
Another option would be to use a mixed formulation where you actively impose u * grad(v) = 0 and do not need a regularization.

Best
Christopher

Dear Christopher,

Thank you for your theoretical Comments!
Your comment helped me a lot.
I understand that implementing u * grad(v) = 0 requires some ingenuity.
Because a += SymbolicBFI(u*grad(v)) will raise the error `NgException: Dimensions don’t match’. I need to study electromagnetics further.

I found other two important points by your comments.

  1. I am interested in the mathematical meaning of the coefficient in front of “nu”.
    The following tutorials almost cancel out “nu”, where nu=7.96e5.
a += nu*curl(u)*curl(v)*dx + 1e-6*nu*u*v*dx
a += 1/(mu0*mur)*curl(u)*curl(v)*dx + 1e-8/(mu0*mur)*u*v*dx
a = BilinearForm(1/mu*curl(u)*curl(v)*dx+1e-6/mu*u*v*dx)

However, the following command in my application gives me good results for the A.

a += nu*curl(u)*curl(v)*dx + nu*u*v*dx
  1. The mesh of a coil area to be contour-integrated must be fine enough.
    This is because the mesh on the line to be contour integrated must be fine enough to represent A.
    mesh
  • Not good mesh. Because mesh around the inside of the cross-section of the coil isn’t fine.
def makeCoil_NotGood(radius:float, width:float, height:float, p=(0,0,0)):
    p_out = (0+p[0], -height/2+p[1], 0+p[2])
    coil = Cylinder(p_out, Y, r=radius+width/2, h=height) - Cylinder(p_out, Y, r=radius-width/2, h=height)
    dr = 2*math.pi*radius / 720
    coil.maxh = dr
    coil.mat('coil')
    coil.faces.col = (1,1,0)
    return coil
  • Good mesh. Because mesh around the inside of the cross-section of the coil is fine.
def makeCoil(radius:float, width:float, height:float, p=(0,0,0)):
    p_out = (0+p[0], -height/2+p[1], 0+p[2])
    coil = Cylinder(p_out, Y, r=radius+width/2, h=height) - Cylinder(p_out, Y, r=radius-width/2, h=height)
    #######################################
    # inside of cross section of the coil
    dr = 2*math.pi*radius / 720
    p_in = (0+p[0], -dr/2+p[1], 0+p[2])
    coil_in = Cylinder(p_in, Y, r=radius+dr/2, h=dr) - Cylinder(p_in, Y, r=radius-dr/2, h=dr)
    coil_in.maxh = dr
    coil = Glue((coil, coil_in))
    #######################################
    coil.mat('coil')
    coil.faces.col = (1,1,0)
    return coil

I would be glad if you could point out any errors in my suggestions, or a better way than the suggestions.
I hope that useful information will be posted on this forum and that the number of NGsolve users will continue to grow.

Best,
Daigo