# GSim

by Ian Ruchlin 2018 http://ruchlin.com

Developed with OpenJDK 1.8.0_172

Using library JFreeChart 1.5.0


## Quick Start

Navigate to the GSim root directory and enter the command 
`java -jar GSim.jar` to run the program. Some information 
about the state of the simulation is displayed in the terminal.
Nearly every element of the interface has a tooltip for more

## Compiling

### Updating the Library Path in Eclipse IDE

The JFreeChart library is used to generate
realtime plots of simulation data. To add
the required libraries to the build path, 
use the navigation menu `Project -> Properties`.
On the left-hand-side menu, select
`Java Build Path`. Click the tab labeled
`Libraries`. Click the button labeled
`Add JARs...`. Navigate to `gsim/lib/`.
Add the JAR files `jcommon-1.0.23.jar` and
`jfreechart-1.0.19.jar`. All of the other
libraries used by GSim are part of the ordinary JDK.

### Code Structure

GSim is built upon a simple model-view-controller
architecture pattern. The state of the simulation
and the evolution rules are modeled in the Stage.
The Stage renders the position of each body, and
derived accuracy indicators are viewed in the
Plotting module. The Control and Stage modules
accept input from the user.

* GSim.java
	* GSim class, extends JFrame, main function
	* Create GUI and initialize Control, Stage, and Plotting panels
* Control.java
	* Control class, extends JPanel
	* State tab
	* Plotting tab
		* Realtime plot rendering settings
			* Sampling interval
			* Width of the plot time axis
	* Advanced tab
		* Numerical integration settings
			* Stormer-Verlet 2nd and 4th order (symplectic)
			* Runge-Kutta 2nd and 4th order (dissipative)
			* Variable time step size
* Stage.java
	* Stage class, extends JPanel
	* Interactive live rendering of body positions
	* User clicks to add a body at the cursor position, drags to specify initial velocity magnitude and direction
* Plotting.java
	* Plotting class, extents JPanel
	* Realtime graphical line plots show simulation data
	* Conserved quantities, such as energy and momentum, serve to measure numerical error