home - login - register - about - sitemap
advanced search

Computer Program Detail Page

Item Picture

This ComPADRE record has not been chosen for inclusion into the Astronomy Center collection. If you feel this record should be included, you may contact the editor using our feedback form.

Magnetic Bar Field Model
written by Wolfgang Christian, Francisco Esquembre, and Anne Cox
The EJS Magnetic Bar Field Model shows the field of a bar magnet and has a movable compass that reports the magnetic field values. The bar magnet modelĀ is built by placing a group of magnetic dipoles along the bar magnet. You can modify this simulation if you have Ejs installed by right-clicking within the plot and selecting "Open Ejs Model" from the pop-up menu item.

The Magnetic Bar Field model was created using the Easy Java Simulations (Ejs) modeling tool.  It is distributed as a ready-to-run (compiled) Java archive.  Double clicking the ejs_em_MagneticBarField.jar file will run the program if Java is installed.  Ejs is a part of the Open Source Physics Project and is designed to make it easier to access, modify, and generate computer models.  Additional Ejs models are available.  They can be found by searching ComPADRE for Open Source Physics, OSP, or Ejs.

Please note that this resource requires at least version 1.5 of Java (JRE).
1 source code document is available
Subjects Levels Resource Types
Electricity & Magnetism
- Magnetic Fields and Forces
= Magnetic Fields
- Magnetic Materials
= Magnets
- Lower Undergraduate
- High School
- Instructional Material
= Activity
= Simulation
Intended Users Formats Ratings
- Learners
- Educators
- application/java
  • Currently 5.0/5

Rated 5.0 stars by 2 people

Want to rate this material?
Login here!

Access Rights:
Free access
This material is released under a GNU General Public License Version 3 license. Additional information is available.
Rights Holder:
Wolfgang Christian
Ejs, bar magnet, dipole, magnetic moment
Record Cloner:
Metadata instance created September 3, 2009 by Anne Cox
Record Updated:
May 31, 2016 by wee lookang
Last Update
when Cataloged:
September 3, 2009
Other Collections:

what it the cause of this runtime error?

Author: lookang
Posted: April 18, 2010 at 6:17AM
Source: The Open Source Physics collection

when i move the compass very quickly, sometimes it is possible to get a runtime error.
any idea how the error can be solved?
I tried to fix it but can't figure out the cause, i increase the array to nx and ny to [21] but that didn't solve the runtime error.

Exception in thread "Thread-3" java.lang.ArrayIndexOutOfBoundsException: 20
at org.opensourcephysics.drawing2d.VectorField.prepareField(Unknown Source)
at org.opensourcephysics.drawing2d.VectorField.draw(Unknown Source)
at org.opensourcephysics.display.DrawingPanel.paintDrawableList(Unknown Source)
at org.opensourcephysics.display.DrawingPanel.paintEverything(Unknown Source)
at org.opensourcephysics.display.DrawingPanel.render(Unknown Source)
at org.opensourcephysics.display.DrawingPanel.render(Unknown Source)
at org.colos.ejs.library.control.swing.ControlDrawablesParent.finalUpdate(Unknown Source)
at org.colos.ejs.library.control.EjsControl.finalUpdate(Unknown Source)
at org.colos.ejs.library.Animation.update(Unknown Source)
at org.colos.ejs.library.Animation.updateWhenIdle(Unknown Source)
at org.colos.ejs.library.control.EjsControl.updateSimulationWhenIdle(Unknown Source)
at org.colos.ejs.library.control.ControlElement.variablesChanged(Unknown Source)

deleted the rest due to character restriction of 2000

» reply

can add new feature?

Author: lookang
Posted: September 25, 2009 at 10:59AM
Source: The Open Source Physics collection

1. a flip magnet simulation possibility
2. better color for the rombus <> blue and red instead of the current teal and red.

can use the version here;topic=1210.0;attach=1368
i added some other features too.
2 added a slider to simulate "magnetic field strength = 10 to 100 percent"
3 fixed the randomization checkbox to work now by adding to randomPositionCheck Action setLocation ()
4 fixed a bug on the markergroup and imagemagnet position not fixed to (xMagnet,yMagnet)
5 show magnetic field inside the magnet made.

for your consideration :)

» reply

Post a new comment on this item
ComPADRE is beta testing Citation Styles!

Record Link
AIP Format
W. Christian, F. Esquembre, and A. Cox, Computer Program MAGNETIC BAR FIELD MODEL, Version 1.0 (2009), WWW Document, (
W. Christian, F. Esquembre, and A. Cox, Computer Program MAGNETIC BAR FIELD MODEL, Version 1.0 (2009), <>.
APA Format
Christian, W., Esquembre, F., & Cox, A. (2009). Magnetic Bar Field Model (Version 1.0) [Computer software]. Retrieved September 22, 2017, from
Chicago Format
Christian, W, F. Esquembre, and A. Cox. "Magnetic Bar Field Model." Version 1.0. (accessed 22 September 2017).
MLA Format
Christian, Wolfgang, Francisco Esquembre, and Anne Cox. Magnetic Bar Field Model. Vers. 1.0. Computer software. 2009. Java (JRE) 1.5. 22 Sep. 2017 <>.
BibTeX Export Format
@misc{ Author = "Wolfgang Christian and Francisco Esquembre and Anne Cox", Title = {Magnetic Bar Field Model}, Month = {September}, Year = {2009} }
Refer Export Format

%A Wolfgang Christian
%A Francisco Esquembre
%A Anne Cox
%T Magnetic Bar Field Model
%D September 3, 2009
%O 1.0
%O application/java

EndNote Export Format

%0 Computer Program
%A Christian, Wolfgang
%A Esquembre, Francisco
%A Cox, Anne
%D September 3, 2009
%T Magnetic Bar Field Model
%7 1.0
%8 September 3, 2009

Disclaimer: ComPADRE offers citation styles as a guide only. We cannot offer interpretations about citations as this is an automated procedure. Please refer to the style manuals in the Citation Source Information area for clarifications.

Citation Source Information

The AIP Style presented is based on information from the AIP Style Manual.

The APA Style presented is based on information from APA Electronic References.

The Chicago Style presented is based on information from Examples of Chicago-Style Documentation.

The MLA Style presented is based on information from the MLA FAQ.

This resource is stored in 2 shared folders.

You must login to access shared folders.

Magnetic Bar Field Model:

Is Based On Easy Java Simulations Modeling and Authoring Tool

The Easy Java Simulations Modeling and Authoring Tool is needed to explore the computational model used in the Magnetic Bar Field Model.

relation by Anne Cox

Know of another related resource? Login to relate this resource to it.
Save to my folders



Related Materials