0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WRFテストラン手順 その3(./real.exe,./wrf.exe編)

Last updated at Posted at 2025-06-04

1. 概要

前々回の記事および前回の記事では,WRFの計算を回すための下準備を行いました.
今回は実際に./wrf.exeによる時間積分計算を行うために必要な手順を紹介していきます.(ここではWRF-4.5.2-ARWを-ARWでコンパイルしたもの=デフォルトを用いて説明します)
以前行ったことのあるFNLでの計算では出なかったようなエラー(GSMは大気だけのデータであることに起因する)に直面したので,その対策についてもまとめました.


2. met_emデータのリンク

まずは,~/WRF/WRF-4.5.2-ARW上にprojectのディレクトリを作成し,この中で前回metgridで作成したデータをリンク付けしていきます.

cd ~/WRF/WRF-4.5.2-ARW
mkdir ./RUN
cd ./RUN
mkdir ./run_project_20250603
cd ./run_project_20250603
ln -s ../../../WPS-4.6.0/RUN/run_project_20250603/met_em.d0* .

以上の操作で,projectのディレクトリにmet_em.d0*.ncのリンク付けが行われました.

3. CAMtr_volume_mixing_ratioのリンク

同様にリンクでもいいですが,名前を固定したいため今回はコピーにしています.

cp ../../WRF/run/CAMtr_volume_mixing_ratio.RCP8.5 CAMtr_volume_mixing_ratio

4. namelist.inputの準備

次に,./real.exe./wrf.exeが参照する設定ファイルであるnamelist.inputを作成していきます.
基本的にWPSの実行で用いたファイルに沿って値を合わせていきますが,物理スキーム等の設定項目があるため,計算したい条件に合わせて適宜変更を加える必要性があります.
今回最終的にテストランが実施できたnamelist.inputは以下の通りです.

namelist.input
 &time_control
 run_days                            = 0,
 run_hours                           = 75,
 run_minutes                         = 0,
 run_seconds                         = 0,
 start_year                          = 2025, 2025,
 start_month                         = 05,   05, 
 start_day                           = 05,   05,
 start_hour                          = 00,   00,
 end_year                            = 2025, 2025,
 end_month                           = 05,   05,
 end_day                             = 08,   08,
 end_hour                            = 03,   03,
 interval_seconds                    = 21600
 input_from_file                     = .true.,.true.,
 history_interval                    = 60,  60,
 frames_per_outfile                  = 1, 1,
 restart                             = .false.,
 restart_interval                    = 7200,
 io_form_history                     = 2
 io_form_restart                     = 2
 io_form_input                       = 2
 io_form_boundary                    = 2
 /

 &domains
 time_step                           = 30,
 time_step_fract_num                 = 0,
 time_step_fract_den                 = 1,
 max_dom                             = 2,
 e_we                                = 500,    301,
 e_sn                                = 500,    301,
 e_vert                              = 50,     50,
 dzstretch_s                         = 1.1
 p_top_requested                     = 10000,
 num_metgrid_levels                  = 18,
 num_metgrid_soil_levels             = 0,
 dx                                  = 5000,
 dy                                  = 5000,
 grid_id                             = 1,     2,
 parent_id                           = 0,     1,
 i_parent_start                      = 1,     110,
 j_parent_start                      = 1,     160,
 parent_grid_ratio                   = 1,     4,
 parent_time_step_ratio              = 1,     3,
 feedback                            = 1,
 smooth_option                       = 0,
 /
 
 &physics
 mp_physics                          = 8,     8,
 cu_physics                          = 6,     6,
 ra_lw_physics                       = 1,     1,
 ra_sw_physics                       = 1,     1,
 bl_pbl_physics                      = 2,     2,
 sf_sfclay_physics                   = 2,     2,
 sf_surface_physics                  = 1,     1,
 radt                                = 15,    15,
 bldt                                = 0,     0,
 cudt                                = 0,     0,
 icloud                              = 1,
 num_land_cat                        = 21,
 sf_urban_physics                    = 0,     0,
 fractional_seaice                   = 0,
 /
 
 &chem
 chem_opt = 0,
 /
 &fdda
 /
 
 &dynamics
 hybrid_opt                          = 0, 
 w_damping                           = 0,
 diff_opt                            = 2,      2,
 km_opt                              = 4,      4,
 diff_6th_opt                        = 0,      0,
 diff_6th_factor                     = 0.12,   0.12,
 base_temp                           = 290.
 damp_opt                            = 3,
 zdamp                               = 5000.,  5000.,
 dampcoef                            = 0.2,    0.2,
 khdif                               = 0,      0,
 kvdif                               = 0,      0,
 non_hydrostatic                     = .true., .true.,
 moist_adv_opt                       = 1,      1,
 scalar_adv_opt                      = 1,      1,
 gwd_opt                             = 1,      0,
 /

 &bdy_control
 spec_bdy_width                      = 5,
 specified                           = .true.
 /

 &grib2
 /

 &namelist_quilt
 nio_tasks_per_group = 0,
 nio_groups = 1,
 /

