-
Notifications
You must be signed in to change notification settings - Fork 54
Description
The qneg4 routine in the v0 Fortran code (located at components/eam/src/physics/cam/qneg4.F90) needs to be converted to c++. This code block checks to see if moisture flux into the ground (negative value of latent heat flux) exceeds the total moisture content of the lowest model layer. Currently, v1 produces negative values of water vapor near the surface (primarily during model spin-up) and this will provide a patch for that in an energy conserving manner.
Lines 64 through 77 represent the essential code that needs to be converted. The rest of the code is for bookkeeping purposes to keep track of the number incidences of clipping (not sure if we want to convert that portion).
In v1 this block of code should be called in the macrophysics (SHOC) interface directly before shoc_main is called.
scream/components/eam/src/physics/cam/qneg4.F90
Lines 58 to 77 in 1084bdc
| ! | |
| ! Compute excess downward (negative) q flux compared to a theoretical | |
| ! maximum downward q flux. The theoretical max is based upon the | |
| ! given moisture content of lowest level of the model atmosphere. | |
| ! | |
| nptsexc = 0 | |
| do i = 1,ncol | |
| excess(i) = qflx(i,1) - (qmin(1) - qbot(i,1))/(ztodt*gravit*srfrpdel(i)) | |
| ! | |
| ! If there is an excess downward (negative) q flux, then subtract | |
| ! excess from "qflx" and "lhflx" and add to "shflx". | |
| ! | |
| if (excess(i) < 0._r8) then | |
| nptsexc = nptsexc + 1 | |
| indxexc(nptsexc) = i | |
| qflx (i,1) = qflx (i,1) - excess(i) | |
| lhflx(i) = lhflx(i) - excess(i)*latvap | |
| shflx(i) = shflx(i) + excess(i)*latvap | |
| end if | |
| end do |