Skip to content

Commit

Permalink
Merge pull request ESCOMP#468 from billsacks/simple_bfb
Browse files Browse the repository at this point in the history
Minor bug fixes, cleanup, documentation and enhancements
  • Loading branch information
ekluzek authored Aug 6, 2018
2 parents ffce211 + 64284f5 commit 0a81de1
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 46 deletions.
2 changes: 1 addition & 1 deletion src/biogeochem/CNDriverMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ subroutine CNDriverNoLeaching(bounds,
dgvs_inst, cnveg_state_inst, &
cnveg_carbonstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, &
leaf_prof_patch=soilbiogeochem_state_inst%leaf_prof_patch(begp:endp, 1:nlevdecomp_full), &
froot_prof_patch=soilbiogeochem_state_inst%froot_prof_patch(begp:endp, 1:nlevdecomp_full), &
froot_prof_patch=soilbiogeochem_state_inst%froot_prof_patch(begp:endp, 1:nlevdecomp_full), &
croot_prof_patch=soilbiogeochem_state_inst%croot_prof_patch(begp:endp, 1:nlevdecomp_full), &
stem_prof_patch=soilbiogeochem_state_inst%stem_prof_patch(begp:endp, 1:nlevdecomp_full), &
totsomc_col=soilbiogeochem_carbonstate_inst%totsomc_col(begc:endc), &
Expand Down
2 changes: 1 addition & 1 deletion src/biogeochem/CNFUNMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@ subroutine CNFUN(bounds,num_soilc, filter_soilc,num_soilp&
frac_ideal_C_use = max(0.0_r8,1.0_r8 - (total_N_resistance-fun_cn_flex_a(ivt(p)))/fun_cn_flex_b(ivt(p)) )
! then, if the plant is very much in need of N, the C used for uptake is increased accordingly.
if(delta_CN .gt.0.and. frac_ideal_C_use.lt.1.0)then
frac_ideal_C_use = frac_ideal_C_use + (1.0_r8-frac_ideal_C_use)*min(1.0_r8, delta_CN/fun_cn_flex_c(ivt(p)));
frac_ideal_C_use = frac_ideal_C_use + (1.0_r8-frac_ideal_C_use)*min(1.0_r8, delta_CN/fun_cn_flex_c(ivt(p)))
end if
! If we have too much N (e.g. from free N retranslocation) then make frac_ideal_c_use even lower.
! For a CN delta of fun_cn_flex_c, then we reduce C expendiure to the minimum of 0.5.
Expand Down
2 changes: 1 addition & 1 deletion src/biogeochem/CNGapMortalityMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ subroutine CNGapMortality (bounds, num_soilc, filter_soilc, num_soilp, filter_so
cnveg_carbonflux_inst%m_livecrootc_to_litter_patch(p) = cnveg_carbonstate_inst%livecrootc_patch(p) * m
if (spinup_state == 2 .and. .not. use_cndv) then !accelerate mortality of dead woody pools
cnveg_carbonflux_inst%m_deadstemc_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_patch(p) * m * 10._r8
cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m * 10._r8
cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m * 10._r8
else
cnveg_carbonflux_inst%m_deadstemc_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_patch(p) * m
cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m
Expand Down
2 changes: 1 addition & 1 deletion src/biogeochem/CNVegNitrogenFluxType.F90
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ subroutine InitHistory(this, bounds)
ptr_patch=this%fert_patch)
end if

if (use_crop) then
if (use_crop .and. .not. use_fun) then
this%soyfixn_patch(begp:endp) = spval
call hist_addfld1d (fname='SOYFIXN', units='gN/m^2/s', &
avgflag='A', long_name='soybean fixation', &
Expand Down
4 changes: 2 additions & 2 deletions src/biogeophys/CanopyTemperatureMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ subroutine CanopyTemperature(bounds, &
real(r8) :: qsatgdT ! d(qsatg)/dT
real(r8) :: fac ! soil wetness of surface layer
real(r8) :: psit ! negative potential of soil
real(r8) :: hr ! relative humidity
real(r8) :: hr_road_perv ! relative humidity for urban pervious road
real(r8) :: hr ! alpha soil
real(r8) :: hr_road_perv ! alpha soil for urban pervious road
real(r8) :: wx ! partial volume of ice and water of surface layer
real(r8) :: fac_fc ! soil wetness of surface layer relative to field capacity
real(r8) :: eff_porosity ! effective porosity in layer
Expand Down
5 changes: 3 additions & 2 deletions src/biogeophys/SurfaceAlbedoMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,14 @@ subroutine SurfaceAlbedoInitTimeConst(bounds)
allocate(isoicol(bounds%begc:bounds%endc))

! Determine soil color and number of soil color classes
! if number of soil color classes is not on input dataset set it to 8

call getfil (fsurdat, locfn, 0)
call ncd_pio_openfile (ncid, locfn, 0)

call ncd_io(ncid=ncid, varname='mxsoil_color', flag='read', data=mxsoil_color, readvar=readvar)
if ( .not. readvar ) mxsoil_color = 8
if ( .not. readvar ) then
call endrun(msg=' ERROR: mxsoil_color NOT on surfdata file '//errMsg(sourcefile, __LINE__))
end if

allocate(soic2d(bounds%begg:bounds%endg))
call ncd_io(ncid=ncid, varname='SOIL_COLOR', flag='read', data=soic2d, dim1name=grlnd, readvar=readvar)
Expand Down
4 changes: 0 additions & 4 deletions src/dyn_subgrid/.gitignore

This file was deleted.

26 changes: 5 additions & 21 deletions src/main/ncdio_pio.F90.in
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ module ncdio_pio
interface ncd_io
module procedure ncd_io_char_var0_start_glob

!DIMS 0,1
!DIMS 0
module procedure ncd_io_{DIMS}d_log_glob

!DIMS 0,1,2,3
Expand Down Expand Up @@ -1192,11 +1192,11 @@ contains
end subroutine ncd_io_char_var0_start_glob

!------------------------------------------------------------------------
!DIMS 0,1
!DIMS 0
subroutine ncd_io_{DIMS}d_log_glob(varname, data, flag, ncid, readvar, nt, posNOTonfile)
!
! !DESCRIPTION:
! netcdf I/O of global integer variable
! netcdf I/O of global logical variable
!
! !ARGUMENTS:
class(file_desc_t) , intent(inout) :: ncid ! netcdf file id
Expand Down Expand Up @@ -1242,12 +1242,7 @@ contains
call shr_sys_abort(' ERROR: bad integer value for logical data'//errMsg(sourcefile, __LINE__))
end if
#else
allocate(idata1d(size(data)))
data = (idata1d == 1)
if ( any(idata1d /= 0 .and. idata1d /= 1) )then
call shr_sys_abort(' ERROR: read in bad integer value(s) for logical data'//errMsg(sourcefile, __LINE__))
end if
deallocate(idata1d)
call shr_sys_abort('ncd_io_*_log_glob not implemented for DIMS > 0')
#endif
endif
if (present(readvar)) readvar = varpresent
Expand All @@ -1267,18 +1262,7 @@ contains
status = pio_put_var(ncid, varid, start, count, idata1d)
deallocate(idata1d)
#else
start(1) = 1 ; count(1) = size(data)
start(2) = 1 ; count(2) = 1
if (present(nt)) start(2) = nt
allocate(idata1d(size(data)))
where( data )
idata1d = 1
elsewhere
idata1d = 0
end where
call ncd_inqvid (ncid, varname, varid, vardesc)
status = pio_put_var(ncid, varid, start, count, idata1d)
deallocate( idata1d )
call shr_sys_abort('ncd_io_*_log_glob not implemented for DIMS > 0')
#endif

endif ! flag
Expand Down
8 changes: 4 additions & 4 deletions src/main/restFileMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -714,10 +714,10 @@ subroutine restFile_dimcheck( ncid )
call check_dim(ncid, namep, nump, msg=msg)
if ( use_fates ) call check_dim(ncid, nameCohort , numCohort, msg=msg)
end if
call check_dim(ncid, 'levsno' , nlevsno, &
msg = 'You can deal with this mismatch by rerunning with ' // &
'use_init_interp = .true. in user_nl_clm')
call check_dim(ncid, 'levgrnd' , nlevgrnd)
msg = 'You can deal with this mismatch by rerunning with ' // &
'use_init_interp = .true. in user_nl_clm'
call check_dim(ncid, 'levsno' , nlevsno, msg=msg)
call check_dim(ncid, 'levgrnd' , nlevgrnd, msg=msg)
call check_dim(ncid, 'levurb' , nlevurb)
call check_dim(ncid, 'levlak' , nlevlak)

Expand Down
2 changes: 0 additions & 2 deletions src/unit_test_shr/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions src/unit_test_stubs/main/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions src/unit_test_stubs/utils/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions src/utils/.gitignore

This file was deleted.

0 comments on commit 0a81de1

Please sign in to comment.