From dc268758177639294a212ce0bc91a0cef7fae49b Mon Sep 17 00:00:00 2001 From: Gautam Bisht Date: Wed, 17 Jan 2024 12:04:24 -0800 Subject: [PATCH] Fixes ELM namelist for with active FAN model If `use_fan = .true.` in `user_nl_elm`, add settings for the FAN model in `lnd_in`. --- components/elm/bld/ELMBuildNamelist.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/components/elm/bld/ELMBuildNamelist.pm b/components/elm/bld/ELMBuildNamelist.pm index fe7e6eba17b3..d3d03d77f50c 100755 --- a/components/elm/bld/ELMBuildNamelist.pm +++ b/components/elm/bld/ELMBuildNamelist.pm @@ -3001,11 +3001,13 @@ sub setup_logic_phosphorus_deposition { sub setup_logic_fan { my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - + # Flags to control FAN (Flow of Agricultural Nitrogen) nitrogen deposition (manure and fertilizer) # if ( $nl_flags->{'bgc_mode'} =~/cn|bgc/ ) { - if( $nl_flags->{'use_fan'} eq ".true." ) { + my $var = "use_fan"; + my $val = $nl->get_value($var); + if( $val eq ".true." ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_fan', 'use_cn'=>$nl_flags->{'use_cn'} ); $nl_flags->{'use_fan'} = $nl->get_value('use_fan'); @@ -3021,7 +3023,9 @@ sub setup_logic_fan { fatal_error('Cannot use_fan if use_crop is false'); } # - if( $nl_flags->{'use_fan'} eq ".true." ) { + my $var = "use_fan"; + my $val = $nl->get_value($var); + if( $val eq ".true." ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "fanmapalgo", 'phys'=>$nl_flags->{'phys'}, 'use_cn'=>$nl_flags->{'use_cn'}, 'hgrid'=>$nl_flags->{'res'} ); add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "stream_year_first_fan", 'phys'=>$nl_flags->{'phys'},