Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Groundwater irrigation #523

Merged
merged 48 commits into from
Dec 3, 2018
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
aeb6a55
implement groundwater irrigation and drip/sprinkler irrigation applic…
swensosc Sep 24, 2018
bb59407
add namelist variables for groundwater irrigation and crop fsat = 0
swensosc Sep 27, 2018
448f1e7
add default irrigation method behavior
swensosc Sep 27, 2018
a784d4a
remove 22sl_8.5m soil layer structure
swensosc Oct 8, 2018
952e0a6
add bounds to available_gw_uncon in clm_driver
swensosc Oct 8, 2018
0e6817d
fix vector output of l/c/p indices
swensosc Oct 8, 2018
cfcc84d
add irrig_method_unset, fix handling of invalid irrig_method values
swensosc Oct 8, 2018
0879727
remove col%itype check
swensosc Oct 8, 2018
cedea67
add qflx_liq_above_canopy
swensosc Oct 8, 2018
4640cc1
change irrig_rate_patch to sfc_irrig_rate_patch
swensosc Oct 8, 2018
457fc54
move calculation of available_gw_uncon out of thetabasedwatertable in…
swensosc Oct 8, 2018
e0a16d5
Move groundwater irrigation division to ApplyIrrigation.
swensosc Oct 9, 2018
0d5c887
add validity check for use_aquifer_layer case
swensosc Oct 9, 2018
d7c8b8d
remove irrigation from unconfined aquifer after baseflow
swensosc Oct 10, 2018
1fd6410
Merge remote-tracking branch 'escomp/master' into groundwater_irrigation
billsacks Nov 8, 2018
e516e6e
Remove unnecessary use statement that was causing circular dependencies
billsacks Nov 8, 2018
5971ade
collect and move groundwater irrigation removal
swensosc Nov 8, 2018
755c6fd
Merge branch 'groundwater_irrigation' of github.com:swensosc/ctsm int…
swensosc Nov 8, 2018
e77b778
Reduce dependencies for the sake of the unit test build
billsacks Nov 9, 2018
cc565a0
Remove notes that are no longer relevant
billsacks Nov 9, 2018
073e067
Remove unused arguments
billsacks Nov 9, 2018
3430e42
add UseGroundwaterIrrigation conditional, clean up water balance check
swensosc Nov 9, 2018
3db3f4a
merge SoilHydrologyMod
swensosc Nov 9, 2018
e309a63
a few clean up items
swensosc Nov 9, 2018
12e87b5
fix histFileMod
swensosc Nov 9, 2018
2b33248
Add consistency check for use_groundwater_irrigation
ekluzek Nov 9, 2018
2e53b7f
Get irrigation unit tests passing
billsacks Nov 12, 2018
b0cabac
Add unit tests covering new irrigation behavior
billsacks Nov 13, 2018
e6942dc
Add single_p, single_c and single_g variables for single-point tests
billsacks Nov 13, 2018
3a43fbd
Make "single-point" tests actually include multiple points
billsacks Nov 13, 2018
291893a
Revert "Make "single-point" tests actually include multiple points"
billsacks Nov 14, 2018
9aa547c
Revert "Add single_p, single_c and single_g variables for single-poin…
billsacks Nov 14, 2018
31c56da
Add an irrig_method_default namelist option
billsacks Nov 14, 2018
b90d854
Add more error checking on use_groundwater_irrigation
billsacks Nov 14, 2018
68eb76c
Add tests covering the new irrigation options
billsacks Nov 14, 2018
454cedf
Tweak test output for new qirrig fields
billsacks Nov 14, 2018
09cb145
correct indices in histfileMod
swensosc Nov 15, 2018
ec8c38b
Merge branch 'groundwater_irrigation' of github.com:swensosc/ctsm int…
swensosc Nov 15, 2018
b6f60d1
Extract routine calling three related routines for irrigation withdrawal
billsacks Nov 15, 2018
0c9c875
Only do some irrigation calls if needed
billsacks Nov 15, 2018
dc72f0e
Restore accidentally-deleted line
billsacks Nov 15, 2018
23645cb
Fix history field name in usermod
billsacks Nov 15, 2018
21616fc
Only try to access irrig_method for CFTs
billsacks Nov 15, 2018
1074092
Better method for only accessing irrig_method for CFTs
billsacks Nov 15, 2018
6a7b0a1
Minor cleanup
billsacks Nov 16, 2018
5521656
Merge tag 'ctsm1.0.dev017' into groundwater_irrigation
billsacks Nov 30, 2018
a2d0e53
Merge tag 'ctsm1.0.dev018' into groundwater_irrigation
billsacks Nov 30, 2018
6fd47d7
Merge branch 'master' into groundwater_irrigation
billsacks Nov 30, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2184,7 +2184,8 @@ sub setup_logic_crop {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "initial_seed_at_planting",
'use_crop'=>$nl->get_value('use_crop') );
} else {
error_if_set( $nl, "Can NOT be set without crop on", "baset_mapping", "baset_latvary_slope", "baset_latvary_intercept" );
error_if_set( $nl, "Can NOT be set without crop on", "baset_mapping", "baset_latvary_slope", "baset_latvary_intercept" );
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'crop_fsat_equals_zero' );
}
}
}
Expand Down Expand Up @@ -2768,7 +2769,7 @@ sub setup_logic_irrigation_parameters {
my $var;
foreach $var ("irrig_min_lai", "irrig_start_time", "irrig_length",
"irrig_target_smp", "irrig_depth", "irrig_threshold_fraction",
"limit_irrigation_if_rof_enabled") {
"limit_irrigation_if_rof_enabled","use_groundwater_irrigation") {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var);
}

