Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Ravaud cuboid field #14

wants to merge 1 commit into from

Conversation

wspr
Copy link
Member

@wspr wspr commented Dec 28, 2018

A few things I’d change before pulling it into the main repo...

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] ...
Copy link
Member Author

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
Copy link
Member Author

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;
Copy link
Member Author

@wspr wspr Dec 28, 2018

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
Copy link
Member Author

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants