Author |
Message |
Stephen Cross (stephenx_86)
New member Username: stephenx_86
Post Number: 1 Registered: 02-2010
| Posted on Friday, February 05, 2010 - 11:05 am: | |
I'm quite new to FlexPDE (I'm using version 5.1.0s Student Edition) and am trying to model the magnetic field from two permanent magnets. In particular I wish to know the field (B) along the line passing between the magnets. I've taken the "permanent magnets" example from the software as the starting point. The vector potential (A) works well and I get a smooth curve for that. However, when I try to model the magnetic field (B) by taking the curl of 'A', the plot I produce is jagged and contains discontinuities. I know from other people who have done this (1. Lipfert, J., Hao, X., and Dekker, N. H. (2009) Biophys. J. 96, 5040-5049) that the plot should be nice and smooth. I have a feeling it's something to do with how I'm implementing the 'surface' plotting command. If I type "surface(curl(A))" it tells me that I require a scalar. Therefore, I do "surface(magnitude(curl(A)))" and it lets me plot it, but the result is the aforementioned jagged line. I've included the full code below. Any help on why I get this jagged plot would be greatly appreciated. Thanks in advance " Variables A { z-component of Vector Magnetic Potential, B=curlA } Definitions {I assume these are the constants} mu = 4*Pi*10^(-7) {actually mu[0]} S = 0 { current density } Brx = 0 { Remnant magnetization x-component } Bry = 0 { Remnant magnetization y-component } Br = vector(Brx,Bry) { Remnant magnetization vector } B = curl(A) { B-field} H = (B/mu)-(mu*Br) { Magnetic field } Initial values A = 0 Equations A : curl(H) + S = 0 Boundaries Region 1 start(15,15) line to (-15,15) to (-15,-15) to (15,-15) to close Region 2 { the left permanent magnet } Brx = 1.4 start (0.5,-2.5) line to (5.5,-2.5) to (5.5,2.5) to (0.5,2.5) to close Region 3 { the right permanent magnet } Brx = 1.4 start (-0.5,-2.5) line to (-0.5,2.5) to (-5.5,2.5) to (-5.5,-2.5) to close Plots grid(x,y) contour(A) as 'Az MAGNETIC POTENTIAL' surface(A) as 'Az MAGNETIC POTENTIAL' surface(magnitude(B)) elevation(magnitude(B)) from (0,0) to (0,10) End" |
Robert G. Nelson (rgnelson)
Moderator Username: rgnelson
Post Number: 1324 Registered: 06-2003
| Posted on Friday, February 05, 2010 - 02:06 pm: | |
The finite element method approximates the solution (ie A) by a patchwork of polynomials on the mesh cells. This solution is guaranteed continuous. Derivatives (such as Curl(A)) are not guaranteed to be continuous, and usually are not. The effect is more noticable when the mesh is very crude, as will be true in the student version of FlexPDE. As the mesh is refined, the discontinuities in the derivatives become less noticeable, because each polynomial patch lies closer to the actual solution shape. Some finite element programs automatically smooth the derivative displays, but this is purely cosmetic. You can do this if you want by displaying FIT(magnitude(B)).
|
Stephen Cross (stephenx_86)
New member Username: stephenx_86
Post Number: 2 Registered: 02-2010
| Posted on Monday, February 08, 2010 - 05:30 am: | |
As the plot I'm trying to get at the moment only needs to be a rough approximation, FIT should work fine. We'll probably get the full version at a later date. Thanks for the help |
Robert G. Nelson (rgnelson)
Moderator Username: rgnelson
Post Number: 1328 Registered: 06-2003
| Posted on Tuesday, February 09, 2010 - 01:41 pm: | |
FIT does a projection onto the finite element basis, so the integral (and therefore strain energy, I think) is preserved. So it's not really that rough an approximation.
|
|