diff --git a/Homework4/README.md b/Homework4/README.md index a1cea9a..ec53076 100644 --- a/Homework4/README.md +++ b/Homework4/README.md @@ -1,57 +1,57 @@ # SP4E - Homework 4 ---- ## General Info This file provides a brief documentation and information related to the fourth (last) Homework of the course "Scientific Programming for Engineers", fall 2019. This homework is done by **O. Ashtari** and **A. Sieber**. Last update: 15.01.2020 ---- ## Project Description ---- ## Executable Files ---- ## Optimization routine The optimization routine `error_minimization.py` is intended to minimize the error on Mercury trajectory (or any other planet of the solar system) by scaling the initial velocity of the planet of interest. The minimization is performed by computing the error between the computed planet trajectory and a reference planet trajectory. This routine calls `main.py`, therefore, in order to run it, the user must first make sure she/he can launch the particles code through the python interface. Once the requirement is satisfied the `error_minimization.py` routine can be called as follow: ``` $ python3 directory_comp directory_ref planet input_file scale nb_steps freq ``` where: * `directory_comp`, the path to the directory containing the computed trajectory data. * `directory_ref`, the path to the directory containing the reference trajectory data. * `planet`, the planet of interest. * `input_file`, the file containing the initial state of the different planets. * `scale`, the initial scaling factor (initial guess of the minimization). * `nb_steps`, the number of time steps of the simulation within the particles code. * `freq`, the dumping frequency at which the particles code writes outputs. As an example a minimization on Mercury trajectory over 365 days with a dumping frequency of 1 day could be run as such: ``` $ python3 dumps trajectories mercury init.csv 1.0 365 1 ``` The `error_minimization.py` routine then prints the scaling factorminimizing the error, the value of this error and the amount of minimization iterations needed to reach an optimum. It moreover plots the evolution of the error versus the scaling factor as shown below. -![Minimization evolution for Mercury](build/src/minimization_evolution.png) +![Minimization evolution for Mercury](optimization_example/minimization_evolution.png) ---- ## Comment on how createSimulation function is overloaded -To comment on this function overload, let's first discuss what is the role of `createComputes` in the whole code. In the `ParticlesFactoryInterface` class, `createComputes` is defined as a function which is to be defined later, if needed. In the constructor of `MaterialPointsFactory`, `createComputes` is defined to be the default function (i.e. to be `createDefaultComputes`.) In the default function, `ComputeTemperature` is added to the system evolution object. Similarly in the `PlanetsFactory` where `createComputes` is defined to be `createDefaultComputes` in which `verlet` is added to the system evolution object. +To comment on this function overload, let's first discuss what is the role of `createComputes` in the whole code. In the `ParticlesFactoryInterface` class, `createComputes` is defined as a function which is to be defined later, if needed. In the constructor of `MaterialPointsFactory`, `createComputes` is defined to be the default function (i.e. to be `createDefaultComputes`.) In the default function, `ComputeTemperature` is added to the system evolution object. Similarly in the `PlanetsFactory` where `createComputes` is defined to be `createDefaultComputes` in which `verlet` is added to the system evolution object. diff --git a/Homework4/optimization_example/minimization_evolution.png b/Homework4/optimization_example/minimization_evolution.png new file mode 100644 index 0000000..e7d8932 Binary files /dev/null and b/Homework4/optimization_example/minimization_evolution.png differ