<commit_before># Project Three 

![Travis CI](https://travis-ci.org/Caronthir/FYS3150.svg?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/Caronthir/FYS3150/badge.svg?branch=master)](https://coveralls.io/github/Caronthir/FYS3150?branch=master)
<a href="https://scan.coverity.com/projects/fys3150">
  <img alt="Coverity Scan Build Status"
       src="https://scan.coverity.com/projects/14080/badge.svg"/>
</a>

<p align="center">
<b><a href="#overview">Overview</a></b>
|
<b><a href="#analysis-scripts">Analysis Scripts</a></b>
|
<b><a href="#usage-c">Usage (C++)</a></b>
|
<b><a href="#testing-c">Testing (C++)</a></b>
|
<b><a href="#usage-julia">Usage (Julia)</a></b>
|
<b><a href="#credits">Credits</a></b>
|
<b><a href="#license">License</a></b>
</p>
<br>


<!-- <img height="700px" align="center" src="latex/figures/solarsys.png?raw=true"> -->
![Animation of the solar system](https://github.com/Caronthir/FYS3150/blob/master/Project3/latex/figures/animation.gif)

## Overview
The aim of [Project 3](https://compphysics.github.io/ComputationalPhysics/doc/Projects/2017/Project3/pdf/Project3.pdf) in FYS3150
is to develop code for simulating the solar system using Euler's Forward method and Velocity Verlet.
This is implemented in both C++ and Julia, and further analysis and plotting is done by Python. 
Python is also used for collecting the initial conditions from [NASA](https://ssd.jpl.nasa.gov/?horizons).
The report itself and associated LaTeX files are available in the `latex` directory.

## Analysis Scripts

There are several Python scripts which do the analysis of the output from the C++ program. Here follows a
list explaining what each of them do

| Script                  | Function                                                                                                          |
| ------                  | --------                                                                                                          |
| `getnasa.py`            | Contacts NASA through telnet and downloads all bodies in the targets.txt file into a JSON file                    |
| `analyze.py`            | A general script which plots the position, energy and angular moment from the output. Can also animate the orbits |
| `batchrun.py`           | Compares Euler and Verlet in terms of running time                                                                |
| `findescapevelocity.py` | Uses a clever methods to find the escape velocity of earth                                                        |
| `jupiterrunner.py`      | Solves the 3-body problem with the Sun, Earth and Jupiter                                                         |
| `perihelion.py`         | Measure the perihelion precession of Mercury from the relativistic correction                                     |


## Usage (C++)

Compilation of the C++ program requires C++14, Armadillo version 6.7, CMake version 3.1 and JSONcpp. On Ubuntu these can be installed with
```console
sudo apt-get install cmake liblapack-dev libblas-dev libbost-dev libarmadillo-dev libjsoncpp-1 libjsoncpp-dev
```
Note that the path to jsoncpp is not standardized. This program assumes it lies in `<include path>/jsoncpp/json/json.h`. 
If you get a compilation error, create a symlink from the path to your `json.h` to `jsoncpp/json/json.h`.

If the
requirements are satisfied, the makefile can be created and run with

```console
cmake . && make
```

After initial compilation, typing `make` will make the program. To run the
compiled program, type `./solve`. Optional flags exist, see `./solve -h`.
The resulting data can then be analyzed
by the python script in the analysis directory using `python analyze.py ../cpp/data`.


The rapport and all supporting material is located in the `latex` directory.
The document is compatible with PdfLaTeX, LuaTeX and XeLaTeX.

## Testing (C++)
Testing is not implemented in the C++ version.
<!-- The framework [Google Test](https://github.com/google/googletest) is used to write unit tests. Google test is -->
<!-- imported as git submodule. To make it work, type -->

<!-- ```console -->
<!-- git submodule init -->
<!-- git submodule update -->
<!-- ``` -->

<!-- Google test is fully integrated into CMake, making it easy to both add and run the tests. In order -->
<!-- to compile the tests, type `cmake -Dtest=ON`. For actually running the tests, run `./runUnitTests` or -->
<!-- `make test`. -->

<!-- Better support for debugging and stricter compiler flags can be turned on using `cmake -DCMAKE_BUILD_TYPE=DEBUG`. -->

## Usage (Julia)
The Julia version is not completed, and does not count as a part of this assignment.
The version of Julia required is at least 0.6.0

These can be tested by running
`julia test.jl`.

## Credits
The contributors of this project are <NAME> and <NAME>.

## License
This project is licensed under the terms of the **MIT** license.
You can check out the full license [here](../LICENSE)<commit_msg>Fix spelling<commit_after># Project Three 

![Travis CI](https://travis-ci.org/Caronthir/FYS3150.svg?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/Caronthir/FYS3150/badge.svg?branch=master)](https://coveralls.io/github/Caronthir/FYS3150?branch=master)
<a href="https://scan.coverity.com/projects/fys3150">
  <img alt="Coverity Scan Build Status"
       src="https://scan.coverity.com/projects/14080/badge.svg"/>
</a>

<p align="center">
<b><a href="#overview">Overview</a></b>
|
<b><a href="#analysis-scripts">Analysis Scripts</a></b>
|
<b><a href="#usage-c">Usage (C++)</a></b>
|
<b><a href="#testing-c">Testing (C++)</a></b>
|
<b><a href="#usage-julia">Usage (Julia)</a></b>
|
<b><a href="#credits">Credits</a></b>
|
<b><a href="#license">License</a></b>
</p>
<br>


<!-- <img height="700px" align="center" src="latex/figures/solarsys.png?raw=true"> -->
![Animation of the solar system](https://github.com/Caronthir/FYS3150/blob/master/Project3/latex/figures/animation.gif)

## Overview
The aim of [Project 3](https://compphysics.github.io/ComputationalPhysics/doc/Projects/2017/Project3/pdf/Project3.pdf) in FYS3150
is to develop code for simulating the solar system using Euler's Forward method and Velocity Verlet.
This is implemented in both C++ and Julia, and further analysis and plotting is done by Python. 
Python is also used for collecting the initial conditions from [NASA](https://ssd.jpl.nasa.gov/?horizons).
The report itself and associated LaTeX files are available in the `latex` directory.

## Analysis Scripts

There are several Python scripts which do the analysis of the output from the C++ program. Here is a
table explaining the function to each script. Python 3.6 is required.

| Script                  | Function                                                                                                          |
| ------                  | --------                                                                                                          |
| `getnasa.py`            | Contacts NASA through telnet and downloads all bodies in the targets.txt file into a JSON file.                   |
| `analyze.py`            | A general script which plots the position, energy and angular moment from the output. Can also animate the orbits.|
| `batchrun.py`           | Compares Euler and Verlet in terms of running time.                                                               |
| `findescapevelocity.py` | Uses a bijection method to find the escape velocity of Earth.                                                     |
| `jupiterrunner.py`      | Solves the 3-body problem consisting of the Sun, Earth and Jupiter.                                               |
| `perihelion.py`         | Measure the perihelion precession of Mercury from relativistic effects.                                 |


## Usage (C++)

Compilation of the C++ program requires C++14, Armadillo version 6.7, CMake version 3.1 and JSONcpp. On Ubuntu these can be installed with
```console
sudo apt-get install cmake liblapack-dev libblas-dev libbost-dev libarmadillo-dev libjsoncpp-1 libjsoncpp-dev
```
Note that the path to jsoncpp is not standardized. This program assumes it lies in `<include path>/jsoncpp/json/json.h`. 
If you get a compilation error, create a symlink from the path to your `json.h` to `jsoncpp/json/json.h`.

If the
requirements are satisfied, the makefile can be created and run with

```console
cmake . && make
```

After initial compilation, typing `make` will make the program. To run the
compiled program, type `./solve`. Optional flags exist, see `./solve -h`.
The resulting data can then be analyzed
by the python script in the analysis directory using `python analyze.py ../cpp/data`.


The rapport and all supporting material is located in the `latex` directory.
The document is compatible with PdfLaTeX, LuaTeX and XeLaTeX.

## Testing (C++)
Testing is not implemented in the C++ version.
<!-- The framework [Google Test](https://github.com/google/googletest) is used to write unit tests. Google test is -->
<!-- imported as git submodule. To make it work, type -->

<!-- ```console -->
<!-- git submodule init -->
<!-- git submodule update -->
<!-- ``` -->

<!-- Google test is fully integrated into CMake, making it easy to both add and run the tests. In order -->
<!-- to compile the tests, type `cmake -Dtest=ON`. For actually running the tests, run `./runUnitTests` or -->
<!-- `make test`. -->

<!-- Better support for debugging and stricter compiler flags can be turned on using `cmake -DCMAKE_BUILD_TYPE=DEBUG`. -->

## Usage (Julia)
The Julia version is not completed, and does not count as a part of this assignment. 
This is left here to stand as a testament to the hubris of students.

The version of Julia required is at least 0.6.0

These can be tested by running
`julia test.jl`.

## Credits
The contributors of this project are <NAME> and <NAME>.

## License
This project is licensed under the terms of the **MIT** license.
You can check out the full license [here](../LICENSE)
{'fraction_non_alphanumeric': 0.11990455358918274, 'fraction_numerical': 0.010340027838536488, 'mean_word_length': 2.65515988372093, 'pattern_counts': {'":': 0, '<': 101, '<?xml version=': 0, '>': 101, 'https://': 18, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 31, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4181330', 'n_tokens_mistral': 2918, 'n_tokens_neox': 2726, 'n_words': 1068}