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

Fixes ELM namelist for with active FAN model #6151

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Changes from all commits
Commits
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
10 changes: 7 additions & 3 deletions components/elm/bld/ELMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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." ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it was a perl error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The information about use_fan was being extracted from the wrong data structure.

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'},
Expand Down