billsacks marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
6 changes: 6 additions & 0 deletions bld/namelist_files/namelist_defaults_clm4_5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<irrigate use_crop=".true." >.false.</irrigate>
<irrigate use_crop=".false.">.true.</irrigate>

<!-- Saturation excess runoff for crops -->
<crop_fsat_equals_zero>.false.</crop_fsat_equals_zero>

<!-- MEGAN model -->
<megan clm_accelerated_spinup="on" >0</megan>
<megan clm_accelerated_spinup="off">1</megan>
Expand Down Expand Up @@ -273,6 +276,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case).
<limit_irrigation_if_rof_enabled phys="clm5_0">.false.</limit_irrigation_if_rof_enabled>
<limit_irrigation_if_rof_enabled >.false.</limit_irrigation_if_rof_enabled>

<use_groundwater_irrigation>.false.</use_groundwater_irrigation>


<!-- Snow veg treatment -->
<snowveg_flag phys="clm4_5" >OFF</snowveg_flag>
<snowveg_flag phys="clm5_0" >ON_RAD</snowveg_flag>
Expand Down
11 changes: 11 additions & 0 deletions bld/namelist_files/namelist_definition_clm4_5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,22 @@ Only applies if using an active runoff (ROF) model; otherwise, river storage-bas
is turned off regardless of the setting of this namelist variable.
</entry>

<entry id="use_groundwater_irrigation" type="logical" category="clm_physics"
group="irrigation_inparm" valid_values="" >
If TRUE, supply irrigation from groundwater (in addition to surface water).

</entry>

<entry id="irrigate" type="logical" category="clm_physics"
group="clm_inparm" >
If TRUE, irrigation will be active.
</entry>

<entry id="crop_fsat_equals_zero" type="logical" category="clm_physics"
group="clm_inparm" >
If TRUE, fsat will be set to zero for crop columns.
</entry>

