I am following steps from here: https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compilation_tutorial.php
Get Data
I used curl to download some recent (low res, 1 degree) GFS forecast data (f000, f003 and f006)to a DATA directory on the server:
curl -O https://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs.20230118/00/atmos/gfs.t00z.pgrb2.1p00.f000
Prepare environment
Make sure that the WRF executables can find the libraries they need, using the bash file in your UCDWRF directory:
source set_env_WRF.bash
Run WPS
Next, edit namelist.wps. Check for correct dates, interval seconds between your input files, number of points west-east and south-north in your grid, dx and dy gridpoint spacing in metres, latitude and longitude values for your lambert projection.
Run geogrid.exe which should create geo_em.d01.nc
Next ./link_grib.csh to your downloaded GFS data.
Make sure you have the correct Vtable
ln -sf ungrib/Variable_Tables/Vtable.GFS Vtable
Run ungrib.exe, which should create a few FILE:2023-01-18_00…
Finally, run metgrid.exe, which should create met_em.d01.2023-01-18_00:00:00.nc files.
Remember to check the log files if you get any errors.
Run WRF
Move into the WRF/run directory and edit the namelist.input file so that it agrees with your namelist.wps file.
Link your met_em files into the run directory:
ln -s ../../WPS/met_em.d01.2023-01-18_0* .
Then run ./real.exe which should create the files wrfinput_d01 and wrfbdy_d01.
There is a workload manager on flynn called Slurm, and we will use it to add our WRF forecast to the queue. First, you need a file to submit your job to the queue. Here is a sample one, called MCCWRF.sbatch
#!/bin/bash
# Name of the job
#SBATCH -J MCCWRF
#SBATCH --ntasks=4
# Start the program
echo $PWD
source /home/conor/GITWRF2/UCDWRF/set_env_WRF.bash
date
srun echo "Starting WRF"
srun ./wrf.exe
echo srun command completed
date
Create this file in your WRF/run directory, making sure to change the path to your set_env_WRF.bash file.
Now you can submit your WRF forecast to the queue with the command
sbatch MCCWRF.sbatch
You can see which jobs are running, and which are queued by using the command
squeue
If you submit a forecast by mistake, and want to remove it from the queue, use the squeue command to find the number of your job, and then cancel it using the scancel command with your job number. For example, to cancel job number 14:
scancel
14
Once your job has finished running (you will no longer see it on the queue), you should see wrfout_d01_2023-01-18_00:00:00… files. Congratulations, you have run a weather forecast!