Strayfields

Search SINQ Wiki:
SINQ LIN

SINQ Wiki
- Main Page
- Search SINQ Wiki
- Sample Environment
- Probenumg. Intern
- Troubleshooting SICS

This Page
- Page Info
- Printer Friendly

Referenced by
MagnetList

Wiki Info
- Unused pages
- Undefined pages
- RecentChanges
- Page Index
- System Info
- JSPWiki Docu
- SandBox
- OneMinuteWiki
- Create a New Page




JSPWiki v2.0.52


This is version 1. It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]


Stray Field Calculator

  • for horizontal magnets, the central field is in x direction
  • for vertical magnets, the central field is in z direction
  • the origin of the coordinate system is the center of the magnet (= sample position)

<html> <script> var horizontal=0; var runit=1; var bunit=0; var fact=0; // factor var field=0; var maxfield=0; function errmsg(text) { document.getElementById("msg").innerHTML=text; document.getElementById("b").innerHTML=""; document.getElementById("bx").innerHTML=""; document.getElementById("by").innerHTML=""; document.getElementById("bz").innerHTML=""; } function calc() { // x: along axis // y: perpendicular to axis if (fact == 0) { errmsg("please select magnet"); return; } xp = parseFloat(document.getElementById("x").value); yp = parseFloat(document.getElementById("y").value); zp = parseFloat(document.getElementById("z").value); bb = parseFloat(document.getElementById("bb").value); if (horizontal) { x=xp; y=Math.sqrt(yp*yp+zp*zp); } else { x=zp; y=Math.sqrt(yp*yp+xp*xp); } r2=x*x+y*y; r3=r2*Math.sqrt(r2); if (fact*runit/r3 > 1) { errmsg("distance too low"); return; }

xb=bb*Math.pow(10,bunit)*runit*fact*(3*x*x/r2-1)/r3; yb=bb*Math.pow(10,bunit)*runit*fact*3*x*y/r3; if (y == 0) y=1; if (horizontal) { bx=xb; by=yb*yp/y; bz=yb*zp/y; } else { bx=yb*xp/y; by=yb*yp/y; bz=xb; } prec = 4-bunit; b = Math.sqrt(bx*bx+by*by+bz*bz); if (b > 0) { eps = Math.pow(0.1,prec); while (eps > 0.09 * b) { prec++; eps *= 0.1; } } errmsg(""); document.getElementById("bx").innerHTML = bx.toFixed(prec); document.getElementById("by").innerHTML = by.toFixed(prec); document.getElementById("bz").innerHTML = bz.toFixed(prec); document.getElementById("b").innerHTML = b.toFixed(prec); return; }

function mag(h,f,b) { horizontal=h; fact=f/b; maxfield=b; document.getElementById("bb").value=b; calc(); }

</script> <form> <input type="radio" name=m onClick="mag(0,0.0064,6)"> MA6 <input type="radio" name=m onClick="mag(1,0.034,6.8)"> MA7 <input type="radio" name=m onClick="mag(1,0.030,9)"> MA09 <input type="radio" name=m onClick="mag(0,0.066,14.9)"> MA15 <table> <tr><td colspan=2><b>central field</b></td> <td rowspan=9 valign=top><input type=button value=">" onClick="calc();"><div id=msg align=right></div></td> <td colspan=2><b>stray field</b></td></tr> <tr><td></td><td><input type=text id=bb size=6 value="" onChange="calc();">Tesla</td> <td>B=</td><td><div id=b align=right></div></td><td><input type="radio" name=b onClick="bunit=0;calc();" checked> Tesla <input type="radio" name=b onClick="bunit=4;calc();"> Gauss<td></tr> <tr><td></td><td>at position</td><td></td><td></td></tr><tr> <tr><td>x</td><td><input type=text id=x size=6 value="0" onChange="calc();"></td> <td>Bx=</td><td><div id=bx align=right></div></tr> <tr><td>y</td><td><input type=text id=y size=6 value="1" onChange="calc();"></td> <td>By=</td><td><div id=by align=right></div></td></tr> <tr><td>z</td><td><input type=text id=z size=6 value="0" onChange="calc();"></td> <td>Bz=</td><td><div id=bz align=right></div></td></tr> <tr><td colspan=2> <input type="radio" name=r onClick="runit=1;calc();" checked> m <input type="radio" name=r onClick="runit=1000000;calc();"> cm <input type="radio" name=r onClick="runit=1000000000;calc();"> mm </td></tr> </table> </form> </html>


This particular version was published on 07-Apr-2016 12:54:59 UTC by MarkusZolliker.