Creating New Inputs
===================

There are two different options for creating new inputs:

*   Generate a new input set using data available online
*   Change the parameters in an existing input

Creating New Input Set
======================

Creating an input set is not difficult (although it can be quite finicky). You will, however, need to install many libraries and auxiliary programs first.

Installing WRF
--------------

I would suggest that you download WRF version 3.6.1 because that is the version that they used to create the inputs for the SPEC CPU 2017 benchmark.

First, follow the instructions from <http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compilation_tutorial.php> up until you get to the section on actually running WRS/WRFV3 (this is done by a script).

WPS_GEOG is the folder for all of the general information needed for running the data found online, while you will need to create a folder called DATA to store specific online inputs. You will likely need to download almost all of the files from <http://www2.mmm.ucar.edu/wrf/users/download/get_sources_wps_geog.html>.

However, please note that the path to geog_data_path MUST be the absolute path.

The script assumes that all of the programs are stored in their own folders as described in the tutorial.

Additionally, you will also need OBSGRID, which is a bit more annoying to install.

Installing OBSGRID
-----------------

To install OBSGRID, first download the source from <http://www2.mmm.ucar.edu/wrf/src/OBSGRID.tar.gz>.

Extract the source into the directory OBSGRID that you installed all of the other programs for wrf (in their tutorial, they called it WRF_Build or something similar).

Then, in OBSGRID run ./configure, followed by ./compile >& log.compile.


When running the configuration file, we found that doing the following helped:
    - Reinstall netcdf using (Only do this after succesfully installing WRF + WPS):
        ./configure -prefix=$DIR/netcdf -disable-dap -disable-examples -disable-doxygen
        make
        make install

    - setenv NCARG_ROOT /usr/share
        (or equivalent for your shell)


    - In configure.oa, remove -C from the line
        CPP = ...

    - In configure.oa, add -lcairo -lfontconfig -lpixman-1 -lfreetype to the line
        NCARG_LIBS = ...

Then, re-run ./compile>& log.compile and it should work.

You have now installed everything necessary for running the script!


Running
-------

Once you have installed everything, download the dataset you want to use from   <http://www2.mmm.ucar.edu/wrf/OnLineTutorial/DATA/index.html>, or from <http://www2.mmm.ucar.edu/wrf/users/download/free_data.html>, and put it into the directory DATA, in a subdirectory which will be the name of the dataset. There will also need to be an OBSGRID_DATA directory inside of the subdirectory, which should hopefully come with the data.

There are three scripts, one that will do a single basic run, one that will set up pairs of parameters, and one that will exhaustively try all combinations of the given parameters.

For all of the scripts, to run them, execute:

    ./<scriptName> <startTime> <endTime> <intervalSeconds> <timeStep> <datasetName> <datasetFormat> <destination>

where:

*    startTime and endTime are in the format: `<year>-<monthNum>-<day>_<24hour>:<minute>:<second>`
    *   Month and days are indexed from 1.
    *   The information on what time range the dataset includes should be available on the site.
    *   Ex: 2005-08-28_00:00:00 is midnight on august 28, 2005.


*   intervalSeconds is the frequency of the data in seconds. So you need an input file for every one of these. Is fine to use the default of 21600.

*   timeStep basically determines how long the benchmark will run. The lower the number the longer it will take.

*   datasetName should be the name of the subdirectory storing the dataset.

*   datasetFormat is the format of the data in the dataset. This information should be available from where you downloaded the dataset, and is found for the instruction for "ln -sf ungrib/Variable_Tables/Vtable.<datasetFormat> Vtable".

*   destination is where the created workload should be placed.


Customizing the Run
-------------------

You can customize the variables by changing the file options.txt by writing them in the format:

    <name> <value>
    <name> <value>
    ...


The file options.gen.txt is a generated file, and do not change it since it will get overwritten.


Running a created input
-----------------------

To run a generated input, all you need to do is run wrf_r in the inputs folder, all of the parameters are stored in the namelist.input.


Changing Parameters
===================

Some of the most promising varaiables to change are those in the physics options in WRFV3. Of them, the one with the largest effect is mp_physics, which is the micro physics option. We have not tested all of the variables, so there may be others with a greater effect.

