# ERROR about Floating point exception

**URL:** <https://forum.cmascenter.org/t/error-about-floating-point-exception/5124>\
**Category:** WRF-CMAQ\
**Created:** [August 1, 2024, 8:23am UTC](https://forum.cmascenter.org/t/error-about-floating-point-exception/5124 "2024-08-01T08:23:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ycyeong](https://avatars.discourse-cdn.com/v4/letter/y/cab0a1/32.png) [@ycyeong](https://forum.cmascenter.org/u/ycyeong)\
**Post date:** [August 1, 2024, 8:23am UTC](https://forum.cmascenter.org/t/error-about-floating-point-exception/5124/1 "2024-08-01T08:23:23Z")

</div>

Dear all,

I am running the wrf-cmaq twoway model in CMAQ version 5.4.  
To compare the effect of aerosol feedback in winter and summer, I am running one month each for January and July 2020, adjusting the feedback option. When I set **NPROCS** to **24** and ran a total of 4 cases, I got the error “Floating point exception for CFRAC\_3D” in the two summer cases.  
So I set NPROCS to **28** and ran the summer sf (feedback on) case and found that it worked fine without the error.  
However, I tried setting NPROCS up to **36** (maximum number of CPUs) for the nf (feedback off) case and found that the _model always stopped at the same time with the same error._ What could be the problem?  
I’ve attached the error code below.

```auto
     Processing Day/Time [YYYYDDD:HHMMSS]: 2020186:054000
       Which is Equivalent to (UTC): 5:40:00 Saturday, July 4, 2020
       Time-Step Length (HHMMSS): 000500
     Beginning Emissions
       Calling Real Emissions at Date: 2020186 and time: 54230

     After VDIFF : Gas 2.250E-01 | Aer 6.738E+09 | Non 6.313E-04
     After COUPLE : Gas 1.918E+03 | Aer 1.940E+14 | Non 5.302E+00

     ATTENTION: Applying fix to aerosol Boundary Conditions for aerosol modes.
       Set verbose_rdbcon preprocessor flag to learn more.

     After HADV : Gas 1.918E+03 | Aer 1.902E+14 | Non 5.343E+00
     After ADV : Gas 1.918E+03 | Aer 1.902E+14 | Non 5.342E+00
     After HDIFF : Gas 1.918E+03 | Aer 1.902E+14 | Non 5.342E+00
     After DECOUPLE : Gas 2.250E-01 | Aer 6.612E+09 | Non 6.361E-04

  COL, ROW, LAY = 26 1 27

  TA, PRES = 2.2171E+02 1.8352E+04

  QV, QC, QI, QS = -4.4278E-07 2.1908E-09 0.0000E+00 0.0000E+00

  ESW, ESI, QVSW, QVSI = 5.1303E+00 3.1842E+00 1.7394E-04 1.0794E-04

  WEIGH, QVS_WEIGH = 0.0000E+00 1.7394E-04

  SUBSAT, RHUM, RHGRID, ARG = 1.7438E-04 -2.5457E-03 1.0000E+00 -1.5215E-05

     *** ERROR ABORT in subroutine CAL_CFRAC_3D on PE 010
     Floating point exception for CFRAC_3D

     *** ERROR ABORT in subroutine CAL_CFRAC_3D on PE 010
     Floating point exception for CFRAC_3D
     Date&time specified as 0

```

---

<div class="post-metadata">

**Author:** ![wong.david-c](https://avatars.discourse-cdn.com/v4/letter/w/bcef8e/32.png) [@wong.david-c](https://forum.cmascenter.org/u/wong.david-c)\
**Post date:** [August 27, 2024, 2:48pm UTC](https://forum.cmascenter.org/t/error-about-floating-point-exception/5124/2 "2024-08-27T14:48:31Z")

</div>

Hi ycyeong,

Could you please add an additional flag -traceback (I assume you used ifort compiler) in the cmaq/Makefile.twoway? Then delete all cmaq/_.o cmaq/_.mod and then recompile the model by typing “compile em\_real \>& mylog”. Hopefully it will show you at what line in CAL\_CFRAC\_3D subroutine. By the way, what are the sizes of your wrf and cmaq domain?

Cheers,  
David

---

<div class="post-metadata">

**Author:** ![ycyeong](https://avatars.discourse-cdn.com/v4/letter/y/cab0a1/32.png) [@ycyeong](https://forum.cmascenter.org/u/ycyeong)\
**Post date:** [August 28, 2024, 2:19am UTC](https://forum.cmascenter.org/t/error-about-floating-point-exception/5124/3 "2024-08-28T02:19:41Z")

</div>

Thank you for your reply.  
My domain size is 150x130 (137x117).  
This error has been resolved. The error occurred because I set sf\_sflay\_physics and bl\_pbl\_physics to 1 in namelist.input. Maybe it comes from a lot of computation. I was able to get out of the error after changing the two options to 7.

---

<div class="post-metadata">

**Author:** ![wong.david-c](https://avatars.discourse-cdn.com/v4/letter/w/bcef8e/32.png) [@wong.david-c](https://forum.cmascenter.org/u/wong.david-c)\
**Post date:** [August 28, 2024, 1:19pm UTC](https://forum.cmascenter.org/t/error-about-floating-point-exception/5124/4 "2024-08-28T13:19:03Z")

</div>

Hi ycyeong,

I am glad to hear your issue has been resolved. For the WRF-CMAQ coupled model, (I believe coupled model document has stated) it needs to use PX related options. For example, sf\_sflay\_phsics, it needs to use option 7, PX surface layer.

Cheers,  
David

---

<div class="post-metadata">

**Author:** ![ycyeong](https://avatars.discourse-cdn.com/v4/letter/y/cab0a1/32.png) [@ycyeong](https://forum.cmascenter.org/u/ycyeong)\
**Post date:** [December 8, 2024, 9:07am UTC](https://forum.cmascenter.org/t/error-about-floating-point-exception/5124/5 "2024-12-08T09:07:52Z")

</div>

Hi,

Unfortunately, I am encountering the same error again.  
The error occurs within the `CAL_CFRAC_3D` subroutine in `PHOT_MET_DATA.F`, as shown below:

```auto
IF (CFRAC_3D(I,J,K) .NE. CFRAC_3D(I,J,K) .OR.
    & CFRAC_3D(I,J,K) .GT. 1.0) THEN
    WRITE(LOGDEV,'(/2X,A,3I6)') 'COL, ROW, LAY = ', I, J, K
    WRITE(LOGDEV,'(/2X,A,4ES12.4)')
    & 'TA, PRES = ', TA(I,J,K), PRES(I,J,K)
    WRITE(LOGDEV,'(/2X,A,4ES12.4)')
    & 'QV, QC, QI, QS = ', QV(I,J,K), QC(I,J,K), QI(I,J,K), QS(I,J,K)
    WRITE(LOGDEV,'(/2X,A,4ES12.4)')
    & 'ESW, ESI, QVSW, QVSI = ', ESW, ESI, QVSW, QVSI
    WRITE(LOGDEV,'(/2X,A,4ES12.4)')
    & 'WEIGH, QVS_WEIGH = ', WHT, QVS_WEIGHT
    WRITE(LOGDEV,'(/2X,A,4ES12.4)')
    & 'SUBSAT, RHUM, RHGRID, ARG = ', SUBSAT, RHUM, RHGRID, ARG
    XMSG = 'Floating point exception for CFRAC_3D'
    CALL M3EXIT('CAL_CFRAC_3D', 0, 0, XMSG, XSTAT1)
END IF

```

The error is triggered because the calculated value of `CFRAC_3D(I,J,K)` meets the conditions of the `IF` statement above. Upon investigation, I found that some of the meteorological variables(QV, RHUM etc) included in the error message have negative values, which seem to affect the calculation of `CFRAC_3D`.

Additionally, I will attach the namelist.input file I used for reference.  
[namelist.txt](https://forum.cmascenter.org/uploads/short-url/62Ys5K1qNwPqIZ7Fco9WNz8Eyrb.txt) (4.8 KB)
