-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ravaud cuboid field #14
base: master
Are you sure you want to change the base?
Conversation
update for magnetfield
%x1,y1,z1 - reference corner of magnet | ||
%x2,y2,z2 - opposite corner of magnet, defining direction of coordinate | ||
% system and dimension of magnet | ||
% x_m = [x1,x2] ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with other approaches, I think the inputs into this function should be x_c,y_c,z_c for the magnet centre with d_x,d_y,d_z for the cuboid widths. Or similar. Could even be two 3x1 vectors instead.
|
||
%theta - CCW angle from the +x-axis to the polarisation vector | ||
% (XY-plane // about Z) | ||
%phi - CW angle from the +z-axis to the polarisation vector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to rewrite the equations around having a magnetization vector such as Mx,My,Mz so that theta & phi don’t need to be figured out?
H = cat(3,Hx,Hy,Hz); | ||
|
||
%magnetic flux density | ||
B = u0.*H; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
M0 could be removed from the Hx,Hy,Hz equations above and moved down to here.
zeta = sqrt((x-x_m(i)+eps).^2+(y-y_m(j)+eps).^2+(z-z_m(k)+eps).^2); | ||
zeta(isnan(zeta))=0; | ||
|
||
%calculate magnetic field strength |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does Ravaud provide the singular cases so we can get rid of the eps terms? It’s a bit ugly to hack around them like this and doesn’t entirely eliminate the problem (not out of the realm of possibility that a user would provide a displacement of eps, say.)
A few things I’d change before pulling it into the main repo...