Computing Hr and Hz from Magnetic potential

AI Thread Summary
To compute Hr and Hz from the magnetic vector potential A, one must understand that the magnetic field is derived from the curl of A, which requires knowledge of the spatial derivatives of A. The FEMM software processes the .ans file containing nodal values of A to compute H values, but these calculations are not directly stored in the file. The user is advised to explore FEMM's source code for insights into how the .ans file is processed and to consider using a Lua script for more efficient data extraction. Understanding the basis functions used in the finite element method (FEM) is crucial for accurately calculating the magnetic fields. The discussion highlights the complexity of deriving Hr and Hz and the importance of FEMM's post-processing capabilities.
rsr_life
Messages
48
Reaction score
0
Hello everybody,

My question to you is how can I compute the values of Hr and Hz given the value of A - the magnetic vector potential.

The reason I seek this: I'm using the FEMM software to obtain the H values at points around a solenoid. The .ans file that FEMM creates has a huge list of numbers which I found to be the magnetic potential. FEMM manages to retrieve the values of Hr and Hz from this list of Magnetic potential values.

Here's a sample of the .ans file:

...
[Solution]
2941
1.2085532825853653 4.0843637420137959 -3.9469544215389256e-005
1.1273460445780257 4.3874332801995255 -7.8792243048921603e-006
1.3411542731880106 3.7999999999999998 -7.0806330952824349e-005
1.4562831499937583 4.2684393799265425 -3.0708797381233563e-005
1.1000000000000001 4.7000000000000002 2.6544667022034454e-005
1.4823341543420145 4.5759703098370341 8.5327589548402048e-006
1.52112000238584 3.5429823025642291 -9.6872108040739851e-005
...

The first column is the r value, the second the z value and the third is our A.

I need to compute Hr and Hz (or Hx and Hy in the planar case) so that I can use Matlab directly on the .ans file that FEMM creates.

Seems simple enough, but how do I do this? Can somebody point me to the formula, OR if you know FEMM well, can you explain the .ans file for me?

Thanks,

-rsr_life.
 
Physics news on Phys.org
The B field is the curl of the vector potential. You cannot calculate this directly from just given vector potential values. You could estimate the derivatives using finite-difference, but you would need to know the location of each vector potential point. I do not understand your results, A is a vector. Do you know only the magnitude and location of A, or do you know the direction and magnitude of A but not the location?
 
Born2bwire,

Thanks for that. I was aware of the equation you mentioned, which was why I was confused as to how FEMM managed to compute the values of H/B from A given the data I've posted.

To answer your query, the first number 2941 is the number of nodes in the mesh. Then, the first column is the r, the second column is the z, (or x and y) of the respective node, and the third column is the nodal value of magnetic potential - A in the case of a planar type model, \Phi = 2*\pi*r*A in the case of an axisymmetric problem.

But, as it turns out,

"... I’d also written a verbal explanation a while ago at http://www.femm.info/list/msg00360.html that’s still pretty much accurate.

However, the information in the .ans file is nodal values of vector potential. The post processor does some work to get values of B and H from the vector potential—these quantities are not stored in the file. ..."


to quote FEMM author David Meeker, who responded to an email I'd sent. Matlab, only calls on FEMM to pass the values of Hr and Hz by pointing to the .ans postprocess file. FEMM's postprocessor still does the computation by itself, using the values of A directly from the .ans file.

Finally, to quote the author again,

If you’re interested in reverse-engineering the solution file format, the best thing to do is just look at the source code that reads in the .ans file. If you download the source, the routine that does it is OnOpenDocument in FemmviewDoc.cpp, which lives in the femm subdirectory of the source code.

For future reference, I will look at the file and update this post on how the computation is done.

But if somebody knows how that could possibly be done, you could still suggest ideas here while I update you guys.
 
Ahh, it is an FEM code. That complicates things then. Because in FEM, you would have a vector basis function that interpolates the value of the vector potential over the patch. What you have solved for is the signed magnitude of the vector potential that is interpolated over the patch. If you knew the basis function of a patch, you could take the curl of the basis function and apply the solved A to find the magnetic field over the patch.

For example, in a method of moments solver, we use the RWG basis function on triangular patches. We solve for a single value for the current, but the current is defined as:

\mathbf{J}_n = J_n \frac{L_n}{2A_n^\pm}\boldsymbol{\rho}^\pm(\mathbf{r})

What all this means is immaterial. It is suffice for you to know that the vector \rho is a vector that points from the vertex of our mesh triangle into the interior of the patch. This vector is the local current vector, we have only solved for a weight on this vector. So if we wanted to know the actual current, we would have to do more math to find the vector currents at the desired points on each mesh element. If we want to find the charge density on the element, we take the divergence of the current which is

\nabla\cdot\mathbf{J_n } = \mp \frac{L_n}{A_n^\pm}

In a similar way we would take the curl of your basis function to find the associated B field. So having solved for the weights for the basis functions you see that you need to go even further to actually get the real vector potential or magnetic field values.
 
Ok... wow. That helps a lot. Thanks. This is precisely the reason I post queries here.

At this stage, I'm attempting to simply retrieve values of Hr & Hz that FEMM's solver generates into a .mat/.csv file - thus bypassing the solver result .ans file completely - using a Lua script (which is compiled into FEMM and is then much faster) and thankfully, for the moment at least, I don't need to work at the level of detail you seem good at. Will be taking my FEM classes next semester - for now, I'm content at just manipulating things at a higher level.

Thanks again. Will keep you guys posted.
 
Last edited:
Thread 'Motional EMF in Faraday disc, co-rotating magnet axial mean flux'
So here is the motional EMF formula. Now I understand the standard Faraday paradox that an axis symmetric field source (like a speaker motor ring magnet) has a magnetic field that is frame invariant under rotation around axis of symmetry. The field is static whether you rotate the magnet or not. So far so good. What puzzles me is this , there is a term average magnetic flux or "azimuthal mean" , this term describes the average magnetic field through the area swept by the rotating Faraday...
Back
Top