Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

A bug in CLM root distribution function

Hi all,I was curious about the root distribution in CESM for different PFTs so I tried plot them in Matlab using the functions given in the Tech book. But I met error, so I found out the original paper of Zeng X., 2001 which gave a description of the original root distribution equation. I wrote the numerical equations myself, compared them to the code, and I found this bug.The root fraction rootfr in each soil layer currently is calculated as:         do lev = 1, nlevsoi-1
            rootfr(p,lev) = .5_r8*( exp(-roota_par(ivt(p)) * zi(c,lev-1))  &
                               + exp(-rootb_par(ivt(p)) * zi(c,lev-1))  &
                               - exp(-roota_par(ivt(p)) * zi(c,lev  ))  &
                               - exp(-rootb_par(ivt(p)) * zi(c,lev  )) )
         end do
         rootfr(p,nlevsoi) = .5_r8*( exp(-roota_par(ivt(p)) * zi(c,nlevsoi-1))  &
                                + exp(-rootb_par(ivt(p)) * zi(c,nlevsoi-1)) )
 However, given the equation that Zeng X.2001 gave, the calculation should be:         lev = 1         rootfr(p,lev) = 1 - .5_r8*( exp(-roota_par(ivt(p)) * zi(c,lev))  &
                               + exp(-rootb_par(ivt(p)) * zi(c,lev)) )         do lev = 2, nlevsoi
            rootfr(p,lev) = .5_r8*( exp(-roota_par(ivt(p)) * zi(c,lev-1))  &
                               + exp(-rootb_par(ivt(p)) * zi(c,lev-1))  &
                               - exp(-roota_par(ivt(p)) * zi(c,lev  ))  &
                               - exp(-rootb_par(ivt(p)) * zi(c,lev  )) )
         end doThe corrected equation will give a cumulative root fraction of 1 by adding all of the root fractions throughout the soil layers while the current equation does not. Hope this helps. Ming
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member

Code:
It appears to be correct as coded.  I coded up the tech note equations in
NCL and it sums to one for all pfts.  I also checked the output of the
CLM4.5 code and it sums to one as well.
Here is the output for grassland, which sums to one:

(1)     0.1048206
(2)     0.1338198
(3)     0.1595498
(4)     0.1617819
(5)     0.138807
(6)     0.1124461
(7)     0.09343975
(8)     0.06386776
(9)     0.02640226
(10)    0.005065059<br /><br />You could check your calculations against this.<br /><br />

Keith Oleson<br />NCAR
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member

Code:
It appears to be correct as coded.  I coded up the tech note equations in
NCL and it sums to one for all pfts.  I also checked the output of the
CLM4.5 code and it sums to one as well.
Here is the output for grassland, which sums to one:

(1)     0.1048206
(2)     0.1338198
(3)     0.1595498
(4)     0.1617819
(5)     0.138807
(6)     0.1124461
(7)     0.09343975
(8)     0.06386776
(9)     0.02640226
(10)    0.005065059<br /><br />You could check your calculations against this.<br /><br />

Keith Oleson<br />NCAR
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member

Code:
It appears to be correct as coded.  I coded up the tech note equations in
NCL and it sums to one for all pfts.  I also checked the output of the
CLM4.5 code and it sums to one as well.
Here is the output for grassland, which sums to one:

(1)     0.1048206
(2)     0.1338198
(3)     0.1595498
(4)     0.1617819
(5)     0.138807
(6)     0.1124461
(7)     0.09343975
(8)     0.06386776
(9)     0.02640226
(10)    0.005065059<br /><br />You could check your calculations against this.<br /><br />

Keith Oleson<br />NCAR
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member

Code:
It appears to be correct as coded.  I coded up the tech note equations in
NCL and it sums to one for all pfts.  I also checked the output of the
CLM4.5 code and it sums to one as well.
Here is the output for grassland, which sums to one:

(1)     0.1048206
(2)     0.1338198
(3)     0.1595498
(4)     0.1617819
(5)     0.138807
(6)     0.1124461
(7)     0.09343975
(8)     0.06386776
(9)     0.02640226
(10)    0.005065059<br /><br />You could check your calculations against this.<br /><br />

Keith Oleson<br />NCAR
 
Dear Keith,
Thank you for your reply. NCL has the subscripts starting from 0, while in matlab subscripts start from 1 (that is why I got error message from the first equation). I remember that in CESM all the subscript start from 0 as well (This is a little bit confusing...) If that's true and there is a z0=0 in CESM, then the two coding are actually the same. Thank you for discussing with me.Best,Ming 
 
Dear Keith,
Thank you for your reply. NCL has the subscripts starting from 0, while in matlab subscripts start from 1 (that is why I got error message from the first equation). I remember that in CESM all the subscript start from 0 as well (This is a little bit confusing...) If that's true and there is a z0=0 in CESM, then the two coding are actually the same. Thank you for discussing with me.Best,Ming 
 
Dear Keith,
Thank you for your reply. NCL has the subscripts starting from 0, while in matlab subscripts start from 1 (that is why I got error message from the first equation). I remember that in CESM all the subscript start from 0 as well (This is a little bit confusing...) If that's true and there is a z0=0 in CESM, then the two coding are actually the same. Thank you for discussing with me.Best,Ming 
 
Dear Keith,
Thank you for your reply. NCL has the subscripts starting from 0, while in matlab subscripts start from 1 (that is why I got error message from the first equation). I remember that in CESM all the subscript start from 0 as well (This is a little bit confusing...) If that's true and there is a z0=0 in CESM, then the two coding are actually the same. Thank you for discussing with me.Best,Ming 
 
Top