1
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に関する備忘録

1
Last updated at Posted at 2026-02-25

はじめに

WRFは領域レベルの気象をシミュレーション可能なソフトウェアです.

本記事では、M1時代に私が実際に直面したWRFのトラブルと、その原因ついて一部まとめます。同様のエラーで悩んでいる方の参考になれば幸いです。
用いたWRFのバージョンは4.6.1です.

入力ファイルがWRF v4 プリプロセッサ形式でない

WRF実行初期に入力ファイルがV4以降の形式を満たしているかのチェックが行われます.うち一つはグローバル属性のTITLE内に" V4."の文字列が存在するかどうかです.満たしていない場合,以下のエラーが表示されます.

rsl.out.0000.txt
 This input data is not V4:"入力ファイルのTITLE"
File name that is causing troubles = "入力ファイルのファイル名"
 1) ensure that the input file was created with WRF v4 pre-processors, or
 2) use force_use_old_data=T in the time_control record of the namelist.input file
-------------- FATAL CALLED ---------------
FATAL CALLED FROM FILE:  <stdin>  LINE:     342
 ---- ERROR: The input file appears to be from a pre-v4 version of WRF initialization routines
-------------------------------------------

当該チェックはshare/input_wrf.Fに記述されています.

share/input_wrf.F(一部抜粋)
    IF ( INDEX(TRIM(input_title_char),' V4.' ) .NE. 0 ) THEN
      yes_use_this_data = .TRUE.
    ELSE
      WRITE(wrf_err_message,*)'This input data is not V4: '

重要な点はV4.の前に半角スペースも必要であることです.
つまり"WRF V4.0"はOKですが,"WRFV4.0"や"V4.0"は弾かれます.

WRF実行中に不定期なメモリエラー(SIGSEGV)

WRF実行中に不定期なタイミングでメモリエラーが出て詰まりました.CFL条件を満たしていない場合は同じ時刻で止まるため別要因と考えられます.

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x14d2658238a0 in ???
#1  0x14d265822a45 in ???
#2  0x14d26543ebef in ???
#3  0x1f815a6 in ???
#4  0x1fa370e in ???
#5  0x1fb132b in ???
#6  0x13b8052 in ???
#7  0x14d2656fc2c5 in ???
#8  0x14d26548a199 in ???
#9  0x14d26550f23f in ???
#10  0xffffffffffffffff in ???

この要因はWRFをsmparでビルドしていたことが原因でした.
WRFをビルドする際の./configureでdmparを選択することで解決しました.

子ドメイン格子数の制約条件

この話は多重のネスティングでダウンスケーリングする際に必要となります.
子ドメインの格子数は親ドメインとの整合性を保つため,以下の条件を満たす必要があります.

e = n \times r +1

ここで
e:子ドメインの格子数(e_we または e_sn)
r:parent_grid_ratio
n:任意の整数

この条件を満たさない場合real.exeやwrf.exe実行時に停止します.

CPU数と最小格子数の関係

WRFを並列計算で実行する場合

mpirun -n CPU数 ./wrf.exe

で実行しますが,このときCPU数は多ければ良いわけではありません.

WRFの並列計算では、ドメインが複数タイルに分割され、各CPUに1タイルが割り当てられます。
このとき,各タイルはlat方向・lon方向ともに最低10格子以上が必要です.詳細はフォーラムにあります.

例えば81コア(9×9分割)で54×54格子の計算領域を実行しようとすると,以下のエラーが表示される.

rsl.out
   For domain            1 , the domain size is too small for this many processors, or the decomposition aspect ratio is poor.
   Minimum decomposed computational patch size, either x-dir or y-dir, is 10 grid cells.
  e_we =    54, nproc_x =    9, with cell width in x-direction =    6
  e_sn =    54, nproc_y =    9, with cell width in y-direction =    6
  --- ERROR: Reduce the MPI rank count, or redistribute the tasks.
-------------- FATAL CALLED ---------------
FATAL CALLED FROM FILE:  <stdin>  LINE:    2862
NOTE:       1 namelist settings are wrong. Please check and reset these options

54×54格子では 54 ÷ 9 = 6 となり,必要条件を満たさないため実行不能です.

同様の問題により80コア(8×10分割)で80×80格子の計算領域を実行しようとすると,以下のエラーが表示されます.

rsl.out
   For domain            1 , the domain size is too small for this many processors, or the decomposition aspect ratio is poor.
   Minimum decomposed computational patch size, either x-dir or y-dir, is 10 grid cells.
  e_we =    80, nproc_x =    8, with cell width in x-direction =    10
  e_sn =    80, nproc_y =    10, with cell width in y-direction =    8
  --- ERROR: Reduce the MPI rank count, or redistribute the tasks.
-------------- FATAL CALLED ---------------
FATAL CALLED FROM FILE:  <stdin>  LINE:    2862
NOTE:       1 namelist settings are wrong. Please check and reset these options

そのため並列計算に用いるCPU数はn^2かつ,各方向の格子数は10×n以上が望ましいです.
素数のCPU数は回避を推奨します.

1
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
1
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?