E3SM-Project / E3SM-Project/E3SM

Question on the definition of nlevbed

Open
#8,409 0 comments 0 reactions 0 assignees View on GitHub
ELM
Dominant language
Fortran
Stars
440
Forks
481
Avg merge
4d 6h
Merged PRs (30d)
36

Description

I have a problem understanding how the ELM is setting the nlevbed when the 'zbedrock' was given in the surface file. The code is copied below:
```fortran
! check for near zero DTBs, set minimum value
beddep = max(dtb(g,ti), 0.2_r8)
j = 0
zimid = 0._r8
do while (zimid < beddep .and. j < nlevgrnd)
zimid = 0.5_r8*(zisoi(j)+zisoi(j+1))
if (beddep > zimid) then
nlevbed = j + 1
else
nlevbed = j
end if
j = j + 1
enddo
nlevbed = max(nlevbed, 5)
nlevbed = min(nlevbed, nlevgrnd)
col_pp%nlevbed(c) = nlevbed
col_pp%zibed(c) = zisoi(nlevbed)
```
The calculation of the zosoi is copied as well:
```fortran
zisoi(0) = 0._r8
do j = 1, nlevgrnd-1
zisoi(j) = 0.5_r8*(zsoi(j)+zsoi(j+1)) !interface depths
enddo
zisoi(nlevgrnd) = zsoi(nlevgrnd) + 0.5_r8*dzsoi(nlevgrnd)
```
According to the code, the zisoi(i) denote the lower boundary of the i-th soil layer, so the zimid(j) should be the middle point of the (j+1)-th soil layer. Why the setting of the nlevbed is dependent on the comparison of the middle point of each layer? For example, if the bedrock bounday lies within 11-th layer but is between its upper boundary and middle point, the model sets the nlevbed as 10, which means not only the 11-th layer but also the 10-th layer are treated as bedrock, even though the zbedrock is deeper than the lower boundary of the 10-th layer?

Contributor guide

Open the contributing guide

Research direction

Start by tracing the shown nlevbed loop alongside the zisoi and zimid calculations, focusing on how the bedrock depth maps to soil-layer boundaries. Compare the loop's result with the stated 11th-layer example and document the intended meaning of nlevbed and zibed; done means the layer-selection behavior is explained clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
fortran
Domain
backend
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.