WRF (学内むけメモ)
WRF は、「Weather Research & Forecasting Model」
という気象の領域モデル (regional model) であり、
アメリカ合衆国の NCAR (National Center for Atmospheric Research) の
MMM (Mesoscale and Microscale Meteorology) 部門を本拠とする
チームによって開発されている。
そのウェブサイトは
http://www.mmm.ucar.edu/models/wrf である。
2025年10月の作業のためのメモ
この部分は作業中のおぼえがきであり、頻繁に書きかえる。
2024年8月12日の時点での内容から、
2025年度の作業がすすむにつれて書きかえていく。
当面の作業方針
研究室には Linux マシン hamana と niigata の2台がある。
2023年度に、hamana に WRF をインストールして実行した。
WRF の実行はとうぶんのあいだ hamana でおこなう。
WRF に必要なライブラリは 2023年度に用意したものを利用し、
WRF本体、WRFの入力を用意する WPS、WRFの出力を見る RIP は、
あらためてインストールする。
WRF の作業はおもに、hamana の外付けディスク /roisdisk に
ユーザーごとのディレクトリをつくり、その中でおこなう。
WRF についての保存すべき情報は /raid/wrf の下に置く。
インストールのための情報
- https://www2.mmm.ucar.edu/wrf/users/download/get_source.html
[WRF Source Codes and Graphics Software Downloads]
- 増田は大学のメールアドレスでユーザー登録してあるので、
returning users にすすむ。
- WRFモデル本体 (2025-10-23現在の最新版は 4.7.1。2024-08-01には 4.6.0 だった。)
- https://github.com/wrf-model/WRF/releases
- wrf-model
- WRF Version 4.7.1
- v4.7.1.tar.gz / 99.3 MB / Jun 3 [2025] ... 2025-10-23 これをダウンロードし、
/raid/wrf/sources に置いた。
- 入力データを準備するプログラム WPS (こちらは 2025-10-23現在の最新版が 4.6.0)
- https://github.com/wrf-model/WPS/releases/tag/v4.6.0
[WRF Pre-processing System Version 4.6.0]
- 2024年8月に v4.6.0.tar.gz をダウンロードした。
ダウンロードされたファイル名は WPS-4.6.0.tar.gz となった。
- 作業用ディレクトリ作成、コンパイルの準備
- cd /roisdisk/ユーザ名
- tar zxvf /raid/wrf/sources/v4.7.1.tar.gz
- ln -s WRFV4.7.1 WRF
- tar zxvf /raid/wrf/sources/WPS-4.6.0.tar.gz
- ln -s WPS-4.6.0 WPS
- https://www2.mmm.ucar.edu/wrf/OnLineTutorial/Introduction/index.php
[WRF-ARW Online Tutorial]
- https://www2.mmm.ucar.edu/wrf/OnLineTutorial/compilation_tutorial.php
[How to Compile WRF: The Complete Process]
- 問題点: ドキュメントは、ログインシェルが csh 系であることを前提としている。
hamana のデフォールトのログインシェルは bash (sh 系)。
ログインしたなかで csh を実行し、その中で作業するのがよいかもしれないが、
2025年度は bash のままでやってみる。
- System Environment Tests (2025年度は、2023年度整備ずみなので省略)
- Building Libraries (2025年度は、2023年度整備ずみなので省略)
- mpich ... 並列処理しなければ不要
- netcdf, netcdf-fortran ... 2023年度に /usr/local にインストールした
- jasper ... 2023年度に /usr/local にインストールした
- libpng, zlib ... OS標準でよいはず
- Library Compatibility Tests (2025年度は、2023年度整備ずみなので省略)
- Fortran_C_NETCDF_MPI_tests.tar
- MPIがかかわる部分のテストはしない
- Building WRF
- configure のまえに、netcdf のありかを指定。hamana で bash のばあいは 「export NETCDF=/usr/local」。
- ./configure
- コンパイラは gfortranで、並列処理はしないので、
WRF 4.7.1 のばあい、選択は 32 となる。
- nesting は、0, 1, 2, 3が選択できることになっている。
2 (preset moves) にしようとしたのだが、有効になってくれないので
(configure からの warning「The moving nest option is not available due to missing rpc/types.h file.」
これは -I/usr/include/tirpc で解決するかもしれないが、未確認)、
1 (basic) でやりなおした。
- configure からのもうひとつの warning
「Copy landread.c.dist to landread.c in share directory to bypass compile error.」 にはしたがっておく。
- ./compile em_real >& log.compile
- Static Geography Data http://www2.mmm.ucar.edu/wrf/users/download/get_sources_wps_geog.html
- 今回は 上記サイトからダウンロードした geog.high_res_mandatory.tar.gz を
あらかじめ /raid/wrf/WPS_GEOG に展開してある。
- Building WPS
- jasper ライブラリのありかを指定
- export JASPERLIB=/usr/local/lib
- export JASPERINC=/usr/local/include
- ./configure
- gfortran, serial (並列処理なし) なので、1を選択
- configure.wps の WRF_DIR = ../WRF はそのままでよい。
- configure.wps の geog_data_path = '/raid/wrf/WPS_GEOG'
- ./compile >& log.compile
- Real-time data
- https://www2.mmm.ucar.edu/wrf/users/ [WRF Model Users' Page]
- [Download / Input Data for WRF]
- https://www2.mmm.ucar.edu/wrf/users/download/free_data.html
- アメリカ合衆国 NOAA NCEP の現業予報の解析値による。
- リアルタイムのばあいは NOAA の NCEP (数値天気予報の現業機関) のサイトから
- 過去のデータのばあいは UCAR の NCAR (研究機関) のアーカイブから
- 日本の気象庁の MSM解析値などによることも可能だが、増田の準備ができていない。
- NCAR GDEX (Geoscience Data Exchange) [2024年までは RDA (Research Data Archive)、さらにむかしは DSS (Data Support Section) だった]
- NCEP Final Analysis (GFS-FNL)
- ds083.2 https://gdex.ucar.edu/datasets/d083002/ [NCEP GDAS Final Analysis (GFS-FNL) (1 degree)]
- ds083.3 https://gdex.ucar.edu/datasets/d083003/ [同 (0.25 degree)]
- ds084.1 https://gdex.ucar.edu/datasets/d084001/ [NCEP GFS (0.25 degree)]
- 2025-10-30 の作業では、対象日時が ds083.3 がはじまる前だったので、
ds083.2 を利用した。
- 2025-10-30 の作業では、NCAR GDEX の DATA ACCESS のうち、
「Web download」がうまくいかない。
(OSDF のサイトから韓国らしいサイトにredirect されるが、そこが応答しない。)
「Globus transfer」に進み、ORCID で Globus アカウントをつくってログインしたら、
ファイル1個ずつのダウンロードはできた。
(パソコンにダウンロードし、WinSCP で hamana の /roisdisk/masudako/FNL/ に置いた。)
- Running WPS
- namelist.wps を編集
- ひとまず 2重ネストのままにする。
- share のところでは、start_date, end_date を対象日時にする。(ネストの各段階とも同様に。)
interval_seconds は、境界値データの時間間隔が 6時間ならば、21600。
- geogrid のところでは、ref_lat, ref_long (領域中央の緯度経度)、stand_lon (地図投影変換の中心経線) を対象にあわせる。北緯・東経が正。
- 格子点数などはよく考えるべきだが、あたえられたままでも動く。
dx, dy (外側domainの格子間隔、単位 m) を、やりたいことにあわせて設定する。
- ./geogrid.exe >& log.geogrid
- ./link_grib.csh /roisdisk/masudako/FNL/fnl*
- ln -sf ungrib/Variable_Tables/Vtable.GFS Vtable
- ./ungrib.exe
- ./metgrid.exe >& log.metgrid
- Running WRF
- cd ../WRF/test/em_real
- ln -sf ../../../WPS/met_em* .
- namelist.input を編集
- time_control のところの開始・終了時刻などをなおず。
interval_seconds は 6時間ならば 21600。
- domains も namelist.input にあわせてなおす。dx, dy など。
- 北大の川島先生のページ
https://www2.lowtem.hokudai.ac.jp/multi-sphere/cloud/kawasima/WRF/wrf.html
にある注意にしたがって、
metgrid の出力データを ncdump などで見て、
num_metgrid_levels と num_metgrid_soil_levels の値を確認。
namelist.input の 同じ名まえの変数の値をそれにあわせて変更。
今回は、num_metgrid_levels を 27 に変更。
num_metgrid_soil_levels は 4 のままでよい。
- domains に「sfcp_to_sfcp = .true.」を追加
(入力データの海面気圧ではなく地表面気圧をつかう。
2025-10-30 の作業では、こうしないと real.exe でエラーになった。
FNLのモデルとWRFとの陸面標高がちがうとき
どう処理されるのか疑問がのこるが。)
- ./real.exe
- nohup ./wrf.exe >log.wrf 2>&1 &
- WRF USERS PAGE
- namelist.wps: Best Practices https://www2.mmm.ucar.edu/wrf/users/namelist_best_prac_wps.html
- namelist.input: Best Practices https://www2.mmm.ucar.edu/wrf/users/namelist_best_prac_wrf.html
- RIP
- NCAR/RIP https://github.com/NCAR/RIP
- バージョンは 4.7 (7 years ago)
- 「Code」から 「Download ZIP」 でダウンロード RIP-master.zip となる。
2024-08-01, 2024-08-08, 2025-10-23, 2025-10-30
増田 耕一 (MASUDA Kooiti)