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 all 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
16 changes: 14 additions & 2 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2191,7 +2191,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 @@ -2779,10 +2780,21 @@ 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",
"irrig_method_default") {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var);
}

billsacks marked this conversation as resolved.
Show resolved Hide resolved
if ( &value_is_true($nl->get_value('use_groundwater_irrigation')) &&
! &value_is_true($nl->get_value('limit_irrigation_if_rof_enabled'))) {
$log->fatal_error("use_groundwater_irrigation only makes sense if limit_irrigation_if_rof_enabled is set. (If limit_irrigation_if_rof_enabled is .false., then groundwater extraction will never be invoked.)")
}

my $lower = $nl->get_value( 'lower_boundary_condition' );
if ( ($lower == 3 || $lower == 4) && (&value_is_true($nl->get_value( 'use_groundwater_irrigation' ))) ) {
$log->fatal_error("use_groundwater_irrigation can only be used when lower_boundary_condition is NOT 3 or 4");
}

$var = "irrig_river_volume_threshold";
if ( &value_is_true($nl->get_value("limit_irrigation_if_rof_enabled")) ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var);
Expand Down
7 changes: 7 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,10 @@ 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>

<irrig_method_default>drip</irrig_method_default>

<!-- Snow veg treatment -->
<snowveg_flag phys="clm4_5" >OFF</snowveg_flag>
<snowveg_flag phys="clm5_0" >ON_RAD</snowveg_flag>
Expand Down
21 changes: 21 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,32 @@ 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).

Can only be set if limit_irrigation_if_rof_enabled is true (otherwise
groundwater extraction is never invoked).

Cannot be combined with lower_boundary_condition = 3 or 4
</entry>

<entry id="irrig_method_default" type="char*32" category="clm_physics"
group="irrigation_inparm"
valid_values="drip,sprinkler" >
Irrigation method used if not specified on surface dataset
</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
20 changes: 20 additions & 0 deletions cime_config/testdefs/testlist_clm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,16 @@
<option name="comment" >Want a multi-year global crop restart test; this was 5 years when we were doing cold start, but 3 years is probably sufficient given that we have spun-up crop initial conditions</option>
</options>
</test>
<test name="ERP_P72x2_Lm7" grid="f10_f10_musgs" compset="I2000Clm50BgcCrop" testmods="clm/irrig_alternate_monthly">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_clm">
<options>
<option name="wallclock">0:30</option>
<option name="comment">Want an ERP test covering some non-default irrigation options. Long enough so that we're likely to exercise the various groundwater irrigation code.</option>
</options>
</machine>
</machines>
</test>
<test name="ERS_D" grid="f19_g17" compset="I1850Clm50BgcCrop" testmods="clm/reseedresetsnow">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_clm"/>
Expand Down Expand Up @@ -1794,6 +1804,16 @@
<option name="wallclock">00:20:00</option>
</options>
</test>
<test name="SMS_D_Ld5" grid="f10_f10_musgs" compset="I2000Clm50BgcCrop" testmods="clm/irrig_alternate">
<machines>
<machine name="hobart" compiler="nag" category="aux_clm">
<options>
<option name="wallclock">0:20:00</option>
<option name="comment">Debug test covering some non-default irrigation options.</option>
</options>
</machine>
</machines>
</test>
<test name="SMS_D_Ln1" grid="f10_f10_musgs" compset="I2000Clm50BgcCropGs" testmods="clm/tracer_consistency">
<machines>

Expand Down
9 changes: 9 additions & 0 deletions cime_config/testdefs/testmods_dirs/clm/_includes/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This directory contains testmods directories that are meant to be
included in other testmods directories, not used directly.

One reason for doing this is so that we can have testmods here that
apply science settings without including one of the testmods that is
typically included for setting output frequency (e.g., 'default' or
'monthly'). Then the testmods here can be included in other testmods
that use different output frequencies (e.g., daily vs. monthly) while
having the same science options.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

! Settings from irrig_alternate: test some non-default irrigation options
limit_irrigation_if_rof_enabled = .true.
use_groundwater_irrigation = .true.
irrig_method_default = 'sprinkler'
hist_fincl1 += 'QIRRIG_DEMAND','QIRRIG_DRIP','QIRRIG_SPRINKLER'
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
hist_fincl1 += 'QIRRIG','QIRRIG_DEMAND'
hist_fincl2 += 'QIRRIG'
hist_fincl1 += 'QIRRIG_FROM_SURFACE','QIRRIG_FROM_GW_UNCONFINED','QIRRIG_FROM_GW_CONFINED','QIRRIG_DRIP','QIRRIG_SPRINKLER','QIRRIG_DEMAND'
hist_dov2xy = .true.,.false.
hist_nhtfrq = 0, -8760
hist_mfilt = 1,1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
../_includes/irrig_alternate
../default
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
../_includes/irrig_alternate
../monthly
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ hist_mfilt(3) = 1
hist_dov2xy(3) = .false.
hist_nhtfrq(3) = 0
hist_type1d_pertape(3) = 'LAND'
hist_fincl3 += 'FSR', 'H2OSNO', 'Q2M', 'SNOWDP', 'TSA', 'TREFMNAV', 'TREFMXAV', 'TG', 'QRUNOFF', 'FSH', 'FIRE', 'FIRA', 'FGR', 'EFLX_LH_TOT', 'RH2M', 'TLAI', 'SOILWATER_10CM', 'TOTSOILLIQ', 'TOTSOILICE', 'U10', 'TSOI_10CM', 'QIRRIG', 'URBAN_HEAT', 'WASTEHEAT', 'TSKIN'
hist_fincl3 += 'FSR', 'H2OSNO', 'Q2M', 'SNOWDP', 'TSA', 'TREFMNAV', 'TREFMXAV', 'TG', 'QRUNOFF', 'FSH', 'FIRE', 'FIRA', 'FGR', 'EFLX_LH_TOT', 'RH2M', 'TLAI', 'SOILWATER_10CM', 'TOTSOILLIQ', 'TOTSOILICE', 'U10', 'TSOI_10CM', 'QIRRIG_FROM_SURFACE', 'URBAN_HEAT', 'WASTEHEAT', 'TSKIN'

