# NTNUJAVA Virtual Physics LaboratoryEnjoy the fun of physics with simulations! Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

## Information about this web site => Request for physics Simulations => Topic started by: danielemateriale on June 25, 2013, 11:47:00 pm

 Title: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 25, 2013, 11:47:00 pm hello I would like to propose a simulation, which I need so much :)2D in a magnetic field that increases with the x axis, then has a maximum, and then returns to zero value as a function gaussina. see photo. the particle part in any point of this plane and with the direction to be set. also the speed and mass are to be set and charge.on the 2D plane in the point x, y have the cmapo varies with xe, remains constant along y. you can set a starting point as the point (xo, yo) where B (tesla) is almost zero and choose the direction of the particle.You can do the following:1) Divide the plan, of length x and height y, in vertical strips of known width.2) manually assign a value of the magnetic field in each strip3)the field is constant in each vertical strip4) manually select a point in the plane5) manually choose a direction in the plane6) assign charge, mass, velocity, to the particle7) go the simulation!then in fig1 explain what must do the program in steps. first step to divide the plane into strips of very great height and thickness of three or more mm and assign the field to each one. the field is constant in each strip but it is different from the strip and the strip. or it can be the same depending on the assignment. second step assign a point and a direction to the particle. third step, run the simulation.in fig2 explain the graphical method for ottenre the result, in any direction goes away, the particle, the radius of curvature is always perpendicular to the direction of the particle. in the band starting the radius of curvature is constant. the particle is a portion of circumference. Now I draw the tangent line to the curve O | and the radius is perpendicalore to this line so the design and so on.set the time in ns the lenght in mm velocity m/s field in tesla charge in coulomb mass in kgthe application is scientific to know if the particle at a given velocity and mass passes through the field or bounces back.thanks Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: Fu-Kwun Hwang on June 26, 2013, 10:39:59 pm The following is a simulation for charged particle in $B_z =B e^{-\frac{x^2}{2*\sigma^2}}$You can drag the changed particle and change it's velocity (drag red arrow).Let me know what you need!   Click the eye (image) to display the simulation[eye][ejsapplet][/eye] Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 27, 2013, 02:07:41 am thanks for having responded unfortunately I can not see the simulation there is a problem with your post. :(did you see the email I sent you ? in the email there are the drawings fig1 e fig2thanks so much. Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: Fu-Kwun Hwang on June 27, 2013, 07:11:52 pm Please check it again! Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 27, 2013, 08:53:15 pm thanks so much!!! is a simulation of based, but it is what I wanted ;D. Now can we please make additions to the program? thanks again for the simulation.So here are the additions I'd like, please:the user must be able to set     - Mass in kg (typically 5 * 10 ^-26Kg)    - Set the charge of the particle (typically 1.6 * 10 ^ -19 C)    - Set the type of charge of the particle + or -.    - You must have a counter for the time in nanoseconds (ns)    - change speed of simulation (example 1s=8ns or 1s= 20ns or etc...)    - set Speed ​​in m / s (typically between 1'000 and 10'000 m / s)    - Set the Gaussian function manually by entering the value of A and B, which is A = 2 * sigma ^ 2    - Enter the rulers on board page in mm    - You can manually choose the size (x and y) of the working window in mm    - The particle would bounce off the walls, up and down of the page, but go trought left end right. (as a particle in a tube infinite.)If you set this becomes a simulation fantastic for particles charged.thanks for the simulation again. Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: Fu-Kwun Hwang on June 27, 2013, 11:19:35 pm For a simulation, the scale/unit of physics properties is not fixed.e.g. the screen width can represent 1cm or 1km. It is depends on how you choose the unit.I did add several sliders for user to adjust related parameters.Could you provide a simple drawing about the ruler? and what is the role for the ruler?Click the eye (image) to display the simulation[eye][ejsapplet][/eye] Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 28, 2013, 12:11:08 am So thank you you for your attention to me.then the ruler would need to figure out what size of screen you are viewing in mm (millimetres).the ruler is in the fig. It must be similar or as you want( in mm) !!!regarding sigma could come down to smaller values ​​0.07, to 0.01?for charge + e - and setting the charge is ok!lacks the ability to set, the value of the magnetic field B we say teslaexample 0.45 TI do not understand the speed and the mass, in which units of measurement have been set.or that represent the values. maybe  m=1 rapresent 5*10^-26Kg and v=1 apresent 1000 m/s?regarding the particle, I would like once out of the design did not fit more on the screenyou might choose as the unit of measure mm? I saw that in previous simulations could choose the unit in micrometers.ever you feel like it could also kindly put the counter of nanosecondsyou can not choose the size of the work area, which is where the particle undergoes the strength of the magnetic field, always in mm?thanks so much professor ;D Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 28, 2013, 01:23:00 am then the program should look more or less like to be functional. I enclose a photo of the finished program.we have a work area, a ruler, comment on the unit of measure, a long, fast, 1s = 100ns, slow, 1s = 30ns, or very fast, 1s = 500ns.you can set the  work area  in millimeters, both x and y.you can set the field B in tesla.in the image there is a error!!! the velocity must be V=v*10'000 m/s and not V=v*1000 m/s because the v range between 0 and 1. Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: Fu-Kwun Hwang on June 28, 2013, 07:46:27 am I modified it with some of your suggestions.I did not add slider for x,y because you can drag particle to any position with your mouse.Or do you want numerical value for x and y?The unit for B is T, for time is us, for m is $10^{-26}$kg, for q is $10^{-19}$C, for v is km/s,it is cm for the coordinate unit.You can read the coordinate when you press mouse inside the screen. I can add ruler if you still need it.Click the eye (image) to display the simulation[eye][ejsapplet][/eye] Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: Fu-Kwun Hwang on June 28, 2013, 08:01:09 am The above simulation was uploaded again. It should work fine now. Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 28, 2013, 03:46:55 pm thank you so much for taking the time to improve the simulation.there are things that do not go unfortunately! :'(- The mass is wrong,must be 10 ^-26Kg, and no, 10 ^ 26kg, must be a mass comparable to that of molecular oxygen, or molecular nitrogen.- The cursor volocità must reach 20 km / s, starting from zero, as it is now.- The particle bounces off walls, above and below, and it is ok, but returns in the video, if it comes out right and left, this effect is not good, please eliminate it, is not realistic.- Can You, please, put the default positively charged particle?are better numerical values ​​of x and y, you can choose the work area as shown in figure I sent you. to remember is that the particle must bounce up and down and left and raises must go away from the work area and not return inside the area. as in figure. can you, please, add the direction of B whit a tridimensional axis? thankshowever there is something wrong with simulation with these values. if r = mv / qB, setting values, sigma = 2.5, m = 10 ^ 26Kg, v = 0.20km / s, B = 5T, q =1.6*10^-19 and, by placing the particle in the middle of the screen, is obtained a radius of curvature of 2.5 * 10 ^ 46 m instead on the screen is seen that the radius of curvature is about 2 cm!Thank you very much professor of patience ;D Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: Fu-Kwun Hwang on June 28, 2013, 04:45:46 pm Sorry! The unit for the mass is $10^{-26}$kg.  Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 28, 2013, 04:59:56 pm there is nothing to forgive, you are doing so much for me.I'm a materials scientist and expert autodesk inventor (3D modeling software), an expert in simulations with magnetic fields in 2D with PERMAG, and expert at using of software for the structural dimensioning, so if you need anything in particular has the my email and free as you are doing. Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: Fu-Kwun Hwang on June 28, 2013, 05:53:50 pm I modify the code so that the velocity can be adjust to 20km/s, however, you better to change the time step to smaller value.The unit for change has been change to e (1.6*10^{-19})$The program will change the scale if the particle come out right/left.The bounce off the wall (above/below) kept the same.Click the eye (image) to display the simulation[eye][ejsapplet][/eye] Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 28, 2013, 08:28:13 pm thanksI discovered that the unit of measure of the point xy is the decimeter.i have found that deltax=1 corrispond 1=100micrometres you could do so to be able to save changes to the default settings? eg if I set sigma = 2.4 then I should be able to save the change that I would see when I press the reset. enter the rulers in centimeters or decimetres for both x and y thanks I'd like to have the possibility to set the height of the work area, not just the scale with a slider that starts from 1 centimeter up to 20 centimetersthe program is almost ready ;D Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: Fu-Kwun Hwang on June 28, 2013, 08:53:30 pm Save the state of a simulation is a build in function for simulation created with EJS.You can download the jar file and double click it to run it.Right click in the simulation region, and you will find menu to save the state of your simulations (you can save as many as you like).You can load the state , and the simulation will be back to when it was saved.QuoteI'd like to have the possibility to set the height of the work area, not just the scale with a slider that starts from 1 centimeter up to 20 centimetersWould you like the range for width/height to be entered with numerical value instead of changed with slider?What about the range for the wall ?(for particle to bounce up and down). Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 28, 2013, 09:08:33 pm then for height work area is the image ??? there was something wrong with the unit size and I found that the program a unit corresponds to 1 = 100 micrometers!! :oI have to use a workspace much larger unfortunately.you could make a work area, height, between 1 and 30 cm?i need a work area of (1500) unit up (positive y) and -1500 unit (negative y)the value of sigma must be bigger in the slider from 0.01 to ??. i must have zero from y=-5cm (500 unit left) to y=5cm (500 unit right)if i cant see the form of gaussian funtcion is not important is important the work area:)the value x=1=100um is must be write for the userthe programm work correctly but the work area is too small. Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: Fu-Kwun Hwang on June 28, 2013, 11:36:06 pm Another slider was added to change the y-scale. Slider for x-scale was moved to the top.You can enter value for x,y coordinate.Click the eye (image) to display the simulation[eye][ejsapplet][/eye] Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 28, 2013, 11:44:33 pm thanks Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 28, 2013, 11:50:50 pm guardare il prossimo messaggio per favoreplease see the next message Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 29, 2013, 12:00:29 am thanks for the time spend to me. ;Dsorry but i cant see the time at large value of x e y. can you put the time in the middle of screen?slider y must reach 1500 (positive value), because x or y = 1 = 100um yetso I have to be able to read on the screen y = 1500 y = -1500the value of sigma must reach 300 from 0.01then the view of the Gaussian function could be enlarged with the increase of the work area?thanks Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: Fu-Kwun Hwang on June 29, 2013, 06:47:14 am 1. The message for time has been moved to the center.2. You can enter scale by enter numerical value, so you can change the range for x and y to any value you want. (how ever you need to adjust other parameters so that the scale make sense).3. The max value can be change to 300 only when scale is set to larger than 20. (from 0.01 to 300 is a very large ratio, it does not make sense for large sigma with small range).4. The yscale for Gaussian function change according to bounce wall in the y-direction.Click the eye (image) to display the simulation[eye][ejsapplet][/eye]-*-The unit for the x,y coordinate is 10^{-4}m.For the default setting: m=$10^{-26}$kg, q=$1.6*10^{-19}$C, v=0.2 km/s, B=1 T$r\approx \frac{m v}{qB}=\frac{10^{-26} 0.2*10^3}{1.6*10^{-19}*1}=\frac{0.2}{1.6}10^{-4}=0.12*10^{-4}$(m) Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 29, 2013, 03:46:58 pm sorry professor but the r=1.25*10^-5 m is =0.125*10^-4 with default ;)so we have 0.0125 mm=12.5um-26+19+3=-4 so we have 0.2/1.6*10^-4on the screen i have a r (with default) of 0.125 unit arbitraryif we have 1 arbitrary unit= 100um(micrometres) we have:so we have 1/0.125=100um/x implies x=12.5umthe radius is effettive 12.5umthanks Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: Fu-Kwun Hwang on June 29, 2013, 03:59:48 pm You are right. I made a mistake. ;) Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 29, 2013, 04:05:02 pm thanks for the timebut i can't on the last version of the programm I can not get up the wall to the values ​​of y = 1500i put the value on the ywall=1500 but the wall does not move upplease can help me ;D Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 29, 2013, 04:17:55 pm I believe that the slides prevent the wall to get up. I would say to eliminate them and keep only the numerical values ​​of x and y. in my opinionthanks Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 29, 2013, 05:45:57 pm Yes, I'm almost certain that the problem is on the slides of x and y that prevent the wall to get up. :othanks Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: Fu-Kwun Hwang on June 29, 2013, 07:42:47 pm I made a mistake in the code. It should work fine now. (It is updated) Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 29, 2013, 08:12:33 pm then first of all thanks for simulationsimulation now works correctly but there would be so many parameters you can tweak.1. time step is expected to reach 0.500 us, from 0.01us, because the simulation is too slow at high value of scale eg 6002. the length of the black mark that represents the trajectory should be more long, it tends to disappear with the advance of the particle. at 600 scale3. the scale of 600, sigma must reach a maximum of 3000 and not 9000, as it is now, because the fixing of parameters is too difficult4. the dimension of velocity vector shoud be became largest if the scale increase. but not big only a bitthanks Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: Fu-Kwun Hwang on June 29, 2013, 08:53:29 pm Normally, I did not design simulation with scale changed with so much. Because a lot of parameters need to be adjusted at the same time. And it is very difficult for new user (novice).The code has been modified according to your new request. Click the eye (image) to display the simulation[eye][ejsapplet][/eye] Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 29, 2013, 10:16:54 pm sorry professor I found a possible error in the program.if I set B = 0 to verify that the speed is correct I find thatscale of wall 600if I put 1 (arbitrary units) = 100um i have that 10 km / s are 1 km / sif I put instead 1 (arbitrary units) = 1000um I find that 10Km / s are 10Km / sbut if I calculate the radius of curvature with any value of sigma B and I find that 1 (arbitrary units) = 100umwhere is the error, maybe in the time? ??? ??? ??? i need your help thanksi'm sure (maybe!!! ;D) that the time si ten times more big of normal1 arbitrary unit =100um yet if you put time divided by (time/10) e.g.default values but B=0 traiectory linear deltax=1.01 arbitrary units, time=5.05us1 arbitray units =100umif you choose time 5us you get 20m/s, not 0,2Km/sif you choose time 5us/10 get 200m/s, real 0.2Km/sdefault values B=1Tif you calculate the diametrer of traiectory you find1=100umas we told in the pastaddition to the time that must be divided by 10 should improve two parameters.1. at any scale, the cursor speed should not exceed 100Km/s are not relistic higher speed.2. the time step, at any scale, must not exceed 2us at higher values ​​the simulation is very badthanks Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 30, 2013, 03:02:56 am please also you could put a space where you can numerically enter the angle of the velocity vector (in short, choose the direction) using a numerical valueplease put in the video of the programm the (down and right) the written 1=100um is much important for the user and show with a figure the direction of B. thanks Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: Fu-Kwun Hwang on June 30, 2013, 08:12:05 am The time step and frame rate was not set correctly. It is done. It will be better if you can provide a jpg/gif file which show direction for B,x,y (lower left corner)Then, I will replace it. Click the eye (image) to display the simulation[eye][ejsapplet][/eye] Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 30, 2013, 02:49:49 pm thanks so much for the improve the simulation. i have attach a gif file for the axis. Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: Fu-Kwun Hwang on June 30, 2013, 03:08:39 pm It is updated again (in the previous message). Your image file is a large one so it is reduced in the simulation. The X,Y,B might not be so clear.Is the size OK? It will be better if the original image file is a small size. Or give me a image with the exact size to fit the simulation will be perfect. Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 30, 2013, 03:08:59 pm excuse professor but the problem of time persistsegdefault values ​​but B = 0in the latest version of the program:deltax = 1.35 units, deltatime = 6.784usif we have 1 = 100umwe have 135um and divided by deltatime you get 20m / sinstead the speed that is correct, and set to 200m / sso the time must be divided by 10 to a correct resultthanks Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 30, 2013, 03:19:11 pm this is a another gif. if you don't like tell me what you need :) Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 30, 2013, 03:26:17 pm there are other attachs Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: Fu-Kwun Hwang on June 30, 2013, 03:46:10 pm The simulation has been updated with latest image file.The mistake was from the mis-interpretation. It is correct now. (The unit for time is not us but 0.1 us, the display has been changed).Actually, the unit used in the simulation is v(m/s), m(kg), r(m), B(T), q (1.6 C)The default for the simulation is m=1kg, v=0.2m/s, B=1 T, q=1.6CFrom$r=\frac{mv}{qB}={1*0.2}{1.6*1}=\frac{1}{8}=0.125$However, you would like to change the interpretation.$m=1*10^{-26}kg, v=0.2 km/s, B=1T, 1=1.6*10^{-19}C$So$r=\frac{1*10^{-26}*0.2*10^{3}}{1.6*10^{-19}*1}=0.125*10^{-4}$mThat is why we call the 1 unit =100 um.Because the unit for space become 100um, the unit for speed become km/s So the time step is$10^{-4}/10^3= 10^{-7}\$s =0.1usIt should work fine now. Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 30, 2013, 04:07:51 pm ok you are right.   Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 30, 2013, 04:37:04 pm thanks now the programma work very well. Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 30, 2013, 05:00:50 pm professor thanks for your help. the program is finished.I thank you now for I can not do nothing but offer her my servicesas I said before I am able to:- Use photoshop cs3- Use autodesk inventor professional   . designs for mechanics   . jewelry   . laser cutting   . etc ...- Use programs for the calculation of structural mecchanic parts     . beams    . bolts    . toothed wheels    . etc ...- Use program for simulation of magnetic fields in 2d PERMAG- Use simple programs for the simulation of thermal exchange in 2d now and in the future in 3dsend me a mail (ony for professor FU-Kwung Hwang) whit your request and if i can i'll do it for free. ;DWe can became friend on facebook i have send you a request as Anto***** Daniele ;D Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: Fu-Kwun Hwang on June 30, 2013, 05:57:39 pm The final version is uploaded again for easy access.Click the eye (image) to display the simulation[eye][ejsapplet][/eye]You are welcomed. I only hope the final simulation is what you really need.Are you going to use the simulation for teaching? It take time to fully understand what you really want. And I also learn something during the process.Regards!  ;D Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 30, 2013, 06:23:30 pm not for teaching, other reason.thanks for have accept my request on facebook  ;DDo you like inventions? i like very much, from when i was a child, and I delight to do inventions in  mechanical.I needed this simulation to see if my idea was valid or not.it's valid!!!thanks so much professor and if you need something in the previuos my post, as said my god, you only have to ask and you will be given ;D Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: Fu-Kwun Hwang on June 30, 2013, 07:09:59 pm I hope your ideas can be realized soon!  :D Title: Re: charged particles and non uniform magnetic field/board:26-1- Post by: danielemateriale on June 30, 2013, 10:26:12 pm thanks :D