'Could not write CTM_DEPV_DIAG file' error

Thanks for posting the results of your debug run. This points to the following line from m3dry.F as the source of the crash:

rgnd = 200. + 300. * MET_DATA%SOIM1(c,r)/GRID_DATA%WFC (c,r)

Specifically, GRID_DATA%WFC (c,r) is zero when being used in this computation.

This issue has come up before in a post by @dazhong.yin, it was listed as issue #2 in that post.

One of my colleagues later had some offline email exchanges with @dazhong.yin and in my recollection, the underlying reason was that the WRF files had an inconsistency between the spatial coverage of land vs. water cells as indicated by the LWMASK array and the spatial coverage of soil types.

The computation above only takes place for land grid cells, i.e. cells for which LWMASK is 1 and the vegetation fraction is greater than 0. For such cells, the soil type should be <= 12, but in @dazhong.yin’s case there were cells where LWMASK was 1 (land) but the soil type was 14 (a placeholder for water), and for that soil type WFC (soil field capacity) is set to the initialized value of 0 which leads to the ‘division by zero’ error you also encountered.

Here is the information my colleague shared with @dazhong.yin

The part of m3dry that uses WFC is for land only so ISLTYP=14 should not occur there. The only way this can happen is if LWMASK = 1 (land) and ISLTYP=14. Usually the soil data has greater extent at coastlines so this does not occur. You could compare SLTYP in the METCRO2D file to the LWMASK in the GRIDCRO2D file (or both in wrfout) to see if there are any grid cells where LWMASK=1 and SLTYP=14 or anything >11

@dazhong.yin then confirmed that indeed in his fields there were many cell with SLTYP=14 and LWMASK=1, but I don’t have any record of if/how this problem was ultimately resolved. Based on my colleague’s experience, a problem like this shouldn’t happen and points to some issues in the WRF setup. Maybe you can reach out to @dazhong.yin to find out if/how this was resolved.