# Issues with M3DRY "NEGATIVE or UNDEFINED Dry Deposition Velocity"

**URL:** <https://forum.cmascenter.org/t/issues-with-m3dry-negative-or-undefined-dry-deposition-velocity/1312>\
**Category:** Run Time Errors and Issues\
**Created:** [February 18, 2020, 8:22pm UTC](https://forum.cmascenter.org/t/issues-with-m3dry-negative-or-undefined-dry-deposition-velocity/1312 "2020-02-18T20:22:27Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![msospedra](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@msospedra](https://forum.cmascenter.org/u/msospedra)\
**Post date:** [February 18, 2020, 8:22pm UTC](https://forum.cmascenter.org/t/issues-with-m3dry-negative-or-undefined-dry-deposition-velocity/1312/1 "2020-02-18T20:22:27Z")

</div>

I am having issues running CMAQ 5.3.1. The program aborts after showing an error message regarding deposition velocity of O3 being NaN (I am attaching the LOG file, the run script and the bldit script). Any insights of what it may be happening?

```
 =============================================
 |>--- SET UP GRAVITATIONAL SETTLING ---<|
 =============================================

```

* * *

\*\*\* Subroutine: M3DRY  
\*\*\* NEGATIVE or UNDEFINED Dry Deposition Velocity  
\*\*\* Point = 14 1  
\*\*\* Species = O3  
\*\*\* Vd = NaN

* * *

```
 *** ERROR ABORT in subroutine M3DRY on PE 059           
 ABORT

```

PM3EXIT: DTBUF 8:01:15 May 2, 2012  
Date and time 8:01:15 May 2, 2012 (2012123:080115)

[CTM\_LOG\_059.v531\_noisam\_mpi\_intel\_SC\_20120502.txt](https://forum.cmascenter.org/uploads/short-url/hvBuKRi2ycQvaD7cCRIvhSO7v7J.txt) (62.6 KB) [run\_cctm\_df12\_all\_gid402\_CMAQ5.3.1\_noisam.txt](https://forum.cmascenter.org/uploads/short-url/bVshGK0nvJIwru1oTn9rtCyDRjw.txt) (35.2 KB) [bldit\_cctm\_saprc07tc\_ae6\_aq\_noisam.csh](https://forum.cmascenter.org/uploads/short-url/A1cQDeb1MFJcw8E2jiyVyHJvSEW.csh) (28.6 KB)

---

<div class="post-metadata">

**Author:** ![C.W.Huang](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@C.W.Huang](https://forum.cmascenter.org/u/C.W.Huang)\
**Post date:** [March 10, 2020, 7:38am UTC](https://forum.cmascenter.org/t/issues-with-m3dry-negative-or-undefined-dry-deposition-velocity/1312/2 "2020-03-10T07:38:31Z")

</div>

Have you fixed this issure yet?  
I have the same issue as you,and I checked the M3DRY subroutine. I found that the issue may be caused by ‘Hg air surface exchange subroutine’ in m3dry.F or improper data in METCRO2D from MCIP.  
I’m still trying to figure it out.Please inform me if you have any solutions.  
Thanks！

---

<div class="post-metadata">

**Author:** ![msospedra](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@msospedra](https://forum.cmascenter.org/u/msospedra)\
**Post date:** [March 10, 2020, 2:17pm UTC](https://forum.cmascenter.org/t/issues-with-m3dry-negative-or-undefined-dry-deposition-velocity/1312/3 "2020-03-10T14:17:34Z")

</div>

Hi,

In our case, I think it’s an issue with MCIP. I was trying to run the CMAQ 5.3.1 with input data that we used for our set-up with CMAQ 5.0.2.

We need to reprocess our WRF met fields, and see if that solves the issue. I’ll let you know if that works.

Thanks,

Marc

---

<div class="post-metadata">

**Author:** ![C.W.Huang](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@C.W.Huang](https://forum.cmascenter.org/u/C.W.Huang)\
**Post date:** [March 20, 2020, 7:03am UTC](https://forum.cmascenter.org/t/issues-with-m3dry-negative-or-undefined-dry-deposition-velocity/1312/4 "2020-03-20T07:03:40Z")

</div>

Hi,

I solved the issue by using WPSv4.0.  
A blog in chinese ([[https://www.i-lightning.cn/2020/01/a\_strange\_error\_about\_wrf\_cmaq/](https://www.i-lightning.cn/2020/01/a_strange_error_about_wrf_cmaq/)]) helped me a lot.  
This issue occurs while there are ‘Flerchinger USEd in NEW version. Iterations= 10’ in rsl.out or SMOIS,SH2O=0 in wrfout,lead to zero in WR(canopy moisture content) in METCRO2D.These can be solved by using WPSv4.0.  
Another blog explained the resaons([[Sillman: Corrections to CMAQ 4.7.1](http://www-personal.umich.edu/~sillman/CMAQ_corrections_2010.htm)]).

> Numerical problems can occur in these algorithms because the WRF model input has LAI=0 for grids located over the ocean or in ice-bound regions. The m3dry.F algorithm includes divide-by-LAI without protection for LAI being zero. This can cause the program to generate Inf or NaN values.

Hope this can help you.

---

<div class="post-metadata">

**Author:** ![msospedra](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@msospedra](https://forum.cmascenter.org/u/msospedra)\
**Post date:** [March 24, 2020, 3:13pm UTC](https://forum.cmascenter.org/t/issues-with-m3dry-negative-or-undefined-dry-deposition-velocity/1312/5 "2020-03-24T15:13:00Z")

</div>

Thank you very much. We did not get too far on this, so this is going to help us enormously.

Sincerely,

Marc

---

<div class="post-metadata">

**Author:** ![C.W.Huang](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@C.W.Huang](https://forum.cmascenter.org/u/C.W.Huang)\
**Post date:** [April 7, 2020, 8:29am UTC](https://forum.cmascenter.org/t/issues-with-m3dry-negative-or-undefined-dry-deposition-velocity/1312/6 "2020-04-07T08:29:27Z")

</div>

In addition,there’s another solution.I modified the m3dry.F and it works.  
From

 ![微信截图_20200407162351](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/1X/85a269428db7e46c1e6aaeada1d3d6b2e3d33131.png)  
To ![微信截图_20200407162856](https://canada1.discourse-cdn.com/flex027/uploads/cmas/original/1X/b847ba04f7f8fe80b0a593bcdf18322a415fd391.png)  
Hope this can help you.

---

<div class="post-metadata">

**Author:** ![pleim.jon](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@pleim.jon](https://forum.cmascenter.org/u/pleim.jon)\
**Post date:** [May 12, 2020, 1:53pm UTC](https://forum.cmascenter.org/t/issues-with-m3dry-negative-or-undefined-dry-deposition-velocity/1312/8 "2020-05-12T13:53:58Z")

</div>

The problem seems to come from some problem in the land and soil processing. One comment says that these problems happen when WFC is zero such as for a water or ice cell. However, this part of the code is only executed for vegetated land cells (NINT(GRID\_DATA%LWMASK( c,r )) .NE. 0 ) .AND. ( vegcr .GT. 0.0 ). WFC should never be zero in such cells. If it is, that means there is an error upstream such that there is no soil data for the land cell. Should not have vegetation without soil. This should not be allowed because it will also cause errors in the LSM part of WRF. If we do as suggested checking for WFC = 0, then it is just covering up for an error upstream.

---

<div class="post-metadata">

**Author:** ![qinch18](https://avatars.discourse-cdn.com/v4/letter/q/71e660/32.png) [@qinch18](https://forum.cmascenter.org/u/qinch18)\
**Post date:** [August 23, 2020, 12:31am UTC](https://forum.cmascenter.org/t/issues-with-m3dry-negative-or-undefined-dry-deposition-velocity/1312/9 "2020-08-23T00:31:05Z")

</div>

Hello,I used WRF4.0, but that didn’t solve the problem.

---

<div class="post-metadata">

**Author:** ![C.W.Huang](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@C.W.Huang](https://forum.cmascenter.org/u/C.W.Huang)\
**Post date:** [August 24, 2020, 8:39am UTC](https://forum.cmascenter.org/t/issues-with-m3dry-negative-or-undefined-dry-deposition-velocity/1312/11 "2020-08-24T08:39:26Z")

</div>

Hi,  
Maybe you can modify the m3dry.F as I said in Apr 7 in this topic.It works successfully and this bug has never occured again.  
Hope this can help you.  
C.W.Huang

---

<div class="post-metadata">

**Author:** ![msospedra](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@msospedra](https://forum.cmascenter.org/u/msospedra)\
**Post date:** [August 26, 2020, 12:04am UTC](https://forum.cmascenter.org/t/issues-with-m3dry-negative-or-undefined-dry-deposition-velocity/1312/12 "2020-08-26T00:04:40Z")

</div>

Hi there,  
I modified the m3dry.F routine as C.W.Huang suggested, and it worked for me as well. I modeled Southern California, and we obtained similar model performance as with version 5.0.2.  
Marc

---

<div class="post-metadata">

**Author:** ![zx37](https://avatars.discourse-cdn.com/v4/letter/z/c67d28/32.png) [@zx37](https://forum.cmascenter.org/u/zx37)\
**Post date:** [December 14, 2021, 7:16am UTC](https://forum.cmascenter.org/t/issues-with-m3dry-negative-or-undefined-dry-deposition-velocity/1312/13 "2021-12-14T07:16:23Z")

</div>

hi,  
When I follow this method to modify m3dry.F, make will appear the following compilation error，  
m3dry.F(781): error #6099: An ENDDO statement occurred without a corresponding DO or DO WHILE statement.  
END DO ddloop ! (l = 1, n\_spc\_m3dry)  
^  
m3dry.F(795): error #6099: An ENDDO statement occurred without a corresponding DO or DO WHILE statement.  
END DO ! c  
^  
m3dry.F(796): error #6099: An ENDDO statement occurred without a corresponding DO or DO WHILE statement.  
END DO ! r  
^  
m3dry.F(550): error #6321: An unterminated block exists.  
ELSE ! land  
^  
m3dry.F(483): error #8147: DO construct with a construct name must be terminated by an ENDDO statement with the same name.  
ddloop: DO l = 1, n\_spc\_m3dry  
^  
m3dry.F(383): error #6321: An unterminated block exists.  
DO c = 1, ncols  
^  
m3dry.F(382): error #6321: An unterminated block exists.  
DO r = 1, nrows  
^  
compilation aborted for m3dry.F (code 1)

---

<div class="post-metadata">

**Author:** ![C.W.Huang](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@C.W.Huang](https://forum.cmascenter.org/u/C.W.Huang)\
**Post date:** [December 14, 2021, 7:55am UTC](https://forum.cmascenter.org/t/issues-with-m3dry-negative-or-undefined-dry-deposition-velocity/1312/14 "2021-12-14T07:55:36Z")

</div>

Hi there,

Can you upload the screenshot of your code changes? It seems like you had wrong changes.  
I add two if…else…endif code statements between line 607 to 614 in M3DRY.F to make sure that WFC\<=0 not cause problems. Maybe you missed an endif?

C.W.Huang

---

<div class="post-metadata">

**Author:** ![C.W.Huang](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@C.W.Huang](https://forum.cmascenter.org/u/C.W.Huang)\
**Post date:** [December 14, 2021, 8:41am UTC](https://forum.cmascenter.org/t/issues-with-m3dry-negative-or-undefined-dry-deposition-velocity/1312/16 "2021-12-14T08:41:47Z")

</div>

It seems like there is no problem, maybe you can try this:  
[m3dry.txt](https://forum.cmascenter.org/uploads/short-url/3gQefPhLOt8FshEb6VtCMttf4bN.txt) (40.6 KB)

save your m3dry.F  
modify this m3dry.txt to m3dry.F and put this in your BLD and recomplied.

Hope this can help you.  
C.W.Huang

---

<div class="post-metadata">

**Author:** ![zx37](https://avatars.discourse-cdn.com/v4/letter/z/c67d28/32.png) [@zx37](https://forum.cmascenter.org/u/zx37)\
**Post date:** [December 14, 2021, 9:09am UTC](https://forum.cmascenter.org/t/issues-with-m3dry-negative-or-undefined-dry-deposition-velocity/1312/17 "2021-12-14T09:09:45Z")

</div>

I am indeed missing an endif，Now the problem has been solved，This problem has troubled me for a long time, thank you very much