<entry id="maxpatch_glcmec" type="integer" category="clm_physics"
group="clm_inparm" valid_values="1,3,5,10,36" >
Number of multiple elevation classes over glacier points.
Expand Down
46 changes: 34 additions & 12 deletions src/biogeophys/BalanceCheckMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ subroutine BeginWaterBalance(bounds, &
!
! !DESCRIPTION:
! Initialize column-level water balance at beginning of time step

!
! !USES:
use SoilWaterMovementMod , only : use_aquifer_layer

!
! !ARGUMENTS:
type(bounds_type) , intent(in) :: bounds
Expand All @@ -78,14 +83,16 @@ subroutine BeginWaterBalance(bounds, &
begwb => waterbalancebulk_inst%begwb_col & ! Output: [real(r8) (:) ] water mass begining of the time step
)

do fc = 1, num_nolakec
c = filter_nolakec(fc)
if (col%hydrologically_active(c)) then
if(zwt(c) <= zi(c,nlevsoi)) then
wa(c) = aquifer_water_baseline
billsacks marked this conversation as resolved.
Show resolved Hide resolved
end if
end if
end do
if(use_aquifer_layer()) then
do fc = 1, num_nolakec
c = filter_nolakec(fc)
if (col%hydrologically_active(c)) then
if(zwt(c) <= zi(c,nlevsoi)) then
wa(c) = aquifer_water_baseline
end if
end if
end do
endif

call ComputeWaterMassNonLake(bounds, num_nolakec, filter_nolakec, &
waterstatebulk_inst, waterdiagnosticbulk_inst, begwb(bounds%begc:bounds%endc))
Expand Down Expand Up @@ -199,7 +206,11 @@ subroutine BalanceCheck( bounds, &
snow_sources => waterfluxbulk_inst%snow_sources_col , & ! Output: [real(r8) (:) ] snow sources (mm H2O /s)
snow_sinks => waterfluxbulk_inst%snow_sinks_col , & ! Output: [real(r8) (:) ] snow sinks (mm H2O /s)

qflx_irrig => waterfluxbulk_inst%qflx_irrig_col , & ! Input: [real(r8) (:) ] irrigation flux (mm H2O /s)
qflx_sfc_irrig => waterfluxbulk_inst%qflx_sfc_irrig_col , & ! Input: [real(r8) (:) ] irrigation flux (mm H2O /s)
qflx_gw_uncon_irrig => waterfluxbulk_inst%qflx_gw_uncon_irrig_col , & ! Input: [real(r8) (:) ] groundwater irrigation flux (mm H2O /s)
qflx_gw_con_irrig => waterfluxbulk_inst%qflx_gw_con_irrig_col , & ! Input: [real(r8) (:) ] groundwater irrigation flux (mm H2O /s)
qflx_irrig_drip => waterfluxbulk_inst%qflx_irrig_drip_col , & ! Input: [real(r8) (:) ] drip irrigation flux (mm H2O /s)
qflx_irrig_sprinkler => waterfluxbulk_inst%qflx_irrig_sprinkler_col , & ! Input: [real(r8) (:) ] sprinkler irrigation flux (mm H2O /s)

qflx_glcice_dyn_water_flux => waterfluxbulk_inst%qflx_glcice_dyn_water_flux_col, & ! Input: [real(r8) (:)] water flux needed for balance check due to glc_dyn_runoff_routing (mm H2O/s) (positive means addition of water to the system)

Expand Down Expand Up @@ -272,7 +283,10 @@ subroutine BalanceCheck( bounds, &
- (forc_rain_col(c) &
+ forc_snow_col(c) &
+ qflx_floodc(c) &
+ qflx_irrig(c) &
+ qflx_irrig_drip(c) &
billsacks marked this conversation as resolved.
Show resolved Hide resolved
+ qflx_irrig_sprinkler(c) &
- qflx_gw_uncon_irrig(c) &
- qflx_gw_con_irrig(c) &
+ qflx_glcice_dyn_water_flux(c) &
- qflx_evap_tot(c) &
- qflx_surf(c) &
Expand Down Expand Up @@ -321,7 +335,11 @@ subroutine BalanceCheck( bounds, &
write(iulog,*)'endwb = ',endwb(indexc)
write(iulog,*)'begwb = ',begwb(indexc)
write(iulog,*)'qflx_evap_tot = ',qflx_evap_tot(indexc)*dtime
write(iulog,*)'qflx_irrig = ',qflx_irrig(indexc)*dtime
write(iulog,*)'qflx_irrig_drip = ',qflx_irrig_drip(indexc)*dtime
write(iulog,*)'qflx_irrig_sprinkler = ',qflx_irrig_sprinkler(indexc)*dtime
write(iulog,*)'qflx_sfc_irrig = ',qflx_sfc_irrig(indexc)*dtime
write(iulog,*)'qflx_gw_uncon_irrig = ',qflx_gw_uncon_irrig(indexc)*dtime
write(iulog,*)'qflx_gw_con_irrig = ',qflx_gw_con_irrig(indexc)*dtime
write(iulog,*)'qflx_surf = ',qflx_surf(indexc)*dtime
write(iulog,*)'qflx_qrgwl = ',qflx_qrgwl(indexc)*dtime
write(iulog,*)'qflx_drain = ',qflx_drain(indexc)*dtime
Expand Down Expand Up @@ -351,7 +369,11 @@ subroutine BalanceCheck( bounds, &
write(iulog,*)'begwb = ',begwb(indexc)

write(iulog,*)'qflx_evap_tot = ',qflx_evap_tot(indexc)*dtime
write(iulog,*)'qflx_irrig = ',qflx_irrig(indexc)*dtime
write(iulog,*)'qflx_irrig_drip = ',qflx_irrig_drip(indexc)*dtime
write(iulog,*)'qflx_irrig_sprinkler = ',qflx_irrig_sprinkler(indexc)*dtime
write(iulog,*)'qflx_sfc_irrig = ',qflx_sfc_irrig(indexc)*dtime
write(iulog,*)'qflx_gw_uncon_irrig = ',qflx_gw_uncon_irrig(indexc)*dtime
write(iulog,*)'qflx_gw_con_irrig = ',qflx_gw_con_irrig(indexc)*dtime
write(iulog,*)'qflx_surf = ',qflx_surf(indexc)*dtime
write(iulog,*)'qflx_qrgwl = ',qflx_qrgwl(indexc)*dtime
write(iulog,*)'qflx_drain = ',qflx_drain(indexc)*dtime
Expand Down
51 changes: 27 additions & 24 deletions src/biogeophys/CanopyHydrologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ module CanopyHydrologyMod
use AerosolMod , only : aerosol_type
use CanopyStateType , only : canopystate_type
use TemperatureType , only : temperature_type
use WaterFluxBulkType , only : waterfluxbulk_type
use Wateratm2lndBulkType , only : wateratm2lndbulk_type
use WaterStateBulkType , only : waterstatebulk_type
use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type
use WaterFluxBulkType , only : waterfluxbulk_type
use Wateratm2lndBulkType , only : wateratm2lndbulk_type
use WaterStateBulkType , only : waterstatebulk_type
use WaterDiagnosticBulkType , only : waterdiagnosticbulk_type
use ColumnType , only : col
use PatchType , only : patch
!
Expand Down Expand Up @@ -176,10 +176,10 @@ subroutine CanopyHydrology(bounds, &
type(canopystate_type) , intent(in) :: canopystate_inst
type(temperature_type) , intent(inout) :: temperature_inst
type(aerosol_type) , intent(inout) :: aerosol_inst
type(waterstatebulk_type) , intent(inout) :: waterstatebulk_inst
type(waterdiagnosticbulk_type) , intent(inout) :: waterdiagnosticbulk_inst
type(waterfluxbulk_type) , intent(inout) :: waterfluxbulk_inst
type(wateratm2lndbulk_type) , intent(inout) :: wateratm2lndbulk_inst
type(waterstatebulk_type) , intent(inout) :: waterstatebulk_inst
type(waterdiagnosticbulk_type) , intent(inout) :: waterdiagnosticbulk_inst
type(waterfluxbulk_type) , intent(inout) :: waterfluxbulk_inst
type(wateratm2lndbulk_type) , intent(inout) :: wateratm2lndbulk_inst
!
! !LOCAL VARIABLES:
integer :: f ! filter index
Expand Down Expand Up @@ -209,6 +209,7 @@ subroutine CanopyHydrology(bounds, &
real(r8) :: qflx_through_snow(bounds%begp:bounds%endp) ! direct snow throughfall [mm/s]
real(r8) :: qflx_prec_grnd_snow(bounds%begp:bounds%endp) ! snow precipitation incident on ground [mm/s]
real(r8) :: qflx_prec_grnd_rain(bounds%begp:bounds%endp) ! rain precipitation incident on ground [mm/s]
real(r8) :: qflx_liq_above_canopy(bounds%begp:bounds%endp) ! liquid water input above canopy (rain plus irrigation) [mm/s]
real(r8) :: z_avg ! grid cell average snow depth
real(r8) :: rho_avg ! avg density of snow column
real(r8) :: temp_snow_depth,temp_intsnow ! temporary variables
Expand Down Expand Up @@ -267,13 +268,14 @@ subroutine CanopyHydrology(bounds, &
qflx_prec_intr => waterfluxbulk_inst%qflx_prec_intr_patch , & ! Output: [real(r8) (:) ] interception of precipitation [mm/s]
qflx_prec_grnd => waterfluxbulk_inst%qflx_prec_grnd_patch , & ! Output: [real(r8) (:) ] water onto ground including canopy runoff [kg/(m2 s)]
qflx_rain_grnd => waterfluxbulk_inst%qflx_rain_grnd_patch , & ! Output: [real(r8) (:) ] rain on ground after interception (mm H2O/s) [+]
qflx_irrig => waterfluxbulk_inst%qflx_irrig_patch , & ! Input: [real(r8) (:) ] irrigation amount (mm/s)
qflx_irrig_drip => waterfluxbulk_inst%qflx_irrig_drip_patch , & ! Input: [real(r8) (:) ] drip irrigation amount (mm/s)
qflx_irrig_sprinkler => waterfluxbulk_inst%qflx_irrig_sprinkler_patch , & ! Input: [real(r8) (:) ] sprinkler irrigation amount (mm/s)

qflx_snowindunload => waterfluxbulk_inst%qflx_snowindunload_patch , & ! Output: [real(r8) (:) ] canopy snow unloading from wind [mm/s]
qflx_snotempunload => waterfluxbulk_inst%qflx_snotempunload_patch & ! Output: [real(r8) (:) ] canopy snow unloading from temp. [mm/s]
)

! Compute time step

dtime = get_step_size()

! Set status of snowveg_flag
Expand All @@ -287,7 +289,7 @@ subroutine CanopyHydrology(bounds, &
g = patch%gridcell(p)
l = patch%landunit(p)
c = patch%column(p)

! Canopy interception and precipitation onto ground surface
! Add precipitation to leaf water

Expand All @@ -308,12 +310,14 @@ subroutine CanopyHydrology(bounds, &


if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall) then
if (frac_veg_nosno(p) == 1 .and. (forc_rain(c) + forc_snow(c) + qflx_irrig_sprinkler(p)) > 0._r8) then

if (frac_veg_nosno(p) == 1 .and. (forc_rain(c) + forc_snow(c)) > 0._r8) then

! total liquid water inputs above canopy
qflx_liq_above_canopy(p) = forc_rain(c)+ qflx_irrig_sprinkler(p)

! determine fraction of input precipitation that is snow and rain
fracsnow(p) = forc_snow(c)/(forc_snow(c) + forc_rain(c))
fracrain(p) = forc_rain(c)/(forc_snow(c) + forc_rain(c))
fracsnow(p) = forc_snow(c)/(forc_snow(c) + qflx_liq_above_canopy(p))
fracrain(p) = forc_rain(c)/(forc_snow(c) + qflx_liq_above_canopy(p))
billsacks marked this conversation as resolved.
Show resolved Hide resolved

! The leaf water capacities for solid and liquid are different,
! generally double for snow, but these are of somewhat less
Expand All @@ -339,21 +343,20 @@ subroutine CanopyHydrology(bounds, &
! Direct throughfall
qflx_through_snow(p) = forc_snow(c) * (1._r8-fpi)
end if

! Direct throughfall
qflx_through_rain(p) = forc_rain(c) * (1._r8-fpi)
qflx_through_rain(p) = qflx_liq_above_canopy(p) * (1._r8-fpi)

if (snowveg_on .or. snowveg_onrad) then
! Intercepted precipitation [mm/s]
qflx_prec_intr(p) = forc_snow(c)*fpisnow + forc_rain(c)*fpi
qflx_prec_intr(p) = forc_snow(c)*fpisnow + (forc_rain(c) + qflx_irrig_sprinkler(p))*fpi
billsacks marked this conversation as resolved.
Show resolved Hide resolved
! storage of intercepted snowfall, rain, and dew
snocan(p) = max(0._r8, snocan(p) + dtime*forc_snow(c)*fpisnow)
liqcan(p) = max(0._r8, liqcan(p) + dtime*forc_rain(c)*fpi)
liqcan(p) = max(0._r8, liqcan(p) + dtime*qflx_liq_above_canopy(p)*fpi)
else
! Intercepted precipitation [mm/s]
qflx_prec_intr(p) = (forc_snow(c) + forc_rain(c)) * fpi
qflx_prec_intr(p) = (forc_snow(c) + qflx_liq_above_canopy(p)) * fpi
end if

! Water storage of intercepted precipitation and dew
h2ocan(p) = max(0._r8, h2ocan(p) + dtime*qflx_prec_intr(p))

Expand Down Expand Up @@ -419,7 +422,7 @@ subroutine CanopyHydrology(bounds, &
if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall) then
if (frac_veg_nosno(p) == 0) then
qflx_prec_grnd_snow(p) = forc_snow(c)
qflx_prec_grnd_rain(p) = forc_rain(c)
qflx_prec_grnd_rain(p) = forc_rain(c) + qflx_irrig_sprinkler(p)
else
if (snowveg_on .or. snowveg_onrad) then
qflx_snowindunload(p)=0._r8
Expand Down Expand Up @@ -452,8 +455,8 @@ subroutine CanopyHydrology(bounds, &

! Add irrigation water directly onto ground (bypassing canopy interception)
! Note that it's still possible that (some of) this irrigation water will runoff (as runoff is computed later)
qflx_prec_grnd_rain(p) = qflx_prec_grnd_rain(p) + qflx_irrig(p)

qflx_prec_grnd_rain(p) = qflx_prec_grnd_rain(p) + qflx_irrig_drip(p)
qflx_prec_grnd(p) = qflx_prec_grnd_snow(p) + qflx_prec_grnd_rain(p)

qflx_snow_grnd_patch(p) = qflx_prec_grnd_snow(p) ! ice onto ground (mm/s)
Expand Down
Loading