@@ -25,9 +25,9 @@ module VerticalProfileMod
2525 logical , public :: exponential_rooting_profile = .true.
2626 logical , public :: pftspecific_rootingprofile = .true.
2727 ! how steep profile is for root C inputs (1/ e-folding depth) (1/m)
28- real (r8 ), public :: rootprof_exp = 3 .
28+ real (r8 ), public :: rootprof_exp = 3._r8
2929 ! how steep profile is for surface components (1/ e_folding depth) (1/m)
30- real (r8 ), public :: surfprof_exp = 10 .
30+ real (r8 ), public :: surfprof_exp = 10._r8
3131 !- ----------------------------------------------------------------------
3232
3333contains
@@ -83,7 +83,8 @@ subroutine decomp_vertprofiles(bounds, &
8383 real (r8 ) :: ndep_prof_sum
8484 real (r8 ) :: nfixation_prof_sum
8585 real (r8 ) :: pdep_prof_sum
86- real (r8 ) :: delta = 1.e-10
86+ real (r8 ) :: delta = 1.e-10_r8
87+ real (r8 ), parameter :: smallparameter = tiny (1._r8 )
8788 character (len= 32 ) :: subname = ' decomp_vertprofiles'
8889 !- ----------------------------------------------------------------------
8990
@@ -191,7 +192,7 @@ subroutine decomp_vertprofiles(bounds, &
191192 surface_prof_tot = surface_prof_tot + surface_prof(j) * dzsoi_decomp(j)
192193 end if
193194 end do
194- if ( (altmax_lastyear_indx(c) > 0 ) .and. (rootfr_tot > 0._r8 ) .and. (surface_prof_tot > 0._r8 ) ) then
195+ if ( (altmax_lastyear_indx(c) > 0 ) .and. (rootfr_tot > smallparameter ) .and. (surface_prof_tot > smallparameter ) ) then
195196 ! where there is not permafrost extending to the surface, integrate the profiles over the active layer
196197 ! this is equivalnet to integrating over all soil layers outside of permafrost regions
197198 do j = 1 , min (max (altmax_lastyear_indx(c), 1 ), nlevdecomp)
@@ -212,10 +213,10 @@ subroutine decomp_vertprofiles(bounds, &
212213 end do
213214 else
214215 ! if fully frozen, or no roots, put everything in the top layer
215- froot_prof(p,1 ) = 1 ./ dzsoi_decomp(1 )
216- croot_prof(p,1 ) = 1 ./ dzsoi_decomp(1 )
217- leaf_prof(p,1 ) = 1 ./ dzsoi_decomp(1 )
218- stem_prof(p,1 ) = 1 ./ dzsoi_decomp(1 )
216+ froot_prof(p,1 ) = 1._r8 / dzsoi_decomp(1 )
217+ croot_prof(p,1 ) = 1._r8 / dzsoi_decomp(1 )
218+ leaf_prof(p,1 ) = 1._r8 / dzsoi_decomp(1 )
219+ stem_prof(p,1 ) = 1._r8 / dzsoi_decomp(1 )
219220 endif
220221
221222 end do
@@ -250,19 +251,19 @@ subroutine decomp_vertprofiles(bounds, &
250251 surface_prof_tot = surface_prof_tot + surface_prof(j) * dzsoi_decomp(j)
251252 end do
252253 if (col_pp% is_fates(c))then
253- if ( (altmax_lastyear_indx(c) > 0 ) .and. (surface_prof_tot > 0._r8 ) ) then
254+ if ( (altmax_lastyear_indx(c) > 0 ) .and. (surface_prof_tot > smallparameter ) ) then
254255 do j = 1 ,min (alt_ind, nlevbed)
255256 nfixation_prof(c,j) = surface_prof(j)/ surface_prof_tot
256257 ndep_prof(c,j) = surface_prof(j)/ surface_prof_tot
257258 pdep_prof(c,j) = surface_prof(j)/ surface_prof_tot
258259 end do
259260 else
260- nfixation_prof(c,1 ) = 1 ./ dzsoi_decomp(1 )
261- ndep_prof(c,1 ) = 1 ./ dzsoi_decomp(1 )
262- pdep_prof(c,1 ) = 1 ./ dzsoi_decomp(1 )
261+ nfixation_prof(c,1 ) = 1._r8 / dzsoi_decomp(1 )
262+ ndep_prof(c,1 ) = 1._r8 / dzsoi_decomp(1 )
263+ pdep_prof(c,1 ) = 1._r8 / dzsoi_decomp(1 )
263264 endif
264265 else
265- if ( (altmax_lastyear_indx(c) > 0 ) .and. (rootfr_tot > 0._r8 ) .and. (surface_prof_tot > 0._r8 ) ) then
266+ if ( (altmax_lastyear_indx(c) > 0 ) .and. (rootfr_tot > smallparameter ) .and. (surface_prof_tot > smallparameter ) ) then
266267 do j = 1 , min (max (altmax_lastyear_indx(c), 1 ), nlevdecomp)
267268 nfixation_prof(c,j) = col_cinput_rootfr(c,j) / rootfr_tot
268269 if (j <= nlevbed) then
@@ -271,9 +272,9 @@ subroutine decomp_vertprofiles(bounds, &
271272 end if
272273 end do
273274 else
274- nfixation_prof(c,1 ) = 1 ./ dzsoi_decomp(1 )
275- ndep_prof(c,1 ) = 1 ./ dzsoi_decomp(1 )
276- pdep_prof(c,1 ) = 1 ./ dzsoi_decomp(1 )
275+ nfixation_prof(c,1 ) = 1._r8 / dzsoi_decomp(1 )
276+ ndep_prof(c,1 ) = 1._r8 / dzsoi_decomp(1 )
277+ pdep_prof(c,1 ) = 1._r8 / dzsoi_decomp(1 )
277278 endif
278279 end if
279280 end do
@@ -294,9 +295,9 @@ subroutine decomp_vertprofiles(bounds, &
294295 ! check to make sure integral of all profiles = 1.
295296 do fc = 1 ,num_soilc
296297 c = filter_soilc(fc)
297- ndep_prof_sum = 0 .
298- nfixation_prof_sum = 0 .
299- pdep_prof_sum = 0 .
298+ ndep_prof_sum = 0._r8
299+ nfixation_prof_sum = 0._r8
300+ pdep_prof_sum = 0._r8
300301 do j = 1 , nlevdecomp
301302 ndep_prof_sum = ndep_prof_sum + ndep_prof(c,j) * dzsoi_decomp(j)
302303 nfixation_prof_sum = nfixation_prof_sum + nfixation_prof(c,j) * dzsoi_decomp(j)
@@ -324,10 +325,10 @@ subroutine decomp_vertprofiles(bounds, &
324325
325326 do fp = 1 ,num_soilp
326327 p = filter_soilp(fp)
327- froot_prof_sum = 0 .
328- croot_prof_sum = 0 .
329- leaf_prof_sum = 0 .
330- stem_prof_sum = 0 .
328+ froot_prof_sum = 0._r8
329+ croot_prof_sum = 0._r8
330+ leaf_prof_sum = 0._r8
331+ stem_prof_sum = 0._r8
331332 do j = 1 , nlevdecomp
332333 froot_prof_sum = froot_prof_sum + froot_prof(p,j) * dzsoi_decomp(j)
333334 croot_prof_sum = croot_prof_sum + croot_prof(p,j) * dzsoi_decomp(j)
@@ -336,7 +337,19 @@ subroutine decomp_vertprofiles(bounds, &
336337 end do
337338 if ( ( abs (froot_prof_sum - 1._r8 ) > delta ) .or. ( abs (croot_prof_sum - 1._r8 ) > delta ) .or. &
338339 ( abs (stem_prof_sum - 1._r8 ) > delta ) .or. ( abs (leaf_prof_sum - 1._r8 ) > delta ) ) then
340+ c = veg_pp% column(p)
339341 write (iulog, * ) ' profile sums: ' , froot_prof_sum, croot_prof_sum, leaf_prof_sum, stem_prof_sum
342+ write (iulog, * ) ' c: ' ,c
343+ write (iulog, * ) ' altmax_lastyear_indx: ' , altmax_lastyear_indx(c)
344+ write (iulog, * ) ' cinput_rootfr: ' , col_cinput_rootfr(c,:)
345+ write (iulog, * ) ' dzsoi_decomp: ' , dzsoi_decomp(:)
346+ write (iulog, * ) ' surface_prof: ' , surface_prof(:)
347+ write (iulog, * ) ' p, itype(p), wtcol(p): ' , p, veg_pp% itype(p), veg_pp% wtcol(p)
348+ write (iulog, * ) ' cinput_rootfr(p,:): ' , cinput_rootfr(p,:)
349+ write (iulog,* ) ' croot_prof(p,:): ' ,croot_prof(p,:)
350+ write (iulog,* ) ' froot_prof(p,:): ' ,froot_prof(p,:)
351+ write (iulog,* ) ' leaf_prof(p,:): ' ,leaf_prof(p,:)
352+ write (iulog,* ) ' stem_prof(p,:): ' ,stem_prof(p,:)
340353 call endrun(msg= ' ERROR: sum-1 > delta' // errMsg(__FILE__, __LINE__))
341354 endif
342355 end do
0 commit comments