@@ -1880,7 +1880,11 @@ sub setup_logic_irrigate {
18801880 if ( $physv -> as_long() >= $physv -> as_long(" clm4_5" ) ) {
18811881 add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' irrigate' ,
18821882 ' use_crop' => $nl_flags -> {' use_crop' }, ' use_cndv' => $nl_flags -> {' use_cndv' } );
1883- $nl_flags -> {' irrigate' } = lc ($nl -> get_value(' irrigate' ));
1883+ if ( &value_is_true($nl -> get_value(' irrigate' ) ) ) {
1884+ $nl_flags -> {' irrigate' } = " .true."
1885+ } else {
1886+ $nl_flags -> {' irrigate' } = " .false."
1887+ }
18841888 }
18851889}
18861890
@@ -2074,6 +2078,9 @@ sub setup_logic_create_crop_landunit {
20742078 if ( &value_is_true($nl_flags -> {' use_fates' }) && &value_is_true($nl -> get_value($var )) ) {
20752079 $log -> fatal_error( " $var is true and yet use_fates is being set, which contradicts that (use_fates requires $var to be .false." );
20762080 }
2081+ if ( (! &value_is_true($nl_flags -> {' use_fates' })) && (! &value_is_true($nl -> get_value($var ))) ) {
2082+ $log -> fatal_error( " $var is false which is ONLY allowed when FATES is being used" );
2083+ }
20772084 }
20782085}
20792086
@@ -2566,9 +2573,6 @@ sub setup_logic_do_transient_crops {
25662573 if (string_is_undef_or_empty($nl -> get_value(' flanduse_timeseries' ))) {
25672574 $cannot_be_true = " $var can only be set to true when running a transient case (flanduse_timeseries non-blank)" ;
25682575 }
2569- elsif (!&value_is_true($nl -> get_value(' use_crop' ))) {
2570- $cannot_be_true = " $var can only be set to true when running with use_crop = true" ;
2571- }
25722576 elsif (&value_is_true($nl -> get_value(' use_fates' ))) {
25732577 # In principle, use_fates should be compatible with
25742578 # do_transient_crops. However, this hasn't been tested, so to be safe,
@@ -2594,6 +2598,13 @@ sub setup_logic_do_transient_crops {
25942598 $log -> fatal_error($cannot_be_true );
25952599 }
25962600
2601+ my $dopft = " do_transient_pfts" ;
2602+ # Make sure the value agrees with the do_transient_pft flag
2603+ if ( ( &value_is_true($nl -> get_value($var ))) && (! &value_is_true($nl -> get_value($dopft ))) ||
2604+ (! &value_is_true($nl -> get_value($var ))) && ( &value_is_true($nl -> get_value($dopft ))) ) {
2605+ $log -> fatal_error(" $var and $dopft do NOT agree and need to" );
2606+ }
2607+
25972608 }
25982609}
25992610
@@ -3047,9 +3058,12 @@ sub setup_logic_fertilizer {
30473058 my ($opts , $nl_flags , $definition , $defaults , $nl , $physv ) = @_ ;
30483059
30493060 if ( $physv -> as_long() >= $physv -> as_long(" clm4_5" ) ) {
3050- $nl_flags -> {' use_crop' } = $nl -> get_value(' use_crop' );
30513061 add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' use_fertilizer' ,
30523062 ' use_crop' => $nl_flags -> {' use_crop' } );
3063+ my $use_fert = $nl -> get_value(' use_fertilizer' );
3064+ if ( (! &value_is_true($nl_flags -> {' use_crop' })) && &value_is_true($use_fert ) ) {
3065+ $log -> fatal_error(" use_ferilizer can NOT be on without prognostic crop\n " );
3066+ }
30533067 }
30543068}
30553069
@@ -3062,9 +3076,11 @@ sub setup_logic_grainproduct {
30623076 my ($opts , $nl_flags , $definition , $defaults , $nl , $physv ) = @_ ;
30633077
30643078 if ( $physv -> as_long() >= $physv -> as_long(" clm4_5" ) ) {
3065- $nl_flags -> {' use_crop' } = $nl -> get_value(' use_crop' );
30663079 add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' use_grainproduct' ,
30673080 ' use_crop' => $nl_flags -> {' use_crop' }, ' phys' => $physv -> as_string() );
3081+ if ( (! &value_is_true($nl_flags -> {' use_crop' })) && &value_is_true($nl -> get_value(' use_grainproduct' ) ) ) {
3082+ $log -> fatal_error(" use_grainproduct can NOT be on without prognostic crop\n " );
3083+ }
30683084 }
30693085}
30703086
0 commit comments