For the last few days I've been struggling trying to figure out why my WRF (v4.4.2) runs consistently crashed in the first d01 model time step with extremely vague segmentation faults, when initialized with GEFS 0.5° data (both the pgrb2a.0p50 and pgrb2b.0p50 files) from a date in 2022. I finally figured out a solution, so I thought I'd post it here in case other people encounter similar issues initializing WRF from GEFS.
I ran ungrib separately on the pgrb2a and pgrb2b files (which I assigned the prefixes GEFS_A and GEFS_B), then used metgrid to combine them in the met_em files. Real also ran successfully. However, inspection of the wrfinput files revealed potential problems with the soil fields. The top SMOIS layer had negative soil moisture (-0.033 m3/m3) at certain locations along the coastlines of BC, WA, OR, and CA (see first image—the bad wrfinput file is on the bottom/right). I wrote a Python script to force those negative soil moisture values to be a small positive value (0.01 m3/m3), but WRF still seg-faulted in the first d01 time step. Then I finally looked at the TSLB field, and was alarmed at what I found along the ocean coastlines and around Great Salt Lake (see second image). Going down to the bottom soil layer, these same areas had soil temperatures at or below 10 K (not shown). Similar issues initializing from GEFS data were documented in a 2019 thread (The 2019 GEFS data cannot drive WRF4.0).
That led me to look at the met_em files that metgrid produced. I found that in those files, the top three soil layers looked fine, but the bottom soil moisture & soil temperature fields were really wonky (again, soil temps around 10 K near coastlines or shorelines of large lakes). My namelist.wps had this entry in the &metgrid namelist, with the GEFS_A files provided first:
On a lark, I tried changing the order of those to:
Rerunning metgrid with the GEFS_B files provided first yielded met_em files with no artifacts in the soil moisture or soil temperature fields—no more negative soil moisture pixels, and no more <10 K soil temperature pixels. Real ran successfully, and produced wrfinput files with no soil artifacts either (see the top/left plots in both attached images). WRF also successfully ran, instead of crashing with a seg fault in the first model time step. I've never encountered this issue before, and I don't know why it matters, but apparently the order in which you provide multiple datasets to metgrid with the fg_name variable matters—at least when using GEFS for ICs/LBCs.
I hope this post and solution helps save time and headaches for others.
Jared
I ran ungrib separately on the pgrb2a and pgrb2b files (which I assigned the prefixes GEFS_A and GEFS_B), then used metgrid to combine them in the met_em files. Real also ran successfully. However, inspection of the wrfinput files revealed potential problems with the soil fields. The top SMOIS layer had negative soil moisture (-0.033 m3/m3) at certain locations along the coastlines of BC, WA, OR, and CA (see first image—the bad wrfinput file is on the bottom/right). I wrote a Python script to force those negative soil moisture values to be a small positive value (0.01 m3/m3), but WRF still seg-faulted in the first d01 time step. Then I finally looked at the TSLB field, and was alarmed at what I found along the ocean coastlines and around Great Salt Lake (see second image). Going down to the bottom soil layer, these same areas had soil temperatures at or below 10 K (not shown). Similar issues initializing from GEFS data were documented in a 2019 thread (The 2019 GEFS data cannot drive WRF4.0).
That led me to look at the met_em files that metgrid produced. I found that in those files, the top three soil layers looked fine, but the bottom soil moisture & soil temperature fields were really wonky (again, soil temps around 10 K near coastlines or shorelines of large lakes). My namelist.wps had this entry in the &metgrid namelist, with the GEFS_A files provided first:
fg_name = '/path/to/GEFS_A','/path/to/GEFS_B',
On a lark, I tried changing the order of those to:
fg_name = '/path/to/GEFS_B','/path/to/GEFS_A',
Rerunning metgrid with the GEFS_B files provided first yielded met_em files with no artifacts in the soil moisture or soil temperature fields—no more negative soil moisture pixels, and no more <10 K soil temperature pixels. Real ran successfully, and produced wrfinput files with no soil artifacts either (see the top/left plots in both attached images). WRF also successfully ran, instead of crashing with a seg fault in the first model time step. I've never encountered this issue before, and I don't know why it matters, but apparently the order in which you provide multiple datasets to metgrid with the fg_name variable matters—at least when using GEFS for ICs/LBCs.
I hope this post and solution helps save time and headaches for others.
Jared