This topic describes how to run Weather Research and Forecasting Model (WRF) in an Elastic High Performance Computing (E-HPC) cluster for a meteorological simulation.
WRF is a next-generation mesoscale numerical weather prediction system designed for both atmospheric research and operational forecasting applications. WRF can produce simulations based on actual atmospheric conditions or idealized conditions. The model serves a wide range of meteorological applications. It uses a software architecture that allows for parallel computation and system extensibility. For more information, visit the WRF official website.
Before you begin
Create an E-HPC cluster. For more information, see Create a cluster by using the wizard.
Configure the following parameters.
Deploy a standard cluster that consists of two management nodes, one compute node, and one logon node. All nodes are ecs.c7.large Elastic Compute Service (ECS) instances. Each instance has 2 vCPUs, 4 GiB of memory, and one 2.7 GHz third-generation Intel Xeon Scalable (Ice Lake) processor.
Deploy a CentOS 7.6 public image and the Slurm scheduler. Turn on VNC.
Create a user. For more information, see Create a user.
The user is used to log on to the cluster, compile LAMMPS, and submit jobs. Grant the sudo permissions to the user.
Install WRF. For more information, see Install software.
Install the following software:
Step 1: Configure the namelist.wps file
The namelist.wps file is a shared file of WRF Preprocessing System (WPS). It is used to set the parameters of main programs, including geogrid.exe, ungrib.exe, and metgrid.exe. Each main program has an exclusive namelist record named &geogrid, &ungrib, and &metgrid. The three programs have a group record named &share that each program reads. The following example shows the recommended values of the required parameters. For the parameters that are not described in the following example, use the default values. For information about the parameters and parameter descriptions of the namelist.wps file, visit the WRF official website.
In this example, namelist.wps resides in the
# &share &share wrf_core = 'ARW', # wrf_core: Specify the WRF dynamical core. Valid values: ARW and NMM. Default value: ARW. start_date = '2005-08-28_00:00:00', # start_date: Specify the start time of the simulation. end_date = '2005-08-29_00:00:00', # end_date: Specify the end time of the simulation. interval_seconds = 21600, max_dom = 1, # max_dom: Specify the total number of model domains, including nests. In this example, a domain is selected. io_form_geogrid = 2, # io_form_geogrid: Specify the format of geogrid output files. # &geogrid # &geogrid specifies information such as the parent domain, parent-to-nest domain grid size ratio, and map projection. &geogrid parent_id = 1, parent_grid_ratio = 1, i_parent_start = 1, j_parent_start = 1, # Specify the number of grid points in the west-east direction and that of grid points in the south-north direction. In this example, set the values to 98 and 70. e_we = 98, e_sn = 70, geog_data_res = 'default', # Specify the grid lengths in the west-east direction and in the south-north direction. Unit: meters. In this example, set the values to 30000 and 30000. dx = 30000, dy = 30000, # Specify the projection. For more information, visit the WRF official website. map_proj = 'mercator' # Specify the latitude and longitude of a known location in the domain. ref_lat = 25.00, ref_lon = -89.00, # Specify the parameters of the map projection. The values vary with projections. truelat1 = 0.0, truelat2 = 0.0, stand_lon = -89.0, geog_data_path = 'Path of static geographical data' # &ungrib &ungrib out_format = 'WPS', # out_format: Specify the format of the intermediate files generated by ungrib.exe for metgrid.exe to read. Valid values: WPS, SI, and MM5. Default value: WPS. prefix = 'FILE' # prefix: Specify the prefix of the intermediate files. The prefix can include a path. # &metgrid &metgrid fg_name = 'FILE', # fg_name: Specify the prefixes of the intermediate files generated by ungrib.exe. io_form_metgrid = 2, ## io_form_metgrid: Specify the I/O format of the metgrid output file. Valid values: 1, 2, and 3. 1 specifies a binary file with an extension of .int. 2 specifies a NetCDF file with an extension of .nc. 3 specifies a GRIB 1 file with an extension of .gr1.
Step 2: Run geogrid.exe
The geogrid.exe program defines the model horizontal domain and horizontally interpolates static geographical data to the model domain.
Log on to the cluster.
Log on to the cluster as the sudo user. For more information, see Log on to a cluster.
Install NCAR Command Language (NCL). For more information, visit the NCL official website.
Check whether the required software of WRF is installed in the cluster.
export MODULEPATH=/opt/ehpcmodulefiles/ module avail
Load the WRF software environment.
module load wrf-mpich/3.8.1 mpich/3.2 echo $WPSHOME $WRFHOME
Copy the installed WPS and WRF software to the working directory.
cp -r $WPSHOME $WPSCOPYHOME cp -r $WRFHOME $WRFCOPYHOMENote
$WRFCOPYHOMEin the preceding code with the actual working directory, for example,
Download and decompress the geographical data file.Note
In this example, the geog_complete.tar.gz file is used. You can also download a different geographical data file based on your needs. For more information, visit the WRF official website.
cd /home/wrftest/WPS wget https://www2.mmm.ucar.edu/wrf/src/wps_files/geog_complete.tar.gz tar -zxvf geog_complete.tar.gz
Link the GEOGRID.TBL file.
The GEOGRID.TBL file determines which fields are interpolated by geogrid.
ln -s geogrid/GEOGRID.TBL GEOGRID.TBL
Interpolate static geographical data to the model domain.
After geogrid.exe is run, the geo_em.d0N.nc file is generated in the WPS directory. The following result is returned.
Step 3: Run ungrib.exe
The ungrib.exe program extracts meteorological fields from GRIB files.
Download and decompress the meteorological data file of Hurricane Katrina.
wget http://www2.mmm.ucar.edu/wrf/TUTORIAL_DATA/Katrina.tar.gz tar -zxvf Katrina.tar.gz
Link the data file to the WPS directory.
Link the Vtable of the data file.
In this example, Vtable.GFS is used. You can also select a different Vtable based on your needs.
ln -sf ungrib/Variable_Tables/Vtable.GFS Vtable
Extract the required meteorological fields.
After ungrib.exe is run, files named in the FILE:YYYY-MM-DD_hh* format are generated in the WPS directory. The following result is returned.
Step 4: Run metgrid.exe
The metgrid.exe file horizontally interpolates meteorological fields to the model domain determined by geogrid.exe.
Link the GEOGRID.TBL file.
The GEOGRID.TBL file defines how metgrid.exe horizontally interpolates meteorological fields to the model domain.
ln -s metgrid/METGRID.TBL.ARW METGRID.TBL
Horizontally interpolate meteorological fields to the model domain determined by geogrid.exe.
After metgrid.exe is run, files named in the met_em.d0N.yyyy-mm-dd_hh:mm:ss.nc format are generated in the WPS directory. The following result is returned.
Step 5: Run wrf.exe
The wrf.exe program stores the forecast data. Before you run wrf.exe, define the namelist.input file. The parameters about &time_control and &domains in the namelist.input file must be the same as those in the namelist.wps file. For more information, visit the WRF official website.
In this example, namelist.input resides in the
Go to the WRFV3 directory.
Import the processing result of WPS.
ln -s /home/wrftest/WRFV3/run/met_em*
Initialize simulation data.
After real.exe is run, the wrfinput.d0N and wrfbyd.dxx files are generated in the
Export the forecast data.
mpirun -np 10 /home/wrftest/WRFV3/run/wrf.exe
After wrf.exe is run, the wrfout.d0N_[date] file is generated in the WRF directory.
Create NCAR Graphics images for the WRF result, as shown in the following figure.