5. 必要なテーブルのコピー

ここら辺までやって後述する方法で本計算に進もうとしたものの,

rsl.error.0000
-------------- FATAL CALLED ---------------
FATAL CALLED FROM FILE:  <stdin>  LINE:    1744
module_physics_init.F: LANDUSE_INIT: open failure for LANDUSE.TBL
-------------------------------------------

こんなエラーが出て,計算ができませんでした.
エラーメッセージによるとLANDUSE.TBLが必要だということなので,探してみると,runディレクトリ上に発見しました.
おそらくこのファイルは物理スキームのルックアップテーブルですが,地表面物理(例えば Noah LSM など)を使う際に必要なファイルっぽいです.
のちのち他のテーブルも計算に関連しそうなので,まとめて*.TBL類をrunディレクトリからコピーします.(リンクでもいいはず)

cp ~/WRF/WRF-4.5.2-ARW/run/*.TBL ~/WRF/WRF-4.5.2-ARW/RUN/run_project_20250603/

6. RRTM_DATA類のコピー

以上の手続きをして解決かと思われたものの,

Fortran runtime error: Cannot open file 'ozone_plev.formatted': No such file or directory\

新たなエラーが出現.
オゾンデータは使わなくていいんじゃねえのかってことで,physicsra_lw_physicsra_sw_physicsは1を指定します.
こうすることで,CAMの放射スキームを使わない設定にしました.

namelist.input
&physics
 ra_lw_physics = 1,   ! ← 例: RRTMG ではなく単純なスキームに変更(CAMは 4)
 ra_sw_physics = 1,
 ...
/

ここまでおこなって再度挑戦しましたが,

FATAL CALLED FROM FILE:  <stdin>  LINE:    7635
module_ra_rrtm: error opening RRTM_DATA on unit   10

RRTMデータというのが必要らしい.
とりあえず,探して同様にコピーする.

cp ~/WRF/WRF-4.5.2-ARW/run/RRTM* ~/WRF/WRF-4.5.2-ARW/RUN/run_project_20250603/

7. real.exe,wrf.exeの実行

まずは,カレントディレクトリ内にリンクを作成しておきます.

ln -s ../../main/wrf.exe .
ln -s ../../main/real.exe .

はじめに,real.exeを用いてWRFに入力するデータ・条件のフォーマットを行います.
real.exeはそこそこ時間がかかります.

./real.exe

無事にrealが通れば,最後にwrf.exeを実行するためのコマンドを叩きます.

./wrf.exe

これだけだとログが監視できませんので,別ターミナル等で,

tail -f ./rsl.out.0000

としてあげると,

.
.
.
d01 2025-05-05_00:00:00  ----------------------------------------
d01 2025-05-05_00:00:00  W-DAMPING  BEGINS AT W-COURANT NUMBER =    1.00000000
d01 2025-05-05_00:00:00  ----------------------------------------
Timing for Writing wrfout_d02_2025-05-05_00:00:00 for domain        2:    2.79981 elapsed seconds
 Tile Strategy is not specified. Assuming 1D-Y
WRF TILE   1 IS      1 IE    301 JS      1 JE    301
WRF NUMBER OF TILES =   1
Timing for main: time 2025-05-05_00:00:10 on domain   2:   13.64500 elapsed seconds
Timing for main: time 2025-05-05_00:00:20 on domain   2:    4.65799 elapsed seconds
Timing for main: time 2025-05-05_00:00:30 on domain   2:    4.80826 elapsed seconds
Timing for main: time 2025-05-05_00:00:30 on domain   1:   73.64230 elapsed seconds
Timing for main: time 2025-05-05_00:00:40 on domain   2:    4.87447 elapsed seconds
Timing for main: time 2025-05-05_00:00:50 on domain   2:    4.85073 elapsed seconds
Timing for main: time 2025-05-05_00:01:00 on domain   2:    4.79100 elapsed seconds
Timing for main: time 2025-05-05_00:01:00 on domain   1:   30.66646 elapsed seconds

計算が回っていることが確認できます.

mpirunを用いて計算を高速化するなら,

mpirun -np 6 ./wrf.exe

などとします.

ディレクトリ直下にwrfout...が作成されていればテストランはうまくいっています!
お疲れさまでした!

wrfout...の可視化については今後別記事でまとめる予定です.


追記(2025/06/09):

GFSの0.25度予報データの利用にも挑戦したところ,Vtable.GFSをそのまま使うと土壌温度や水分が読み込めなく,土壌層データが空(num_metgrid_soil_levels = 4)ですよ~っていうエラーが出ました.
なので,grib2データ上の格納場所を追跡して再構成したVtableVtable.GFS025を以下に貼っておきます.

Vtable.GFS025
GRIB1| Level| From |  To  | metgrid  | metgrid | metgrid                                 |GRIB2|GRIB2|GRIB2|GRIB2|
Param| Type |Level1|Level2| Name     | Units   | Description                             |Discp|Catgy|Param|Level|
-----+------+------+------+----------+---------+-----------------------------------------+-----------------------+
  11 | 100  |   *  |      | TT       | K       | Temperature                             |  0  |  0  |  0  | 100 |
  33 | 100  |   *  |      | UU       | m s-1   | U                                       |  0  |  2  |  2  | 100 |
  34 | 100  |   *  |      | VV       | m s-1   | V                                       |  0  |  2  |  3  | 100 |
  52 | 100  |   *  |      | RH       | %       | Relative Humidity                       |  0  |  1  |  1  | 100 |
   7 | 100  |   *  |      | HGT      | m       | Height                                  |  0  |  3  |  5  | 100 |
  11 | 105  |   2  |      | TT       | K       | Temperature       at 2 m                |  0  |  0  |  0  | 103 |
  52 | 105  |   2  |      | RH       | %       | Relative Humidity at 2 m                |  0  |  1  |  1  | 103 |
  33 | 105  |  10  |      | UU       | m s-1   | U                 at 10 m               |  0  |  2  |  2  | 103 |
  34 | 105  |  10  |      | VV       | m s-1   | V                 at 10 m               |  0  |  2  |  3  | 103 |
   1 |   1  |   0  |      | PSFC     | Pa      | Surface Pressure                        |  0  |  3  |  0  |   1 |
   2 | 102  |   0  |      | PMSL     | Pa      | Sea-level Pressure                      |  0  |  3  |  1  | 101 |
 144 | 112  |   0  |  10  | SM000010 | fraction| Soil Moist 0-10 cm below grn layer (Up) |  2  |  0  | 192 | 106 |
 144 | 112  |  10  |  40  | SM010040 | fraction| Soil Moist 10-40 cm below grn layer     |  2  |  0  | 192 | 106 |
 144 | 112  |  40  | 100  | SM040100 | fraction| Soil Moist 40-100 cm below grn layer    |  2  |  0  | 192 | 106 |
 144 | 112  | 100  | 200  | SM100200 | fraction| Soil Moist 100-200 cm below gr layer    |  2  |  0  | 192 | 106 |
 144 | 112  |  10  | 200  | SM010200 | fraction| Soil Moist 10-200 cm below gr layer     |  2  |  0  | 192 | 106 |
  11 | 112  |   0  |  10  | ST000010 | K       | T 0-10 cm below ground layer (Upper)    |  2  |  0  |  2  | 106 |
  11 | 112  |  10  |  40  | ST010040 | K       | T 10-40 cm below ground layer (Upper)   |  2  |  0  |  2  | 106 |
  11 | 112  |  40  | 100  | ST040100 | K       | T 40-100 cm below ground layer (Upper)  |  2  |  0  |  2  | 106 |
  11 | 112  | 100  | 200  | ST100200 | K       | T 100-200 cm below ground layer (Bottom)|  2  |  0  |  2  | 106 |
  11 | 112  |  10  | 200  | ST010200 | K       | T 10-200 cm below ground layer (Bottom) |  2  |  0  |  2  | 106 |
  91 |   1  |   0  |      | SEAICE   | proprtn | Ice flag                                | 10  |  2  |  0  |   1 |
  81 |   1  |   0  |      | LANDSEA  | proprtn | Land/Sea flag (1=land, 0 or 2=sea)      |  2  |  0  |  0  |   1 |
   7 |   1  |   0  |      | SOILHGT  | m       | Terrain field of source analysis        |  0  |  3  |  5  |   1 |
  11 |   1  |   0  |      | SKINTEMP | K       | Skin temperature (can use for SST also) |  0  |  0  |  0  |   1 |
  65 |   1  |   0  |      | SNOW     | kg m-2  | Water equivalent snow depth             |  0  |  1  | 13  |   1 |
     |   1  |   0  |      | SNOWH    | m       | Physical Snow Depth                     |  0  |  1  |     |   1 |
-----+------+------+------+----------+---------+-----------------------------------------+-----------------------+
#
# This table is written for use with GFS 0.25-degree GRIB2 data as input for WRF/WPS.
# Modified: 2025/06/09 - Soil temperature/moisture mapping fixed for new GFS format.
# Author: @pokitamazaing

※補足:Vtable編集ポイント

  • GFSデータの土壌温度・水分が,デフォルトのVtable.GFSでは読めないため,「discipline/category/parameter/level」の値をgrib_dumpwgrib2で実際に確認し,あらためて対応させてあります.
  • 例:Soil Temperatureはdiscipline=2, category=0, parameter=2, level=106 など.
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?