A bug was identified within the CMAQ to WRF coupling routine (twoway_feedback.F90) where aerosol feedback information is transferred from CMAQ to WRF. In doing so, it was found that WRF was not receiving the correct aerosol feedback information due to the number of layers looping index error related to its value being reset unintentionally, which resulted in the aerosol optical properties not being correctly updated through the model vertical extent. The distinct symptom of this bug is the AOD and other calculated aerosol optical properties in the wrfout files (no matter which wavelength) does not exhibit temporal variability. This bug impacts the WRF-CMAQ coupled system in the CMAQv5.3 release series only (v5.3, v5.3.1, v5.3.2, v5.3.3) when running with short wave radiative feedback. The bug was not present in prior WRF-CMAQ versions.
In the original code, there was a nested loop:
do l = 1, NLAYS3D do r = tw_sr, tw_er do c = tw_sc, tw_ec grid%mass_ws_i(c, l, r) = feedback_data_wrf(c-tw_sc+1,r-tw_sr+1,l,1) . . . end do end do end do
and followed by a block of code assigning the top layer data to the top layer + 1.
The value of NLAYS3D (an IOAPI library specific variable), which was the number of layers in the model, was obtained within the firstime block by calling DESC3(feedback_fname). If there was another DESC3 call with a non 3D file before the subsequent call to twoway_read, the above calculations will be incorrect. Fortunately, this scenario did not happen in the coupled model with CMAQ 5.2 or earlier version.
The introduction of the Centralized Input/Output (CIO) module in CMAQ 5.3 resulted in a new data flow pattern in CMAQ particularly the call sequence of basic IOAPI routines OPEN3 and DESC3. NLAYS3D’s value ended up with 1 in the subsequent call to twoway_read routine and materialized the bug.
Significance and Impact:
If your WRF-CMAQ coupled is using CMAQ version 5.2 or earlier, there is NO impact. With CMAQ 5.3 or later version, the aerosol optical properties and estimated aerosol direct effects are impacted. A correction to this error has been implemented and will be available in CMAQv5.4 (expected to be publicly available soon) and is summarized below.
-- in routine feedback_read, declared a new local variable integer, save :: loc_nlays -- assigned NLAYS3d to loc_nlays before the end of the firstime block loc_nlays = nlays3d -- replaced each NLAYS3D with loc_nlays from the end of the first block to the end of subroutine