- Home
- Users & Science
- Accelerators
- Instrumentation & Equipment
- Scientific Software Developed by the ID Group
- Radia
- Documentation
- Radia Examples
- Example#4: Uniformly Magnetized Sphere
Example#4: Uniformly Magnetized Sphere
Version : 0.1
Introduction
This example illustrates the use of a polyhedron shape by means of the "radObjMltExtPgn" function. A uniformly magnetized polyhedron is created with a magnetization of 1 Tesla. The field produced by this polyhedron is computed and shown to be uniform inside the volume of the polyhedron and equal to 2/3 Tesla as expected from an analytical integration.
It is assumed that the reader has some experience with Mathematica and that he has successfully run Example#1.
Evaluate sections in the order of presentation: "Load and Initialize Radia" followed by "Build the Geometry", "Display the Geometry with QuickDraw 3D", "Plot the Geometry", "Plot the Magnetic Field".
If successful, try to modify some parameters (see the Reference Guide for the explanations on the Radia functions) and re-execute the corresponding section. All sections must be evaluated in the order of presentation. A section may be evaluated several times with the same or different parameters if the previous sections have been evaluated before. The only limitation is memory. The Radia.exe memory can be re-initialized by re-executing the section entitled "Load and Initialize Radia". The Kernel memory can be re-initialized by calling Exit[] and then re-executing all sections of this example. If the Front-End is running out of memory, close some windows or close the Front-End and start it again. Note that if by mistake any section is executed before the previous ones are executed, it may be necessary to exit the Kernel and re-start everything from the very beginning.
Load and Initialize Radia
The following instruction loads the Radia package and returns the Radia version number.
<<Radia`;
Build the Geometry
These instructions define a uniformly magnetized convex polyhedron which converges to a sphere at large values of segmentation parameters.
SphericalVolume[R_, nn&phiv_, nz_, {mx_,my_,mz_}]:=Module[{z, dz, &thgr, cos&thgr, &phiv, d&phiv, SlicePgn, AllSlicePgns}, dz=2.*R/nz; z=-R+dz; d&phiv=2.*&pgr/nn&phiv AllSlicePgns={{{{0.,0.}}, -R}}; For[i=1, i<=(nz-1), i++, &thgr=ArcSin[z/R]; cos&thgr=Cos[&thgr]; &phiv=d&phiv SlicePgn={{R*cos&thgr, 0.}}; For[k=1, k<=(nn&phiv-1), k++, SlicePgn=Append[SlicePgn, {R*Cos[&phiv]*cos&thgr, R*Sin[&phiv]*cos&thgr}]; &phiv+=d&phiv ]; AllSlicePgns=Append[AllSlicePgns, {SlicePgn, z}]; z+=dz; ]; AllSlicePgns=Append[AllSlicePgns, {{{0.,0.}}, R}]; radObjMltExtPgn[AllSlicePgns, N[{mx,my,mz}]] ]; radUtiDelAll[]; aSphere = SphericalVolume[1., 15, 15, {1.,0.,0.}]; radObjDrwAtr[aSphere, {0,0.5,0.8}];
Display the Geometry with QuickDraw 3D
If you have QuickDraw 3D installed on your platform (freely available for PC and Macs from Apple at "http://www.apple.com/quicktime/qd3d/" ) , execute the following line to display the geometry in a dedicated window where you will be able to zoom, rotate etc....When you have finished, Quit from the Menu File of Radia.exe (for Macs) or Exit from the Menu File of the Viewer window (for PC) to release the memory required by QuickDraw3D and continue executing the following instructions.
radObjDrwQD3D[aSphere];
Plot the Geometry
These instructions plot the geometry of coils previously created.
RadPlot3DOptions[]; dr=radObjDrw[aSphere]; (* Draw the Geometry *) Show[Graphics3D[dr ,PlotLabel->FontForm["Sphere",{"Times",14}] ,DefaultFont -> {"Times",10}]];
Plot the Magnetic Field
The magnetic field created by the sphere is computed on the center and a profile along Y is plotted
RadPlotOptions[]; Print["Field in the Center = ",radFld[aSphere,"b",{0,0,0}]] Plot[radFld[aSphere,"Bx",{0,y,0}],{y,-0.99,0.99}];