If you meet all the [requirements](mar-forecast-intro) to set up a MAR-based weather forecast, follow the next steps carefully to first set up a folder hierarchy that will act as the backbone of the forecast.
1. On your target computer (i.e. where the forecast will run), e.g. a cluster, create a new directory at a suitable location to store the software and main resources of the operational forecast chain. **This directory must be permanent** as it will both contain the main software, the `MARsim` archives used for the forecast as well as logs written by various parts of the operational chain. This directory will be subsequently refered to as `$DIR`.
2. Copy the following contents from this `git` repository in `$DIR`: `bin`, `python`, `MAR_forecast.bash` and `MAR_hindcast_ERA5T.bash`. Make sure all `.bash` scripts are executable (``chmod +x my_script.bash``).
3. Review the folders listed in ``bin/variable.bash``, starting from line 50, and create new empty folders with the same names in `$DIR`.
4. Copy the input files for your NESTOR domain in ``nst-in``. To get these input files, you can run a short NESTOR job and abort it right after the appearance of the `NESTOR.log` file in the work directory of NESTOR. The `input` folder will contain the input files tailored to your domain and the initial forcings of the jobs. To only keep the former, copy only the subdirectories of `input` in `nst-in`.
5. Next, copy in `nst-src` the content of your `~/MAR/sim/DOM/input/NESTOR` folder (where `DOM` is your domain), omitting `input`, `ctrl`, `doc` and `run`, in ``nst-src``. Replace the initial `input` folder by a symbolic link towards ``../nst-in`` and create an empty `output` folder. As for the `NSTing.ctr` file, rename it `NSTing.ctr-src`. Inside of it, replace the `Large-scale model` with `GFS`, and write `YYYY,MM,DD,00` at the line containing `DATE of RUN START`. At the line containing `RUN LENGTH`, write `10,00` (10 day forecast). Make also sure that `filtering of topography` is set to `T`. This `NSTing.ctr-src` file will act as a template for writing the actual control file of NESTOR while running the operational chain.
6. Copy your most recent `MARsim` archive (from `~/MAR/out/DOM/input/MARsim/EXP/` where `DOM` is your domain and `EXP` your simulation) into `mar-in`, and create a symbolic link towards it named ``MARsim_YYYYMMDD00.tgz``. E.g., if your `MARsim` archive is `MARsim_a01.2025.04.01.DAT.tar.gz`, the symbolic link will be ``MARsim_2025040100.tgz``.
7. In `mar-src`, copy the executable of your MAR simulation and create a symbolic link to it named `MAR.exe`. You can also copy your executable in a separate directory or even rename the executable (instead of using a symbolic link); what matters the most is the `MAR.exe` name can be used to run your MAR executable.
8. Still in `mar-src`, copy all the files that are normally present in a MAR working directory at start, with the exception of lateral boundary forcings (which will come from the `MARsim` archives). This includes the typical contents of `~/MAR/src/datMAR` and from `~/MAR/usr`, and in particular `ICEvou.dat` (to tune your output variables).
9. Still in `mar-src`, add your (uncompressed) `MARdom_DOM*.dat` file (normally found compressed in `~/MAR/sim/DOM/input/MARdom/EXP` where `DOM` is your domain and `EXP` your simulation) and create a symbolic link to it named `MARdom.dat`.
10. Copy your typical `MARctr.dat` and `MARscenario.ctr` files in `mar-src`. If you do not know what they look like, re-run any period of your MAR simulation, abort the job soon after launch and copy the files of the same name you will find in the work directory of MAR. Don't forget to clean up after (i.e., delete the work directory of the aborted job).
11. Edit your `MARctr.dat` file to adjust the `np` variable. Indeed, the `np` variable indirectly controls the duration of a single MAR run, and for the needs of the operational chain, this duration must be adjusted to a single day. The product of the `dt`, `nboucl` and `np` variables must be equal to the number of seconds elapsed in a single day, i.e., 86400 seconds. The former two variables are parameters of your simulation that shouldn't be edited.
12. Finally, review carefully and edit the `bin/region.bash` file. This file centralizes environment variables used by the forecast operational chain, such that you will not have to review and edit each script yourself to tune it for your area of interest. In particular, you have to give the dimensions of your MAR grid and the target coordinates ranges of the forcings pre-processed for NESTOR. The `bin/region.bash` file also lets you decide whether or not you need to build atmospheric forcings for the NEMO model from the MAR outputs.
If you are done with this tutorial, you can move on with [making your MAR simulation catch up with the present](mar-forecast-era5t) thanks to ERA5T data.