! h3 stream (yearly average, gridcell-level)
! Eyr
Expand Down
38 changes: 22 additions & 16 deletions src/biogeophys/BalanceCheckMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ end function GetBalanceCheckSkipSteps
!-----------------------------------------------------------------------
subroutine BeginWaterBalance(bounds, &
num_nolakec, filter_nolakec, num_lakec, filter_lakec, &
water_inst, soilhydrology_inst)
water_inst, soilhydrology_inst, &
use_aquifer_layer)
!
! !DESCRIPTION:
! Initialize column-level water balance at beginning of time step, for bulk water and
Expand All @@ -137,6 +138,7 @@ subroutine BeginWaterBalance(bounds, &
integer , intent(in) :: filter_lakec(:) ! column filter for lake points
type(water_type) , intent(inout) :: water_inst
type(soilhydrology_type) , intent(in) :: soilhydrology_inst
logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run
!
! !LOCAL VARIABLES:
integer :: i
Expand All @@ -151,15 +153,17 @@ subroutine BeginWaterBalance(bounds, &
soilhydrology_inst, &
water_inst%bulk_and_tracers(i)%waterstate_inst, &
water_inst%bulk_and_tracers(i)%waterdiagnostic_inst, &
water_inst%bulk_and_tracers(i)%waterbalance_inst)
water_inst%bulk_and_tracers(i)%waterbalance_inst, &
use_aquifer_layer = use_aquifer_layer)
end do

end subroutine BeginWaterBalance

!-----------------------------------------------------------------------
subroutine BeginWaterBalanceSingle(bounds, &
num_nolakec, filter_nolakec, num_lakec, filter_lakec, &
soilhydrology_inst, waterstate_inst, waterdiagnostic_inst, waterbalance_inst)
soilhydrology_inst, waterstate_inst, waterdiagnostic_inst, waterbalance_inst, &
use_aquifer_layer)
!
! !DESCRIPTION:
! Initialize column-level water balance at beginning of time step, for bulk or a
Expand All @@ -175,6 +179,7 @@ subroutine BeginWaterBalanceSingle(bounds, &
class(waterstate_type) , intent(inout) :: waterstate_inst
class(waterdiagnostic_type), intent(in) :: waterdiagnostic_inst
class(waterbalance_type) , intent(inout) :: waterbalance_inst
logical , intent(in) :: use_aquifer_layer ! whether an aquifer layer is used in this run
!
! !LOCAL VARIABLES:
integer :: c, j, fc ! indices
Expand All @@ -189,14 +194,16 @@ subroutine BeginWaterBalanceSingle(bounds, &
h2osno_old => waterbalance_inst%h2osno_old_col & ! Output: [real(r8) (:) ] snow water (mm H2O) at previous 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, &
waterstate_inst, waterdiagnostic_inst, begwb(bounds%begc:bounds%endc))
Expand Down Expand Up @@ -305,8 +312,7 @@ subroutine BalanceCheck( bounds, &
qflx_ice_runoff_xs => waterflux_inst%qflx_ice_runoff_xs_col , & ! Input: [real(r8) (:) ] solid runoff from excess ice in soil (mm H2O /s)
qflx_sl_top_soil => waterflux_inst%qflx_sl_top_soil_col , & ! Input: [real(r8) (:) ] liquid water + ice from layer above soil to top soil layer or sent to qflx_qrgwl (mm H2O/s)

qflx_irrig => waterflux_inst%qflx_irrig_col , & ! Input: [real(r8) (:) ] irrigation flux (mm H2O /s)

qflx_sfc_irrig => waterflux_inst%qflx_sfc_irrig_col , & ! Input: [real(r8) (:) ] irrigation flux (mm H2O /s)
qflx_glcice_dyn_water_flux => waterflux_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)

eflx_lwrad_out => energyflux_inst%eflx_lwrad_out_patch , & ! Input: [real(r8) (:) ] emitted infrared (longwave) radiation (W/m**2)
Expand Down Expand Up @@ -378,7 +384,7 @@ subroutine BalanceCheck( bounds, &
- (forc_rain_col(c) &
+ forc_snow_col(c) &
+ qflx_floodc(c) &
+ qflx_irrig(c) &
+ qflx_sfc_irrig(c) &
+ qflx_glcice_dyn_water_flux(c) &
- qflx_evap_tot(c) &
- qflx_surf(c) &
Expand Down Expand Up @@ -427,7 +433,7 @@ 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_sfc_irrig = ',qflx_sfc_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 All @@ -454,7 +460,7 @@ 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_sfc_irrig = ',qflx_sfc_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
Loading