Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With the PBL scheme, K_turb may become negative below the surface (k<0). This is due to the fact that the box operations in PBL are over a growntilebox(1) so they include halo cells in each region. At k==-1 the zval is negative and thus so it the l_S length scale. This can cause K_turb below the surface to become negative and flip the direction of diffusion.
Since MOST utilizes eta at the surface (k==0) to define the molecular fluxes, the following patch will limit zval to the quantity obtained with k==0 and thus K_turb at k==-1 will match that at k==0. This ensures the correct diffusive behavior at the bottom boundary. The top boundary should not require any special treatment since zval is still positive.