diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm index 458b8daaef..6d5a774b70 100644 --- a/bld/CLMBuildNamelist.pm +++ b/bld/CLMBuildNamelist.pm @@ -80,15 +80,6 @@ REQUIRED OPTIONS "-sim_year list" to list valid simulation years (default 2000) OPTIONS - -bgc "value" Build CLM with BGC package [ sp | bgc ] - (default is sp). - CLM Biogeochemistry mode - sp = Satellite Phenology (SP) - This toggles off the namelist variable: use_cn - bgc = Carbon Nitrogen with methane, nitrification, vertical soil C, - CENTURY decomposition - This toggles on the namelist variables: - use_cn, use_lch4, use_nitrif_denitrif, use_vertsoilc, use_century_decomp -[no-]chk_res Also check [do NOT check] to make sure the resolution and land-mask is valid. -clm_demand "list" List of variables to require on clm namelist besides the usuals. @@ -105,8 +96,6 @@ OPTIONS -co2_ppmv "value" Set CO2 concentration to use when co2_type is constant (ppmv). -csmdata "dir" Root directory of CESM input data. Can also be set by using the CSMDATA environment variable. - -glc_nec Glacier number of elevation classes [0 | 3 | 5 | 10 | 36] - (default is 0) (standard option with land-ice model is 10) -help [or -h] Print usage to STDOUT. -ignore_ic_date Ignore the date on the initial condition files when determining what input initial condition file to use. @@ -150,7 +139,7 @@ OPTIONS Note: The precedence for setting the values of namelist variables is (highest to lowest): 0. namelist values set by specific command-line options, like, -d, -sim_year - (i.e. compset choice and CLM_BLDNML_OPTS, CLM_ACCELERATED_SPINUP, LND_TUNING_MODE env_run variables) + (i.e. compset choice and CLM_BLDNML_OPTS, LND_TUNING_MODE env_run variables) (NOTE: If you try to contradict these settings by methods below, an error will be triggered) 1. values set on the command-line using the -namelist option, (i.e. CLM_NAMELIST_OPTS env_run variable) @@ -180,7 +169,6 @@ sub process_commandline { co2_ppmv => undef, clm_demand => "null", help => 0, - glc_nec => "default", l_ncpl => undef, lnd_frac => undef, dir => "$cwd", @@ -210,7 +198,6 @@ sub process_commandline { "ignore_warnings!" => \$opts{'ignore_warnings'}, "chk_res!" => \$opts{'chk_res'}, "note!" => \$opts{'note'}, - "glc_nec=i" => \$opts{'glc_nec'}, "d:s" => \$opts{'dir'}, "h|help" => \$opts{'help'}, "ignore_ic_date" => \$opts{'ignore_ic_date'}, @@ -531,9 +518,7 @@ sub process_namelist_commandline_options { setup_cmdl_chk_res($opts, $defaults); setup_cmdl_resolution($opts, $nl_flags, $definition, $defaults); setup_cmdl_mask($opts, $nl_flags, $definition, $defaults, $nl); - setup_cmdl_bgc($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv); setup_cmdl_maxpft($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv); - setup_cmdl_glc_nec($opts, $nl_flags, $definition, $defaults, $nl); setup_cmdl_rcp($opts, $nl_flags, $definition, $defaults, $nl); setup_cmdl_simulation_year($opts, $nl_flags, $definition, $defaults, $nl); setup_cmdl_run_type($opts, $nl_flags, $definition, $defaults, $nl); @@ -604,91 +589,6 @@ sub setup_cmdl_mask { $log->verbose_message("CLM land mask is $nl_flags->{'mask'}"); } -#------------------------------------------------------------------------------- -sub setup_cmdl_bgc { - # BGC - alias for group of biogeochemistry related use_XXX namelists - - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv) = @_; - - my $val; - my $var = "bgc"; - - $val = $opts->{$var}; - $nl_flags->{'bgc_mode'} = $val; - - my $var = "bgc_mode"; - if ( $nl_flags->{$var} eq "default" ) { - $nl_flags->{$var} = $defaults->get_value($var); - } - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, quote_string( $nl_flags->{$var} ) ); - if ( ! $definition->is_valid_value( $var, quote_string( $nl_flags->{$var}) ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value (".$nl_flags->{$var}.") that is NOT valid. Valid values are: @valid_values"); - } - $log->verbose_message("Using $nl_flags->{$var} for bgc."); - - # now set the actual name list variables based on the bgc alias - if ($nl_flags->{$var} eq "bgc" ) { - $nl_flags->{'use_cn'} = ".true."; - } else { - $nl_flags->{'use_cn'} = ".false."; - } - if ( defined($nl->get_value("use_cn")) && ($nl_flags->{'use_cn'} ne $nl->get_value("use_cn")) ) { - $log->fatal_error("The namelist variable use_cn is inconsistent with the -bgc option"); - } - - { - # If the variable has already been set use it, if not set to the value defined by the bgc_mode - my @list = ( "use_lch4", "use_nitrif_denitrif", "use_vertsoilc", "use_century_decomp" ); - my $ndiff = 0; - my %settings = ( 'bgc_mode'=>$nl_flags->{'bgc_mode'} ); - foreach my $var ( @list ) { - my $default_setting = $defaults->get_value($var, \%settings ); - if ( ! defined($nl->get_value($var)) ) { - $nl_flags->{$var} = $default_setting; - } else { - if ( $nl->get_value($var) ne $default_setting ) { - $ndiff += 1; - } - $nl_flags->{$var} = $nl->get_value($var); - } - $val = $nl_flags->{$var}; - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - } - # If all the variables are different report it as an error - if ( $ndiff == ($#list + 1) ) { - $log->fatal_error("You are contradicting the -bgc setting with the namelist variables: @list" ); - } - } - - # Now set use_cn - foreach $var ( "use_cn" ) { - $val = $nl_flags->{$var}; - $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - } - my $var = "use_fun"; - if ( ! defined($nl->get_value($var)) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, - 'phys'=>$nl_flags->{'phys'}, 'use_cn'=>$nl_flags->{'use_cn'}, - 'use_nitrif_denitrif'=>$nl_flags->{'use_nitrif_denitrif'} ); - } - if ( (! &value_is_true($nl_flags->{'use_nitrif_denitrif'}) ) && &value_is_true($nl->get_value('use_fun')) ) { - $log->fatal_error("When FUN is on, use_nitrif_denitrif MUST also be on!"); - } -} # end bgc - - #------------------------------------------------------------------------------- sub setup_cmdl_maxpft { @@ -704,14 +604,6 @@ sub setup_cmdl_maxpft { } $nl_flags->{'maxpft'} = $val; - if ( ($nl_flags->{'bgc_mode'} ne "sp") && ($nl_flags->{'maxpft'} != $maxpatchpft) ) { - $log->fatal_error("** For CN or BGC mode you MUST set max patch PFT's to $maxpatchpft\n" . - "**\n" . - "** Set the bgc mode, crop and maxpft by the following means from highest to lowest precedence:\n" . - "** * by the command-line options -bgc and -maxpft\n" . - "** * by a default configuration file, specified by -defaults\n" . - "**"); - } if ( $nl_flags->{'maxpft'} > $maxpatchpft ) { $log->fatal_error("** Max patch PFT's can NOT exceed $maxpatchpft\n" . "**\n" . @@ -724,41 +616,6 @@ sub setup_cmdl_maxpft { $log->warning("running with maxpft NOT equal to $maxpatchpft is " . "NOT validated / scientifically supported." ); } - $log->verbose_message("Using $nl_flags->{'maxpft'} for maxpft."); - - $var = "maxpatch_pft"; - $val = $nl_flags->{'maxpft'}; - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_glc_nec { - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - my $val; - my $var = "glc_nec"; - - if ( $opts->{$var} ne "default" ) { - $val = $opts->{$var}; - } else { - $val = $defaults->get_value($var); - } - - $nl_flags->{'glc_nec'} = $val; - $opts->{'glc_nec'} = $val; - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - $log->verbose_message("Glacier number of elevation classes is $val"); } #------------------------------------------------------------------------------- @@ -839,15 +696,13 @@ sub setup_cmdl_run_type { my $var = "clm_start_type"; if (defined $opts->{$var}) { if ($opts->{$var} eq "default" ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, - 'use_cndv'=>$nl_flags->{'use_cndv'} ); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var); } else { my $group = $definition->get_group_name($var); $nl->set_variable_value($group, $var, quote_string( $opts->{$var} ) ); } } else { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, - 'use_cndv'=>$nl_flags->{'use_cndv'} ); + add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var); } $nl_flags->{'clm_start_type'} = $nl->get_value($var); } @@ -944,9 +799,6 @@ sub process_namelist_commandline_use_case { $settings{'sim_year'} = $nl_flags->{'sim_year'}; $settings{'sim_year_range'} = $nl_flags->{'sim_year_range'}; $settings{'phys'} = $nl_flags->{'phys'}; - $settings{'use_cn'} = $nl_flags->{'use_cn'}; - $settings{'use_cndv'} = $nl_flags->{'use_cndv'}; - $settings{'cnfireson'} = $nl_flags->{'cnfireson'}; # Loop over the variables specified in the use case. # Add each one to the namelist. my @vars = $uc_defaults->get_variable_names(); @@ -1004,72 +856,11 @@ sub process_namelist_inline_logic { setup_logic_delta_time($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_decomp_performance($opts, $nl_flags, $definition, $defaults, $nl); setup_logic_glacier($opts, $nl_flags, $definition, $defaults, $nl, $envxml_ref, $physv); - setup_logic_dynamic_plant_nitrogen_alloc($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_hydrstress($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_dynamic_roots($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_params_file($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_create_crop_landunit($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_soilstate($opts, $nl_flags, $definition, $defaults, $nl, $physv); setup_logic_demand($opts, $nl_flags, $definition, $defaults, $nl, $physv); setup_logic_surface_dataset($opts, $nl_flags, $definition, $defaults, $nl, $physv); setup_logic_initial_conditions($opts, $nl_flags, $definition, $defaults, $nl, $physv); setup_logic_snowpack($opts, $nl_flags, $definition, $defaults, $nl, $physv); - ######################################### - # namelist group: atm2lnd_inparm - ######################################### - setup_logic_atm_forcing($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ######################################### - # namelist group: lnd2atm_inparm - ######################################### - setup_logic_lnd2atm($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################### - # namelist group: clmu_inparm # - ############################### - setup_logic_urban($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ################################## - # namelist group: bgc_shared - ################################## - setup_logic_bgc_shared($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################################# - # namelist group: soilwater_movement_inparm # - ############################################# - setup_logic_soilwater_movement($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################################# - # namelist group: rooting_profile_inparm # - ############################################# - setup_logic_rooting_profile($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - #################################### - # namelist group: cnvegcarbonstate # - #################################### - setup_logic_cnvegcarbonstate($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################################# - # namelist group: soil_resis_inparm # - ############################################# - setup_logic_soil_resis($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################################# - # namelist group: canopyhydrology_inparm # - ############################################# - setup_logic_canopyhydrology($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ##################################### - # namelist group: clm_canopy_inparm # - ##################################### - setup_logic_canopy($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ####################################################################### - # namelist groups: clm_hydrology1_inparm and clm_soilhydrology_inparm # - ####################################################################### - setup_logic_hydrology_switches($nl, $physv); - } #------------------------------------------------------------------------------- @@ -1196,58 +987,7 @@ sub setup_logic_glacier { # my ($opts, $nl_flags, $definition, $defaults, $nl, $envxml_ref, $physv) = @_; - my $var = "maxpatch_glcmec"; - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'val'=>$nl_flags->{'glc_nec'} ); - - my $val = $nl->get_value($var); - if ( $val != $nl_flags->{'glc_nec'} ) { - $log->fatal_error("$var set to $val does NOT agree with -glc_nec argument of $nl_flags->{'glc_nec'} (set with GLC_NEC env variable)"); - } - - if ( $nl_flags->{'glc_nec'} < 1 ) { - $log->fatal_error("For clm4_5 and later, GLC_NEC must be at least 1."); - } - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glc_snow_persistence_max_days'); - - # Dependence of albice on glc_nec has gone away starting in CLM4_5. Thus, we - # can remove glc_nec from the following call once we ditch CLM4_0. - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'albice', 'glc_nec'=>$nl_flags->{'glc_nec'}); add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glacier_region_behavior'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glacier_region_melt_behavior'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glacier_region_ice_runoff_behavior'); -} - -#------------------------------------------------------------------------------- - -sub setup_logic_params_file { - # get param data. For 4_0, pft-physiology, for 4_5 old - # pft-physiology was used but now now includes CN and BGC century - # parameters. - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'paramfile', - 'phys'=>$nl_flags->{'phys'}, - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); -} - -#------------------------------------------------------------------------------- - -sub setup_logic_create_crop_landunit { - # Create crop land unit - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my $var = 'create_crop_landunit'; - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var ); -} -#------------------------------------------------------------------------------- - -sub setup_logic_urban { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'building_temp_method'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'urban_hac'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'urban_traffic'); } #------------------------------------------------------------------------------- @@ -1262,17 +1002,6 @@ sub error_if_set { } } - -#------------------------------------------------------------------------------- - -sub setup_logic_soilstate { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'organic_frac_squared' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soil_layerstruct' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_bedrock' ); -} - #------------------------------------------------------------------------------- sub setup_logic_demand { @@ -1287,14 +1016,7 @@ sub setup_logic_demand { $settings{'sim_year_range'} = $nl_flags->{'sim_year_range'}; $settings{'mask'} = $nl_flags->{'mask'}; $settings{'rcp'} = $nl_flags->{'rcp'}; - $settings{'glc_nec'} = $nl_flags->{'glc_nec'}; # necessary for demand to be set correctly - $settings{'use_cn'} = $nl_flags->{'use_cn'}; - $settings{'use_cndv'} = $nl_flags->{'use_cndv'}; - $settings{'use_lch4'} = $nl_flags->{'use_lch4'}; - $settings{'use_nitrif_denitrif'} = $nl_flags->{'use_nitrif_denitrif'}; - $settings{'use_vertsoilc'} = $nl_flags->{'use_vertsoilc'}; - $settings{'use_century_decomp'} = $nl_flags->{'use_century_decomp'}; my $demand = $nl->get_value('clm_demand'); if (defined($demand)) { @@ -1346,13 +1068,9 @@ sub setup_logic_surface_dataset { } $flanduse_timeseries = $nl_flags->{'flanduse_timeseries'}; - if ($flanduse_timeseries ne "null" && &value_is_true($nl_flags->{'use_cndv'}) ) { - $log->fatal_error( "dynamic PFT's (setting flanduse_timeseries) are incompatible with dynamic vegetation (use_cndv=.true)." ); - } add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fsurdat', 'hgrid'=>$nl_flags->{'res'}, - 'sim_year'=>$nl_flags->{'sim_year'}, - 'glc_nec'=>$nl_flags->{'glc_nec'}); + 'sim_year'=>$nl_flags->{'sim_year'}); # MML: try and add my own namelist variable for mml_surdat forcing file add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'mml_surdat'); @@ -1413,9 +1131,7 @@ sub setup_logic_initial_conditions { } else { delete( $settings{'sim_year'} ); } - foreach my $item ( "mask", "maxpft", "glc_nec", "use_cn", "use_cndv", - "use_nitrif_denitrif", "use_vertsoilc", "use_century_decomp", - ) { + foreach my $item ( "mask", "maxpft" ) { $settings{$item} = $nl_flags->{$item}; } if ($opts->{'ignore_ic_year'}) { @@ -1447,7 +1163,7 @@ sub setup_logic_initial_conditions { } } add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $useinitvar, - 'use_cndv'=>$nl_flags->{'use_cndv'}, 'phys'=>$physv->as_string(), + 'phys'=>$physv->as_string(), 'sim_year'=>$settings{'sim_year'}, 'nofail'=>1 ); $settings{$useinitvar} = $nl->get_value($useinitvar); if ( $try > 1 ) { @@ -1457,9 +1173,8 @@ sub setup_logic_initial_conditions { if ( &value_is_true($nl->get_value($useinitvar) ) ) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "init_interp_attributes", - 'sim_year'=>$settings{'sim_year'}, 'use_cndv'=>$nl_flags->{'use_cndv'}, - 'glc_nec'=>$nl_flags->{'glc_nec'}, - 'use_cn'=>$nl_flags->{'use_cn'}, 'nofail'=>1 ); + 'sim_year'=>$settings{'sim_year'}, + 'nofail'=>1 ); my $attributes_string = remove_leading_and_trailing_quotes($nl->get_value("init_interp_attributes")); foreach my $pair ( split( /\s/, $attributes_string) ) { if ( $pair =~ /^([a-z_]+)=([a-z._0-9]+)$/ ) { @@ -1491,222 +1206,6 @@ sub setup_logic_initial_conditions { #------------------------------------------------------------------------------- -sub setup_logic_bgc_shared { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $nl_flags->{'bgc_mode'} ne "sp" ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'constrain_stress_deciduous_onset', 'phys'=>$physv->as_string() ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_hydrology_switches { - # - # Check on Switches for hydrology - # - my ($nl, $physv) = @_; - - my $subgrid = $nl->get_value('subgridflag' ); - my $origflag = $nl->get_value('origflag' ); - my $h2osfcflag = $nl->get_value('h2osfcflag' ); - if ( $origflag == 1 && $subgrid == 1 ) { - $log->fatal_error("if origflag is ON, subgridflag can NOT also be on!"); - } - if ( $h2osfcflag == 1 && $subgrid != 1 ) { - $log->fatal_error("if h2osfcflag is ON, subgridflag can NOT be off!"); - } - # These should NOT be set for CLM5.0 and beyond - if ( $physv->as_long() > $physv->as_long("clm4_5") ) { - foreach my $var ( "origflag", "h2osfcflag", "oldfflag" ) { - my $val = $nl->get_value($var); - if ( defined($val) ) { - $log->fatal_error( "ERROR:: $var=$val is deprecated and can only be used with CLM4.5" ); - } - } - } - # Test bad configurations - my $lower = $nl->get_value( 'lower_boundary_condition' ); - my $use_bed = $nl->get_value( 'use_bedrock' ); - my $soilmtd = $nl->get_value( 'soilwater_movement_method' ); - if ( defined($soilmtd) && defined($lower) && $soilmtd == 0 && $lower != 4 ) { - $log->fatal_error( "If soil water movement method is zeng-decker -- lower_boundary_condition can only be aquifer" ); - } - if ( defined($soilmtd) && defined($lower) && $soilmtd == 1 && $lower == 4 ) { - $log->fatal_error( "If soil water movement method is adaptive -- lower_boundary_condition can NOT be aquifer" ); - } - if ( defined($use_bed) && defined($lower) && (&value_is_true($use_bed)) && $lower != 2 ) { - $log->fatal_error( "If use_bedrock is on -- lower_boundary_condition can only be flux" ); - } - if ( defined($h2osfcflag) && defined($lower) && $h2osfcflag == 0 && $lower != 4 ) { - $log->fatal_error( "If h2osfcflag is 0 lower_boundary_condition can only be aquifer" ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_dynamic_plant_nitrogen_alloc { - # - # dynamic plant nitrogen allocation model, bgc=bgc - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( &value_is_true($nl_flags->{'use_cn'}) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_flexibleCN', - 'phys'=>$physv->as_string(), 'use_cn'=>$nl_flags->{'use_cn'} ); - $nl_flags->{'use_flexibleCN'} = $nl->get_value('use_flexibleCN'); - - if ( &value_is_true($nl_flags->{'use_flexibleCN'}) ) { - # TODO(bja, 2015-04) make this depend on > clm 5.0 and bgc mode at some point. - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'MM_Nuptake_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'downreg_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'plant_ndemand_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'substrate_term_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'nscalar_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'temp_scalar_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'CNratio_floating', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reduce_dayl_factor', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'vcmax_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'CN_residual_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'CN_partition_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'CN_evergreen_phenology_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'carbon_resp_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'}, 'use_fun'=>$nl->get_value('use_fun') ); - if ( $nl->get_value('carbon_resp_opt') == 1 && &value_is_true($nl->get_value('use_fun')) ) { - $log->fatal_error("carbon_resp_opt should NOT be set to 1 when FUN is also on"); - } - } - } elsif ( ! &value_is_true($nl_flags->{'use_cn'}) ) { - if ( &value_is_true($nl->get_value('use_flexibleCN')) ) { - $log->fatal_error("use_flexibleCN can ONLY be set if CN is on"); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_hydrstress { - # - # Plant hydraulic stress model - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - # TODO(kwo, 2015-09) make this depend on > clm 5.0 at some point. - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_hydrstress' ); - $nl_flags->{'use_hydrstress'} = $nl->get_value('use_hydrstress'); -} - -#------------------------------------------------------------------------------- - -sub setup_logic_dynamic_roots { - # - # dynamic root model - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_dynroot', 'phys'=>$physv->as_string(), 'bgc_mode'=>$nl_flags->{'bgc_mode'}); - my $use_dynroot = $nl->get_value('use_dynroot'); - if ( &value_is_true($use_dynroot) && ($nl_flags->{'bgc_mode'} eq "sp") ) { - $log->fatal_error("Cannot turn dynroot mode on mode bgc=sp\n" . - "Set the bgc mode to 'cn' or 'bgc'."); - } - if ( &value_is_true( $use_dynroot ) && &value_is_true( $nl_flags->{'use_hydrstress'} ) ) { - $log->fatal_error("Cannot turn use_dynroot on when use_hydrstress is on" ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_canopy { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - # - # Canopy state - # - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, - $nl, 'leaf_mr_vcm', 'phys'=>$nl_flags->{'phys'} ) -} - -#------------------------------------------------------------------------------- - -sub setup_logic_soilwater_movement { - # soilwater_movement require clm4_5/clm5_0 - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soilwater_movement_method' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'upper_boundary_condition' ); - - my $soilmtd = $nl->get_value("soilwater_movement_method"); - my $use_bed = $nl->get_value('use_bedrock' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, - 'lower_boundary_condition', - 'soilwater_movement_method'=>$soilmtd, 'use_bedrock'=>$use_bed - ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'dtmin' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'verySmall' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'xTolerUpper' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'xTolerLower' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'expensive' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'inexpensive' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'flux_calculation' ); -} -#------------------------------------------------------------------------------- - -sub setup_logic_cnvegcarbonstate { - # MUST be AFTER: setup_logic_dynamic_plant_nitrogen_alloc as depends on mm_nuptake_opt which is set there - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( &value_is_true($nl->get_value('use_cn')) ) { - my $mmnuptake = $nl->get_value('mm_nuptake_opt'); - if ( ! defined($mmnuptake) ) { $mmnuptake = ".false."; } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'initial_vegC', - 'use_cn' => $nl->get_value('use_cn'), 'mm_nuptake_opt' => $mmnuptake ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_rooting_profile { - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'rooting_profile_method_water' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'rooting_profile_method_carbon' ); -} - -#------------------------------------------------------------------------------- - -sub setup_logic_soil_resis { - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soil_resis_method' ); -} - -#------------------------------------------------------------------------------- - -sub setup_logic_canopyhydrology { - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'interception_fraction' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'maximum_leaf_wetted_fraction' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_clm5_fpi' ); -} - -#------------------------------------------------------------------------------- - sub setup_logic_snowpack { # # Snowpack related options @@ -1715,87 +1214,11 @@ sub setup_logic_snowpack { if ($physv->as_long() >= $physv->as_long("clm4_5")) { add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'nlevsno'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'h2osno_max'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'int_snow_max'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'n_melt_glcmec'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'wind_dependent_snow_density'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'snow_overburden_compaction_method'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lotmp_snowdensity_method'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'upplim_destruct_metamorph'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fresh_snw_rds_max'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reset_snow'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reset_snow_glc'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reset_snow_glc_ela'); - - if (remove_leading_and_trailing_quotes($nl->get_value('snow_overburden_compaction_method')) eq 'Vionnet2012') { - # overburden_compress_tfactor isn't used if we're using the Vionnet2012 - # snow overburden compaction method, so make sure the user hasn't tried - # to set it - if (defined($nl->get_value('overburden_compress_tfactor'))) { - $log->fatal_error('overburden_compress_tfactor is set, but does not apply when using snow_overburden_compaction_method=Vionnet2012'); - } - } else { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'overburden_compress_tfactor'); - } } } #------------------------------------------------------------------------------- -sub setup_logic_atm_forcing { - # - # Options related to atmospheric forcings - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ($physv->as_long() >= $physv->as_long("clm4_5")) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glcmec_downscale_longwave'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'repartition_rain_snow'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lapse_rate'); - - my $var; - - foreach $var ("lapse_rate_longwave", - "longwave_downscaling_limit") { - if ( &value_is_true($nl->get_value("glcmec_downscale_longwave")) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var); - } else { - if (defined($nl->get_value($var))) { - $log->fatal_error("$var can only be set if glcmec_downscale_longwave is true"); - } - } - } - - foreach $var ("precip_repartition_glc_all_snow_t", - "precip_repartition_glc_all_rain_t", - "precip_repartition_nonglc_all_snow_t", - "precip_repartition_nonglc_all_rain_t") { - if ( &value_is_true($nl->get_value("repartition_rain_snow")) ){ - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var); - } else { - if (defined($nl->get_value($var))) { - $log->fatal_error("$var can only be set if repartition_rain_snow is true"); - } - } - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_lnd2atm { - # - # Options related to fields sent to atmosphere - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ($physv->as_long() >= $physv->as_long("clm4_5")) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'melt_non_icesheet_ice_runoff'); - } -} - -#------------------------------------------------------------------------------- - sub write_output_files { my ($opts, $nl_flags, $defaults, $nl, $physv) = @_; @@ -1813,21 +1236,10 @@ sub write_output_files { # CLM component my @groups = qw(clm_inparm - lai_streams atm2lnd_inparm lnd2atm_inparm - cnvegcarbonstate finidat_consistency_checks clm_initinterp_inparm - soilwater_movement_inparm rooting_profile_inparm - soil_resis_inparm bgc_shared - clmu_inparm clm_soilstate_inparm - clm_soilhydrology_inparm clm_glacier_behavior); - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - push @groups, "cn_general"; - push @groups, "clm_canopy_inparm"; - } - my $outfile; $outfile = "$opts->{'dir'}/lnd_in"; $nl->write($outfile, 'groups'=>\@groups, 'note'=>"$note" ); diff --git a/bld/configure b/bld/configure index 9823585f85..b9b58f1bae 100755 --- a/bld/configure +++ b/bld/configure @@ -47,7 +47,7 @@ OPTIONS or double leading dashes. A consequence of this is that single letter options may NOT be bundled. - -bgc Build CLM with BGC package [ none | cn | cndv ] + -bgc Build CLM with BGC package [ none | cn ] (default is none). -cache Name of output cache file (default: config_cache.xml). -cachedir Name of directory where output cache file is written @@ -58,7 +58,7 @@ OPTIONS -cppdefs A string of user specified CPP defines. Appended to Makefile defaults. e.g. -cppdefs '-DVAR1 -DVAR2' -crop Toggle for prognostic crop model. [on | off] (default is off) - (can ONLY be turned on when BGC type is CN or CNDV) + (can ONLY be turned on when BGC type is CN) -comp_intf Component interface to use (ESMF or MCT) (default MCT) -defaults Specify full path to a configuration file which will be used to supply defaults instead of the defaults in bld/config_files. @@ -66,22 +66,12 @@ OPTIONS Parameters relating to the build which are system dependent will be ignored. -help [or -h] Print usage to STDOUT. - -nofire Turn off wildfires for BGC setting of CN - (default includes fire for CN) -noio Turn history output completely off (typically for testing). -phys Value of clm4_5, or clm5_0 (default is clm4_5) -silent [or -s] Turns on silent mode - only fatal messages issued. -sitespf_pt Setup for the given site specific single-point resolution. -snicar_frc Turn on SNICAR radiative forcing calculation. [on | off] (default is off) - -spinup CLM 4.0 Only. For CLM 4.5, spinup is controlled from build-namelist. - Turn on given spinup mode for BGC setting of CN (level) - AD Turn on Accelerated Decomposition from (2) - bare-soil - exit Jump directly from AD spinup to normal mode (1) - normal Normal decomposition ("final spinup mode") (0) - (default) - The recommended sequence is 2-1-0 -usr_src [,[,[...]]] Directories containing user source code. -verbose [or -v] Turn on verbose echoing of settings made by configure. @@ -121,14 +111,11 @@ my $commandline = "$cfgdir/configure @ARGV"; my %opts = ( cache => "config_cache.xml", phys => "clm4_5", - nofire => undef, noio => undef, cimeroot => undef, clm_root => undef, - spinup => "normal", ); GetOptions( - "spinup=s" => \$opts{'spinup'}, "bgc=s" => \$opts{'bgc'}, "cache=s" => \$opts{'cache'}, "cachedir=s" => \$opts{'cachedir'}, @@ -140,7 +127,6 @@ GetOptions( "defaults=s" => \$opts{'defaults'}, "clm4me=s" => \$opts{'clm4me'}, "h|help" => \$opts{'help'}, - "nofire" => \$opts{'nofire'}, "noio" => \$opts{'noio'}, "phys=s" => \$opts{'phys'}, "snicar_frc=s" => \$opts{'snicar_frc'}, diff --git a/bld/namelist_files/namelist_defaults.xsl b/bld/namelist_files/namelist_defaults.xsl index 96cb2b6edf..3085d98ff7 100644 --- a/bld/namelist_files/namelist_defaults.xsl +++ b/bld/namelist_files/namelist_defaults.xsl @@ -20,17 +20,15 @@

Miscellaneous items include:

    -
  1. Biogeochemistry (BGC) type (none, CN, CNDV)
  2. +
  3. Biogeochemistry (BGC) type (none, CN)
  4. Initial condition date (ymd - year month day)
  5. Initial condition time of day (tod) (sec)
  6. Maximum number of Plant Function Types (maxpft)
  7. -
  8. Number of glacier multiple elevation classes (glc_nec)
  9. Site specific point name (sitespf_pt)
  10. Crop model (crop)
  11. Data model forcing source (forcing)
  12. Representative concentration pathway for future scenarios (rcp)
  13. New good wood harvest (newwoodharv)
  14. -
  15. CN Spin-up mode (spinup)
  16. Type of file (type)
  17. Grid mapping to (to_hgrid)
  18. Land-mask mapping to (to_lmask)
  19. @@ -121,9 +119,6 @@ maxpft= - - glc_nec= - sitespf_pt= @@ -133,12 +128,6 @@ crop= - - irrig= - - - spinup= - forcing= diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml index 6d7e927c5a..ad7a327384 100644 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ b/bld/namelist_files/namelist_defaults_clm4_5.xml @@ -30,162 +30,9 @@ attributes from the config_cache.xml file (with keys converted to upper-case). constant - -sp - - -0.50,0.30 -0.60,0.40 - - -ON_WASTEHEAT -ON - -1 -0 - - -.false. - - -.true. -.false. - -20SL_8.5m -10SL_3.5m - -.false. -.false. -.true. -.false. - - - -1 -0 - -1 -1 - - -1 -0 - - -.true. -.false. - -.true. - - -0.006 - - -0.032 - -0.5 - -0. -2. - -0. -2. - --2. -0. - - -.false. -.true. - - -.true. -1.0 -0.05 - -.false. -0.25 -1.0 - - -0 -1 - -1 -1 - -4 -2 -2 -3 - -60. -1.e-8 -1.e-1 -1.e-2 -42 -1 -1 - - -0.0 -21600 -14400 --3400. -0.6 -1.0 -0.5 -0.1 - - -.false. -.false. - - -OFF -ON_RAD - 12 5 -10000.0 -1000.0 - -2000. - -1.e30 - -10.0d00 -10.0 - -.true. -.false. - -'Vionnet2012' -'Anderson1976' - -'Slater2017' -'TruncatedAnderson1976' - -100.d00 -175.d00 - -54.526d00 -204.526d00 - -0.08d00 - -.false. -.false. - -1.e9 'single_at_atm_topo','virtual','virtual','multiple' - -'remains_in_place','replaced_by_ice','replaced_by_ice','replaced_by_ice' - - -'melted','melted','remains_ice','remains_ice' - - -0 -7300 - -lnd/clm2/paramdata/clm5_params.c171117.nc -lnd/clm2/paramdata/clm_params.c170913.nc - - - - -lnd/clm2/paramdata/fates_params_2troppftclones.c171018.nc - - - - -.true. -.false. -.false. - - -.true. -.false. -.false. - - -.true. -.false. -3 -.true. -.true. -.true. -.true. -.false. -3 -1 -1 -1 -1 -0 - - - - - - -.true. -.false. - -.false. -.true. -.true. - -0.093563 - -.false. -.false. -.true. - -3.d00 -1.d00 - - - -0.5 -10.0 - - -.false. -.true. - - -.false. -.false. -.false. -.false. -.false. - - -.false. -.false. -.true. - - -.false. -.false. -.true. -.true. -.true. -.false. +.true. +.true. +.false. -hgrid=0.9x1.25 maxpft=17 mask=gx1v6 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.false. irrigate=.false. glc_nec=10 +hgrid=0.9x1.25 maxpft=17 mask=gx1v6 -hgrid=0.9x1.25 maxpft=17 mask=gx1v6 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.false. irrigate=.false. glc_nec=10 +hgrid=0.9x1.25 maxpft=17 mask=gx1v6 -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.false. glc_nec=10 +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 -hgrid=0.9x1.25 maxpft=17 mask=gx1v6 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 - - -hgrid=0.9x1.25 maxpft=79 mask=gx1v6 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.false. glc_nec=10 + +hgrid=0.9x1.25 maxpft=79 mask=gx1v6 -hgrid=0.9x1.25 maxpft=79 mask=gx1v6 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.false. glc_nec=10 +hgrid=0.9x1.25 maxpft=79 mask=gx1v6 - -hgrid=0.9x1.25 maxpft=17 mask=gx1v6 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 + +hgrid=0.9x1.25 maxpft=17 mask=gx1v6 -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.false. glc_nec=10 +hgrid=0.9x1.25 maxpft=79 mask=gx1v7 -hgrid=1.9x2.5 maxpft=79 mask=gx1v6 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 +hgrid=1.9x2.5 maxpft=79 mask=gx1v6 @@ -375,62 +118,62 @@ attributes from the config_cache.xml file (with keys converted to upper-case). (if it will work on an exact match, leave use_init_interp off) --> -lnd/clm2/initdata_map/clmi.I1850Clm45BgcGs.0901-01-01.0.9x1.25_gx1v6_simyr1850_c180204.nc -lnd/clm2/initdata_map/clmi.I1850Clm45BgcCruGs.1101-01-01.0.9x1.25_gx1v6_simyr1850_c180204.nc -lnd/clm2/initdata_map/clmi.B1850.0161-01-01.0.9x1.25_gx1v7_simyr1850_c180130.nc -lnd/clm2/initdata_map/clmi.I1850Clm50Sp.0181-01-01.0.9x1.25_gx1v6_simyr1850_c171214.nc -lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop.1366-01-01.0.9x1.25_gx1v6_simyr1850_c171213.nc -lnd/clm2/initdata_map/clmi.I1850Clm50BgcCropCru.1526-01-01.0.9x1.25_gx1v6_simyr1850_c180109.nc -lnd/clm2/initdata_map/clmi.B1850.0161-01-01.0.9x1.25_gx1v7_simyr1850_c180130.nc -lnd/clm2/initdata_map/clmi.I1850Clm50SpCru.1706-01-01.0.9x1.25_gx1v6_simyr1850_c180110.nc @@ -442,147 +185,115 @@ attributes from the config_cache.xml file (with keys converted to upper-case). --> -lnd/clm2/initdata_map/clmi.IGM2000GSWP3CLM50BGCCROPIRR.2011-01-01.1.9x2.5_gx1v6_gl5_simyr2000_c170419.nc - -lnd/clm2/initdata_map/clmi.I2000Clm45Fates.0121-01-01.4x5_mgx3v7_simyr2000_c180122.nc - - -lnd/clm2/initdata_map/clmi.I2000Clm45Fates.0101-01-01.1x1_brazil_simyr2000_c180120.nc - - - - + lnd/clm2/surfdata_map/surfdata_360x720cru_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - + lnd/clm2/surfdata_map/surfdata_48x96_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - + lnd/clm2/surfdata_map/surfdata_0.47x0.63_16pfts_Irrig_CMIP6_simyr2000_c170919.nc - + lnd/clm2/surfdata_map/surfdata_0.9x1.25_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - + lnd/clm2/surfdata_map/surfdata_1.9x2.5_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - + lnd/clm2/surfdata_map/surfdata_4x5_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - + lnd/clm2/surfdata_map/surfdata_10x15_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - + lnd/clm2/surfdata_map/surfdata_ne120np4_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - + lnd/clm2/surfdata_map/surfdata_ne30np4_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - + lnd/clm2/surfdata_map/surfdata_ne16np4_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - + lnd/clm2/surfdata_map/surfdata_5x5_amazon_16pfts_Irrig_CMIP6_simyr2000_c171214.nc - + lnd/clm2/surfdata_map/surfdata_1x1_brazil_16pfts_Irrig_CMIP6_simyr2000_c171214.nc -lnd/clm2/surfdata_map/surfdata_64x128_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - + lnd/clm2/surfdata_map/surfdata_0.47x0.63_78pfts_CMIP6_simyr2000_c170919.nc - + lnd/clm2/surfdata_map/surfdata_0.9x1.25_78pfts_CMIP6_simyr2000_c170824.nc - + lnd/clm2/surfdata_map/surfdata_1.9x2.5_78pfts_CMIP6_simyr2000_c170824.nc - + lnd/clm2/surfdata_map/surfdata_0.125x0.125_mp24_simyr2000_c150114.nc - + lnd/clm2/surfdata_map/surfdata_10x15_78pfts_CMIP6_simyr2000_c170824.nc - + lnd/clm2/surfdata_map/surfdata_4x5_78pfts_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_1x1_numaIA_78pfts_CMIP6_simyr2000_c171214.nc - -lnd/clm2/surfdata_map/surfdata_1x1_smallvilleIA_78pfts_CMIP6_simyr2000_c171214.nc - + lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr2000_c170824.nc - + lnd/clm2/surfdata_map/surfdata_ne30np4_78pfts_CMIP6_simyr2000_c170824.nc - + lnd/clm2/surfdata_map/surfdata_ne16np4_78pfts_CMIP6_simyr2000_c170824.nc - - -lnd/clm2/surfdata_map/surfdata_1x1_camdenNJ_16pfts_Irrig_CMIP6_simyr2000_c171214.nc - -lnd/clm2/surfdata_map/surfdata_1x1_vancouverCAN_16pfts_Irrig_CMIP6_simyr2000_c171214.nc - -lnd/clm2/surfdata_map/surfdata_1x1_mexicocityMEX_16pfts_Irrig_CMIP6_simyr2000_c171214.nc - -lnd/clm2/surfdata_map/surfdata_1x1_urbanc_alpha_16pfts_Irrig_CMIP6_simyr2000_c171214.nc - - + lnd/clm2/surfdata_map/surfdata_360x720cru_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - + lnd/clm2/surfdata_map/surfdata_48x96_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - + lnd/clm2/surfdata_map/surfdata_0.47x0.63_16pfts_Irrig_CMIP6_simyr1850_c170919.nc - + lnd/clm2/surfdata_map/surfdata_0.9x1.25_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - + lnd/clm2/surfdata_map/surfdata_1.9x2.5_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - + lnd/clm2/surfdata_map/surfdata_10x15_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - + lnd/clm2/surfdata_map/surfdata_4x5_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - + lnd/clm2/surfdata_map/surfdata_1x1_brazil_16pfts_Irrig_CMIP6_simyr1850_c171214.nc - + lnd/clm2/surfdata_map/surfdata_ne120np4_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - + lnd/clm2/surfdata_map/surfdata_ne30np4_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - + lnd/clm2/surfdata_map/surfdata_360x720cru_78pfts_CMIP6_simyr1850_c170824.nc - + lnd/clm2/surfdata_map/surfdata_48x96_78pfts_CMIP6_simyr1850_c170824.nc - + lnd/clm2/surfdata_map/surfdata_0.47x0.63_78pfts_CMIP6_simyr1850_c170919.nc - + lnd/clm2/surfdata_map/surfdata_0.9x1.25_78pfts_CMIP6_simyr1850_c170824.nc - + lnd/clm2/surfdata_map/surfdata_1.9x2.5_78pfts_CMIP6_simyr1850_c170824.nc - + lnd/clm2/surfdata_map/surfdata_10x15_78pfts_CMIP6_simyr1850_c170824.nc - + lnd/clm2/surfdata_map/surfdata_4x5_78pfts_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_1x1_smallvilleIA_78pfts_CMIP6_simyr1850_c171214.nc - -lnd/clm2/surfdata_map/surfdata_1x1_numaIA_78pfts_CMIP6_simyr1850_c170917.nc - + lnd/clm2/surfdata_map/surfdata_1x1_brazil_78pfts_CMIP6_simyr1850_c171214.nc - + lnd/clm2/surfdata_map/surfdata_ne30np4_78pfts_CMIP6_simyr1850_c170824.nc - + lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nc @@ -591,1498 +302,195 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c171025.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c171025.nc +lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc + +lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc + +lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1x1_numaIA_hist_78pfts_CMIP6_simyr1850-2015_c170917.nc + >lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - - -lnd/clm2/surfdata_map/landuse.timeseries_1x1_smallvilleIA_hist_78pfts_simyr1850-1855_c160127.nc + >lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc + +lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc + +lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc + +lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc + +lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc +lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc + >lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - - -.true. -.false. - - -0.015d00 -0.015d00 - - -20.0d00, 20.0d00, 20.0d00 -200.0d00, 200.0d00, 200.0d00 -20.0d00, 20.0d00, 20.0d00 -200.0d00, 200.0d00, 200.0d00 - -1.50d00 -0.3 -1.50d00 -0.3 - -100.d00 -20.d00 -1.d00 -1.d00 - - - -lnd/clm2/snicardata/snicar_optics_5bnd_c090915.nc -lnd/clm2/snicardata/snicar_drdt_bst_fit_60_c070416.nc - - -.false. -2001 -2013 -2001 - -lnd/clm2/lai_streams/MODISPFTLAI_0.5x0.5_c140711.nc + >lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc bilinear nn -nn -nn -nn -nn -nn nn nn -nn -nn -nn -nn -nn nn - -.true. -.false. - - 35 - - - - - - - -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.1x0.1_nomask_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.5x0.5_AVHRR_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.5x0.5_MODIS_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.25x0.25_MODIS_to_0.1x0.1_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.5x0.5_nomask_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_10x10min_nomask_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_3x3min_MODIS_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_3x3min_MODIS-wCsp_to_0.1x0.1_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_5x5min_IGBP-GSDP_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_5x5min_ISRIC-WISE_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_5x5min_ORNL-Soil_to_0.1x0.1_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_5x5min_nomask_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_ne120np4_nomask_to_0.1x0.1_nomask_aave_da_c120711.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_4x5_nomask_to_0.1x0.1_nomask_aave_da_c120706.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_1.9x2.5_nomask_to_0.1x0.1_nomask_aave_da_c120709.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_ne240np4_nomask_to_0.1x0.1_nomask_aave_da_c120711.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.9x1.25_GRDC_to_0.1x0.1_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_360x720_cruncep_to_0.1x0.1_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_1km-merge-10min_HYDRO1K-merge-nomask_to_0.1x0.1_nomask_aave_da_c130405.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.5x0.5_AVHRR_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.5x0.5_MODIS_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.25x0.25_MODIS_to_1x1_asphaltjungleNJ_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.5x0.5_nomask_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_10x10min_nomask_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_MODIS_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_MODIS-wCsp_to_1x1_asphaltjungleNJ_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_USGS_to_1x1_asphaltjungleNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_LandScan2004_to_1x1_asphaltjungleNJ_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_5x5min_IGBP-GSDP_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_5x5min_ISRIC-WISE_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_5x5min_ORNL-Soil_to_1x1_asphaltjungleNJ_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_5x5min_nomask_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_GLOBE-Gardner_to_1x1_asphaltjungleNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_asphaltjungleNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.9x1.25_GRDC_to_1x1_asphaltjungleNJ_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_360x720_cruncep_to_1x1_asphaltjungleNJ_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_asphaltjungleNJ_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.5x0.5_AVHRR_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.5x0.5_MODIS_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.25x0.25_MODIS_to_1x1_brazil_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.5x0.5_nomask_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_10x10min_nomask_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_MODIS_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_MODIS-wCsp_to_1x1_brazil_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_USGS_to_1x1_brazil_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_LandScan2004_to_1x1_brazil_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_5x5min_IGBP-GSDP_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_5x5min_ISRIC-WISE_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_5x5min_ORNL-Soil_to_1x1_brazil_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_5x5min_nomask_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_GLOBE-Gardner_to_1x1_brazil_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_brazil_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.9x1.25_GRDC_to_1x1_brazil_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_360x720_cruncep_to_1x1_brazil_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_brazil_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.5x0.5_AVHRR_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.5x0.5_MODIS_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.25x0.25_MODIS_to_1x1_camdenNJ_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.5x0.5_nomask_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_10x10min_nomask_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_MODIS_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_MODIS-wCsp_to_1x1_camdenNJ_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_USGS_to_1x1_camdenNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_LandScan2004_to_1x1_camdenNJ_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_5x5min_IGBP-GSDP_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_5x5min_ISRIC-WISE_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_5x5min_ORNL-Soil_to_1x1_camdenNJ_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_5x5min_nomask_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_GLOBE-Gardner_to_1x1_camdenNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_camdenNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.9x1.25_GRDC_to_1x1_camdenNJ_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_360x720_cruncep_to_1x1_camdenNJ_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_camdenNJ_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.5x0.5_AVHRR_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.5x0.5_MODIS_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.25x0.25_MODIS_to_1x1_mexicocityMEX_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.5x0.5_nomask_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_10x10min_nomask_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_MODIS_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_MODIS-wCsp_to_1x1_mexicocityMEX_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_USGS_to_1x1_mexicocityMEX_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_LandScan2004_to_1x1_mexicocityMEX_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_5x5min_IGBP-GSDP_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_5x5min_ISRIC-WISE_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_5x5min_ORNL-Soil_to_1x1_mexicocityMEX_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_5x5min_nomask_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_GLOBE-Gardner_to_1x1_mexicocityMEX_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_mexicocityMEX_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.9x1.25_GRDC_to_1x1_mexicocityMEX_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_360x720_cruncep_to_1x1_mexicocityMEX_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_mexicocityMEX_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.5x0.5_AVHRR_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.5x0.5_MODIS_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.25x0.25_MODIS_to_1x1_numaIA_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.5x0.5_nomask_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_10x10min_nomask_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_MODIS_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_MODIS-wCsp_to_1x1_numaIA_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_USGS_to_1x1_numaIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_LandScan2004_to_1x1_numaIA_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_5x5min_IGBP-GSDP_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_5x5min_ISRIC-WISE_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_5x5min_ORNL-Soil_to_1x1_numaIA_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_5x5min_nomask_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_GLOBE-Gardner_to_1x1_numaIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_numaIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.9x1.25_GRDC_to_1x1_numaIA_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_360x720_cruncep_to_1x1_numaIA_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_numaIA_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.5x0.5_AVHRR_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.5x0.5_MODIS_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.25x0.25_MODIS_to_1x1_smallvilleIA_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.5x0.5_nomask_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_10x10min_nomask_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_MODIS_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_MODIS-wCsp_to_1x1_smallvilleIA_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_USGS_to_1x1_smallvilleIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_LandScan2004_to_1x1_smallvilleIA_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_5x5min_IGBP-GSDP_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_5x5min_ISRIC-WISE_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_5x5min_ORNL-Soil_to_1x1_smallvilleIA_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_5x5min_nomask_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_GLOBE-Gardner_to_1x1_smallvilleIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_smallvilleIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.9x1.25_GRDC_to_1x1_smallvilleIA_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_360x720_cruncep_to_1x1_smallvilleIA_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_smallvilleIA_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.5x0.5_AVHRR_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.5x0.5_MODIS_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.25x0.25_MODIS_to_1x1_urbanc_alpha_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.5x0.5_nomask_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_10x10min_nomask_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_MODIS_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_MODIS-wCsp_to_1x1_urbanc_alpha_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_USGS_to_1x1_urbanc_alpha_nomask_aave_da_c120928.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_LandScan2004_to_1x1_urbanc_alpha_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_5x5min_IGBP-GSDP_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_5x5min_ISRIC-WISE_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_5x5min_ORNL-Soil_to_1x1_urbanc_alpha_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_5x5min_nomask_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_GLOBE-Gardner_to_1x1_urbanc_alpha_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_urbanc_alpha_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.9x1.25_GRDC_to_1x1_urbanc_alpha_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_360x720_cruncep_to_1x1_urbanc_alpha_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_urbanc_alpha_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.5x0.5_AVHRR_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.5x0.5_MODIS_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.25x0.25_MODIS_to_1x1_vancouverCAN_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.5x0.5_nomask_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_10x10min_nomask_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_MODIS_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_MODIS-wCsp_to_1x1_vancouverCAN_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_USGS_to_1x1_vancouverCAN_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_LandScan2004_to_1x1_vancouverCAN_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_5x5min_IGBP-GSDP_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_5x5min_ISRIC-WISE_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_5x5min_ORNL-Soil_to_1x1_vancouverCAN_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_5x5min_nomask_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_GLOBE-Gardner_to_1x1_vancouverCAN_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_vancouverCAN_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.9x1.25_GRDC_to_1x1_vancouverCAN_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_360x720_cruncep_to_1x1_vancouverCAN_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_vancouverCAN_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/0.47x0.63/map_0.25x0.25_MODIS_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_0.5x0.5_AVHRR_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_0.5x0.5_MODIS_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_0.9x1.25_GRDC_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_10x10min_IGBPmergeICESatGIS_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_10x10min_nomask_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_1km-merge-10min_HYDRO1K-merge-nomask_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_360x720cru_cruncep_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_GLOBE-Gardner_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_LandScan2004_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_MODIS-wCsp_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_USGS_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_5x5min_IGBP-GSDP_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_5x5min_ISRIC-WISE_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_5x5min_nomask_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_5x5min_ORNL-Soil_to_0.47x0.63_nomask_aave_da_c170914.nc - - - - -lnd/clm2/mappingdata/maps/0.9x1.25/map_0.5x0.5_landuse_to_0.9x1.25_aave_da_110307.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_0.25x0.25_MODIS_to_0.9x1.25_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_0.5x0.5_lanwat_to_0.9x1.25_aave_da_110307.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_10minx10min_topo_to_0.9x1.25_aave_da_110630.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_5minx5min_soitex_to_0.9x1.25_aave_da_110722.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_5minx5min_irrig_to_0.9x1.25_aave_da_110529.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_5x5min_ISRIC-WISE_to_0.9x1.25_nomask_aave_da_c120525.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_5x5min_ORNL-Soil_to_0.9x1.25_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_MODIS_to_0.9x1.25_nomask_aave_da_c120523.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_MODIS-wCsp_to_0.9x1.25_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_USGS_to_0.9x1.25_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_LandScan2004_to_0.9x1.25_nomask_aave_da_c120522.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_GLOBE-Gardner_to_0.9x1.25_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.9x1.25_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_0.9x1.25_GRDC_to_0.9x1.25_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_360x720_cruncep_to_0.9x1.25_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_1km-merge-10min_HYDRO1K-merge-nomask_to_0.9x1.25_nomask_aave_da_c130405.nc - -lnd/clm2/mappingdata/maps/1.9x2.5/map_0.5x0.5_landuse_to_1.9x2.5_aave_da_110307.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_0.25x0.25_MODIS_to_1.9x2.5_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_0.5x0.5_lanwat_to_1.9x2.5_aave_da_110307.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_10minx10min_topo_to_1.9x2.5_aave_da_110307.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_5minx5min_soitex_to_1.9x2.5_aave_da_110307.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_5x5min_nomask_to_1.9x2.5_nomask_aave_da_c120606.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_5x5min_ISRIC-WISE_to_1.9x2.5_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_5x5min_ORNL-Soil_to_1.9x2.5_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_MODIS_to_1.9x2.5_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_MODIS-wCsp_to_1.9x2.5_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_USGS_to_1.9x2.5_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_LandScan2004_to_1.9x2.5_nomask_aave_da_c120522.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_GLOBE-Gardner_to_1.9x2.5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_GLOBE-Gardner-mergeGIS_to_1.9x2.5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_0.9x1.25_GRDC_to_1.9x2.5_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_360x720_cruncep_to_1.9x2.5_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1.9x2.5_nomask_aave_da_c130405.nc - - -lnd/clm2/mappingdata/maps/10x15/map_0.5x0.5_landuse_to_10x15_aave_da_110307.nc -lnd/clm2/mappingdata/maps/10x15/map_0.25x0.25_MODIS_to_10x15_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/10x15/map_0.5x0.5_lanwat_to_10x15_aave_da_110307.nc -lnd/clm2/mappingdata/maps/10x15/map_10minx10min_topo_to_10x15_aave_da_110307.nc -lnd/clm2/mappingdata/maps/10x15/map_5minx5min_soitex_to_10x15_aave_da_110307.nc -lnd/clm2/mappingdata/maps/10x15/map_5x5min_nomask_to_10x15_nomask_aave_da_c120327.nc -lnd/clm2/mappingdata/maps/10x15/map_5x5min_ISRIC-WISE_to_10x15_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/10x15/map_5x5min_ORNL-Soil_to_10x15_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_MODIS_to_10x15_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_MODIS-wCsp_to_10x15_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_USGS_to_10x15_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_LandScan2004_to_10x15_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_GLOBE-Gardner_to_10x15_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_GLOBE-Gardner-mergeGIS_to_10x15_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/10x15/map_0.9x1.25_GRDC_to_10x15_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/10x15/map_360x720_cruncep_to_10x15_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/10x15/map_1km-merge-10min_HYDRO1K-merge-nomask_to_10x15_nomask_aave_da_c130411.nc - -lnd/clm2/mappingdata/maps/360x720/map_0.5x0.5_MODIS_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_0.25x0.25_MODIS_to_360x720cru_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/360x720/map_0.5x0.5_AVHRR_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_10x10min_nomask_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_5x5min_IGBP-GSDP_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_5x5min_nomask_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_5x5min_ISRIC-WISE_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_5x5min_ORNL-Soil_to_360x720cru_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_MODIS_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_MODIS-wCsp_to_360x720cru_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_USGS_to_360x720_nomask_aave_da_c121128.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_LandScan2004_to_360x720_nomask_aave_da_c121017.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_GLOBE-Gardner_to_360x720_nomask_aave_da_c121128.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_GLOBE-Gardner-mergeGIS_to_360x720_nomask_aave_da_c121128.nc -lnd/clm2/mappingdata/maps/360x720/map_0.9x1.25_GRDC_to_360x720_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/360x720/map_360x720_cruncep_to_360x720_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/360x720/map_1km-merge-10min_HYDRO1K-merge-nomask_to_360x720_nomask_aave_da_c130403.nc - - -lnd/clm2/mappingdata/maps/512x1024/map_0.5x0.5_MODIS_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_0.25x0.25_MODIS_to_512x1024_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/512x1024/map_0.5x0.5_AVHRR_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_10x10min_nomask_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_5x5min_IGBP-GSDP_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_5x5min_nomask_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_5x5min_ISRIC-WISE_to_512x1024_nomask_aave_da_c120906.nc -lnd/clm2/mappingdata/maps/512x1024/map_5x5min_ORNL-Soil_to_512x1024_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_MODIS_to_512x1024_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_MODIS-wCsp_to_512x1024_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_USGS_to_512x1024_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_LandScan2004_to_512x1024_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_GLOBE-Gardner_to_512x1024_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_GLOBE-Gardner-mergeGIS_to_512x1024_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/512x1024/map_0.9x1.25_GRDC_to_512x1024_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/512x1024/map_360x720_cruncep_to_512x1024_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/512x1024/map_1km-merge-10min_HYDRO1K-merge-nomask_to_512x1024_nomask_aave_da_c130403.nc - - -lnd/clm2/mappingdata/maps/128x256/map_0.5x0.5_MODIS_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_0.25x0.25_MODIS_to_128x256_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/128x256/map_0.5x0.5_AVHRR_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_10x10min_nomask_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_5x5min_IGBP-GSDP_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_5x5min_nomask_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_5x5min_ISRIC-WISE_to_128x256_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/128x256/map_5x5min_ORNL-Soil_to_128x256_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_MODIS_to_128x256_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_MODIS-wCsp_to_128x256_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_USGS_to_128x256_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_LandScan2004_to_128x256_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_GLOBE-Gardner_to_128x256_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_GLOBE-Gardner-mergeGIS_to_128x256_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/128x256/map_0.9x1.25_GRDC_to_128x256_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/128x256/map_360x720_cruncep_to_128x256_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/128x256/map_1km-merge-10min_HYDRO1K-merge-nomask_to_128x256_nomask_aave_da_c130403.nc - - -lnd/clm2/mappingdata/maps/64x128/map_0.5x0.5_MODIS_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_0.25x0.25_MODIS_to_64x128_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/64x128/map_0.5x0.5_AVHRR_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_10x10min_nomask_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_5x5min_IGBP-GSDP_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_5x5min_nomask_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_5x5min_ISRIC-WISE_to_64x128_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/64x128/map_5x5min_ORNL-Soil_to_64x128_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_MODIS_to_64x128_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_MODIS-wCsp_to_64x128_nomask_aave_da_c160428.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_USGS_to_64x128_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_LandScan2004_to_64x128_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_GLOBE-Gardner_to_64x128_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_GLOBE-Gardner-mergeGIS_to_64x128_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/64x128/map_0.9x1.25_GRDC_to_64x128_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/64x128/map_360x720_cruncep_to_64x128_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/64x128/map_1km-merge-10min_HYDRO1K-merge-nomask_to_64x128_nomask_aave_da_c130403.nc - -lnd/clm2/mappingdata/maps/48x96/map_0.5x0.5_MODIS_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_0.25x0.25_MODIS_to_48x96_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/48x96/map_0.5x0.5_AVHRR_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_10x10min_nomask_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_5x5min_IGBP-GSDP_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_5x5min_nomask_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_5x5min_ISRIC-WISE_to_48x96_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/48x96/map_5x5min_ORNL-Soil_to_48x96_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_MODIS_to_48x96_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_MODIS-wCsp_to_48x96_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_USGS_to_48x96_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_LandScan2004_to_48x96_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_GLOBE-Gardner_to_48x96_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_GLOBE-Gardner-mergeGIS_to_48x96_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/48x96/map_0.9x1.25_GRDC_to_48x96_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/48x96/map_360x720_cruncep_to_48x96_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/48x96/map_1km-merge-10min_HYDRO1K-merge-nomask_to_48x96_nomask_aave_da_c130405.nc - -lnd/clm2/mappingdata/maps/32x64/map_0.5x0.5_MODIS_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_0.25x0.25_MODIS_to_32x64_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/32x64/map_0.5x0.5_AVHRR_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_10x10min_nomask_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_IGBP-GSDP_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_nomask_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_ISRIC-WISE_to_32x64_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_ORNL-Soil_to_32x64_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_MODIS_to_32x64_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_MODIS-wCsp_to_32x64_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_USGS_to_32x64_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_LandScan2004_to_32x64_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_GLOBE-Gardner_to_32x64_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_GLOBE-Gardner-mergeGIS_to_32x64_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/32x64/map_0.9x1.25_GRDC_to_32x64_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/32x64/map_360x720_cruncep_to_32x64_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/32x64/map_1km-merge-10min_HYDRO1K-merge-nomask_to_32x64_nomask_aave_da_c130405.nc - -lnd/clm2/mappingdata/maps/8x16/map_0.5x0.5_MODIS_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_0.25x0.25_MODIS_to_8x16_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/8x16/map_0.5x0.5_AVHRR_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_10x10min_nomask_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_IGBP-GSDP_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_nomask_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_ISRIC-WISE_to_8x16_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_ORNL-Soil_to_8x16_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_MODIS_to_8x16_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_MODIS-wCsp_to_8x16_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_USGS_to_8x16_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_LandScan2004_to_8x16_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_GLOBE-Gardner_to_8x16_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_GLOBE-Gardner-mergeGIS_to_8x16_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/8x16/map_0.9x1.25_GRDC_to_8x16_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/8x16/map_360x720_cruncep_to_8x16_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/8x16/map_1km-merge-10min_HYDRO1K-merge-nomask_to_8x16_nomask_aave_da_c130411.nc - -lnd/clm2/mappingdata/maps/4x5/map_0.5x0.5_MODIS_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_0.25x0.25_MODIS_to_4x5_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/4x5/map_0.5x0.5_AVHRR_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_10x10min_nomask_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_5x5min_IGBP-GSDP_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_5x5min_nomask_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_5x5min_ISRIC-WISE_to_4x5_nomask_aave_da_c120906.nc -lnd/clm2/mappingdata/maps/4x5/map_5x5min_ORNL-Soil_to_4x5_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_MODIS_to_4x5_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_MODIS-wCsp_to_4x5_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_USGS_to_4x5_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_LandScan2004_to_4x5_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_GLOBE-Gardner_to_4x5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_GLOBE-Gardner-mergeGIS_to_4x5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/4x5/map_0.9x1.25_GRDC_to_4x5_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/4x5/map_360x720_cruncep_to_4x5_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/4x5/map_1km-merge-10min_HYDRO1K-merge-nomask_to_4x5_nomask_aave_da_c130411.nc - -lnd/clm2/mappingdata/maps/0.23x0.31/map_0.5x0.5_MODIS_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_0.25x0.25_MODIS_to_0.23x0.31_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_0.5x0.5_AVHRR_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_10x10min_nomask_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_5x5min_IGBP-GSDP_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_5x5min_nomask_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_5x5min_ISRIC-WISE_to_0.23x0.31_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_5x5min_ORNL-Soil_to_0.23x0.31_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_MODIS_to_0.23x0.31_nomask_aave_da_c110930.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_MODIS-wCsp_to_0.23x0.31_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_USGS_to_0.23x0.31_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_LandScan2004_to_0.23x0.31_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_GLOBE-Gardner_to_0.23x0.31_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.23x0.31_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_LandScan2004_to_0.23x0.31_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_0.9x1.25_GRDC_to_0.23x0.31_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_360x720_cruncep_to_0.23x0.31_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_1km-merge-10min_HYDRO1K-merge-nomask_to_0.23x0.31_nomask_aave_da_c130405.nc - - -lnd/clm2/mappingdata/maps/2.5x3.33/map_0.5x0.5_MODIS_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_0.25x0.25_MODIS_to_2.5x3.33_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_0.5x0.5_AVHRR_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_10x10min_nomask_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_5x5min_IGBP-GSDP_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_5x5min_nomask_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_5x5min_ISRIC-WISE_to_2.5x3.33_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_5x5min_ORNL-Soil_to_2.5x3.33_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_MODIS_to_2.5x3.33_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_MODIS-wCsp_to_2.5x3.33_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_USGS_to_2.5x3.33_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_LandScan2004_to_2.5x3.33_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_GLOBE-Gardner_to_2.5x3.33_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_GLOBE-Gardner-mergeGIS_to_2.5x3.33_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_0.9x1.25_GRDC_to_2.5x3.33_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_360x720_cruncep_to_2.5x3.33_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_1km-merge-10min_HYDRO1K-merge-nomask_to_2.5x3.33_nomask_aave_da_c130405.nc - - - - -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.5x0.5_AVHRR_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.25x0.25_MODIS_to_0.5x0.5_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.5x0.5_MODIS_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.5x0.5_nomask_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_10x10min_IGBPmergeICESatGIS_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_10x10min_nomask_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_5x5min_IGBP-GSDP_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_5x5min_nomask_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_MODIS_to_0.5x0.5_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_MODIS-wCsp_to_0.5x0.5_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_5x5min_ISRIC-WISE_to_0.5x0.5_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_5x5min_ORNL-Soil_to_0.5x0.5_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_LandScan2004_to_0.5x0.5_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_GLOBE-Gardner_to_0.5x0.5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.5x0.5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.1x0.1_nomask_to_0.5x0.5_nomask_aave_da_c120706.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_ne240np4_nomask_to_0.5x0.5_nomask_aave_da_c120711.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_4x5_nomask_to_0.5x0.5_nomask_aave_da_c120706.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_1.9x2.5_nomask_to_0.5x0.5_nomask_aave_da_c120709.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_ne120np4_nomask_to_0.5x0.5_nomask_aave_da_c120711.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3_USGS_nomask_to_0.5x0.5_nomask_aave_da_c120912.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.9x1.25_GRDC_to_0.5x0.5_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_360x720_cruncep_to_0.5x0.5_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_1km-merge-10min_HYDRO1K-merge-nomask_to_0.5x0.5_nomask_aave_da_c130405.nc - - - -lnd/clm2/mappingdata/maps/ne4np4/map_0.5x0.5_MODIS_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_0.25x0.25_MODIS_to_ne4np4_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/ne4np4/map_0.5x0.5_AVHRR_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_10x10min_nomask_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_5x5min_IGBP-GSDP_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_5x5min_nomask_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_5x5min_ISRIC-WISE_to_ne4np4_nomask_aave_da_c120906.nc -lnd/clm2/mappingdata/maps/ne4np4/map_5x5min_ORNL-Soil_to_ne4np4_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_MODIS_to_ne4np4_nomask_aave_da_c120906.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_MODIS-wCsp_to_ne4np4_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_USGS_to_ne4np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_LandScan2004_to_ne4np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_GLOBE-Gardner_to_ne4np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne4np4_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_LandScan2004_to_ne4np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne4np4/map_0.9x1.25_GRDC_to_ne4np4_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/ne4np4/map_360x720_cruncep_to_ne4np4_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/ne4np4/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne4np4_nomask_aave_da_c130411.nc -lnd/clm2/mappingdata/maps/ne4np4/map_ne4np4_nomask_to_0.5x0.5_nomask_aave_da_c110923.nc - - -lnd/clm2/mappingdata/maps/ne16np4/map_0.5x0.5_MODIS_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_0.25x0.25_MODIS_to_ne16np4_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/ne16np4/map_0.5x0.5_AVHRR_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_10x10min_nomask_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_5x5min_IGBP-GSDP_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_5x5min_nomask_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_5x5min_ISRIC-WISE_to_ne16np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne16np4/map_5x5min_ORNL-Soil_to_ne16np4_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_MODIS_to_ne16np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_MODIS-wCsp_to_ne16np4_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_USGS_to_ne16np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_LandScan2004_to_ne16np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_GLOBE-Gardner_to_ne16np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne16np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne16np4/map_0.9x1.25_GRDC_to_ne16np4_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/ne16np4/map_360x720_cruncep_to_ne16np4_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/ne16np4/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne16np4_nomask_aave_da_c130408.nc -lnd/clm2/mappingdata/maps/ne16np4/map_ne16np4_nomask_to_0.5x0.5_nomask_aave_da_c110922.nc - - -lnd/clm2/mappingdata/maps/ne30np4/map_0.5x0.5_landuse_to_ne30np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne30np4/map_0.25x0.25_MODIS_to_ne30np4_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/ne30np4/map_0.5x0.5_lanwat_to_ne30np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne30np4/map_10minx10min_topo_to_ne30np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne30np4/map_5minx5min_soitex_to_ne30np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne30np4/map_5minx5min_irrig_to_ne30np4_aave_da_110720.nc -lnd/clm2/mappingdata/maps/ne30np4/map_5x5min_ISRIC-WISE_to_ne30np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne30np4/map_5x5min_ORNL-Soil_to_ne30np4_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_MODIS_to_ne30np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_MODIS-wCsp_to_ne30np4_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_USGS_to_ne30np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_LandScan2004_to_ne30np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_GLOBE-Gardner_to_ne30np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne30np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne30np4/map_0.9x1.25_GRDC_to_ne30np4_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/ne30np4/map_360x720_cruncep_to_ne30np4_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/ne30np4/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne30np4_nomask_aave_da_c130405.nc - -lnd/clm2/mappingdata/maps/ne30np4/map_ne30np4_to_0.5x0.5rtm_aave_da_110320.nc - -lnd/clm2/mappingdata/maps/ne60np4/map_0.5x0.5_MODIS_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_0.25x0.25_MODIS_to_ne60np4_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/ne60np4/map_0.5x0.5_AVHRR_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_10x10min_nomask_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_5x5min_IGBP-GSDP_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_5x5min_nomask_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_5x5min_ISRIC-WISE_to_ne60np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne60np4/map_5x5min_ORNL-Soil_to_ne60np4_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_MODIS_to_ne60np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_MODIS-wCsp_to_ne60np4_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_USGS_to_ne60np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_LandScan2004_to_ne60np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_GLOBE-Gardner_to_ne60np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne60np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne60np4/map_0.9x1.25_GRDC_to_ne60np4_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/ne60np4/map_360x720_cruncep_to_ne60np4_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/ne60np4/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne60np4_nomask_aave_da_c130405.nc -lnd/clm2/mappingdata/maps/ne60np4/map_ne60np4_nomask_to_0.5x0.5_nomask_aave_da_c110922.nc - -lnd/clm2/mappingdata/maps/ne120np4/map_0.5x0.5_landuse_to_ne120np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne120np4/map_0.25x0.25_MODIS_to_ne120np4_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/ne120np4/map_0.5x0.5_lanwat_to_ne120np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne120np4/map_10minx10min_topo_to_ne120np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne120np4/map_5minx5min_soitex_to_ne120np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne120np4/map_5x5min_ISRIC-WISE_to_ne120np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne120np4/map_5x5min_ORNL-Soil_to_ne120np4_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/ne120np4/map_5minx5min_irrig_to_ne120np4_aave_da_110817.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_MODIS_to_ne120np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_MODIS-wCsp_to_ne120np4_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_USGS_to_ne120np4_nomask_aave_da_c120913.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_LandScan2004_to_ne120np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_GLOBE-Gardner_to_ne120np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne120np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_USGS_to_ne120np4_nomask_aave_da_c120913.nc -lnd/clm2/mappingdata/maps/ne120np4/map_0.9x1.25_GRDC_to_ne120np4_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/ne120np4/map_360x720_cruncep_to_ne120np4_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/ne120np4/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne120np4_nomask_aave_da_c130405.nc - - - - -lnd/clm2/mappingdata/maps/ne120np4/map_0.1x0.1_nomask_to_ne120np4_nomask_aave_da_c120706.nc - - - -lnd/clm2/mappingdata/maps/5x5_amazon/map_0.5x0.5_MODIS_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_0.25x0.25_MODIS_to_5x5_amazon_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_0.5x0.5_AVHRR_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_10x10min_nomask_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_5x5min_IGBP-GSDP_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_5x5min_nomask_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_5x5min_ISRIC-WISE_to_5x5_amazon_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_5x5min_ORNL-Soil_to_5x5_amazon_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_MODIS_to_5x5_amazon_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_MODIS-wCsp_to_5x5_amazon_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_USGS_to_5x5_amazon_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_LandScan2004_to_5x5_amazon_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_GLOBE-Gardner_to_5x5_amazon_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_GLOBE-Gardner-mergeGIS_to_5x5_amazon_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_0.9x1.25_GRDC_to_5x5_amazon_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_360x720_cruncep_to_5x5_amazon_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_1km-merge-10min_HYDRO1K-merge-nomask_to_5x5_amazon_nomask_aave_da_c130403.nc - -lnd/clm2/mappingdata/maps/ne240np4/map_0.5x0.5_MODIS_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_0.25x0.25_MODIS_to_ne240np4_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/ne240np4/map_0.5x0.5_AVHRR_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_10x10min_nomask_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_5x5min_IGBP-GSDP_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_5x5min_nomask_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_5x5min_ISRIC-WISE_to_ne240np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne240np4/map_5x5min_ORNL-Soil_to_ne240np4_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_MODIS_to_ne240np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_MODIS-wCsp_to_ne240np4_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_USGS_to_ne240np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_LandScan2004_to_ne240np4_nomask_aave_da_c120521.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_GLOBE-Gardner_to_ne240np4_nomask_aave_da_c120925.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne240np4_nomask_aave_da_c120925.nc -lnd/clm2/mappingdata/maps/ne240np4/map_0.9x1.25_GRDC_to_ne240np4_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/ne240np4/map_360x720_cruncep_to_ne240np4_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/ne240np4/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne240np4_nomask_aave_da_c130405.nc -lnd/clm2/mappingdata/maps/ne240np4/map_ne240np4_nomask_to_0.5x0.5_nomask_aave_da_c110922.nc - - - - -lnd/clm2/mappingdata/maps/0.125x0.125/map_0.5x0.5_AVHRR_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_0.5x0.5_MODIS_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_0.25x0.25_MODIS_to_0.125x0.125_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_0.9x1.25_GRDC_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_10x10min_IGBPmergeICESatGIS_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_10x10min_nomask_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_1km-merge-10min_HYDRO1K-merge-nomask_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_360x720cru_cruncep_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_GLOBE-Gardner_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_LandScan2004_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_MODIS_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_MODIS-wCsp_to_0.125x0.125_nomask_aave_da_c160427.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_USGS_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_5x5min_IGBP-GSDP_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_5x5min_ISRIC-WISE_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_5x5min_ORNL-Soil_to_0.125x0.125_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_5x5min_nomask_to_0.125x0.125_nomask_aave_da_c140702.nc - - - @@ -2090,36 +498,4 @@ lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nc. . - - - - -.false. -.false. -.false. -.false. - -.false. -.false. -.false. -.false. - -.true. -.true. -.true. -.true. - -.true. -.true. -.false. -.false. - - -.false. -.false. -.false. -.false. -.false. -.false. - diff --git a/bld/namelist_files/namelist_defaults_overall.xml b/bld/namelist_files/namelist_defaults_overall.xml index 9d8e3da454..a3e7e368ef 100644 --- a/bld/namelist_files/namelist_defaults_overall.xml +++ b/bld/namelist_files/namelist_defaults_overall.xml @@ -15,11 +15,6 @@ determine default values for namelists. startup startup -arb_ic -arb_ic -arb_ic -arb_ic -cold /fs/cgd/csm/inputdata @@ -28,13 +23,6 @@ determine default values for namelists. 1.9x2.5 1x1_brazil 5x5_amazon -1x1_camdenNJ -1x1_vancouverCAN -1x1_mexicocityMEX -1x1_asphaltjungleNJ -1x1_urbanc_alpha -1x1_numaIA -1x1_smallvilleIA 2000 @@ -53,9 +41,6 @@ determine default values for namelists. -999.9 - -.false. - gx1v6 gx1v6 @@ -79,24 +64,7 @@ determine default values for namelists. gx1v6 navy -navy -navy -navy -navy navy -test -navy -test gx1v6 - - -.false. -0 -1 -3 -5 -10 -36 - diff --git a/bld/namelist_files/namelist_definition.xsl b/bld/namelist_files/namelist_definition.xsl index 545d810e52..a83d4d7dc1 100644 --- a/bld/namelist_files/namelist_definition.xsl +++ b/bld/namelist_files/namelist_definition.xsl @@ -54,84 +54,6 @@ - - - - - - - - - - - -
    CLM Namelist Lake Model Options
    NameTypeDescription
    Valid values
    - - - - - - - - - - - - -
    CLM Biogeochemistry (BGC) Model Options
    NameTypeDescription
    Valid values
    - - - - - - - - - - - - -
    CLM Biogeochemistry Namelist Nitrogen Model Options
    NameTypeDescription
    Valid values
    - - - - - - - - - - - - -
    CLM Namelist Methane Model Options
    NameTypeDescription
    Valid values
    - - - - - - - - - - - - -
    CLM Namelist Vertical CN Model Options
    NameTypeDescription
    Valid values
    - - - - - - - - - - - - -
    CLM Namelist Carbon Isotope Model Options
    NameTypeDescription
    Valid values
    - @@ -314,21 +236,6 @@
    -

    Namelist items for Driver MEGAN Physics

    -
    CLM Namelist Datasets
    - - - - - - - - - - -
    Driver Physics
    NameTypeDescription
    Valid values
    - -

    Namelist items for Driver Dry Deposition

    diff --git a/bld/namelist_files/namelist_definition_clm4_5.xml b/bld/namelist_files/namelist_definition_clm4_5.xml index 0ded48143e..6ebee1a964 100644 --- a/bld/namelist_files/namelist_definition_clm4_5.xml +++ b/bld/namelist_files/namelist_definition_clm4_5.xml @@ -77,253 +77,6 @@ Type of CO2 feedback. diagnostic = use the diagnostic value sent from the atmosphere - - -Supplemental Nitrogen mode and for what type of vegetation it's turned on for. -In this mode Nitrogen is unlimited rather than prognosed and in general vegetation is -over-productive. - NONE = No vegetation types get supplemental Nitrogen - ALL = Supplemental Nitrogen is active for all vegetation types - - - -If TRUE, separate the vegetated landunit into a crop landunit and a natural vegetation landunit - - - -If TRUE, make ALL pfts, columns and landunits active, even those with 0 weight. -This means that computations will be run even over these 0-weight points. - -THIS IS ONLY FOR TESTING PURPOSES - IT HAS NOT BEEN CHECKED FOR SCIENTIFIC VALIDITY. - - - -If TRUE, square the organic fraction when it's used (as was done in CLM4.5) -Otherwise use the fraction straight up (the default for CLM5.0) - - - -10SL_3.5m = standard CLM4 and CLM4.5 version -23SL_3.5m = more vertical layers for permafrost simulations -49SL_10m = 49 layer soil column, 10m of soil, 5 bedrock layers -20SL_8.5m = 20 layer soil column, 8m of soil, 5 bedrock layers - - - -If TRUE, use variable soil depth. - -If present on surface dataset, use depth to bedrock information to -specify spatially variable soil thickness. If not present, use bottom -of soil column (nlevsoi). - - - -Index of rooting profile for water - -Changes rooting profile from Zeng 2001 double exponential (0) to -Jackson 1996 single exponential (1) to Koven uniform exponential (2). - - - -Index of rooting profile for carbon - -Changes rooting profile from Zeng 2001 double exponential (0) to -Jackson 1996 single exponential (1) to Koven uniform exponential (2). - - - -Index of rooting profile for soil carbon - -Changes rooting profile from Zeng 2001 double exponential (0) to -Jackson 1996 single exponential (1) to Koven uniform exponential (2). - - - -Variant index of rooting profile for water -(Currently only used for Jackson 1996 method) - - - -Variant index of rooting profile for carbon and soil carbon -(Currently only used for Jackson 1996 method) - - - -Index of rooting profile for carbon - -Changes rooting profile from Zeng 2001 double exponential (0) to -Jackson 1996 single exponential (1) to Koven uniform exponential (2). - - - -Index of evaporative resistance method. - -Changes soil evaporative resistance method from Sakaguchi and Zeng -2009 Beta function (0) to Swenson and Lawrence 2014 dry surface layer -formulation (1). - - - -Slope of free living Nitrogen fixation with annual ET - - - -Intercept of free living Nitrogen fixation with zero annual ET - - - -Fraction of intercepted precipitation - - - -If TRUE use clm5 equation for fraction of intercepted precipitation - - - -Maximum fraction of leaf that may be wet prior to drip occuring - - - -Index of solution method of Richards equation. - -Change method for richards equation solution and boundary -conditions. - -CLM 4.5 - soilwater_movement_method = 0 (Zeng and Decker, 2009, method). -CLM 5.0 - soilwater_movement_method = 1 (adaptive time stepping moisture form from Martyn Clark). - -1 (adaptive time stepping moisture form - - - -Index of upper boundary condition for Richards equation. - - - -Index of lower boundary condition for Richards equation. - -lower_boundary_condition = 1 : flux lower boundary condition (use with soilwater_movement_method=adaptive time stepping) -lower_boundary_condition = 2 : zero-flux lower boundary condition (use with soilwater_movement_method=adaptive time stepping) -lower_boundary_condition = 3 : water table head-based lower boundary condition w/ aquifer layer. (use with soilwater_movement_method=adaptive time stepping) -lower_boundary_condition = 4 : 11-layer solution w/ aquifer layer (only used with soilwater_movement_method=Zeng&Decker 2009) - -TODO(bja, 2015-09) these should be strings so they have meaningful names instead of ints. - - - -minimum time step length (seconds) for adaptive time stepping in richards equation - - -a very small number: used to check for sub step completion for adaptive time stepping in richards equation - - -tolerance to halve length of substep for adaptive time stepping in richards equation - - -tolerance to double length of substep for adaptive time stepping in richards equation - - - - - - - - - - - - -Minimum leaf area index for irrigation to occur - - - -Time of day to check whether we need irrigation, seconds (0 = midnight). -We start applying the irrigation in the time step FOLLOWING this time. - - - -Desired amount of time to irrigate per day (sec). -Actual time may differ if this is not a multiple of dtime. - - - -Target soil matric potential for irrigation (mm). -When we irrigate, we aim to bring the total soil moisture in the top (irrig_depth) m of soil up to this level. - - - -Soil depth to which we measure for irrigation (m) - - - -Determines soil moisture threshold at which we irrigate. -If h2osoi_liq_wilting_point is the soil moisture level at wilting point and -h2osoi_liq_target is the soil moisture level at the target irrigation level -(given by irrig_target_smp), then the threshold at which we irrigate is - h2osoi_liq_wilting_point + - irrig_threshold_fraction*(h2osoi_liq_target - h2osoi_liq_wilting_point) -A value of 1 means that we irrigate whenever soil moisture falls below the target. -A value of 0 means that we only irrigate when soil moisture falls below the wilting point. - - - -Threshold for river water volume below which irrigation is shut off (as a fraction of available river water), if limit_irrigation_if_rof_enabled is .true. -A threshold of 0 means allow all river water to be used; -a threshold of 0.1 means allow 90% of the river volume to be used; etc. - - - -If TRUE, limit irrigation when river storage drops below a threshold. -Only applies if using an active runoff (ROF) model; otherwise, river storage-based limitation -is turned off regardless of the setting of this namelist variable. - - - -If TRUE, irrigation will be active. - - - -Number of multiple elevation classes over glacier points. - - @@ -342,68 +95,6 @@ Allowed values are: Behavior of 'virtual' is required in the region where we have an ice sheet model - -Treatment of ice melt for each glacier region (GLACIER_REGION in surface dataset). -First item corresponds to GLACIER_REGION with ID 0 in the surface dataset, -second to GLACIER_REGION with ID 1, etc. -Allowed values are: -'replaced_by_ice': any melted ice runs off and is immediately replaced by solid ice; - this results in positive liquid runoff and negative ice runoff -'remains_in_place': any melted ice remains in place as liquid until it refreezes; - thus, ice melt does not result in any runoff -IMPORTANT NOTE: Regions with the 'remains_in_place' behavior also do not -compute SMB (because negative SMB would be pretty much meaningless in -those regions). Thus, you cannot use this behavior where GLC is -operating. -Regions with the 'replaced_by_ice' behavior also compute SMB for the -vegetated column. - - - -Treatment of ice runoff for each glacier region (GLACIER_REGION in surface dataset). -First item corresponds to GLACIER_REGION with ID 0 in the surface dataset, -second to GLACIER_REGION with ID 1, etc. -Allowed values are: -'remains_ice': ice runoff is sent to the river model as ice; this is a crude parameterization - of iceberg calving, and so is appropriate in regions where there is substantial iceberg calving - in reality -'melted': ice runoff generated by the CLM physics (primarily due to snow capping) is melted - (generating a negative sensible heat flux) and runs off as liquid; this is appropriate in - regions that have little iceberg calving in reality. This can be important to avoid unrealistic - cooling of the ocean and consequent runaway sea ice growth. -Only applies when melt_non_icesheet_ice_runoff is .true. - - - -Number of days before one considers the perennially snow-covered point 'land ice' -(and thus capable of generating a positive surface mass balance for the glacier model). -This is meant to compensate for the fact that, with small values of h2osno_max, -the onset of a snow-capped state (and thus conversion to land ice) can occur in an -unrealistically short amount of time. -Thus, in general, large values of h2osno_max should have glc_snow_persistence_max_days = 0; -small values of h2osno_max should have glc_snow_persistence_max_days > 0. - - - -Visible and Near-infrared albedo's for glacier ice - - - -Scalar of leaf respiration to vcmax - - - -baseline proportion of nitrogen allocated for electron transport (J) - - Time step (seconds) @@ -415,42 +106,6 @@ Override the start type from the driver: it can only be set to 3 meaning branch. - -Toggle to turn on the FATES model -(use_fates= '.true.' is EXPERIMENTAL NOT SUPPORTED!) - - - -Toggle to turn on the LUNA model, to effect Photosynthesis by leaf Nitrogen -LUNA operates on C3 and non-crop vegetation (see vcmax_opt for how other veg is handled) -LUNA: Leaf Utilization of Nitrogen for Assimilation - - - -Toggle to turn on the plant hydraulic stress model - - - -How LUNA and Photosynthesis (if needed) will get Leaf nitrogen content - lnc_opt = true get from leaf N from CN model - lnc_opt = false get based on LAI and fixed CN ratio from parameter file - - - -Full pathname datafile with plant function type (PFT) constants combined with -constants for biogeochem modules - - - -Full pathname datafile with fates parameters - - Full pathname of surface data file. @@ -590,553 +245,24 @@ Perturbation limit when doing error growth test If FALSE, don't write any restart files. - -Turn urban air conditioning/heating ON or OFF and add wasteheat: - OFF = Air conditioning/heating is OFF in buildings, internal temperature allowed to float freely - ON = Air conditioning/heating is ON in buildings, internal temperature constrained - ON_WASTEHEAT = Air conditioning/heating is ON and waste-heat sent to urban canyon - - - -If TRUE, urban traffic flux will be activated (Currently NOT implemented). - - - -0 = simpler method (clm4_5) -1 = prognostic calculation of interior building temp (clm5_0) - - If TRUE, write diagnostic of global radiative temperature written to CLM log file. - -Subgrid fluxes for snow - - - -Turn vegetation snow canopy ON, OFF, or ON with albedo influence (ON_RAD) - - - -Turn on methane model. Standard part of CLM45BGC model. - - - -CLM Biogeochemistry mode : Carbon Nitrogen model (CN) -(or CLM45BGC if phys=clm4_5, vsoilc_centbgc='on', and clm4me='on') - - - -Turn the Fixation and Uptate of Nitrogen model version 2 (FUN2.0) -Requires the CN model to work (either CN or CNDV). - - - -Nitrification/denitrification splits the prognostic mineral N pool into two - mineral N pools: NO3 and NH4, and includes the transformations between them. -Requires the CN model to work (either CN or CNDV). - - - -Turn on vertical soil carbon. -Requires the CN or FATES model to work (either CN or CNDV). - - - -Use parameters for decomposition from the CENTURY Carbon model -Requires the CN or FATES model to work (either CN or CNDV). - - - -Toggle to turn on the prognostic crop model - - - -Initial seed Carbon to use at planting -(only used when CN is on as well as crop) - Toggle to turn all history output completely OFF (possibly used for testing) - -Max number of plant functional types in naturally vegetated landunit. - - - -Toggle to turn on the dynamic root model - - - - - - -SCRIP format grid data file - - - -Flag to pass to the ESMF mapping utility, telling it what kind of large -file support is needed for an output file generated with this grid as -either the source or destination ('none', '64bit_offset' or 'netcdf4'). - - - -Flag to pass to the ESMF mapping utility, telling it what kind of grid -file this is (SCRIP or UGRID). - - - -For UGRID files, flag to pass to the ESMF mapping utility, telling it the -name of the dummy variable that has all of the topology information stored -in its attributes. (Only used if scripgriddata_src_type = UGRID.) - - - - - - -Filename for mksurfdata_map to remap raw data into the output surface dataset - - - -Plant Function Type dataset for mksurfdata - - - -Harvest dataset for mksurfdata - - - -Dataset for percent glacier land-unit for mksurfdata - - - -Dataset for glacier region ID for mksurfdata - - - -Dataset for topography used to define urban threshold - - - -Leaf Area Index dataset for mksurfdata - - - -Soil texture dataset for mksurfdata - - - -Soil color dataset for mksurfdata - - - -Soil max fraction dataset for mksurfdata - - - -High resolution land mask/fraction dataset for mksurfdata -(used for glacier_mec land-units) - - - -Type of grid to create for mksurfdata - - - -Grid file at the output resolution for mksurfdata - - - -Text file with filepaths (or list of XML elements) for vegetation fractions -and harvesting for each year to run over for mksurfdata to be able to model -transient land-use change - - - -High resolution topography dataset for mksurfdata -(used for glacier_mec land-units) - - - -Irrigation dataset for mksurfdata - - - -Organic soil dataset for mksurfdata - - - -Lake water dataset for mksurfdata - - - -Wetland dataset for mksurfdata - - - -Urban dataset for mksurfdata - - - -Biogenic Volatile Organic Compounds (VOC) emissions dataset for mksurfdata - - - -GDP dataset for mksurfdata - - - -Peat dataset for mksurfdata - - - -Soil depth dataset for mksurfdata - - - -Agricultural burning dominant month dataset for mksurfdata - - - -Topography statistics dataset for mksurfdata - - - -VIC parameters dataset for mksurfdata - - - -Inversion-derived CH4 parameters dataset for mksurfdata - - - -If TRUE, output variables in double precision for mksurfdata - - - -If TRUE, ignore other files, and set the output percentage to 100% urban and -zero for other land-use types. - - - -If TRUE, set wetland to 0% over land (renormalizing other landcover types as needed); -wetland will only be used for ocean points. - - - -Number of Plant Functional Types (excluding bare-soil) - - - -Plant Function Type index to override global file with for mksurfdata - - - -Plant Function Type fraction to override global file with for mksurfdata - - - -Soil color index to override global file with for mksurfdata - - - -Soil maximum fraction to override global file with for mksurfdata - - - -Soil percent sand to override global file with for mksurfdata - - - -Soil percent clay to override global file with for mksurfdata - - - - - - - -Orography file with surface heights and land area fraction - - - -CLM grid file - - - -CESM domain file - - - -CAM file - - - -Raw topography file - - - -CAM topography file - - - -Number of longitudes to use for a regional grid (for single-point set to 1) - - - -Number of latitudes to use for a regional grid (for single-point set to 1) - - - -Northern edge of the regional grid - - - -Southern edge of the regional grid - - - -Eastern edge of the regional grid - - - -Western edge of the regional grid - - - - - - - -Historical greenhouse gas concentrations from CAM, only used -by getco2_historical.ncl - - - - - - -Aerosol deposition file name (only used for aerdepregrid.ncl) - - - -Full pathname of CLM fraction dataset (only used for mkdatadomain). - - - -Full pathname of CLM grid dataset (only used for mkdatadomain). - - - -Full pathname of output domain dataset (only used for mkdatadomain). - - - -Type of domain file to create (ocean or atmosphere) (only used for mkdatadomain) - - - - - - - -If TRUE, repartition rain/snow from atmosphere based on temperature. - - - -If TRUE, downscale longwave radiation over glc_mec landunits. -This downscaling is conservative. -Default: .true. - - - -Surface temperature lapse rate (K m-1) -A positive value means a decrease in temperature with increasing height - - - -Longwave radiation lapse rate (W m-2 m-1) -A positive value means a decrease in LW radiation with increasing height -Only relevant if glcmec_downscale_longwave is .true. - - - -Relative limit for how much longwave downscaling can be done (unitless) -The pre-normalized, downscaled longwave is restricted to be in the range -[lwrad*(1-longwave_downscaling_limit), lwrad*(1+longwave_downscaling_limit)] -This parameter must be in the range [0,1] -Only relevant if glcmec_downscale_longwave is .true. - - - -Temperature below which all precipitation falls as snow, for glacier columns (deg C) -Only relevant if repartition_rain_snow is .true. - - - -Temperature above which all precipitation falls as rain, for glacier columns (deg C) -Only relevant if repartition_rain_snow is .true. - - - -Temperature below which all precipitation falls as snow, for non-glacier columns (deg C) -Only relevant if repartition_rain_snow is .true. - - - -Temperature above which all precipitation falls as rain, for non-glacier columns (deg C) -Only relevant if repartition_rain_snow is .true. - - - -If TRUE, ice runoff generated from non-glacier columns and glacier columns outside icesheet regions -is converted to liquid, with an appropriate sensible heat flux. -That is, the atmosphere (rather than the ocean) melts the ice. -(Exception: ice runoff generated to ensure conservation with dynamic landunits remains as ice.) - - - - - - - - -Toggle to turn on use of LAI streams in place of the LAI on the surface dataset when using Satellite Phenology mode. -(EXPERIMENTAL and NOT tested) - - - -First year to loop over for LAI data - - - -Last year to loop over for LAI data - - - -Simulation year that aligns with stream_year_first_lai value - - - -Filename of input stream data for LAI - - - -Mapping method from LAI input file to the model resolution - bilinear = bilinear interpolation - nn = nearest neighbor - nnoni = nearest neighbor on the "i" (longitude) axis - nnonj = nearest neighbor on the "j" (latitude) axis - spval = set to special value - copy = copy using the same indices - - datm input directory @@ -1176,19 +302,6 @@ Horizontal grid resolutions for mksurfdata input files - -Resolution of finundated inversion streams dataset (stream_fldfilename_ch4finundated) -to use for methane model -(only applies when CN and methane model are turned on) - - - -Resolution of Lightning dataset to use for CN fire model -(only applies when CN and the CN fire model are turned on) - - Check that the resolution and land-mask is valid before continuing. @@ -1213,7 +326,7 @@ CLM run type. +"512x1024,360x720cru,128x256,64x128,48x96,32x64,8x16,94x192,0.23x0.31,0.47x0.63,0.9x1.25,1.9x2.5,2.5x3.33,4x5,10x15,5x5_amazon,1x1_brazil,0.1x0.1,0.25x0.25,0.5x0.5,3x3min,5x5min,10x10min,0.33x0.33,0.125x0.125,ne4np4,ne16np4,ne30np4,ne60np4,ne120np4,ne240np4,1km-merge-10min"> Horizontal resolutions Note: 0.1x0.1, 0.25x0.25, 0.5x0.5, 5x5min, 10x10min, 3x3min and 0.33x0.33 are only used for CLM tools @@ -1240,11 +353,6 @@ the configuration of model version and atmospheric forcing. To run well constant to run with a different type of atmospheric forcing. - -If 1, turn on the MEGAN model for BVOC's (Biogenic Volitile Organic Compounds) - - @@ -1289,217 +397,6 @@ How close in years to use when looking for an initial condition file (finidat) i Simulation years you can look for in initial condition files (finidat) if interpolation is turned on (use_init_interp is .true.) - -Command line argument for setting up your simulation in a mode for faster -throughput. By default turns off some options, and sets up for a lower level -of output. When bgc_mode is some level of prognostic BGC (so NOT Satellite Phenology) -it also sets up for accelerated decomposition. -NOTE: THIS CORRESPONDS DIRECTLY TO THE env_run.xml VARIABLE OF THE SAME NAME. - Set the env_run variable, rather than setting this directly. - - - -Command line arguement for biogeochemistry mode for CLM4.5 - sp = Satellitte Phenology - cn = Carbon Nitrogen model - bgc = CLM4.5 BGC model with: - CENTURY model pools - Nitrification/De-nitrification - Methane model - Vertically resolved Carbon - fates = FATES/ED ecosystem demography model with below ground BGC: - - - - - - - -Flag for setting the state of the Accelerated decomposition spinup state for the BGC model. - 0 = normal model behavior; - 1 = AD spinup (standard) - 2 = AD spinup (accelerated spinup from Ricciuto, doesn't work for CNDV and not implemented for CN soil decomposition) -Entering and exiting spinup mode occurs automatically by comparing the namelist and restart file values for this variable. -NOTE: THIS CAN ONLY BE SET TO NON-ZERO WHEN BGC_MODE IS NOT SATELITE PHENOLOGY! - - - - -E-folding depth over which decomposition is slowed with depth in all soils. - - - -separate q10 for frozen soil respiration rates. default to same as above zero rates - - - - - - -Flag to reseed any dead plants on startup from reading the initial conditions file - - - -Flag to use the atmospheric time series of C14 concentrations from bomb fallout and Seuss effect, rather than natural abundance C14 (nominally set as 10^-12 mol C14 / mol C) -(EXPERIMENTAL and NOT tested) - - - -Filename with time series of atmospheric Delta C14 data. variables in file are "time" and "Delta14co2_in_air". time variable is in format: years since 1850-01-01 0:0:0.0 units are permil. -(EXPERIMENTAL and NOT tested) - - - -Flag to use the atmospheric time series of C13 concentrations from natural abundance and the Seuss Effect, rather than static values. -(EXPERIMENTAL and NOT tested) - - - -Filename with time series of atmospheric Delta C13 data, which use CMIP6 format. variables in file are "time" and "delta13co2_in_air". time variable is in format: years since 1850-01-01 0:0:0.0. units are permil. -(EXPERIMENTAL and NOT tested) - - - - - - - -If TRUE use additional stress deciduous onset trigger - - - -Apply the guardrail for leaf-Nitrogen that ensures it doesn't go negative or too small - - - - - - - -Allow the CN ratio to flexibly change with the simulation, rather than being fixed - - - - Michaelis Menten nitrogen uptake kinetics - - - -How much Carbon to initialize vegetation pools (leafc/frootc and storage) to when -- Michaelis Menten nitrogen uptake kinetics is on - - - - GPP downregulation for use_flexibleCN option -(EXPERIMENTAL and NOT tested) - - - - Plant nitrogen demand for use_flexibleCN option -(EXPERIMENTAL and NOT tested) - - - - Michaelis Menten substrate limitation for use_flexibleCN option -(EXPERIMENTAL and NOT tested) - - - - Michaelis Menten nitrogen limitation for use_flexibleCN option -(EXPERIMENTAL and NOT tested) - - - - Michaelis Menten temperature limitation for use_flexibleCN option -(EXPERIMENTAL and NOT tested) - - - - Flexible CN ratio used for Phenology -(EXPERIMENTAL and NOT tested) - - - - Reduce day length factor -(NOT implemented) - - - -Vcmax calculation for Photosynthesis - vcmax_opt = 4 As for vcmax_opt=0, but using leafN, and exponential if tree (EXPERIMENTAL NOT TESTED!) - vcmax_opt = 3 Based on leafN and VCAD (used with Luna for crop and C4 vegetation) - vcmax_opt = 0 Based on canopy top and foilage Nitrogen limitation factor from params file (clm4.5) -(EXPERIMENTAL and NOT tested) - - - -Residual option for flexible-CN -(EXPERIMENTAL and NOT tested) - - - -Partition option for flexible-CN - CN_partition_opt = 1 -(EXPERIMENTAL and NOT tested) - - - -Evergreen phenology option for CNPhenology -(EXPERIMENTAL and NOT tested) - - - -Carbon respiration option to burn off carbon when CN ratio is too high (do NOT use when FUN is on) -(EXPERIMENTAL and NOT tested) - - - - - - - -Use old snow cover fraction from Niu et al. 2007 -(deprecated -- will be removed) - - - -If surface water is active or not -(deprecated -- will be removed) - - - -Use original CLM4 soil hydraulic properties -(deprecated -- will be removed) - - @@ -1516,16 +413,6 @@ If TRUE (which is the default), check consistency between pct_pft on the finidat and pct_pft read from the surface dataset. This check is only done for a NON-transient run. - - - - - -If TRUE (which is the default), check consistency between pct_nat_pft on the flanduse_timeseries file -and pct_nat_pft read from the surface dataset. - - @@ -1536,125 +423,6 @@ Number of snow layers. Values less than 5 are mainly useful for testing, and should not be used for science. - -Maximum snow depth in mm H2O equivalent. Additional mass gains will be capped when this depth -is exceeded. -Changes in this value should possibly be accompanied by changes in: -- nlevsno: larger values of h2osno_max should be accompanied by increases in nlevsno -- glc_snow_persistence_max_days: large values of h2osno_max should generally have - glc_snow_persistence_max_days = 0; small values of h2osno_max should generally have - glc_snow_persistence_max_days > 0. - - - -Limit applied to integrated snowfall when determining changes in snow-covered fraction during melt -(mm H2O) - - - -SCA shape parameter for glc_mec (glacier multiple elevation class) columns -For most columns, n_melt is based on the standard deviation of 1km topography in the grid cell; -but glc_mec columns already account for subgrid topographic variability through their use of -multiple elevation classes; thus, to avoid double-accounting for topographic variability -in these columns, we use a fixed value of n_melt. - - - -If TRUE, the density of new snow depends on wind speed, and there is also -wind-dependent snow compaction. - - - -Method used to compute snow overburden compaction -Anderson1976 -- older method, default in CLM45 -Vionnet2012 --- newer method, default in CLM50 - - - -Snow density method to use for low temperatures (below -15C) -TruncatedAnderson1976 -- Truncate the Anderson-1976 equation at the value for -15C -Slater2017 ------------- Use equation from Slater that increases snow density for very cold temperatures (Arctic, Antarctic) - - - -Upper Limit on Destructive Metamorphism Compaction [kg/m3] - - - -Snow compaction overburden exponential factor (1/K) -Not used for snow_overburden_compaction_method=Vionnet2012 - - - -Minimum wind speed tht results in compaction (m/s) - - - -maximum warm (at freezing) fresh snow effective radius [microns] - - - -If set to .true., then reset the snow pack over non-glacier columns to a small value. -This is useful when transitioning from a spinup under one set of atmospheric forcings -to a run under a different set of atmospheric forcings: By resetting too-large snow packs, -we make it more likely that points will remain only seasonally snow-covered under the new -atmospheric forcings. (This is particularly true in a coupled run, where starting with a -too-large snow pack can cool the atmosphere, thus maintaining the too-large snow pack.) - -WARNING: Setting this to .true. will break water conservation for approximately the first -day of the new run. This is by design: The excess snow is completely removed from the system. - - - -If set to .true., then reset the snow pack over glacier columns to a small value. -This is useful when transitioning from a spinup under one set of atmospheric forcings -to a run under a different set of atmospheric forcings: By resetting too-large snow packs, -we make it more likely that points will remain only seasonally snow-covered under the new -atmospheric forcings. (This is particularly true in a coupled run, where starting with a -too-large snow pack can cool the atmosphere, thus maintaining the too-large snow pack.) - -See also reset_snow_glc_ela, which controls the elevation below which -glacier columns are reset. - -WARNING: Setting this to .true. will break water conservation for approximately the first -day of the new run. This is by design: The excess snow is completely removed from the system. - -WARNING: This variable is intended for short test runs, and generally -should not be used for scientific production runs. By resetting snow -below a given elevation, you risk forcing the system to evolve -differently in areas below and above reset_snow_glc_ela. - - - -Only relevant if reset_snow_glc is .true. - -When resetting snow pack over glacier columns, one can choose to do this over all glacier -columns, or only those below a certain elevation. A typical use case is to reset only those -columns that have a seasonal snow pack in the real world, i.e. SMB less than 0, also known as -the equilibrium line altitude (ELA). This parameter sets a single global ELA value. By -setting this parameter to a large value (i.e. 10000 m), all glacier columns will be reset. - -WARNING: This variable is intended for short test runs, and generally -should not be used for scientific production runs. By resetting snow -below a given elevation, you risk forcing the system to evolve -differently in areas below and above reset_snow_glc_ela. - - - diff --git a/bld/namelist_files/namelist_definition_drv.xml b/bld/namelist_files/namelist_definition_drv.xml index 493f2f2a01..4c3c4004c4 100644 --- a/bld/namelist_files/namelist_definition_drv.xml +++ b/bld/namelist_files/namelist_definition_drv.xml @@ -11,7 +11,6 @@ - diff --git a/cime_config/buildnml b/cime_config/buildnml index 77477cbdd0..173189afb3 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -44,7 +44,6 @@ def buildnml(case, caseroot, compname): clm_bldnml_opts = case.get_value("CLM_BLDNML_OPTS") clm_nml_use_case = case.get_value("CLM_NML_USE_CASE") clm_force_coldstart = case.get_value("CLM_FORCE_COLDSTART") - clm_accelerated_spinup = case.get_value("CLM_ACCELERATED_SPINUP") comp_glc = case.get_value("COMP_GLC") comp_atm = case.get_value("COMP_ATM") lnd_grid = case.get_value("LND_GRID") @@ -58,13 +57,8 @@ def buildnml(case, caseroot, compname): run_refcase = case.get_value("RUN_REFCASE") run_refdate = case.get_value("RUN_REFDATE") run_reftod = case.get_value("RUN_REFTOD") - glc_nec = case.get_value("GLC_NEC") mask = case.get_value("MASK_GRID") - - if ( clm_accelerated_spinup != "off" ): - expect(False, "CLM_ACCELERATED_SPINUP is not OFF -- SLIM can not use this!" ) - # ----------------------------------------------------- # Clear out old data # ----------------------------------------------------- @@ -202,11 +196,11 @@ def buildnml(case, caseroot, compname): command = ("%s -cimeroot %s -infile %s -csmdata %s -inputdata %s %s -namelist \"&clm_inparm start_ymd=%s/ \" " "%s %s -res %s -clm_start_type %s -envxml_dir %s -l_ncpl %s " - "-lnd_frac %s -glc_nec %s -co2_ppmv %s -co2_type %s -config %s " + "-lnd_frac %s -co2_ppmv %s -co2_type %s -config %s " "%s %s" %(cmd, _CIMEROOT, infile, din_loc_root, inputdata_file, ignore, start_ymd, clm_namelist_opts, usecase, lnd_grid, start_type, caseroot, lnd_ncpl, - lndfrac_file, glc_nec, ccsm_co2_ppmv, clm_co2_type, config_cache_file, + lndfrac_file, ccsm_co2_ppmv, clm_co2_type, config_cache_file, clm_bldnml_opts, gridmask)) rc, out, err = run_cmd(command, from_dir=clmconf) diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index ab8a8c9e51..b858907da8 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -14,10 +14,9 @@ - clm4.5: - clm5.0: - Satellite phenology: - BGC (vert. resol. CN and methane): + clm4.5: + clm5.0: + Satellite phenology: @@ -70,10 +69,7 @@ -bgc sp - -bgc bgc - -bgc sp - -bgc bgc run_component_clm env_run.xml @@ -86,8 +82,6 @@ constant diagnostic - diagnostic - prognostic diagnostic run_component_clm @@ -116,16 +110,6 @@ This is an advanced flag and should only be used by expert users. - - char - off - off - run_component_clm - env_run.xml - Turn on any settings for accellerating the model spinup. This is unused for SLIM! - - - char on,off diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml index 47d76184a1..a5373349cc 100644 --- a/cime_config/testdefs/testlist_clm.xml +++ b/cime_config/testdefs/testlist_clm.xml @@ -12,7 +12,7 @@ - + diff --git a/cime_config/testdefs/testmods_dirs/clm/2000_CMIP6_AMIP_1deg_ensemble/shell_commands b/cime_config/testdefs/testmods_dirs/clm/2000_CMIP6_AMIP_1deg_ensemble/shell_commands new file mode 100755 index 0000000000..5d3544865c --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/clm/2000_CMIP6_AMIP_1deg_ensemble/shell_commands @@ -0,0 +1,2 @@ +#!/bin/bash +./xmlchange CLM_FORCE_COLDSTART="on" diff --git a/cime_config/testdefs/testmods_dirs/clm/default/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/default/user_nl_clm index 82ac77de65..2efcc6c9bf 100644 --- a/cime_config/testdefs/testmods_dirs/clm/default/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/clm/default/user_nl_clm @@ -16,4 +16,4 @@ 'MML_diag1_1d', 'MML_diag2_1d', 'MML_diag3_1d', 'MML_diag1_2d', 'MML_diag2_2d', 'MML_diag3_2d', 'MML_q_excess', 'MML_lh_excess', 'MML_q_demand', 'MML_lh_demand', 'mml_err_h2o', 'mml_err_h2osno', 'mml_err_seb', 'mml_err_soi', 'mml_err_sol', 'WIND', - 'THBOT', 'RAIN', 'SNOW', 'RH' + 'RH' diff --git a/cime_config/user_nl_clm b/cime_config/user_nl_clm index b225eb1d00..9755f60435 100644 --- a/cime_config/user_nl_clm +++ b/cime_config/user_nl_clm @@ -11,6 +11,5 @@ ! (includes $inst_string for multi-ensemble cases) ! or with CLM_FORCE_COLDSTART to do a cold start ! or set it with an explicit filename here. -! Set maxpatch_glcmec with GLC_NEC option !---------------------------------------------------------------------------------- diff --git a/src/biogeochem/CNBalanceCheckMod.F90 b/src/biogeochem/CNBalanceCheckMod.F90 deleted file mode 100644 index f2811d290a..0000000000 --- a/src/biogeochem/CNBalanceCheckMod.F90 +++ /dev/null @@ -1,358 +0,0 @@ -module CNBalanceCheckMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module for carbon/nitrogen mass balance checking. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_varctl , only : iulog, use_nitrif_denitrif - use clm_time_manager , only : get_step_size - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use SoilBiogeochemNitrogenfluxType , only : soilbiogeochem_nitrogenflux_type - use SoilBiogeochemCarbonfluxType , only : soilbiogeochem_carbonflux_type - use ColumnType , only : col - use GridcellType , only : grc - use CNSharedParamsMod , only : use_fun - - ! - implicit none - private - ! - ! !PUBLIC TYPES: - type, public :: cn_balance_type - private - real(r8), pointer :: begcb_col(:) ! (gC/m2) carbon mass, beginning of time step - real(r8), pointer :: endcb_col(:) ! (gC/m2) carbon mass, end of time step - real(r8), pointer :: begnb_col(:) ! (gN/m2) nitrogen mass, beginning of time step - real(r8), pointer :: endnb_col(:) ! (gN/m2) nitrogen mass, end of time step - contains - procedure , public :: Init - procedure , public :: BeginCNBalance - procedure , public :: CBalanceCheck - procedure , public :: NBalanceCheck - procedure , private :: InitAllocate - end type cn_balance_type - ! - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine Init(this, bounds) - class(cn_balance_type) :: this - type(bounds_type) , intent(in) :: bounds - - call this%InitAllocate(bounds) - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - class(cn_balance_type) :: this - type(bounds_type) , intent(in) :: bounds - - integer :: begc, endc - - begc = bounds%begc; endc= bounds%endc - - allocate(this%begcb_col(begc:endc)) ; this%begcb_col(:) = nan - allocate(this%endcb_col(begc:endc)) ; this%endcb_col(:) = nan - allocate(this%begnb_col(begc:endc)) ; this%begnb_col(:) = nan - allocate(this%endnb_col(begc:endc)) ; this%endnb_col(:) = nan - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine BeginCNBalance(this, bounds, num_soilc, filter_soilc, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! Calculate beginning column-level carbon/nitrogen balance, for mass conservation check - ! - ! Should be called after the CN state summaries have been computed for this time step - ! (which should be after the dynamic landunit area updates and the associated filter - ! updates - i.e., using the new version of the filters) - ! - ! !ARGUMENTS: - class(cn_balance_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - integer :: fc,c - !----------------------------------------------------------------------- - - associate( & - col_begcb => this%begcb_col , & ! Output: [real(r8) (:)] (gC/m2) carbon mass, beginning of time step - col_begnb => this%begnb_col , & ! Output: [real(r8) (:)] (gN/m2) nitrogen mass, beginning of time step - totcolc => cnveg_carbonstate_inst%totc_col , & ! Input: [real(r8) (:)] (gC/m2) total column carbon, incl veg and cpool - totcoln => cnveg_nitrogenstate_inst%totn_col & ! Input: [real(r8) (:)] (gN/m2) total column nitrogen, incl veg - ) - - do fc = 1,num_soilc - c = filter_soilc(fc) - col_begcb(c) = totcolc(c) - col_begnb(c) = totcoln(c) - end do - - end associate - - end subroutine BeginCNBalance - - !----------------------------------------------------------------------- - subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & - soilbiogeochem_carbonflux_inst, cnveg_carbonflux_inst, cnveg_carbonstate_inst) - ! - ! !DESCRIPTION: - ! Perform carbon mass conservation check for column and patch - ! - ! !ARGUMENTS: - class(cn_balance_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(soilbiogeochem_carbonflux_type) , intent(in) :: soilbiogeochem_carbonflux_inst - type(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c,err_index ! indices - integer :: fc ! lake filter indices - logical :: err_found ! error flag - real(r8) :: dt ! radiation time step (seconds) - real(r8) :: col_cinputs - real(r8) :: col_coutputs - real(r8) :: col_errcb(bounds%begc:bounds%endc) - !----------------------------------------------------------------------- - - associate( & - col_begcb => this%begcb_col , & ! Input: [real(r8) (:) ] (gC/m2) carbon mass, beginning of time step - col_endcb => this%endcb_col , & ! Output: [real(r8) (:) ] (gC/m2) carbon mass, end of time step - wood_harvestc => cnveg_carbonflux_inst%wood_harvestc_col , & ! Input: [real(r8) (:) ] (gC/m2/s) wood harvest (to product pools) - grainc_to_cropprodc => cnveg_carbonflux_inst%grainc_to_cropprodc_col , & ! Input: [real(r8) (:) ] (gC/m2/s) grain C to 1-year crop product pool - gpp => cnveg_carbonflux_inst%gpp_col , & ! Input: [real(r8) (:) ] (gC/m2/s) gross primary production - er => cnveg_carbonflux_inst%er_col , & ! Input: [real(r8) (:) ] (gC/m2/s) total ecosystem respiration, autotrophic + heterotrophic - col_fire_closs => cnveg_carbonflux_inst%fire_closs_col , & ! Input: [real(r8) (:) ] (gC/m2/s) total column-level fire C loss - col_hrv_xsmrpool_to_atm => cnveg_carbonflux_inst%hrv_xsmrpool_to_atm_col , & ! Input: [real(r8) (:) ] (gC/m2/s) excess MR pool harvest mortality - - som_c_leached => soilbiogeochem_carbonflux_inst%som_c_leached_col , & ! Input: [real(r8) (:) ] (gC/m2/s) total SOM C loss from vertical transport - - totcolc => cnveg_carbonstate_inst%totc_col & ! Input: [real(r8) (:) ] (gC/m2) total column carbon, incl veg and cpool - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - err_found = .false. - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! calculate the total column-level carbon storage, for mass conservation check - col_endcb(c) = totcolc(c) - - ! calculate total column-level inputs - col_cinputs = gpp(c) - - ! calculate total column-level outputs - ! er = ar + hr, col_fire_closs includes patch-level fire losses - col_coutputs = er(c) + col_fire_closs(c) + col_hrv_xsmrpool_to_atm(c) - - ! Fluxes to product pools are included in column-level outputs: the product - ! pools are not included in totcolc, so are outside the system with respect to - ! these balance checks. (However, the dwt flux to product pools is NOT included, - ! since col_begcb is initialized after the dynamic area adjustments - i.e., - ! after the dwt term has already been taken out.) - col_coutputs = col_coutputs + & - wood_harvestc(c) + & - grainc_to_cropprodc(c) - - ! subtract leaching flux - col_coutputs = col_coutputs - som_c_leached(c) - - ! calculate the total column-level carbon balance error for this time step - col_errcb(c) = (col_cinputs - col_coutputs)*dt - & - (col_endcb(c) - col_begcb(c)) - - ! check for significant errors - if (abs(col_errcb(c)) > 1e-7_r8) then - err_found = .true. - err_index = c - end if - if (abs(col_errcb(c)) > 1e-8_r8) then - write(iulog,*) 'cbalance warning',c,col_errcb(c),col_endcb(c) - end if - - - - end do ! end of columns loop - - if (err_found) then - c = err_index - write(iulog,*)'column cbalance error = ', col_errcb(c), c - write(iulog,*)'Latdeg,Londeg=',grc%latdeg(col%gridcell(c)),grc%londeg(col%gridcell(c)) - write(iulog,*)'begcb = ',col_begcb(c) - write(iulog,*)'endcb = ',col_endcb(c) - write(iulog,*)'delta store = ',col_endcb(c)-col_begcb(c) - write(iulog,*)'--- Inputs ---' - write(iulog,*)'gpp = ',gpp(c)*dt - write(iulog,*)'--- Outputs ---' - write(iulog,*)'er = ',er(c)*dt - write(iulog,*)'col_fire_closs = ',col_fire_closs(c)*dt - write(iulog,*)'col_hrv_xsmrpool_to_atm = ',col_hrv_xsmrpool_to_atm(c)*dt - write(iulog,*)'wood_harvestc = ',wood_harvestc(c)*dt - write(iulog,*)'grainc_to_cropprodc = ',grainc_to_cropprodc(c)*dt - write(iulog,*)'-1*som_c_leached = ',som_c_leached(c)*dt - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - end associate - - end subroutine CBalanceCheck - - !----------------------------------------------------------------------- - subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & - soilbiogeochem_nitrogenflux_inst, cnveg_nitrogenflux_inst, cnveg_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! Perform nitrogen mass conservation check - ! - ! !USES: - use clm_varctl, only : use_crop - ! - ! !ARGUMENTS: - class(cn_balance_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc (:) ! filter for soil columns - type(soilbiogeochem_nitrogenflux_type) , intent(in) :: soilbiogeochem_nitrogenflux_inst - type(cnveg_nitrogenflux_type) , intent(in) :: cnveg_nitrogenflux_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c,err_index,j ! indices - integer :: fc ! lake filter indices - logical :: err_found ! error flag - real(r8):: dt ! radiation time step (seconds) - real(r8):: col_ninputs(bounds%begc:bounds%endc) - real(r8):: col_noutputs(bounds%begc:bounds%endc) - real(r8):: col_errnb(bounds%begc:bounds%endc) - !----------------------------------------------------------------------- - - associate( & - col_begnb => this%begnb_col , & ! Input: [real(r8) (:) ] (gN/m2) nitrogen mass, beginning of time step - col_endnb => this%endnb_col , & ! Output: [real(r8) (:) ] (gN/m2) nitrogen mass, end of time step - ndep_to_sminn => soilbiogeochem_nitrogenflux_inst%ndep_to_sminn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) atmospheric N deposition to soil mineral N - nfix_to_sminn => soilbiogeochem_nitrogenflux_inst%nfix_to_sminn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) symbiotic/asymbiotic N fixation to soil mineral N - ffix_to_sminn => soilbiogeochem_nitrogenflux_inst%ffix_to_sminn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) free living N fixation to soil mineral N - fert_to_sminn => soilbiogeochem_nitrogenflux_inst%fert_to_sminn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) - soyfixn_to_sminn => soilbiogeochem_nitrogenflux_inst%soyfixn_to_sminn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) - supplement_to_sminn => soilbiogeochem_nitrogenflux_inst%supplement_to_sminn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) supplemental N supply - denit => soilbiogeochem_nitrogenflux_inst%denit_col , & ! Input: [real(r8) (:) ] (gN/m2/s) total rate of denitrification - sminn_leached => soilbiogeochem_nitrogenflux_inst%sminn_leached_col , & ! Input: [real(r8) (:) ] (gN/m2/s) soil mineral N pool loss to leaching - smin_no3_leached => soilbiogeochem_nitrogenflux_inst%smin_no3_leached_col , & ! Input: [real(r8) (:) ] (gN/m2/s) soil mineral NO3 pool loss to leaching - smin_no3_runoff => soilbiogeochem_nitrogenflux_inst%smin_no3_runoff_col , & ! Input: [real(r8) (:) ] (gN/m2/s) soil mineral NO3 pool loss to runoff - f_n2o_nit => soilbiogeochem_nitrogenflux_inst%f_n2o_nit_col , & ! Input: [real(r8) (:) ] (gN/m2/s) flux of N2o from nitrification - som_n_leached => soilbiogeochem_nitrogenflux_inst%som_n_leached_col , & ! Input: [real(r8) (:) ] (gN/m2/s) total SOM N loss from vertical transport - - col_fire_nloss => cnveg_nitrogenflux_inst%fire_nloss_col , & ! Input: [real(r8) (:) ] (gN/m2/s) total column-level fire N loss - wood_harvestn => cnveg_nitrogenflux_inst%wood_harvestn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) wood harvest (to product pools) - grainn_to_cropprodn => cnveg_nitrogenflux_inst%grainn_to_cropprodn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) grain N to 1-year crop product pool - - totcoln => cnveg_nitrogenstate_inst%totn_col & ! Input: [real(r8) (:) ] (gN/m2) total column nitrogen, incl veg - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - err_found = .false. - do fc = 1,num_soilc - c=filter_soilc(fc) - - ! calculate the total column-level nitrogen storage, for mass conservation check - col_endnb(c) = totcoln(c) - - ! calculate total column-level inputs - col_ninputs(c) = ndep_to_sminn(c) + nfix_to_sminn(c) + supplement_to_sminn(c) - - if(use_fun)then - col_ninputs(c) = col_ninputs(c) + ffix_to_sminn(c) ! for FUN, free living fixation is a seprate flux. RF. - endif - - if (use_crop) then - col_ninputs(c) = col_ninputs(c) + fert_to_sminn(c) + soyfixn_to_sminn(c) - end if - - ! calculate total column-level outputs - col_noutputs(c) = denit(c) + col_fire_nloss(c) - - ! Fluxes to product pools are included in column-level outputs: the product - ! pools are not included in totcoln, so are outside the system with respect to - ! these balance checks. (However, the dwt flux to product pools is NOT included, - ! since col_begnb is initialized after the dynamic area adjustments - i.e., - ! after the dwt term has already been taken out.) - col_noutputs(c) = col_noutputs(c) + & - wood_harvestn(c) + & - grainn_to_cropprodn(c) - - if (.not. use_nitrif_denitrif) then - col_noutputs(c) = col_noutputs(c) + sminn_leached(c) - else - col_noutputs(c) = col_noutputs(c) + f_n2o_nit(c) - - col_noutputs(c) = col_noutputs(c) + smin_no3_leached(c) + smin_no3_runoff(c) - end if - - col_noutputs(c) = col_noutputs(c) - som_n_leached(c) - - ! calculate the total column-level nitrogen balance error for this time step - col_errnb(c) = (col_ninputs(c) - col_noutputs(c))*dt - & - (col_endnb(c) - col_begnb(c)) - - if (abs(col_errnb(c)) > 1e-3_r8) then - err_found = .true. - err_index = c - end if - - if (abs(col_errnb(c)) > 1e-7_r8) then - write(iulog,*) 'nbalance warning',c,col_errnb(c),col_endnb(c) - write(iulog,*)'inputs,ffix,nfix,ndep = ',ffix_to_sminn(c)*dt,nfix_to_sminn(c)*dt,ndep_to_sminn(c)*dt - write(iulog,*)'outputs,lch,roff,dnit = ',smin_no3_leached(c)*dt, smin_no3_runoff(c)*dt,f_n2o_nit(c)*dt - end if - - end do ! end of columns loop - - if (err_found) then - c = err_index - write(iulog,*)'column nbalance error = ',col_errnb(c), c - write(iulog,*)'Latdeg,Londeg = ',grc%latdeg(col%gridcell(c)),grc%londeg(col%gridcell(c)) - write(iulog,*)'begnb = ',col_begnb(c) - write(iulog,*)'endnb = ',col_endnb(c) - write(iulog,*)'delta store = ',col_endnb(c)-col_begnb(c) - write(iulog,*)'input mass = ',col_ninputs(c)*dt - write(iulog,*)'output mass = ',col_noutputs(c)*dt - write(iulog,*)'net flux = ',(col_ninputs(c)-col_noutputs(c))*dt - write(iulog,*)'inputs,ffix,nfix,ndep = ',ffix_to_sminn(c)*dt,nfix_to_sminn(c)*dt,ndep_to_sminn(c)*dt - write(iulog,*)'outputs,ffix,nfix,ndep = ',smin_no3_leached(c)*dt, smin_no3_runoff(c)*dt,f_n2o_nit(c)*dt - - - - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - end associate - - end subroutine NBalanceCheck - -end module CNBalanceCheckMod diff --git a/src/biogeochem/CNDVType.F90 b/src/biogeochem/CNDVType.F90 deleted file mode 100644 index daacd84574..0000000000 --- a/src/biogeochem/CNDVType.F90 +++ /dev/null @@ -1,519 +0,0 @@ -module CNDVType - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing routines to drive the annual dynamic vegetation - ! that works with CN, reset related variables, - ! and initialize/reset time invariant variables - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use decompMod , only : bounds_type - use clm_varctl , only : use_cndv, iulog - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC DATA TYPES: - ! - ! DGVM-specific ecophysiological constants structure (patch-level) - type, public :: dgv_ecophyscon_type - real(r8), pointer :: crownarea_max(:) ! patch tree maximum crown area [m2] - real(r8), pointer :: tcmin(:) ! patch minimum coldest monthly mean temperature [units?] - real(r8), pointer :: tcmax(:) ! patch maximum coldest monthly mean temperature [units?] - real(r8), pointer :: gddmin(:) ! patch minimum growing degree days (at or above 5 C) - real(r8), pointer :: twmax(:) ! patch upper limit of temperature of the warmest month [units?] - real(r8), pointer :: reinickerp(:) ! patch parameter in allometric equation - real(r8), pointer :: allom1(:) ! patch parameter in allometric - real(r8), pointer :: allom2(:) ! patch parameter in allometric - real(r8), pointer :: allom3(:) ! patch parameter in allometric - end type dgv_ecophyscon_type - type(dgv_ecophyscon_type), public :: dgv_ecophyscon - ! - ! DGVM state variables structure - type, public :: dgvs_type - real(r8), pointer, public :: agdd_patch (:) ! patch accumulated growing degree days above 5 - real(r8), pointer, public :: agddtw_patch (:) ! patch accumulated growing degree days above twmax - real(r8), pointer, public :: agdd20_patch (:) ! patch 20-yr running mean of agdd - real(r8), pointer, public :: tmomin20_patch (:) ! patch 20-yr running mean of tmomin - logical , pointer, public :: present_patch (:) ! patch whether PATCH present in patch - logical , pointer, public :: pftmayexist_patch (:) ! patch if .false. then exclude seasonal decid patches from tropics - real(r8), pointer, public :: nind_patch (:) ! patch number of individuals (#/m**2) - real(r8), pointer, public :: lm_ind_patch (:) ! patch individual leaf mass - real(r8), pointer, public :: lai_ind_patch (:) ! patch LAI per individual - real(r8), pointer, public :: fpcinc_patch (:) ! patch foliar projective cover increment (fraction) - real(r8), pointer, public :: fpcgrid_patch (:) ! patch foliar projective cover on gridcell (fraction) - real(r8), pointer, public :: fpcgridold_patch (:) ! patch last yr's fpcgrid - real(r8), pointer, public :: crownarea_patch (:) ! patch area that each individual tree takes up (m^2) - real(r8), pointer, public :: greffic_patch (:) - real(r8), pointer, public :: heatstress_patch (:) - - contains - - procedure , public :: Init - procedure , public :: Restart - procedure , public :: InitAccBuffer - procedure , public :: InitAccVars - procedure , public :: UpdateAccVars - procedure , private :: InitAllocate - procedure , private :: InitCold - procedure , private :: InitHistory - end type dgvs_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(dgvs_type) :: this - type(bounds_type), intent(in) :: bounds - - ! Note - need allocation so that associate statements can be used - ! at run time for NAG (allocation of variables is needed) - history - ! should only be initialized if use_cndv is true - - call this%InitAllocate (bounds) - - if (use_cndv) then - call this%InitCold (bounds) - call this%InitHistory (bounds) - end if - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : numpft - use pftconMod , only : allom1s, allom2s, allom1, allom2, allom3, reinickerp - use pftconMod , only : ntree, nbrdlf_dcd_brl_shrub - use pftconMod , only : pftcon - ! - ! !ARGUMENTS: - class(dgvs_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: m - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - allocate(this%agdd_patch (begp:endp)) ; this%agdd_patch (:) = nan - allocate(this%agddtw_patch (begp:endp)) ; this%agddtw_patch (:) = nan - allocate(this%agdd20_patch (begp:endp)) ; this%agdd20_patch (:) = nan - allocate(this%tmomin20_patch (begp:endp)) ; this%tmomin20_patch (:) = nan - allocate(this%present_patch (begp:endp)) ; this%present_patch (:) = .false. - allocate(this%pftmayexist_patch (begp:endp)) ; this%pftmayexist_patch (:) = .true. - allocate(this%nind_patch (begp:endp)) ; this%nind_patch (:) = nan - allocate(this%lm_ind_patch (begp:endp)) ; this%lm_ind_patch (:) = nan - allocate(this%lai_ind_patch (begp:endp)) ; this%lai_ind_patch (:) = nan - allocate(this%fpcinc_patch (begp:endp)) ; this%fpcinc_patch (:) = nan - allocate(this%fpcgrid_patch (begp:endp)) ; this%fpcgrid_patch (:) = nan - allocate(this%fpcgridold_patch (begp:endp)) ; this%fpcgridold_patch (:) = nan - allocate(this%crownarea_patch (begp:endp)) ; this%crownarea_patch (:) = nan - allocate(this%greffic_patch (begp:endp)) ; this%greffic_patch (:) = nan - allocate(this%heatstress_patch (begp:endp)) ; this%heatstress_patch (:) = nan - - allocate(dgv_ecophyscon%crownarea_max (0:numpft)) - allocate(dgv_ecophyscon%tcmin (0:numpft)) - allocate(dgv_ecophyscon%tcmax (0:numpft)) - allocate(dgv_ecophyscon%gddmin (0:numpft)) - allocate(dgv_ecophyscon%twmax (0:numpft)) - allocate(dgv_ecophyscon%reinickerp (0:numpft)) - allocate(dgv_ecophyscon%allom1 (0:numpft)) - allocate(dgv_ecophyscon%allom2 (0:numpft)) - allocate(dgv_ecophyscon%allom3 (0:numpft)) - - do m = 0,numpft - dgv_ecophyscon%crownarea_max(m) = pftcon%pftpar20(m) - dgv_ecophyscon%tcmin(m) = pftcon%pftpar28(m) - dgv_ecophyscon%tcmax(m) = pftcon%pftpar29(m) - dgv_ecophyscon%gddmin(m) = pftcon%pftpar30(m) - dgv_ecophyscon%twmax(m) = pftcon%pftpar31(m) - dgv_ecophyscon%reinickerp(m) = reinickerp - dgv_ecophyscon%allom1(m) = allom1 - dgv_ecophyscon%allom2(m) = allom2 - dgv_ecophyscon%allom3(m) = allom3 - ! modification for shrubs by X.D.Z - if (m > ntree .and. m <= nbrdlf_dcd_brl_shrub ) then - dgv_ecophyscon%allom1(m) = allom1s - dgv_ecophyscon%allom2(m) = allom2s - end if - end do - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ - use decompMod , only : bounds_type - ! - ! !ARGUMENTS: - class(dgvs_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p ! patch index - !----------------------------------------------------------------------- - - do p = bounds%begp,bounds%endp - this%present_patch(p) = .false. - this%crownarea_patch(p) = 0._r8 - this%nind_patch(p) = 0._r8 - this%agdd20_patch(p) = 0._r8 - this%tmomin20_patch(p) = SHR_CONST_TKFRZ - 5._r8 !initialize this way for Phenology code - end do - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize history variables - ! - ! !USES: - use histFileMod, only : hist_addfld1d - ! - ! !ARGUMENTS: - class(dgvs_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'InitHistory' - !----------------------------------------------------------------------- - - call hist_addfld1d (fname='AGDD', units='K', & - avgflag='A', long_name='growing degree-days base 5C', & - ptr_patch=this%agdd_patch, default='inactive') - - end subroutine InitHistory - - - !----------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag) - ! - ! !DESCRIPTION: - ! Read/Write module information to/from restart file. - ! - ! !USES: - use clm_varcon , only : spval - use spmdMod , only : masterproc - use decompMod , only : get_proc_global - use restUtilMod - use ncdio_pio - use pio - ! - ! !ARGUMENTS: - class(dgvs_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: j,c,p ! indices - logical :: readvar ! determine if variable is on initial file - logical :: do_io ! whether to do i/o for the given variable - integer :: nump_global ! total number of patches, globally - integer :: dimlen ! dimension length - integer :: ier ! error status - integer :: itemp ! temporary - integer , pointer :: iptemp(:) ! pointer to memory to be allocated - integer :: err_code ! error code - !----------------------------------------------------------------------- - - ! Get expected total number of points, for later error checks - call get_proc_global(np=nump_global) - - call restartvar(ncid=ncid, flag=flag, varname='CROWNAREA', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%crownarea_patch) - - call restartvar(ncid=ncid, flag=flag, varname='nind', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%nind_patch) - - call restartvar(ncid=ncid, flag=flag, varname='fpcgrid', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fpcgrid_patch) - - call restartvar(ncid=ncid, flag=flag, varname='fpcgridold', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fpcgridold_patch) - - ! tmomin20 - do_io = .true. - if (flag == 'read') then - ! On a read, confirm that this variable has the expected size; if not, don't - ! read it (instead leave it at its arbitrary initial value). This is needed to - ! support older initial conditions for which this variable had a different size. - call ncd_inqvdlen(ncid, 'TMOMIN20', 1, dimlen, err_code) - if (dimlen /= nump_global) then - do_io = .false. - end if - end if - if (do_io) then - call restartvar(ncid=ncid, flag=flag, varname='TMOMIN20', xtype=ncd_double, & - dim1name='pft', & - long_name='',units='', & - interpinic_flag='interp', readvar=readvar, data=this%tmomin20_patch) - end if - - ! agdd20 - do_io = .true. - if (flag == 'read') then - ! On a read, confirm that this variable has the expected size; if not, don't - ! read it (instead leave it at its arbitrary initial value). This is needed to - ! support older initial conditions for which this variable had a different size. - call ncd_inqvdlen(ncid, 'AGDD20', 1, dimlen, err_code) - if (dimlen /= nump_global) then - do_io = .false. - end if - end if - if (do_io) then - call restartvar(ncid=ncid, flag=flag, varname='AGDD20', xtype=ncd_double, & - dim1name='pft',& - long_name='',units='', & - interpinic_flag='interp', readvar=readvar, data=this%agdd20_patch) - end if - - ! present - if (flag == 'read' .or. flag == 'write') then - allocate (iptemp(bounds%begp:bounds%endp), stat=ier) - end if - if (flag == 'write') then - do p = bounds%begp,bounds%endp - iptemp(p) = 0 - if (this%present_patch(p)) iptemp(p) = 1 - end do - end if - call restartvar(ncid=ncid, flag=flag, varname='present', xtype=ncd_int, & - dim1name='pft',& - long_name='',units='', & - interpinic_flag='interp', readvar=readvar, data=iptemp) - if (flag=='read' .and. readvar) then - do p = bounds%begp,bounds%endp - this%present_patch(p) = .false. - if (iptemp(p) == 1) this%present_patch(p) = .true. - end do - end if - if (flag == 'read' .or. flag == 'write') then - deallocate (iptemp) - end if - - call restartvar(ncid=ncid, flag=flag, varname='heatstress', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%heatstress_patch) - - call restartvar(ncid=ncid, flag=flag, varname='greffic', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%greffic_patch) - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine InitAccBuffer (this, bounds) - ! - ! !DESCRIPTION: - ! Initialize accumulation buffer for all required module accumulated fields - ! This routine set defaults values that are then overwritten by the - ! restart file for restart or branch runs - ! Each interval and accumulation type is unique to each field processed. - ! Routine [initAccBuffer] defines the fields to be processed - ! and the type of accumulation. - ! Routine [updateCNDVAccVars] does the actual accumulation for a given field. - ! Fields are accumulated by calls to subroutine [update_accum_field]. - ! To accumulate a field, it must first be defined in subroutine [initAccVars] - ! and then accumulated by calls to [updateCNDVAccVars]. - ! - ! This should only be called if use_cndv is true. - ! - ! !USES - use accumulMod , only : init_accum_field - ! - ! !ARGUMENTS: - class(dgvs_type) :: this - type(bounds_type), intent(in) :: bounds - - ! - ! !LOCAL VARIABLES: - integer, parameter :: not_used = huge(1) - - !--------------------------------------------------------------------- - - ! The following are accumulated fields. - ! These types of fields are accumulated until a trigger value resets - ! the accumulation to zero (see subroutine update_accum_field). - ! Hence, [accper] is not valid. - - call init_accum_field (name='AGDDTW', units='K', & - desc='growing degree-days base twmax', accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field (name='AGDD', units='K', & - desc='growing degree-days base 5C', accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - end subroutine InitAccBuffer - - !----------------------------------------------------------------------- - subroutine InitAccVars(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module variables that are associated with - ! time accumulated fields. This routine is called for both an initial run - ! and a restart run (and must therefore must be called after the restart file - ! is read in and the accumulation buffer is obtained) - ! - ! This should only be called if use_cndv is true. - ! - ! !USES - use accumulMod , only : extract_accum_field - use clm_time_manager , only : get_nstep - ! - ! !ARGUMENTS: - class(dgvs_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: nstep - integer :: ier ! error status - real(r8), pointer :: rbufslp(:) ! temporary - - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - ! Allocate needed dynamic memory for single level patch field - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)' in ' - call endrun(msg=" allocation error for rbufslp"//& - errMsg(sourcefile, __LINE__)) - endif - - nstep = get_nstep() - - call extract_accum_field ('AGDDTW', rbufslp, nstep) - this%agddtw_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('AGDD', rbufslp, nstep) - this%agdd_patch(begp:endp) = rbufslp(begp:endp) - - deallocate(rbufslp) - - end subroutine InitAccVars - - !----------------------------------------------------------------------- - subroutine UpdateAccVars(this, bounds, t_a10_patch, t_ref2m_patch) - ! - ! !DESCRIPTION: - ! Update accumulated variables. Should be called every time step. - ! - ! This should only be called if use_cndv is true. - ! - ! !USES: - use shr_const_mod , only : SHR_CONST_CDAY, SHR_CONST_TKFRZ - use clm_time_manager , only : get_step_size, get_nstep, get_curr_date - use pftconMod , only : ndllf_dcd_brl_tree - use accumulMod , only : update_accum_field, extract_accum_field, accumResetVal - ! - ! !ARGUMENTS: - class(dgvs_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - ! COMPILER_BUG(wjs, 2014-11-30, pgi 14.7) These arrays get resized to 0 when running - ! with threading with pgi 14.7 on yellowstone. My standard workarounds weren't - ! working; the only thing that I can find that works is to change them to pointers -! real(r8) , intent(in) :: t_a10_patch( bounds%begp:) ! 10-day running mean of the 2 m temperature (K) -! real(r8) , intent(in) :: t_ref2m_patch( bounds%begp:) ! 2 m height surface air temperature (K) - real(r8), pointer , intent(in) :: t_a10_patch(:) ! 10-day running mean of the 2 m temperature (K) - real(r8), pointer , intent(in) :: t_ref2m_patch(:) ! 2 m height surface air temperature (K) - ! - ! !LOCAL VARIABLES: - integer :: p ! index - integer :: ier ! error status - integer :: dtime ! timestep size [seconds] - integer :: nstep ! timestep number - integer :: year ! year (0, ...) for nstep - integer :: month ! month (1, ..., 12) for nstep - integer :: day ! day of month (1, ..., 31) for nstep - integer :: secs ! seconds into current date for nstep - integer :: begp, endp - real(r8), pointer :: rbufslp(:) ! temporary single level - patch level - !----------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(t_a10_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_ref2m_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - - dtime = get_step_size() - nstep = get_nstep() - call get_curr_date (year, month, day, secs) - - ! Allocate needed dynamic memory for single level patch field - - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)'update_accum_hist allocation error for rbuf1dp' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - - ! Accumulate growing degree days based on 10-day running mean temperature. - ! The trigger to reset the accumulated values to zero is -99999. - - ! Accumulate and extract AGDDTW (gdd base twmax, which is 23 deg C - ! for boreal woody patches) - - do p = begp,endp - rbufslp(p) = max(0._r8, & - (t_a10_patch(p) - SHR_CONST_TKFRZ - dgv_ecophyscon%twmax(ndllf_dcd_brl_tree)) & - * dtime/SHR_CONST_CDAY) - if (month==1 .and. day==1 .and. secs==int(dtime)) rbufslp(p) = accumResetVal - end do - call update_accum_field ('AGDDTW', rbufslp, nstep) - call extract_accum_field ('AGDDTW', this%agddtw_patch, nstep) - - ! Accumulate and extract AGDD - - do p = begp,endp - rbufslp(p) = max(0.0_r8, & - (t_ref2m_patch(p) - (SHR_CONST_TKFRZ + 5.0_r8)) * dtime/SHR_CONST_CDAY) - ! - ! Fix (for bug 1858) from Sam Levis to reset the annual AGDD variable - ! - if (month==1 .and. day==1 .and. secs==int(dtime)) rbufslp(p) = accumResetVal - end do - call update_accum_field ('AGDD', rbufslp, nstep) - call extract_accum_field ('AGDD', this%agdd_patch, nstep) - - deallocate(rbufslp) - - end subroutine UpdateAccVars - -end module CNDVType diff --git a/src/biogeochem/CNDriverMod.F90 b/src/biogeochem/CNDriverMod.F90 deleted file mode 100644 index ea3abb5c6c..0000000000 --- a/src/biogeochem/CNDriverMod.F90 +++ /dev/null @@ -1,37 +0,0 @@ -module CNDriverMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Ecosystem dynamics: phenology, vegetation - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use perf_mod , only : t_startf, t_stopf - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: CNDriverInit ! Ecosystem dynamics: initialization - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CNDriverInit(bounds, NLFilename) - ! - ! !DESCRIPTION: - ! Initialzation of the CN Ecosystem dynamics. - ! - ! !USES: - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - character(len=*) , intent(in) :: NLFilename ! Namelist filename - !----------------------------------------------------------------------- - - end subroutine CNDriverInit - -end module CNDriverMod diff --git a/src/biogeochem/CNGapMortalityMod.F90 b/src/biogeochem/CNGapMortalityMod.F90 deleted file mode 100644 index a2f8c4fd89..0000000000 --- a/src/biogeochem/CNGapMortalityMod.F90 +++ /dev/null @@ -1,493 +0,0 @@ -module CNGapMortalityMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module holding routines used in gap mortality for coupled carbon - ! nitrogen code. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - use pftconMod , only : pftcon - use CNDVType , only : dgvs_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use CanopyStateType , only : canopystate_type - use ColumnType , only : col - use PatchType , only : patch - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: readParams - public :: CNGapMortality - - type, private :: params_type - real(r8):: am ! mortality rate based on annual rate, fractional mortality (1/yr) - real(r8):: k_mort ! coeff. of growth efficiency in mortality equation - end type params_type - ! - type(params_type), private :: params_inst - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: CNGap_PatchToColumn - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !DESCRIPTION: - ! Read in parameters - ! - ! !USES: - use ncdio_pio , only : file_desc_t,ncd_io - ! - ! !ARGUMENTS: - implicit none - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNGapMortParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - tString='r_mort' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%am=tempr - - tString='k_mort' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_mort=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine CNGapMortality (bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - dgvs_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, & - cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, canopystate_inst, & - leaf_prof_patch, froot_prof_patch, croot_prof_patch, stem_prof_patch) - ! - ! !DESCRIPTION: - ! Gap-phase mortality routine for coupled carbon-nitrogen code (CN) - ! - ! !USES: - use clm_time_manager , only: get_days_per_year - use clm_varpar , only: nlevdecomp_full - use clm_varcon , only: secspday - use clm_varctl , only: use_cndv, spinup_state - use pftconMod , only: npcropmin - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! column filter for soil points - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! patch filter for soil points - type(dgvs_type) , intent(inout) :: dgvs_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(canopystate_type) , intent(in) :: canopystate_inst - real(r8) , intent(in) :: leaf_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: froot_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: croot_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: stem_prof_patch(bounds%begp:,1:) - ! - ! !LOCAL VARIABLES: - integer :: p ! patch index - integer :: fp ! patch filter index - real(r8):: am ! rate for fractional mortality (1/yr) - real(r8):: m ! rate for fractional mortality (1/s) - real(r8):: mort_max ! asymptotic max mortality rate (/yr) - real(r8):: k_mort = 0.3 ! coeff of growth efficiency in mortality equation - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(leaf_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(froot_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(croot_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(stem_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform - - greffic => dgvs_inst%greffic_patch , & ! Input: [real(r8) (:) ] - heatstress => dgvs_inst%heatstress_patch , & ! Input: [real(r8) (:) ] - - leafcn => pftcon%leafcn , & ! Input: [real(r8) (:)] leaf C:N (gC/gN) - frootcn => pftcon%frootcn , & ! Input: [real(r8) (:)] fine root C:N (gC/gN) - livewdcn => pftcon%livewdcn , & ! Input: [real(r8) (:)] live wood (phloem and ray parenchyma) C:N (gC/gN) - laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit projected leaf area index - laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded projected leaf area index - - nind => dgvs_inst%nind_patch & ! Output: [real(r8) (:) ] number of individuals (#/m2) added by F. Li and S. Levis - ) - - ! set the mortality rate based on annual rate - am = params_inst%am - ! set coeff of growth efficiency in mortality equation - k_mort = params_inst%k_mort - - ! patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - if (use_cndv) then - ! Stress mortality from lpj's subr Mortality. - - if (woody(ivt(p)) == 1._r8) then - - if (ivt(p) == 8) then - mort_max = 0.03_r8 ! BDT boreal - else - mort_max = 0.01_r8 ! original value for all patches - end if - - ! heatstress and greffic calculated in Establishment once/yr - - ! Mortality rate inversely related to growth efficiency - ! (Prentice et al 1993) - am = mort_max / (1._r8 + k_mort * greffic(p)) - - ! Mortality rate inversely related to growth efficiency - ! (Prentice et al 1993) - am = mort_max / (1._r8 + k_mort * greffic(p)) - - am = min(1._r8, am + heatstress(p)) - else ! lpj didn't set this for grasses; cn does - ! set the mortality rate based on annual rate - am = params_inst%am - end if - - end if - - m = am/(get_days_per_year() * secspday) - - !------------------------------------------------------ - ! patch-level gap mortality carbon fluxes - !------------------------------------------------------ - - ! displayed pools - cnveg_carbonflux_inst%m_leafc_to_litter_patch(p) = cnveg_carbonstate_inst%leafc_patch(p) * m - cnveg_carbonflux_inst%m_frootc_to_litter_patch(p) = cnveg_carbonstate_inst%frootc_patch(p) * m - cnveg_carbonflux_inst%m_livestemc_to_litter_patch(p) = cnveg_carbonstate_inst%livestemc_patch(p) * m - cnveg_carbonflux_inst%m_livecrootc_to_litter_patch(p) = cnveg_carbonstate_inst%livecrootc_patch(p) * m - if (spinup_state == 2 .and. .not. use_cndv) then !accelerate mortality of dead woody pools - cnveg_carbonflux_inst%m_deadstemc_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_patch(p) * m * 10._r8 - cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m * 10._r8 - else - cnveg_carbonflux_inst%m_deadstemc_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_patch(p) * m - cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m - end if - - ! storage pools - cnveg_carbonflux_inst%m_leafc_storage_to_litter_patch(p) = cnveg_carbonstate_inst%leafc_storage_patch(p) * m - cnveg_carbonflux_inst%m_frootc_storage_to_litter_patch(p) = cnveg_carbonstate_inst%frootc_storage_patch(p) * m - cnveg_carbonflux_inst%m_livestemc_storage_to_litter_patch(p) = cnveg_carbonstate_inst%livestemc_storage_patch(p) * m - cnveg_carbonflux_inst%m_deadstemc_storage_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_storage_patch(p) * m - cnveg_carbonflux_inst%m_livecrootc_storage_to_litter_patch(p) = cnveg_carbonstate_inst%livecrootc_storage_patch(p) * m - cnveg_carbonflux_inst%m_deadcrootc_storage_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_storage_patch(p) * m - cnveg_carbonflux_inst%m_gresp_storage_to_litter_patch(p) = cnveg_carbonstate_inst%gresp_storage_patch(p) * m - - ! transfer pools - cnveg_carbonflux_inst%m_leafc_xfer_to_litter_patch(p) = cnveg_carbonstate_inst%leafc_xfer_patch(p) * m - cnveg_carbonflux_inst%m_frootc_xfer_to_litter_patch(p) = cnveg_carbonstate_inst%frootc_xfer_patch(p) * m - cnveg_carbonflux_inst%m_livestemc_xfer_to_litter_patch(p) = cnveg_carbonstate_inst%livestemc_xfer_patch(p) * m - cnveg_carbonflux_inst%m_deadstemc_xfer_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_xfer_patch(p) * m - cnveg_carbonflux_inst%m_livecrootc_xfer_to_litter_patch(p) = cnveg_carbonstate_inst%livecrootc_xfer_patch(p) * m - cnveg_carbonflux_inst%m_deadcrootc_xfer_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_xfer_patch(p) * m - cnveg_carbonflux_inst%m_gresp_xfer_to_litter_patch(p) = cnveg_carbonstate_inst%gresp_xfer_patch(p) * m - - !------------------------------------------------------ - ! patch-level gap mortality nitrogen fluxes - !------------------------------------------------------ - - ! displayed pools - cnveg_nitrogenflux_inst%m_leafn_to_litter_patch(p) = cnveg_nitrogenstate_inst%leafn_patch(p) * m - cnveg_nitrogenflux_inst%m_frootn_to_litter_patch(p) = cnveg_nitrogenstate_inst%frootn_patch(p) * m - cnveg_nitrogenflux_inst%m_livestemn_to_litter_patch(p) = cnveg_nitrogenstate_inst%livestemn_patch(p) * m - cnveg_nitrogenflux_inst%m_livecrootn_to_litter_patch(p) = cnveg_nitrogenstate_inst%livecrootn_patch(p) * m - - if (spinup_state == 2 .and. .not. use_cndv) then !accelerate mortality of dead woody pools - cnveg_nitrogenflux_inst%m_deadstemn_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadstemn_patch(p) * m * 10._r8 - cnveg_nitrogenflux_inst%m_deadcrootn_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadcrootn_patch(p) * m * 10._r8 - else - cnveg_nitrogenflux_inst%m_deadstemn_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadstemn_patch(p) * m - cnveg_nitrogenflux_inst%m_deadcrootn_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadcrootn_patch(p) * m - end if - - if (ivt(p) < npcropmin) then - cnveg_nitrogenflux_inst%m_retransn_to_litter_patch(p) = cnveg_nitrogenstate_inst%retransn_patch(p) * m - end if - - ! storage pools - cnveg_nitrogenflux_inst%m_leafn_storage_to_litter_patch(p) = cnveg_nitrogenstate_inst%leafn_storage_patch(p) * m - cnveg_nitrogenflux_inst%m_frootn_storage_to_litter_patch(p) = cnveg_nitrogenstate_inst%frootn_storage_patch(p) * m - cnveg_nitrogenflux_inst%m_livestemn_storage_to_litter_patch(p) = cnveg_nitrogenstate_inst%livestemn_storage_patch(p) * m - cnveg_nitrogenflux_inst%m_deadstemn_storage_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadstemn_storage_patch(p) * m - cnveg_nitrogenflux_inst%m_livecrootn_storage_to_litter_patch(p) = cnveg_nitrogenstate_inst%livecrootn_storage_patch(p) * m - cnveg_nitrogenflux_inst%m_deadcrootn_storage_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadcrootn_storage_patch(p) * m - - ! transfer pools - cnveg_nitrogenflux_inst%m_leafn_xfer_to_litter_patch(p) = cnveg_nitrogenstate_inst%leafn_xfer_patch(p) * m - cnveg_nitrogenflux_inst%m_frootn_xfer_to_litter_patch(p) = cnveg_nitrogenstate_inst%frootn_xfer_patch(p) * m - cnveg_nitrogenflux_inst%m_livestemn_xfer_to_litter_patch(p) = cnveg_nitrogenstate_inst%livestemn_xfer_patch(p) * m - cnveg_nitrogenflux_inst%m_deadstemn_xfer_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadstemn_xfer_patch(p) * m - cnveg_nitrogenflux_inst%m_livecrootn_xfer_to_litter_patch(p) = cnveg_nitrogenstate_inst%livecrootn_xfer_patch(p) * m - cnveg_nitrogenflux_inst%m_deadcrootn_xfer_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadcrootn_xfer_patch(p) * m - - ! added by F. Li and S. Levis - if (use_cndv) then - if (woody(ivt(p)) == 1._r8)then - if (cnveg_carbonstate_inst%livestemc_patch(p) + cnveg_carbonstate_inst%deadstemc_patch(p)> 0._r8)then - nind(p)=nind(p)*(1._r8-m) - else - nind(p) = 0._r8 - end if - end if - end if - - end do ! end of patch loop - - ! gather all patch-level litterfall fluxes to the column - ! for litter C and N inputs - - call CNGap_PatchToColumn(bounds, num_soilc, filter_soilc, & - cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, & - leaf_prof_patch(bounds%begp:bounds%endp, 1:nlevdecomp_full), & - froot_prof_patch(bounds%begp:bounds%endp, 1:nlevdecomp_full), & - croot_prof_patch(bounds%begp:bounds%endp, 1:nlevdecomp_full), & - stem_prof_patch(bounds%begp:bounds%endp, 1:nlevdecomp_full)) - - end associate - - end subroutine CNGapMortality - - !----------------------------------------------------------------------- - subroutine CNGap_PatchToColumn (bounds, num_soilc, filter_soilc, & - cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, & - leaf_prof_patch, froot_prof_patch, croot_prof_patch, stem_prof_patch) - ! - ! !DESCRIPTION: - ! gathers all patch-level gap mortality fluxes to the column level and - ! assigns them to the three litter pools - ! - ! !USES: - use clm_varpar , only : maxpatch_pft, nlevdecomp, nlevdecomp_full - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! soil column filter - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - real(r8) , intent(in) :: leaf_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: froot_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: croot_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: stem_prof_patch(bounds%begp:,1:) - ! - ! !LOCAL VARIABLES: - integer :: fc,c,pi,p,j ! indices - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(leaf_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(froot_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(croot_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(stem_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - - associate( & - leaf_prof => leaf_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of leaves - froot_prof => froot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of fine roots - croot_prof => croot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of coarse roots - stem_prof => stem_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of stems - - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - wtcol => patch%wtcol , & ! Input: [real(r8) (:) ] patch weight relative to column (0-1) - - lf_flab => pftcon%lf_flab , & ! Input: [real(r8) (:) ] leaf litter labile fraction - lf_fcel => pftcon%lf_fcel , & ! Input: [real(r8) (:) ] leaf litter cellulose fraction - lf_flig => pftcon%lf_flig , & ! Input: [real(r8) (:) ] leaf litter lignin fraction - fr_flab => pftcon%fr_flab , & ! Input: [real(r8) (:) ] fine root litter labile fraction - fr_fcel => pftcon%fr_fcel , & ! Input: [real(r8) (:) ] fine root litter cellulose fraction - fr_flig => pftcon%fr_flig , & ! Input: [real(r8) (:) ] fine root litter lignin fraction - - m_leafc_to_litter => cnveg_carbonflux_inst%m_leafc_to_litter_patch , & ! Input: [real(r8) (:) ] - m_frootc_to_litter => cnveg_carbonflux_inst%m_frootc_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livestemc_to_litter => cnveg_carbonflux_inst%m_livestemc_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadstemc_to_litter => cnveg_carbonflux_inst%m_deadstemc_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livecrootc_to_litter => cnveg_carbonflux_inst%m_livecrootc_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadcrootc_to_litter => cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch , & ! Input: [real(r8) (:) ] - m_leafc_storage_to_litter => cnveg_carbonflux_inst%m_leafc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_frootc_storage_to_litter => cnveg_carbonflux_inst%m_frootc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livestemc_storage_to_litter => cnveg_carbonflux_inst%m_livestemc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadstemc_storage_to_litter => cnveg_carbonflux_inst%m_deadstemc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livecrootc_storage_to_litter => cnveg_carbonflux_inst%m_livecrootc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadcrootc_storage_to_litter => cnveg_carbonflux_inst%m_deadcrootc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_gresp_storage_to_litter => cnveg_carbonflux_inst%m_gresp_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_leafc_xfer_to_litter => cnveg_carbonflux_inst%m_leafc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_frootc_xfer_to_litter => cnveg_carbonflux_inst%m_frootc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livestemc_xfer_to_litter => cnveg_carbonflux_inst%m_livestemc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadstemc_xfer_to_litter => cnveg_carbonflux_inst%m_deadstemc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livecrootc_xfer_to_litter => cnveg_carbonflux_inst%m_livecrootc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadcrootc_xfer_to_litter => cnveg_carbonflux_inst%m_deadcrootc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_gresp_xfer_to_litter => cnveg_carbonflux_inst%m_gresp_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - gap_mortality_c_to_litr_met_c => cnveg_carbonflux_inst%gap_mortality_c_to_litr_met_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with gap mortality to litter metabolic pool (gC/m3/s) - gap_mortality_c_to_litr_cel_c => cnveg_carbonflux_inst%gap_mortality_c_to_litr_cel_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with gap mortality to litter cellulose pool (gC/m3/s) - gap_mortality_c_to_litr_lig_c => cnveg_carbonflux_inst%gap_mortality_c_to_litr_lig_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with gap mortality to litter lignin pool (gC/m3/s) - gap_mortality_c_to_cwdc => cnveg_carbonflux_inst%gap_mortality_c_to_cwdc_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with gap mortality to CWD pool (gC/m3/s) - - m_leafn_to_litter => cnveg_nitrogenflux_inst%m_leafn_to_litter_patch , & ! Input: [real(r8) (:) ] - m_frootn_to_litter => cnveg_nitrogenflux_inst%m_frootn_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livestemn_to_litter => cnveg_nitrogenflux_inst%m_livestemn_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadstemn_to_litter => cnveg_nitrogenflux_inst%m_deadstemn_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livecrootn_to_litter => cnveg_nitrogenflux_inst%m_livecrootn_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadcrootn_to_litter => cnveg_nitrogenflux_inst%m_deadcrootn_to_litter_patch , & ! Input: [real(r8) (:) ] - m_retransn_to_litter => cnveg_nitrogenflux_inst%m_retransn_to_litter_patch , & ! Input: [real(r8) (:) ] - m_leafn_storage_to_litter => cnveg_nitrogenflux_inst%m_leafn_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_frootn_storage_to_litter => cnveg_nitrogenflux_inst%m_frootn_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livestemn_storage_to_litter => cnveg_nitrogenflux_inst%m_livestemn_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadstemn_storage_to_litter => cnveg_nitrogenflux_inst%m_deadstemn_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livecrootn_storage_to_litter => cnveg_nitrogenflux_inst%m_livecrootn_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadcrootn_storage_to_litter => cnveg_nitrogenflux_inst%m_deadcrootn_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_leafn_xfer_to_litter => cnveg_nitrogenflux_inst%m_leafn_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_frootn_xfer_to_litter => cnveg_nitrogenflux_inst%m_frootn_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livestemn_xfer_to_litter => cnveg_nitrogenflux_inst%m_livestemn_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadstemn_xfer_to_litter => cnveg_nitrogenflux_inst%m_deadstemn_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livecrootn_xfer_to_litter => cnveg_nitrogenflux_inst%m_livecrootn_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadcrootn_xfer_to_litter => cnveg_nitrogenflux_inst%m_deadcrootn_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - gap_mortality_n_to_litr_met_n => cnveg_nitrogenflux_inst%gap_mortality_n_to_litr_met_n_col , & ! Output: [real(r8) (:,:) ] N fluxes associated with gap mortality to litter metabolic pool (gN/m3/s) - gap_mortality_n_to_litr_cel_n => cnveg_nitrogenflux_inst%gap_mortality_n_to_litr_cel_n_col , & ! Output: [real(r8) (:,:) ] N fluxes associated with gap mortality to litter cellulose pool (gN/m3/s) - gap_mortality_n_to_litr_lig_n => cnveg_nitrogenflux_inst%gap_mortality_n_to_litr_lig_n_col , & ! Output: [real(r8) (:,:) ] N fluxes associated with gap mortality to litter lignin pool (gN/m3/s) - gap_mortality_n_to_cwdn => cnveg_nitrogenflux_inst%gap_mortality_n_to_cwdn_col & ! Output: [real(r8) (:,:) ] N fluxes associated with gap mortality to CWD pool (gN/m3/s) - ) - - do j = 1,nlevdecomp - do pi = 1,maxpatch_pft - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - - if (patch%active(p)) then - - ! leaf gap mortality carbon fluxes - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_leafc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - gap_mortality_c_to_litr_cel_c(c,j) = gap_mortality_c_to_litr_cel_c(c,j) + & - m_leafc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - gap_mortality_c_to_litr_lig_c(c,j) = gap_mortality_c_to_litr_lig_c(c,j) + & - m_leafc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - ! fine root gap mortality carbon fluxes - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_frootc_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) * froot_prof(p,j) - gap_mortality_c_to_litr_cel_c(c,j) = gap_mortality_c_to_litr_cel_c(c,j) + & - m_frootc_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) * froot_prof(p,j) - gap_mortality_c_to_litr_lig_c(c,j) = gap_mortality_c_to_litr_lig_c(c,j) + & - m_frootc_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) * froot_prof(p,j) - - ! wood gap mortality carbon fluxes - gap_mortality_c_to_cwdc(c,j) = gap_mortality_c_to_cwdc(c,j) + & - (m_livestemc_to_litter(p) + m_deadstemc_to_litter(p)) * wtcol(p) * stem_prof(p,j) - gap_mortality_c_to_cwdc(c,j) = gap_mortality_c_to_cwdc(c,j) + & - (m_livecrootc_to_litter(p) + m_deadcrootc_to_litter(p)) * wtcol(p) * croot_prof(p,j) - - ! storage gap mortality carbon fluxes - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - (m_leafc_storage_to_litter(p) + m_gresp_storage_to_litter(p)) * wtcol(p) * leaf_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_frootc_storage_to_litter(p) * wtcol(p) * froot_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - (m_livestemc_storage_to_litter(p) + m_deadstemc_storage_to_litter(p)) * wtcol(p) * stem_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - (m_livecrootc_storage_to_litter(p) + m_deadcrootc_storage_to_litter(p)) * wtcol(p) * croot_prof(p,j) - - ! transfer gap mortality carbon fluxes - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - (m_leafc_xfer_to_litter(p) + m_gresp_xfer_to_litter(p)) * wtcol(p) * leaf_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_frootc_xfer_to_litter(p) * wtcol(p) * froot_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - (m_livestemc_xfer_to_litter(p) + m_deadstemc_xfer_to_litter(p)) * wtcol(p) * stem_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - (m_livecrootc_xfer_to_litter(p) + m_deadcrootc_xfer_to_litter(p)) * wtcol(p) * croot_prof(p,j) - - ! leaf gap mortality nitrogen fluxes - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - m_leafn_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - gap_mortality_n_to_litr_cel_n(c,j) = gap_mortality_n_to_litr_cel_n(c,j) + & - m_leafn_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - gap_mortality_n_to_litr_lig_n(c,j) = gap_mortality_n_to_litr_lig_n(c,j) + & - m_leafn_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - ! fine root litter nitrogen fluxes - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - m_frootn_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) * froot_prof(p,j) - gap_mortality_n_to_litr_cel_n(c,j) = gap_mortality_n_to_litr_cel_n(c,j) + & - m_frootn_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) * froot_prof(p,j) - gap_mortality_n_to_litr_lig_n(c,j) = gap_mortality_n_to_litr_lig_n(c,j) + & - m_frootn_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) * froot_prof(p,j) - - ! wood gap mortality nitrogen fluxes - gap_mortality_n_to_cwdn(c,j) = gap_mortality_n_to_cwdn(c,j) + & - (m_livestemn_to_litter(p) + m_deadstemn_to_litter(p)) * wtcol(p) * stem_prof(p,j) - gap_mortality_n_to_cwdn(c,j) = gap_mortality_n_to_cwdn(c,j) + & - (m_livecrootn_to_litter(p) + m_deadcrootn_to_litter(p)) * wtcol(p) * croot_prof(p,j) - - ! retranslocated N pool gap mortality fluxes - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - m_retransn_to_litter(p) * wtcol(p) * leaf_prof(p,j) - - ! storage gap mortality nitrogen fluxes - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - m_leafn_storage_to_litter(p) * wtcol(p) * leaf_prof(p,j) - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - m_frootn_storage_to_litter(p) * wtcol(p) * froot_prof(p,j) - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - (m_livestemn_storage_to_litter(p) + m_deadstemn_storage_to_litter(p)) * wtcol(p) * stem_prof(p,j) - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - (m_livecrootn_storage_to_litter(p) + m_deadcrootn_storage_to_litter(p)) * wtcol(p) * croot_prof(p,j) - - ! transfer gap mortality nitrogen fluxes - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - m_leafn_xfer_to_litter(p) * wtcol(p) * leaf_prof(p,j) - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - m_frootn_xfer_to_litter(p) * wtcol(p) * froot_prof(p,j) - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - (m_livestemn_xfer_to_litter(p) + m_deadstemn_xfer_to_litter(p)) * wtcol(p) * stem_prof(p,j) - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - (m_livecrootn_xfer_to_litter(p) + m_deadcrootn_xfer_to_litter(p)) * wtcol(p) * croot_prof(p,j) - - - end if - end if - - end do - end do - end do - - end associate - - end subroutine CNGap_PatchToColumn - -end module CNGapMortalityMod diff --git a/src/biogeochem/CNMRespMod.F90 b/src/biogeochem/CNMRespMod.F90 deleted file mode 100644 index 74ff1a9d3a..0000000000 --- a/src/biogeochem/CNMRespMod.F90 +++ /dev/null @@ -1,237 +0,0 @@ -module CNMRespMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module holding maintenance respiration routines for coupled carbon - ! nitrogen code. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ - use clm_varpar , only : nlevgrnd - use clm_varcon , only : spval - use decompMod , only : bounds_type - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - use pftconMod , only : npcropmin, pftcon - use SoilStateType , only : soilstate_type - use CanopyStateType , only : canopystate_type - use TemperatureType , only : temperature_type - use PhotosynthesisMod , only : photosyns_type - use CNVegcarbonfluxType , only : cnveg_carbonflux_type - use CNVegnitrogenstateType , only : cnveg_nitrogenstate_type - use CNSharedParamsMod , only : CNParamsShareInst - use PatchType , only : patch - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: readParams ! Read in parameters from file - public :: CNMResp ! Apply maintenance respiration - - type, private :: params_type - real(r8) :: br = spval ! base rate for maintenance respiration (gC/gN/s) - real(r8) :: br_root = spval ! base rate for maintenance respiration for roots (gC/gN/s) - end type params_type - - type(params_type), private :: params_inst - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !DESCRIPTION: - ! Read parameters (call AFTER CNMRespReadNML!) - ! - ! !USES: - use ncdio_pio , only : file_desc_t,ncd_io - ! - ! !ARGUMENTS: - implicit none - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNMRespParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - tString='br_mr' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%br=tempr - - if ( params_inst%br_root == spval ) then - params_inst%br_root = params_inst%br - end if - - end subroutine readParams - - !----------------------------------------------------------------------- - ! FIX(SPM,032414) this shouldn't even be called with fates on. - ! - subroutine CNMResp(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - canopystate_inst, soilstate_inst, temperature_inst, photosyns_inst, & - cnveg_carbonflux_inst, cnveg_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! - ! !ARGUMENTS: - use clm_varcon , only : tfrz - - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil points in column filter - integer , intent(in) :: filter_soilc(:) ! column filter for soil points - integer , intent(in) :: num_soilp ! number of soil points in patch filter - integer , intent(in) :: filter_soilp(:) ! patch filter for soil points - type(canopystate_type) , intent(in) :: canopystate_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(photosyns_type) , intent(in) :: photosyns_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c,p,j ! indices - integer :: fp ! soil filter patch index - integer :: fc ! soil filter column index - real(r8):: br ! base rate (gC/gN/s) - real(r8):: br_root ! root base rate (gC/gN/s) - real(r8):: q10 ! temperature dependence - - real(r8):: tc ! temperature correction, 2m air temp (unitless) - real(r8):: tcsoi(bounds%begc:bounds%endc,nlevgrnd) ! temperature correction by soil layer (unitless) - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - - frac_veg_nosno => canopystate_inst%frac_veg_nosno_patch , & ! Input: [integer (:) ] fraction of vegetation not covered by snow (0 OR 1) [-] - laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit projected leaf area index - laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded projected leaf area index - - crootfr => soilstate_inst%crootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots for carbon in each soil layer (nlevgrnd) - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - t_ref2m => temperature_inst%t_ref2m_patch , & ! Input: [real(r8) (:) ] 2 m height surface air temperature (Kelvin) - - t10 => temperature_inst%t_a10_patch , & ! Input: [real(r8) (:) ] 10-day running mean of the 2 m temperature (K) - - lmrsun => photosyns_inst%lmrsun_patch , & ! Input: [real(r8) (:) ] sunlit leaf maintenance respiration rate (umol CO2/m**2/s) - lmrsha => photosyns_inst%lmrsha_patch , & ! Input: [real(r8) (:) ] shaded leaf maintenance respiration rate (umol CO2/m**2/s) - rootstem_acc => photosyns_inst%rootstem_acc , & ! Input: [logical ] root and stem acclimation switch - - frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N - livestemn => cnveg_nitrogenstate_inst%livestemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N - livecrootn => cnveg_nitrogenstate_inst%livecrootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N - grainn => cnveg_nitrogenstate_inst%grainn_patch , & ! Input: [real(r8) (:) ] (kgN/m2) grain N - - leaf_mr => cnveg_carbonflux_inst%leaf_mr_patch , & ! Output: [real(r8) (:) ] - froot_mr => cnveg_carbonflux_inst%froot_mr_patch , & ! Output: [real(r8) (:) ] - livestem_mr => cnveg_carbonflux_inst%livestem_mr_patch , & ! Output: [real(r8) (:) ] - livecroot_mr => cnveg_carbonflux_inst%livecroot_mr_patch , & ! Output: [real(r8) (:) ] - grain_mr => cnveg_carbonflux_inst%grain_mr_patch & ! Output: [real(r8) (:) ] - - ) - - ! base rate for maintenance respiration is from: - ! M. Ryan, 1991. Effects of climate change on plant respiration. - ! Ecological Applications, 1(2), 157-167. - ! Original expression is br = 0.0106 molC/(molN h) - ! Conversion by molecular weights of C and N gives 2.525e-6 gC/(gN s) - ! set constants - br = params_inst%br - br_root = params_inst%br_root - - ! Peter Thornton: 3/13/09 - ! Q10 was originally set to 2.0, an arbitrary choice, but reduced to 1.5 as part of the tuning - ! to improve seasonal cycle of atmospheric CO2 concentration in global - ! simulatoins - Q10 = CNParamsShareInst%Q10 - - ! column loop to calculate temperature factors in each soil layer - do j=1,nlevgrnd - do fc = 1, num_soilc - c = filter_soilc(fc) - - ! calculate temperature corrections for each soil layer, for use in - ! estimating fine root maintenance respiration with depth - tcsoi(c,j) = Q10**((t_soisno(c,j)-SHR_CONST_TKFRZ - 20.0_r8)/10.0_r8) - end do - end do - - ! patch loop for leaves and live wood - do fp = 1, num_soilp - p = filter_soilp(fp) - - ! calculate maintenance respiration fluxes in - ! gC/m2/s for each of the live plant tissues. - ! Leaf and live wood MR - - tc = Q10**((t_ref2m(p)-SHR_CONST_TKFRZ - 20.0_r8)/10.0_r8) - - !RF: acclimation of root and stem respiration fluxes - ! n.b. we do not yet know if this is defensible scientifically (awaiting data analysis) - ! turning this on will increase R and decrease productivity in boreal forests, A LOT. :) - - if(rootstem_acc)then - br = br * 10._r8**(-0.00794_r8*((t10(p)-tfrz)-25._r8)) - br_root = br_root * 10._r8**(-0.00794_r8*((t10(p)-tfrz)-25._r8)) - end if - - if (frac_veg_nosno(p) == 1) then - - leaf_mr(p) = lmrsun(p) * laisun(p) * 12.011e-6_r8 + & - lmrsha(p) * laisha(p) * 12.011e-6_r8 - - else !nosno - - leaf_mr(p) = 0._r8 - - end if - - if (woody(ivt(p)) == 1) then - livestem_mr(p) = livestemn(p)*br*tc - livecroot_mr(p) = livecrootn(p)*br_root*tc - else if (ivt(p) >= npcropmin) then - livestem_mr(p) = livestemn(p)*br*tc - grain_mr(p) = grainn(p)*br*tc - end if - end do - - ! soil and patch loop for fine root - - do j = 1,nlevgrnd - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - - ! Fine root MR - ! crootfr(j) sums to 1.0 over all soil layers, and - ! describes the fraction of root mass for carbon that is in each - ! layer. This is used with the layer temperature correction - ! to estimate the total fine root maintenance respiration as a - ! function of temperature and N content. - if(rootstem_acc)then - br_root = br_root * 10._r8**(-0.00794_r8*((t10(p)-tfrz)-25._r8)) - end if - froot_mr(p) = froot_mr(p) + frootn(p)*br_root*tcsoi(c,j)*crootfr(p,j) - - end do - end do - - end associate - - end subroutine CNMResp - -end module CNMRespMod diff --git a/src/biogeochem/CNNDynamicsMod.F90 b/src/biogeochem/CNNDynamicsMod.F90 deleted file mode 100644 index 0d367efea9..0000000000 --- a/src/biogeochem/CNNDynamicsMod.F90 +++ /dev/null @@ -1,375 +0,0 @@ -module CNNDynamicsMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module for mineral nitrogen dynamics (deposition, fixation, leaching) - ! for coupled carbon-nitrogen code. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use clm_varcon , only : dzsoi_decomp, zisoi - use clm_varctl , only : use_nitrif_denitrif, use_vertsoilc, nfix_timeconst - use subgridAveMod , only : p2c - use atm2lndType , only : atm2lnd_type - use CNVegStateType , only : cnveg_state_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use WaterStateType , only : waterstate_type - use WaterFluxType , only : waterflux_type - use CropType , only : crop_type - use ColumnType , only : col - use PatchType , only : patch - use perf_mod , only : t_startf, t_stopf - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: CNNDeposition ! Update N deposition rate from atm forcing - public :: CNNFixation ! Update N Fixation rate - public :: CNNFert ! Update N fertilizer for crops - public :: CNSoyfix ! N Fixation for soybeans - public :: CNFreeLivingFixation ! N free living fixation - - ! - ! !PRIVATE DATA MEMBERS: - type, private :: params_type - real(r8) :: freelivfix_intercept ! intercept of line of free living fixation with annual ET - real(r8) :: freelivfix_slope_wET ! slope of line of free living fixation with annual ET - end type params_type - type(params_type) :: params_inst - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CNNDeposition( bounds, & - atm2lnd_inst, soilbiogeochem_nitrogenflux_inst ) - ! - ! !DESCRIPTION: - ! On the radiation time step, update the nitrogen deposition rate - ! from atmospheric forcing. For now it is assumed that all the atmospheric - ! N deposition goes to the soil mineral N pool. - ! This could be updated later to divide the inputs between mineral N absorbed - ! directly into the canopy and mineral N entering the soil pool. - ! - ! !USES: - use CNSharedParamsMod , only: use_fun - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: g,c ! indices - !----------------------------------------------------------------------- - - associate( & - forc_ndep => atm2lnd_inst%forc_ndep_grc , & ! Input: [real(r8) (:)] nitrogen deposition rate (gN/m2/s) - ndep_to_sminn => soilbiogeochem_nitrogenflux_inst%ndep_to_sminn_col & ! Output: [real(r8) (:)] atmospheric N deposition to soil mineral N (gN/m2/s) - ) - - ! Loop through columns - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - ndep_to_sminn(c) = forc_ndep(g) - - end do - - end associate - - end subroutine CNNDeposition - - !----------------------------------------------------------------------- - subroutine CNFreeLivingFixation(num_soilc, filter_soilc, & - waterflux_inst, soilbiogeochem_nitrogenflux_inst) - - - use clm_time_manager , only : get_days_per_year, get_step_size - use shr_sys_mod , only : shr_sys_flush - use clm_varcon , only : secspday, spval - - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - ! - ! !LOCAL VARIABLES: - integer :: c,fc !indices - real(r8) :: dayspyr !days per year - real(r8) :: secs_per_year !seconds per year - - associate( & - AnnET => waterflux_inst%AnnET, & ! Input: [real(:) ] : Annual average ET flux mmH20/s - freelivfix_slope => params_inst%freelivfix_slope_wET, & ! Input: [real ] : slope of fixation with ET - freelivfix_inter => params_inst%freelivfix_intercept, & ! Input: [real ] : intercept of fixation with ET - ffix_to_sminn => soilbiogeochem_nitrogenflux_inst%ffix_to_sminn_col & ! Output: [real(:) ] : free living N fixation to soil mineral N (gN/m2/s) - ) - - dayspyr = get_days_per_year() - secs_per_year = dayspyr*24_r8*3600_r8 - - do fc = 1,num_soilc - c = filter_soilc(fc) - ffix_to_sminn(c) = (freelivfix_slope*(max(0._r8,AnnET(c))*secs_per_year) + freelivfix_inter )/secs_per_year !(units g N m-2 s-1) - - end do - - end associate - end subroutine CNFreeLivingFixation - - !----------------------------------------------------------------------- - subroutine CNNFixation(num_soilc, filter_soilc, & - cnveg_carbonflux_inst, soilbiogeochem_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, update the nitrogen fixation rate - ! as a function of annual total NPP. This rate gets updated once per year. - ! All N fixation goes to the soil mineral N pool. - ! - ! !USES: - use clm_time_manager , only : get_days_per_year, get_step_size - use shr_sys_mod , only : shr_sys_flush - use clm_varcon , only : secspday, spval - use CNSharedParamsMod , only: use_fun - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: c,fc ! indices - real(r8) :: t ! temporary - real(r8) :: dayspyr ! days per year - !----------------------------------------------------------------------- - - associate( & - cannsum_npp => cnveg_carbonflux_inst%annsum_npp_col , & ! Input: [real(r8) (:)] nitrogen deposition rate (gN/m2/s) - col_lag_npp => cnveg_carbonflux_inst%lag_npp_col , & ! Input: [real(r8) (:)] (gC/m2/s) lagged net primary production - - nfix_to_sminn => soilbiogeochem_nitrogenflux_inst%nfix_to_sminn_col & ! Output: [real(r8) (:)] symbiotic/asymbiotic N fixation to soil mineral N (gN/m2/s) - ) - - dayspyr = get_days_per_year() - - if ( nfix_timeconst > 0._r8 .and. nfix_timeconst < 500._r8 ) then - ! use exponential relaxation with time constant nfix_timeconst for NPP - NFIX relation - ! Loop through columns - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (col_lag_npp(c) /= spval) then - ! need to put npp in units of gC/m^2/year here first - t = (1.8_r8 * (1._r8 - exp(-0.003_r8 * col_lag_npp(c)*(secspday * dayspyr))))/(secspday * dayspyr) - nfix_to_sminn(c) = max(0._r8,t) - else - nfix_to_sminn(c) = 0._r8 - endif - end do - else - ! use annual-mean values for NPP-NFIX relation - do fc = 1,num_soilc - c = filter_soilc(fc) - - t = (1.8_r8 * (1._r8 - exp(-0.003_r8 * cannsum_npp(c))))/(secspday * dayspyr) - nfix_to_sminn(c) = max(0._r8,t) - end do - endif - if(use_fun)then - nfix_to_sminn(c) = 0.0_r8 - end if - - end associate - - end subroutine CNNFixation - - !----------------------------------------------------------------------- - subroutine CNNFert(bounds, num_soilc, filter_soilc, & - cnveg_nitrogenflux_inst, soilbiogeochem_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, update the nitrogen fertilizer for crops - ! All fertilizer goes into the soil mineral N pool. - ! - ! !USES: - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(cnveg_nitrogenflux_type) , intent(in) :: cnveg_nitrogenflux_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: c,fc ! indices - !----------------------------------------------------------------------- - - associate( & - fert => cnveg_nitrogenflux_inst%fert_patch , & ! Input: [real(r8) (:)] nitrogen fertilizer rate (gN/m2/s) - fert_to_sminn => soilbiogeochem_nitrogenflux_inst%fert_to_sminn_col & ! Output: [real(r8) (:)] - ) - - call p2c(bounds, num_soilc, filter_soilc, & - fert(bounds%begp:bounds%endp), & - fert_to_sminn(bounds%begc:bounds%endc)) - - end associate - - end subroutine CNNFert - - !----------------------------------------------------------------------- - subroutine CNSoyfix (bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - waterstate_inst, crop_inst, cnveg_state_inst, cnveg_nitrogenflux_inst , & - soilbiogeochem_state_inst, soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! This routine handles the fixation of nitrogen for soybeans based on - ! the EPICPHASE model M. Cabelguenne et al., Agricultural systems 60: 175-196, 1999 - ! N-fixation is based on soil moisture, plant growth phase, and availibility of - ! nitrogen in the soil root zone. - ! - ! !USES: - use pftconMod, only : ntmp_soybean, nirrig_tmp_soybean - use pftconMod, only : ntrp_soybean, nirrig_trp_soybean - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(waterstate_type) , intent(in) :: waterstate_inst - type(crop_type) , intent(in) :: crop_inst - type(cnveg_state_type) , intent(in) :: cnveg_state_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(soilbiogeochem_state_type) , intent(in) :: soilbiogeochem_state_inst - type(soilbiogeochem_nitrogenstate_type) , intent(in) :: soilbiogeochem_nitrogenstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: fp,p,c - real(r8):: fxw,fxn,fxg,fxr ! soil water factor, nitrogen factor, growth stage factor - real(r8):: soy_ndemand ! difference between nitrogen supply and demand - real(r8):: GDDfrac - real(r8):: sminnthreshold1, sminnthreshold2 - real(r8):: GDDfracthreshold1, GDDfracthreshold2 - real(r8):: GDDfracthreshold3, GDDfracthreshold4 - !----------------------------------------------------------------------- - - associate( & - wf => waterstate_inst%wf_col , & ! Input: [real(r8) (:) ] soil water as frac. of whc for top 0.5 m - - hui => crop_inst%gddplant_patch , & ! Input: [real(r8) (:) ] gdd since planting (gddplant) - croplive => crop_inst%croplive_patch , & ! Input: [logical (:) ] true if planted and not harvested - - gddmaturity => cnveg_state_inst%gddmaturity_patch , & ! Input: [real(r8) (:) ] gdd needed to harvest - - plant_ndemand => cnveg_nitrogenflux_inst%plant_ndemand_patch , & ! Input: [real(r8) (:) ] N flux required to support initial GPP (gN/m2/s) - soyfixn => cnveg_nitrogenflux_inst%soyfixn_patch , & ! Output: [real(r8) (:) ] nitrogen fixed to each soybean crop - - fpg => soilbiogeochem_state_inst%fpg_col , & ! Input: [real(r8) (:) ] fraction of potential gpp (no units) - - sminn => soilbiogeochem_nitrogenstate_inst%sminn_col , & ! Input: [real(r8) (:) ] (kgN/m2) soil mineral N - soyfixn_to_sminn => soilbiogeochem_nitrogenflux_inst%soyfixn_to_sminn_col & ! Output: [real(r8) (:) ] - ) - - sminnthreshold1 = 30._r8 - sminnthreshold2 = 10._r8 - GDDfracthreshold1 = 0.15_r8 - GDDfracthreshold2 = 0.30_r8 - GDDfracthreshold3 = 0.55_r8 - GDDfracthreshold4 = 0.75_r8 - - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - - ! if soybean currently growing then calculate fixation - - if (croplive(p) .and. & - (patch%itype(p) == ntmp_soybean .or. & - patch%itype(p) == nirrig_tmp_soybean .or. & - patch%itype(p) == ntrp_soybean .or. & - patch%itype(p) == nirrig_trp_soybean) ) then - - ! difference between supply and demand - - if (fpg(c) < 1._r8) then - soy_ndemand = 0._r8 - soy_ndemand = plant_ndemand(p) - plant_ndemand(p)*fpg(c) - - ! fixation depends on nitrogen, soil water, and growth stage - - ! soil water factor - - fxw = 0._r8 - fxw = wf(c)/0.85_r8 - - ! soil nitrogen factor (Beth says: CHECK UNITS) - - if (sminn(c) > sminnthreshold1) then - fxn = 0._r8 - else if (sminn(c) > sminnthreshold2 .and. sminn(c) <= sminnthreshold1) then - fxn = 1.5_r8 - .005_r8 * (sminn(c) * 10._r8) - else if (sminn(c) <= sminnthreshold2) then - fxn = 1._r8 - end if - - ! growth stage factor - ! slevis: to replace GDDfrac, assume... - ! Beth's crit_offset_gdd_def is similar to my gddmaturity - ! Beth's ac_gdd (base 5C) similar to my hui=gddplant (base 10 - ! for soy) - ! Ranges below are not firm. Are they lit. based or tuning based? - - GDDfrac = hui(p) / gddmaturity(p) - - if (GDDfrac <= GDDfracthreshold1) then - fxg = 0._r8 - else if (GDDfrac > GDDfracthreshold1 .and. GDDfrac <= GDDfracthreshold2) then - fxg = 6.67_r8 * GDDfrac - 1._r8 - else if (GDDfrac > GDDfracthreshold2 .and. GDDfrac <= GDDfracthreshold3) then - fxg = 1._r8 - else if (GDDfrac > GDDfracthreshold3 .and. GDDfrac <= GDDfracthreshold4) then - fxg = 3.75_r8 - 5._r8 * GDDfrac - else ! GDDfrac > GDDfracthreshold4 - fxg = 0._r8 - end if - - ! calculate the nitrogen fixed by the soybean - - fxr = min(1._r8, fxw, fxn) * fxg - fxr = max(0._r8, fxr) - soyfixn(p) = fxr * soy_ndemand - soyfixn(p) = min(soyfixn(p), soy_ndemand) - - else ! if nitrogen demand met, no fixation - - soyfixn(p) = 0._r8 - - end if - - else ! if not live soybean, no fixation - - soyfixn(p) = 0._r8 - - end if - end do - - call p2c(bounds, num_soilc, filter_soilc, & - soyfixn(bounds%begp:bounds%endp), & - soyfixn_to_sminn(bounds%begc:bounds%endc)) - - end associate - - end subroutine CNSoyfix - -end module CNNDynamicsMod diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 deleted file mode 100644 index b54cff51be..0000000000 --- a/src/biogeochem/CNPhenologyMod.F90 +++ /dev/null @@ -1,247 +0,0 @@ -module CNPhenologyMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !MODULE: CNPhenologyMod - ! - ! !DESCRIPTION: - ! Module holding routines used in phenology model for coupled carbon - ! nitrogen code. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_sys_mod , only : shr_sys_flush - use decompMod , only : bounds_type - use clm_varpar , only : numpft, nlevdecomp_full - use clm_varctl , only : iulog, use_cndv - use clm_varcon , only : tfrz - use abortutils , only : endrun - use CanopyStateType , only : canopystate_type - use CNDVType , only : dgvs_type - use CNVegstateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegnitrogenstateType , only : cnveg_nitrogenstate_type - use CNVegnitrogenfluxType , only : cnveg_nitrogenflux_type - use CropType , only : crop_type - use pftconMod , only : pftcon - use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type - use WaterstateType , only : waterstate_type - use ColumnType , only : col - use GridcellType , only : grc - use PatchType , only : patch - use atm2lndType , only : atm2lnd_type - use atm2lndType , only : atm2lnd_type - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: readParams ! Read parameters - public :: CNPhenologyInit ! Initialization - ! - ! !PRIVATE DATA MEMBERS: - type, private :: params_type - real(r8) :: crit_dayl ! critical day length for senescence - real(r8) :: ndays_on ! number of days to complete leaf onset - real(r8) :: ndays_off ! number of days to complete leaf offset - real(r8) :: fstor2tran ! fraction of storage to move to transfer for each onset - real(r8) :: crit_onset_fdd ! critical number of freezing days to set gdd counter - real(r8) :: crit_onset_swi ! critical number of days > soilpsi_on for onset - real(r8) :: soilpsi_on ! critical soil water potential for leaf onset - real(r8) :: crit_offset_fdd ! critical number of freezing days to initiate offset - real(r8) :: crit_offset_swi ! critical number of water stress days to initiate offset - real(r8) :: soilpsi_off ! critical soil water potential for leaf offset - real(r8) :: lwtop ! live wood turnover proportion (annual fraction) - end type params_type - - type(params_type) :: params_inst - - real(r8) :: dt ! radiation time step delta t (seconds) - real(r8) :: fracday ! dtime as a fraction of day - real(r8) :: crit_dayl ! critical daylength for offset (seconds) - real(r8) :: ndays_on ! number of days to complete onset - real(r8) :: ndays_off ! number of days to complete offset - real(r8) :: fstor2tran ! fraction of storage to move to transfer on each onset - real(r8) :: crit_onset_fdd ! critical number of freezing days - real(r8) :: crit_onset_swi ! water stress days for offset trigger - real(r8) :: soilpsi_on ! water potential for onset trigger (MPa) - real(r8) :: crit_offset_fdd ! critical number of freezing degree days to trigger offset - real(r8) :: crit_offset_swi ! water stress days for offset trigger - real(r8) :: soilpsi_off ! water potential for offset trigger (MPa) - real(r8) :: lwtop ! live wood turnover proportion (annual fraction) - - ! CropPhenology variables and constants - real(r8) :: p1d, p1v ! photoperiod factor constants for crop vernalization - real(r8) :: hti ! cold hardening index threshold for vernalization - real(r8) :: tbase ! base temperature for vernalization - - integer, parameter :: NOT_Planted = 999 ! If not planted yet in year - integer, parameter :: NOT_Harvested = 999 ! If not harvested yet in year - integer, parameter :: inNH = 1 ! Northern Hemisphere - integer, parameter :: inSH = 2 ! Southern Hemisphere - integer, pointer :: inhemi(:) ! Hemisphere that patch is in - - integer, allocatable :: minplantjday(:,:) ! minimum planting julian day - integer, allocatable :: maxplantjday(:,:) ! maximum planting julian day - integer :: jdayyrstart(inSH) ! julian day of start of year - - real(r8), private :: initial_seed_at_planting = 3._r8 ! Initial seed at planting - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !DESCRIPTION: - ! - ! !USES: - use ncdio_pio , only: file_desc_t,ncd_io - - ! !ARGUMENTS: - implicit none - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNPhenolParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in parameter - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - ! - ! read in parameters - ! - tString='crit_dayl' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_dayl=tempr - - tString='ndays_on' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%ndays_on=tempr - - tString='ndays_off' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%ndays_off=tempr - - tString='fstor2tran' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%fstor2tran=tempr - - tString='crit_onset_fdd' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_onset_fdd=tempr - - tString='crit_onset_swi' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_onset_swi=tempr - - tString='soilpsi_on' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%soilpsi_on=tempr - - tString='crit_offset_fdd' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_offset_fdd=tempr - - tString='crit_offset_swi' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_offset_swi=tempr - - tString='soilpsi_off' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%soilpsi_off=tempr - - tString='lwtop_ann' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%lwtop=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine CNPhenologyInit(bounds) - ! - ! !DESCRIPTION: - ! Initialization of CNPhenology. Must be called after time-manager is - ! initialized, and after pftcon file is read in. - ! - ! !USES: - use clm_time_manager, only: get_step_size - use clm_varctl , only: use_crop - use clm_varcon , only: secspday - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - !------------------------------------------------------------------------ - - ! - ! Get time-step and what fraction of a day it is - ! - dt = real( get_step_size(), r8 ) - fracday = dt/secspday - - ! set constants for CNSeasonDecidPhenology - ! (critical daylength from Biome-BGC, v4.1.2) - crit_dayl=params_inst%crit_dayl - - ! Set constants for CNSeasonDecidPhenology and CNStressDecidPhenology - ndays_on=params_inst%ndays_on - ndays_off=params_inst%ndays_off - - ! set transfer parameters - fstor2tran=params_inst%fstor2tran - - ! ----------------------------------------- - ! Constants for CNStressDecidPhenology - ! ----------------------------------------- - - ! onset parameters - crit_onset_fdd=params_inst%crit_onset_fdd - ! critical onset gdd now being calculated as a function of annual - ! average 2m temp. - ! crit_onset_gdd = 150.0 ! c3 grass value - ! crit_onset_gdd = 1000.0 ! c4 grass value - crit_onset_swi=params_inst%crit_onset_swi - soilpsi_on=params_inst%soilpsi_on - - ! offset parameters - crit_offset_fdd=params_inst%crit_offset_fdd - crit_offset_swi=params_inst%crit_offset_swi - soilpsi_off=params_inst%soilpsi_off - - ! ----------------------------------------- - ! Constants for CNLivewoodTurnover - ! ----------------------------------------- - - ! set the global parameter for livewood turnover rate - ! define as an annual fraction (0.7), and convert to fraction per second - lwtop=params_inst%lwtop/31536000.0_r8 !annual fraction converted to per second - - ! ----------------------------------------- - ! Call any subroutine specific initialization routines - ! ----------------------------------------- - - !if ( use_crop ) call CropPhenologyInit(bounds) - - end subroutine CNPhenologyInit - -end module CNPhenologyMod diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 deleted file mode 100644 index 8c5660d198..0000000000 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ /dev/null @@ -1,498 +0,0 @@ -module CNPrecisionControlMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! controls on very low values in critical state variables - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use PatchType , only : patch - use abortutils , only : endrun - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public:: CNPrecisionControl - - ! !PUBLIC DATA: - real(r8), public :: ccrit = 1.e-8_r8 ! critical carbon state value for truncation (gC/m2) - real(r8), public :: cnegcrit = -6.e+1_r8 ! critical negative carbon state value for abort (gC/m2) - real(r8), public :: ncrit = 1.e-8_r8 ! critical nitrogen state value for truncation (gN/m2) - real(r8), public :: nnegcrit = -6.e+0_r8 ! critical negative nitrogen state value for abort (gN/m2) - real(r8), public, parameter :: n_min = 0.000000001_r8 ! Minimum Nitrogen value to use when calculating CN ratio (gN/m2) - - ! !PRIVATE DATA: - logical, private :: prec_control_for_froot = .true. ! If true do precision control for frootc/frootn - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & - cnveg_carbonstate_inst, c13_cnveg_carbonstate_inst, c14_cnveg_carbonstate_inst, & - cnveg_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! Force leaf and deadstem c and n to 0 if they get too small. - ! - ! !USES: - use clm_varctl , only : iulog - use clm_varpar , only : use_crop - use pftconMod , only : nc3crop - use decompMod , only : bounds_type - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_soilp ! number of soil patchs in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_carbonstate_type) , intent(inout) :: c13_cnveg_carbonstate_inst - type(cnveg_carbonstate_type) , intent(inout) :: c14_cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - integer :: p,j,k ! indices - integer :: fp ! filter indices - real(r8):: pc(bounds%begp:bounds%endp) ! truncation terms for patch-level corrections Carbon - real(r8):: pn(bounds%begp:bounds%endp) ! truncation terms for patch-level corrections nitrogen - real(r8):: pc13(bounds%begp:bounds%endp) ! truncation terms for patch-level corrections - real(r8):: pc14(bounds%begp:bounds%endp) ! truncation terms for patch-level corrections - !----------------------------------------------------------------------- - - ! cnveg_carbonstate_inst%cpool_patch Output: [real(r8) (:) ] (gC/m2) temporary photosynthate C pool - ! cnveg_carbonstate_inst%deadcrootc_patch Output: [real(r8) (:) ] (gC/m2) dead coarse root C - ! cnveg_carbonstate_inst%deadcrootc_storage_patch Output: [real(r8) (:) ] (gC/m2) dead coarse root C storage - ! cnveg_carbonstate_inst%deadcrootc_xfer_patch Output: [real(r8) (:) ] (gC/m2) dead coarse root C transfer - ! cnveg_carbonstate_inst%deadstemc_patch Output: [real(r8) (:) ] (gC/m2) dead stem C - ! cnveg_carbonstate_inst%deadstemc_storage_patch Output: [real(r8) (:) ] (gC/m2) dead stem C storage - ! cnveg_carbonstate_inst%deadstemc_xfer_patch Output: [real(r8) (:) ] (gC/m2) dead stem C transfer - ! cnveg_carbonstate_inst%frootc_patch Output: [real(r8) (:) ] (gC/m2) fine root C - ! cnveg_carbonstate_inst%frootc_storage_patch Output: [real(r8) (:) ] (gC/m2) fine root C storage - ! cnveg_carbonstate_inst%frootc_xfer_patch Output: [real(r8) (:) ] (gC/m2) fine root C transfer - ! cnveg_carbonstate_inst%gresp_storage_patch Output: [real(r8) (:) ] (gC/m2) growth respiration storage - ! cnveg_carbonstate_inst%gresp_xfer_patch Output: [real(r8) (:) ] (gC/m2) growth respiration transfer - ! cnveg_carbonstate_inst%leafc_patch Output: [real(r8) (:) ] (gC/m2) leaf C - ! cnveg_carbonstate_inst%leafc_storage_patch Output: [real(r8) (:) ] (gC/m2) leaf C storage - ! cnveg_carbonstate_inst%leafc_xfer_patch Output: [real(r8) (:) ] (gC/m2) leaf C transfer - ! cnveg_carbonstate_inst%livecrootc_patch Output: [real(r8) (:) ] (gC/m2) live coarse root C - ! cnveg_carbonstate_inst%livecrootc_storage_patch Output: [real(r8) (:) ] (gC/m2) live coarse root C storage - ! cnveg_carbonstate_inst%livecrootc_xfer_patch Output: [real(r8) (:) ] (gC/m2) live coarse root C transfer - ! cnveg_carbonstate_inst%livestemc_patch Output: [real(r8) (:) ] (gC/m2) live stem C - ! cnveg_carbonstate_inst%livestemc_storage_patch Output: [real(r8) (:) ] (gC/m2) live stem C storage - ! cnveg_carbonstate_inst%livestemc_xfer_patch Output: [real(r8) (:) ] (gC/m2) live stem C transfer - ! cnveg_carbonstate_inst%ctrunc_patch Output: [real(r8) (:) ] (gC/m2) patch-level sink for C truncation - ! cnveg_carbonstate_inst%xsmrpool_patch Output: [real(r8) (:) ] (gC/m2) execss maint resp C pool - ! cnveg_carbonstate_inst%grainc_patch Output: [real(r8) (:) ] (gC/m2) grain C - ! cnveg_carbonstate_inst%grainc_storage_patch Output: [real(r8) (:) ] (gC/m2) grain C storage - ! cnveg_carbonstate_inst%grainc_xfer_patch Output: [real(r8) (:) ] (gC/m2) grain C transfer - - ! cnveg_nitrogenstate_inst%deadcrootn_patch Output: [real(r8) (:) ] (gN/m2) dead coarse root N - ! cnveg_nitrogenstate_inst%deadcrootn_storage_patch Output: [real(r8) (:) ] (gN/m2) dead coarse root N storage - ! cnveg_nitrogenstate_inst%deadcrootn_xfer_patch Output: [real(r8) (:) ] (gN/m2) dead coarse root N transfer - ! cnveg_nitrogenstate_inst%deadstemn_patch Output: [real(r8) (:) ] (gN/m2) dead stem N - ! cnveg_nitrogenstate_inst%deadstemn_storage_patch Output: [real(r8) (:) ] (gN/m2) dead stem N storage - ! cnveg_nitrogenstate_inst%deadstemn_xfer_patch Output: [real(r8) (:) ] (gN/m2) dead stem N transfer - ! cnveg_nitrogenstate_inst%frootn_patch Output: [real(r8) (:) ] (gN/m2) fine root N - ! cnveg_nitrogenstate_inst%frootn_storage_patch Output: [real(r8) (:) ] (gN/m2) fine root N storage - ! cnveg_nitrogenstate_inst%frootn_xfer_patch Output: [real(r8) (:) ] (gN/m2) fine root N transfer - ! cnveg_nitrogenstate_inst%leafn_patch Output: [real(r8) (:) ] (gN/m2) leaf N - ! cnveg_nitrogenstate_inst%leafn_storage_patch Output: [real(r8) (:) ] (gN/m2) leaf N storage - ! cnveg_nitrogenstate_inst%leafn_xfer_patch Output: [real(r8) (:) ] (gN/m2) leaf N transfer - ! cnveg_nitrogenstate_inst%livecrootn_patch Output: [real(r8) (:) ] (gN/m2) live coarse root N - ! cnveg_nitrogenstate_inst%livecrootn_storage_patch Output: [real(r8) (:) ] (gN/m2) live coarse root N storage - ! cnveg_nitrogenstate_inst%livecrootn_xfer_patch Output: [real(r8) (:) ] (gN/m2) live coarse root N transfer - ! cnveg_nitrogenstate_inst%grainn_patch Output: [real(r8) (:) ] (gC/m2) grain N - ! cnveg_nitrogenstate_inst%grainn_storage_patch Output: [real(r8) (:) ] (gC/m2) grain N storage - ! cnveg_nitrogenstate_inst%grainn_xfer_patch Output: [real(r8) (:) ] (gC/m2) grain N transfer - ! cnveg_nitrogenstate_inst%livestemn_patch Output: [real(r8) (:) ] (gN/m2) live stem N - ! cnveg_nitrogenstate_inst%livestemn_storage_patch Output: [real(r8) (:) ] (gN/m2) live stem N storage - ! cnveg_nitrogenstate_inst%livestemn_xfer_patch Output: [real(r8) (:) ] (gN/m2) live stem N transfer - ! cnveg_nitrogenstate_inst%npool_patch Output: [real(r8) (:) ] (gN/m2) temporary plant N pool - ! cnveg_nitrogenstate_inst%ntrunc_patch Output: [real(r8) (:) ] (gN/m2) patch-level sink for N truncation - ! cnveg_nitrogenstate_inst%retransn_patch Output: [real(r8) (:) ] (gN/m2) plant pool of retranslocated N - - - associate( & - cs => cnveg_carbonstate_inst , & - ns => cnveg_nitrogenstate_inst , & - c13cs => c13_cnveg_carbonstate_inst , & - c14cs => c14_cnveg_carbonstate_inst & - ) - - ! patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! initialize the patch-level C and N truncation terms - pc(p) = 0._r8 - pn(p) = 0._r8 - end do - - ! do tests on state variables for precision control - ! for linked C-N state variables, perform precision test on - ! the C component, but truncate C, C13, and N components - - ! leaf C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_patch(bounds%begp:bounds%endp), & - ns%leafn_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%leafc_patch, c14=c14cs%leafc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! leaf storage C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_storage_patch(bounds%begp:bounds%endp), & - ns%leafn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%leafc_storage_patch, c14=c14cs%leafc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! leaf transfer C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_xfer_patch(bounds%begp:bounds%endp), & - ns%leafn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%leafc_xfer_patch, c14=c14cs%leafc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! froot C and N - ! EBK KO DML: For some reason frootc/frootn can go negative and allowing - ! it to be negative is important for C4 crops (otherwise they die) Jun/3/2016 - if ( prec_control_for_froot ) then - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_patch(bounds%begp:bounds%endp), & - ns%frootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%frootc_patch, c14=c14cs%frootc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true. ) - end if - - ! froot storage C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_storage_patch(bounds%begp:bounds%endp), & - ns%frootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%frootc_storage_patch, c14=c14cs%frootc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! froot transfer C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_xfer_patch(bounds%begp:bounds%endp), & - ns%frootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%frootc_xfer_patch, c14=c14cs%frootc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - if ( use_crop )then - ! grain C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_patch(bounds%begp:bounds%endp), & - ns%grainn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%grainc_patch, c14=c14cs%grainc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) - - ! grain storage C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_storage_patch(bounds%begp:bounds%endp), & - ns%grainn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%grainc_storage_patch, c14=c14cs%grainc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) - - ! grain transfer C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_xfer_patch(bounds%begp:bounds%endp), & - ns%grainn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%grainc_xfer_patch, c14=c14cs%grainc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) - - ! grain transfer C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & - ns%cropseedn_deficit_patch(bounds%begp:bounds%endp), pc(bounds%begp:), & - pn(bounds%begp:), __LINE__, & - c13=c13cs%cropseedc_deficit_patch, c14=c14cs%cropseedc_deficit_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true., croponly=.true. ) - - end if - - ! livestem C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_patch(bounds%begp:bounds%endp), & - ns%livestemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%livestemc_patch, c14=c14cs%livestemc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! livestem storage C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_storage_patch(bounds%begp:bounds%endp), & - ns%livestemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livestemc_storage_patch, c14=c14cs%livestemc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! livestem transfer C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_xfer_patch(bounds%begp:bounds%endp), & - ns%livestemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livestemc_xfer_patch, c14=c14cs%livestemc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! deadstem C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_patch(bounds%begp:bounds%endp), & - ns%deadstemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%deadstemc_patch, c14=c14cs%deadstemc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - ! deadstem storage C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_storage_patch(bounds%begp:bounds%endp), & - ns%deadstemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadstemc_storage_patch, c14=c14cs%deadstemc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! deadstem transfer C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), & - ns%deadstemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadstemc_xfer_patch, c14=c14cs%deadstemc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! livecroot C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_patch(bounds%begp:bounds%endp), & - ns%livecrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%livecrootc_patch, c14=c14cs%livecrootc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! livecroot storage C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_storage_patch(bounds%begp:bounds%endp), & - ns%livecrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livecrootc_storage_patch, c14=c14cs%livecrootc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! livecroot transfer C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), & - ns%livecrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livecrootc_xfer_patch, c14=c14cs%livecrootc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! deadcroot C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%deadcrootc_patch, c14=c14cs%deadcrootc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! deadcroot storage C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadcrootc_storage_patch, c14=c14cs%deadcrootc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! deadcroot transfer C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadcrootc_xfer_patch, c14=c14cs%deadcrootc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! gresp_storage (C only) - call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_storage_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, & - c13=c13cs%gresp_storage_patch, c14=c14cs%gresp_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! gresp_xfer(c only) - call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_xfer_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, & - c13=c13cs%gresp_xfer_patch, c14=c14cs%gresp_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! cpool (C only) - call TruncateCStates( bounds, filter_soilp, num_soilp, cs%cpool_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, & - c13=c13cs%cpool_patch, c14=c14cs%cpool_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - if ( use_crop )then - ! xsmrpool (C only) - ! xsmr is a pool to balance the budget and as such can be freely negative - call TruncateCStates( bounds, filter_soilp, num_soilp, cs%xsmrpool_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, & - c13=c13cs%xsmrpool_patch, c14=c14cs%xsmrpool_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true., croponly=.true. ) - - end if - - ! retransn (N only) - call TruncateNStates( bounds, filter_soilp, num_soilp, ns%retransn_patch(bounds%begp:bounds%endp), pn(bounds%begp:), & - __LINE__ ) - - ! npool (N only) - call TruncateNStates( bounds, filter_soilp, num_soilp, ns%npool_patch(bounds%begp:bounds%endp), pn(bounds%begp:), & - __LINE__ ) - - ! patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - cs%ctrunc_patch(p) = cs%ctrunc_patch(p) + pc(p) - - ns%ntrunc_patch(p) = ns%ntrunc_patch(p) + pn(p) - - end do - - end associate - - end subroutine CNPrecisionControl - - subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, nitrogen_patch, pc, pn, lineno, c13, c14, & - pc13, pc14, croponly, allowneg ) - ! - ! !DESCRIPTION: - ! Truncate paired Carbon and Nitrogen states. If a paired carbon and nitrogen state iare too small truncate - ! the pair of them to zero. - ! - ! !USES: - use shr_log_mod, only : errMsg => shr_log_errMsg - use clm_varctl , only : use_nguardrail - use clm_varctl , only : iulog - use pftconMod , only : nc3crop - use decompMod , only : bounds_type - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_soilp ! number of soil patchs in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - real(r8), intent(inout) :: carbon_patch(bounds%begp:) - real(r8), intent(inout) :: nitrogen_patch(bounds%begp:) - real(r8), intent(inout) :: pc(bounds%begp:) - real(r8), intent(inout) :: pn(bounds%begp:) - integer, intent(in) :: lineno - real(r8), intent(inout), optional, pointer :: c13(:) - real(r8), intent(inout), optional, pointer :: c14(:) - real(r8), intent(inout), optional :: pc13(bounds%begp:) - real(r8), intent(inout), optional :: pc14(bounds%begp:) - logical , intent(in) , optional :: croponly - logical , intent(in) , optional :: allowneg - - logical :: lcroponly, lallowneg - integer :: fp, p - - SHR_ASSERT_ALL((ubound(carbon_patch) == (/bounds%endp/)), 'ubnd(carb)'//errMsg(sourcefile, lineno)) - SHR_ASSERT_ALL((ubound(nitrogen_patch) == (/bounds%endp/)), 'ubnd(nitro)'//errMsg(sourcefile, lineno)) - SHR_ASSERT_ALL((ubound(pc) == (/bounds%endp/)), 'ubnd(pc)'//errMsg(sourcefile, lineno)) - SHR_ASSERT_ALL((ubound(pn) == (/bounds%endp/)), 'ubnd(pn)'//errMsg(sourcefile, lineno)) - ! patch loop - lcroponly = .false. - if ( present(croponly) )then - if ( croponly ) lcroponly = .true. - end if - lallowneg = .false. - if ( present(allowneg) )then - if ( allowneg ) lallowneg = .true. - end if - do fp = 1,num_soilp - p = filter_soilp(fp) - - if ( .not. lcroponly .or. (patch%itype(p) >= nc3crop) ) then - if ( .not. lallowneg .and. ((carbon_patch(p) < cnegcrit) .or. (nitrogen_patch(p) < nnegcrit)) ) then - write(iulog,*) 'ERROR: Carbon or Nitrogen patch negative = ', carbon_patch(p), nitrogen_patch(p) - write(iulog,*) 'ERROR: limits = ', cnegcrit, nnegcrit - call endrun(msg='ERROR: carbon or nitrogen state critically negative '//errMsg(sourcefile, lineno)) - else if ( abs(carbon_patch(p)) < ccrit .or. (use_nguardrail .and. abs(nitrogen_patch(p)) < ncrit) ) then - pc(p) = pc(p) + carbon_patch(p) - carbon_patch(p) = 0._r8 - - pn(p) = pn(p) + nitrogen_patch(p) - nitrogen_patch(p) = 0._r8 - - end if - end if - end do - end subroutine TruncateCandNStates - - subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, lineno, c13, c14, pc13, pc14, croponly, allowneg ) - ! - ! !DESCRIPTION: - ! Truncate Carbon states. If a carbon state is too small truncate it to - ! zero. - ! - ! !USES: - use abortutils , only : endrun - use clm_varctl , only : iulog - use shr_log_mod, only : errMsg => shr_log_errMsg - use pftconMod , only : nc3crop - use decompMod , only : bounds_type - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_soilp ! number of soil patchs in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - real(r8) , intent(inout) :: carbon_patch(bounds%begp:) - real(r8) , intent(inout) :: pc(bounds%begp:) - integer , intent(in) :: lineno - real(r8) , intent(inout), optional, pointer :: c13(:) - real(r8) , intent(inout), optional, pointer :: c14(:) - real(r8) , intent(inout), optional :: pc13(bounds%begp:) - real(r8) , intent(inout), optional :: pc14(bounds%begp:) - logical , intent(in) , optional :: croponly - logical , intent(in) , optional :: allowneg - - logical :: lcroponly, lallowneg - integer :: fp, p - - SHR_ASSERT_ALL((ubound(carbon_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(pc) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - if ( -ccrit < cnegcrit )then - call endrun(msg='ERROR: cnegcrit should be less than -ccrit: '//errMsg(sourcefile, lineno)) - end if - lcroponly = .false. - if ( present(croponly) )then - if ( croponly ) lcroponly = .true. - end if - lallowneg = .false. - if ( present(allowneg) )then - if ( allowneg ) lallowneg = .true. - end if - do fp = 1,num_soilp - p = filter_soilp(fp) - - if ( .not. lcroponly .or. (patch%itype(p) >= nc3crop) ) then - if ( .not. lallowneg .and. (carbon_patch(p) < cnegcrit) ) then - write(iulog,*) 'ERROR: Carbon patch negative = ', carbon_patch(p) - write(iulog,*) 'ERROR: limit = ', cnegcrit - call endrun(msg='ERROR: carbon state critically negative '//errMsg(sourcefile, lineno)) - else if ( abs(carbon_patch(p)) < ccrit) then - pc(p) = pc(p) + carbon_patch(p) - carbon_patch(p) = 0._r8 - - end if - end if - end do - end subroutine TruncateCStates - - subroutine TruncateNStates( bounds, filter_soilp, num_soilp, nitrogen_patch, pn, lineno ) - ! - ! !DESCRIPTION: - ! Truncate Nitrogen states. If a nitrogen state is too small truncate it to - ! zero. - ! - ! !USES: - use abortutils , only : endrun - use shr_log_mod, only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog - use decompMod , only : bounds_type - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_soilp ! number of soil patchs in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - real(r8), intent(inout) :: nitrogen_patch(bounds%begp:) - real(r8), intent(inout) :: pn(bounds%begp:) - integer, intent(in) :: lineno - - integer :: fp, p - - SHR_ASSERT_ALL((ubound(nitrogen_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(pn) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - do fp = 1,num_soilp - p = filter_soilp(fp) - if ( nitrogen_patch(p) < nnegcrit ) then - !write(iulog,*) 'WARNING: Nitrogen patch negative = ', nitrogen_patch - !call endrun(msg='ERROR: nitrogen state critically negative'//errMsg(sourcefile, lineno)) - else if ( abs(nitrogen_patch(p)) < ncrit) then - pn(p) = pn(p) + nitrogen_patch(p) - nitrogen_patch(p) = 0._r8 - - end if - end do - end subroutine TruncateNStates - -end module CNPrecisionControlMod diff --git a/src/biogeochem/CNProductsMod.F90 b/src/biogeochem/CNProductsMod.F90 deleted file mode 100644 index d71d7b1568..0000000000 --- a/src/biogeochem/CNProductsMod.F90 +++ /dev/null @@ -1,741 +0,0 @@ -module CNProductsMod - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculate loss fluxes from wood products pools, and update product pool state variables - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_time_manager , only : get_step_size - use SpeciesBaseType , only : species_base_type - use PatchType , only : patch - ! - implicit none - private - ! - ! !PUBLIC TYPES: - type, public :: cn_products_type - private - ! ------------------------------------------------------------------------ - ! Public instance variables - ! ------------------------------------------------------------------------ - - real(r8), pointer, public :: product_loss_grc(:) ! (g[C or N]/m2/s) total decomposition loss from ALL product pools - - ! ------------------------------------------------------------------------ - ! Private instance variables - ! ------------------------------------------------------------------------ - - class(species_base_type), allocatable :: species ! C, N, C13, C14, etc. - - ! States - real(r8), pointer :: cropprod1_grc(:) ! (g[C or N]/m2) grain product pool, 1-year lifespan - real(r8), pointer :: prod10_grc(:) ! (g[C or N]/m2) wood product pool, 10-year lifespan - real(r8), pointer :: prod100_grc(:) ! (g[C or N]/m2) wood product pool, 100-year lifespan - real(r8), pointer :: tot_woodprod_grc(:) ! (g[C or N]/m2) total wood product pool - - ! Fluxes: gains - real(r8), pointer :: dwt_prod10_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to 10-year wood product pool - real(r8), pointer :: dwt_prod100_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to 100-year wood product pool - real(r8), pointer :: dwt_woodprod_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to wood product pools - real(r8), pointer :: dwt_cropprod1_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to 1-year crop product pool - real(r8), pointer :: hrv_deadstem_to_prod10_patch(:) ! (g[C or N]/m2/s) dead stem harvest to 10-year wood product pool - real(r8), pointer :: hrv_deadstem_to_prod10_grc(:) ! (g[C or N]/m2/s) dead stem harvest to 10-year wood product pool - real(r8), pointer :: hrv_deadstem_to_prod100_patch(:) ! (g[C or N]/m2/s) dead stem harvest to 100-year wood product pool - real(r8), pointer :: hrv_deadstem_to_prod100_grc(:) ! (g[C or N]/m2/s) dead stem harvest to 100-year wood product pool - real(r8), pointer :: grain_to_cropprod1_patch(:) ! (g[C or N]/m2/s) grain to 1-year crop product pool - real(r8), pointer :: grain_to_cropprod1_grc(:) ! (g[C or N]/m2/s) grain to 1-year crop product pool - - ! Fluxes: losses - real(r8), pointer :: cropprod1_loss_grc(:) ! (g[C or N]/m2/s) decomposition loss from 1-yr grain product pool - real(r8), pointer :: prod10_loss_grc(:) ! (g[C or N]/m2/s) decomposition loss from 10-yr wood product pool - real(r8), pointer :: prod100_loss_grc(:) ! (g[C or N]/m2/s) decomposition loss from 100-yr wood product pool - real(r8), pointer :: tot_woodprod_loss_grc(:) ! (g[C or N]/m2/s) decompomposition loss from all wood product pools - - contains - - ! Infrastructure routines - procedure, public :: Init - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - procedure, public :: Restart - - ! Science routines - procedure, public :: UpdateProducts - procedure, private :: PartitionWoodFluxes - procedure, private :: PartitionGrainFluxes - procedure, private :: ComputeSummaryVars - - end type cn_products_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine Init(this, bounds, species) - ! !ARGUMENTS: - class(cn_products_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - - ! species tells whether this object is being used for C, N, C13, C14, etc. This is - ! just used for naming history and restart fields - class(species_base_type), intent(in) :: species - - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'Init' - !----------------------------------------------------------------------- - - allocate(this%species, source = species) - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! !ARGUMENTS: - class(cn_products_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp,endp - integer :: begg,endg - - character(len=*), parameter :: subname = 'InitAllocate' - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - begg = bounds%begg - endg = bounds%endg - - allocate(this%cropprod1_grc(begg:endg)) ; this%cropprod1_grc(:) = nan - allocate(this%prod10_grc(begg:endg)) ; this%prod10_grc(:) = nan - allocate(this%prod100_grc(begg:endg)) ; this%prod100_grc(:) = nan - allocate(this%tot_woodprod_grc(begg:endg)) ; this%tot_woodprod_grc(:) = nan - - allocate(this%dwt_prod10_gain_grc(begg:endg)) ; this%dwt_prod10_gain_grc(:) = nan - allocate(this%dwt_prod100_gain_grc(begg:endg)) ; this%dwt_prod100_gain_grc(:) = nan - allocate(this%dwt_woodprod_gain_grc(begg:endg)) ; this%dwt_woodprod_gain_grc(:) = nan - - allocate(this%dwt_cropprod1_gain_grc(begg:endg)) ; this%dwt_cropprod1_gain_grc(:) = nan - - allocate(this%hrv_deadstem_to_prod10_patch(begp:endp)) ; this%hrv_deadstem_to_prod10_patch(:) = nan - allocate(this%hrv_deadstem_to_prod10_grc(begg:endg)) ; this%hrv_deadstem_to_prod10_grc(:) = nan - - allocate(this%hrv_deadstem_to_prod100_patch(begp:endp)) ; this%hrv_deadstem_to_prod100_patch(:) = nan - allocate(this%hrv_deadstem_to_prod100_grc(begg:endg)) ; this%hrv_deadstem_to_prod100_grc(:) = nan - - allocate(this%grain_to_cropprod1_patch(begp:endp)) ; this%grain_to_cropprod1_patch(:) = nan - allocate(this%grain_to_cropprod1_grc(begg:endg)) ; this%grain_to_cropprod1_grc(:) = nan - - allocate(this%cropprod1_loss_grc(begg:endg)) ; this%cropprod1_loss_grc(:) = nan - allocate(this%prod10_loss_grc(begg:endg)) ; this%prod10_loss_grc(:) = nan - allocate(this%prod100_loss_grc(begg:endg)) ; this%prod100_loss_grc(:) = nan - allocate(this%tot_woodprod_loss_grc(begg:endg)) ; this%tot_woodprod_loss_grc(:) = nan - allocate(this%product_loss_grc(begg:endg)) ; this%product_loss_grc(:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! !USES: - use histFileMod, only : hist_addfld1d - use clm_varcon , only : spval - ! - ! !ARGUMENTS: - class(cn_products_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begg,endg - - character(len=*), parameter :: subname = 'InitHistory' - !----------------------------------------------------------------------- - - begg = bounds%begg - endg = bounds%endg - - this%cropprod1_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('CROPPROD1'), & - units = 'g' // this%species%get_species() // '/m^2', & - avgflag = 'A', & - long_name = '1-yr grain product ' // this%species%get_species(), & - ptr_gcell = this%cropprod1_grc, default='inactive') - - this%prod10_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('PROD10'), & - units = 'g' // this%species%get_species() // '/m^2', & - avgflag = 'A', & - long_name = '10-yr wood product ' // this%species%get_species(), & - ptr_gcell = this%prod10_grc, default='inactive') - - this%prod100_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('PROD100'), & - units = 'g' // this%species%get_species() // '/m^2', & - avgflag = 'A', & - long_name = '100-yr wood product ' // this%species%get_species(), & - ptr_gcell = this%prod100_grc, default='inactive') - - this%tot_woodprod_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('TOT_WOODPROD'), & - units = 'g' // this%species%get_species() // '/m^2', & - avgflag = 'A', & - long_name = 'total wood product ' // this%species%get_species(), & - ptr_gcell = this%tot_woodprod_grc, default='inactive') - - this%dwt_prod10_gain_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('DWT_PROD10', suffix='_GAIN'), & - units = 'g' // this%species%get_species() // '/m^2/s', & - avgflag = 'A', & - long_name = 'landcover change-driven addition to 10-yr wood product pool', & - ptr_gcell = this%dwt_prod10_gain_grc, default='inactive') - - this%dwt_prod100_gain_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('DWT_PROD100', suffix='_GAIN'), & - units = 'g' // this%species%get_species() // '/m^2/s', & - avgflag = 'A', & - long_name = 'landcover change-driven addition to 100-yr wood product pool', & - ptr_gcell = this%dwt_prod100_gain_grc, default='inactive') - - this%dwt_woodprod_gain_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('DWT_WOODPROD', suffix='_GAIN'), & - units = 'g' // this%species%get_species() // '/m^2/s', & - avgflag = 'A', & - long_name = 'landcover change-driven addition to wood product pools', & - ptr_gcell = this%dwt_woodprod_gain_grc, default='inactive') - - this%dwt_cropprod1_gain_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('DWT_CROPPROD1', suffix='_GAIN'), & - units = 'g' // this%species%get_species() // '/m^2/s', & - avgflag = 'A', & - long_name = 'landcover change-driven addition to 1-year crop product pool', & - ptr_gcell = this%dwt_cropprod1_gain_grc, default='inactive') - - this%cropprod1_loss_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('CROPPROD1', suffix='_LOSS'), & - units = 'g' // this%species%get_species() // '/m^2/s', & - avgflag = 'A', & - long_name = 'loss from 1-yr grain product pool', & - ptr_gcell = this%cropprod1_loss_grc, default='inactive') - - this%prod10_loss_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('PROD10', suffix='_LOSS'), & - units = 'g' // this%species%get_species() // '/m^2/s', & - avgflag = 'A', & - long_name = 'loss from 10-yr wood product pool', & - ptr_gcell = this%prod10_loss_grc, default='inactive') - - this%prod100_loss_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('PROD100', suffix='_LOSS'), & - units = 'g' // this%species%get_species() // '/m^2/s', & - avgflag = 'A', & - long_name = 'loss from 100-yr wood product pool', & - ptr_gcell = this%prod100_loss_grc, default='inactive') - - this%tot_woodprod_loss_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('TOT_WOODPROD', suffix='_LOSS'), & - units = 'g' // this%species%get_species() // '/m^2/s', & - avgflag = 'A', & - long_name = 'total loss from wood product pools', & - ptr_gcell = this%tot_woodprod_loss_grc, default='inactive') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! !ARGUMENTS: - class(cn_products_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g, p - - character(len=*), parameter :: subname = 'InitCold' - !----------------------------------------------------------------------- - - do g = bounds%begg, bounds%endg - this%cropprod1_grc(g) = 0._r8 - this%prod10_grc(g) = 0._r8 - this%prod100_grc(g) = 0._r8 - this%tot_woodprod_grc(g) = 0._r8 - end do - - ! Need to set these patch-level fluxes to 0 everywhere for the sake of special - ! landunits (because they don't get set over special landunits in the run loop) - do p = bounds%begp, bounds%endp - this%hrv_deadstem_to_prod10_patch(p) = 0._r8 - this%hrv_deadstem_to_prod100_patch(p) = 0._r8 - this%grain_to_cropprod1_patch(p) = 0._r8 - end do - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag, & - template_for_missing_fields, template_multiplier) - ! !USES: - use ncdio_pio , only : file_desc_t, ncd_double - use restUtilMod, only : restartvar, set_missing_from_template, set_grc_field_from_col_field - ! - ! !ARGUMENTS: - class(cn_products_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid - character(len=*), intent(in) :: flag ! 'read' or 'write' - - ! If template_for_missing_fields and template_multiplier are provided, then: When - ! reading the restart file, for any field not present on the restart file, the field - ! in this object is set equal to the corresponding field in - ! template_for_missing_fields times template_multiplier. - ! - ! The Restart routine must have been called on template_for_missing_fields before - ! calling it on this object. - ! - ! (Must provide both template_for_missing_fields and template_multiplier or neither) - class(cn_products_type), optional, intent(in) :: template_for_missing_fields - real(r8), optional, intent(in) :: template_multiplier - - ! - ! !LOCAL VARIABLES: - logical :: template_provided - logical :: readvar - - character(len=*), parameter :: subname = 'Restart' - !----------------------------------------------------------------------- - - if (present(template_for_missing_fields) .and. present(template_multiplier)) then - template_provided = .true. - else if (present(template_for_missing_fields)) then - call endrun(& - msg='template_for_missing_fields provided; must also provide template_multiplier' // & - errMsg(sourcefile, __LINE__)) - else if (present(template_multiplier)) then - call endrun(& - msg='template_multiplier provided; must also provide template_for_missing_fields' // & - errMsg(sourcefile, __LINE__)) - else - template_provided = .false. - end if - - ! NOTE(wjs, 2016-03-29) Adding '_g' suffixes to the end of the restart field names to - ! distinguish these gridcell-level restart fields from the obsolete column-level - ! restart fields that are present on old restart files. - - call restartvar(ncid=ncid, flag=flag, & - varname=this%species%rest_fname('cropprod1', suffix='_g'), & - xtype=ncd_double, dim1name='gridcell', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%cropprod1_grc) - if (flag == 'read' .and. .not. readvar) then - ! BACKWARDS_COMPATIBILITY(wjs, 2016-03-31) If the gridcell-level field isn't - ! present, try to find a column-level field (which may be present on an older - ! restart file). - call set_grc_field_from_col_field( & - bounds = bounds, & - ncid = ncid, & - varname = this%species%rest_fname('cropprod1'), & - data_grc = this%cropprod1_grc, & - readvar = readvar) - - ! If we still haven't found an appropriate field on the restart file, then set - ! this field from the template, if provided - if (.not. readvar .and. template_provided) then - call set_missing_from_template(this%cropprod1_grc, & - template_for_missing_fields%cropprod1_grc, & - multiplier = template_multiplier) - end if - end if - - call restartvar(ncid=ncid, flag=flag, & - varname=this%species%rest_fname('prod10', suffix='_g'), & - xtype=ncd_double, dim1name='gridcell', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%prod10_grc) - if (flag == 'read' .and. .not. readvar) then - ! BACKWARDS_COMPATIBILITY(wjs, 2016-03-31) If the gridcell-level field isn't - ! present, try to find a column-level field (which may be present on an older - ! restart file). - call set_grc_field_from_col_field( & - bounds = bounds, & - ncid = ncid, & - varname = this%species%rest_fname('prod10'), & - data_grc = this%prod10_grc, & - readvar = readvar) - - ! If we still haven't found an appropriate field on the restart file, then set - ! this field from the template, if provided - if (.not. readvar .and. template_provided) then - call set_missing_from_template(this%prod10_grc, & - template_for_missing_fields%prod10_grc, & - multiplier = template_multiplier) - end if - end if - - call restartvar(ncid=ncid, flag=flag, & - varname=this%species%rest_fname('prod100', suffix='_g'), & - xtype=ncd_double, dim1name='gridcell', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%prod100_grc) - if (flag == 'read' .and. .not. readvar) then - ! BACKWARDS_COMPATIBILITY(wjs, 2016-03-31) If the gridcell-level field isn't - ! present, try to find a column-level field (which may be present on an older - ! restart file). - call set_grc_field_from_col_field( & - bounds = bounds, & - ncid = ncid, & - varname = this%species%rest_fname('prod100'), & - data_grc = this%prod100_grc, & - readvar = readvar) - - ! If we still haven't found an appropriate field on the restart file, then set - ! this field from the template, if provided - if (.not. readvar .and. template_provided) then - call set_missing_from_template(this%prod100_grc, & - template_for_missing_fields%prod100_grc, & - multiplier = template_multiplier) - end if - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine UpdateProducts(this, bounds, & - num_soilp, filter_soilp, & - dwt_wood_product_gain_patch, & - wood_harvest_patch, & - dwt_crop_product_gain_patch, & - grain_to_cropprod_patch) - ! - ! !DESCRIPTION: - ! Update all loss fluxes from wood and grain product pools, and update product pool - ! state variables for both loss and gain terms - ! - ! !ARGUMENTS: - class(cn_products_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - - ! dynamic landcover addition to wood product pools (g/m2/s) [patch]; although this is - ! a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), intent(in) :: dwt_wood_product_gain_patch( bounds%begp: ) - - ! wood harvest addition to wood product pools (g/m2/s) [patch] - real(r8), intent(in) :: wood_harvest_patch( bounds%begp: ) - - ! dynamic landcover addition to crop product pools (g/m2/s) [patch]; although this is - ! a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), intent(in) :: dwt_crop_product_gain_patch( bounds%begp: ) - - ! grain to crop product pool (g/m2/s) [patch] - real(r8), intent(in) :: grain_to_cropprod_patch( bounds%begp: ) - ! - ! !LOCAL VARIABLES: - integer :: g ! indices - real(r8) :: dt ! time step (seconds) - real(r8) :: kprod1 ! decay constant for 1-year product pool - real(r8) :: kprod10 ! decay constant for 10-year product pool - real(r8) :: kprod100 ! decay constant for 100-year product pool - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(dwt_wood_product_gain_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(wood_harvest_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dwt_crop_product_gain_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(grain_to_cropprod_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - call this%PartitionWoodFluxes(bounds, & - num_soilp, filter_soilp, & - dwt_wood_product_gain_patch(bounds%begp:bounds%endp), & - wood_harvest_patch(bounds%begp:bounds%endp)) - - call this%PartitionGrainFluxes(bounds, & - num_soilp, filter_soilp, & - dwt_crop_product_gain_patch(bounds%begp:bounds%endp), & - grain_to_cropprod_patch(bounds%begp:bounds%endp)) - - ! calculate losses from product pools - ! the following (1/s) rate constants result in ~90% loss of initial state over 1, 10 and 100 years, - ! respectively, using a discrete-time fractional decay algorithm. - kprod1 = 7.2e-8 - kprod10 = 7.2e-9 - kprod100 = 7.2e-10 - - do g = bounds%begg, bounds%endg - ! calculate fluxes out of product pools (1/sec) - this%cropprod1_loss_grc(g) = this%cropprod1_grc(g) * kprod1 - this%prod10_loss_grc(g) = this%prod10_grc(g) * kprod10 - this%prod100_loss_grc(g) = this%prod100_grc(g) * kprod100 - end do - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! update product state variables - do g = bounds%begg, bounds%endg - - ! fluxes into wood & grain product pools, from landcover change - this%cropprod1_grc(g) = this%cropprod1_grc(g) + this%dwt_cropprod1_gain_grc(g)*dt - this%prod10_grc(g) = this%prod10_grc(g) + this%dwt_prod10_gain_grc(g)*dt - this%prod100_grc(g) = this%prod100_grc(g) + this%dwt_prod100_gain_grc(g)*dt - - ! fluxes into wood & grain product pools, from harvest - this%cropprod1_grc(g) = this%cropprod1_grc(g) + this%grain_to_cropprod1_grc(g)*dt - this%prod10_grc(g) = this%prod10_grc(g) + this%hrv_deadstem_to_prod10_grc(g)*dt - this%prod100_grc(g) = this%prod100_grc(g) + this%hrv_deadstem_to_prod100_grc(g)*dt - - ! fluxes out of wood & grain product pools, from decomposition - this%cropprod1_grc(g) = this%cropprod1_grc(g) - this%cropprod1_loss_grc(g)*dt - this%prod10_grc(g) = this%prod10_grc(g) - this%prod10_loss_grc(g)*dt - this%prod100_grc(g) = this%prod100_grc(g) - this%prod100_loss_grc(g)*dt - - end do - - call this%ComputeSummaryVars(bounds) - - end subroutine UpdateProducts - - !----------------------------------------------------------------------- - subroutine PartitionWoodFluxes(this, bounds, & - num_soilp, filter_soilp, & - dwt_wood_product_gain_patch, & - wood_harvest_patch) - ! - ! !DESCRIPTION: - ! Partition input wood fluxes into 10 and 100 year product pools - ! - ! !USES: - use pftconMod , only : pftcon - use subgridAveMod, only : p2g - ! - ! !ARGUMENTS: - class(cn_products_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - - ! dynamic landcover addition to wood product pools (g/m2/s) [patch]; although this is - ! a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), intent(in) :: dwt_wood_product_gain_patch( bounds%begp: ) - - ! wood harvest addition to wood product pools (g/m2/s) [patch] - real(r8), intent(in) :: wood_harvest_patch( bounds%begp: ) - - ! - ! !LOCAL VARIABLES: - integer :: fp - integer :: p - integer :: g - real(r8) :: pprod10 ! PFT proportion of deadstem to 10-year product pool - real(r8) :: pprod100 ! PFT proportion of deadstem to 100-year product pool - real(r8) :: pprod_tot ! PFT proportion of deadstem to any product pool - real(r8) :: pprod10_frac ! PFT fraction of deadstem to product pool that goes to 10-year product pool - real(r8) :: pprod100_frac ! PFT fraction of deadstem to product pool that goes to 100-year product pool - - character(len=*), parameter :: subname = 'PartitionWoodFluxes' - !----------------------------------------------------------------------- - - ! Partition patch-level harvest fluxes to 10 and 100-year product pools - do fp = 1, num_soilp - p = filter_soilp(fp) - this%hrv_deadstem_to_prod10_patch(p) = & - wood_harvest_patch(p) * pftcon%pprodharv10(patch%itype(p)) - this%hrv_deadstem_to_prod100_patch(p) = & - wood_harvest_patch(p) * (1.0_r8 - pftcon%pprodharv10(patch%itype(p))) - end do - - ! Average harvest fluxes from patch to gridcell - call p2g(bounds, & - this%hrv_deadstem_to_prod10_patch(bounds%begp:bounds%endp), & - this%hrv_deadstem_to_prod10_grc(bounds%begg:bounds%endg), & - p2c_scale_type = 'unity', & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - - call p2g(bounds, & - this%hrv_deadstem_to_prod100_patch(bounds%begp:bounds%endp), & - this%hrv_deadstem_to_prod100_grc(bounds%begg:bounds%endg), & - p2c_scale_type = 'unity', & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - - ! Zero the dwt gains - do g = bounds%begg, bounds%endg - this%dwt_prod10_gain_grc(g) = 0._r8 - this%dwt_prod100_gain_grc(g) = 0._r8 - end do - - ! Partition dynamic land cover fluxes to 10 and 100-year product pools. - do p = bounds%begp, bounds%endp - g = patch%gridcell(p) - - ! Note that pprod10 + pprod100 do NOT sum to 1: some fraction of the dwt changes - ! was lost to other fluxes. dwt_wood_product_gain_patch gives the amount that goes - ! to all product pools, so we need to determine the fraction of that flux that - ! goes to each pool. - pprod10 = pftcon%pprod10(patch%itype(p)) - pprod100 = pftcon%pprod100(patch%itype(p)) - pprod_tot = pprod10 + pprod100 - if (pprod_tot > 0) then - pprod10_frac = pprod10 / pprod_tot - pprod100_frac = pprod100 / pprod_tot - else - ! Avoid divide by 0 - pprod10_frac = 0._r8 - pprod100_frac = 0._r8 - end if - - ! Note that the patch-level fluxes are expressed per unit gridcell area. So, to go - ! from patch-level fluxes to gridcell-level fluxes, we simply add up the various - ! patch contributions, without having to multiply by any area weightings. - this%dwt_prod10_gain_grc(g) = this%dwt_prod10_gain_grc(g) + & - dwt_wood_product_gain_patch(p) * pprod10_frac - this%dwt_prod100_gain_grc(g) = this%dwt_prod100_gain_grc(g) + & - dwt_wood_product_gain_patch(p) * pprod100_frac - end do - - end subroutine PartitionWoodFluxes - - !----------------------------------------------------------------------- - subroutine PartitionGrainFluxes(this, bounds, & - num_soilp, filter_soilp, & - dwt_crop_product_gain_patch, & - grain_to_cropprod_patch) - ! - ! !DESCRIPTION: - ! Partition input grain fluxes into crop product pools - ! - ! For now this doesn't do much, since there is just a single (1-year) crop product - ! pool. But this provides the capability to add different crop product pools in the - ! future, without requiring any changes to code outside of this class. It also gives - ! symmetry with the wood fluxes. - ! - ! !USES: - use subgridAveMod, only : p2g - ! - ! !ARGUMENTS: - class(cn_products_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - - ! dynamic landcover addition to crop product pool (g/m2/s) [patch]; although this is - ! a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), intent(in) :: dwt_crop_product_gain_patch( bounds%begp: ) - - ! grain to crop product pool(s) (g/m2/s) [patch] - real(r8) , intent(in) :: grain_to_cropprod_patch( bounds%begp: ) - ! - ! !LOCAL VARIABLES: - integer :: fp - integer :: p - integer :: g - - character(len=*), parameter :: subname = 'PartitionGrainFluxes' - !----------------------------------------------------------------------- - - ! Determine gains from crop harvest - - do fp = 1, num_soilp - p = filter_soilp(fp) - - ! For now all crop product is put in the 1-year crop product pool - this%grain_to_cropprod1_patch(p) = grain_to_cropprod_patch(p) - end do - - call p2g(bounds, & - this%grain_to_cropprod1_patch(bounds%begp:bounds%endp), & - this%grain_to_cropprod1_grc(bounds%begg:bounds%endg), & - p2c_scale_type = 'unity', & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - - ! Determine gains from dynamic landcover - - do g = bounds%begg, bounds%endg - this%dwt_cropprod1_gain_grc(g) = 0._r8 - end do - - do p = bounds%begp, bounds%endp - g = patch%gridcell(p) - - ! Note that the patch-level fluxes are expressed per unit gridcell area. So, to go - ! from patch-level fluxes to gridcell-level fluxes, we simply add up the various - ! patch contributions, without having to multiply by any area weightings. - this%dwt_cropprod1_gain_grc(g) = this%dwt_cropprod1_gain_grc(g) + & - dwt_crop_product_gain_patch(p) - end do - - end subroutine PartitionGrainFluxes - - - !----------------------------------------------------------------------- - subroutine ComputeSummaryVars(this, bounds) - ! - ! !DESCRIPTION: - ! Compute summary variables in this object: sums across multiple product pools - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_products_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g ! indices - - character(len=*), parameter :: subname = 'ComputeSummaryVars' - !----------------------------------------------------------------------- - - do g = bounds%begg, bounds%endg - - ! total wood products - this%tot_woodprod_grc(g) = & - this%prod10_grc(g) + & - this%prod100_grc(g) - - ! total loss from wood products - this%tot_woodprod_loss_grc(g) = & - this%prod10_loss_grc(g) + & - this%prod100_loss_grc(g) - - ! total loss from ALL products - this%product_loss_grc(g) = & - this%cropprod1_loss_grc(g) + & - this%prod10_loss_grc(g) + & - this%prod100_loss_grc(g) - - this%dwt_woodprod_gain_grc(g) = & - this%dwt_prod100_gain_grc(g) + & - this%dwt_prod10_gain_grc(g) - end do - - end subroutine ComputeSummaryVars - - -end module CNProductsMod diff --git a/src/biogeochem/CNSharedParamsMod.F90 b/src/biogeochem/CNSharedParamsMod.F90 deleted file mode 100644 index 42156b1158..0000000000 --- a/src/biogeochem/CNSharedParamsMod.F90 +++ /dev/null @@ -1,192 +0,0 @@ -module CNSharedParamsMod - - !----------------------------------------------------------------------- - ! - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - implicit none - - ! CNParamsShareInst. PGI wants the type decl. public but the instance - ! is indeed protected. A generic private statement at the start of the module - ! overrides the protected functionality with PGI - - type, public :: CNParamsShareType - real(r8) :: Q10 ! temperature dependence - real(r8) :: minpsi ! minimum soil water potential for heterotrophic resp - real(r8) :: cwd_fcel ! cellulose fraction of coarse woody debris - real(r8) :: cwd_flig ! lignin fraction of coarse woody debris - real(r8) :: froz_q10 ! separate q10 for frozen soil respiration rates - real(r8) :: decomp_depth_efolding ! e-folding depth for reduction in decomposition (m) - real(r8) :: mino2lim ! minimum anaerobic decomposition rate as a fraction of potential aerobic rate - real(r8) :: organic_max ! organic matter content (kg/m3) where soil is assumed to act like peat - logical :: constrain_stress_deciduous_onset ! if true use additional constraint on stress deciduous onset trigger - end type CNParamsShareType - - type(CNParamsShareType), protected :: CNParamsShareInst - - logical, public :: anoxia_wtsat = .false. - logical, public :: use_fun = .false. ! Use the FUN2.0 model - integer, public :: nlev_soildecomp_standard = 5 - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CNParamsReadShared(ncid, namelist_file) - - use ncdio_pio , only : file_desc_t - - type(file_desc_t), intent(inout) :: ncid ! pio netCDF file id - character(len=*), intent(in) :: namelist_file - - call CNParamsReadShared_netcdf(ncid) - call CNParamsReadShared_namelist(namelist_file) - - end subroutine CNParamsReadShared - - !----------------------------------------------------------------------- - subroutine CNParamsReadShared_netcdf(ncid) - ! - use ncdio_pio , only : file_desc_t, ncd_io - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - ! - implicit none - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - character(len=32) :: subname = 'CNParamsReadShared' - character(len=100) :: errCode = '-Error reading in CN and BGC shared params file. Var:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in parameter - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - ! - ! netcdf read here - ! - tString='q10_mr' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - CNParamsShareInst%Q10=tempr - - tString='minpsi_hr' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - CNParamsShareInst%minpsi=tempr - - tString='cwd_fcel' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - CNParamsShareInst%cwd_fcel=tempr - - tString='cwd_flig' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - CNParamsShareInst%cwd_flig=tempr - - tString='froz_q10' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - CNParamsShareInst%froz_q10=tempr - - tString='mino2lim' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - CNParamsShareInst%mino2lim=tempr - !CNParamsShareInst%mino2lim=0.2_r8 - - tString='organic_max' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - CNParamsShareInst%organic_max=tempr - - end subroutine CNParamsReadShared_netcdf - - !----------------------------------------------------------------------- - subroutine CNParamsReadShared_namelist(namelist_file) - ! - ! !DESCRIPTION: - ! Read and initialize CN Shared parameteres from the namelist. - ! - ! !USES: - use fileutils , only : relavu, getavu - use spmdMod , only : masterproc, mpicom, MPI_REAL8, MPI_LOGICAL - use shr_nl_mod , only : shr_nl_find_group_name - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog - use abortutils , only : endrun - use shr_mpi_mod , only : shr_mpi_bcast - - ! - implicit none - ! - - character(len=*), intent(in) :: namelist_file - - integer :: i,j,n ! loop indices - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - real(r8) :: decomp_depth_efolding = 0.0_r8 - logical :: constrain_stress_deciduous_onset = .false. - - character(len=32) :: subroutine_name = 'CNParamsReadNamelist' - character(len=10) :: namelist_group = 'bgc_shared' - - !----------------------------------------------------------------------- - - ! ---------------------------------------------------------------------- - ! Namelist Variables - ! ---------------------------------------------------------------------- - - namelist /bgc_shared/ & - decomp_depth_efolding, & - constrain_stress_deciduous_onset - - - ! Read namelist from standard input. - if (masterproc) then - - write(iulog,*) 'Attempting to read CN/BGC shared namelist parameters .....' - unitn = getavu() - write(iulog,*) 'Read in ' // namelist_group // ' namelist from: ', trim(namelist_file) - open( unitn, file=trim(namelist_file), status='old' ) - call shr_nl_find_group_name(unitn, namelist_group, status=ierr) - if (ierr == 0) then - read(unitn, bgc_shared, iostat=ierr) - if (ierr /= 0) then - call endrun(msg='error in reading in ' // namelist_group // ' namelist' // & - errMsg(sourcefile, __LINE__)) - end if - else - call endrun(msg='error in finding ' // namelist_group // ' namelist' // & - errMsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - - end if ! masterproc - - ! Broadcast the parameters from master - call shr_mpi_bcast ( decomp_depth_efolding, mpicom ) - call shr_mpi_bcast ( constrain_stress_deciduous_onset, mpicom ) - - ! Save the parameter to the instance - CNParamsShareInst%decomp_depth_efolding = decomp_depth_efolding - CNParamsShareInst%constrain_stress_deciduous_onset = constrain_stress_deciduous_onset - - ! Output read parameters to the lnd.log - if (masterproc) then - write(iulog,*) 'CN/BGC shared namelist parameters:' - write(iulog,*)' ' - write(iulog,*)' decomp_depth_efolding = ', decomp_depth_efolding - write(iulog,*)' constrain_stress_deciduous_onset = ',constrain_stress_deciduous_onset - - write(iulog,*) - - end if - - end subroutine CNParamsReadShared_namelist - -end module CNSharedParamsMod diff --git a/src/biogeochem/CNSpeciesMod.F90 b/src/biogeochem/CNSpeciesMod.F90 deleted file mode 100644 index fc89f3ac02..0000000000 --- a/src/biogeochem/CNSpeciesMod.F90 +++ /dev/null @@ -1,68 +0,0 @@ -module CNSpeciesMod - - !----------------------------------------------------------------------- - ! Module holding information about different species available in the CN code (C, C13, - ! C14, N). - ! - ! - ! NOTE(wjs, 2016-06-05) Eventually I could imagine having a cn_species base class, with - ! derived classes for each species type - so a cn_species_c class, a cn_species_c13 - ! class, a cn_species_c14 class and a cn_species_n class. These would contain methods - ! to handle calculations specific to each species type. For example, there could be a - ! carbon_multiplier method that returns the species-specific multiplier that you would - ! apply to a variable in units of gC/m2 to give you g[this species]/m2 (this would - ! depend on pft type). - ! - ! Basically, anywhere where there is code that has a conditional based on the constants - ! defined here, we could replace that with polymorphism using a cn_species class. - ! - ! Eventually I think it would make sense to make this contain an instance of - ! species_base_type (i.e., the class used to determine history & restart field names), - ! with forwarding methods. So then (e.g.) a cn_products_type object would just contain a - ! cn_species object (which in turn would contain a species_metadata [or whatever we call - ! it] object). - - implicit none - private - - integer, parameter, public :: CN_SPECIES_C12 = 1 - integer, parameter, public :: CN_SPECIES_C13 = 2 - integer, parameter, public :: CN_SPECIES_C14 = 3 - integer, parameter, public :: CN_SPECIES_N = 4 - - public :: species_from_string ! convert a string representation to one of the constants defined here - -contains - - !----------------------------------------------------------------------- - function species_from_string(species_string) result(species) - ! - ! !DESCRIPTION: - ! Convert a string representation to one of the constants defined here - ! - ! !USES: - ! - ! !ARGUMENTS: - integer :: species ! function result - character(len=*), intent(in) :: species_string ! string representation of species (should be lowercase) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'species_from_string' - !----------------------------------------------------------------------- - - select case (species_string) - case ('c12') - species = CN_SPECIES_C12 - case ('c13') - species = CN_SPECIES_C13 - case ('c14') - species = CN_SPECIES_C14 - case ('n') - species = CN_SPECIES_N - end select - - end function species_from_string - - -end module CNSpeciesMod diff --git a/src/biogeochem/CNVegCarbonFluxType.F90 b/src/biogeochem/CNVegCarbonFluxType.F90 deleted file mode 100644 index 3fa76b3af2..0000000000 --- a/src/biogeochem/CNVegCarbonFluxType.F90 +++ /dev/null @@ -1,3891 +0,0 @@ -module CNVegCarbonFluxType - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools - use clm_varpar , only : nlevdecomp_full, nlevgrnd, nlevdecomp - use clm_varcon , only : spval, dzsoi_decomp - use clm_varctl , only : use_cndv, use_nitrif_denitrif, use_crop - use clm_varctl , only : use_grainproduct - use clm_varctl , only : iulog - use landunit_varcon , only : istsoil, istcrop, istdlak - use pftconMod , only : npcropmin - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use abortutils , only : endrun - ! - ! !PUBLIC TYPES: - implicit none - private - ! - type, public :: cnveg_carbonflux_type - - ! gap mortality fluxes - real(r8), pointer :: m_leafc_to_litter_patch (:) ! leaf C mortality (gC/m2/s) - real(r8), pointer :: m_leafc_storage_to_litter_patch (:) ! leaf C storage mortality (gC/m2/s) - real(r8), pointer :: m_leafc_xfer_to_litter_patch (:) ! leaf C transfer mortality (gC/m2/s) - real(r8), pointer :: m_frootc_to_litter_patch (:) ! fine root C mortality (gC/m2/s) - real(r8), pointer :: m_frootc_storage_to_litter_patch (:) ! fine root C storage mortality (gC/m2/s) - real(r8), pointer :: m_frootc_xfer_to_litter_patch (:) ! fine root C transfer mortality (gC/m2/s) - real(r8), pointer :: m_livestemc_to_litter_patch (:) ! live stem C mortality (gC/m2/s) - real(r8), pointer :: m_livestemc_storage_to_litter_patch (:) ! live stem C storage mortality (gC/m2/s) - real(r8), pointer :: m_livestemc_xfer_to_litter_patch (:) ! live stem C transfer mortality (gC/m2/s) - real(r8), pointer :: m_deadstemc_to_litter_patch (:) ! dead stem C mortality (gC/m2/s) - real(r8), pointer :: m_deadstemc_storage_to_litter_patch (:) ! dead stem C storage mortality (gC/m2/s) - real(r8), pointer :: m_deadstemc_xfer_to_litter_patch (:) ! dead stem C transfer mortality (gC/m2/s) - real(r8), pointer :: m_livecrootc_to_litter_patch (:) ! live coarse root C mortality (gC/m2/s) - real(r8), pointer :: m_livecrootc_storage_to_litter_patch (:) ! live coarse root C storage mortality (gC/m2/s) - real(r8), pointer :: m_livecrootc_xfer_to_litter_patch (:) ! live coarse root C transfer mortality (gC/m2/s) - real(r8), pointer :: m_deadcrootc_to_litter_patch (:) ! dead coarse root C mortality (gC/m2/s) - real(r8), pointer :: m_deadcrootc_storage_to_litter_patch (:) ! dead coarse root C storage mortality (gC/m2/s) - real(r8), pointer :: m_deadcrootc_xfer_to_litter_patch (:) ! dead coarse root C transfer mortality (gC/m2/s) - real(r8), pointer :: m_gresp_storage_to_litter_patch (:) ! growth respiration storage mortality (gC/m2/s) - real(r8), pointer :: m_gresp_xfer_to_litter_patch (:) ! growth respiration transfer mortality (gC/m2/s) - - ! harvest mortality fluxes - real(r8), pointer :: hrv_leafc_to_litter_patch (:) ! leaf C harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_leafc_storage_to_litter_patch (:) ! leaf C storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_leafc_xfer_to_litter_patch (:) ! leaf C transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_frootc_to_litter_patch (:) ! fine root C harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_frootc_storage_to_litter_patch (:) ! fine root C storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_frootc_xfer_to_litter_patch (:) ! fine root C transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_livestemc_to_litter_patch (:) ! live stem C harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_livestemc_storage_to_litter_patch (:) ! live stem C storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_livestemc_xfer_to_litter_patch (:) ! live stem C transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_deadstemc_storage_to_litter_patch (:) ! dead stem C storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_deadstemc_xfer_to_litter_patch (:) ! dead stem C transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_livecrootc_to_litter_patch (:) ! live coarse root C harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_livecrootc_storage_to_litter_patch (:) ! live coarse root C storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_livecrootc_xfer_to_litter_patch (:) ! live coarse root C transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_deadcrootc_to_litter_patch (:) ! dead coarse root C harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_deadcrootc_storage_to_litter_patch (:) ! dead coarse root C storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_deadcrootc_xfer_to_litter_patch (:) ! dead coarse root C transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_gresp_storage_to_litter_patch (:) ! growth respiration storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_gresp_xfer_to_litter_patch (:) ! growth respiration transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_xsmrpool_to_atm_patch (:) ! excess MR pool harvest mortality (gC/m2/s) - - ! fire fluxes - real(r8), pointer :: m_leafc_to_fire_patch (:) ! (gC/m2/s) fire C emissions from leafc - real(r8), pointer :: m_leafc_storage_to_fire_patch (:) ! (gC/m2/s) fire C emissions from leafc_storage - real(r8), pointer :: m_leafc_xfer_to_fire_patch (:) ! (gC/m2/s) fire C emissions from leafc_xfer - real(r8), pointer :: m_livestemc_to_fire_patch (:) ! (gC/m2/s) fire C emissions from livestemc - real(r8), pointer :: m_livestemc_storage_to_fire_patch (:) ! (gC/m2/s) fire C emissions from livestemc_storage - real(r8), pointer :: m_livestemc_xfer_to_fire_patch (:) ! (gC/m2/s) fire C emissions from livestemc_xfer - real(r8), pointer :: m_deadstemc_to_fire_patch (:) ! (gC/m2/s) fire C emissions from deadstemc_xfer - real(r8), pointer :: m_deadstemc_storage_to_fire_patch (:) ! (gC/m2/s) fire C emissions from deadstemc_storage - real(r8), pointer :: m_deadstemc_xfer_to_fire_patch (:) ! (gC/m2/s) fire C emissions from deadstemc_xfer - real(r8), pointer :: m_frootc_to_fire_patch (:) ! (gC/m2/s) fire C emissions from frootc - real(r8), pointer :: m_frootc_storage_to_fire_patch (:) ! (gC/m2/s) fire C emissions from frootc_storage - real(r8), pointer :: m_frootc_xfer_to_fire_patch (:) ! (gC/m2/s) fire C emissions from frootc_xfer - real(r8), pointer :: m_livecrootc_to_fire_patch (:) ! (gC/m2/s) fire C emissions from livecrootc - real(r8), pointer :: m_livecrootc_storage_to_fire_patch (:) ! (gC/m2/s) fire C emissions from livecrootc_storage - real(r8), pointer :: m_livecrootc_xfer_to_fire_patch (:) ! (gC/m2/s) fire C emissions from livecrootc_xfer - real(r8), pointer :: m_deadcrootc_to_fire_patch (:) ! (gC/m2/s) fire C emissions from deadcrootc - real(r8), pointer :: m_deadcrootc_storage_to_fire_patch (:) ! (gC/m2/s) fire C emissions from deadcrootc_storage - real(r8), pointer :: m_deadcrootc_xfer_to_fire_patch (:) ! (gC/m2/s) fire C emissions from deadcrootc_xfer - real(r8), pointer :: m_gresp_storage_to_fire_patch (:) ! (gC/m2/s) fire C emissions from gresp_storage - real(r8), pointer :: m_gresp_xfer_to_fire_patch (:) ! (gC/m2/s) fire C emissions from gresp_xfer - real(r8), pointer :: m_leafc_to_litter_fire_patch (:) ! (gC/m2/s) from leafc to litter c due to fire - real(r8), pointer :: m_leafc_storage_to_litter_fire_patch (:) ! (gC/m2/s) from leafc_storage to litter C due to fire - real(r8), pointer :: m_leafc_xfer_to_litter_fire_patch (:) ! (gC/m2/s) from leafc_xfer to litter C due to fire - real(r8), pointer :: m_livestemc_to_litter_fire_patch (:) ! (gC/m2/s) from livestemc to litter C due to fire - real(r8), pointer :: m_livestemc_storage_to_litter_fire_patch (:) ! (gC/m2/s) from livestemc_storage to litter C due to fire - real(r8), pointer :: m_livestemc_xfer_to_litter_fire_patch (:) ! (gC/m2/s) from livestemc_xfer to litter C due to fire - real(r8), pointer :: m_livestemc_to_deadstemc_fire_patch (:) ! (gC/m2/s) from livestemc to deadstemc due to fire - real(r8), pointer :: m_deadstemc_to_litter_fire_patch (:) ! (gC/m2/s) from deadstemc to litter C due to fire - real(r8), pointer :: m_deadstemc_storage_to_litter_fire_patch (:) ! (gC/m2/s) from deadstemc_storage to litter C due to fire - real(r8), pointer :: m_deadstemc_xfer_to_litter_fire_patch (:) ! (gC/m2/s) from deadstemc_xfer to litter C due to fire - real(r8), pointer :: m_frootc_to_litter_fire_patch (:) ! (gC/m2/s) from frootc to litter C due to fire - real(r8), pointer :: m_frootc_storage_to_litter_fire_patch (:) ! (gC/m2/s) from frootc_storage to litter C due to fire - real(r8), pointer :: m_frootc_xfer_to_litter_fire_patch (:) ! (gC/m2/s) from frootc_xfer to litter C due to fire - real(r8), pointer :: m_livecrootc_to_litter_fire_patch (:) ! (gC/m2/s) from livecrootc to litter C due to fire - real(r8), pointer :: m_livecrootc_storage_to_litter_fire_patch (:) ! (gC/m2/s) from livecrootc_storage to litter C due to fire - real(r8), pointer :: m_livecrootc_xfer_to_litter_fire_patch (:) ! (gC/m2/s) from livecrootc_xfer to litter C due to fire - real(r8), pointer :: m_livecrootc_to_deadcrootc_fire_patch (:) ! (gC/m2/s) from livecrootc to deadstemc due to fire - real(r8), pointer :: m_deadcrootc_to_litter_fire_patch (:) ! (gC/m2/s) from deadcrootc to litter C due to fire - real(r8), pointer :: m_deadcrootc_storage_to_litter_fire_patch (:) ! (gC/m2/s) from deadcrootc_storage to litter C due to fire - real(r8), pointer :: m_deadcrootc_xfer_to_litter_fire_patch (:) ! (gC/m2/s) from deadcrootc_xfer to litter C due to fire - real(r8), pointer :: m_gresp_storage_to_litter_fire_patch (:) ! (gC/m2/s) from gresp_storage to litter C due to fire - real(r8), pointer :: m_gresp_xfer_to_litter_fire_patch (:) ! (gC/m2/s) from gresp_xfer to litter C due to fire - - ! phenology fluxes from transfer pools - real(r8), pointer :: grainc_xfer_to_grainc_patch (:) ! grain C growth from storage for prognostic crop(gC/m2/s) - real(r8), pointer :: leafc_xfer_to_leafc_patch (:) ! leaf C growth from storage (gC/m2/s) - real(r8), pointer :: frootc_xfer_to_frootc_patch (:) ! fine root C growth from storage (gC/m2/s) - real(r8), pointer :: livestemc_xfer_to_livestemc_patch (:) ! live stem C growth from storage (gC/m2/s) - real(r8), pointer :: deadstemc_xfer_to_deadstemc_patch (:) ! dead stem C growth from storage (gC/m2/s) - real(r8), pointer :: livecrootc_xfer_to_livecrootc_patch (:) ! live coarse root C growth from storage (gC/m2/s) - real(r8), pointer :: deadcrootc_xfer_to_deadcrootc_patch (:) ! dead coarse root C growth from storage (gC/m2/s) - - ! leaf and fine root litterfall fluxes - real(r8), pointer :: leafc_to_litter_patch (:) ! leaf C litterfall (gC/m2/s) - real(r8), pointer :: leafc_to_litter_fun_patch (:) ! leaf C litterfall used by FUN (gC/m2/s) - real(r8), pointer :: frootc_to_litter_patch (:) ! fine root C litterfall (gC/m2/s) - real(r8), pointer :: livestemc_to_litter_patch (:) ! live stem C litterfall (gC/m2/s) - real(r8), pointer :: grainc_to_food_patch (:) ! grain C to food for prognostic crop(gC/m2/s) - real(r8), pointer :: grainc_to_seed_patch (:) ! grain C to seed for prognostic crop(gC/m2/s) - - ! maintenance respiration fluxes - real(r8), pointer :: cpool_to_resp_patch (:) ! CNflex excess C maintenance respiration (gC/m2/s) - real(r8), pointer :: cpool_to_leafc_resp_patch (:) ! CNflex excess C maintenance respiration (gC/m2/s) - real(r8), pointer :: cpool_to_leafc_storage_resp_patch (:) ! CNflex excess C maintenance respiration (gC/m2/s) - real(r8), pointer :: cpool_to_frootc_resp_patch (:) ! CNflex excess C maintenance respiration (gC/m2/s) - real(r8), pointer :: cpool_to_frootc_storage_resp_patch (:) ! CNflex excess C maintenance respiration (gC/m2/s) - real(r8), pointer :: cpool_to_livecrootc_resp_patch (:) ! CNflex excess C maintenance respiration (gC/m2/s) - real(r8), pointer :: cpool_to_livecrootc_storage_resp_patch (:) ! CNflex excess C maintenance respiration (gC/m2/s) - real(r8), pointer :: cpool_to_livestemc_resp_patch (:) ! CNflex excess C maintenance respiration (gC/m2/s) - real(r8), pointer :: cpool_to_livestemc_storage_resp_patch (:) ! CNflex excess C maintenance respiration (gC/m2/s) - real(r8), pointer :: leaf_mr_patch (:) ! leaf maintenance respiration (gC/m2/s) - real(r8), pointer :: froot_mr_patch (:) ! fine root maintenance respiration (gC/m2/s) - real(r8), pointer :: livestem_mr_patch (:) ! live stem maintenance respiration (gC/m2/s) - real(r8), pointer :: livecroot_mr_patch (:) ! live coarse root maintenance respiration (gC/m2/s) - real(r8), pointer :: grain_mr_patch (:) ! crop grain or organs maint. respiration (gC/m2/s) - real(r8), pointer :: leaf_curmr_patch (:) ! leaf maintenance respiration from current GPP (gC/m2/s) - real(r8), pointer :: froot_curmr_patch (:) ! fine root maintenance respiration from current GPP (gC/m2/s) - real(r8), pointer :: livestem_curmr_patch (:) ! live stem maintenance respiration from current GPP (gC/m2/s) - real(r8), pointer :: livecroot_curmr_patch (:) ! live coarse root maintenance respiration from current GPP (gC/m2/s) - real(r8), pointer :: grain_curmr_patch (:) ! crop grain or organs maint. respiration from current GPP (gC/m2/s) - real(r8), pointer :: leaf_xsmr_patch (:) ! leaf maintenance respiration from storage (gC/m2/s) - real(r8), pointer :: froot_xsmr_patch (:) ! fine root maintenance respiration from storage (gC/m2/s) - real(r8), pointer :: livestem_xsmr_patch (:) ! live stem maintenance respiration from storage (gC/m2/s) - real(r8), pointer :: livecroot_xsmr_patch (:) ! live coarse root maintenance respiration from storage (gC/m2/s) - real(r8), pointer :: grain_xsmr_patch (:) ! crop grain or organs maint. respiration from storage (gC/m2/s) - - ! photosynthesis fluxes - real(r8), pointer :: psnsun_to_cpool_patch (:) ! C fixation from sunlit canopy (gC/m2/s) - real(r8), pointer :: psnshade_to_cpool_patch (:) ! C fixation from shaded canopy (gC/m2/s) - - ! allocation fluxes, from current GPP - real(r8), pointer :: cpool_to_xsmrpool_patch (:) ! allocation to maintenance respiration storage pool (gC/m2/s) - real(r8), pointer :: cpool_to_grainc_patch (:) ! allocation to grain C for prognostic crop(gC/m2/s) - real(r8), pointer :: cpool_to_grainc_storage_patch (:) ! allocation to grain C storage for prognostic crop(gC/m2/s) - real(r8), pointer :: cpool_to_leafc_patch (:) ! allocation to leaf C (gC/m2/s) - real(r8), pointer :: cpool_to_leafc_storage_patch (:) ! allocation to leaf C storage (gC/m2/s) - real(r8), pointer :: cpool_to_frootc_patch (:) ! allocation to fine root C (gC/m2/s) - real(r8), pointer :: cpool_to_frootc_storage_patch (:) ! allocation to fine root C storage (gC/m2/s) - real(r8), pointer :: cpool_to_livestemc_patch (:) ! allocation to live stem C (gC/m2/s) - real(r8), pointer :: cpool_to_livestemc_storage_patch (:) ! allocation to live stem C storage (gC/m2/s) - real(r8), pointer :: cpool_to_deadstemc_patch (:) ! allocation to dead stem C (gC/m2/s) - real(r8), pointer :: cpool_to_deadstemc_storage_patch (:) ! allocation to dead stem C storage (gC/m2/s) - real(r8), pointer :: cpool_to_livecrootc_patch (:) ! allocation to live coarse root C (gC/m2/s) - real(r8), pointer :: cpool_to_livecrootc_storage_patch (:) ! allocation to live coarse root C storage (gC/m2/s) - real(r8), pointer :: cpool_to_deadcrootc_patch (:) ! allocation to dead coarse root C (gC/m2/s) - real(r8), pointer :: cpool_to_deadcrootc_storage_patch (:) ! allocation to dead coarse root C storage (gC/m2/s) - real(r8), pointer :: cpool_to_gresp_storage_patch (:) ! allocation to growth respiration storage (gC/m2/s) - - ! growth respiration fluxes - real(r8), pointer :: xsmrpool_to_atm_patch (:) ! excess MR pool harvest mortality (gC/m2/s) - real(r8), pointer :: cpool_leaf_gr_patch (:) ! leaf growth respiration (gC/m2/s) - real(r8), pointer :: cpool_leaf_storage_gr_patch (:) ! leaf growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_leaf_gr_patch (:) ! leaf growth respiration from storage (gC/m2/s) - real(r8), pointer :: cpool_froot_gr_patch (:) ! fine root growth respiration (gC/m2/s) - real(r8), pointer :: cpool_froot_storage_gr_patch (:) ! fine root growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_froot_gr_patch (:) ! fine root growth respiration from storage (gC/m2/s) - real(r8), pointer :: cpool_livestem_gr_patch (:) ! live stem growth respiration (gC/m2/s) - real(r8), pointer :: cpool_livestem_storage_gr_patch (:) ! live stem growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_livestem_gr_patch (:) ! live stem growth respiration from storage (gC/m2/s) - real(r8), pointer :: cpool_deadstem_gr_patch (:) ! dead stem growth respiration (gC/m2/s) - real(r8), pointer :: cpool_deadstem_storage_gr_patch (:) ! dead stem growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_deadstem_gr_patch (:) ! dead stem growth respiration from storage (gC/m2/s) - real(r8), pointer :: cpool_livecroot_gr_patch (:) ! live coarse root growth respiration (gC/m2/s) - real(r8), pointer :: cpool_livecroot_storage_gr_patch (:) ! live coarse root growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_livecroot_gr_patch (:) ! live coarse root growth respiration from storage (gC/m2/s) - real(r8), pointer :: cpool_deadcroot_gr_patch (:) ! dead coarse root growth respiration (gC/m2/s) - real(r8), pointer :: cpool_deadcroot_storage_gr_patch (:) ! dead coarse root growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_deadcroot_gr_patch (:) ! dead coarse root growth respiration from storage (gC/m2/s) - - ! growth respiration for prognostic crop model - real(r8), pointer :: cpool_grain_gr_patch (:) ! grain growth respiration (gC/m2/s) - real(r8), pointer :: cpool_grain_storage_gr_patch (:) ! grain growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_grain_gr_patch (:) ! grain growth respiration from storage (gC/m2/s) - - ! annual turnover of storage to transfer pools - real(r8), pointer :: grainc_storage_to_xfer_patch (:) ! grain C shift storage to transfer for prognostic crop model (gC/m2/s) - real(r8), pointer :: leafc_storage_to_xfer_patch (:) ! leaf C shift storage to transfer (gC/m2/s) - real(r8), pointer :: frootc_storage_to_xfer_patch (:) ! fine root C shift storage to transfer (gC/m2/s) - real(r8), pointer :: livestemc_storage_to_xfer_patch (:) ! live stem C shift storage to transfer (gC/m2/s) - real(r8), pointer :: deadstemc_storage_to_xfer_patch (:) ! dead stem C shift storage to transfer (gC/m2/s) - real(r8), pointer :: livecrootc_storage_to_xfer_patch (:) ! live coarse root C shift storage to transfer (gC/m2/s) - real(r8), pointer :: deadcrootc_storage_to_xfer_patch (:) ! dead coarse root C shift storage to transfer (gC/m2/s) - real(r8), pointer :: gresp_storage_to_xfer_patch (:) ! growth respiration shift storage to transfer (gC/m2/s) - - ! turnover of livewood to deadwood - real(r8), pointer :: livestemc_to_deadstemc_patch (:) ! live stem C turnover (gC/m2/s) - real(r8), pointer :: livecrootc_to_deadcrootc_patch (:) ! live coarse root C turnover (gC/m2/s) - - ! phenology: litterfall and crop fluxes - real(r8), pointer :: phenology_c_to_litr_met_c_col (:,:) ! C fluxes associated with phenology (litterfall and crop) to litter metabolic pool (gC/m3/s) - real(r8), pointer :: phenology_c_to_litr_cel_c_col (:,:) ! C fluxes associated with phenology (litterfall and crop) to litter cellulose pool (gC/m3/s) - real(r8), pointer :: phenology_c_to_litr_lig_c_col (:,:) ! C fluxes associated with phenology (litterfall and crop) to litter lignin pool (gC/m3/s) - - ! gap mortality - real(r8), pointer :: gap_mortality_c_to_litr_met_c_col (:,:) ! C fluxes associated with gap mortality to litter metabolic pool (gC/m3/s) - real(r8), pointer :: gap_mortality_c_to_litr_cel_c_col (:,:) ! C fluxes associated with gap mortality to litter cellulose pool (gC/m3/s) - real(r8), pointer :: gap_mortality_c_to_litr_lig_c_col (:,:) ! C fluxes associated with gap mortality to litter lignin pool (gC/m3/s) - real(r8), pointer :: gap_mortality_c_to_cwdc_col (:,:) ! C fluxes associated with gap mortality to CWD pool (gC/m3/s) - - ! fire - real(r8), pointer :: fire_mortality_c_to_cwdc_col (:,:) ! C fluxes associated with fire mortality to CWD pool (gC/m3/s) - - ! harvest - real(r8), pointer :: harvest_c_to_litr_met_c_col (:,:) ! C fluxes associated with harvest to litter metabolic pool (gC/m3/s) - real(r8), pointer :: harvest_c_to_litr_cel_c_col (:,:) ! C fluxes associated with harvest to litter cellulose pool (gC/m3/s) - real(r8), pointer :: harvest_c_to_litr_lig_c_col (:,:) ! C fluxes associated with harvest to litter lignin pool (gC/m3/s) - real(r8), pointer :: harvest_c_to_cwdc_col (:,:) ! C fluxes associated with harvest to CWD pool (gC/m3/s) - real(r8), pointer :: grainc_to_cropprodc_patch (:) ! grain C to crop product pool (gC/m2/s) - real(r8), pointer :: grainc_to_cropprodc_col (:) ! grain C to crop product pool (gC/m2/s) - - ! fire fluxes - real(r8), pointer :: m_decomp_cpools_to_fire_vr_col (:,:,:) ! vertically-resolved decomposing C fire loss (gC/m3/s) - real(r8), pointer :: m_decomp_cpools_to_fire_col (:,:) ! vertically-integrated (diagnostic) decomposing C fire loss (gC/m2/s) - real(r8), pointer :: m_c_to_litr_met_fire_col (:,:) ! C from leaf, froot, xfer and storage C to litter labile C by fire (gC/m3/s) - real(r8), pointer :: m_c_to_litr_cel_fire_col (:,:) ! C from leaf, froot, xfer and storage C to litter cellulose C by fire (gC/m3/s) - real(r8), pointer :: m_c_to_litr_lig_fire_col (:,:) ! C from leaf, froot, xfer and storage C to litter lignin C by fire (gC/m3/s) - - ! dynamic landcover fluxes - real(r8), pointer :: dwt_seedc_to_leaf_patch (:) ! (gC/m2/s) seed source to patch-level; although this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_seedc_to_leaf_grc (:) ! (gC/m2/s) dwt_seedc_to_leaf_patch summed to the gridcell-level - real(r8), pointer :: dwt_seedc_to_deadstem_patch (:) ! (gC/m2/s) seed source to patch-level; although this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_seedc_to_deadstem_grc (:) ! (gC/m2/s) dwt_seedc_to_leaf_patch summed to the gridcell-level - real(r8), pointer :: dwt_conv_cflux_patch (:) ! (gC/m2/s) conversion C flux (immediate loss to atm); although this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_conv_cflux_grc (:) ! (gC/m2/s) dwt_conv_cflux_patch summed to the gridcell-level - real(r8), pointer :: dwt_conv_cflux_dribbled_grc (:) ! (gC/m2/s) dwt_conv_cflux_grc dribbled evenly throughout the year - real(r8), pointer :: dwt_wood_productc_gain_patch (:) ! (gC/m2/s) addition to wood product pools from landcover change; although this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_crop_productc_gain_patch (:) ! (gC/m2/s) addition to crop product pools from landcover change; although this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_slash_cflux_col (:) ! (gC/m2/s) conversion slash flux due to landcover change - real(r8), pointer :: dwt_frootc_to_litr_met_c_col (:,:) ! (gC/m3/s) fine root to litter due to landcover change - real(r8), pointer :: dwt_frootc_to_litr_cel_c_col (:,:) ! (gC/m3/s) fine root to litter due to landcover change - real(r8), pointer :: dwt_frootc_to_litr_lig_c_col (:,:) ! (gC/m3/s) fine root to litter due to landcover change - real(r8), pointer :: dwt_livecrootc_to_cwdc_col (:,:) ! (gC/m3/s) live coarse root to CWD due to landcover change - real(r8), pointer :: dwt_deadcrootc_to_cwdc_col (:,:) ! (gC/m3/s) dead coarse root to CWD due to landcover change - - ! crop fluxes - real(r8), pointer :: crop_seedc_to_leaf_patch (:) ! (gC/m2/s) seed source to leaf, for crops - - ! summary (diagnostic) flux variables, not involved in mass balance - real(r8), pointer :: gpp_before_downreg_patch (:) ! (gC/m2/s) gross primary production before down regulation - real(r8), pointer :: current_gr_patch (:) ! (gC/m2/s) growth resp for new growth displayed in this timestep - real(r8), pointer :: transfer_gr_patch (:) ! (gC/m2/s) growth resp for transfer growth displayed in this timestep - real(r8), pointer :: storage_gr_patch (:) ! (gC/m2/s) growth resp for growth sent to storage for later display - real(r8), pointer :: plant_calloc_patch (:) ! (gC/m2/s) total allocated C flux - real(r8), pointer :: excess_cflux_patch (:) ! (gC/m2/s) C flux not allocated due to downregulation - real(r8), pointer :: prev_leafc_to_litter_patch (:) ! (gC/m2/s) previous timestep leaf C litterfall flux - real(r8), pointer :: prev_frootc_to_litter_patch (:) ! (gC/m2/s) previous timestep froot C litterfall flux - real(r8), pointer :: availc_patch (:) ! (gC/m2/s) C flux available for allocation - real(r8), pointer :: xsmrpool_recover_patch (:) ! (gC/m2/s) C flux assigned to recovery of negative cpool - real(r8), pointer :: xsmrpool_c13ratio_patch (:) ! C13/C(12+13) ratio for xsmrpool (proportion) - - real(r8), pointer :: cwdc_hr_col (:) ! (gC/m2/s) col-level coarse woody debris C heterotrophic respiration - real(r8), pointer :: cwdc_loss_col (:) ! (gC/m2/s) col-level coarse woody debris C loss - real(r8), pointer :: litterc_loss_col (:) ! (gC/m2/s) col-level litter C loss - real(r8), pointer :: frootc_alloc_patch (:) ! (gC/m2/s) patch-level fine root C alloc - real(r8), pointer :: frootc_loss_patch (:) ! (gC/m2/s) patch-level fine root C loss - real(r8), pointer :: leafc_alloc_patch (:) ! (gC/m2/s) patch-level leaf C alloc - real(r8), pointer :: leafc_loss_patch (:) ! (gC/m2/s) patch-level leaf C loss - real(r8), pointer :: woodc_alloc_patch (:) ! (gC/m2/s) patch-level wood C alloc - real(r8), pointer :: woodc_loss_patch (:) ! (gC/m2/s) patch-level wood C loss - - real(r8), pointer :: gpp_patch (:) ! (gC/m2/s) patch gross primary production - real(r8), pointer :: gpp_col (:) ! (gC/m2/s) column GPP flux before downregulation (p2c) - real(r8), pointer :: rr_patch (:) ! (gC/m2/s) root respiration (fine root MR + total root GR) - real(r8), pointer :: rr_col (:) ! (gC/m2/s) root respiration (fine root MR + total root GR) (p2c) - real(r8), pointer :: mr_patch (:) ! (gC/m2/s) maintenance respiration - real(r8), pointer :: gr_patch (:) ! (gC/m2/s) total growth respiration - real(r8), pointer :: ar_patch (:) ! (gC/m2/s) patch autotrophic respiration (MR + GR) - real(r8), pointer :: ar_col (:) ! (gC/m2/s) column autotrophic respiration (MR + GR) (p2c) - real(r8), pointer :: npp_patch (:) ! (gC/m2/s) patch net primary production - real(r8), pointer :: npp_col (:) ! (gC/m2/s) column net primary production (p2c) - real(r8), pointer :: agnpp_patch (:) ! (gC/m2/s) aboveground NPP - real(r8), pointer :: bgnpp_patch (:) ! (gC/m2/s) belowground NPP - real(r8), pointer :: litfall_patch (:) ! (gC/m2/s) patch litterfall (leaves and fine roots) - real(r8), pointer :: wood_harvestc_patch (:) ! (gC/m2/s) patch-level wood harvest (to product pools) - real(r8), pointer :: wood_harvestc_col (:) ! (gC/m2/s) column-level wood harvest (to product pools) (p2c) - real(r8), pointer :: slash_harvestc_patch (:) ! (gC/m2/s) patch-level slash from harvest (to litter) - real(r8), pointer :: cinputs_patch (:) ! (gC/m2/s) patch-level carbon inputs (for balance checking) - real(r8), pointer :: coutputs_patch (:) ! (gC/m2/s) patch-level carbon outputs (for balance checking) - real(r8), pointer :: sr_col (:) ! (gC/m2/s) total soil respiration (HR + root resp) - real(r8), pointer :: er_col (:) ! (gC/m2/s) total ecosystem respiration, autotrophic + heterotrophic - real(r8), pointer :: litfire_col (:) ! (gC/m2/s) litter fire losses - real(r8), pointer :: somfire_col (:) ! (gC/m2/s) soil organic matter fire losses - real(r8), pointer :: totfire_col (:) ! (gC/m2/s) total ecosystem fire losses - real(r8), pointer :: hrv_xsmrpool_to_atm_col (:) ! (gC/m2/s) excess MR pool harvest mortality (p2c) - - ! fire code - real(r8), pointer :: fire_closs_patch (:) ! (gC/m2/s) total fire C loss - real(r8), pointer :: fire_closs_p2c_col (:) ! (gC/m2/s) patch2col averaged column-level fire C loss (p2c) - real(r8), pointer :: fire_closs_col (:) ! (gC/m2/s) total patch-level fire C loss - - ! temporary and annual sums - real(r8), pointer :: tempsum_litfall_patch (:) ! (gC/m2/yr) temporary annual sum of litfall (CNDV only for now) - real(r8), pointer :: annsum_litfall_patch (:) ! (gC/m2/yr) annual sum of litfall (CNDV only for now) - real(r8), pointer :: tempsum_npp_patch (:) ! (gC/m2/yr) temporary annual sum of NPP - real(r8), pointer :: annsum_npp_patch (:) ! (gC/m2/yr) annual sum of NPP - real(r8), pointer :: annsum_npp_col (:) ! (gC/m2/yr) annual sum of NPP, averaged from patch-level - real(r8), pointer :: lag_npp_col (:) ! (gC/m2/yr) lagged net primary production - - ! Summary C fluxes. - real(r8), pointer :: nep_col (:) ! (gC/m2/s) net ecosystem production, excludes fire, landuse, and harvest flux, positive for sink - real(r8), pointer :: nbp_grc (:) ! (gC/m2/s) net biome production, includes fire, landuse, harvest and hrv_xsmrpool flux, positive for sink (same as net carbon exchange between land and atmosphere) - real(r8), pointer :: nee_grc (:) ! (gC/m2/s) net ecosystem exchange of carbon, includes fire and hrv_xsmrpool, excludes landuse and harvest flux, positive for source - - ! Dynamic landcover fluxnes - real(r8), pointer :: landuseflux_grc(:) ! (gC/m2/s) dwt_conv_cflux+product_closs - real(r8), pointer :: npp_Nactive_patch (:) ! C used by mycorrhizal uptake (gC/m2/s) - real(r8), pointer :: npp_burnedoff_patch (:) ! C that cannot be used for N uptake (gC/m2/s) - real(r8), pointer :: npp_Nnonmyc_patch (:) ! C used by non-myc uptake (gC/m2/s) - real(r8), pointer :: npp_Nam_patch (:) ! C used by AM plant (gC/m2/s) - real(r8), pointer :: npp_Necm_patch (:) ! C used by ECM plant (gC/m2/s) - real(r8), pointer :: npp_Nactive_no3_patch (:) ! C used by mycorrhizal uptake (gC/m2/s) - real(r8), pointer :: npp_Nactive_nh4_patch (:) ! C used by mycorrhizal uptake (gC/m2/s) - real(r8), pointer :: npp_Nnonmyc_no3_patch (:) ! C used by non-myc (gC/m2/s) - real(r8), pointer :: npp_Nnonmyc_nh4_patch (:) ! C used by non-myc (gC/m2/s) - real(r8), pointer :: npp_Nam_no3_patch (:) ! C used by AM plant (gC/m2/s) - real(r8), pointer :: npp_Nam_nh4_patch (:) ! C used by AM plant (gC/m2/s) - real(r8), pointer :: npp_Necm_no3_patch (:) ! C used by ECM plant (gC/m2/s) - real(r8), pointer :: npp_Necm_nh4_patch (:) ! C used by ECM plant (gC/m2/s) - real(r8), pointer :: npp_Nfix_patch (:) ! C used by Symbiotic BNF (gC/m2/s) - real(r8), pointer :: npp_Nretrans_patch (:) ! C used by retranslocation (gC/m2/s) - real(r8), pointer :: npp_Nuptake_patch (:) ! Total C used by N uptake in FUN (gC/m2/s) - real(r8), pointer :: npp_growth_patch (:) ! Total C u for growth in FUN (gC/m2/s) - real(r8), pointer :: leafc_change_patch (:) ! Total used C from leaves (gC/m2/s) - real(r8), pointer :: soilc_change_patch (:) ! Total used C from soil (gC/m2/s) - - contains - - procedure , public :: Init - procedure , private :: InitAllocate - procedure , private :: InitHistory - procedure , private :: InitCold - procedure , public :: Restart - procedure , private :: RestartBulkOnly ! Handle restart fields only present for bulk C - procedure , private :: RestartAllIsotopes ! Handle restart fields present for both bulk C and isotopes - procedure , public :: SetValues - - end type cnveg_carbonflux_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, carbon_type) - - class(cnveg_carbonflux_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=3) , intent(in) :: carbon_type ! one of ['c12', c13','c14'] - - call this%InitAllocate ( bounds, carbon_type) - call this%InitHistory ( bounds, carbon_type ) - call this%InitCold (bounds ) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds, carbon_type) - ! - ! !ARGUMENTS: - class (cnveg_carbonflux_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=*) , intent(in) :: carbon_type ! one of ['c12', c13','c14'] - ! - ! !LOCAL VARIABLES: - integer :: begp,endp - integer :: begc,endc - integer :: begg,endg - character(len=:), allocatable :: carbon_type_suffix - !------------------------------------------------------------------------ - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - allocate(this%m_leafc_to_litter_patch (begp:endp)) ; this%m_leafc_to_litter_patch (:) = nan - allocate(this%m_frootc_to_litter_patch (begp:endp)) ; this%m_frootc_to_litter_patch (:) = nan - allocate(this%m_leafc_storage_to_litter_patch (begp:endp)) ; this%m_leafc_storage_to_litter_patch (:) = nan - allocate(this%m_frootc_storage_to_litter_patch (begp:endp)) ; this%m_frootc_storage_to_litter_patch (:) = nan - allocate(this%m_livestemc_storage_to_litter_patch (begp:endp)) ; this%m_livestemc_storage_to_litter_patch (:) = nan - allocate(this%m_deadstemc_storage_to_litter_patch (begp:endp)) ; this%m_deadstemc_storage_to_litter_patch (:) = nan - allocate(this%m_livecrootc_storage_to_litter_patch (begp:endp)) ; this%m_livecrootc_storage_to_litter_patch (:) = nan - allocate(this%m_deadcrootc_storage_to_litter_patch (begp:endp)) ; this%m_deadcrootc_storage_to_litter_patch (:) = nan - allocate(this%m_leafc_xfer_to_litter_patch (begp:endp)) ; this%m_leafc_xfer_to_litter_patch (:) = nan - allocate(this%m_frootc_xfer_to_litter_patch (begp:endp)) ; this%m_frootc_xfer_to_litter_patch (:) = nan - allocate(this%m_livestemc_xfer_to_litter_patch (begp:endp)) ; this%m_livestemc_xfer_to_litter_patch (:) = nan - allocate(this%m_deadstemc_xfer_to_litter_patch (begp:endp)) ; this%m_deadstemc_xfer_to_litter_patch (:) = nan - allocate(this%m_livecrootc_xfer_to_litter_patch (begp:endp)) ; this%m_livecrootc_xfer_to_litter_patch (:) = nan - allocate(this%m_deadcrootc_xfer_to_litter_patch (begp:endp)) ; this%m_deadcrootc_xfer_to_litter_patch (:) = nan - allocate(this%m_livestemc_to_litter_patch (begp:endp)) ; this%m_livestemc_to_litter_patch (:) = nan - allocate(this%m_deadstemc_to_litter_patch (begp:endp)) ; this%m_deadstemc_to_litter_patch (:) = nan - allocate(this%m_livecrootc_to_litter_patch (begp:endp)) ; this%m_livecrootc_to_litter_patch (:) = nan - allocate(this%m_deadcrootc_to_litter_patch (begp:endp)) ; this%m_deadcrootc_to_litter_patch (:) = nan - allocate(this%m_gresp_storage_to_litter_patch (begp:endp)) ; this%m_gresp_storage_to_litter_patch (:) = nan - allocate(this%m_gresp_xfer_to_litter_patch (begp:endp)) ; this%m_gresp_xfer_to_litter_patch (:) = nan - allocate(this%hrv_leafc_to_litter_patch (begp:endp)) ; this%hrv_leafc_to_litter_patch (:) = nan - allocate(this%hrv_leafc_storage_to_litter_patch (begp:endp)) ; this%hrv_leafc_storage_to_litter_patch (:) = nan - allocate(this%hrv_leafc_xfer_to_litter_patch (begp:endp)) ; this%hrv_leafc_xfer_to_litter_patch (:) = nan - allocate(this%hrv_frootc_to_litter_patch (begp:endp)) ; this%hrv_frootc_to_litter_patch (:) = nan - allocate(this%hrv_frootc_storage_to_litter_patch (begp:endp)) ; this%hrv_frootc_storage_to_litter_patch (:) = nan - allocate(this%hrv_frootc_xfer_to_litter_patch (begp:endp)) ; this%hrv_frootc_xfer_to_litter_patch (:) = nan - allocate(this%hrv_livestemc_to_litter_patch (begp:endp)) ; this%hrv_livestemc_to_litter_patch (:) = nan - allocate(this%hrv_livestemc_storage_to_litter_patch (begp:endp)) ; this%hrv_livestemc_storage_to_litter_patch (:) = nan - allocate(this%hrv_livestemc_xfer_to_litter_patch (begp:endp)) ; this%hrv_livestemc_xfer_to_litter_patch (:) = nan - allocate(this%hrv_deadstemc_storage_to_litter_patch (begp:endp)) ; this%hrv_deadstemc_storage_to_litter_patch (:) = nan - allocate(this%hrv_deadstemc_xfer_to_litter_patch (begp:endp)) ; this%hrv_deadstemc_xfer_to_litter_patch (:) = nan - allocate(this%hrv_livecrootc_to_litter_patch (begp:endp)) ; this%hrv_livecrootc_to_litter_patch (:) = nan - allocate(this%hrv_livecrootc_storage_to_litter_patch (begp:endp)) ; this%hrv_livecrootc_storage_to_litter_patch (:) = nan - allocate(this%hrv_livecrootc_xfer_to_litter_patch (begp:endp)) ; this%hrv_livecrootc_xfer_to_litter_patch (:) = nan - allocate(this%hrv_deadcrootc_to_litter_patch (begp:endp)) ; this%hrv_deadcrootc_to_litter_patch (:) = nan - allocate(this%hrv_deadcrootc_storage_to_litter_patch (begp:endp)) ; this%hrv_deadcrootc_storage_to_litter_patch (:) = nan - allocate(this%hrv_deadcrootc_xfer_to_litter_patch (begp:endp)) ; this%hrv_deadcrootc_xfer_to_litter_patch (:) = nan - allocate(this%hrv_gresp_storage_to_litter_patch (begp:endp)) ; this%hrv_gresp_storage_to_litter_patch (:) = nan - allocate(this%hrv_gresp_xfer_to_litter_patch (begp:endp)) ; this%hrv_gresp_xfer_to_litter_patch (:) = nan - allocate(this%hrv_xsmrpool_to_atm_patch (begp:endp)) ; this%hrv_xsmrpool_to_atm_patch (:) = nan - allocate(this%m_leafc_to_fire_patch (begp:endp)) ; this%m_leafc_to_fire_patch (:) = nan - allocate(this%m_leafc_storage_to_fire_patch (begp:endp)) ; this%m_leafc_storage_to_fire_patch (:) = nan - allocate(this%m_leafc_xfer_to_fire_patch (begp:endp)) ; this%m_leafc_xfer_to_fire_patch (:) = nan - allocate(this%m_livestemc_to_fire_patch (begp:endp)) ; this%m_livestemc_to_fire_patch (:) = nan - allocate(this%m_livestemc_storage_to_fire_patch (begp:endp)) ; this%m_livestemc_storage_to_fire_patch (:) = nan - allocate(this%m_livestemc_xfer_to_fire_patch (begp:endp)) ; this%m_livestemc_xfer_to_fire_patch (:) = nan - allocate(this%m_deadstemc_to_fire_patch (begp:endp)) ; this%m_deadstemc_to_fire_patch (:) = nan - allocate(this%m_deadstemc_storage_to_fire_patch (begp:endp)) ; this%m_deadstemc_storage_to_fire_patch (:) = nan - allocate(this%m_deadstemc_xfer_to_fire_patch (begp:endp)) ; this%m_deadstemc_xfer_to_fire_patch (:) = nan - allocate(this%m_frootc_to_fire_patch (begp:endp)) ; this%m_frootc_to_fire_patch (:) = nan - allocate(this%m_frootc_storage_to_fire_patch (begp:endp)) ; this%m_frootc_storage_to_fire_patch (:) = nan - allocate(this%m_frootc_xfer_to_fire_patch (begp:endp)) ; this%m_frootc_xfer_to_fire_patch (:) = nan - allocate(this%m_livecrootc_to_fire_patch (begp:endp)) ; this%m_livecrootc_to_fire_patch (:) = nan - allocate(this%m_livecrootc_storage_to_fire_patch (begp:endp)) ; this%m_livecrootc_storage_to_fire_patch (:) = nan - allocate(this%m_livecrootc_xfer_to_fire_patch (begp:endp)) ; this%m_livecrootc_xfer_to_fire_patch (:) = nan - allocate(this%m_deadcrootc_to_fire_patch (begp:endp)) ; this%m_deadcrootc_to_fire_patch (:) = nan - allocate(this%m_deadcrootc_storage_to_fire_patch (begp:endp)) ; this%m_deadcrootc_storage_to_fire_patch (:) = nan - allocate(this%m_deadcrootc_xfer_to_fire_patch (begp:endp)) ; this%m_deadcrootc_xfer_to_fire_patch (:) = nan - allocate(this%m_gresp_storage_to_fire_patch (begp:endp)) ; this%m_gresp_storage_to_fire_patch (:) = nan - allocate(this%m_gresp_xfer_to_fire_patch (begp:endp)) ; this%m_gresp_xfer_to_fire_patch (:) = nan - allocate(this%m_leafc_to_litter_fire_patch (begp:endp)) ; this%m_leafc_to_litter_fire_patch (:) = nan - allocate(this%m_leafc_storage_to_litter_fire_patch (begp:endp)) ; this%m_leafc_storage_to_litter_fire_patch (:) = nan - allocate(this%m_leafc_xfer_to_litter_fire_patch (begp:endp)) ; this%m_leafc_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_livestemc_to_litter_fire_patch (begp:endp)) ; this%m_livestemc_to_litter_fire_patch (:) = nan - allocate(this%m_livestemc_storage_to_litter_fire_patch (begp:endp)) ; this%m_livestemc_storage_to_litter_fire_patch (:) = nan - allocate(this%m_livestemc_xfer_to_litter_fire_patch (begp:endp)) ; this%m_livestemc_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_livestemc_to_deadstemc_fire_patch (begp:endp)) ; this%m_livestemc_to_deadstemc_fire_patch (:) = nan - allocate(this%m_deadstemc_to_litter_fire_patch (begp:endp)) ; this%m_deadstemc_to_litter_fire_patch (:) = nan - allocate(this%m_deadstemc_storage_to_litter_fire_patch (begp:endp)) ; this%m_deadstemc_storage_to_litter_fire_patch (:) = nan - allocate(this%m_deadstemc_xfer_to_litter_fire_patch (begp:endp)) ; this%m_deadstemc_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_frootc_to_litter_fire_patch (begp:endp)) ; this%m_frootc_to_litter_fire_patch (:) = nan - allocate(this%m_frootc_storage_to_litter_fire_patch (begp:endp)) ; this%m_frootc_storage_to_litter_fire_patch (:) = nan - allocate(this%m_frootc_xfer_to_litter_fire_patch (begp:endp)) ; this%m_frootc_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_livecrootc_to_litter_fire_patch (begp:endp)) ; this%m_livecrootc_to_litter_fire_patch (:) = nan - allocate(this%m_livecrootc_storage_to_litter_fire_patch (begp:endp)) ; this%m_livecrootc_storage_to_litter_fire_patch (:) = nan - allocate(this%m_livecrootc_xfer_to_litter_fire_patch (begp:endp)) ; this%m_livecrootc_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_livecrootc_to_deadcrootc_fire_patch (begp:endp)) ; this%m_livecrootc_to_deadcrootc_fire_patch (:) = nan - allocate(this%m_deadcrootc_to_litter_fire_patch (begp:endp)) ; this%m_deadcrootc_to_litter_fire_patch (:) = nan - allocate(this%m_deadcrootc_storage_to_litter_fire_patch (begp:endp)) ; this%m_deadcrootc_storage_to_litter_fire_patch (:) = nan - allocate(this%m_deadcrootc_xfer_to_litter_fire_patch (begp:endp)) ; this%m_deadcrootc_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_gresp_storage_to_litter_fire_patch (begp:endp)) ; this%m_gresp_storage_to_litter_fire_patch (:) = nan - allocate(this%m_gresp_xfer_to_litter_fire_patch (begp:endp)) ; this%m_gresp_xfer_to_litter_fire_patch (:) = nan - allocate(this%leafc_xfer_to_leafc_patch (begp:endp)) ; this%leafc_xfer_to_leafc_patch (:) = nan - allocate(this%frootc_xfer_to_frootc_patch (begp:endp)) ; this%frootc_xfer_to_frootc_patch (:) = nan - allocate(this%livestemc_xfer_to_livestemc_patch (begp:endp)) ; this%livestemc_xfer_to_livestemc_patch (:) = nan - allocate(this%deadstemc_xfer_to_deadstemc_patch (begp:endp)) ; this%deadstemc_xfer_to_deadstemc_patch (:) = nan - allocate(this%livecrootc_xfer_to_livecrootc_patch (begp:endp)) ; this%livecrootc_xfer_to_livecrootc_patch (:) = nan - allocate(this%deadcrootc_xfer_to_deadcrootc_patch (begp:endp)) ; this%deadcrootc_xfer_to_deadcrootc_patch (:) = nan - allocate(this%leafc_to_litter_patch (begp:endp)) ; this%leafc_to_litter_patch (:) = nan - allocate(this%leafc_to_litter_fun_patch (begp:endp)) ; this%leafc_to_litter_fun_patch (:) = nan - allocate(this%frootc_to_litter_patch (begp:endp)) ; this%frootc_to_litter_patch (:) = nan - allocate(this%cpool_to_resp_patch (begp:endp)) ; this%cpool_to_resp_patch (:) = nan - allocate(this%cpool_to_leafc_resp_patch (begp:endp)) ; this%cpool_to_leafc_resp_patch (:) = nan - allocate(this%cpool_to_leafc_storage_resp_patch (begp:endp)) ; this%cpool_to_leafc_storage_resp_patch (:) = nan - allocate(this%cpool_to_frootc_resp_patch (begp:endp)) ; this%cpool_to_frootc_resp_patch (:) = nan - allocate(this%cpool_to_frootc_storage_resp_patch (begp:endp)) ; this%cpool_to_frootc_storage_resp_patch (:) = nan - allocate(this%cpool_to_livecrootc_resp_patch (begp:endp)) ; this%cpool_to_livecrootc_resp_patch (:) = nan - allocate(this%cpool_to_livecrootc_storage_resp_patch (begp:endp)) ; this%cpool_to_livecrootc_storage_resp_patch (:) = nan - allocate(this%cpool_to_livestemc_resp_patch (begp:endp)) ; this%cpool_to_livestemc_resp_patch (:) = nan - allocate(this%cpool_to_livestemc_storage_resp_patch (begp:endp)) ; this%cpool_to_livestemc_storage_resp_patch (:) = nan - allocate(this%leaf_mr_patch (begp:endp)) ; this%leaf_mr_patch (:) = nan - allocate(this%froot_mr_patch (begp:endp)) ; this%froot_mr_patch (:) = nan - allocate(this%livestem_mr_patch (begp:endp)) ; this%livestem_mr_patch (:) = nan - allocate(this%livecroot_mr_patch (begp:endp)) ; this%livecroot_mr_patch (:) = nan - allocate(this%grain_mr_patch (begp:endp)) ; this%grain_mr_patch (:) = nan - allocate(this%leaf_curmr_patch (begp:endp)) ; this%leaf_curmr_patch (:) = nan - allocate(this%froot_curmr_patch (begp:endp)) ; this%froot_curmr_patch (:) = nan - allocate(this%livestem_curmr_patch (begp:endp)) ; this%livestem_curmr_patch (:) = nan - allocate(this%livecroot_curmr_patch (begp:endp)) ; this%livecroot_curmr_patch (:) = nan - allocate(this%grain_curmr_patch (begp:endp)) ; this%grain_curmr_patch (:) = nan - allocate(this%leaf_xsmr_patch (begp:endp)) ; this%leaf_xsmr_patch (:) = nan - allocate(this%froot_xsmr_patch (begp:endp)) ; this%froot_xsmr_patch (:) = nan - allocate(this%livestem_xsmr_patch (begp:endp)) ; this%livestem_xsmr_patch (:) = nan - allocate(this%livecroot_xsmr_patch (begp:endp)) ; this%livecroot_xsmr_patch (:) = nan - allocate(this%grain_xsmr_patch (begp:endp)) ; this%grain_xsmr_patch (:) = nan - allocate(this%psnsun_to_cpool_patch (begp:endp)) ; this%psnsun_to_cpool_patch (:) = nan - allocate(this%psnshade_to_cpool_patch (begp:endp)) ; this%psnshade_to_cpool_patch (:) = nan - allocate(this%cpool_to_xsmrpool_patch (begp:endp)) ; this%cpool_to_xsmrpool_patch (:) = nan - allocate(this%cpool_to_leafc_patch (begp:endp)) ; this%cpool_to_leafc_patch (:) = nan - allocate(this%cpool_to_leafc_storage_patch (begp:endp)) ; this%cpool_to_leafc_storage_patch (:) = nan - allocate(this%cpool_to_frootc_patch (begp:endp)) ; this%cpool_to_frootc_patch (:) = nan - allocate(this%cpool_to_frootc_storage_patch (begp:endp)) ; this%cpool_to_frootc_storage_patch (:) = nan - allocate(this%cpool_to_livestemc_patch (begp:endp)) ; this%cpool_to_livestemc_patch (:) = nan - allocate(this%cpool_to_livestemc_storage_patch (begp:endp)) ; this%cpool_to_livestemc_storage_patch (:) = nan - allocate(this%cpool_to_deadstemc_patch (begp:endp)) ; this%cpool_to_deadstemc_patch (:) = nan - allocate(this%cpool_to_deadstemc_storage_patch (begp:endp)) ; this%cpool_to_deadstemc_storage_patch (:) = nan - allocate(this%cpool_to_livecrootc_patch (begp:endp)) ; this%cpool_to_livecrootc_patch (:) = nan - allocate(this%cpool_to_livecrootc_storage_patch (begp:endp)) ; this%cpool_to_livecrootc_storage_patch (:) = nan - allocate(this%cpool_to_deadcrootc_patch (begp:endp)) ; this%cpool_to_deadcrootc_patch (:) = nan - allocate(this%cpool_to_deadcrootc_storage_patch (begp:endp)) ; this%cpool_to_deadcrootc_storage_patch (:) = nan - allocate(this%cpool_to_gresp_storage_patch (begp:endp)) ; this%cpool_to_gresp_storage_patch (:) = nan - allocate(this%cpool_leaf_gr_patch (begp:endp)) ; this%cpool_leaf_gr_patch (:) = nan - allocate(this%cpool_leaf_storage_gr_patch (begp:endp)) ; this%cpool_leaf_storage_gr_patch (:) = nan - allocate(this%transfer_leaf_gr_patch (begp:endp)) ; this%transfer_leaf_gr_patch (:) = nan - allocate(this%cpool_froot_gr_patch (begp:endp)) ; this%cpool_froot_gr_patch (:) = nan - allocate(this%cpool_froot_storage_gr_patch (begp:endp)) ; this%cpool_froot_storage_gr_patch (:) = nan - allocate(this%transfer_froot_gr_patch (begp:endp)) ; this%transfer_froot_gr_patch (:) = nan - allocate(this%cpool_livestem_gr_patch (begp:endp)) ; this%cpool_livestem_gr_patch (:) = nan - allocate(this%cpool_livestem_storage_gr_patch (begp:endp)) ; this%cpool_livestem_storage_gr_patch (:) = nan - allocate(this%transfer_livestem_gr_patch (begp:endp)) ; this%transfer_livestem_gr_patch (:) = nan - allocate(this%cpool_deadstem_gr_patch (begp:endp)) ; this%cpool_deadstem_gr_patch (:) = nan - allocate(this%cpool_deadstem_storage_gr_patch (begp:endp)) ; this%cpool_deadstem_storage_gr_patch (:) = nan - allocate(this%transfer_deadstem_gr_patch (begp:endp)) ; this%transfer_deadstem_gr_patch (:) = nan - allocate(this%cpool_livecroot_gr_patch (begp:endp)) ; this%cpool_livecroot_gr_patch (:) = nan - allocate(this%cpool_livecroot_storage_gr_patch (begp:endp)) ; this%cpool_livecroot_storage_gr_patch (:) = nan - allocate(this%transfer_livecroot_gr_patch (begp:endp)) ; this%transfer_livecroot_gr_patch (:) = nan - allocate(this%cpool_deadcroot_gr_patch (begp:endp)) ; this%cpool_deadcroot_gr_patch (:) = nan - allocate(this%cpool_deadcroot_storage_gr_patch (begp:endp)) ; this%cpool_deadcroot_storage_gr_patch (:) = nan - allocate(this%transfer_deadcroot_gr_patch (begp:endp)) ; this%transfer_deadcroot_gr_patch (:) = nan - allocate(this%leafc_storage_to_xfer_patch (begp:endp)) ; this%leafc_storage_to_xfer_patch (:) = nan - allocate(this%frootc_storage_to_xfer_patch (begp:endp)) ; this%frootc_storage_to_xfer_patch (:) = nan - allocate(this%livestemc_storage_to_xfer_patch (begp:endp)) ; this%livestemc_storage_to_xfer_patch (:) = nan - allocate(this%deadstemc_storage_to_xfer_patch (begp:endp)) ; this%deadstemc_storage_to_xfer_patch (:) = nan - allocate(this%livecrootc_storage_to_xfer_patch (begp:endp)) ; this%livecrootc_storage_to_xfer_patch (:) = nan - allocate(this%deadcrootc_storage_to_xfer_patch (begp:endp)) ; this%deadcrootc_storage_to_xfer_patch (:) = nan - allocate(this%gresp_storage_to_xfer_patch (begp:endp)) ; this%gresp_storage_to_xfer_patch (:) = nan - allocate(this%livestemc_to_deadstemc_patch (begp:endp)) ; this%livestemc_to_deadstemc_patch (:) = nan - allocate(this%livecrootc_to_deadcrootc_patch (begp:endp)) ; this%livecrootc_to_deadcrootc_patch (:) = nan - allocate(this%current_gr_patch (begp:endp)) ; this%current_gr_patch (:) = nan - allocate(this%transfer_gr_patch (begp:endp)) ; this%transfer_gr_patch (:) = nan - allocate(this%storage_gr_patch (begp:endp)) ; this%storage_gr_patch (:) = nan - allocate(this%plant_calloc_patch (begp:endp)) ; this%plant_calloc_patch (:) = nan - allocate(this%excess_cflux_patch (begp:endp)) ; this%excess_cflux_patch (:) = nan - allocate(this%prev_leafc_to_litter_patch (begp:endp)) ; this%prev_leafc_to_litter_patch (:) = nan - allocate(this%prev_frootc_to_litter_patch (begp:endp)) ; this%prev_frootc_to_litter_patch (:) = nan - allocate(this%gpp_before_downreg_patch (begp:endp)) ; this%gpp_before_downreg_patch (:) = nan - allocate(this%availc_patch (begp:endp)) ; this%availc_patch (:) = nan - allocate(this%xsmrpool_recover_patch (begp:endp)) ; this%xsmrpool_recover_patch (:) = nan - allocate(this%xsmrpool_c13ratio_patch (begp:endp)) ; this%xsmrpool_c13ratio_patch (:) = nan - - allocate(this%cpool_to_grainc_patch (begp:endp)) ; this%cpool_to_grainc_patch (:) = nan - allocate(this%cpool_to_grainc_storage_patch (begp:endp)) ; this%cpool_to_grainc_storage_patch (:) = nan - allocate(this%livestemc_to_litter_patch (begp:endp)) ; this%livestemc_to_litter_patch (:) = nan - allocate(this%grainc_to_food_patch (begp:endp)) ; this%grainc_to_food_patch (:) = nan - allocate(this%grainc_to_seed_patch (begp:endp)) ; this%grainc_to_seed_patch (:) = nan - allocate(this%grainc_xfer_to_grainc_patch (begp:endp)) ; this%grainc_xfer_to_grainc_patch (:) = nan - allocate(this%cpool_grain_gr_patch (begp:endp)) ; this%cpool_grain_gr_patch (:) = nan - allocate(this%cpool_grain_storage_gr_patch (begp:endp)) ; this%cpool_grain_storage_gr_patch (:) = nan - allocate(this%transfer_grain_gr_patch (begp:endp)) ; this%transfer_grain_gr_patch (:) = nan - allocate(this%xsmrpool_to_atm_patch (begp:endp)) ; this%xsmrpool_to_atm_patch (:) = nan - allocate(this%grainc_storage_to_xfer_patch (begp:endp)) ; this%grainc_storage_to_xfer_patch (:) = nan - allocate(this%frootc_alloc_patch (begp:endp)) ; this%frootc_alloc_patch (:) = nan - allocate(this%frootc_loss_patch (begp:endp)) ; this%frootc_loss_patch (:) = nan - allocate(this%leafc_alloc_patch (begp:endp)) ; this%leafc_alloc_patch (:) = nan - allocate(this%leafc_loss_patch (begp:endp)) ; this%leafc_loss_patch (:) = nan - allocate(this%woodc_alloc_patch (begp:endp)) ; this%woodc_alloc_patch (:) = nan - allocate(this%woodc_loss_patch (begp:endp)) ; this%woodc_loss_patch (:) = nan - - allocate(this%phenology_c_to_litr_met_c_col (begc:endc,1:nlevdecomp_full)); - this%phenology_c_to_litr_met_c_col (:,:)=nan - - allocate(this%phenology_c_to_litr_cel_c_col (begc:endc,1:nlevdecomp_full)); this%phenology_c_to_litr_cel_c_col (:,:)=nan - allocate(this%phenology_c_to_litr_lig_c_col (begc:endc,1:nlevdecomp_full)); this%phenology_c_to_litr_lig_c_col (:,:)=nan - - allocate(this%gap_mortality_c_to_litr_met_c_col (begc:endc,1:nlevdecomp_full)); this%gap_mortality_c_to_litr_met_c_col(:,:)=nan - allocate(this%gap_mortality_c_to_litr_cel_c_col (begc:endc,1:nlevdecomp_full)); this%gap_mortality_c_to_litr_cel_c_col(:,:)=nan - allocate(this%gap_mortality_c_to_litr_lig_c_col (begc:endc,1:nlevdecomp_full)); this%gap_mortality_c_to_litr_lig_c_col(:,:)=nan - - allocate(this%gap_mortality_c_to_cwdc_col (begc:endc,1:nlevdecomp_full)); this%gap_mortality_c_to_cwdc_col (:,:)=nan - allocate(this%fire_mortality_c_to_cwdc_col (begc:endc,1:nlevdecomp_full)); this%fire_mortality_c_to_cwdc_col (:,:)=nan - allocate(this%m_c_to_litr_met_fire_col (begc:endc,1:nlevdecomp_full)); this%m_c_to_litr_met_fire_col (:,:)=nan - allocate(this%m_c_to_litr_cel_fire_col (begc:endc,1:nlevdecomp_full)); this%m_c_to_litr_cel_fire_col (:,:)=nan - allocate(this%m_c_to_litr_lig_fire_col (begc:endc,1:nlevdecomp_full)); this%m_c_to_litr_lig_fire_col (:,:)=nan - allocate(this%harvest_c_to_litr_met_c_col (begc:endc,1:nlevdecomp_full)); this%harvest_c_to_litr_met_c_col (:,:)=nan - allocate(this%harvest_c_to_litr_cel_c_col (begc:endc,1:nlevdecomp_full)); this%harvest_c_to_litr_cel_c_col (:,:)=nan - allocate(this%harvest_c_to_litr_lig_c_col (begc:endc,1:nlevdecomp_full)); this%harvest_c_to_litr_lig_c_col (:,:)=nan - allocate(this%harvest_c_to_cwdc_col (begc:endc,1:nlevdecomp_full)); this%harvest_c_to_cwdc_col (:,:)=nan - - allocate(this%dwt_slash_cflux_col (begc:endc)) ; this%dwt_slash_cflux_col (:) =nan - allocate(this%dwt_frootc_to_litr_met_c_col (begc:endc,1:nlevdecomp_full)); this%dwt_frootc_to_litr_met_c_col (:,:)=nan - allocate(this%dwt_frootc_to_litr_cel_c_col (begc:endc,1:nlevdecomp_full)); this%dwt_frootc_to_litr_cel_c_col (:,:)=nan - allocate(this%dwt_frootc_to_litr_lig_c_col (begc:endc,1:nlevdecomp_full)); this%dwt_frootc_to_litr_lig_c_col (:,:)=nan - allocate(this%dwt_livecrootc_to_cwdc_col (begc:endc,1:nlevdecomp_full)); this%dwt_livecrootc_to_cwdc_col (:,:)=nan - allocate(this%dwt_deadcrootc_to_cwdc_col (begc:endc,1:nlevdecomp_full)); this%dwt_deadcrootc_to_cwdc_col (:,:)=nan - - allocate(this%dwt_seedc_to_leaf_patch (begp:endp)) ; this%dwt_seedc_to_leaf_patch (:) =nan - allocate(this%dwt_seedc_to_leaf_grc (begg:endg)) ; this%dwt_seedc_to_leaf_grc (:) =nan - allocate(this%dwt_seedc_to_deadstem_patch (begp:endp)) ; this%dwt_seedc_to_deadstem_patch(:) =nan - allocate(this%dwt_seedc_to_deadstem_grc (begg:endg)) ; this%dwt_seedc_to_deadstem_grc (:) =nan - allocate(this%dwt_conv_cflux_patch (begp:endp)) ; this%dwt_conv_cflux_patch (:) =nan - allocate(this%dwt_conv_cflux_grc (begg:endg)) ; this%dwt_conv_cflux_grc (:) =nan - allocate(this%dwt_conv_cflux_dribbled_grc (begg:endg)) ; this%dwt_conv_cflux_dribbled_grc(:) =nan - allocate(this%dwt_wood_productc_gain_patch (begp:endp)) ; this%dwt_wood_productc_gain_patch(:) =nan - allocate(this%dwt_crop_productc_gain_patch (begp:endp)) ; this%dwt_crop_productc_gain_patch(:) =nan - - allocate(this%crop_seedc_to_leaf_patch (begp:endp)) ; this%crop_seedc_to_leaf_patch (:) =nan - - allocate(this%cwdc_hr_col (begc:endc)) ; this%cwdc_hr_col (:) =nan - allocate(this%cwdc_loss_col (begc:endc)) ; this%cwdc_loss_col (:) =nan - allocate(this%litterc_loss_col (begc:endc)) ; this%litterc_loss_col (:) =nan - - allocate(this%grainc_to_cropprodc_patch(begp:endp)) - this%grainc_to_cropprodc_patch(:) = nan - - allocate(this%grainc_to_cropprodc_col(begc:endc)) - this%grainc_to_cropprodc_col(:) = nan - - allocate(this%m_decomp_cpools_to_fire_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools)) - this%m_decomp_cpools_to_fire_vr_col(:,:,:)= nan - - allocate(this%m_decomp_cpools_to_fire_col(begc:endc,1:ndecomp_pools)) - this%m_decomp_cpools_to_fire_col(:,:)= nan - - allocate(this%m_decomp_cpools_to_fire_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools)) - this%m_decomp_cpools_to_fire_vr_col(:,:,:)= nan - - allocate(this%m_decomp_cpools_to_fire_col(begc:endc,1:ndecomp_pools)) - this%m_decomp_cpools_to_fire_col(:,:)= nan - - allocate(this%rr_patch (begp:endp)) ; this%rr_patch (:) = nan - allocate(this%mr_patch (begp:endp)) ; this%mr_patch (:) = nan - allocate(this%gr_patch (begp:endp)) ; this%gr_patch (:) = nan - allocate(this%ar_patch (begp:endp)) ; this%ar_patch (:) = nan - allocate(this%npp_patch (begp:endp)) ; this%npp_patch (:) = nan - allocate(this%agnpp_patch (begp:endp)) ; this%agnpp_patch (:) = nan - allocate(this%bgnpp_patch (begp:endp)) ; this%bgnpp_patch (:) = nan - allocate(this%litfall_patch (begp:endp)) ; this%litfall_patch (:) = nan - allocate(this%wood_harvestc_patch (begp:endp)) ; this%wood_harvestc_patch (:) = nan - allocate(this%slash_harvestc_patch (begp:endp)) ; this%slash_harvestc_patch (:) = nan - allocate(this%cinputs_patch (begp:endp)) ; this%cinputs_patch (:) = nan - allocate(this%coutputs_patch (begp:endp)) ; this%coutputs_patch (:) = nan - allocate(this%gpp_patch (begp:endp)) ; this%gpp_patch (:) = nan - allocate(this%fire_closs_patch (begp:endp)) ; this%fire_closs_patch (:) = nan - allocate(this%sr_col (begc:endc)) ; this%sr_col (:) = nan - allocate(this%er_col (begc:endc)) ; this%er_col (:) = nan - allocate(this%litfire_col (begc:endc)) ; this%litfire_col (:) = nan - allocate(this%somfire_col (begc:endc)) ; this%somfire_col (:) = nan - allocate(this%totfire_col (begc:endc)) ; this%totfire_col (:) = nan - allocate(this%rr_col (begc:endc)) ; this%rr_col (:) = nan - allocate(this%ar_col (begc:endc)) ; this%ar_col (:) = nan - allocate(this%gpp_col (begc:endc)) ; this%gpp_col (:) = nan - allocate(this%npp_col (begc:endc)) ; this%npp_col (:) = nan - allocate(this%fire_closs_p2c_col (begc:endc)) ; this%fire_closs_p2c_col (:) = nan - allocate(this%fire_closs_col (begc:endc)) ; this%fire_closs_col (:) = nan - allocate(this%wood_harvestc_col (begc:endc)) ; this%wood_harvestc_col (:) = nan - allocate(this%hrv_xsmrpool_to_atm_col (begc:endc)) ; this%hrv_xsmrpool_to_atm_col (:) = nan - allocate(this%tempsum_npp_patch (begp:endp)) ; this%tempsum_npp_patch (:) = nan - allocate(this%annsum_npp_patch (begp:endp)) ; this%annsum_npp_patch (:) = nan - allocate(this%tempsum_litfall_patch (begp:endp)) ; this%tempsum_litfall_patch (:) = nan - allocate(this%annsum_litfall_patch (begp:endp)) ; this%annsum_litfall_patch (:) = nan - allocate(this%annsum_npp_col (begc:endc)) ; this%annsum_npp_col (:) = nan - allocate(this%lag_npp_col (begc:endc)) ; this%lag_npp_col (:) = spval - - allocate(this%nep_col (begc:endc)) ; this%nep_col (:) = nan - allocate(this%nbp_grc (begg:endg)) ; this%nbp_grc (:) = nan - allocate(this%nee_grc (begg:endg)) ; this%nee_grc (:) = nan - allocate(this%landuseflux_grc (begg:endg)) ; this%landuseflux_grc (:) = nan - allocate(this%npp_Nactive_patch (begp:endp)) ; this%npp_Nactive_patch (:) = nan - allocate(this%npp_burnedoff_patch (begp:endp)) ; this%npp_burnedoff_patch (:) = nan - allocate(this%npp_Nnonmyc_patch (begp:endp)) ; this%npp_Nnonmyc_patch (:) = nan - allocate(this%npp_Nam_patch (begp:endp)) ; this%npp_Nam_patch (:) = nan - allocate(this%npp_Necm_patch (begp:endp)) ; this%npp_Necm_patch (:) = nan - allocate(this%npp_Nactive_no3_patch (begp:endp)) ; this%npp_Nactive_no3_patch (:) = nan - allocate(this%npp_Nactive_nh4_patch (begp:endp)) ; this%npp_Nactive_nh4_patch (:) = nan - allocate(this%npp_Nnonmyc_no3_patch (begp:endp)) ; this%npp_Nnonmyc_no3_patch (:) = nan - allocate(this%npp_Nnonmyc_nh4_patch (begp:endp)) ; this%npp_Nnonmyc_nh4_patch (:) = nan - allocate(this%npp_Nam_no3_patch (begp:endp)) ; this%npp_Nam_no3_patch (:) = nan - allocate(this%npp_Nam_nh4_patch (begp:endp)) ; this%npp_Nam_nh4_patch (:) = nan - allocate(this%npp_Necm_no3_patch (begp:endp)) ; this%npp_Necm_no3_patch (:) = nan - allocate(this%npp_Necm_nh4_patch (begp:endp)) ; this%npp_Necm_nh4_patch (:) = nan - allocate(this%npp_Nfix_patch (begp:endp)) ; this%npp_Nfix_patch (:) = nan - allocate(this%npp_Nretrans_patch (begp:endp)) ; this%npp_Nretrans_patch (:) = nan - allocate(this%npp_Nuptake_patch (begp:endp)) ; this%npp_Nuptake_patch (:) = nan - allocate(this%npp_growth_patch (begp:endp)) ; this%npp_growth_patch (:) = nan - allocate(this%leafc_change_patch (begp:endp)) ; this%leafc_change_patch (:) = nan - allocate(this%soilc_change_patch (begp:endp)) ; this%soilc_change_patch (:) = nan - - ! Construct restart field names consistently to what is done in SpeciesNonIsotope & - ! SpeciesIsotope, to aid future migration to that infrastructure - if (carbon_type == 'c12') then - carbon_type_suffix = 'c' - else if (carbon_type == 'c13') then - carbon_type_suffix = 'c_13' - else if (carbon_type == 'c14') then - carbon_type_suffix = 'c_14' - else - write(iulog,*) 'CNVegCarbonFluxType InitAllocate: Unknown carbon_type: ', trim(carbon_type) - call endrun(msg='CNVegCarbonFluxType InitAllocate: Unknown carbon_type: ' // & - errMsg(sourcefile, __LINE__)) - end if - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds, carbon_type) - ! - ! !DESCRIPTION: - ! add history fields for all CN variables, always set as default='inactive' - ! - ! !USES: - use clm_varpar , only : nlevdecomp, nlevdecomp_full, nlevgrnd - use clm_varctl , only : hist_wrtch4diag - use CNSharedParamsMod, only: use_fun - use histFileMod, only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp - ! - ! !ARGUMENTS: - class(cnveg_carbonflux_type) :: this - type(bounds_type) , intent(in) :: bounds - character(len=3) , intent(in) :: carbon_type ! one of ['c12', c13','c14'] - ! - ! !LOCAL VARIABLES: - integer :: k,l,ii,jj - character(8) :: vr_suffix - character(10) :: active - integer :: begp,endp - integer :: begc,endc - integer :: begg,endg - character(24) :: fieldname - character(100) :: longname - real(r8), pointer :: data1dptr(:) ! temp. pointer for slicing larger arrays - real(r8), pointer :: data2dptr(:,:) ! temp. pointer for slicing larger arrays - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - if (nlevdecomp > 1) then - vr_suffix = "_vr" - else - vr_suffix = "" - endif - - !------------------------------- - ! C flux variables - patch - !------------------------------- - - if (carbon_type == 'c12') then - - if (use_crop) then - this%grainc_to_food_patch(begp:endp) = spval - call hist_addfld1d (fname='GRAINC_TO_FOOD', units='gC/m^2/s', & - avgflag='A', long_name='grain C to food', & - ptr_patch=this%grainc_to_food_patch, default='inactive') - - this%grainc_to_seed_patch(begp:endp) = spval - call hist_addfld1d (fname='GRAINC_TO_SEED', units='gC/m^2/s', & - avgflag='A', long_name='grain C to seed', & - ptr_patch=this%grainc_to_seed_patch, default='inactive') - end if - - this%litterc_loss_col(begc:endc) = spval - call hist_addfld1d (fname='LITTERC_LOSS', units='gC/m^2/s', & - avgflag='A', long_name='litter C loss', & - ptr_col=this%litterc_loss_col, default='inactive') - - this%woodc_alloc_patch(begp:endp) = spval - call hist_addfld1d (fname='WOODC_ALLOC', units='gC/m^2/s', & - avgflag='A', long_name='wood C eallocation', & - ptr_patch=this%woodc_alloc_patch, default='inactive') - - this%woodc_loss_patch(begp:endp) = spval - call hist_addfld1d (fname='WOODC_LOSS', units='gC/m^2/s', & - avgflag='A', long_name='wood C loss', & - ptr_patch=this%woodc_loss_patch, default='inactive') - - this%leafc_loss_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_LOSS', units='gC/m^2/s', & - avgflag='A', long_name='leaf C loss', & - ptr_patch=this%leafc_loss_patch, default='inactive') - - this%leafc_alloc_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_ALLOC', units='gC/m^2/s', & - avgflag='A', long_name='leaf C allocation', & - ptr_patch=this%leafc_alloc_patch, default='inactive') - - this%frootc_loss_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTC_LOSS', units='gC/m^2/s', & - avgflag='A', long_name='fine root C loss', & - ptr_patch=this%frootc_loss_patch, default='inactive') - - this%frootc_alloc_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTC_ALLOC', units='gC/m^2/s', & - avgflag='A', long_name='fine root C allocation', & - ptr_patch=this%frootc_alloc_patch, default='inactive') - - this%m_leafc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='leaf C mortality', & - ptr_patch=this%m_leafc_to_litter_patch, default='inactive') - - this%m_frootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='fine root C mortality', & - ptr_patch=this%m_frootc_to_litter_patch, default='inactive') - - this%m_leafc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFC_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='leaf C storage mortality', & - ptr_patch=this%m_leafc_storage_to_litter_patch, default='inactive') - - this%m_frootc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTC_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='fine root C storage mortality', & - ptr_patch=this%m_frootc_storage_to_litter_patch, default='inactive') - - this%m_livestemc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='live stem C storage mortality', & - ptr_patch=this%m_livestemc_storage_to_litter_patch, default='inactive') - - this%m_deadstemc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMC_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C storage mortality', & - ptr_patch=this%m_deadstemc_storage_to_litter_patch, default='inactive') - - this%m_livecrootc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTC_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C storage mortality', & - ptr_patch=this%m_livecrootc_storage_to_litter_patch, default='inactive') - - this%m_deadcrootc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTC_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C storage mortality', & - ptr_patch=this%m_deadcrootc_storage_to_litter_patch, default='inactive') - - this%m_leafc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFC_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='leaf C transfer mortality', & - ptr_patch=this%m_leafc_xfer_to_litter_patch, default='inactive') - - this%m_frootc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTC_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='fine root C transfer mortality', & - ptr_patch=this%m_frootc_xfer_to_litter_patch, default='inactive') - - this%m_livestemc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='live stem C transfer mortality', & - ptr_patch=this%m_livestemc_xfer_to_litter_patch, default='inactive') - - this%m_deadstemc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMC_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C transfer mortality', & - ptr_patch=this%m_deadstemc_xfer_to_litter_patch, default='inactive') - - this%m_livecrootc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTC_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C transfer mortality', & - ptr_patch=this%m_livecrootc_xfer_to_litter_patch, default='inactive') - - this%m_deadcrootc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTC_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C transfer mortality', & - ptr_patch=this%m_deadcrootc_xfer_to_litter_patch, default='inactive') - - this%m_livestemc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='live stem C mortality', & - ptr_patch=this%m_livestemc_to_litter_patch, default='inactive') - - this%m_deadstemc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C mortality', & - ptr_patch=this%m_deadstemc_to_litter_patch, default='inactive') - - this%m_livecrootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C mortality', & - ptr_patch=this%m_livecrootc_to_litter_patch, default='inactive') - - this%m_deadcrootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C mortality', & - ptr_patch=this%m_deadcrootc_to_litter_patch, default='inactive') - - this%m_gresp_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_GRESP_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration storage mortality', & - ptr_patch=this%m_gresp_storage_to_litter_patch, default='inactive') - - this%m_gresp_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_GRESP_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration transfer mortality', & - ptr_patch=this%m_gresp_xfer_to_litter_patch, default='inactive') - - this%m_leafc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='leaf C fire loss', & - ptr_patch=this%m_leafc_to_fire_patch, default='inactive') - - this%m_leafc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFC_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='leaf C storage fire loss', & - ptr_patch=this%m_leafc_storage_to_fire_patch, default='inactive') - - this%m_leafc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFC_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='leaf C transfer fire loss', & - ptr_patch=this%m_leafc_xfer_to_fire_patch, default='inactive') - - this%m_livestemc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live stem C fire loss', & - ptr_patch=this%m_livestemc_to_fire_patch, default='inactive') - - this%m_livestemc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live stem C storage fire loss', & - ptr_patch=this%m_livestemc_storage_to_fire_patch, default='inactive') - - this%m_livestemc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live stem C transfer fire loss', & - ptr_patch=this%m_livestemc_xfer_to_fire_patch, default='inactive') - - this%m_deadstemc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C fire loss', & - ptr_patch=this%m_deadstemc_to_fire_patch, default='inactive') - - this%m_deadstemc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMC_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C storage fire loss', & - ptr_patch=this%m_deadstemc_storage_to_fire_patch, default='inactive') - - this%m_deadstemc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMC_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C transfer fire loss', & - ptr_patch=this%m_deadstemc_xfer_to_fire_patch, default='inactive') - - this%m_frootc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='fine root C fire loss', & - ptr_patch=this%m_frootc_to_fire_patch, default='inactive') - - this%m_frootc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTC_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='fine root C storage fire loss', & - ptr_patch=this%m_frootc_storage_to_fire_patch, default='inactive') - - this%m_frootc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTC_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='fine root C transfer fire loss', & - ptr_patch=this%m_frootc_xfer_to_fire_patch, default='inactive') - - this%m_livecrootc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVEROOTC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live root C fire loss', & - ptr_patch=this%m_livecrootc_to_fire_patch, default='inactive') - - this%m_livecrootc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVEROOTC_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live root C storage fire loss', & - ptr_patch=this%m_livecrootc_storage_to_fire_patch, default='inactive') - - this%m_livecrootc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVEROOTC_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live root C transfer fire loss', & - ptr_patch=this%m_livecrootc_xfer_to_fire_patch, default='inactive') - - this%m_deadcrootc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADROOTC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead root C fire loss', & - ptr_patch=this%m_deadcrootc_to_fire_patch, default='inactive') - - this%m_deadcrootc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADROOTC_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead root C storage fire loss', & - ptr_patch=this%m_deadcrootc_storage_to_fire_patch, default='inactive') - - this%m_deadcrootc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADROOTC_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead root C transfer fire loss', & - ptr_patch=this%m_deadcrootc_xfer_to_fire_patch, default='inactive') - - this%m_gresp_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_GRESP_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration storage fire loss', & - ptr_patch=this%m_gresp_storage_to_fire_patch, default='inactive') - - this%m_gresp_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_GRESP_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration transfer fire loss', & - ptr_patch=this%m_gresp_xfer_to_fire_patch, default='inactive') - - this%m_leafc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFC_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='leaf C fire mortality to litter', & - ptr_patch=this%m_leafc_to_litter_fire_patch, default='inactive') - - ! add by F. Li and S. Levis - this%m_leafc_storage_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFC_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='leaf C fire mortality to litter', & - ptr_patch=this%m_leafc_storage_to_litter_fire_patch, default='inactive') - - this%m_leafc_xfer_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFC_XFER_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='leaf C transfer fire mortality to litter', & - ptr_patch=this%m_leafc_xfer_to_litter_fire_patch, default='inactive') - - this%m_livestemc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live stem C fire mortality to litter', & - ptr_patch=this%m_livestemc_to_litter_fire_patch, default='inactive') - - this%m_livestemc_storage_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live stem C storage fire mortality to litter', & - ptr_patch=this%m_livestemc_storage_to_litter_fire_patch, default='inactive') - - this%m_livestemc_xfer_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_XFER_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live stem C transfer fire mortality to litter', & - ptr_patch=this%m_livestemc_xfer_to_litter_fire_patch, default='inactive') - - this%m_livestemc_to_deadstemc_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_TO_DEADSTEMC_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live stem C fire mortality to dead stem C', & - ptr_patch=this%m_livestemc_to_deadstemc_fire_patch, default='inactive') - - this%m_deadstemc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMC_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C fire mortality to litter', & - ptr_patch=this%m_deadstemc_to_litter_fire_patch, default='inactive') - - this%m_deadstemc_storage_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMC_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C storage fire mortality to litter', & - ptr_patch=this%m_deadstemc_storage_to_litter_fire_patch, default='inactive') - - this%m_deadstemc_xfer_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMC_XFER_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C transfer fire mortality to litter', & - ptr_patch=this%m_deadstemc_xfer_to_litter_fire_patch, default='inactive') - - this%m_frootc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTC_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='fine root C fire mortality to litter', & - ptr_patch=this%m_frootc_to_litter_fire_patch, default='inactive') - - this%m_frootc_storage_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTC_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='fine root C storage fire mortality to litter', & - ptr_patch=this%m_frootc_storage_to_litter_fire_patch, default='inactive') - - this%m_frootc_xfer_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTC_XFER_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='fine root C transfer fire mortality to litter', & - ptr_patch=this%m_frootc_xfer_to_litter_fire_patch, default='inactive') - - this%m_livecrootc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVEROOTC_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live root C fire mortality to litter', & - ptr_patch=this%m_livecrootc_to_litter_fire_patch, default='inactive') - - this%m_livecrootc_storage_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVEROOTC_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live root C storage fire mortality to litter', & - ptr_patch=this%m_livecrootc_storage_to_litter_fire_patch, default='inactive') - - this%m_livecrootc_xfer_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVEROOTC_XFER_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live root C transfer fire mortality to litter', & - ptr_patch=this%m_livecrootc_xfer_to_litter_fire_patch, default='inactive') - - this%m_livecrootc_to_deadcrootc_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVEROOTC_TO_DEADROOTC_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live root C fire mortality to dead root C', & - ptr_patch=this%m_livecrootc_to_deadcrootc_fire_patch, default='inactive') - - - this%m_deadcrootc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADROOTC_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead root C fire mortality to litter', & - ptr_patch=this%m_deadcrootc_to_litter_fire_patch, default='inactive') - - this%m_deadcrootc_storage_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADROOTC_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead root C storage fire mortality to litter', & - ptr_patch=this%m_deadcrootc_storage_to_litter_fire_patch, default='inactive') - - this%m_deadcrootc_xfer_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADROOTC_XFER_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead root C transfer fire mortality to litter', & - ptr_patch=this%m_deadcrootc_xfer_to_litter_fire_patch, default='inactive') - - this%m_livecrootc_storage_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTC_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C fire mortality to litter', & - ptr_patch=this%m_livecrootc_storage_to_litter_fire_patch, default='inactive') - - this%m_deadcrootc_storage_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTC_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C storage fire mortality to litter', & - ptr_patch=this%m_deadcrootc_storage_to_litter_fire_patch, default='inactive') - - this%m_gresp_storage_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_GRESP_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration storage fire mortality to litter', & - ptr_patch=this%m_gresp_storage_to_litter_fire_patch, default='inactive') - - this%m_gresp_xfer_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_GRESP_XFER_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration transfer fire mortality to litter', & - ptr_patch=this%m_gresp_xfer_to_litter_fire_patch, default='inactive') - - this%leafc_xfer_to_leafc_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_XFER_TO_LEAFC', units='gC/m^2/s', & - avgflag='A', long_name='leaf C growth from storage', & - ptr_patch=this%leafc_xfer_to_leafc_patch, default='inactive') - - this%frootc_xfer_to_frootc_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTC_XFER_TO_FROOTC', units='gC/m^2/s', & - avgflag='A', long_name='fine root C growth from storage', & - ptr_patch=this%frootc_xfer_to_frootc_patch, default='inactive') - - this%livestemc_xfer_to_livestemc_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMC_XFER_TO_LIVESTEMC', units='gC/m^2/s', & - avgflag='A', long_name='live stem C growth from storage', & - ptr_patch=this%livestemc_xfer_to_livestemc_patch, default='inactive') - - this%deadstemc_xfer_to_deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMC_XFER_TO_DEADSTEMC', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C growth from storage', & - ptr_patch=this%deadstemc_xfer_to_deadstemc_patch, default='inactive') - - this%livecrootc_xfer_to_livecrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTC_XFER_TO_LIVECROOTC', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C growth from storage', & - ptr_patch=this%livecrootc_xfer_to_livecrootc_patch, default='inactive') - - this%deadcrootc_xfer_to_deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTC_XFER_TO_DEADCROOTC', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C growth from storage', & - ptr_patch=this%deadcrootc_xfer_to_deadcrootc_patch, default='inactive') - - this%leafc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='leaf C litterfall', & - ptr_patch=this%leafc_to_litter_patch, default='inactive') - - if ( use_fun ) then - this%leafc_to_litter_fun_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_TO_LITTER_FUN', units='gC/m^2/s', & - avgflag='A', long_name='leaf C litterfall used by FUN', & - ptr_patch=this%leafc_to_litter_fun_patch, default='inactive') - end if - - this%frootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='fine root C litterfall', & - ptr_patch=this%frootc_to_litter_patch, default='inactive') - - this%cpool_to_resp_patch(begp:endp) = spval - call hist_addfld1d (fname='EXCESSC_MR', units='gC/m^2/s', & - avgflag='A', long_name='excess C maintenance respiration', & - ptr_patch=this%cpool_to_resp_patch, default='inactive') - this%leaf_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAF_MR', units='gC/m^2/s', & - avgflag='A', long_name='leaf maintenance respiration', & - ptr_patch=this%leaf_mr_patch, default='inactive') - - this%froot_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOT_MR', units='gC/m^2/s', & - avgflag='A', long_name='fine root maintenance respiration', & - ptr_patch=this%froot_mr_patch, default='inactive') - - this%livestem_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEM_MR', units='gC/m^2/s', & - avgflag='A', long_name='live stem maintenance respiration', & - ptr_patch=this%livestem_mr_patch, default='inactive') - - this%livecroot_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOT_MR', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root maintenance respiration', & - ptr_patch=this%livecroot_mr_patch, default='inactive') - - this%psnsun_to_cpool_patch(begp:endp) = spval - call hist_addfld1d (fname='PSNSUN_TO_CPOOL', units='gC/m^2/s', & - avgflag='A', long_name='C fixation from sunlit canopy', & - ptr_patch=this%psnsun_to_cpool_patch, default='inactive') - - this%psnshade_to_cpool_patch(begp:endp) = spval - call hist_addfld1d (fname='PSNSHADE_TO_CPOOL', units='gC/m^2/s', & - avgflag='A', long_name='C fixation from shaded canopy', & - ptr_patch=this%psnshade_to_cpool_patch, default='inactive') - - this%cpool_to_leafc_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_LEAFC', units='gC/m^2/s', & - avgflag='A', long_name='allocation to leaf C', & - ptr_patch=this%cpool_to_leafc_patch, default='inactive') - - this%cpool_to_leafc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_LEAFC_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to leaf C storage', & - ptr_patch=this%cpool_to_leafc_storage_patch, default='inactive') - - this%cpool_to_frootc_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_FROOTC', units='gC/m^2/s', & - avgflag='A', long_name='allocation to fine root C', & - ptr_patch=this%cpool_to_frootc_patch, default='inactive') - - this%cpool_to_frootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_FROOTC_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to fine root C storage', & - ptr_patch=this%cpool_to_frootc_storage_patch, default='inactive') - - this%cpool_to_livestemc_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_LIVESTEMC', units='gC/m^2/s', & - avgflag='A', long_name='allocation to live stem C', & - ptr_patch=this%cpool_to_livestemc_patch, default='inactive') - - this%cpool_to_livestemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_LIVESTEMC_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to live stem C storage', & - ptr_patch=this%cpool_to_livestemc_storage_patch, default='inactive') - - this%cpool_to_deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_DEADSTEMC', units='gC/m^2/s', & - avgflag='A', long_name='allocation to dead stem C', & - ptr_patch=this%cpool_to_deadstemc_patch, default='inactive') - - this%cpool_to_deadstemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_DEADSTEMC_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to dead stem C storage', & - ptr_patch=this%cpool_to_deadstemc_storage_patch, default='inactive') - - this%cpool_to_livecrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_LIVECROOTC', units='gC/m^2/s', & - avgflag='A', long_name='allocation to live coarse root C', & - ptr_patch=this%cpool_to_livecrootc_patch, default='inactive') - - this%cpool_to_livecrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_LIVECROOTC_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to live coarse root C storage', & - ptr_patch=this%cpool_to_livecrootc_storage_patch, default='inactive') - - this%cpool_to_deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_DEADCROOTC', units='gC/m^2/s', & - avgflag='A', long_name='allocation to dead coarse root C', & - ptr_patch=this%cpool_to_deadcrootc_patch, default='inactive') - - this%cpool_to_deadcrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_DEADCROOTC_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to dead coarse root C storage', & - ptr_patch=this%cpool_to_deadcrootc_storage_patch, default='inactive') - - this%cpool_to_gresp_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_GRESP_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to growth respiration storage', & - ptr_patch=this%cpool_to_gresp_storage_patch, default='inactive') - - this%cpool_leaf_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_LEAF_GR', units='gC/m^2/s', & - avgflag='A', long_name='leaf growth respiration', & - ptr_patch=this%cpool_leaf_gr_patch, default='inactive') - - this%cpool_leaf_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_LEAF_STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='leaf growth respiration to storage', & - ptr_patch=this%cpool_leaf_storage_gr_patch, default='inactive') - - this%transfer_leaf_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='TRANSFER_LEAF_GR', units='gC/m^2/s', & - avgflag='A', long_name='leaf growth respiration from storage', & - ptr_patch=this%transfer_leaf_gr_patch, default='inactive') - - this%cpool_froot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_FROOT_GR', units='gC/m^2/s', & - avgflag='A', long_name='fine root growth respiration', & - ptr_patch=this%cpool_froot_gr_patch, default='inactive') - - this%cpool_froot_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_FROOT_STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='fine root growth respiration to storage', & - ptr_patch=this%cpool_froot_storage_gr_patch, default='inactive') - - this%transfer_froot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='TRANSFER_FROOT_GR', units='gC/m^2/s', & - avgflag='A', long_name='fine root growth respiration from storage', & - ptr_patch=this%transfer_froot_gr_patch, default='inactive') - - this%cpool_livestem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_LIVESTEM_GR', units='gC/m^2/s', & - avgflag='A', long_name='live stem growth respiration', & - ptr_patch=this%cpool_livestem_gr_patch, default='inactive') - - this%cpool_livestem_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_LIVESTEM_STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='live stem growth respiration to storage', & - ptr_patch=this%cpool_livestem_storage_gr_patch, default='inactive') - - this%transfer_livestem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='TRANSFER_LIVESTEM_GR', units='gC/m^2/s', & - avgflag='A', long_name='live stem growth respiration from storage', & - ptr_patch=this%transfer_livestem_gr_patch, default='inactive') - - this%cpool_deadstem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_DEADSTEM_GR', units='gC/m^2/s', & - avgflag='A', long_name='dead stem growth respiration', & - ptr_patch=this%cpool_deadstem_gr_patch, default='inactive') - - this%cpool_deadstem_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_DEADSTEM_STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='dead stem growth respiration to storage', & - ptr_patch=this%cpool_deadstem_storage_gr_patch, default='inactive') - - this%transfer_deadstem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='TRANSFER_DEADSTEM_GR', units='gC/m^2/s', & - avgflag='A', long_name='dead stem growth respiration from storage', & - ptr_patch=this%transfer_deadstem_gr_patch, default='inactive') - - this%cpool_livecroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_LIVECROOT_GR', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root growth respiration', & - ptr_patch=this%cpool_livecroot_gr_patch, default='inactive') - - this%cpool_livecroot_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_LIVECROOT_STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root growth respiration to storage', & - ptr_patch=this%cpool_livecroot_storage_gr_patch, default='inactive') - - this%transfer_livecroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='TRANSFER_LIVECROOT_GR', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root growth respiration from storage', & - ptr_patch=this%transfer_livecroot_gr_patch, default='inactive') - - this%cpool_deadcroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_DEADCROOT_GR', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root growth respiration', & - ptr_patch=this%cpool_deadcroot_gr_patch, default='inactive') - - this%cpool_deadcroot_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_DEADCROOT_STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root growth respiration to storage', & - ptr_patch=this%cpool_deadcroot_storage_gr_patch, default='inactive') - - this%transfer_deadcroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='TRANSFER_DEADCROOT_GR', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root growth respiration from storage', & - ptr_patch=this%transfer_deadcroot_gr_patch, default='inactive') - - this%leafc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='leaf C shift storage to transfer', & - ptr_patch=this%leafc_storage_to_xfer_patch, default='inactive') - - this%frootc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTC_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='fine root C shift storage to transfer', & - ptr_patch=this%frootc_storage_to_xfer_patch, default='inactive') - - this%livestemc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMC_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='live stem C shift storage to transfer', & - ptr_patch=this%livestemc_storage_to_xfer_patch, default='inactive') - - this%deadstemc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMC_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C shift storage to transfer', & - ptr_patch=this%deadstemc_storage_to_xfer_patch, default='inactive') - - this%livecrootc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTC_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C shift storage to transfer', & - ptr_patch=this%livecrootc_storage_to_xfer_patch, default='inactive') - - this%deadcrootc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTC_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C shift storage to transfer', & - ptr_patch=this%deadcrootc_storage_to_xfer_patch, default='inactive') - - this%gresp_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='GRESP_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration shift storage to transfer', & - ptr_patch=this%gresp_storage_to_xfer_patch, default='inactive') - - this%livestemc_to_deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMC_TO_DEADSTEMC', units='gC/m^2/s', & - avgflag='A', long_name='live stem C turnover', & - ptr_patch=this%livestemc_to_deadstemc_patch, default='inactive') - - this%livecrootc_to_deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTC_TO_DEADCROOTC', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C turnover', & - ptr_patch=this%livecrootc_to_deadcrootc_patch, default='inactive') - - this%gpp_before_downreg_patch(begp:endp) = spval - call hist_addfld1d (fname='INIT_GPP', units='gC/m^2/s', & - avgflag='A', long_name='GPP flux before downregulation', & - ptr_patch=this%gpp_before_downreg_patch, default='inactive') - - this%current_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CURRENT_GR', units='gC/m^2/s', & - avgflag='A', long_name='growth resp for new growth displayed in this timestep', & - ptr_patch=this%current_gr_patch, default='inactive') - - this%transfer_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='TRANSFER_GR', units='gC/m^2/s', & - avgflag='A', long_name='growth resp for transfer growth displayed in this timestep', & - ptr_patch=this%transfer_gr_patch, default='inactive') - - this%storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='growth resp for growth sent to storage for later display', & - ptr_patch=this%storage_gr_patch, default='inactive') - - this%availc_patch(begp:endp) = spval - call hist_addfld1d (fname='AVAILC', units='gC/m^2/s', & - avgflag='A', long_name='C flux available for allocation', & - ptr_patch=this%availc_patch, default='inactive') - - this%plant_calloc_patch(begp:endp) = spval - call hist_addfld1d (fname='PLANT_CALLOC', units='gC/m^2/s', & - avgflag='A', long_name='total allocated C flux', & - ptr_patch=this%plant_calloc_patch, default='inactive') - - this%excess_cflux_patch(begp:endp) = spval - call hist_addfld1d (fname='EXCESS_CFLUX', units='gC/m^2/s', & - avgflag='A', long_name='C flux not allocated due to downregulation', & - ptr_patch=this%excess_cflux_patch, default='inactive') - - this%prev_leafc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='PREV_LEAFC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='previous timestep leaf C litterfall flux', & - ptr_patch=this%prev_leafc_to_litter_patch, default='inactive') - - this%prev_frootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='PREV_FROOTC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='previous timestep froot C litterfall flux', & - ptr_patch=this%prev_frootc_to_litter_patch, default='inactive') - - this%xsmrpool_recover_patch(begp:endp) = spval - call hist_addfld1d (fname='XSMRPOOL_RECOVER', units='gC/m^2/s', & - avgflag='A', long_name='C flux assigned to recovery of negative xsmrpool', & - ptr_patch=this%xsmrpool_recover_patch, default='inactive') - - this%gpp_patch(begp:endp) = spval - call hist_addfld1d (fname='GPP', units='gC/m^2/s', & - avgflag='A', long_name='gross primary production', & - ptr_patch=this%gpp_patch, default='inactive') - - this%rr_patch(begp:endp) = spval - call hist_addfld1d (fname='RR', units='gC/m^2/s', & - avgflag='A', long_name='root respiration (fine root MR + total root GR)', & - ptr_patch=this%rr_patch, default='inactive') - - this%mr_patch(begp:endp) = spval - call hist_addfld1d (fname='MR', units='gC/m^2/s', & - avgflag='A', long_name='maintenance respiration', & - ptr_patch=this%mr_patch, default='inactive') - - this%gr_patch(begp:endp) = spval - call hist_addfld1d (fname='GR', units='gC/m^2/s', & - avgflag='A', long_name='total growth respiration', & - ptr_patch=this%gr_patch, default='inactive') - - this%ar_patch(begp:endp) = spval - call hist_addfld1d (fname='AR', units='gC/m^2/s', & - avgflag='A', long_name='autotrophic respiration (MR + GR)', & - ptr_patch=this%ar_patch, default='inactive') - - this%npp_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP', units='gC/m^2/s', & - avgflag='A', long_name='net primary production', & - ptr_patch=this%npp_patch, default='inactive') - - this%agnpp_patch(begp:endp) = spval - call hist_addfld1d (fname='AGNPP', units='gC/m^2/s', & - avgflag='A', long_name='aboveground NPP', & - ptr_patch=this%agnpp_patch, default='inactive') - - this%bgnpp_patch(begp:endp) = spval - call hist_addfld1d (fname='BGNPP', units='gC/m^2/s', & - avgflag='A', long_name='belowground NPP', & - ptr_patch=this%bgnpp_patch, default='inactive') - - this%litfall_patch(begp:endp) = spval - call hist_addfld1d (fname='LITFALL', units='gC/m^2/s', & - avgflag='A', long_name='litterfall (leaves and fine roots)', & - ptr_patch=this%litfall_patch, default='inactive') - - this%wood_harvestc_patch(begp:endp) = spval - call hist_addfld1d (fname='WOOD_HARVESTC', units='gC/m^2/s', & - avgflag='A', long_name='wood harvest carbon (to product pools)', & - ptr_patch=this%wood_harvestc_patch, default='inactive') - - this%slash_harvestc_patch(begp:endp) = spval - call hist_addfld1d (fname='SLASH_HARVESTC', units='gC/m^2/s', & - avgflag='A', long_name='slash harvest carbon (to litter)', & - ptr_patch=this%slash_harvestc_patch, default='inactive') - - this%fire_closs_patch(begp:endp) = spval - call hist_addfld1d (fname='PFT_FIRE_CLOSS', units='gC/m^2/s', & - avgflag='A', long_name='total patch-level fire C loss for non-peat fires outside land-type converted region', & - ptr_patch=this%fire_closs_patch, default='inactive') - - if ( use_fun ) then - this%npp_Nactive_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NACTIVE', units='gC/m^2/s', & - avgflag='A', long_name='Mycorrhizal N uptake used C', & - ptr_patch=this%npp_Nactive_patch, default='inactive') - - ! BUG(wjs, 2016-04-13, bugz 2292) This field has a threading bug. Making it - ! inactive for now. - this%npp_burnedoff_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_BURNEDOFF', units='gC/m^2/s', & - avgflag='A', long_name='C that cannot be used for N uptake', & - ptr_patch=this%npp_burnedoff_patch, default='inactive') - - this%npp_Nnonmyc_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NNONMYC', units='gC/m^2/s', & - avgflag='A', long_name='Non-mycorrhizal N uptake used C', & - ptr_patch=this%npp_Nnonmyc_patch, default='inactive') - - this%npp_Nam_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NAM', units='gC/m^2/s', & - avgflag='A', long_name='AM-associated N uptake used C', & - ptr_patch=this%npp_Nam_patch, default='inactive') - - this%npp_Necm_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NECM', units='gC/m^2/s', & - avgflag='A', long_name='ECM-associated N uptake used C', & - ptr_patch=this%npp_Necm_patch, default='inactive') - - if (use_nitrif_denitrif) then - this%npp_Nactive_no3_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NACTIVE_NO3', units='gC/m^2/s', & - avgflag='A', long_name='Mycorrhizal N uptake used C', & - ptr_patch=this%npp_Nactive_no3_patch, default='inactive') - - this%npp_Nactive_nh4_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NACTIVE_NH4', units='gC/m^2/s', & - avgflag='A', long_name='Mycorrhizal N uptake use C', & - ptr_patch=this%npp_Nactive_nh4_patch, default='inactive') - - this%npp_Nnonmyc_no3_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NNONMYC_NO3', units='gC/m^2/s', & - avgflag='A', long_name='Non-mycorrhizal N uptake use C', & - ptr_patch=this%npp_Nnonmyc_no3_patch, default='inactive') - - this%npp_Nnonmyc_nh4_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NNONMYC_NH4', units='gC/m^2/s', & - avgflag='A', long_name='Non-mycorrhizal N uptake use C', & - ptr_patch=this%npp_Nnonmyc_nh4_patch, default='inactive') - - this%npp_Nam_no3_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NAM_NO3', units='gC/m^2/s', & - avgflag='A', long_name='AM-associated N uptake use C', & - ptr_patch=this%npp_Nam_no3_patch, default='inactive') - - this%npp_Nam_nh4_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NAM_NH4', units='gC/m^2/s', & - avgflag='A', long_name='AM-associated N uptake use C', & - ptr_patch=this%npp_Nam_nh4_patch, default='inactive') - - this%npp_Necm_no3_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NECM_NO3', units='gC/m^2/s', & - avgflag='A', long_name='ECM-associated N uptake used C', & - ptr_patch=this%npp_Necm_no3_patch, default='inactive') - - this%npp_Necm_nh4_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NECM_NH4', units='gC/m^2/s', & - avgflag='A', long_name='ECM-associated N uptake use C', & - ptr_patch=this%npp_Necm_nh4_patch, default='inactive') - end if - - this%npp_Nfix_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NFIX', units='gC/m^2/s', & - avgflag='A', long_name='Symbiotic BNF uptake used C', & - ptr_patch=this%npp_Nfix_patch, default='inactive') - - this%npp_Nretrans_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NRETRANS', units='gC/m^2/s', & - avgflag='A', long_name='Retranslocated N uptake flux', & - ptr_patch=this%npp_Nretrans_patch, default='inactive') - - this%npp_Nuptake_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NUPTAKE', units='gC/m^2/s', & - avgflag='A', long_name='Total C used by N uptake in FUN', & - ptr_patch=this%npp_Nuptake_patch, default='inactive') - - this%npp_growth_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_GROWTH', units='gC/m^2/s', & - avgflag='A', long_name='Total C used for growth in FUN', & - ptr_patch=this%npp_growth_patch, default='inactive') - - - - this%leafc_change_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_CHANGE', units='gC/m^2/s', & - avgflag='A', long_name='C change in leaf', & - ptr_patch=this%leafc_change_patch, default='inactive') - - this%soilc_change_patch(begp:endp) = spval - call hist_addfld1d (fname='SOILC_CHANGE', units='gC/m^2/s', & - avgflag='A', long_name='C change in soil', & - ptr_patch=this%soilc_change_patch, default='inactive') - end if -! FUN Ends - - end if ! end of if-c12 - - !------------------------------- - ! C13 flux variables - patch - !------------------------------- - - if ( carbon_type == 'c13') then - - this%gpp_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_GPP', units='gC13/m^2/s', & - avgflag='A', long_name='C13 gross primary production', & - ptr_patch=this%gpp_patch, default='inactive') - - this%rr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_RR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 root respiration (fine root MR + total root GR)', & - ptr_patch=this%rr_patch, default='inactive') - - this%mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_MR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 maintenance respiration', & - ptr_patch=this%mr_patch, default='inactive') - - this%gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total growth respiration', & - ptr_patch=this%gr_patch, default='inactive') - - this%ar_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_AR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 autotrophic respiration (MR + GR)', & - ptr_patch=this%ar_patch, default='inactive') - - this%npp_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_NPP', units='gC13/m^2/s', & - avgflag='A', long_name='C13 net primary production', & - ptr_patch=this%npp_patch, default='inactive') - - this%agnpp_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_AGNPP', units='gC13/m^2/s', & - avgflag='A', long_name='C13 aboveground NPP', & - ptr_patch=this%agnpp_patch, default='inactive') - - this%bgnpp_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_BGNPP', units='gC13/m^2/s', & - avgflag='A', long_name='C13 belowground NPP', & - ptr_patch=this%bgnpp_patch, default='inactive') - - this%litfall_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LITFALL', units='gC13/m^2/s', & - avgflag='A', long_name='C13 litterfall (leaves and fine roots)', & - ptr_patch=this%litfall_patch, default='inactive') - - this%fire_closs_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_PFT_FIRE_CLOSS', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total patch-level fire C loss', & - ptr_patch=this%fire_closs_patch, default='inactive') - - this%m_leafc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LEAFC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C mortality', & - ptr_patch=this%m_leafc_to_litter_patch, default='inactive') - - this%m_frootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_FROOTC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C mortality', & - ptr_patch=this%m_frootc_to_litter_patch, default='inactive') - - this%m_leafc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LEAFC_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C storage mortality', & - ptr_patch=this%m_leafc_storage_to_litter_patch, default='inactive') - - this%m_frootc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_FROOTC_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C storage mortality', & - ptr_patch=this%m_frootc_storage_to_litter_patch, default='inactive') - - this%m_livestemc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVESTEMC_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C storage mortality', & - ptr_patch=this%m_livestemc_storage_to_litter_patch, default='inactive') - - this%m_deadstemc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADSTEMC_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C storage mortality', & - ptr_patch=this%m_deadstemc_storage_to_litter_patch, default='inactive') - - this%m_livecrootc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVECROOTC_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C storage mortality', & - ptr_patch=this%m_livecrootc_storage_to_litter_patch, default='inactive') - - this%m_deadcrootc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADCROOTC_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C storage mortality', & - ptr_patch=this%m_deadcrootc_storage_to_litter_patch, default='inactive') - - this%m_leafc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LEAFC_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C transfer mortality', & - ptr_patch=this%m_leafc_xfer_to_litter_patch, default='inactive') - - this%m_frootc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_FROOTC_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C transfer mortality', & - ptr_patch=this%m_frootc_xfer_to_litter_patch, default='inactive') - - this%m_livestemc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVESTEMC_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C transfer mortality', & - ptr_patch=this%m_livestemc_xfer_to_litter_patch, default='inactive') - - this%m_deadstemc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADSTEMC_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C transfer mortality', & - ptr_patch=this%m_deadstemc_xfer_to_litter_patch, default='inactive') - - this%m_livecrootc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVECROOTC_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C transfer mortality', & - ptr_patch=this%m_livecrootc_xfer_to_litter_patch, default='inactive') - - this%m_deadcrootc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADCROOTC_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C transfer mortality', & - ptr_patch=this%m_deadcrootc_xfer_to_litter_patch, default='inactive') - - this%m_livestemc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVESTEMC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C mortality', & - ptr_patch=this%m_livestemc_to_litter_patch, default='inactive') - - this%m_deadstemc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADSTEMC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C mortality', & - ptr_patch=this%m_deadstemc_to_litter_patch, default='inactive') - - this%m_livecrootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVECROOTC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C mortality', & - ptr_patch=this%m_livecrootc_to_litter_patch, default='inactive') - - this%m_deadcrootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADCROOTC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C mortality', & - ptr_patch=this%m_deadcrootc_to_litter_patch, default='inactive') - - this%m_gresp_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_GRESP_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth respiration storage mortality', & - ptr_patch=this%m_gresp_storage_to_litter_patch, default='inactive') - - this%m_gresp_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_GRESP_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth respiration transfer mortality', & - ptr_patch=this%m_gresp_xfer_to_litter_patch, default='inactive') - - this%m_leafc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LEAFC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C fire loss', & - ptr_patch=this%m_leafc_to_fire_patch, default='inactive') - - this%m_frootc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_FROOTC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C fire loss', & - ptr_patch=this%m_frootc_to_fire_patch, default='inactive') - - this%m_leafc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LEAFC_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C storage fire loss', & - ptr_patch=this%m_leafc_storage_to_fire_patch, default='inactive') - - this%m_frootc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_FROOTC_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C storage fire loss', & - ptr_patch=this%m_frootc_storage_to_fire_patch, default='inactive') - - this%m_livestemc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVESTEMC_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C storage fire loss', & - ptr_patch=this%m_livestemc_storage_to_fire_patch, default='inactive') - - this%m_deadstemc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADSTEMC_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C storage fire loss', & - ptr_patch=this%m_deadstemc_storage_to_fire_patch, default='inactive') - - this%m_livecrootc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVECROOTC_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C storage fire loss', & - ptr_patch=this%m_livecrootc_storage_to_fire_patch, default='inactive') - - this%m_deadcrootc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADCROOTC_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C storage fire loss', & - ptr_patch=this%m_deadcrootc_storage_to_fire_patch, default='inactive') - - this%m_leafc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LEAFC_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C transfer fire loss', & - ptr_patch=this%m_leafc_xfer_to_fire_patch, default='inactive') - - this%m_frootc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_FROOTC_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C transfer fire loss', & - ptr_patch=this%m_frootc_xfer_to_fire_patch, default='inactive') - - this%m_livestemc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVESTEMC_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C transfer fire loss', & - ptr_patch=this%m_livestemc_xfer_to_fire_patch, default='inactive') - - this%m_deadstemc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADSTEMC_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C transfer fire loss', & - ptr_patch=this%m_deadstemc_xfer_to_fire_patch, default='inactive') - - this%m_livecrootc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVECROOTC_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C transfer fire loss', & - ptr_patch=this%m_livecrootc_xfer_to_fire_patch, default='inactive') - - this%m_deadcrootc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADCROOTC_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C transfer fire loss', & - ptr_patch=this%m_deadcrootc_xfer_to_fire_patch, default='inactive') - - this%m_livestemc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVESTEMC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C fire loss', & - ptr_patch=this%m_livestemc_to_fire_patch, default='inactive') - - this%m_deadstemc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADSTEMC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C fire loss', & - ptr_patch=this%m_deadstemc_to_fire_patch, default='inactive') - - this%m_deadstemc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADSTEMC_TO_LITTER_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C fire mortality to litter', & - ptr_patch=this%m_deadstemc_to_litter_fire_patch, default='inactive') - - this%m_livecrootc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVECROOTC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C fire loss', & - ptr_patch=this%m_livecrootc_to_fire_patch, default='inactive') - - this%m_deadcrootc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADCROOTC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C fire loss', & - ptr_patch=this%m_deadcrootc_to_fire_patch, default='inactive') - - this%m_deadcrootc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADCROOTC_TO_LITTER_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C fire mortality to litter', & - ptr_patch=this%m_deadcrootc_to_litter_fire_patch, default='inactive') - - this%m_gresp_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_GRESP_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth respiration storage fire loss', & - ptr_patch=this%m_gresp_storage_to_fire_patch, default='inactive') - - this%m_gresp_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_GRESP_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth respiration transfer fire loss', & - ptr_patch=this%m_gresp_xfer_to_fire_patch, default='inactive') - - this%leafc_xfer_to_leafc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LEAFC_XFER_TO_LEAFC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C growth from storage', & - ptr_patch=this%leafc_xfer_to_leafc_patch, default='inactive') - - this%frootc_xfer_to_frootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_FROOTC_XFER_TO_FROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C growth from storage', & - ptr_patch=this%frootc_xfer_to_frootc_patch, default='inactive') - - this%livestemc_xfer_to_livestemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVESTEMC_XFER_TO_LIVESTEMC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C growth from storage', & - ptr_patch=this%livestemc_xfer_to_livestemc_patch, default='inactive') - - this%deadstemc_xfer_to_deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADSTEMC_XFER_TO_DEADSTEMC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C growth from storage', & - ptr_patch=this%deadstemc_xfer_to_deadstemc_patch, default='inactive') - - this%livecrootc_xfer_to_livecrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVECROOTC_XFER_TO_LIVECROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C growth from storage', & - ptr_patch=this%livecrootc_xfer_to_livecrootc_patch, default='inactive') - - this%deadcrootc_xfer_to_deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADCROOTC_XFER_TO_DEADCROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C growth from storage', & - ptr_patch=this%deadcrootc_xfer_to_deadcrootc_patch, default='inactive') - - this%leafc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LEAFC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C litterfall', & - ptr_patch=this%leafc_to_litter_patch, default='inactive') - - this%frootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_FROOTC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C litterfall', & - ptr_patch=this%frootc_to_litter_patch, default='inactive') - - this%leaf_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LEAF_MR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf maintenance respiration', & - ptr_patch=this%leaf_mr_patch, default='inactive') - - this%froot_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_FROOT_MR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root maintenance respiration', & - ptr_patch=this%froot_mr_patch, default='inactive') - - this%livestem_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVESTEM_MR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem maintenance respiration', & - ptr_patch=this%livestem_mr_patch, default='inactive') - - this%livecroot_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVECROOT_MR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root maintenance respiration', & - ptr_patch=this%livecroot_mr_patch, default='inactive') - - this%psnsun_to_cpool_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_PSNSUN_TO_CPOOL', units='gC13/m^2/s', & - avgflag='A', long_name='C13 C fixation from sunlit canopy', & - ptr_patch=this%psnsun_to_cpool_patch, default='inactive') - - this%psnshade_to_cpool_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_PSNSHADE_TO_CPOOL', units='gC13/m^2/s', & - avgflag='A', long_name='C13 C fixation from shaded canopy', & - ptr_patch=this%psnshade_to_cpool_patch, default='inactive') - - this%cpool_to_leafc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_LEAFC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to leaf C', & - ptr_patch=this%cpool_to_leafc_patch, default='inactive') - - this%cpool_to_leafc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_LEAFC_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to leaf C storage', & - ptr_patch=this%cpool_to_leafc_storage_patch, default='inactive') - - this%cpool_to_frootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_FROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to fine root C', & - ptr_patch=this%cpool_to_frootc_patch, default='inactive') - - this%cpool_to_frootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_FROOTC_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to fine root C storage', & - ptr_patch=this%cpool_to_frootc_storage_patch, default='inactive') - - this%cpool_to_livestemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_LIVESTEMC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to live stem C', & - ptr_patch=this%cpool_to_livestemc_patch, default='inactive') - - this%cpool_to_livestemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_LIVESTEMC_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to live stem C storage', & - ptr_patch=this%cpool_to_livestemc_storage_patch, default='inactive') - - this%cpool_to_deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_DEADSTEMC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to dead stem C', & - ptr_patch=this%cpool_to_deadstemc_patch, default='inactive') - - this%cpool_to_deadstemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_DEADSTEMC_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to dead stem C storage', & - ptr_patch=this%cpool_to_deadstemc_storage_patch, default='inactive') - - this%cpool_to_livecrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_LIVECROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to live coarse root C', & - ptr_patch=this%cpool_to_livecrootc_patch, default='inactive') - - this%cpool_to_livecrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_LIVECROOTC_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to live coarse root C storage', & - ptr_patch=this%cpool_to_livecrootc_storage_patch, default='inactive') - - this%cpool_to_deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_DEADCROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to dead coarse root C', & - ptr_patch=this%cpool_to_deadcrootc_patch, default='inactive') - - this%cpool_to_deadcrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_DEADCROOTC_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to dead coarse root C storage', & - ptr_patch=this%cpool_to_deadcrootc_storage_patch, default='inactive') - - this%cpool_to_gresp_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_GRESP_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to growth respiration storage', & - ptr_patch=this%cpool_to_gresp_storage_patch, default='inactive') - - this%cpool_leaf_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_LEAF_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf growth respiration', & - ptr_patch=this%cpool_leaf_gr_patch, default='inactive') - - this%cpool_leaf_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_LEAF_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf growth respiration to storage', & - ptr_patch=this%cpool_leaf_storage_gr_patch, default='inactive') - - this%transfer_leaf_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_TRANSFER_LEAF_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf growth respiration from storage', & - ptr_patch=this%transfer_leaf_gr_patch, default='inactive') - - this%cpool_froot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_FROOT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root growth respiration', & - ptr_patch=this%cpool_froot_gr_patch, default='inactive') - - this%cpool_froot_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_FROOT_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root growth respiration to storage', & - ptr_patch=this%cpool_froot_storage_gr_patch, default='inactive') - - this%transfer_froot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_TRANSFER_FROOT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root growth respiration from storage', & - ptr_patch=this%transfer_froot_gr_patch, default='inactive') - - this%cpool_livestem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_LIVESTEM_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem growth respiration', & - ptr_patch=this%cpool_livestem_gr_patch, default='inactive') - - this%cpool_livestem_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_LIVESTEM_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem growth respiration to storage', & - ptr_patch=this%cpool_livestem_storage_gr_patch, default='inactive') - - this%transfer_livestem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_TRANSFER_LIVESTEM_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem growth respiration from storage', & - ptr_patch=this%transfer_livestem_gr_patch, default='inactive') - - this%cpool_deadstem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_DEADSTEM_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem growth respiration', & - ptr_patch=this%cpool_deadstem_gr_patch, default='inactive') - - this%cpool_deadstem_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_DEADSTEM_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem growth respiration to storage', & - ptr_patch=this%cpool_deadstem_storage_gr_patch, default='inactive') - - this%transfer_deadstem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_TRANSFER_DEADSTEM_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem growth respiration from storage', & - ptr_patch=this%transfer_deadstem_gr_patch, default='inactive') - - this%cpool_livecroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_LIVECROOT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root growth respiration', & - ptr_patch=this%cpool_livecroot_gr_patch, default='inactive') - - this%cpool_livecroot_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_LIVECROOT_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root growth respiration to storage', & - ptr_patch=this%cpool_livecroot_storage_gr_patch, default='inactive') - - this%transfer_livecroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_TRANSFER_LIVECROOT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root growth respiration from storage', & - ptr_patch=this%transfer_livecroot_gr_patch, default='inactive') - - this%cpool_deadcroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_DEADCROOT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root growth respiration', & - ptr_patch=this%cpool_deadcroot_gr_patch, default='inactive') - - this%cpool_deadcroot_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_DEADCROOT_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root growth respiration to storage', & - ptr_patch=this%cpool_deadcroot_storage_gr_patch, default='inactive') - - this%transfer_deadcroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_TRANSFER_DEADCROOT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root growth respiration from storage', & - ptr_patch=this%transfer_deadcroot_gr_patch, default='inactive') - - this%leafc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LEAFC_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C shift storage to transfer', & - ptr_patch=this%leafc_storage_to_xfer_patch, default='inactive') - - this%frootc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_FROOTC_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C shift storage to transfer', & - ptr_patch=this%frootc_storage_to_xfer_patch, default='inactive') - - this%livestemc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVESTEMC_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C shift storage to transfer', & - ptr_patch=this%livestemc_storage_to_xfer_patch, default='inactive') - - this%deadstemc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADSTEMC_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C shift storage to transfer', & - ptr_patch=this%deadstemc_storage_to_xfer_patch, default='inactive') - - this%livecrootc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVECROOTC_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C shift storage to transfer', & - ptr_patch=this%livecrootc_storage_to_xfer_patch, default='inactive') - - this%deadcrootc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADCROOTC_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C shift storage to transfer', & - ptr_patch=this%deadcrootc_storage_to_xfer_patch, default='inactive') - - this%gresp_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_GRESP_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth respiration shift storage to transfer', & - ptr_patch=this%gresp_storage_to_xfer_patch, default='inactive') - - this%livestemc_to_deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVESTEMC_TO_DEADSTEMC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C turnover', & - ptr_patch=this%livestemc_to_deadstemc_patch, default='inactive') - - this%livecrootc_to_deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVECROOTC_TO_DEADCROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C turnover', & - ptr_patch=this%livecrootc_to_deadcrootc_patch, default='inactive') - - this%current_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CURRENT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth resp for new growth displayed in this timestep', & - ptr_patch=this%current_gr_patch, default='inactive') - - this%transfer_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_TRANSFER_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth resp for transfer growth displayed in this timestep', & - ptr_patch=this%transfer_gr_patch, default='inactive') - - this%storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth resp for growth sent to storage for later display', & - ptr_patch=this%storage_gr_patch, default='inactive') - - this%xsmrpool_c13ratio_patch(begp:endp) = spval - call hist_addfld1d (fname='XSMRPOOL_C13RATIO', units='proportion', & - avgflag='A', long_name='C13/C(12+13) ratio for xsmrpool', & - ptr_patch=this%xsmrpool_c13ratio_patch, default='inactive') - - endif - - !------------------------------- - ! C14 flux variables - patch - !------------------------------- - - if ( carbon_type == 'c14' ) then - - this%m_leafc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LEAFC_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf C mortality', & - ptr_patch=this%m_leafc_to_litter_patch, default='inactive') - - this%m_frootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_FROOTC_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root C mortality', & - ptr_patch=this%m_frootc_to_litter_patch, default='inactive') - - this%m_leafc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LEAFC_STORAGE_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf C storage mortality', & - ptr_patch=this%m_leafc_storage_to_litter_patch, default='inactive') - - this%m_frootc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_FROOTC_STORAGE_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root C storage mortality', & - ptr_patch=this%m_frootc_storage_to_litter_patch, default='inactive') - - this%m_livestemc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVESTEMC_STORAGE_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem C storage mortality', & - ptr_patch=this%m_livestemc_storage_to_litter_patch, default='inactive') - - this%m_deadstemc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADSTEMC_STORAGE_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem C storage mortality', & - ptr_patch=this%m_deadstemc_storage_to_litter_patch, default='inactive') - - this%m_livecrootc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVECROOTC_STORAGE_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root C storage mortality', & - ptr_patch=this%m_livecrootc_storage_to_litter_patch, default='inactive') - - this%m_deadcrootc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADCROOTC_STORAGE_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root C storage mortality', & - ptr_patch=this%m_deadcrootc_storage_to_litter_patch, default='inactive') - - this%m_leafc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LEAFC_XFER_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf C transfer mortality', & - ptr_patch=this%m_leafc_xfer_to_litter_patch, default='inactive') - - this%m_frootc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_FROOTC_XFER_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root C transfer mortality', & - ptr_patch=this%m_frootc_xfer_to_litter_patch, default='inactive') - - this%m_livestemc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVESTEMC_XFER_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem C transfer mortality', & - ptr_patch=this%m_livestemc_xfer_to_litter_patch, default='inactive') - - this%m_deadstemc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADSTEMC_XFER_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem C transfer mortality', & - ptr_patch=this%m_deadstemc_xfer_to_litter_patch, default='inactive') - - this%m_livecrootc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVECROOTC_XFER_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root C transfer mortality', & - ptr_patch=this%m_livecrootc_xfer_to_litter_patch, default='inactive') - - this%m_deadcrootc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADCROOTC_XFER_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root C transfer mortality', & - ptr_patch=this%m_deadcrootc_xfer_to_litter_patch, default='inactive') - - this%m_livestemc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVESTEMC_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem C mortality', & - ptr_patch=this%m_livestemc_to_litter_patch, default='inactive') - - this%m_deadstemc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADSTEMC_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem C mortality', & - ptr_patch=this%m_deadstemc_to_litter_patch, default='inactive') - - this%m_livecrootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVECROOTC_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root C mortality', & - ptr_patch=this%m_livecrootc_to_litter_patch, default='inactive') - - this%m_deadcrootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADCROOTC_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root C mortality', & - ptr_patch=this%m_deadcrootc_to_litter_patch, default='inactive') - - this%m_gresp_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_GRESP_STORAGE_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 growth respiration storage mortality', & - ptr_patch=this%m_gresp_storage_to_litter_patch, default='inactive') - - this%m_gresp_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_GRESP_XFER_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 growth respiration transfer mortality', & - ptr_patch=this%m_gresp_xfer_to_litter_patch, default='inactive') - - this%m_leafc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LEAFC_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf C fire loss', & - ptr_patch=this%m_leafc_to_fire_patch, default='inactive') - - this%m_frootc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_FROOTC_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root C fire loss', & - ptr_patch=this%m_frootc_to_fire_patch, default='inactive') - - this%m_leafc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LEAFC_STORAGE_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf C storage fire loss', & - ptr_patch=this%m_leafc_storage_to_fire_patch, default='inactive') - - this%m_frootc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_FROOTC_STORAGE_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root C storage fire loss', & - ptr_patch=this%m_frootc_storage_to_fire_patch, default='inactive') - - this%m_livestemc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVESTEMC_STORAGE_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem C storage fire loss', & - ptr_patch=this%m_livestemc_storage_to_fire_patch, default='inactive') - - this%m_deadstemc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADSTEMC_STORAGE_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem C storage fire loss', & - ptr_patch=this%m_deadstemc_storage_to_fire_patch, default='inactive') - - this%m_livecrootc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVECROOTC_STORAGE_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root C storage fire loss', & - ptr_patch=this%m_livecrootc_storage_to_fire_patch, default='inactive') - - this%m_deadcrootc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADCROOTC_STORAGE_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root C storage fire loss', & - ptr_patch=this%m_deadcrootc_storage_to_fire_patch, default='inactive') - - this%m_leafc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LEAFC_XFER_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf C transfer fire loss', & - ptr_patch=this%m_leafc_xfer_to_fire_patch, default='inactive') - - this%m_frootc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_FROOTC_XFER_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root C transfer fire loss', & - ptr_patch=this%m_frootc_xfer_to_fire_patch, default='inactive') - - this%m_livestemc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVESTEMC_XFER_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem C transfer fire loss', & - ptr_patch=this%m_livestemc_xfer_to_fire_patch, default='inactive') - - this%m_deadstemc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADSTEMC_XFER_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem C transfer fire loss', & - ptr_patch=this%m_deadstemc_xfer_to_fire_patch, default='inactive') - - this%m_livecrootc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVECROOTC_XFER_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root C transfer fire loss', & - ptr_patch=this%m_livecrootc_xfer_to_fire_patch, default='inactive') - - this%m_deadcrootc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADCROOTC_XFER_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root C transfer fire loss', & - ptr_patch=this%m_deadcrootc_xfer_to_fire_patch, default='inactive') - - this%m_livestemc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVESTEMC_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem C fire loss', & - ptr_patch=this%m_livestemc_to_fire_patch, default='inactive') - - this%m_deadstemc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADSTEMC_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem C fire loss', & - ptr_patch=this%m_deadstemc_to_fire_patch, default='inactive') - - this%m_deadstemc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADSTEMC_TO_LITTER_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem C fire mortality to litter', & - ptr_patch=this%m_deadstemc_to_litter_fire_patch, default='inactive') - - this%m_livecrootc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVECROOTC_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root C fire loss', & - ptr_patch=this%m_livecrootc_to_fire_patch, default='inactive') - - this%m_deadcrootc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADCROOTC_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root C fire loss', & - ptr_patch=this%m_deadcrootc_to_fire_patch, default='inactive') - - this%m_deadcrootc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADCROOTC_TO_LITTER_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root C fire mortality to litter', & - ptr_patch=this%m_deadcrootc_to_litter_fire_patch, default='inactive') - - this%m_gresp_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_GRESP_STORAGE_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 growth respiration storage fire loss', & - ptr_patch=this%m_gresp_storage_to_fire_patch, default='inactive') - - this%m_gresp_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_GRESP_XFER_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 growth respiration transfer fire loss', & - ptr_patch=this%m_gresp_xfer_to_fire_patch, default='inactive') - - this%leafc_xfer_to_leafc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LEAFC_XFER_TO_LEAFC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf C growth from storage', & - ptr_patch=this%leafc_xfer_to_leafc_patch, default='inactive') - - this%frootc_xfer_to_frootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_FROOTC_XFER_TO_FROOTC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root C growth from storage', & - ptr_patch=this%frootc_xfer_to_frootc_patch, default='inactive') - - this%livestemc_xfer_to_livestemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVESTEMC_XFER_TO_LIVESTEMC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem C growth from storage', & - ptr_patch=this%livestemc_xfer_to_livestemc_patch, default='inactive') - - this%deadstemc_xfer_to_deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADSTEMC_XFER_TO_DEADSTEMC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem C growth from storage', & - ptr_patch=this%deadstemc_xfer_to_deadstemc_patch, default='inactive') - - this%livecrootc_xfer_to_livecrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVECROOTC_XFER_TO_LIVECROOTC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root C growth from storage', & - ptr_patch=this%livecrootc_xfer_to_livecrootc_patch, default='inactive') - - this%deadcrootc_xfer_to_deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADCROOTC_XFER_TO_DEADCROOTC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root C growth from storage', & - ptr_patch=this%deadcrootc_xfer_to_deadcrootc_patch, default='inactive') - - this%leafc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LEAFC_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf C litterfall', & - ptr_patch=this%leafc_to_litter_patch, default='inactive') - - this%frootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_FROOTC_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root C litterfall', & - ptr_patch=this%frootc_to_litter_patch, default='inactive') - - this%leaf_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LEAF_MR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf maintenance respiration', & - ptr_patch=this%leaf_mr_patch, default='inactive') - - this%froot_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_FROOT_MR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root maintenance respiration', & - ptr_patch=this%froot_mr_patch, default='inactive') - - this%livestem_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVESTEM_MR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem maintenance respiration', & - ptr_patch=this%livestem_mr_patch, default='inactive') - - this%livecroot_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVECROOT_MR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root maintenance respiration', & - ptr_patch=this%livecroot_mr_patch, default='inactive') - - this%psnsun_to_cpool_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_PSNSUN_TO_CPOOL', units='gC14/m^2/s', & - avgflag='A', long_name='C14 C fixation from sunlit canopy', & - ptr_patch=this%psnsun_to_cpool_patch, default='inactive') - - this%psnshade_to_cpool_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_PSNSHADE_TO_CPOOL', units='gC14/m^2/s', & - avgflag='A', long_name='C14 C fixation from shaded canopy', & - ptr_patch=this%psnshade_to_cpool_patch, default='inactive') - - this%cpool_to_leafc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_LEAFC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to leaf C', & - ptr_patch=this%cpool_to_leafc_patch, default='inactive') - - this%cpool_to_leafc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_LEAFC_STORAGE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to leaf C storage', & - ptr_patch=this%cpool_to_leafc_storage_patch, default='inactive') - - this%cpool_to_frootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_FROOTC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to fine root C', & - ptr_patch=this%cpool_to_frootc_patch, default='inactive') - - this%cpool_to_frootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_FROOTC_STORAGE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to fine root C storage', & - ptr_patch=this%cpool_to_frootc_storage_patch, default='inactive') - - this%cpool_to_livestemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_LIVESTEMC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to live stem C', & - ptr_patch=this%cpool_to_livestemc_patch, default='inactive') - - this%cpool_to_livestemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_LIVESTEMC_STORAGE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to live stem C storage', & - ptr_patch=this%cpool_to_livestemc_storage_patch, default='inactive') - - this%cpool_to_deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_DEADSTEMC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to dead stem C', & - ptr_patch=this%cpool_to_deadstemc_patch, default='inactive') - - this%cpool_to_deadstemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_DEADSTEMC_STORAGE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to dead stem C storage', & - ptr_patch=this%cpool_to_deadstemc_storage_patch, default='inactive') - - this%cpool_to_livecrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_LIVECROOTC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to live coarse root C', & - ptr_patch=this%cpool_to_livecrootc_patch, default='inactive') - - this%cpool_to_livecrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_LIVECROOTC_STORAGE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to live coarse root C storage', & - ptr_patch=this%cpool_to_livecrootc_storage_patch, default='inactive') - - this%cpool_to_deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_DEADCROOTC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to dead coarse root C', & - ptr_patch=this%cpool_to_deadcrootc_patch, default='inactive') - - this%cpool_to_deadcrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_DEADCROOTC_STORAGE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to dead coarse root C storage', & - ptr_patch=this%cpool_to_deadcrootc_storage_patch, default='inactive') - - this%cpool_to_gresp_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_GRESP_STORAGE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to growth respiration storage', & - ptr_patch=this%cpool_to_gresp_storage_patch, default='inactive') - - this%cpool_leaf_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_LEAF_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf growth respiration', & - ptr_patch=this%cpool_leaf_gr_patch, default='inactive') - - this%cpool_leaf_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_LEAF_STORAGE_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf growth respiration to storage', & - ptr_patch=this%cpool_leaf_storage_gr_patch, default='inactive') - - this%transfer_leaf_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_TRANSFER_LEAF_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf growth respiration from storage', & - ptr_patch=this%transfer_leaf_gr_patch, default='inactive') - - this%cpool_froot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_FROOT_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root growth respiration', & - ptr_patch=this%cpool_froot_gr_patch, default='inactive') - - this%cpool_froot_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_FROOT_STORAGE_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root growth respiration to storage', & - ptr_patch=this%cpool_froot_storage_gr_patch, default='inactive') - - this%transfer_froot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_TRANSFER_FROOT_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root growth respiration from storage', & - ptr_patch=this%transfer_froot_gr_patch, default='inactive') - - this%cpool_livestem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_LIVESTEM_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem growth respiration', & - ptr_patch=this%cpool_livestem_gr_patch, default='inactive') - - this%cpool_livestem_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_LIVESTEM_STORAGE_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem growth respiration to storage', & - ptr_patch=this%cpool_livestem_storage_gr_patch, default='inactive') - - this%transfer_livestem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_TRANSFER_LIVESTEM_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem growth respiration from storage', & - ptr_patch=this%transfer_livestem_gr_patch, default='inactive') - - this%cpool_deadstem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_DEADSTEM_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem growth respiration', & - ptr_patch=this%cpool_deadstem_gr_patch, default='inactive') - - this%cpool_deadstem_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_DEADSTEM_STORAGE_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem growth respiration to storage', & - ptr_patch=this%cpool_deadstem_storage_gr_patch, default='inactive') - - this%transfer_deadstem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_TRANSFER_DEADSTEM_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem growth respiration from storage', & - ptr_patch=this%transfer_deadstem_gr_patch, default='inactive') - - this%cpool_livecroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_LIVECROOT_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root growth respiration', & - ptr_patch=this%cpool_livecroot_gr_patch, default='inactive') - - this%cpool_livecroot_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_LIVECROOT_STORAGE_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root growth respiration to storage', & - ptr_patch=this%cpool_livecroot_storage_gr_patch, default='inactive') - - this%transfer_livecroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_TRANSFER_LIVECROOT_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root growth respiration from storage', & - ptr_patch=this%transfer_livecroot_gr_patch, default='inactive') - - this%cpool_deadcroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_DEADCROOT_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root growth respiration', & - ptr_patch=this%cpool_deadcroot_gr_patch, default='inactive') - - this%cpool_deadcroot_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_DEADCROOT_STORAGE_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root growth respiration to storage', & - ptr_patch=this%cpool_deadcroot_storage_gr_patch, default='inactive') - - this%transfer_deadcroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_TRANSFER_DEADCROOT_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root growth respiration from storage', & - ptr_patch=this%transfer_deadcroot_gr_patch, default='inactive') - - this%leafc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LEAFC_STORAGE_TO_XFER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf C shift storage to transfer', & - ptr_patch=this%leafc_storage_to_xfer_patch, default='inactive') - - this%frootc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_FROOTC_STORAGE_TO_XFER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root C shift storage to transfer', & - ptr_patch=this%frootc_storage_to_xfer_patch, default='inactive') - - this%livestemc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVESTEMC_STORAGE_TO_XFER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem C shift storage to transfer', & - ptr_patch=this%livestemc_storage_to_xfer_patch, default='inactive') - - this%deadstemc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADSTEMC_STORAGE_TO_XFER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem C shift storage to transfer', & - ptr_patch=this%deadstemc_storage_to_xfer_patch, default='inactive') - - this%livecrootc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVECROOTC_STORAGE_TO_XFER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root C shift storage to transfer', & - ptr_patch=this%livecrootc_storage_to_xfer_patch, default='inactive') - - this%deadcrootc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADCROOTC_STORAGE_TO_XFER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root C shift storage to transfer', & - ptr_patch=this%deadcrootc_storage_to_xfer_patch, default='inactive') - - this%gresp_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_GRESP_STORAGE_TO_XFER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 growth respiration shift storage to transfer', & - ptr_patch=this%gresp_storage_to_xfer_patch, default='inactive') - - this%livestemc_to_deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVESTEMC_TO_DEADSTEMC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem C turnover', & - ptr_patch=this%livestemc_to_deadstemc_patch, default='inactive') - - this%livecrootc_to_deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVECROOTC_TO_DEADCROOTC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root C turnover', & - ptr_patch=this%livecrootc_to_deadcrootc_patch, default='inactive') - - this%current_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CURRENT_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 growth resp for new growth displayed in this timestep', & - ptr_patch=this%current_gr_patch, default='inactive') - - this%transfer_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_TRANSFER_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 growth resp for transfer growth displayed in this timestep', & - ptr_patch=this%transfer_gr_patch, default='inactive') - - this%storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_STORAGE_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 growth resp for growth sent to storage for later display', & - ptr_patch=this%storage_gr_patch, default='inactive') - - this%gpp_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_GPP', units='gC14/m^2/s', & - avgflag='A', long_name='C14 gross primary production', & - ptr_patch=this%gpp_patch, default='inactive') - - this%rr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_RR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 root respiration (fine root MR + total root GR)', & - ptr_patch=this%rr_patch, default='inactive') - - this%mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_MR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 maintenance respiration', & - ptr_patch=this%mr_patch, default='inactive') - - this%gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 total growth respiration', & - ptr_patch=this%gr_patch, default='inactive') - - this%ar_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_AR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 autotrophic respiration (MR + GR)', & - ptr_patch=this%ar_patch, default='inactive') - - this%npp_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_NPP', units='gC14/m^2/s', & - avgflag='A', long_name='C14 net primary production', & - ptr_patch=this%npp_patch, default='inactive') - - this%agnpp_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_AGNPP', units='gC14/m^2/s', & - avgflag='A', long_name='C14 aboveground NPP', & - ptr_patch=this%agnpp_patch, default='inactive') - - this%bgnpp_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_BGNPP', units='gC14/m^2/s', & - avgflag='A', long_name='C14 belowground NPP', & - ptr_patch=this%bgnpp_patch, default='inactive') - - this%litfall_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LITFALL', units='gC14/m^2/s', & - avgflag='A', long_name='C14 litterfall (leaves and fine roots)', & - ptr_patch=this%litfall_patch, default='inactive') - - this%fire_closs_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_PFT_FIRE_CLOSS', units='gC14/m^2/s', & - avgflag='A', long_name='C14 total patch-level fire C loss', & - ptr_patch=this%fire_closs_patch, default='inactive') - endif - - !------------------------------- - ! C flux variables - column - !------------------------------- - - if (carbon_type == 'c12') then - - this%cwdc_loss_col(begc:endc) = spval - call hist_addfld1d (fname='CWDC_LOSS', units='gC/m^2/s', & - avgflag='A', long_name='coarse woody debris C loss', & - ptr_col=this%cwdc_loss_col) - - this%m_decomp_cpools_to_fire_col(begc:endc,:) = spval - this%m_decomp_cpools_to_fire_vr_col(begc:endc,:,:) = spval - do k = 1, ndecomp_pools - if ( decomp_cascade_con%is_litter(k) .or. decomp_cascade_con%is_cwd(k) ) then - data1dptr => this%m_decomp_cpools_to_fire_col(:,k) - fieldname = 'M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'C_TO_FIRE' - longname = trim(decomp_cascade_con%decomp_pool_name_long(k))//' C fire loss' - call hist_addfld1d (fname=fieldname, units='gC/m^2/s', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - - if ( nlevdecomp_full > 1 ) then - data2dptr => this%m_decomp_cpools_to_fire_vr_col(:,:,k) - fieldname = 'M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'C_TO_FIRE'//trim(vr_suffix) - longname = trim(decomp_cascade_con%decomp_pool_name_long(k))//' C fire loss' - call hist_addfld_decomp (fname=fieldname, units='gC/m^3/s', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - endif - end do - - this%dwt_seedc_to_leaf_grc(begg:endg) = spval - call hist_addfld1d (fname='DWT_SEEDC_TO_LEAF', units='gC/m^2/s', & - avgflag='A', long_name='seed source to patch-level leaf', & - ptr_gcell=this%dwt_seedc_to_leaf_grc, default='inactive') - - this%dwt_seedc_to_leaf_patch(begp:endp) = spval - call hist_addfld1d (fname='DWT_SEEDC_TO_LEAF_PATCH', units='gC/m^2/s', & - avgflag='A', & - long_name='patch-level seed source to patch-level leaf ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_seedc_to_leaf_patch, default='inactive') - - this%dwt_seedc_to_deadstem_grc(begg:endg) = spval - call hist_addfld1d (fname='DWT_SEEDC_TO_DEADSTEM', units='gC/m^2/s', & - avgflag='A', long_name='seed source to patch-level deadstem', & - ptr_gcell=this%dwt_seedc_to_deadstem_grc, default='inactive') - - this%dwt_seedc_to_deadstem_patch(begp:endp) = spval - call hist_addfld1d (fname='DWT_SEEDC_TO_DEADSTEM_PATCH', units='gC/m^2/s', & - avgflag='A', & - long_name='patch-level seed source to patch-level deadstem ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_seedc_to_deadstem_patch, default='inactive') - - this%dwt_conv_cflux_grc(begg:endg) = spval - call hist_addfld1d (fname='DWT_CONV_CFLUX', units='gC/m^2/s', & - avgflag='A', & - long_name='conversion C flux (immediate loss to atm) (0 at all times except first timestep of year)', & - ptr_gcell=this%dwt_conv_cflux_grc, default='inactive') - - this%dwt_conv_cflux_patch(begp:endp) = spval - call hist_addfld1d (fname='DWT_CONV_CFLUX_PATCH', units='gC/m^2/s', & - avgflag='A', & - long_name='patch-level conversion C flux (immediate loss to atm) ' // & - '(0 at all times except first timestep of year) ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_conv_cflux_patch, default='inactive') - - this%dwt_conv_cflux_dribbled_grc(begg:endg) = spval - call hist_addfld1d (fname='DWT_CONV_CFLUX_DRIBBLED', units='gC/m^2/s', & - avgflag='A', & - long_name='conversion C flux (immediate loss to atm), dribbled throughout the year', & - ptr_gcell=this%dwt_conv_cflux_dribbled_grc, default='inactive') - - this%dwt_wood_productc_gain_patch(begp:endp) = spval - call hist_addfld1d (fname='DWT_WOOD_PRODUCTC_GAIN_PATCH', units='gC/m^2/s', & - avgflag='A', & - long_name='patch-level landcover change-driven addition to wood product pools' // & - '(0 at all times except first timestep of year) ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_wood_productc_gain_patch, default='inactive') - - this%dwt_slash_cflux_col(begc:endc) = spval - call hist_addfld1d (fname='DWT_SLASH_CFLUX', units='gC/m^2/s', & - avgflag='A', long_name='slash C flux to litter and CWD due to land use', & - ptr_col=this%dwt_slash_cflux_col, default='inactive') - - this%dwt_frootc_to_litr_met_c_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_FROOTC_TO_LITR_MET_C', units='gC/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='fine root to litter due to landcover change', & - ptr_col=this%dwt_frootc_to_litr_met_c_col, default='inactive') - - this%dwt_frootc_to_litr_cel_c_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_FROOTC_TO_LITR_CEL_C', units='gC/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='fine root to litter due to landcover change', & - ptr_col=this%dwt_frootc_to_litr_cel_c_col, default='inactive') - - this%dwt_frootc_to_litr_lig_c_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_FROOTC_TO_LITR_LIG_C', units='gC/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='fine root to litter due to landcover change', & - ptr_col=this%dwt_frootc_to_litr_lig_c_col, default='inactive') - - this%dwt_livecrootc_to_cwdc_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_LIVECROOTC_TO_CWDC', units='gC/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='live coarse root to CWD due to landcover change', & - ptr_col=this%dwt_livecrootc_to_cwdc_col, default='inactive') - - this%dwt_deadcrootc_to_cwdc_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_DEADCROOTC_TO_CWDC', units='gC/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='dead coarse root to CWD due to landcover change', & - ptr_col=this%dwt_deadcrootc_to_cwdc_col, default='inactive') - - this%crop_seedc_to_leaf_patch(begp:endp) = spval - call hist_addfld1d (fname='CROP_SEEDC_TO_LEAF', units='gC/m^2/s', & - avgflag='A', long_name='crop seed source to leaf', & - ptr_patch=this%crop_seedc_to_leaf_patch, default='inactive') - - this%sr_col(begc:endc) = spval - call hist_addfld1d (fname='SR', units='gC/m^2/s', & - avgflag='A', long_name='total soil respiration (HR + root resp)', & - ptr_col=this%sr_col, default='inactive') - - this%er_col(begc:endc) = spval - call hist_addfld1d (fname='ER', units='gC/m^2/s', & - avgflag='A', long_name='total ecosystem respiration, autotrophic + heterotrophic', & - ptr_col=this%er_col, default='inactive') - - this%litfire_col(begc:endc) = spval - call hist_addfld1d (fname='LITFIRE', units='gC/m^2/s', & - avgflag='A', long_name='litter fire losses', & - ptr_col=this%litfire_col, default='inactive') - - this%somfire_col(begc:endc) = spval - call hist_addfld1d (fname='SOMFIRE', units='gC/m^2/s', & - avgflag='A', long_name='soil organic matter fire losses', & - ptr_col=this%somfire_col, default='inactive') - - this%totfire_col(begc:endc) = spval - call hist_addfld1d (fname='TOTFIRE', units='gC/m^2/s', & - avgflag='A', long_name='total ecosystem fire losses', & - ptr_col=this%totfire_col, default='inactive') - - this%fire_closs_col(begc:endc) = spval - call hist_addfld1d (fname='COL_FIRE_CLOSS', units='gC/m^2/s', & - avgflag='A', long_name='total column-level fire C loss for non-peat fires outside land-type converted region', & - ptr_col=this%fire_closs_col, default='inactive') - - this%annsum_npp_patch(begp:endp) = spval - call hist_addfld1d (fname='ANNSUM_NPP', units='gC/m^2/yr', & - avgflag='A', long_name='annual sum of NPP', & - ptr_patch=this%annsum_npp_patch, default='inactive') - - this%annsum_npp_col(begc:endc) = spval - call hist_addfld1d (fname='CANNSUM_NPP', units='gC/m^2/s', & - avgflag='A', long_name='annual sum of column-level NPP', & - ptr_col=this%annsum_npp_col, default='inactive') - - this%nep_col(begc:endc) = spval - call hist_addfld1d (fname='NEP', units='gC/m^2/s', & - avgflag='A', long_name='net ecosystem production, excludes fire, landuse, and harvest flux, positive for sink', & - ptr_col=this%nep_col, default='inactive') - - this%nbp_grc(begg:endg) = spval - call hist_addfld1d (fname='NBP', units='gC/m^2/s', & - avgflag='A', long_name='net biome production, includes fire, landuse,'& - //' harvest and hrv_xsmrpool flux (latter smoothed over the year), positive for sink'& - //' (same as net carbon exchange between land and atmosphere)', & - ptr_gcell=this%nbp_grc, default='inactive') - - this%nee_grc(begg:endg) = spval - call hist_addfld1d (fname='NEE', units='gC/m^2/s', & - avgflag='A', long_name='net ecosystem exchange of carbon,'& - //' includes fire and hrv_xsmrpool (latter smoothed over the year),'& - //' excludes landuse and harvest flux, positive for source', & - ptr_gcell=this%nee_grc, default='inactive') - - this%landuseflux_grc(begg:endg) = spval - call hist_addfld1d (fname='LAND_USE_FLUX', units='gC/m^2/s', & - avgflag='A', & - long_name='total C emitted from land cover conversion (smoothed over the year)'& - //' and wood and grain product pools (NOTE: not a net value)', & - ptr_gcell=this%landuseflux_grc, default='inactive') - - end if - !------------------------------- - ! C13 flux variables - column - !------------------------------- - - if ( carbon_type == 'c13' ) then - - this%m_decomp_cpools_to_fire_col(begc:endc,:) = spval - this%m_decomp_cpools_to_fire_vr_col(begc:endc,:,:) = spval - do k = 1, ndecomp_pools - if ( decomp_cascade_con%is_litter(k) .or. decomp_cascade_con%is_cwd(k) ) then - data1dptr => this%m_decomp_cpools_to_fire_col(:,k) - fieldname = 'C13_M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'C_TO_FIRE' - longname = 'C13 '//trim(decomp_cascade_con%decomp_pool_name_long(k))//' C fire loss' - call hist_addfld1d (fname=fieldname, units='gC13/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - - if ( nlevdecomp_full > 1 ) then - data2dptr => this%m_decomp_cpools_to_fire_vr_col(:,:,k) - fieldname = 'C13_M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'C_TO_FIRE'//trim(vr_suffix) - longname = 'C13 '//trim(decomp_cascade_con%decomp_pool_name_long(k))//' C fire loss' - call hist_addfld_decomp (fname=fieldname, units='gC13/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - end if - endif - end do - - this%dwt_seedc_to_leaf_grc(begg:endg) = spval - call hist_addfld1d (fname='C13_DWT_SEEDC_TO_LEAF', units='gC13/m^2/s', & - avgflag='A', long_name='C13 seed source to patch-level leaf', & - ptr_gcell=this%dwt_seedc_to_leaf_grc, default='inactive') - - this%dwt_seedc_to_leaf_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DWT_SEEDC_TO_LEAF_PATCH', units='gC13/m^2/s', & - avgflag='A', & - long_name='patch-level C13 seed source to patch-level leaf ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_seedc_to_leaf_patch, default='inactive') - - this%dwt_seedc_to_deadstem_grc(begg:endg) = spval - call hist_addfld1d (fname='C13_DWT_SEEDC_TO_DEADSTEM', units='gC13/m^2/s', & - avgflag='A', long_name='C13 seed source to patch-level deadstem', & - ptr_gcell=this%dwt_seedc_to_deadstem_grc, default='inactive') - - this%dwt_seedc_to_deadstem_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DWT_SEEDC_TO_DEADSTEM_PATCH', units='gC13/m^2/s', & - avgflag='A', & - long_name='patch-level C13 seed source to patch-level deadstem ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_seedc_to_deadstem_patch, default='inactive') - - this%dwt_conv_cflux_grc(begg:endg) = spval - call hist_addfld1d (fname='C13_DWT_CONV_CFLUX', units='gC13/m^2/s', & - avgflag='A', long_name='C13 conversion C flux (immediate loss to atm) ' // & - '(0 at all times except first timestep of year)', & - ptr_gcell=this%dwt_conv_cflux_grc, default='inactive') - - this%dwt_conv_cflux_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DWT_CONV_CFLUX_PATCH', units='gC13/m^2/s', & - avgflag='A', & - long_name='patch-level C13 conversion C flux (immediate loss to atm) ' // & - '(0 at all times except first timestep of year) ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_conv_cflux_patch, default='inactive') - - this%dwt_conv_cflux_dribbled_grc(begg:endg) = spval - call hist_addfld1d (fname='C13_DWT_CONV_CFLUX_DRIBBLED', units='gC13/m^2/s', & - avgflag='A', & - long_name='C13 conversion C flux (immediate loss to atm), dribbled throughout the year', & - ptr_gcell=this%dwt_conv_cflux_dribbled_grc, default='inactive') - - this%dwt_slash_cflux_col(begc:endc) = spval - call hist_addfld1d (fname='C13_DWT_SLASH_CFLUX', units='gC/m^2/s', & - avgflag='A', long_name='C13 slash C flux to litter and CWD due to land use', & - ptr_col=this%dwt_slash_cflux_col, default='inactive') - - this%dwt_frootc_to_litr_met_c_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C13_DWT_FROOTC_TO_LITR_MET_C', units='gC13/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C13 fine root to litter due to landcover change', & - ptr_col=this%dwt_frootc_to_litr_met_c_col, default='inactive') - - this%dwt_frootc_to_litr_cel_c_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C13_DWT_FROOTC_TO_LITR_CEL_C', units='gC13/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C13 fine root to litter due to landcover change', & - ptr_col=this%dwt_frootc_to_litr_cel_c_col, default='inactive') - - this%dwt_frootc_to_litr_lig_c_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C13_DWT_FROOTC_TO_LITR_LIG_C', units='gC13/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C13 fine root to litter due to landcover change', & - ptr_col=this%dwt_frootc_to_litr_lig_c_col, default='inactive') - - this%dwt_livecrootc_to_cwdc_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C13_DWT_LIVECROOTC_TO_CWDC', units='gC13/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C13 live coarse root to CWD due to landcover change', & - ptr_col=this%dwt_livecrootc_to_cwdc_col, default='inactive') - - this%dwt_deadcrootc_to_cwdc_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C13_DWT_DEADCROOTC_TO_CWDC', units='gC13/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C13 dead coarse root to CWD due to landcover change', & - ptr_col=this%dwt_deadcrootc_to_cwdc_col, default='inactive') - - this%crop_seedc_to_leaf_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CROP_SEEDC_TO_LEAF', units='gC13/m^2/s', & - avgflag='A', long_name='C13 crop seed source to leaf', & - ptr_patch=this%crop_seedc_to_leaf_patch, default='inactive') - - this%sr_col(begc:endc) = spval - call hist_addfld1d (fname='C13_SR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total soil respiration (HR + root resp)', & - ptr_col=this%sr_col, default='inactive') - - this%er_col(begc:endc) = spval - call hist_addfld1d (fname='C13_ER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total ecosystem respiration, autotrophic + heterotrophic', & - ptr_col=this%er_col, default='inactive') - - this%litfire_col(begc:endc) = spval - call hist_addfld1d (fname='C13_LITFIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 litter fire losses', & - ptr_col=this%litfire_col, default='inactive') - - this%somfire_col(begc:endc) = spval - call hist_addfld1d (fname='C13_SOMFIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 soil organic matter fire losses', & - ptr_col=this%somfire_col, default='inactive') - - this%totfire_col(begc:endc) = spval - call hist_addfld1d (fname='C13_TOTFIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total ecosystem fire losses', & - ptr_col=this%totfire_col, default='inactive') - - this%fire_closs_col(begc:endc) = spval - call hist_addfld1d (fname='C13_COL_FIRE_CLOSS', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total column-level fire C loss', & - ptr_col=this%fire_closs_col, default='inactive') - - this%nep_col(begc:endc) = spval - call hist_addfld1d (fname='C13_NEP', units='gC13/m^2/s', & - avgflag='A', long_name='C13 net ecosystem production, excludes fire flux, positive for sink', & - ptr_col=this%nep_col, default='inactive') - - this%nee_grc(begg:endg) = spval - call hist_addfld1d (fname='C13_NEE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 net ecosystem exchange of carbon, includes fire flux, positive for source', & - ptr_gcell=this%nee_grc, default='inactive') - - endif - - !------------------------------- - ! C14 flux variables - column - !------------------------------- - - if (carbon_type == 'c14') then - - this%m_decomp_cpools_to_fire_col(begc:endc,:) = spval - this%m_decomp_cpools_to_fire_vr_col(begc:endc,:,:) = spval - do k = 1, ndecomp_pools - if ( decomp_cascade_con%is_litter(k) .or. decomp_cascade_con%is_cwd(k) ) then - data1dptr => this%m_decomp_cpools_to_fire_col(:,k) - fieldname = 'C14_M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'C_TO_FIRE' - longname = 'C14 '//trim(decomp_cascade_con%decomp_pool_name_long(k))//' C fire loss' - call hist_addfld1d (fname=fieldname, units='gC14/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - - if ( nlevdecomp_full > 1 ) then - data2dptr => this%m_decomp_cpools_to_fire_vr_col(:,:,k) - fieldname = 'C14_M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'C_TO_FIRE'//trim(vr_suffix) - longname = 'C14 '//trim(decomp_cascade_con%decomp_pool_name_long(k))//' C fire loss' - call hist_addfld_decomp (fname=fieldname, units='gC14/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - end if - endif - end do - - this%dwt_seedc_to_leaf_grc(begg:endg) = spval - call hist_addfld1d (fname='C14_DWT_SEEDC_TO_LEAF', units='gC14/m^2/s', & - avgflag='A', long_name='C14 seed source to patch-level leaf', & - ptr_gcell=this%dwt_seedc_to_leaf_grc, default='inactive') - - this%dwt_seedc_to_leaf_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DWT_SEEDC_TO_LEAF_PATCH', units='gC14/m^2/s', & - avgflag='A', & - long_name='patch-level C14 seed source to patch-level leaf ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_seedc_to_leaf_patch, default='inactive') - - this%dwt_seedc_to_deadstem_grc(begg:endg) = spval - call hist_addfld1d (fname='C14_DWT_SEEDC_TO_DEADSTEM', units='gC14/m^2/s', & - avgflag='A', long_name='C14 seed source to patch-level deadstem', & - ptr_gcell=this%dwt_seedc_to_deadstem_grc, default='inactive') - - this%dwt_seedc_to_deadstem_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DWT_SEEDC_TO_DEADSTEM_PATCH', units='gC14/m^2/s', & - avgflag='A', & - long_name='patch-level C14 seed source to patch-level deadstem ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_seedc_to_deadstem_patch, default='inactive') - - this%dwt_conv_cflux_grc(begg:endg) = spval - call hist_addfld1d (fname='C14_DWT_CONV_CFLUX', units='gC14/m^2/s', & - avgflag='A', long_name='C14 conversion C flux (immediate loss to atm) ' // & - '(0 at all times except first timestep of year)', & - ptr_gcell=this%dwt_conv_cflux_grc, default='inactive') - - this%dwt_conv_cflux_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DWT_CONV_CFLUX_PATCH', units='gC14/m^2/s', & - avgflag='A', & - long_name='patch-level C14 conversion C flux (immediate loss to atm) ' // & - '(0 at all times except first timestep of year) ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_conv_cflux_patch, default='inactive') - - this%dwt_conv_cflux_dribbled_grc(begg:endg) = spval - call hist_addfld1d (fname='C14_DWT_CONV_CFLUX_DRIBBLED', units='gC14/m^2/s', & - avgflag='A', & - long_name='C14 conversion C flux (immediate loss to atm), dribbled throughout the year', & - ptr_gcell=this%dwt_conv_cflux_dribbled_grc, default='inactive') - - this%dwt_slash_cflux_col(begc:endc) = spval - call hist_addfld1d (fname='C14_DWT_SLASH_CFLUX', units='gC/m^2/s', & - avgflag='A', long_name='C14 slash C flux to litter and CWD due to land use', & - ptr_col=this%dwt_slash_cflux_col, default='inactive') - - this%dwt_frootc_to_litr_met_c_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C14_DWT_FROOTC_TO_LITR_MET_C', units='gC14/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C14 fine root to litter due to landcover change', & - ptr_col=this%dwt_frootc_to_litr_met_c_col, default='inactive') - - this%dwt_frootc_to_litr_cel_c_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C14_DWT_FROOTC_TO_LITR_CEL_C', units='gC14/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C14 fine root to litter due to landcover change', & - ptr_col=this%dwt_frootc_to_litr_cel_c_col, default='inactive') - - this%dwt_frootc_to_litr_lig_c_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C14_DWT_FROOTC_TO_LITR_LIG_C', units='gC14/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C14 fine root to litter due to landcover change', & - ptr_col=this%dwt_frootc_to_litr_lig_c_col, default='inactive') - - this%dwt_livecrootc_to_cwdc_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C14_DWT_LIVECROOTC_TO_CWDC', units='gC14/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C14 live coarse root to CWD due to landcover change', & - ptr_col=this%dwt_livecrootc_to_cwdc_col, default='inactive') - - this%dwt_deadcrootc_to_cwdc_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C14_DWT_DEADCROOTC_TO_CWDC', units='gC14/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C14 dead coarse root to CWD due to landcover change', & - ptr_col=this%dwt_deadcrootc_to_cwdc_col, default='inactive') - - this%crop_seedc_to_leaf_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CROP_SEEDC_TO_LEAF', units='gC14/m^2/s', & - avgflag='A', long_name='C14 crop seed source to leaf', & - ptr_patch=this%crop_seedc_to_leaf_patch, default='inactive') - - this%sr_col(begc:endc) = spval - call hist_addfld1d (fname='C14_SR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 total soil respiration (HR + root resp)', & - ptr_col=this%sr_col, default='inactive') - - this%er_col(begc:endc) = spval - call hist_addfld1d (fname='C14_ER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 total ecosystem respiration, autotrophic + heterotrophic', & - ptr_col=this%er_col, default='inactive') - - this%litfire_col(begc:endc) = spval - call hist_addfld1d (fname='C14_LITFIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 litter fire losses', & - ptr_col=this%litfire_col, default='inactive') - - this%somfire_col(begc:endc) = spval - call hist_addfld1d (fname='C14_SOMFIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 soil organic matter fire losses', & - ptr_col=this%somfire_col, default='inactive') - - this%totfire_col(begc:endc) = spval - call hist_addfld1d (fname='C14_TOTFIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 total ecosystem fire losses', & - ptr_col=this%totfire_col, default='inactive') - - this%fire_closs_col(begc:endc) = spval - call hist_addfld1d (fname='C14_COL_FIRE_CLOSS', units='gC14/m^2/s', & - avgflag='A', long_name='C14 total column-level fire C loss', & - ptr_col=this%fire_closs_col, default='inactive') - - this%nep_col(begc:endc) = spval - call hist_addfld1d (fname='C14_NEP', units='gC14/m^2/s', & - avgflag='A', long_name='C14 net ecosystem production, excludes fire flux, positive for sink', & - ptr_col=this%nep_col, default='inactive') - - this%nee_grc(begg:endg) = spval - call hist_addfld1d (fname='C14_NEE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 net ecosystem exchange of carbon, includes fire flux, positive for source', & - ptr_gcell=this%nee_grc, default='inactive') - - endif - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !ARGUMENTS: - class(cnveg_carbonflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p, c, l, j - integer :: fc ! filter index - integer :: num_special_col ! number of good values in special_col filter - integer :: num_special_patch ! number of good values in special_patch filter - integer :: special_col(bounds%endc-bounds%begc+1) ! special landunit filter - columns - integer :: special_patch(bounds%endp-bounds%begp+1) ! special landunit filter - patches - !----------------------------------------------------------------------- - - ! Set column filters - - num_special_col = 0 - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - num_special_col = num_special_col + 1 - special_col(num_special_col) = c - end if - end do - - ! Set patch filters - - num_special_patch = 0 - do p = bounds%begp,bounds%endp - l = patch%landunit(p) - - if (lun%ifspecial(l)) then - num_special_patch = num_special_patch + 1 - special_patch(num_special_patch) = p - end if - end do - - do p = bounds%begp,bounds%endp - l = patch%landunit(p) - this%gpp_before_downreg_patch(p) = 0._r8 - - if (lun%ifspecial(l)) then - this%availc_patch(p) = spval - this%xsmrpool_recover_patch(p) = spval - this%excess_cflux_patch(p) = spval - this%plant_calloc_patch(p) = spval - this%prev_leafc_to_litter_patch(p) = spval - this%prev_frootc_to_litter_patch(p) = spval - this%leafc_to_litter_fun_patch(p) = spval - end if - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%availc_patch(p) = 0._r8 - this%xsmrpool_recover_patch(p) = 0._r8 - this%excess_cflux_patch(p) = 0._r8 - this%prev_leafc_to_litter_patch(p) = 0._r8 - this%leafc_to_litter_fun_patch(p) = 0._r8 - this%prev_frootc_to_litter_patch(p) = 0._r8 - this%plant_calloc_patch(p) = 0._r8 - end if - end do - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - - ! also initialize dynamic landcover fluxes so that they have - ! real values on first timestep, prior to calling pftdyn_cnbal - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%dwt_slash_cflux_col(c) = 0._r8 - do j = 1, nlevdecomp_full - this%dwt_frootc_to_litr_met_c_col(c,j) = 0._r8 - this%dwt_frootc_to_litr_cel_c_col(c,j) = 0._r8 - this%dwt_frootc_to_litr_lig_c_col(c,j) = 0._r8 - this%dwt_livecrootc_to_cwdc_col(c,j) = 0._r8 - this%dwt_deadcrootc_to_cwdc_col(c,j) = 0._r8 - end do - end if - end do - - do p = bounds%begp,bounds%endp - l = patch%landunit(p) - - this%gpp_patch(p) = 0._r8 - if (lun%ifspecial(l)) then - this%tempsum_npp_patch(p) = spval - this%annsum_npp_patch(p) = spval - this%tempsum_litfall_patch(p) = spval - this%annsum_litfall_patch(p) = spval - end if - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%tempsum_npp_patch(p) = 0._r8 - this%annsum_npp_patch(p) = 0._r8 - this%tempsum_litfall_patch(p) = 0._r8 - this%annsum_litfall_patch(p) = 0._r8 - end if - end do - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - - if (lun%ifspecial(l)) then - this%annsum_npp_col(c) = spval - end if - - ! also initialize dynamic landcover fluxes so that they have - ! real values on first timestep, prior to calling pftdyn_cnbal - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%annsum_npp_col(c) = 0._r8 - end if - end do - - ! initialize fields for special filters - - call this%SetValues (& - num_patch=num_special_patch, filter_patch=special_patch, value_patch=0._r8, & - num_column=num_special_col, filter_column=special_col, value_column=0._r8) - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart ( this, bounds, ncid, flag, carbon_type ) - ! - ! !DESCRIPTION: - ! Read/write CN restart data for carbon fluxes - ! - ! !USES: - use ncdio_pio, only : file_desc_t - ! - ! !ARGUMENTS: - class (cnveg_carbonflux_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag !'read' or 'write' - character(len=*) , intent(in) :: carbon_type ! 'c12' or 'c13' or 'c14' - !------------------------------------------------------------------------ - - if (carbon_type == 'c12') then - call this%RestartBulkOnly(bounds, ncid, flag) - end if - - call this%RestartAllIsotopes(bounds, ncid, flag) - - end subroutine Restart - - - !----------------------------------------------------------------------- - subroutine RestartBulkOnly ( this, bounds, ncid, flag ) - ! - ! !DESCRIPTION: - ! Read/write CN restart data for carbon fluxes - fields only present for bulk C - ! - ! !USES: - use shr_infnan_mod , only : isnan => shr_infnan_isnan, nan => shr_infnan_nan, assignment(=) - use clm_time_manager , only : is_restart - use clm_varcon , only : c13ratio, c14ratio - use CNSharedParamsMod, only : use_fun - use restUtilMod - use ncdio_pio - ! - ! !ARGUMENTS: - class (cnveg_carbonflux_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag !'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - logical :: readvar ! determine if variable is on initial file - !------------------------------------------------------------------------ - - if (use_crop) then - - call restartvar(ncid=ncid, flag=flag, varname='grainc_xfer_to_grainc', xtype=ncd_double, & - dim1name='pft', & - long_name='grain C growth from storage', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_xfer_to_grainc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_to_litter', xtype=ncd_double, & - dim1name='pft', & - long_name='live stem C litterfall', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_to_litter_patch) - - call restartvar(ncid=ncid, flag=flag, varname='grainc_to_food', xtype=ncd_double, & - dim1name='pft', & - long_name='grain C to food', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_to_food_patch) - - call restartvar(ncid=ncid, flag=flag, varname='cpool_to_grainc', xtype=ncd_double, & - dim1name='pft', & - long_name='allocation to grain C', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%cpool_to_grainc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='cpool_to_grainc_storage', xtype=ncd_double, & - dim1name='pft', & - long_name='allocation to grain C storage', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%cpool_to_grainc_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='cpool_grain_gr', xtype=ncd_double, & - dim1name='pft', & - long_name='grain growth respiration', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%cpool_grain_gr_patch) - - call restartvar(ncid=ncid, flag=flag, varname='cpool_grain_storage_gr', xtype=ncd_double, & - dim1name='pft', & - long_name='grain growth respiration to storage', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%cpool_grain_storage_gr_patch) - - call restartvar(ncid=ncid, flag=flag, varname='transfer_grain_gr', xtype=ncd_double, & - dim1name='pft', & - long_name='grain growth respiration from storage', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%transfer_grain_gr_patch) - - call restartvar(ncid=ncid, flag=flag, varname='grainc_storage_to_xfer', xtype=ncd_double, & - dim1name='pft', & - long_name='grain C shift storage to transfer', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_storage_to_xfer_patch) - - end if - - call restartvar(ncid=ncid, flag=flag, varname='gpp_pepv', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%gpp_before_downreg_patch) - - call restartvar(ncid=ncid, flag=flag, varname='availc', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%availc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='xsmrpool_recover', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%xsmrpool_recover_patch) - - call restartvar(ncid=ncid, flag=flag, varname='plant_calloc', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%plant_calloc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='excess_cflux', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%excess_cflux_patch) - - call restartvar(ncid=ncid, flag=flag, varname='prev_leafc_to_litter', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%prev_leafc_to_litter_patch) - - call restartvar(ncid=ncid, flag=flag, varname='prev_frootc_to_litter', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%prev_frootc_to_litter_patch) - - call restartvar(ncid=ncid, flag=flag, varname='tempsum_npp', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tempsum_npp_patch) - - call restartvar(ncid=ncid, flag=flag, varname='annsum_npp', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%annsum_npp_patch) - - call restartvar(ncid=ncid, flag=flag, varname='col_lag_npp', xtype=ncd_double, & - dim1name='column', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%lag_npp_col) - - call restartvar(ncid=ncid, flag=flag, varname='cannsum_npp', xtype=ncd_double, & - dim1name='column', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%annsum_npp_col) - - call restartvar(ncid=ncid, flag=flag, varname='tempsum_litfall', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tempsum_litfall_patch) - - call restartvar(ncid=ncid, flag=flag, varname='annsum_litfall', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%annsum_litfall_patch) - - if ( use_fun ) then - call restartvar(ncid=ncid, flag=flag, varname='leafc_to_litter_fun', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_to_litter_fun_patch) - end if - - end subroutine RestartBulkOnly - - - !----------------------------------------------------------------------- - subroutine RestartAllIsotopes ( this, bounds, ncid, flag ) - ! - ! !DESCRIPTION: - ! Read/write CN restart data for carbon fluxes - fields present for both bulk C and isotopes - ! - ! !USES: - use ncdio_pio, only : file_desc_t - ! - ! !ARGUMENTS: - class (cnveg_carbonflux_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag !'read' or 'write' - !----------------------------------------------------------------------- - - end subroutine RestartAllIsotopes - - !----------------------------------------------------------------------- - subroutine SetValues ( this, & - num_patch, filter_patch, value_patch, & - num_column, filter_column, value_column) - ! - ! !DESCRIPTION: - ! Set carbon state fluxes - ! - ! !ARGUMENTS: - class (cnveg_carbonflux_type) :: this - integer , intent(in) :: num_patch - integer , intent(in) :: filter_patch(:) - real(r8), intent(in) :: value_patch - integer , intent(in) :: num_column - integer , intent(in) :: filter_column(:) - real(r8), intent(in) :: value_column - ! - ! !LOCAL VARIABLES: - integer :: fi,i ! loop index - integer :: j,k,l ! indices - !------------------------------------------------------------------------ - - do fi = 1,num_patch - i = filter_patch(fi) - - this%m_leafc_to_litter_patch(i) = value_patch - this%m_frootc_to_litter_patch(i) = value_patch - this%m_leafc_storage_to_litter_patch(i) = value_patch - this%m_frootc_storage_to_litter_patch(i) = value_patch - this%m_livestemc_storage_to_litter_patch(i) = value_patch - this%m_deadstemc_storage_to_litter_patch(i) = value_patch - this%m_livecrootc_storage_to_litter_patch(i) = value_patch - this%m_deadcrootc_storage_to_litter_patch(i) = value_patch - this%m_leafc_xfer_to_litter_patch(i) = value_patch - this%m_frootc_xfer_to_litter_patch(i) = value_patch - this%m_livestemc_xfer_to_litter_patch(i) = value_patch - this%m_deadstemc_xfer_to_litter_patch(i) = value_patch - this%m_livecrootc_xfer_to_litter_patch(i) = value_patch - this%m_deadcrootc_xfer_to_litter_patch(i) = value_patch - this%m_livestemc_to_litter_patch(i) = value_patch - this%m_deadstemc_to_litter_patch(i) = value_patch - this%m_livecrootc_to_litter_patch(i) = value_patch - this%m_deadcrootc_to_litter_patch(i) = value_patch - this%m_gresp_storage_to_litter_patch(i) = value_patch - this%m_gresp_xfer_to_litter_patch(i) = value_patch - this%hrv_leafc_to_litter_patch(i) = value_patch - this%hrv_leafc_storage_to_litter_patch(i) = value_patch - this%hrv_leafc_xfer_to_litter_patch(i) = value_patch - this%hrv_frootc_to_litter_patch(i) = value_patch - this%hrv_frootc_storage_to_litter_patch(i) = value_patch - this%hrv_frootc_xfer_to_litter_patch(i) = value_patch - this%hrv_livestemc_to_litter_patch(i) = value_patch - this%hrv_livestemc_storage_to_litter_patch(i) = value_patch - this%hrv_livestemc_xfer_to_litter_patch(i) = value_patch - this%hrv_deadstemc_storage_to_litter_patch(i) = value_patch - this%hrv_deadstemc_xfer_to_litter_patch(i) = value_patch - this%hrv_livecrootc_to_litter_patch(i) = value_patch - this%hrv_livecrootc_storage_to_litter_patch(i) = value_patch - this%hrv_livecrootc_xfer_to_litter_patch(i) = value_patch - this%hrv_deadcrootc_to_litter_patch(i) = value_patch - this%hrv_deadcrootc_storage_to_litter_patch(i) = value_patch - this%hrv_deadcrootc_xfer_to_litter_patch(i) = value_patch - this%hrv_gresp_storage_to_litter_patch(i) = value_patch - this%hrv_gresp_xfer_to_litter_patch(i) = value_patch - this%hrv_xsmrpool_to_atm_patch(i) = value_patch - - this%m_leafc_to_fire_patch(i) = value_patch - this%m_leafc_storage_to_fire_patch(i) = value_patch - this%m_leafc_xfer_to_fire_patch(i) = value_patch - this%m_livestemc_to_fire_patch(i) = value_patch - this%m_livestemc_storage_to_fire_patch(i) = value_patch - this%m_livestemc_xfer_to_fire_patch(i) = value_patch - this%m_deadstemc_to_fire_patch(i) = value_patch - this%m_deadstemc_storage_to_fire_patch(i) = value_patch - this%m_deadstemc_xfer_to_fire_patch(i) = value_patch - this%m_frootc_to_fire_patch(i) = value_patch - this%m_frootc_storage_to_fire_patch(i) = value_patch - this%m_frootc_xfer_to_fire_patch(i) = value_patch - this%m_livecrootc_to_fire_patch(i) = value_patch - this%m_livecrootc_storage_to_fire_patch(i) = value_patch - this%m_livecrootc_xfer_to_fire_patch(i) = value_patch - this%m_deadcrootc_to_fire_patch(i) = value_patch - this%m_deadcrootc_storage_to_fire_patch(i) = value_patch - this%m_deadcrootc_xfer_to_fire_patch(i) = value_patch - this%m_gresp_storage_to_fire_patch(i) = value_patch - this%m_gresp_xfer_to_fire_patch(i) = value_patch - - this%m_leafc_to_litter_fire_patch(i) = value_patch - this%m_leafc_storage_to_litter_fire_patch(i) = value_patch - this%m_leafc_xfer_to_litter_fire_patch(i) = value_patch - this%m_livestemc_to_litter_fire_patch(i) = value_patch - this%m_livestemc_storage_to_litter_fire_patch(i) = value_patch - this%m_livestemc_xfer_to_litter_fire_patch(i) = value_patch - this%m_livestemc_to_deadstemc_fire_patch(i) = value_patch - this%m_deadstemc_to_litter_fire_patch(i) = value_patch - this%m_deadstemc_storage_to_litter_fire_patch(i) = value_patch - this%m_deadstemc_xfer_to_litter_fire_patch(i) = value_patch - this%m_frootc_to_litter_fire_patch(i) = value_patch - this%m_frootc_storage_to_litter_fire_patch(i) = value_patch - this%m_frootc_xfer_to_litter_fire_patch(i) = value_patch - this%m_livecrootc_to_litter_fire_patch(i) = value_patch - this%m_livecrootc_storage_to_litter_fire_patch(i) = value_patch - this%m_livecrootc_xfer_to_litter_fire_patch(i) = value_patch - this%m_livecrootc_to_deadcrootc_fire_patch(i) = value_patch - this%m_deadcrootc_to_litter_fire_patch(i) = value_patch - this%m_deadcrootc_storage_to_litter_fire_patch(i) = value_patch - this%m_deadcrootc_xfer_to_litter_fire_patch(i) = value_patch - this%m_gresp_storage_to_litter_fire_patch(i) = value_patch - this%m_gresp_xfer_to_litter_fire_patch(i) = value_patch - - this%leafc_xfer_to_leafc_patch(i) = value_patch - this%frootc_xfer_to_frootc_patch(i) = value_patch - this%livestemc_xfer_to_livestemc_patch(i) = value_patch - this%deadstemc_xfer_to_deadstemc_patch(i) = value_patch - this%livecrootc_xfer_to_livecrootc_patch(i) = value_patch - this%deadcrootc_xfer_to_deadcrootc_patch(i) = value_patch - this%leafc_to_litter_patch(i) = value_patch - this%frootc_to_litter_patch(i) = value_patch - this%cpool_to_resp_patch(i) = value_patch - this%cpool_to_leafc_resp_patch(i) = value_patch - this%cpool_to_leafc_storage_resp_patch(i) = value_patch - this%cpool_to_frootc_resp_patch(i) = value_patch - this%cpool_to_frootc_storage_resp_patch(i) = value_patch - this%cpool_to_livecrootc_resp_patch(i) = value_patch - this%cpool_to_livecrootc_storage_resp_patch(i) = value_patch - this%cpool_to_livestemc_resp_patch(i) = value_patch - this%cpool_to_livestemc_storage_resp_patch(i) = value_patch - this%leaf_mr_patch(i) = value_patch - this%froot_mr_patch(i) = value_patch - this%livestem_mr_patch(i) = value_patch - this%livecroot_mr_patch(i) = value_patch - this%grain_mr_patch(i) = value_patch - this%leaf_curmr_patch(i) = value_patch - this%froot_curmr_patch(i) = value_patch - this%livestem_curmr_patch(i) = value_patch - this%livecroot_curmr_patch(i) = value_patch - this%grain_curmr_patch(i) = value_patch - this%leaf_xsmr_patch(i) = value_patch - this%froot_xsmr_patch(i) = value_patch - this%livestem_xsmr_patch(i) = value_patch - this%livecroot_xsmr_patch(i) = value_patch - this%grain_xsmr_patch(i) = value_patch - this%psnsun_to_cpool_patch(i) = value_patch - this%psnshade_to_cpool_patch(i) = value_patch - this%cpool_to_xsmrpool_patch(i) = value_patch - this%cpool_to_leafc_patch(i) = value_patch - this%cpool_to_leafc_storage_patch(i) = value_patch - this%cpool_to_frootc_patch(i) = value_patch - this%cpool_to_frootc_storage_patch(i) = value_patch - this%cpool_to_livestemc_patch(i) = value_patch - this%cpool_to_livestemc_storage_patch(i) = value_patch - this%cpool_to_deadstemc_patch(i) = value_patch - this%cpool_to_deadstemc_storage_patch(i) = value_patch - this%cpool_to_livecrootc_patch(i) = value_patch - this%cpool_to_livecrootc_storage_patch(i) = value_patch - this%cpool_to_deadcrootc_patch(i) = value_patch - this%cpool_to_deadcrootc_storage_patch(i) = value_patch - this%cpool_to_gresp_storage_patch(i) = value_patch - this%cpool_leaf_gr_patch(i) = value_patch - this%cpool_leaf_storage_gr_patch(i) = value_patch - this%transfer_leaf_gr_patch(i) = value_patch - this%cpool_froot_gr_patch(i) = value_patch - this%cpool_froot_storage_gr_patch(i) = value_patch - this%transfer_froot_gr_patch(i) = value_patch - this%cpool_livestem_gr_patch(i) = value_patch - this%cpool_livestem_storage_gr_patch(i) = value_patch - this%transfer_livestem_gr_patch(i) = value_patch - this%cpool_deadstem_gr_patch(i) = value_patch - this%cpool_deadstem_storage_gr_patch(i) = value_patch - this%transfer_deadstem_gr_patch(i) = value_patch - this%cpool_livecroot_gr_patch(i) = value_patch - this%cpool_livecroot_storage_gr_patch(i) = value_patch - this%transfer_livecroot_gr_patch(i) = value_patch - this%cpool_deadcroot_gr_patch(i) = value_patch - this%cpool_deadcroot_storage_gr_patch(i) = value_patch - this%transfer_deadcroot_gr_patch(i) = value_patch - this%leafc_storage_to_xfer_patch(i) = value_patch - this%frootc_storage_to_xfer_patch(i) = value_patch - this%livestemc_storage_to_xfer_patch(i) = value_patch - this%deadstemc_storage_to_xfer_patch(i) = value_patch - this%livecrootc_storage_to_xfer_patch(i) = value_patch - this%deadcrootc_storage_to_xfer_patch(i) = value_patch - this%gresp_storage_to_xfer_patch(i) = value_patch - this%livestemc_to_deadstemc_patch(i) = value_patch - this%livecrootc_to_deadcrootc_patch(i) = value_patch - - this%current_gr_patch(i) = value_patch - this%transfer_gr_patch(i) = value_patch - this%storage_gr_patch(i) = value_patch - this%frootc_alloc_patch(i) = value_patch - this%frootc_loss_patch(i) = value_patch - this%leafc_alloc_patch(i) = value_patch - this%leafc_loss_patch(i) = value_patch - this%woodc_alloc_patch(i) = value_patch - this%woodc_loss_patch(i) = value_patch - - this%crop_seedc_to_leaf_patch(i) = value_patch - this%grainc_to_cropprodc_patch(i) = value_patch - end do - - if ( use_crop )then - do fi = 1,num_patch - i = filter_patch(fi) - this%xsmrpool_to_atm_patch(i) = value_patch - this%livestemc_to_litter_patch(i) = value_patch - this%grainc_to_food_patch(i) = value_patch - this%grainc_to_seed_patch(i) = value_patch - this%grainc_xfer_to_grainc_patch(i) = value_patch - this%cpool_to_grainc_patch(i) = value_patch - this%cpool_to_grainc_storage_patch(i) = value_patch - this%cpool_grain_gr_patch(i) = value_patch - this%cpool_grain_storage_gr_patch(i) = value_patch - this%transfer_grain_gr_patch(i) = value_patch - this%grainc_storage_to_xfer_patch(i) = value_patch - end do - end if - - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - - this%phenology_c_to_litr_met_c_col(i,j) = value_column - this%phenology_c_to_litr_cel_c_col(i,j) = value_column - this%phenology_c_to_litr_lig_c_col(i,j) = value_column - - this%gap_mortality_c_to_litr_met_c_col(i,j) = value_column - this%gap_mortality_c_to_litr_cel_c_col(i,j) = value_column - this%gap_mortality_c_to_litr_lig_c_col(i,j) = value_column - this%gap_mortality_c_to_cwdc_col(i,j) = value_column - - this%fire_mortality_c_to_cwdc_col(i,j) = value_column - this%m_c_to_litr_met_fire_col(i,j) = value_column - this%m_c_to_litr_cel_fire_col(i,j) = value_column - this%m_c_to_litr_lig_fire_col(i,j) = value_column - - this%harvest_c_to_litr_met_c_col(i,j) = value_column - this%harvest_c_to_litr_cel_c_col(i,j) = value_column - this%harvest_c_to_litr_lig_c_col(i,j) = value_column - this%harvest_c_to_cwdc_col(i,j) = value_column - - end do - end do - - do k = 1, ndecomp_pools - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%m_decomp_cpools_to_fire_vr_col(i,j,k) = value_column - end do - end do - end do - - do k = 1, ndecomp_pools - do fi = 1,num_column - i = filter_column(fi) - this%m_decomp_cpools_to_fire_col(i,k) = value_column - end do - end do - - do fi = 1,num_column - i = filter_column(fi) - - this%grainc_to_cropprodc_col(i) = value_column - this%cwdc_hr_col(i) = value_column - this%cwdc_loss_col(i) = value_column - this%litterc_loss_col(i) = value_column - end do - - do fi = 1,num_patch - i = filter_patch(fi) - - this%gpp_patch(i) = value_patch - this%mr_patch(i) = value_patch - this%gr_patch(i) = value_patch - this%ar_patch(i) = value_patch - this%rr_patch(i) = value_patch - this%npp_patch(i) = value_patch - this%agnpp_patch(i) = value_patch - this%bgnpp_patch(i) = value_patch - this%litfall_patch(i) = value_patch - this%wood_harvestc_patch(i) = value_patch - this%slash_harvestc_patch(i) = value_patch - this%cinputs_patch(i) = value_patch - this%coutputs_patch(i) = value_patch - this%fire_closs_patch(i) = value_patch - this%npp_Nactive_patch(i) = value_patch - this%npp_burnedoff_patch(i) = value_patch - this%npp_Nnonmyc_patch(i) = value_patch - this%npp_Nam_patch(i) = value_patch - this%npp_Necm_patch(i) = value_patch - this%npp_Nactive_no3_patch(i) = value_patch - this%npp_Nactive_nh4_patch(i) = value_patch - this%npp_Nnonmyc_no3_patch(i) = value_patch - this%npp_Nnonmyc_nh4_patch(i) = value_patch - this%npp_Nam_no3_patch(i) = value_patch - this%npp_Nam_nh4_patch(i) = value_patch - this%npp_Necm_no3_patch(i) = value_patch - this%npp_Necm_nh4_patch(i) = value_patch - this%npp_Nfix_patch(i) = value_patch - this%npp_Nretrans_patch(i) = value_patch - this%npp_Nuptake_patch(i) = value_patch - this%npp_growth_patch(i) = value_patch - this%leafc_change_patch(i) = value_patch - this%soilc_change_patch(i) = value_patch - end do - - do fi = 1,num_column - i = filter_column(fi) - - this%sr_col(i) = value_column - this%er_col(i) = value_column - this%litfire_col(i) = value_column - this%somfire_col(i) = value_column - this%totfire_col(i) = value_column - this%fire_closs_col(i) = value_column - - ! Zero p2c column fluxes - this%rr_col(i) = value_column - this%ar_col(i) = value_column - this%gpp_col(i) = value_column - this%npp_col(i) = value_column - this%fire_closs_col(i) = value_column - this%wood_harvestc_col(i) = value_column - this%hrv_xsmrpool_to_atm_col(i) = value_column - - this%nep_col(i) = value_column - - end do - - end subroutine SetValues - -end module CNVegCarbonFluxType - - diff --git a/src/biogeochem/CNVegCarbonStateType.F90 b/src/biogeochem/CNVegCarbonStateType.F90 deleted file mode 100644 index a580047944..0000000000 --- a/src/biogeochem/CNVegCarbonStateType.F90 +++ /dev/null @@ -1,2346 +0,0 @@ -module CNVegCarbonStateType - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_const_mod , only : SHR_CONST_PDB - use shr_log_mod , only : errMsg => shr_log_errMsg - use pftconMod , only : noveg, npcropmin, pftcon - use clm_varcon , only : spval, c3_r2, c4_r2, c14ratio - use clm_varctl , only : iulog, use_cndv, use_crop - use decompMod , only : bounds_type - use abortutils , only : endrun - use spmdMod , only : masterproc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use CNSpeciesMod , only : species_from_string, CN_SPECIES_C12 - use CNVegComputeSeedMod, only : ComputeSeedAmounts - ! - ! !PUBLIC TYPES: - implicit none - private - ! - - type, public :: cnveg_carbonstate_type - - integer :: species ! c12, c13, c14 - - real(r8), pointer :: grainc_patch (:) ! (gC/m2) grain C (crop model) - real(r8), pointer :: grainc_storage_patch (:) ! (gC/m2) grain C storage (crop model) - real(r8), pointer :: grainc_xfer_patch (:) ! (gC/m2) grain C transfer (crop model) - real(r8), pointer :: leafc_patch (:) ! (gC/m2) leaf C - real(r8), pointer :: leafc_storage_patch (:) ! (gC/m2) leaf C storage - real(r8), pointer :: leafc_xfer_patch (:) ! (gC/m2) leaf C transfer - real(r8), pointer :: leafc_storage_xfer_acc_patch (:) ! (gC/m2) Accmulated leaf C transfer - real(r8), pointer :: storage_cdemand_patch (:) ! (gC/m2) C use from the C storage pool - real(r8), pointer :: frootc_patch (:) ! (gC/m2) fine root C - real(r8), pointer :: frootc_storage_patch (:) ! (gC/m2) fine root C storage - real(r8), pointer :: frootc_xfer_patch (:) ! (gC/m2) fine root C transfer - real(r8), pointer :: livestemc_patch (:) ! (gC/m2) live stem C - real(r8), pointer :: livestemc_storage_patch (:) ! (gC/m2) live stem C storage - real(r8), pointer :: livestemc_xfer_patch (:) ! (gC/m2) live stem C transfer - real(r8), pointer :: deadstemc_patch (:) ! (gC/m2) dead stem C - real(r8), pointer :: deadstemc_storage_patch (:) ! (gC/m2) dead stem C storage - real(r8), pointer :: deadstemc_xfer_patch (:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: livecrootc_patch (:) ! (gC/m2) live coarse root C - real(r8), pointer :: livecrootc_storage_patch (:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: livecrootc_xfer_patch (:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: deadcrootc_patch (:) ! (gC/m2) dead coarse root C - real(r8), pointer :: deadcrootc_storage_patch (:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: deadcrootc_xfer_patch (:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: gresp_storage_patch (:) ! (gC/m2) growth respiration storage - real(r8), pointer :: gresp_xfer_patch (:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: cpool_patch (:) ! (gC/m2) temporary photosynthate C pool - real(r8), pointer :: xsmrpool_patch (:) ! (gC/m2) abstract C pool to meet excess MR demand - real(r8), pointer :: ctrunc_patch (:) ! (gC/m2) patch-level sink for C truncation - real(r8), pointer :: woodc_patch (:) ! (gC/m2) wood C - real(r8), pointer :: leafcmax_patch (:) ! (gC/m2) ann max leaf C - real(r8), pointer :: totc_patch (:) ! (gC/m2) total patch-level carbon, including cpool - real(r8), pointer :: rootc_col (:) ! (gC/m2) root carbon at column level (fire) - real(r8), pointer :: leafc_col (:) ! (gC/m2) column-level leafc (fire) - real(r8), pointer :: deadstemc_col (:) ! (gC/m2) column-level deadstemc (fire) - real(r8), pointer :: fuelc_col (:) ! fuel load outside cropland - real(r8), pointer :: fuelc_crop_col (:) ! fuel load for cropland - real(r8), pointer :: cropseedc_deficit_patch (:) ! (gC/m2) pool for seeding new crop growth; this is a NEGATIVE term, indicating the amount of seed usage that needs to be repaid - - ! pools for dynamic landcover - real(r8), pointer :: seedc_grc (:) ! (gC/m2) gridcell-level pool for seeding new PFTs via dynamic landcover - - ! summary (diagnostic) state variables, not involved in mass balance - real(r8), pointer :: dispvegc_patch (:) ! (gC/m2) displayed veg carbon, excluding storage and cpool - real(r8), pointer :: storvegc_patch (:) ! (gC/m2) stored vegetation carbon, excluding cpool - real(r8), pointer :: totvegc_patch (:) ! (gC/m2) total vegetation carbon, excluding cpool - real(r8), pointer :: totvegc_col (:) ! (gC/m2) total vegetation carbon, excluding cpool averaged to column (p2c) - - ! Total C pools - real(r8), pointer :: totc_p2c_col (:) ! (gC/m2) totc_patch averaged to col - real(r8), pointer :: totc_col (:) ! (gC/m2) total column carbon, incl veg and cpool - real(r8), pointer :: totecosysc_col (:) ! (gC/m2) total ecosystem carbon, incl veg but excl cpool - - contains - - procedure , public :: Init - procedure , public :: SetValues - procedure , public :: Restart - - procedure , private :: InitAllocate ! Allocate arrays - procedure , private :: InitReadNML ! Read in namelist - procedure , private :: InitHistory ! Initialize history - procedure , private :: InitCold ! Initialize arrays for a cold-start - - end type cnveg_carbonstate_type - - ! !PRIVATE DATA: - - type, private :: cnvegcarbonstate_const_type - ! !PRIVATE MEMBER DATA: - real(r8) :: initial_vegC = 20._r8 ! Initial vegetation carbon for leafc/frootc and storage - end type - type(cnvegcarbonstate_const_type), private :: cnvegcstate_const ! Constants used here - character(len=*), parameter :: sourcefile = & - __FILE__ - - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, carbon_type, ratio, NLFilename, & - c12_cnveg_carbonstate_inst) - - class(cnveg_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: ratio - character(len=*) , intent(in) :: carbon_type ! Carbon isotope type C12, C13 or C1 - character(len=*) , intent(in) :: NLFilename ! Namelist filename - type(cnveg_carbonstate_type) , intent(in), optional :: c12_cnveg_carbonstate_inst ! cnveg_carbonstate for C12 (if C13 or C14) - !----------------------------------------------------------------------- - - this%species = species_from_string(carbon_type) - - call this%InitAllocate ( bounds) - call this%InitReadNML ( NLFilename ) - call this%InitHistory ( bounds, carbon_type) - if (present(c12_cnveg_carbonstate_inst)) then - call this%InitCold ( bounds, ratio, carbon_type, c12_cnveg_carbonstate_inst ) - else - call this%InitCold ( bounds, ratio, carbon_type ) - end if - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitReadNML(this, NLFilename) - ! - ! !DESCRIPTION: - ! Read the namelist for CNVegCarbonState - ! - !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - ! - ! !ARGUMENTS: - class(cnveg_carbonstate_type) :: this - character(len=*) , intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'InitReadNML' - character(len=*), parameter :: nmlname = 'cnvegcarbonstate' ! MUST match what is in namelist below - !----------------------------------------------------------------------- - real(r8) :: initial_vegC - namelist /cnvegcarbonstate/ initial_vegC - - initial_vegC = cnvegcstate_const%initial_vegC - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=cnvegcarbonstate, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (initial_vegC , mpicom) - - cnvegcstate_const%initial_vegC = initial_vegC - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=cnvegcarbonstate) ! Name here MUST be the same as in nmlname above! - write(iulog,*) ' ' - end if - - !----------------------------------------------------------------------- - - end subroutine InitReadNML - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !ARGUMENTS: - class (cnveg_carbonstate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp,endp - integer :: begc,endc - integer :: begg,endg - !------------------------------------------------------------------------ - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - allocate(this%leafc_patch (begp:endp)) ; this%leafc_patch (:) = nan - allocate(this%leafc_storage_patch (begp:endp)) ; this%leafc_storage_patch (:) = nan - allocate(this%leafc_xfer_patch (begp:endp)) ; this%leafc_xfer_patch (:) = nan - allocate(this%leafc_storage_xfer_acc_patch (begp:endp)) ; this%leafc_storage_xfer_acc_patch (:) = nan - allocate(this%storage_cdemand_patch (begp:endp)) ; this%storage_cdemand_patch (:) = nan - allocate(this%frootc_patch (begp:endp)) ; this%frootc_patch (:) = nan - allocate(this%frootc_storage_patch (begp:endp)) ; this%frootc_storage_patch (:) = nan - allocate(this%frootc_xfer_patch (begp:endp)) ; this%frootc_xfer_patch (:) = nan - allocate(this%livestemc_patch (begp:endp)) ; this%livestemc_patch (:) = nan - allocate(this%livestemc_storage_patch (begp:endp)) ; this%livestemc_storage_patch (:) = nan - allocate(this%livestemc_xfer_patch (begp:endp)) ; this%livestemc_xfer_patch (:) = nan - allocate(this%deadstemc_patch (begp:endp)) ; this%deadstemc_patch (:) = nan - allocate(this%deadstemc_storage_patch (begp:endp)) ; this%deadstemc_storage_patch (:) = nan - allocate(this%deadstemc_xfer_patch (begp:endp)) ; this%deadstemc_xfer_patch (:) = nan - allocate(this%livecrootc_patch (begp:endp)) ; this%livecrootc_patch (:) = nan - allocate(this%livecrootc_storage_patch (begp:endp)) ; this%livecrootc_storage_patch (:) = nan - allocate(this%livecrootc_xfer_patch (begp:endp)) ; this%livecrootc_xfer_patch (:) = nan - allocate(this%deadcrootc_patch (begp:endp)) ; this%deadcrootc_patch (:) = nan - allocate(this%deadcrootc_storage_patch (begp:endp)) ; this%deadcrootc_storage_patch (:) = nan - allocate(this%deadcrootc_xfer_patch (begp:endp)) ; this%deadcrootc_xfer_patch (:) = nan - allocate(this%gresp_storage_patch (begp:endp)) ; this%gresp_storage_patch (:) = nan - allocate(this%gresp_xfer_patch (begp:endp)) ; this%gresp_xfer_patch (:) = nan - allocate(this%cpool_patch (begp:endp)) ; this%cpool_patch (:) = nan - allocate(this%xsmrpool_patch (begp:endp)) ; this%xsmrpool_patch (:) = nan - allocate(this%ctrunc_patch (begp:endp)) ; this%ctrunc_patch (:) = nan - allocate(this%dispvegc_patch (begp:endp)) ; this%dispvegc_patch (:) = nan - allocate(this%storvegc_patch (begp:endp)) ; this%storvegc_patch (:) = nan - allocate(this%leafcmax_patch (begp:endp)) ; this%leafcmax_patch (:) = nan - allocate(this%totc_patch (begp:endp)) ; this%totc_patch (:) = nan - allocate(this%grainc_patch (begp:endp)) ; this%grainc_patch (:) = nan - allocate(this%grainc_storage_patch (begp:endp)) ; this%grainc_storage_patch (:) = nan - allocate(this%grainc_xfer_patch (begp:endp)) ; this%grainc_xfer_patch (:) = nan - allocate(this%woodc_patch (begp:endp)) ; this%woodc_patch (:) = nan - - allocate(this%cropseedc_deficit_patch (begp:endp)) ; this%cropseedc_deficit_patch (:) = nan - allocate(this%seedc_grc (begg:endg)) ; this%seedc_grc (:) = nan - allocate(this%rootc_col (begc:endc)) ; this%rootc_col (:) = nan - allocate(this%leafc_col (begc:endc)) ; this%leafc_col (:) = nan - allocate(this%deadstemc_col (begc:endc)) ; this%deadstemc_col (:) = nan - allocate(this%fuelc_col (begc:endc)) ; this%fuelc_col (:) = nan - allocate(this%fuelc_crop_col (begc:endc)) ; this%fuelc_crop_col (:) = nan - - allocate(this%totvegc_patch (begp:endp)) ; this%totvegc_patch (:) = nan - allocate(this%totvegc_col (begc:endc)) ; this%totvegc_col (:) = nan - - allocate(this%totc_p2c_col (begc:endc)) ; this%totc_p2c_col (:) = nan - allocate(this%totc_col (begc:endc)) ; this%totc_col (:) = nan - allocate(this%totecosysc_col (begc:endc)) ; this%totecosysc_col (:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds, carbon_type) - ! - ! !DESCRIPTION: - ! add history fields for all CN variables, always set as default='inactive' - ! - ! !USES: - use histFileMod, only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp - ! - ! !ARGUMENTS: - class (cnveg_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - character(len=*) , intent(in) :: carbon_type ! one of ['c12', c13','c14'] - ! - ! !LOCAL VARIABLES: - integer :: k,l,ii,jj - character(10) :: active - integer :: begp,endp - integer :: begc,endc - integer :: begg,endg - character(24) :: fieldname - character(100) :: longname - real(r8), pointer :: data1dptr(:) ! temp. pointer for slicing larger arrays - real(r8), pointer :: data2dptr(:,:) ! temp. pointer for slicing larger arrays - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - !------------------------------- - ! C12 state variables - !------------------------------- - - if (carbon_type == 'c12') then - - if (use_crop) then - this%grainc_patch(begp:endp) = spval - call hist_addfld1d (fname='GRAINC', units='gC/m^2', & - avgflag='A', long_name='grain C (does not equal yield)', & - ptr_patch=this%grainc_patch, default='inactive') - this%cropseedc_deficit_patch(begp:endp) = spval - call hist_addfld1d (fname='CROPSEEDC_DEFICIT', units='gC/m^2', & - avgflag='A', long_name='C used for crop seed that needs to be repaid', & - ptr_patch=this%cropseedc_deficit_patch, default='inactive') - end if - - this%woodc_patch(begp:endp) = spval - call hist_addfld1d (fname='WOODC', units='gC/m^2', & - avgflag='A', long_name='wood C', & - ptr_patch=this%woodc_patch, default='inactive') - - this%leafc_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC', units='gC/m^2', & - avgflag='A', long_name='leaf C', & - ptr_patch=this%leafc_patch, default='inactive') - - this%leafc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_STORAGE', units='gC/m^2', & - avgflag='A', long_name='leaf C storage', & - ptr_patch=this%leafc_storage_patch, default='inactive') - - this%leafc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_XFER', units='gC/m^2', & - avgflag='A', long_name='leaf C transfer', & - ptr_patch=this%leafc_xfer_patch, default='inactive') - - this%leafc_storage_xfer_acc_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_STORAGE_XFER_ACC', units='gC/m^2', & - avgflag='A', long_name='Accumulated leaf C transfer', & - ptr_patch=this%leafc_storage_xfer_acc_patch, default='inactive') - - this%storage_cdemand_patch(begp:endp) = spval - call hist_addfld1d (fname='STORAGE_CDEMAND', units='gC/m^2', & - avgflag='A', long_name='C use from the C storage pool', & - ptr_patch=this%storage_cdemand_patch, default='inactive') - - this%frootc_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTC', units='gC/m^2', & - avgflag='A', long_name='fine root C', & - ptr_patch=this%frootc_patch, default='inactive') - - this%frootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTC_STORAGE', units='gC/m^2', & - avgflag='A', long_name='fine root C storage', & - ptr_patch=this%frootc_storage_patch, default='inactive') - - this%frootc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTC_XFER', units='gC/m^2', & - avgflag='A', long_name='fine root C transfer', & - ptr_patch=this%frootc_xfer_patch, default='inactive') - - this%livestemc_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMC', units='gC/m^2', & - avgflag='A', long_name='live stem C', & - ptr_patch=this%livestemc_patch, default='inactive') - - this%livestemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMC_STORAGE', units='gC/m^2', & - avgflag='A', long_name='live stem C storage', & - ptr_patch=this%livestemc_storage_patch, default='inactive') - - this%livestemc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMC_XFER', units='gC/m^2', & - avgflag='A', long_name='live stem C transfer', & - ptr_patch=this%livestemc_xfer_patch, default='inactive') - - this%deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMC', units='gC/m^2', & - avgflag='A', long_name='dead stem C', & - ptr_patch=this%deadstemc_patch, default='inactive') - - this%deadstemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMC_STORAGE', units='gC/m^2', & - avgflag='A', long_name='dead stem C storage', & - ptr_patch=this%deadstemc_storage_patch, default='inactive') - - this%deadstemc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMC_XFER', units='gC/m^2', & - avgflag='A', long_name='dead stem C transfer', & - ptr_patch=this%deadstemc_xfer_patch, default='inactive') - - this%livecrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTC', units='gC/m^2', & - avgflag='A', long_name='live coarse root C', & - ptr_patch=this%livecrootc_patch, default='inactive') - - this%livecrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTC_STORAGE', units='gC/m^2', & - avgflag='A', long_name='live coarse root C storage', & - ptr_patch=this%livecrootc_storage_patch, default='inactive') - - this%livecrootc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTC_XFER', units='gC/m^2', & - avgflag='A', long_name='live coarse root C transfer', & - ptr_patch=this%livecrootc_xfer_patch, default='inactive') - - this%deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTC', units='gC/m^2', & - avgflag='A', long_name='dead coarse root C', & - ptr_patch=this%deadcrootc_patch, default='inactive') - - this%deadcrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTC_STORAGE', units='gC/m^2', & - avgflag='A', long_name='dead coarse root C storage', & - ptr_patch=this%deadcrootc_storage_patch, default='inactive') - - this%deadcrootc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTC_XFER', units='gC/m^2', & - avgflag='A', long_name='dead coarse root C transfer', & - ptr_patch=this%deadcrootc_xfer_patch, default='inactive') - - this%gresp_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='GRESP_STORAGE', units='gC/m^2', & - avgflag='A', long_name='growth respiration storage', & - ptr_patch=this%gresp_storage_patch, default='inactive') - - this%gresp_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='GRESP_XFER', units='gC/m^2', & - avgflag='A', long_name='growth respiration transfer', & - ptr_patch=this%gresp_xfer_patch, default='inactive') - - this%cpool_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL', units='gC/m^2', & - avgflag='A', long_name='temporary photosynthate C pool', & - ptr_patch=this%cpool_patch, default='inactive') - - this%xsmrpool_patch(begp:endp) = spval - call hist_addfld1d (fname='XSMRPOOL', units='gC/m^2', & - avgflag='A', long_name='temporary photosynthate C pool', & - ptr_patch=this%xsmrpool_patch, default='inactive') - - this%ctrunc_patch(begp:endp) = spval - call hist_addfld1d (fname='PFT_CTRUNC', units='gC/m^2', & - avgflag='A', long_name='patch-level sink for C truncation', & - ptr_patch=this%ctrunc_patch, default='inactive') - - this%dispvegc_patch(begp:endp) = spval - call hist_addfld1d (fname='DISPVEGC', units='gC/m^2', & - avgflag='A', long_name='displayed veg carbon, excluding storage and cpool', & - ptr_patch=this%dispvegc_patch, default='inactive') - - this%storvegc_patch(begp:endp) = spval - call hist_addfld1d (fname='STORVEGC', units='gC/m^2', & - avgflag='A', long_name='stored vegetation carbon, excluding cpool', & - ptr_patch=this%storvegc_patch, default='inactive') - - this%totvegc_patch(begp:endp) = spval - call hist_addfld1d (fname='TOTVEGC', units='gC/m^2', & - avgflag='A', long_name='total vegetation carbon, excluding cpool', & - ptr_patch=this%totvegc_patch, default='inactive') - - this%totc_patch(begp:endp) = spval - call hist_addfld1d (fname='TOTPFTC', units='gC/m^2', & - avgflag='A', long_name='total patch-level carbon, including cpool', & - ptr_patch=this%totc_patch, default='inactive') - - this%seedc_grc(begg:endg) = spval - call hist_addfld1d (fname='SEEDC', units='gC/m^2', & - avgflag='A', long_name='pool for seeding new PFTs via dynamic landcover', & - ptr_gcell=this%seedc_grc, default='inactive') - - this%fuelc_col(begc:endc) = spval - call hist_addfld1d (fname='FUELC', units='gC/m^2', & - avgflag='A', long_name='fuel load', & - ptr_col=this%fuelc_col, default='inactive') - - this%totc_col(begc:endc) = spval - call hist_addfld1d (fname='TOTCOLC', units='gC/m^2', & - avgflag='A', long_name='total column carbon, incl veg and cpool but excl product pools', & - ptr_col=this%totc_col, default='inactive') - - this%totecosysc_col(begc:endc) = spval - call hist_addfld1d (fname='TOTECOSYSC', units='gC/m^2', & - avgflag='A', long_name='total ecosystem carbon, incl veg but excl cpool and product pools', & - ptr_col=this%totecosysc_col, default='inactive') - - end if - - !------------------------------- - ! C13 state variables - !------------------------------- - - if ( carbon_type == 'c13' ) then - - this%leafc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LEAFC', units='gC13/m^2', & - avgflag='A', long_name='C13 leaf C', & - ptr_patch=this%leafc_patch, default='inactive') - - this%leafc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LEAFC_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 leaf C storage', & - ptr_patch=this%leafc_storage_patch, default='inactive') - - this%leafc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LEAFC_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 leaf C transfer', & - ptr_patch=this%leafc_xfer_patch, default='inactive') - - this%leafc_storage_xfer_acc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LEAFC_STORAGE_XFER_ACC', units='gC13/m^2', & - avgflag='A', long_name='Accumulated C13 leaf C transfer', & - ptr_patch=this%leafc_storage_xfer_acc_patch, default='inactive') - - this%frootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_FROOTC', units='gC13/m^2', & - avgflag='A', long_name='C13 fine root C', & - ptr_patch=this%frootc_patch, default='inactive') - - this%frootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_FROOTC_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 fine root C storage', & - ptr_patch=this%frootc_storage_patch, default='inactive') - - this%frootc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_FROOTC_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 fine root C transfer', & - ptr_patch=this%frootc_xfer_patch, default='inactive') - - this%livestemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVESTEMC', units='gC13/m^2', & - avgflag='A', long_name='C13 live stem C', & - ptr_patch=this%livestemc_patch, default='inactive') - - this%livestemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVESTEMC_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 live stem C storage', & - ptr_patch=this%livestemc_storage_patch, default='inactive') - - this%livestemc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVESTEMC_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 live stem C transfer', & - ptr_patch=this%livestemc_xfer_patch, default='inactive') - - this%deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADSTEMC', units='gC13/m^2', & - avgflag='A', long_name='C13 dead stem C', & - ptr_patch=this%deadstemc_patch, default='inactive') - - this%deadstemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADSTEMC_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 dead stem C storage', & - ptr_patch=this%deadstemc_storage_patch, default='inactive') - - this%deadstemc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADSTEMC_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 dead stem C transfer', & - ptr_patch=this%deadstemc_xfer_patch, default='inactive') - - this%livecrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVECROOTC', units='gC13/m^2', & - avgflag='A', long_name='C13 live coarse root C', & - ptr_patch=this%livecrootc_patch, default='inactive') - - this%livecrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVECROOTC_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 live coarse root C storage', & - ptr_patch=this%livecrootc_storage_patch, default='inactive') - - this%livecrootc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVECROOTC_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 live coarse root C transfer', & - ptr_patch=this%livecrootc_xfer_patch, default='inactive') - - this%deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADCROOTC', units='gC13/m^2', & - avgflag='A', long_name='C13 dead coarse root C', & - ptr_patch=this%deadcrootc_patch, default='inactive') - - this%deadcrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADCROOTC_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 dead coarse root C storage', & - ptr_patch=this%deadcrootc_storage_patch, default='inactive') - - this%deadcrootc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADCROOTC_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 dead coarse root C transfer', & - ptr_patch=this%deadcrootc_xfer_patch, default='inactive') - - this%gresp_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_GRESP_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 growth respiration storage', & - ptr_patch=this%gresp_storage_patch, default='inactive') - - this%gresp_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_GRESP_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 growth respiration transfer', & - ptr_patch=this%gresp_xfer_patch, default='inactive') - - this%cpool_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL', units='gC13/m^2', & - avgflag='A', long_name='C13 temporary photosynthate C pool', & - ptr_patch=this%cpool_patch, default='inactive') - - this%xsmrpool_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_XSMRPOOL', units='gC13/m^2', & - avgflag='A', long_name='C13 temporary photosynthate C pool', & - ptr_patch=this%xsmrpool_patch, default='inactive') - - this%ctrunc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_PFT_CTRUNC', units='gC13/m^2', & - avgflag='A', long_name='C13 patch-level sink for C truncation', & - ptr_patch=this%ctrunc_patch, default='inactive') - - this%dispvegc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DISPVEGC', units='gC13/m^2', & - avgflag='A', long_name='C13 displayed veg carbon, excluding storage and cpool', & - ptr_patch=this%dispvegc_patch, default='inactive') - - this%storvegc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_STORVEGC', units='gC13/m^2', & - avgflag='A', long_name='C13 stored vegetation carbon, excluding cpool', & - ptr_patch=this%storvegc_patch, default='inactive') - - this%totvegc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_TOTVEGC', units='gC13/m^2', & - avgflag='A', long_name='C13 total vegetation carbon, excluding cpool', & - ptr_patch=this%totvegc_patch, default='inactive') - - this%totc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_TOTPFTC', units='gC13/m^2', & - avgflag='A', long_name='C13 total patch-level carbon, including cpool', & - ptr_patch=this%totc_patch, default='inactive') - - this%seedc_grc(begg:endg) = spval - call hist_addfld1d (fname='C13_SEEDC', units='gC13/m^2', & - avgflag='A', long_name='C13 pool for seeding new PFTs via dynamic landcover', & - ptr_gcell=this%seedc_grc, default='inactive') - - this%totc_col(begc:endc) = spval - call hist_addfld1d (fname='C13_TOTCOLC', units='gC13/m^2', & - avgflag='A', long_name='C13 total column carbon, incl veg and cpool but excl product pools', & - ptr_col=this%totc_col, default='inactive') - - this%totecosysc_col(begc:endc) = spval - call hist_addfld1d (fname='C13_TOTECOSYSC', units='gC13/m^2', & - avgflag='A', long_name='C13 total ecosystem carbon, incl veg but excl cpool and product pools', & - ptr_col=this%totecosysc_col, default='inactive') - - if (use_crop) then - this%grainc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_GRAINC', units='gC/m^2', & - avgflag='A', long_name='C13 grain C (does not equal yield)', & - ptr_patch=this%grainc_patch, default='inactive') - this%cropseedc_deficit_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CROPSEEDC_DEFICIT', units='gC/m^2', & - avgflag='A', long_name='C13 C used for crop seed that needs to be repaid', & - ptr_patch=this%cropseedc_deficit_patch, default='inactive') - end if - - - endif - - !------------------------------- - ! C14 state variables - !------------------------------- - - if ( carbon_type == 'c14') then - - this%leafc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LEAFC', units='gC14/m^2', & - avgflag='A', long_name='C14 leaf C', & - ptr_patch=this%leafc_patch, default='inactive') - - this%leafc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LEAFC_STORAGE', units='gC14/m^2', & - avgflag='A', long_name='C14 leaf C storage', & - ptr_patch=this%leafc_storage_patch, default='inactive') - - this%leafc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LEAFC_XFER', units='gC14/m^2', & - avgflag='A', long_name='C14 leaf C transfer', & - ptr_patch=this%leafc_xfer_patch, default='inactive') - - this%leafc_storage_xfer_acc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LEAFC_STORAGE_XFER_ACC', units='gC14/m^2', & - avgflag='A', long_name='Accumulated C14 leaf C transfer', & - ptr_patch=this%leafc_storage_xfer_acc_patch, default='inactive') - - this%frootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_FROOTC', units='gC14/m^2', & - avgflag='A', long_name='C14 fine root C', & - ptr_patch=this%frootc_patch, default='inactive') - - this%frootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_FROOTC_STORAGE', units='gC14/m^2', & - avgflag='A', long_name='C14 fine root C storage', & - ptr_patch=this%frootc_storage_patch, default='inactive') - - this%frootc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_FROOTC_XFER', units='gC14/m^2', & - avgflag='A', long_name='C14 fine root C transfer', & - ptr_patch=this%frootc_xfer_patch, default='inactive') - - this%livestemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVESTEMC', units='gC14/m^2', & - avgflag='A', long_name='C14 live stem C', & - ptr_patch=this%livestemc_patch, default='inactive') - - this%livestemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVESTEMC_STORAGE', units='gC14/m^2', & - avgflag='A', long_name='C14 live stem C storage', & - ptr_patch=this%livestemc_storage_patch, default='inactive') - - this%livestemc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVESTEMC_XFER', units='gC14/m^2', & - avgflag='A', long_name='C14 live stem C transfer', & - ptr_patch=this%livestemc_xfer_patch, default='inactive') - - this%deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADSTEMC', units='gC14/m^2', & - avgflag='A', long_name='C14 dead stem C', & - ptr_patch=this%deadstemc_patch, default='inactive') - - this%deadstemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADSTEMC_STORAGE', units='gC14/m^2', & - avgflag='A', long_name='C14 dead stem C storage', & - ptr_patch=this%deadstemc_storage_patch, default='inactive') - - this%deadstemc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADSTEMC_XFER', units='gC14/m^2', & - avgflag='A', long_name='C14 dead stem C transfer', & - ptr_patch=this%deadstemc_xfer_patch, default='inactive') - - this%livecrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVECROOTC', units='gC14/m^2', & - avgflag='A', long_name='C14 live coarse root C', & - ptr_patch=this%livecrootc_patch, default='inactive') - - this%livecrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVECROOTC_STORAGE', units='gC14/m^2', & - avgflag='A', long_name='C14 live coarse root C storage', & - ptr_patch=this%livecrootc_storage_patch, default='inactive') - - this%livecrootc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVECROOTC_XFER', units='gC14/m^2', & - avgflag='A', long_name='C14 live coarse root C transfer', & - ptr_patch=this%livecrootc_xfer_patch, default='inactive') - - this%deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADCROOTC', units='gC14/m^2', & - avgflag='A', long_name='C14 dead coarse root C', & - ptr_patch=this%deadcrootc_patch, default='inactive') - - this%deadcrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADCROOTC_STORAGE', units='gC14/m^2', & - avgflag='A', long_name='C14 dead coarse root C storage', & - ptr_patch=this%deadcrootc_storage_patch, default='inactive') - - this%deadcrootc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADCROOTC_XFER', units='gC14/m^2', & - avgflag='A', long_name='C14 dead coarse root C transfer', & - ptr_patch=this%deadcrootc_xfer_patch, default='inactive') - - this%gresp_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_GRESP_STORAGE', units='gC14/m^2', & - avgflag='A', long_name='C14 growth respiration storage', & - ptr_patch=this%gresp_storage_patch, default='inactive') - - this%gresp_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_GRESP_XFER', units='gC14/m^2', & - avgflag='A', long_name='C14 growth respiration transfer', & - ptr_patch=this%gresp_xfer_patch, default='inactive') - - this%cpool_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL', units='gC14/m^2', & - avgflag='A', long_name='C14 temporary photosynthate C pool', & - ptr_patch=this%cpool_patch, default='inactive') - - this%xsmrpool_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_XSMRPOOL', units='gC14/m^2', & - avgflag='A', long_name='C14 temporary photosynthate C pool', & - ptr_patch=this%xsmrpool_patch, default='inactive') - - this%ctrunc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_PFT_CTRUNC', units='gC14/m^2', & - avgflag='A', long_name='C14 patch-level sink for C truncation', & - ptr_patch=this%ctrunc_patch, default='inactive') - - this%dispvegc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DISPVEGC', units='gC14/m^2', & - avgflag='A', long_name='C14 displayed veg carbon, excluding storage and cpool', & - ptr_patch=this%dispvegc_patch, default='inactive') - - this%storvegc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_STORVEGC', units='gC14/m^2', & - avgflag='A', long_name='C14 stored vegetation carbon, excluding cpool', & - ptr_patch=this%storvegc_patch, default='inactive') - - this%totvegc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_TOTVEGC', units='gC14/m^2', & - avgflag='A', long_name='C14 total vegetation carbon, excluding cpool', & - ptr_patch=this%totvegc_patch, default='inactive') - - this%totc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_TOTPFTC', units='gC14/m^2', & - avgflag='A', long_name='C14 total patch-level carbon, including cpool', & - ptr_patch=this%totc_patch, default='inactive') - - this%seedc_grc(begg:endg) = spval - call hist_addfld1d (fname='C14_SEEDC', units='gC14/m^2', & - avgflag='A', long_name='C14 pool for seeding new PFTs via dynamic landcover', & - ptr_gcell=this%seedc_grc, default='inactive') - - this%totc_col(begc:endc) = spval - call hist_addfld1d (fname='C14_TOTCOLC', units='gC14/m^2', & - avgflag='A', long_name='C14 total column carbon, incl veg and cpool but excl product pools', & - ptr_col=this%totc_col, default='inactive') - - this%totecosysc_col(begc:endc) = spval - call hist_addfld1d (fname='C14_TOTECOSYSC', units='gC14/m^2', & - avgflag='A', long_name='C14 total ecosystem carbon, incl veg but excl cpool and product pools', & - ptr_col=this%totecosysc_col, default='inactive') - - if (use_crop) then - this%grainc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_GRAINC', units='gC/m^2', & - avgflag='A', long_name='C14 grain C (does not equal yield)', & - ptr_patch=this%grainc_patch, default='inactive') - this%cropseedc_deficit_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CROPSEEDC_DEFICIT', units='gC/m^2', & - avgflag='A', long_name='C14 C used for crop seed that needs to be repaid', & - ptr_patch=this%cropseedc_deficit_patch, default='inactive') - end if - - - endif - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds, ratio, carbon_type, c12_cnveg_carbonstate_inst) - ! - ! !DESCRIPTION: - ! Initializes time varying variables used only in coupled carbon-nitrogen mode (CN): - ! - ! !USES, default='inactive': - use landunit_varcon , only : istsoil, istcrop - use clm_time_manager , only : is_restart, get_nstep - use clm_varctl, only : MM_Nuptake_opt - ! - ! !ARGUMENTS: - class(cnveg_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: ratio ! Standard isotope ratio - character(len=*) , intent(in) :: carbon_type ! 'c12' or 'c13' or 'c14' - type(cnveg_carbonstate_type) , optional, intent(in) :: c12_cnveg_carbonstate_inst - ! - ! !LOCAL VARIABLES: - integer :: p,c,l,g,j,k,i - integer :: fc ! filter index - integer :: num_special_col ! number of good values in special_col filter - integer :: num_special_patch ! number of good values in special_patch filter - integer :: special_col(bounds%endc-bounds%begc+1) ! special landunit filter - columns - integer :: special_patch(bounds%endp-bounds%begp+1) ! special landunit filter - patches - !----------------------------------------------------------------------- - - if (carbon_type == 'c13' .or. carbon_type == 'c14') then - if (.not. present(c12_cnveg_carbonstate_inst)) then - call endrun(msg=' ERROR: for C13 or C14 must pass in c12_cnveg_carbonstate_inst as argument' //& - errMsg(sourcefile, __LINE__)) - end if - end if - - ! Set column filters - - num_special_col = 0 - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - num_special_col = num_special_col + 1 - special_col(num_special_col) = c - end if - end do - - ! Set patch filters - - num_special_patch = 0 - do p = bounds%begp,bounds%endp - l = patch%landunit(p) - if (lun%ifspecial(l)) then - num_special_patch = num_special_patch + 1 - special_patch(num_special_patch) = p - end if - end do - - !----------------------------------------------- - ! initialize patch-level carbon state variables - !----------------------------------------------- - - do p = bounds%begp,bounds%endp - - this%leafcmax_patch(p) = 0._r8 - - l = patch%landunit(p) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - - if (patch%itype(p) == noveg) then - this%leafc_patch(p) = 0._r8 - this%leafc_storage_patch(p) = 0._r8 - this%frootc_patch(p) = 0._r8 - this%frootc_storage_patch(p) = 0._r8 - else - if (pftcon%evergreen(patch%itype(p)) == 1._r8) then - this%leafc_patch(p) = cnvegcstate_const%initial_vegC * ratio - this%leafc_storage_patch(p) = 0._r8 - this%frootc_patch(p) = cnvegcstate_const%initial_vegC * ratio - this%frootc_storage_patch(p) = 0._r8 - else if (patch%itype(p) >= npcropmin) then ! prognostic crop types - this%leafc_patch(p) = 0._r8 - this%leafc_storage_patch(p) = 0._r8 - this%frootc_patch(p) = 0._r8 - this%frootc_storage_patch(p) = 0._r8 - else - this%leafc_patch(p) = 0._r8 - this%leafc_storage_patch(p) = cnvegcstate_const%initial_vegC * ratio - this%frootc_patch(p) = 0._r8 - this%frootc_storage_patch(p) = cnvegcstate_const%initial_vegC * ratio - end if - end if - this%leafc_xfer_patch(p) = 0._r8 - this%leafc_storage_xfer_acc_patch(p) = 0._r8 - this%storage_cdemand_patch(p) = 0._r8 - - if (MM_Nuptake_opt .eqv. .false.) then ! if not running in floating CN ratio option - this%frootc_patch(p) = 0._r8 - this%frootc_storage_patch(p) = 0._r8 - end if - this%frootc_xfer_patch(p) = 0._r8 - - this%livestemc_patch(p) = 0._r8 - this%livestemc_storage_patch(p) = 0._r8 - this%livestemc_xfer_patch(p) = 0._r8 - - if (pftcon%woody(patch%itype(p)) == 1._r8) then - this%deadstemc_patch(p) = 0.1_r8 * ratio - else - this%deadstemc_patch(p) = 0._r8 - end if - this%deadstemc_storage_patch(p) = 0._r8 - this%deadstemc_xfer_patch(p) = 0._r8 - - this%livecrootc_patch(p) = 0._r8 - this%livecrootc_storage_patch(p) = 0._r8 - this%livecrootc_xfer_patch(p) = 0._r8 - - this%deadcrootc_patch(p) = 0._r8 - this%deadcrootc_storage_patch(p) = 0._r8 - this%deadcrootc_xfer_patch(p) = 0._r8 - - this%gresp_storage_patch(p) = 0._r8 - this%gresp_xfer_patch(p) = 0._r8 - - this%cpool_patch(p) = 0._r8 - this%xsmrpool_patch(p) = 0._r8 - this%ctrunc_patch(p) = 0._r8 - this%dispvegc_patch(p) = 0._r8 - this%storvegc_patch(p) = 0._r8 - this%woodc_patch(p) = 0._r8 - this%totc_patch(p) = 0._r8 - - if ( use_crop )then - this%grainc_patch(p) = 0._r8 - this%grainc_storage_patch(p) = 0._r8 - this%grainc_xfer_patch(p) = 0._r8 - this%cropseedc_deficit_patch(p) = 0._r8 - end if - - endif - - end do - - ! ----------------------------------------------- - ! initialize column-level variables - ! ----------------------------------------------- - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then -! this%totgrainc_col(c) = 0._r8 - - ! total carbon pools - this%totecosysc_col(c) = 0._r8 - this%totc_p2c_col(c) = 0._r8 - this%totc_col(c) = 0._r8 - end if - end do - - - do g = bounds%begg, bounds%endg - this%seedc_grc(g) = 0._r8 - end do - - if ( .not. is_restart() .and. get_nstep() == 1 ) then - - do p = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(p)) == 1._r8) then - this%grainc_patch(p) = c12_cnveg_carbonstate_inst%grainc_patch(p) * c3_r2 - this%grainc_storage_patch(p) = c12_cnveg_carbonstate_inst%grainc_storage_patch(p) * c3_r2 - this%grainc_xfer_patch(p) = c12_cnveg_carbonstate_inst%grainc_xfer_patch(p) * c3_r2 - this%dispvegc_patch(p) = c12_cnveg_carbonstate_inst%dispvegc_patch(p) * c3_r2 - this%storvegc_patch(p) = c12_cnveg_carbonstate_inst%storvegc_patch(p) * c3_r2 - this%totvegc_patch(p) = c12_cnveg_carbonstate_inst%totvegc_patch(p) * c3_r2 - this%totc_patch(p) = c12_cnveg_carbonstate_inst%totc_patch(p) * c3_r2 - this%woodc_patch(p) = c12_cnveg_carbonstate_inst%woodc_patch(p) * c3_r2 - else - this%grainc_patch(p) = c12_cnveg_carbonstate_inst%grainc_patch(p) * c4_r2 - this%grainc_storage_patch(p) = c12_cnveg_carbonstate_inst%grainc_storage_patch(p) * c4_r2 - this%grainc_xfer_patch(p) = c12_cnveg_carbonstate_inst%grainc_xfer_patch(p) * c4_r2 - this%dispvegc_patch(p) = c12_cnveg_carbonstate_inst%dispvegc_patch(p) * c4_r2 - this%storvegc_patch(p) = c12_cnveg_carbonstate_inst%storvegc_patch(p) * c4_r2 - this%totvegc_patch(p) = c12_cnveg_carbonstate_inst%totvegc_patch(p) * c4_r2 - this%totc_patch(p) = c12_cnveg_carbonstate_inst%totc_patch(p) * c4_r2 - this%woodc_patch(p) = c12_cnveg_carbonstate_inst%woodc_patch(p) * c4_r2 - end if - end do - end if - - ! initialize fields for special filters - - call this%SetValues (& - num_patch=num_special_patch, filter_patch=special_patch, value_patch=0._r8, & - num_column=num_special_col, filter_column=special_col, value_column=0._r8) - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart ( this, bounds, ncid, flag, carbon_type, reseed_dead_plants, & - c12_cnveg_carbonstate_inst, filter_reseed_patch, & - num_reseed_patch) - ! - ! !DESCRIPTION: - ! Read/write CN restart data for carbon state - ! - ! !USES: - use shr_infnan_mod , only : isnan => shr_infnan_isnan, nan => shr_infnan_nan, assignment(=) - use clm_varcon , only : c13ratio, c14ratio - use clm_varctl , only : spinup_state, use_cndv, MM_Nuptake_opt - use clm_time_manager , only : get_nstep, is_restart, get_nstep - use landunit_varcon , only : istsoil, istcrop - use spmdMod , only : mpicom - use shr_mpi_mod , only : shr_mpi_sum - use restUtilMod - use ncdio_pio - ! - ! !ARGUMENTS: - class (cnveg_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag !'read' or 'write' - character(len=*) , intent(in) :: carbon_type ! 'c12' or 'c13' or 'c14' - logical , intent(in) :: reseed_dead_plants - type (cnveg_carbonstate_type) , intent(in), optional :: c12_cnveg_carbonstate_inst - integer , intent(out), optional :: filter_reseed_patch(:) - integer , intent(out), optional :: num_reseed_patch - ! - ! !LOCAL VARIABLES: - integer :: i,j,k,l,c,p - real(r8) :: ratio - character(len=128) :: varname ! temporary - logical :: readvar - integer :: idata - logical :: exit_spinup = .false. - logical :: enter_spinup = .false. - ! flags for comparing the model and restart decomposition cascades - integer :: decomp_cascade_state, restart_file_decomp_cascade_state - ! spinup state as read from restart file, for determining whether to enter or exit spinup mode. - integer :: restart_file_spinup_state - integer :: total_num_reseed_patch ! Total number of patches to reseed across all processors - - !------------------------------------------------------------------------ - - if (carbon_type == 'c13' .or. carbon_type == 'c14') then - if (.not. present(c12_cnveg_carbonstate_inst)) then - call endrun(msg=' ERROR: for C14 must pass in c12_cnveg_carbonstate_inst as argument' //& - errMsg(sourcefile, __LINE__)) - end if - end if - if (carbon_type == 'c12') then - ratio = 1._r8 - else if (carbon_type == 'c13') then - ratio = c13ratio - else if (carbon_type == 'c14') then - ratio = c14ratio - end if - - if ( ( present(num_reseed_patch) .and. .not. present(filter_reseed_patch)) & - .or. (.not. present(num_reseed_patch) .and. present(filter_reseed_patch) ) )then - call endrun(msg=' ERROR: filter_reseed_patch and num_reseed_patch both need to be entered ' //& - errMsg(sourcefile, __LINE__)) - end if - if ( present(num_reseed_patch) )then - num_reseed_patch = 0 - filter_reseed_patch(:) = -1 - end if - - !-------------------------------- - ! patch carbon state variables (c12) - !-------------------------------- - - if (carbon_type == 'c12') then - call restartvar(ncid=ncid, flag=flag, varname='leafc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='leafc_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='leafc_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='leafc_storage_xfer_acc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_storage_xfer_acc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='storage_cdemand', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%storage_cdemand_patch) - - call restartvar(ncid=ncid, flag=flag, varname='frootc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='frootc_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootc_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='frootc_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootc_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livestemc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadstemc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadstemc_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemc_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadstemc_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemc_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livecrootc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livecrootc_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livecrootc_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootc_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootc_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootc_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootc_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='gresp_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%gresp_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='gresp_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%gresp_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='cpool', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%cpool_patch) - - call restartvar(ncid=ncid, flag=flag, varname='xsmrpool', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%xsmrpool_patch) - - call restartvar(ncid=ncid, flag=flag, varname='pft_ctrunc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%ctrunc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='leafcmax', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafcmax_patch) - - if (flag == 'read') then - call restartvar(ncid=ncid, flag=flag, varname='spinup_state', xtype=ncd_int, & - long_name='Spinup state of the model that wrote this restart file: ' & - // ' 0 = normal model mode, 1 = AD spinup, 2 = AAD spinup', units='', & - interpinic_flag='copy', readvar=readvar, data=idata) - - if (readvar) then - restart_file_spinup_state = idata - else - restart_file_spinup_state = spinup_state - if ( masterproc ) then - write(iulog,*) ' CNRest: WARNING! Restart file does not contain info ' & - // ' on spinup state used to generate the restart file. ' - write(iulog,*) ' Assuming the same as current setting: ', spinup_state - end if - end if - end if - - if (flag == 'read' .and. spinup_state /= restart_file_spinup_state .and. .not. use_cndv) then - if ( masterproc ) write(iulog, *) 'exit_spinup ',exit_spinup,' restart_file_spinup_state ',restart_file_spinup_state - if (spinup_state <= 1 .and. restart_file_spinup_state == 2 ) then - if ( masterproc ) write(iulog,*) ' CNRest: taking Dead wood C pools out of AD spinup mode' - exit_spinup = .true. - if ( masterproc ) write(iulog, *) 'Multiplying stemc and crootc by 10 for exit spinup' - do i = bounds%begp,bounds%endp - this%deadstemc_patch(i) = this%deadstemc_patch(i) * 10._r8 - this%deadcrootc_patch(i) = this%deadcrootc_patch(i) * 10._r8 - end do - else if (spinup_state == 2 .and. restart_file_spinup_state <= 1 )then - if (spinup_state == 2 .and. restart_file_spinup_state <= 1 )then - if ( masterproc ) write(iulog,*) ' CNRest: taking Dead wood C pools into AD spinup mode' - enter_spinup = .true. - if ( masterproc ) write(iulog, *) 'Dividing stemc and crootc by 10 for enter spinup ' - do i = bounds%begp,bounds%endp - this%deadstemc_patch(i) = this%deadstemc_patch(i) / 10._r8 - this%deadcrootc_patch(i) = this%deadcrootc_patch(i) / 10._r8 - end do - end if - end if - end if - !-------------------------------- - ! C12 carbon state variables - !-------------------------------- - - if (carbon_type == 'c12') then - call restartvar(ncid=ncid, flag=flag, varname='totvegc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%totvegc_patch) - ! totvegc_col needed for resetting soil carbon stocks during AD spinup exit - call restartvar(ncid=ncid, flag=flag, varname='totvegc_col', xtype=ncd_double, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%totvegc_col) - end if - - !-------------------------------- - ! C13 carbon state variables - !-------------------------------- - - if ( carbon_type == 'c13') then - call restartvar(ncid=ncid, flag=flag, varname='totvegc_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%totvegc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing cnveg_carbonstate_inst%totvegc with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%totvegc_patch(i) = c12_cnveg_carbonstate_inst%totvegc_patch(i) * c3_r2 - else - this%totvegc_patch(i) = c12_cnveg_carbonstate_inst%totvegc_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='totvegc_col_13', xtype=ncd_double, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%totvegc_col) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing cnveg_carbonstate_inst%totvegc with atmospheric c13 value' - do i = bounds%begc,bounds%endc - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%totvegc_col(i) = c12_cnveg_carbonstate_inst%totvegc_col(i) * c3_r2 - else - this%totvegc_col(i) = c12_cnveg_carbonstate_inst%totvegc_col(i) * c4_r2 - endif - end do - end if - - end if - - !-------------------------------- - ! C14 patch carbon state variables - !-------------------------------- - - if ( carbon_type == 'c14') then - call restartvar(ncid=ncid, flag=flag, varname='totvegc_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%totvegc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%totvegc_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%totvegc_patch(i) /= spval .and. & - .not. isnan(this%totvegc_patch(i)) ) then - this%totvegc_patch(i) = c12_cnveg_carbonstate_inst%totvegc_patch(i) * c14ratio - endif - end do - endif - - call restartvar(ncid=ncid, flag=flag, varname='totvegc_col_14', xtype=ncd_double, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%totvegc_col) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing cnveg_carbonstate_inst%totvegc with atmospheric c14 value' - do i = bounds%begc,bounds%endc - if (this%totvegc_col(i) /= spval .and. & - .not. isnan(this%totvegc_col(i)) ) then - this%totvegc_col(i) = c12_cnveg_carbonstate_inst%totvegc_col(i) * c14ratio - endif - end do - end if - end if - - - if ( flag == 'read' .and. (enter_spinup .or. (reseed_dead_plants .and. .not. is_restart())) .and. .not. use_cndv) then - if ( masterproc ) write(iulog, *) 'Reseeding dead plants for CNVegCarbonState' - ! If a pft is dead (indicated by totvegc = 0) then we reseed that - ! pft according to the cold start protocol in the InitCold subroutine. - ! Thus, the variable totvegc is required to be read before here - ! so that if it is zero for a given pft, the pft can be reseeded. - do i = bounds%begp,bounds%endp - if (this%totvegc_patch(i) .le. 0.0_r8) then - !----------------------------------------------- - ! initialize patch-level carbon state variables - !----------------------------------------------- - - this%leafcmax_patch(i) = 0._r8 - - l = patch%landunit(i) - if (lun%itype(l) == istsoil )then - if ( present(num_reseed_patch) ) then - num_reseed_patch = num_reseed_patch + 1 - filter_reseed_patch(num_reseed_patch) = i - end if - - if (patch%itype(i) == noveg) then - this%leafc_patch(i) = 0._r8 - this%leafc_storage_patch(i) = 0._r8 - this%frootc_patch(i) = 0._r8 - this%frootc_storage_patch(i) = 0._r8 - else - if (pftcon%evergreen(patch%itype(i)) == 1._r8) then - this%leafc_patch(i) = cnvegcstate_const%initial_vegC * ratio - this%leafc_storage_patch(i) = 0._r8 - this%frootc_patch(i) = cnvegcstate_const%initial_vegC * ratio - this%frootc_storage_patch(i) = 0._r8 - else - this%leafc_patch(i) = 0._r8 - this%leafc_storage_patch(i) = cnvegcstate_const%initial_vegC * ratio - this%frootc_patch(i) = 0._r8 - this%frootc_storage_patch(i) = cnvegcstate_const%initial_vegC * ratio - end if - end if - this%leafc_xfer_patch(i) = 0._r8 - this%leafc_storage_xfer_acc_patch(i) = 0._r8 - this%storage_cdemand_patch(i) = 0._r8 - - if (MM_Nuptake_opt .eqv. .false.) then ! if not running in floating CN ratio option - this%frootc_patch(i) = 0._r8 - this%frootc_storage_patch(i) = 0._r8 - end if - this%frootc_xfer_patch(i) = 0._r8 - - this%livestemc_patch(i) = 0._r8 - this%livestemc_storage_patch(i) = 0._r8 - this%livestemc_xfer_patch(i) = 0._r8 - - if (pftcon%woody(patch%itype(i)) == 1._r8) then - this%deadstemc_patch(i) = 0.1_r8 * ratio - else - this%deadstemc_patch(i) = 0._r8 - end if - this%deadstemc_storage_patch(i) = 0._r8 - this%deadstemc_xfer_patch(i) = 0._r8 - - this%livecrootc_patch(i) = 0._r8 - this%livecrootc_storage_patch(i) = 0._r8 - this%livecrootc_xfer_patch(i) = 0._r8 - - this%deadcrootc_patch(i) = 0._r8 - this%deadcrootc_storage_patch(i) = 0._r8 - this%deadcrootc_xfer_patch(i) = 0._r8 - - this%gresp_storage_patch(i) = 0._r8 - this%gresp_xfer_patch(i) = 0._r8 - - this%cpool_patch(i) = 0._r8 - this%xsmrpool_patch(i) = 0._r8 - this%ctrunc_patch(i) = 0._r8 - this%dispvegc_patch(i) = 0._r8 - this%storvegc_patch(i) = 0._r8 - this%woodc_patch(i) = 0._r8 - this%totc_patch(i) = 0._r8 - - if ( use_crop )then - this%grainc_patch(i) = 0._r8 - this%grainc_storage_patch(i) = 0._r8 - this%grainc_xfer_patch(i) = 0._r8 - this%cropseedc_deficit_patch(i) = 0._r8 - end if - - ! calculate totvegc explicitly so that it is available for the isotope - ! code on the first time step. - - this%totvegc_patch(i) = & - this%leafc_patch(i) + & - this%leafc_storage_patch(i) + & - this%leafc_xfer_patch(i) + & - this%frootc_patch(i) + & - this%frootc_storage_patch(i) + & - this%frootc_xfer_patch(i) + & - this%livestemc_patch(i) + & - this%livestemc_storage_patch(i) + & - this%livestemc_xfer_patch(i) + & - this%deadstemc_patch(i) + & - this%deadstemc_storage_patch(i) + & - this%deadstemc_xfer_patch(i) + & - this%livecrootc_patch(i) + & - this%livecrootc_storage_patch(i) + & - this%livecrootc_xfer_patch(i) + & - this%deadcrootc_patch(i) + & - this%deadcrootc_storage_patch(i) + & - this%deadcrootc_xfer_patch(i) + & - this%gresp_storage_patch(i) + & - this%gresp_xfer_patch(i) + & - this%cpool_patch(i) - - if ( use_crop )then - this%totvegc_patch(i) = & - this%totvegc_patch(i) + & - this%grainc_patch(i) + & - this%grainc_storage_patch(i) + & - this%grainc_xfer_patch(i) - end if - - endif - end if - end do - if ( .not. is_restart() .and. get_nstep() == 1 ) then - - do p = bounds%begp,bounds%endp - if (this%leafc_patch(p) .lt. 0.01_r8) then - if (pftcon%c3psn(patch%itype(p)) == 1._r8) then - this%grainc_patch(p) = c12_cnveg_carbonstate_inst%grainc_patch(p) * c3_r2 - this%grainc_storage_patch(p) = c12_cnveg_carbonstate_inst%grainc_storage_patch(p) * c3_r2 - this%grainc_xfer_patch(p) = c12_cnveg_carbonstate_inst%grainc_xfer_patch(p) * c3_r2 - this%dispvegc_patch(p) = c12_cnveg_carbonstate_inst%dispvegc_patch(p) * c3_r2 - this%storvegc_patch(p) = c12_cnveg_carbonstate_inst%storvegc_patch(p) * c3_r2 - this%totvegc_patch(p) = c12_cnveg_carbonstate_inst%totvegc_patch(p) * c3_r2 - this%totc_patch(p) = c12_cnveg_carbonstate_inst%totc_patch(p) * c3_r2 - this%woodc_patch(p) = c12_cnveg_carbonstate_inst%woodc_patch(p) * c3_r2 - else - this%grainc_patch(p) = c12_cnveg_carbonstate_inst%grainc_patch(p) * c4_r2 - this%grainc_storage_patch(p) = c12_cnveg_carbonstate_inst%grainc_storage_patch(p) * c4_r2 - this%grainc_xfer_patch(p) = c12_cnveg_carbonstate_inst%grainc_xfer_patch(p) * c4_r2 - this%dispvegc_patch(p) = c12_cnveg_carbonstate_inst%dispvegc_patch(p) * c4_r2 - this%storvegc_patch(p) = c12_cnveg_carbonstate_inst%storvegc_patch(p) * c4_r2 - this%totvegc_patch(p) = c12_cnveg_carbonstate_inst%totvegc_patch(p) * c4_r2 - this%totc_patch(p) = c12_cnveg_carbonstate_inst%totc_patch(p) * c4_r2 - this%woodc_patch(p) = c12_cnveg_carbonstate_inst%woodc_patch(p) * c4_r2 - end if - end if - end do - end if - if ( present(num_reseed_patch) ) then - call shr_mpi_sum( num_reseed_patch, total_num_reseed_patch, mpicom ) - if ( masterproc ) write(iulog,*) 'Total num_reseed, over all tasks = ', total_num_reseed_patch - end if - end if - - end if - - !-------------------------------- - ! C13 patch carbon state variables - !-------------------------------- - - if ( carbon_type == 'c13') then - call restartvar(ncid=ncid, flag=flag, varname='leafc_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%leafc with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%leafc_patch(i) = c12_cnveg_carbonstate_inst%leafc_patch(i) * c3_r2 - else - this%leafc_patch(i) = c12_cnveg_carbonstate_inst%leafc_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='leafc_storage_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%leafc_storage with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%leafc_storage_patch(i) = c12_cnveg_carbonstate_inst%leafc_storage_patch(i) * c3_r2 - else - this%leafc_storage_patch(i) = c12_cnveg_carbonstate_inst%leafc_storage_patch(i) * c4_r2 - this%leafc_storage_patch(i) = c12_cnveg_carbonstate_inst%leafc_storage_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='leafc_xfer_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%leafc_xfer with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%leafc_xfer_patch(i) = c12_cnveg_carbonstate_inst%leafc_xfer_patch(i) * c3_r2 - else - this%leafc_xfer_patch(i) = c12_cnveg_carbonstate_inst%leafc_xfer_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='frootc_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%frootc with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%frootc_patch(i) = c12_cnveg_carbonstate_inst%frootc_patch(i) * c3_r2 - else - this%frootc_patch(i) = c12_cnveg_carbonstate_inst%frootc_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='frootc_storage_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%frootc_storage with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%frootc_storage_patch(i) = c12_cnveg_carbonstate_inst%frootc_storage_patch(i) * c3_r2 - else - this%frootc_storage_patch(i) = c12_cnveg_carbonstate_inst%frootc_storage_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='frootc_xfer_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%frootc_xfer with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%frootc_xfer_patch(i) = c12_cnveg_carbonstate_inst%frootc_xfer_patch(i) * c3_r2 - else - this%frootc_xfer_patch(i) = c12_cnveg_carbonstate_inst%frootc_xfer_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livestemc with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%livestemc_patch(i) = c12_cnveg_carbonstate_inst%livestemc_patch(i) * c3_r2 - else - this%livestemc_patch(i) = c12_cnveg_carbonstate_inst%livestemc_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_storage_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livestemc_storage with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%livestemc_storage_patch(i) = c12_cnveg_carbonstate_inst%livestemc_storage_patch(i) * c3_r2 - else - this%livestemc_storage_patch(i) = c12_cnveg_carbonstate_inst%livestemc_storage_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_xfer_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livestemc_xfer with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%livestemc_xfer_patch(i) = c12_cnveg_carbonstate_inst%livestemc_xfer_patch(i) * c3_r2 - else - this%livestemc_xfer_patch(i) = c12_cnveg_carbonstate_inst%livestemc_xfer_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadstemc_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadstemc with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%deadstemc_patch(i) = c12_cnveg_carbonstate_inst%deadstemc_patch(i) * c3_r2 - else - this%deadstemc_patch(i) = c12_cnveg_carbonstate_inst%deadstemc_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadstemc_storage_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadstemc_storage with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%deadstemc_storage_patch(i) = c12_cnveg_carbonstate_inst%deadstemc_storage_patch(i) * c3_r2 - else - this%deadstemc_storage_patch(i) = c12_cnveg_carbonstate_inst%deadstemc_storage_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadstemc_xfer_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadstemc_xfer with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%deadstemc_xfer_patch(i) = c12_cnveg_carbonstate_inst%deadstemc_xfer_patch(i) * c3_r2 - else - this%deadstemc_xfer_patch(i) = c12_cnveg_carbonstate_inst%deadstemc_xfer_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livecrootc_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livecrootc with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%livecrootc_patch(i) = c12_cnveg_carbonstate_inst%livecrootc_patch(i) * c3_r2 - else - this%livecrootc_patch(i) = c12_cnveg_carbonstate_inst%livecrootc_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livecrootc_storage_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livecrootc_storage with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%livecrootc_storage_patch(i) = c12_cnveg_carbonstate_inst%livecrootc_storage_patch(i) * c3_r2 - else - this%livecrootc_storage_patch(i) = c12_cnveg_carbonstate_inst%livecrootc_storage_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livecrootc_xfer_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livecrootc_xfer with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%livecrootc_xfer_patch(i) = c12_cnveg_carbonstate_inst%livecrootc_xfer_patch(i) * c3_r2 - else - this%livecrootc_xfer_patch(i) = c12_cnveg_carbonstate_inst%livecrootc_xfer_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootc_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadcrootc with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%deadcrootc_patch(i) = c12_cnveg_carbonstate_inst%deadcrootc_patch(i) * c3_r2 - else - this%deadcrootc_patch(i) = c12_cnveg_carbonstate_inst%deadcrootc_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootc_storage_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadcrootc_storage with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%deadcrootc_storage_patch(i) = c12_cnveg_carbonstate_inst%deadcrootc_storage_patch(i) * c3_r2 - else - this%deadcrootc_storage_patch(i) = c12_cnveg_carbonstate_inst%deadcrootc_storage_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootc_xfer_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadcrootc_xfer with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%deadcrootc_xfer_patch(i) = c12_cnveg_carbonstate_inst%deadcrootc_xfer_patch(i) * c3_r2 - else - this%deadcrootc_xfer_patch(i) = c12_cnveg_carbonstate_inst%deadcrootc_xfer_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='gresp_storage_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%gresp_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%gresp_storage with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%gresp_storage_patch(i) = c12_cnveg_carbonstate_inst%gresp_storage_patch(i) * c3_r2 - else - this%gresp_storage_patch(i) = c12_cnveg_carbonstate_inst%gresp_storage_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='gresp_xfer_13', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%gresp_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%gresp_xfer with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%gresp_xfer_patch(i) = c12_cnveg_carbonstate_inst%gresp_xfer_patch(i) * c3_r2 - else - this%gresp_xfer_patch(i) = c12_cnveg_carbonstate_inst%gresp_xfer_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='cpool_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%cpool_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%cpool with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%cpool_patch(i) = c12_cnveg_carbonstate_inst%cpool_patch(i) * c3_r2 - else - this%cpool_patch(i) = c12_cnveg_carbonstate_inst%cpool_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='xsmrpool_13', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%xsmrpool_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%xsmrpool with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%xsmrpool_patch(i) = c12_cnveg_carbonstate_inst%xsmrpool_patch(i) * c3_r2 - else - this%xsmrpool_patch(i) = c12_cnveg_carbonstate_inst%xsmrpool_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='pft_ctrunc_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%ctrunc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%ctrunc with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%ctrunc_patch(i) = c12_cnveg_carbonstate_inst%ctrunc_patch(i) * c3_r2 - else - this%ctrunc_patch(i) = c12_cnveg_carbonstate_inst%ctrunc_patch(i) * c4_r2 - endif - end do - end if - - end if - - !-------------------------------- - ! C14 patch carbon state variables - !-------------------------------- - - if ( carbon_type == 'c14') then - call restartvar(ncid=ncid, flag=flag, varname='leafc_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%leafc_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%leafc_patch(i) /= spval .and. & - .not. isnan(this%leafc_patch(i)) ) then - this%leafc_patch(i) = c12_cnveg_carbonstate_inst%leafc_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='leafc_storage_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%leafc_storage_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%leafc_storage_patch(i) /= spval .and. & - .not. isnan(this%leafc_storage_patch(i)) ) then - this%leafc_storage_patch(i) = c12_cnveg_carbonstate_inst%leafc_storage_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='leafc_xfer_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%leafc_xfer_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%leafc_xfer_patch(i) /= spval .and. .not. isnan(this%leafc_xfer_patch(i)) ) then - this%leafc_xfer_patch(i) = c12_cnveg_carbonstate_inst%leafc_xfer_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='frootc_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%frootc_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%frootc_patch(i) /= spval .and. & - .not. isnan(this%frootc_patch(i)) ) then - this%frootc_patch(i) = c12_cnveg_carbonstate_inst%frootc_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='frootc_storage_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%frootc_storage_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%frootc_storage_patch(i) /= spval .and. & - .not. isnan(this%frootc_storage_patch(i)) ) then - this%frootc_storage_patch(i) = c12_cnveg_carbonstate_inst%frootc_storage_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='frootc_xfer_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%frootc_xfer_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%frootc_xfer_patch(i) /= spval .and. & - .not. isnan(this%frootc_xfer_patch(i)) ) then - this%frootc_xfer_patch(i) = c12_cnveg_carbonstate_inst%frootc_xfer_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livestemc_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%livestemc_patch(i) /= spval .and. .not. isnan(this%livestemc_patch(i)) ) then - this%livestemc_patch(i) = c12_cnveg_carbonstate_inst%livestemc_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_storage_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livestemc_storage_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%livestemc_storage_patch(i) /= spval .and. .not. isnan(this%livestemc_storage_patch(i)) ) then - this%livestemc_storage_patch(i) = c12_cnveg_carbonstate_inst%livestemc_storage_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_xfer_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livestemc_xfer_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%livestemc_xfer_patch(i) /= spval .and. .not. isnan(this%livestemc_xfer_patch(i)) ) then - this%livestemc_xfer_patch(i) = c12_cnveg_carbonstate_inst%livestemc_xfer_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadstemc_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadstemc_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%deadstemc_patch(i) /= spval .and. .not. isnan(this%deadstemc_patch(i)) ) then - this%deadstemc_patch(i) = c12_cnveg_carbonstate_inst%deadstemc_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadstemc_storage_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadstemc_storage_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%deadstemc_storage_patch(i) /= spval .and. .not. isnan(this%deadstemc_storage_patch(i)) ) then - this%deadstemc_storage_patch(i) = c12_cnveg_carbonstate_inst%deadstemc_storage_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadstemc_xfer_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadstemc_xfer_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%deadstemc_xfer_patch(i) /= spval .and. .not. isnan(this%deadstemc_xfer_patch(i)) ) then - this%deadstemc_xfer_patch(i) = c12_cnveg_carbonstate_inst%deadstemc_xfer_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livecrootc_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livecrootc_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%livecrootc_patch(i) /= spval .and. .not. isnan(this%livecrootc_patch(i)) ) then - this%livecrootc_patch(i) = c12_cnveg_carbonstate_inst%livecrootc_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livecrootc_storage_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livecrootc_storage_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%livecrootc_storage_patch(i) /= spval .and. .not. isnan(this%livecrootc_storage_patch(i)) ) then - this%livecrootc_storage_patch(i) = c12_cnveg_carbonstate_inst%livecrootc_storage_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livecrootc_xfer_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livecrootc_xfer_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%livecrootc_xfer_patch(i) /= spval .and. .not. isnan(this%livecrootc_xfer_patch(i)) ) then - this%livecrootc_xfer_patch(i) = c12_cnveg_carbonstate_inst%livecrootc_xfer_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootc_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadcrootc_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%deadcrootc_patch(i) /= spval .and. .not. isnan(this%deadcrootc_patch(i)) ) then - this%deadcrootc_patch(i) = c12_cnveg_carbonstate_inst%deadcrootc_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootc_storage_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadcrootc_storage_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%deadcrootc_storage_patch(i) /= spval .and. .not. isnan(this%deadcrootc_storage_patch(i)) ) then - this%deadcrootc_storage_patch(i) = c12_cnveg_carbonstate_inst%deadcrootc_storage_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootc_xfer_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadcrootc_xfer_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%deadcrootc_xfer_patch(i) /= spval .and. .not. isnan(this%deadcrootc_xfer_patch(i)) ) then - this%deadcrootc_xfer_patch(i) = c12_cnveg_carbonstate_inst%deadcrootc_xfer_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='gresp_storage_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%gresp_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%gresp_storage_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%gresp_storage_patch(i) /= spval .and. .not. isnan(this%gresp_storage_patch(i)) ) then - this%gresp_storage_patch(i) = c12_cnveg_carbonstate_inst%gresp_storage_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='gresp_xfer_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%gresp_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%gresp_xfer_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%gresp_xfer_patch(i) /= spval .and. .not. isnan(this%gresp_xfer_patch(i)) ) then - this%gresp_xfer_patch(i) = c12_cnveg_carbonstate_inst%gresp_xfer_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='cpool_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%cpool_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%cpool_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%cpool_patch(i) /= spval .and. .not. isnan(this%cpool_patch(i)) ) then - this%cpool_patch(i) = c12_cnveg_carbonstate_inst%cpool_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='xsmrpool_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%xsmrpool_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%xsmrpool_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%xsmrpool_patch(i) /= spval .and. .not. isnan(this%xsmrpool_patch(i)) ) then - this%xsmrpool_patch(i) = c12_cnveg_carbonstate_inst%xsmrpool_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='pft_ctrunc_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%ctrunc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%ctrunc_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%ctrunc_patch(i) /= spval .and. .not. isnan(this%ctrunc_patch(i)) ) then - this%ctrunc_patch(i) = c12_cnveg_carbonstate_inst%ctrunc_patch(i) * c14ratio - endif - end do - end if - - end if - - !-------------------------------- - ! patch prognostic crop variables - !-------------------------------- - - if (use_crop) then - if (carbon_type == 'c12') then - call restartvar(ncid=ncid, flag=flag, varname='grainc', xtype=ncd_double, & - dim1name='pft', long_name='grain C', units='gC/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='grainc_storage', xtype=ncd_double, & - dim1name='pft', long_name='grain C storage', units='gC/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='grainc_xfer', xtype=ncd_double, & - dim1name='pft', long_name='grain C transfer', units='gC/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='cropseedc_deficit', xtype=ncd_double, & - dim1name='pft', long_name='pool for seeding new crop growth', units='gC/m2', & - interpinic_flag='interp', readvar=readvar, data=this%cropseedc_deficit_patch) - end if - - if (carbon_type == 'c13') then - call restartvar(ncid=ncid, flag=flag, varname='grainc_13', xtype=ncd_double, & - dim1name='pft', long_name='c13 grain C', units='gC13/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_patch) - if (flag=='read' .and. .not. readvar) then - call set_missing_from_template( & - my_var = this%grainc_patch, & - template_var = c12_cnveg_carbonstate_inst%grainc_patch, & - multiplier = c3_r2) - end if - - call restartvar(ncid=ncid, flag=flag, varname='grainc_13_storage', xtype=ncd_double, & - dim1name='pft', long_name='c13 grain C storage', units='gC13/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_storage_patch) - if (flag=='read' .and. .not. readvar) then - call set_missing_from_template( & - my_var = this%grainc_storage_patch, & - template_var = c12_cnveg_carbonstate_inst%grainc_storage_patch, & - multiplier = c3_r2) - end if - - call restartvar(ncid=ncid, flag=flag, varname='grainc_13_xfer', xtype=ncd_double, & - dim1name='pft', long_name='c13 grain C transfer', units='gC13/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - call set_missing_from_template( & - my_var = this%grainc_xfer_patch, & - template_var = c12_cnveg_carbonstate_inst%grainc_xfer_patch, & - multiplier = c3_r2) - end if - - call restartvar(ncid=ncid, flag=flag, varname='cropseedc_13_deficit', xtype=ncd_double, & - dim1name='pft', long_name='pool for seeding new crop growth', units='gC13/m2', & - interpinic_flag='interp', readvar=readvar, data=this%cropseedc_deficit_patch) - if (flag=='read' .and. .not. readvar) then - call set_missing_from_template( & - my_var = this%cropseedc_deficit_patch, & - template_var = c12_cnveg_carbonstate_inst%cropseedc_deficit_patch, & - multiplier = c3_r2) - end if - end if - - if ( carbon_type == 'c14' ) then - - call restartvar(ncid=ncid, flag=flag, varname='grainc_14', xtype=ncd_double, & - dim1name='pft', long_name='c14 grain C', units='gC14/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_patch) - if (flag=='read' .and. .not. readvar) then - call set_missing_from_template( & - my_var = this%grainc_patch, & - template_var = c12_cnveg_carbonstate_inst%grainc_patch, & - multiplier = c3_r2) - end if - - call restartvar(ncid=ncid, flag=flag, varname='grainc_14_storage', xtype=ncd_double, & - dim1name='pft', long_name='c14 grain C storage', units='gC14/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_storage_patch) - if (flag=='read' .and. .not. readvar) then - call set_missing_from_template( & - my_var = this%grainc_storage_patch, & - template_var = c12_cnveg_carbonstate_inst%grainc_storage_patch, & - multiplier = c3_r2) - end if - - call restartvar(ncid=ncid, flag=flag, varname='grainc_14_xfer', xtype=ncd_double, & - dim1name='pft', long_name='c14 grain C transfer', units='gC14/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - call set_missing_from_template( & - my_var = this%grainc_xfer_patch, & - template_var = c12_cnveg_carbonstate_inst%grainc_xfer_patch, & - multiplier = c3_r2) - end if - - call restartvar(ncid=ncid, flag=flag, varname='cropseedc_14_deficit', xtype=ncd_double, & - dim1name='pft', long_name='pool for seeding new crop growth', units='gC14/m2', & - interpinic_flag='interp', readvar=readvar, data=this%cropseedc_deficit_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%cropseedc_deficit_patch with atmospheric c14 value' - call set_missing_from_template( & - my_var = this%cropseedc_deficit_patch, & - template_var = c12_cnveg_carbonstate_inst%cropseedc_deficit_patch, & - multiplier = c14ratio) - end if - end if - end if - - !-------------------------------- - ! gridcell carbon state variables - !-------------------------------- - - if (carbon_type == 'c12') then - ! BACKWARDS_COMPATIBILITY(wjs, 2017-01-12) Naming this with a _g suffix in order - ! to distinguish it from the old column-level seedc restart variable - call restartvar(ncid=ncid, flag=flag, varname='seedc_g', xtype=ncd_double, & - dim1name='gridcell', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%seedc_grc) - end if - - !-------------------------------- - ! C13 gridcell carbon state variables - !-------------------------------- - - if (carbon_type == 'c13') then - call restartvar(ncid=ncid, flag=flag, varname='seedc_13_g', xtype=ncd_double, & - dim1name='gridcell', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%seedc_grc) - if (flag=='read' .and. .not. readvar) then - call set_missing_from_template( & - my_var = this%seedc_grc, & - template_var = c12_cnveg_carbonstate_inst%seedc_grc, & - multiplier = c3_r2) - end if - end if - - !-------------------------------- - ! C14 column carbon state variables - !-------------------------------- - - if ( carbon_type == 'c14' ) then - call restartvar(ncid=ncid, flag=flag, varname='seedc_14_g', xtype=ncd_double, & - dim1name='gridcell', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%seedc_grc) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%seedc_grc with atmospheric c14 value' - call set_missing_from_template( & - my_var = this%seedc_grc, & - template_var = c12_cnveg_carbonstate_inst%seedc_grc, & - multiplier = c14ratio) - end if - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine SetValues ( this, & - num_patch, filter_patch, value_patch, & - num_column, filter_column, value_column) - ! - ! !DESCRIPTION: - ! Set carbon state variables - ! - ! !ARGUMENTS: - class (cnveg_carbonstate_type) :: this - integer , intent(in) :: num_patch - integer , intent(in) :: filter_patch(:) - real(r8), intent(in) :: value_patch - integer , intent(in) :: num_column - integer , intent(in) :: filter_column(:) - real(r8), intent(in) :: value_column - ! - ! !LOCAL VARIABLES: - integer :: fi,i,j,k,l ! loop index - !------------------------------------------------------------------------ - - do fi = 1,num_patch - i = filter_patch(fi) - this%leafc_patch(i) = value_patch - this%leafc_storage_patch(i) = value_patch - this%leafc_xfer_patch(i) = value_patch - this%leafc_storage_xfer_acc_patch(i) = value_patch - this%storage_cdemand_patch(i) = value_patch - this%frootc_patch(i) = value_patch - this%frootc_storage_patch(i) = value_patch - this%frootc_xfer_patch(i) = value_patch - this%livestemc_patch(i) = value_patch - this%livestemc_storage_patch(i) = value_patch - this%livestemc_xfer_patch(i) = value_patch - this%deadstemc_patch(i) = value_patch - this%deadstemc_storage_patch(i) = value_patch - this%deadstemc_xfer_patch(i) = value_patch - this%livecrootc_patch(i) = value_patch - this%livecrootc_storage_patch(i) = value_patch - this%livecrootc_xfer_patch(i) = value_patch - this%deadcrootc_patch(i) = value_patch - this%deadcrootc_storage_patch(i) = value_patch - this%deadcrootc_xfer_patch(i) = value_patch - this%gresp_storage_patch(i) = value_patch - this%gresp_xfer_patch(i) = value_patch - this%cpool_patch(i) = value_patch - this%xsmrpool_patch(i) = value_patch - this%ctrunc_patch(i) = value_patch - this%dispvegc_patch(i) = value_patch - this%storvegc_patch(i) = value_patch - this%woodc_patch(i) = value_patch - this%totvegc_patch(i) = value_patch - this%totc_patch(i) = value_patch - if ( use_crop ) then - this%grainc_patch(i) = value_patch - this%grainc_storage_patch(i) = value_patch - this%grainc_xfer_patch(i) = value_patch - this%cropseedc_deficit_patch(i) = value_patch - end if - end do - - do fi = 1,num_column - i = filter_column(fi) - this%rootc_col(i) = value_column - this%leafc_col(i) = value_column - this%deadstemc_col(i) = value_column - this%fuelc_col(i) = value_column - this%fuelc_crop_col(i) = value_column - this%totvegc_col(i) = value_column - this%totc_p2c_col(i) = value_column - this%totc_col(i) = value_column - this%totecosysc_col(i) = value_column - end do - - end subroutine SetValues - -end module CNVegCarbonStateType diff --git a/src/biogeochem/CNVegComputeSeedMod.F90 b/src/biogeochem/CNVegComputeSeedMod.F90 deleted file mode 100644 index 01cf471e20..0000000000 --- a/src/biogeochem/CNVegComputeSeedMod.F90 +++ /dev/null @@ -1,259 +0,0 @@ -module CNVegComputeSeedMod - - !----------------------------------------------------------------------- - ! Module to compute seed amounts for new patch areas - ! - ! !USES: -#include "shr_assert.h" - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use pftconMod , only : pftcon, noveg - use clm_varcon , only : c3_r2, c4_r2, c14ratio - use clm_varctl , only : iulog - use PatchType , only : patch - use abortutils , only : endrun - use CNSpeciesMod , only : CN_SPECIES_C12, CN_SPECIES_C13, CN_SPECIES_C14, CN_SPECIES_N - ! - ! !PUBLIC ROUTINES: - implicit none - private - - public :: ComputeSeedAmounts - - ! !PRIVATE ROUTINES: - - private :: SpeciesTypeMultiplier - private :: LeafProportions ! compute leaf proportions (leaf, storage and xfer) - - ! !PRIVATE DATA: - - integer, parameter :: COMPONENT_LEAF = 1 - integer, parameter :: COMPONENT_DEADWOOD = 2 - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - subroutine ComputeSeedAmounts(bounds, & - num_soilp_with_inactive, filter_soilp_with_inactive, & - species, & - leafc_seed, deadstemc_seed, & - leaf_patch, leaf_storage_patch, leaf_xfer_patch, & - compute_here_patch, ignore_current_state_patch, & - seed_leaf_patch, seed_leaf_storage_patch, seed_leaf_xfer_patch, & - seed_deadstem_patch) - ! - ! !DESCRIPTION: - ! Compute seed amounts for patches that increase in area, for various variables, for - ! the given species (c12, c13, c14 or n). - ! - ! The output variables are only set for patches inside the filter, where - ! compute_here_patch is true; for other patches, they remain at their original values. - ! - ! Note that, regardless of the species, leafc_seed and deadstemc_seed are specified - ! in terms of gC/m2; these amounts are converted to the amount of the given species - ! here. - ! - ! !USES: - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp_with_inactive ! number of points in filter - integer , intent(in) :: filter_soilp_with_inactive(:) ! soil patch filter that includes inactive points - integer , intent(in) :: species ! which C/N species we're operating on; should be one of the values in CNSpeciesMod - real(r8) , intent(in) :: leafc_seed ! seed amount for leaf C - real(r8) , intent(in) :: deadstemc_seed ! seed amount for deadstem C - real(r8) , intent(in) :: leaf_patch( bounds%begp: ) ! current leaf C or N content (g/m2) - real(r8) , intent(in) :: leaf_storage_patch( bounds%begp: ) ! current leaf C or N storage content (g/m2) - real(r8) , intent(in) :: leaf_xfer_patch( bounds%begp: ) ! current leaf C or N xfer content (g/m2) - - ! whether to compute outputs for each patch - logical, intent(in) :: compute_here_patch( bounds%begp: ) - - ! If ignore_current_state is true, then use default leaf proportions rather than - ! proportions based on current state. - logical, intent(in) :: ignore_current_state_patch( bounds%begp: ) - - real(r8), intent(inout) :: seed_leaf_patch( bounds%begp: ) ! seed amount for leaf itself for this species (g/m2) - real(r8), intent(inout) :: seed_leaf_storage_patch( bounds%begp: ) ! seed amount for leaf storage for this species (g/m2) - real(r8), intent(inout) :: seed_leaf_xfer_patch( bounds%begp: ) ! seed amount for leaf xfer for this species (g/m2) - real(r8), intent(inout) :: seed_deadstem_patch( bounds%begp: ) ! seed amount for deadstem for this species (g/m2) - ! - ! !LOCAL VARIABLES: - integer :: fp, p - integer :: begp, endp - real(r8) :: my_leaf_seed - real(r8) :: my_deadstem_seed - integer :: pft_type - real(r8) :: pleaf - real(r8) :: pstor - real(r8) :: pxfer - - character(len=*), parameter :: subname = 'ComputeSeedAmounts' - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - - SHR_ASSERT_ALL((ubound(leaf_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(leaf_storage_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(leaf_xfer_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(compute_here_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(ignore_current_state_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(seed_leaf_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(seed_leaf_storage_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(seed_leaf_xfer_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(seed_deadstem_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - - - do fp = 1, num_soilp_with_inactive - p = filter_soilp_with_inactive(fp) - - if (compute_here_patch(p)) then - - my_leaf_seed = 0._r8 - my_deadstem_seed = 0._r8 - - pft_type = patch%itype(p) - - call LeafProportions( & - ignore_current_state = ignore_current_state_patch(p), & - pft_type = pft_type, & - leaf = leaf_patch(p), & - leaf_storage = leaf_storage_patch(p), & - leaf_xfer = leaf_xfer_patch(p), & - pleaf = pleaf, & - pstorage = pstor, & - pxfer = pxfer) - - if (pft_type /= noveg) then - my_leaf_seed = leafc_seed * & - SpeciesTypeMultiplier(species, pft_type, COMPONENT_LEAF) - if (pftcon%woody(pft_type) == 1._r8) then - my_deadstem_seed = deadstemc_seed * & - SpeciesTypeMultiplier(species, pft_type, COMPONENT_DEADWOOD) - end if - end if - - seed_leaf_patch(p) = my_leaf_seed * pleaf - seed_leaf_storage_patch(p) = my_leaf_seed * pstor - seed_leaf_xfer_patch(p) = my_leaf_seed * pxfer - seed_deadstem_patch(p) = my_deadstem_seed - end if - - end do - - end subroutine ComputeSeedAmounts - - - !----------------------------------------------------------------------- - function SpeciesTypeMultiplier(species, pft_type, component) result(multiplier) - ! - ! !DESCRIPTION: - ! Returns a multiplier based on the species type. This multiplier is - ! meant to be applied to some state variable expressed in terms of g C, translating - ! this value into an appropriate value for c13, c14 or n. - ! - ! !USES: - ! - ! !ARGUMENTS: - real(r8) :: multiplier ! function result - integer, intent(in) :: species ! which C/N species we're operating on; should be one of the values in CNSpeciesMod - integer, intent(in) :: pft_type - integer, intent(in) :: component ! which plant component; should be one of the COMPONENT_* parameters defined in this module - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'SpeciesTypeMultiplier' - !----------------------------------------------------------------------- - - select case (species) - case (CN_SPECIES_C12) - multiplier = 1._r8 - - case (CN_SPECIES_C13) - if (pftcon%c3psn(pft_type) == 1._r8) then - multiplier = c3_r2 - else - multiplier = c4_r2 - end if - - case (CN_SPECIES_C14) - ! 14c state is initialized assuming initial "modern" 14C of 1.e-12 - multiplier = c14ratio - - case (CN_SPECIES_N) - select case (component) - case (COMPONENT_LEAF) - multiplier = 1._r8 / pftcon%leafcn(pft_type) - case (COMPONENT_DEADWOOD) - multiplier = 1._r8 / pftcon%deadwdcn(pft_type) - case default - write(iulog,*) subname//' ERROR: unknown component: ', component - call endrun(subname//': unknown component') - end select - - case default - write(iulog,*) subname//' ERROR: unknown species: ', species - call endrun(subname//': unknown species') - end select - - end function SpeciesTypeMultiplier - - - !----------------------------------------------------------------------- - subroutine LeafProportions(ignore_current_state, & - pft_type, & - leaf, leaf_storage, leaf_xfer, & - pleaf, pstorage, pxfer) - ! - ! !DESCRIPTION: - ! Compute leaf proportions (leaf, storage and xfer) - ! - ! If ignore_current_state is true, then use default proportions rather than - ! proportions based on current state. (Also use default proportions if total leaf mass - ! is 0 for this patch.) - ! - ! !USES: - ! - ! !ARGUMENTS: - logical, intent(in) :: ignore_current_state ! see comment above - integer , intent(in) :: pft_type - real(r8), intent(in) :: leaf ! g/m2 leaf C or N - real(r8), intent(in) :: leaf_storage ! g/m2 leaf C or N storage - real(r8), intent(in) :: leaf_xfer ! g/m2 leaf C or N transfer - - real(r8), intent(out) :: pleaf ! proportion in leaf itself - real(r8), intent(out) :: pstorage ! proportion in leaf storage - real(r8), intent(out) :: pxfer ! proportion in leaf xfer - ! - ! !LOCAL VARIABLES: - real(r8) :: tot_leaf - - character(len=*), parameter :: subname = 'LeafProportions' - !----------------------------------------------------------------------- - - tot_leaf = leaf + leaf_storage + leaf_xfer - pleaf = 0._r8 - pstorage = 0._r8 - pxfer = 0._r8 - - if (tot_leaf == 0._r8 .or. ignore_current_state) then - if (pftcon%evergreen(pft_type) == 1._r8) then - pleaf = 1._r8 - else - pstorage = 1._r8 - end if - else - pleaf = leaf/tot_leaf - pstorage = leaf_storage/tot_leaf - pxfer = leaf_xfer/tot_leaf - end if - - end subroutine LeafProportions - -end module CNVegComputeSeedMod diff --git a/src/biogeochem/CNVegNitrogenFluxType.F90 b/src/biogeochem/CNVegNitrogenFluxType.F90 deleted file mode 100644 index 65727f5c62..0000000000 --- a/src/biogeochem/CNVegNitrogenFluxType.F90 +++ /dev/null @@ -1,1737 +0,0 @@ -module CNVegNitrogenFluxType - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools - use clm_varpar , only : nlevdecomp_full, nlevdecomp - use clm_varcon , only : spval, ispval, dzsoi_decomp - use clm_varctl , only : use_nitrif_denitrif, use_vertsoilc, use_crop - use CNSharedParamsMod , only : use_fun - use decompMod , only : bounds_type - use abortutils , only : endrun - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - private - ! - type, public :: cnveg_nitrogenflux_type - - ! gap mortality fluxes - real(r8), pointer :: m_leafn_to_litter_patch (:) ! patch leaf N mortality (gN/m2/s) - real(r8), pointer :: m_frootn_to_litter_patch (:) ! patch fine root N mortality (gN/m2/s) - real(r8), pointer :: m_leafn_storage_to_litter_patch (:) ! patch leaf N storage mortality (gN/m2/s) - real(r8), pointer :: m_frootn_storage_to_litter_patch (:) ! patch fine root N storage mortality (gN/m2/s) - real(r8), pointer :: m_livestemn_storage_to_litter_patch (:) ! patch live stem N storage mortality (gN/m2/s) - real(r8), pointer :: m_deadstemn_storage_to_litter_patch (:) ! patch dead stem N storage mortality (gN/m2/s) - real(r8), pointer :: m_livecrootn_storage_to_litter_patch (:) ! patch live coarse root N storage mortality (gN/m2/s) - real(r8), pointer :: m_deadcrootn_storage_to_litter_patch (:) ! patch dead coarse root N storage mortality (gN/m2/s) - real(r8), pointer :: m_leafn_xfer_to_litter_patch (:) ! patch leaf N transfer mortality (gN/m2/s) - real(r8), pointer :: m_frootn_xfer_to_litter_patch (:) ! patch fine root N transfer mortality (gN/m2/s) - real(r8), pointer :: m_livestemn_xfer_to_litter_patch (:) ! patch live stem N transfer mortality (gN/m2/s) - real(r8), pointer :: m_deadstemn_xfer_to_litter_patch (:) ! patch dead stem N transfer mortality (gN/m2/s) - real(r8), pointer :: m_livecrootn_xfer_to_litter_patch (:) ! patch live coarse root N transfer mortality (gN/m2/s) - real(r8), pointer :: m_deadcrootn_xfer_to_litter_patch (:) ! patch dead coarse root N transfer mortality (gN/m2/s) - real(r8), pointer :: m_livestemn_to_litter_patch (:) ! patch live stem N mortality (gN/m2/s) - real(r8), pointer :: m_deadstemn_to_litter_patch (:) ! patch dead stem N mortality (gN/m2/s) - real(r8), pointer :: m_livecrootn_to_litter_patch (:) ! patch live coarse root N mortality (gN/m2/s) - real(r8), pointer :: m_deadcrootn_to_litter_patch (:) ! patch dead coarse root N mortality (gN/m2/s) - real(r8), pointer :: m_retransn_to_litter_patch (:) ! patch retranslocated N pool mortality (gN/m2/s) - - ! harvest fluxes - real(r8), pointer :: hrv_leafn_to_litter_patch (:) ! patch leaf N harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_frootn_to_litter_patch (:) ! patch fine root N harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_leafn_storage_to_litter_patch (:) ! patch leaf N storage harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_frootn_storage_to_litter_patch (:) ! patch fine root N storage harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_livestemn_storage_to_litter_patch (:) ! patch live stem N storage harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_deadstemn_storage_to_litter_patch (:) ! patch dead stem N storage harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_livecrootn_storage_to_litter_patch (:) ! patch live coarse root N storage harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_deadcrootn_storage_to_litter_patch (:) ! patch dead coarse root N storage harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_leafn_xfer_to_litter_patch (:) ! patch leaf N transfer harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_frootn_xfer_to_litter_patch (:) ! patch fine root N transfer harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_livestemn_xfer_to_litter_patch (:) ! patch live stem N transfer harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_deadstemn_xfer_to_litter_patch (:) ! patch dead stem N transfer harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_livecrootn_xfer_to_litter_patch (:) ! patch live coarse root N transfer harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_deadcrootn_xfer_to_litter_patch (:) ! patch dead coarse root N transfer harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_livestemn_to_litter_patch (:) ! patch live stem N harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_livecrootn_to_litter_patch (:) ! patch live coarse root N harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_deadcrootn_to_litter_patch (:) ! patch dead coarse root N harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_retransn_to_litter_patch (:) ! patch retranslocated N pool harvest mortality (gN/m2/s) - real(r8), pointer :: grainn_to_cropprodn_patch (:) ! patch grain N to crop product pool (gN/m2/s) - real(r8), pointer :: grainn_to_cropprodn_col (:) ! col grain N to crop product pool (gN/m2/s) - real(r8), pointer :: m_n_to_litr_met_fire_col (:,:) ! col N from leaf, froot, xfer and storage N to litter labile N by fire (gN/m3/s) - real(r8), pointer :: m_n_to_litr_cel_fire_col (:,:) ! col N from leaf, froot, xfer and storage N to litter cellulose N by fire (gN/m3/s) - real(r8), pointer :: m_n_to_litr_lig_fire_col (:,:) ! col N from leaf, froot, xfer and storage N to litter lignin N by fire (gN/m3/s) - real(r8), pointer :: harvest_n_to_litr_met_n_col (:,:) ! col N fluxes associated with harvest to litter metabolic pool (gN/m3/s) - real(r8), pointer :: harvest_n_to_litr_cel_n_col (:,:) ! col N fluxes associated with harvest to litter cellulose pool (gN/m3/s) - real(r8), pointer :: harvest_n_to_litr_lig_n_col (:,:) ! col N fluxes associated with harvest to litter lignin pool (gN/m3/s) - real(r8), pointer :: harvest_n_to_cwdn_col (:,:) ! col N fluxes associated with harvest to CWD pool (gN/m3/s) - - ! fire N fluxes - real(r8), pointer :: m_decomp_npools_to_fire_vr_col (:,:,:) ! col vertically-resolved decomposing N fire loss (gN/m3/s) - real(r8), pointer :: m_decomp_npools_to_fire_col (:,:) ! col vertically-integrated (diagnostic) decomposing N fire loss (gN/m2/s) - real(r8), pointer :: m_leafn_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from leafn - real(r8), pointer :: m_leafn_storage_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from leafn_storage - real(r8), pointer :: m_leafn_xfer_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from leafn_xfer - real(r8), pointer :: m_livestemn_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from livestemn - real(r8), pointer :: m_livestemn_storage_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from livestemn_storage - real(r8), pointer :: m_livestemn_xfer_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from livestemn_xfer - real(r8), pointer :: m_deadstemn_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from deadstemn - real(r8), pointer :: m_deadstemn_storage_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from deadstemn_storage - real(r8), pointer :: m_deadstemn_xfer_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from deadstemn_xfer - real(r8), pointer :: m_frootn_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from frootn - real(r8), pointer :: m_frootn_storage_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from frootn_storage - real(r8), pointer :: m_frootn_xfer_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from frootn_xfer - real(r8), pointer :: m_livecrootn_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from m_livecrootn_to_fire - real(r8), pointer :: m_livecrootn_storage_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from livecrootn_storage - real(r8), pointer :: m_livecrootn_xfer_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from livecrootn_xfer - real(r8), pointer :: m_deadcrootn_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from deadcrootn - real(r8), pointer :: m_deadcrootn_storage_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from deadcrootn_storage - real(r8), pointer :: m_deadcrootn_xfer_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from deadcrootn_xfer - real(r8), pointer :: m_retransn_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from retransn - real(r8), pointer :: m_leafn_to_litter_fire_patch (:) ! patch (gN/m2/s) from leafn to litter N due to fire - real(r8), pointer :: m_leafn_storage_to_litter_fire_patch (:) ! patch (gN/m2/s) from leafn_storage to litter N due to fire - real(r8), pointer :: m_leafn_xfer_to_litter_fire_patch (:) ! patch (gN/m2/s) from leafn_xfer to litter N due to fire - real(r8), pointer :: m_livestemn_to_litter_fire_patch (:) ! patch (gN/m2/s) from livestemn to litter N due to fire - real(r8), pointer :: m_livestemn_storage_to_litter_fire_patch (:) ! patch (gN/m2/s) from livestemn_storage to litter N due to fire - real(r8), pointer :: m_livestemn_xfer_to_litter_fire_patch (:) ! patch (gN/m2/s) from livestemn_xfer to litter N due to fire - real(r8), pointer :: m_livestemn_to_deadstemn_fire_patch (:) ! patch (gN/m2/s) from livestemn to deadstemn N due to fire - real(r8), pointer :: m_deadstemn_to_litter_fire_patch (:) ! patch (gN/m2/s) from deadstemn to litter N due to fire - real(r8), pointer :: m_deadstemn_storage_to_litter_fire_patch (:) ! patch (gN/m2/s) from deadstemn_storage to litter N due to fire - real(r8), pointer :: m_deadstemn_xfer_to_litter_fire_patch (:) ! patch (gN/m2/s) from deadstemn_xfer to litter N due to fire - real(r8), pointer :: m_frootn_to_litter_fire_patch (:) ! patch (gN/m2/s) from frootn to litter N due to fire - real(r8), pointer :: m_frootn_storage_to_litter_fire_patch (:) ! patch (gN/m2/s) from frootn_storage to litter N due to fire - real(r8), pointer :: m_frootn_xfer_to_litter_fire_patch (:) ! patch (gN/m2/s) from frootn_xfer to litter N due to fire - real(r8), pointer :: m_livecrootn_to_litter_fire_patch (:) ! patch (gN/m2/s) from livecrootn to litter N due to fire - real(r8), pointer :: m_livecrootn_storage_to_litter_fire_patch (:) ! patch (gN/m2/s) from livecrootn_storage to litter N due to fire - real(r8), pointer :: m_livecrootn_xfer_to_litter_fire_patch (:) ! patch (gN/m2/s) from livecrootn_xfer to litter N due to fire - real(r8), pointer :: m_livecrootn_to_deadcrootn_fire_patch (:) ! patch (gN/m2/s) from livecrootn_xfer to deadcrootn due to fire - real(r8), pointer :: m_deadcrootn_to_litter_fire_patch (:) ! patch (gN/m2/s) from deadcrootn to deadcrootn due to fire - real(r8), pointer :: m_deadcrootn_storage_to_litter_fire_patch (:) ! patch (gN/m2/s) from deadcrootn_storage to deadcrootn due to fire - real(r8), pointer :: m_deadcrootn_xfer_to_litter_fire_patch (:) ! patch (gN/m2/s) from deadcrootn_xfer to deadcrootn due to fire - real(r8), pointer :: m_retransn_to_litter_fire_patch (:) ! patch (gN/m2/s) from retransn to deadcrootn due to fire - real(r8), pointer :: fire_nloss_patch (:) ! patch total patch-level fire N loss (gN/m2/s) - real(r8), pointer :: fire_nloss_col (:) ! col total column-level fire N loss (gN/m2/s) - real(r8), pointer :: fire_nloss_p2c_col (:) ! col patch2col column-level fire N loss (gN/m2/s) (p2c) - real(r8), pointer :: fire_mortality_n_to_cwdn_col (:,:) ! col N fluxes associated with fire mortality to CWD pool (gN/m3/s) - - ! phenology fluxes from transfer pool - real(r8), pointer :: grainn_xfer_to_grainn_patch (:) ! patch grain N growth from storage for prognostic crop model (gN/m2/s) - real(r8), pointer :: leafn_xfer_to_leafn_patch (:) ! patch leaf N growth from storage (gN/m2/s) - real(r8), pointer :: frootn_xfer_to_frootn_patch (:) ! patch fine root N growth from storage (gN/m2/s) - real(r8), pointer :: livestemn_xfer_to_livestemn_patch (:) ! patch live stem N growth from storage (gN/m2/s) - real(r8), pointer :: deadstemn_xfer_to_deadstemn_patch (:) ! patch dead stem N growth from storage (gN/m2/s) - real(r8), pointer :: livecrootn_xfer_to_livecrootn_patch (:) ! patch live coarse root N growth from storage (gN/m2/s) - real(r8), pointer :: deadcrootn_xfer_to_deadcrootn_patch (:) ! patch dead coarse root N growth from storage (gN/m2/s) - - ! litterfall fluxes - real(r8), pointer :: livestemn_to_litter_patch (:) ! patch livestem N to litter (gN/m2/s) - real(r8), pointer :: grainn_to_food_patch (:) ! patch grain N to food for prognostic crop (gN/m2/s) - real(r8), pointer :: grainn_to_seed_patch (:) ! patch grain N to seed for prognostic crop (gN/m2/s) - real(r8), pointer :: leafn_to_litter_patch (:) ! patch leaf N litterfall (gN/m2/s) - real(r8), pointer :: leafn_to_retransn_patch (:) ! patch leaf N to retranslocated N pool (gN/m2/s) - real(r8), pointer :: frootn_to_retransn_patch (:) ! patch fine root N to retranslocated N pool (gN/m2/s) - real(r8), pointer :: frootn_to_litter_patch (:) ! patch fine root N litterfall (gN/m2/s) - - ! allocation fluxes - real(r8), pointer :: retransn_to_npool_patch (:) ! patch deployment of retranslocated N (gN/m2/s) - real(r8), pointer :: free_retransn_to_npool_patch (:) ! patch deployment of free retranslocated N (gN/m2/s) - real(r8), pointer :: sminn_to_npool_patch (:) ! patch deployment of soil mineral N uptake (gN/m2/s) - real(r8), pointer :: npool_to_grainn_patch (:) ! patch allocation to grain N for prognostic crop (gN/m2/s) - real(r8), pointer :: npool_to_grainn_storage_patch (:) ! patch allocation to grain N storage for prognostic crop (gN/m2/s) - real(r8), pointer :: npool_to_leafn_patch (:) ! patch allocation to leaf N (gN/m2/s) - real(r8), pointer :: npool_to_leafn_storage_patch (:) ! patch allocation to leaf N storage (gN/m2/s) - real(r8), pointer :: npool_to_frootn_patch (:) ! patch allocation to fine root N (gN/m2/s) - real(r8), pointer :: npool_to_frootn_storage_patch (:) ! patch allocation to fine root N storage (gN/m2/s) - real(r8), pointer :: npool_to_livestemn_patch (:) ! patch allocation to live stem N (gN/m2/s) - real(r8), pointer :: npool_to_livestemn_storage_patch (:) ! patch allocation to live stem N storage (gN/m2/s) - real(r8), pointer :: npool_to_deadstemn_patch (:) ! patch allocation to dead stem N (gN/m2/s) - real(r8), pointer :: npool_to_deadstemn_storage_patch (:) ! patch allocation to dead stem N storage (gN/m2/s) - real(r8), pointer :: npool_to_livecrootn_patch (:) ! patch allocation to live coarse root N (gN/m2/s) - real(r8), pointer :: npool_to_livecrootn_storage_patch (:) ! patch allocation to live coarse root N storage (gN/m2/s) - real(r8), pointer :: npool_to_deadcrootn_patch (:) ! patch allocation to dead coarse root N (gN/m2/s) - real(r8), pointer :: npool_to_deadcrootn_storage_patch (:) ! patch allocation to dead coarse root N storage (gN/m2/s) - - ! annual turnover of storage to transfer pools - real(r8), pointer :: grainn_storage_to_xfer_patch (:) ! patch grain N shift storage to transfer for prognostic crop (gN/m2/s) - real(r8), pointer :: leafn_storage_to_xfer_patch (:) ! patch leaf N shift storage to transfer (gN/m2/s) - real(r8), pointer :: frootn_storage_to_xfer_patch (:) ! patch fine root N shift storage to transfer (gN/m2/s) - real(r8), pointer :: livestemn_storage_to_xfer_patch (:) ! patch live stem N shift storage to transfer (gN/m2/s) - real(r8), pointer :: deadstemn_storage_to_xfer_patch (:) ! patch dead stem N shift storage to transfer (gN/m2/s) - real(r8), pointer :: livecrootn_storage_to_xfer_patch (:) ! patch live coarse root N shift storage to transfer (gN/m2/s) - real(r8), pointer :: deadcrootn_storage_to_xfer_patch (:) ! patch dead coarse root N shift storage to transfer (gN/m2/s) - real(r8), pointer :: fert_patch (:) ! patch applied fertilizer (gN/m2/s) - real(r8), pointer :: fert_counter_patch (:) ! patch >0 fertilize; <=0 not - real(r8), pointer :: soyfixn_patch (:) ! patch soybean fixed N (gN/m2/s) - - ! turnover of livewood to deadwood, with retranslocation - real(r8), pointer :: livestemn_to_deadstemn_patch (:) ! patch live stem N turnover (gN/m2/s) - real(r8), pointer :: livestemn_to_retransn_patch (:) ! patch live stem N to retranslocated N pool (gN/m2/s) - real(r8), pointer :: livecrootn_to_deadcrootn_patch (:) ! patch live coarse root N turnover (gN/m2/s) - real(r8), pointer :: livecrootn_to_retransn_patch (:) ! patch live coarse root N to retranslocated N pool (gN/m2/s) - - ! summary (diagnostic) flux variables, not involved in mass balance - real(r8), pointer :: ndeploy_patch (:) ! patch total N deployed to growth and storage (gN/m2/s) - real(r8), pointer :: wood_harvestn_patch (:) ! patch total N losses to wood product pools (gN/m2/s) - real(r8), pointer :: wood_harvestn_col (:) ! col total N losses to wood product pools (gN/m2/s) (p2c) - - ! phenology: litterfall and crop fluxes - real(r8), pointer :: phenology_n_to_litr_met_n_col (:,:) ! col N fluxes associated with phenology (litterfall and crop) to litter metabolic pool (gN/m3/s) - real(r8), pointer :: phenology_n_to_litr_cel_n_col (:,:) ! col N fluxes associated with phenology (litterfall and crop) to litter cellulose pool (gN/m3/s) - real(r8), pointer :: phenology_n_to_litr_lig_n_col (:,:) ! col N fluxes associated with phenology (litterfall and crop) to litter lignin pool (gN/m3/s) - - ! gap mortality fluxes - real(r8), pointer :: gap_mortality_n_to_litr_met_n_col (:,:) ! col N fluxes associated with gap mortality to litter metabolic pool (gN/m3/s) - real(r8), pointer :: gap_mortality_n_to_litr_cel_n_col (:,:) ! col N fluxes associated with gap mortality to litter cellulose pool (gN/m3/s) - real(r8), pointer :: gap_mortality_n_to_litr_lig_n_col (:,:) ! col N fluxes associated with gap mortality to litter lignin pool (gN/m3/s) - real(r8), pointer :: gap_mortality_n_to_cwdn_col (:,:) ! col N fluxes associated with gap mortality to CWD pool (gN/m3/s) - - ! dynamic landcover fluxes - real(r8), pointer :: dwt_seedn_to_leaf_patch (:) ! (gN/m2/s) seed source to patch-level; although this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_seedn_to_leaf_grc (:) ! (gN/m2/s) dwt_seedn_to_leaf_patch summed to the gridcell-level - real(r8), pointer :: dwt_seedn_to_deadstem_patch (:) ! (gN/m2/s) seed source to patch-level; although this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_seedn_to_deadstem_grc (:) ! (gN/m2/s) dwt_seedn_to_deadstem_patch summed to the gridcell-level - real(r8), pointer :: dwt_conv_nflux_patch (:) ! (gN/m2/s) conversion N flux (immediate loss to atm); although this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_conv_nflux_grc (:) ! (gN/m2/s) dwt_conv_nflux_patch summed to the gridcell-level - real(r8), pointer :: dwt_wood_productn_gain_patch (:) ! patch (gN/m2/s) addition to wood product pools from landcover change; even though this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_crop_productn_gain_patch (:) ! patch (gN/m2/s) addition to crop product pool from landcover change; even though this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_frootn_to_litr_met_n_col (:,:) ! col (gN/m3/s) fine root to litter due to landcover change - real(r8), pointer :: dwt_frootn_to_litr_cel_n_col (:,:) ! col (gN/m3/s) fine root to litter due to landcover change - real(r8), pointer :: dwt_frootn_to_litr_lig_n_col (:,:) ! col (gN/m3/s) fine root to litter due to landcover change - real(r8), pointer :: dwt_livecrootn_to_cwdn_col (:,:) ! col (gN/m3/s) live coarse root to CWD due to landcover change - real(r8), pointer :: dwt_deadcrootn_to_cwdn_col (:,:) ! col (gN/m3/s) dead coarse root to CWD due to landcover change - - ! crop fluxes - real(r8), pointer :: crop_seedn_to_leaf_patch (:) ! patch (gN/m2/s) seed source to leaf, for crops - - ! Misc - real(r8), pointer :: plant_ndemand_patch (:) ! N flux required to support initial GPP (gN/m2/s) - real(r8), pointer :: avail_retransn_patch (:) ! N flux available from retranslocation pool (gN/m2/s) - real(r8), pointer :: plant_nalloc_patch (:) ! total allocated N flux (gN/m2/s) - real(r8), pointer :: plant_ndemand_retrans_patch (:) ! The N demand pool generated for FUN2.0; mainly used for deciduous trees (gN/m2/s) - real(r8), pointer :: plant_ndemand_season_patch (:) ! The N demand pool for seasonal deciduous (gN/m2/s) - real(r8), pointer :: plant_ndemand_stress_patch (:) ! The N demand pool for stress deciduous (gN/m2/s) - real(r8), pointer :: Nactive_patch (:) ! N acquired by mycorrhizal uptake (gN/m2/s) - real(r8), pointer :: Nnonmyc_patch (:) ! N acquired by non-myc uptake (gN/m2/s) - real(r8), pointer :: Nam_patch (:) ! N acquired by AM plant (gN/m2/s) - real(r8), pointer :: Necm_patch (:) ! N acquired by ECM plant (gN/m2/s) - real(r8), pointer :: Nactive_no3_patch (:) ! N acquired by mycorrhizal uptake (gN/m2/s) - real(r8), pointer :: Nactive_nh4_patch (:) ! N acquired by mycorrhizal uptake (gN/m2/s) - real(r8), pointer :: Nnonmyc_no3_patch (:) ! N acquired by non-myc (gN/m2/s) - real(r8), pointer :: Nnonmyc_nh4_patch (:) ! N acquired by non-myc (gN/m2/s) - real(r8), pointer :: Nam_no3_patch (:) ! N acquired by AM plant (gN/m2/s) - real(r8), pointer :: Nam_nh4_patch (:) ! N acquired by AM plant (gN/m2/s) - real(r8), pointer :: Necm_no3_patch (:) ! N acquired by ECM plant (gN/m2/s) - real(r8), pointer :: Necm_nh4_patch (:) ! N acquired by ECM plant (gN/m2/s) - real(r8), pointer :: Nfix_patch (:) ! N acquired by Symbiotic BNF (gN/m2/s) - real(r8), pointer :: Npassive_patch (:) ! N acquired by passive uptake (gN/m2/s) - real(r8), pointer :: Nretrans_patch (:) ! N acquired by retranslocation (gN/m2/s) - real(r8), pointer :: Nretrans_org_patch (:) ! N acquired by retranslocation (gN/m2/s) - real(r8), pointer :: Nretrans_season_patch (:) ! N acquired by retranslocation (gN/m2/s) - real(r8), pointer :: Nretrans_stress_patch (:) ! N acquired by retranslocation (gN/m2/s) - real(r8), pointer :: Nuptake_patch (:) ! Total N uptake of FUN (gN/m2/s) - real(r8), pointer :: sminn_to_plant_fun_patch (:) ! Total soil N uptake of FUN (gN/m2/s) - real(r8), pointer :: sminn_to_plant_fun_vr_patch (:,:) ! Total layer soil N uptake of FUN (gN/m2/s) - real(r8), pointer :: sminn_to_plant_fun_no3_vr_patch (:,:) ! Total layer no3 uptake of FUN (gN/m2/s) - real(r8), pointer :: sminn_to_plant_fun_nh4_vr_patch (:,:) ! Total layer nh4 uptake of FUN (gN/m2/s) - real(r8), pointer :: cost_nfix_patch (:) ! Average cost of fixation (gN/m2/s) - real(r8), pointer :: cost_nactive_patch (:) ! Average cost of active uptake (gN/m2/s) - real(r8), pointer :: cost_nretrans_patch (:) ! Average cost of retranslocation (gN/m2/s) - real(r8), pointer :: nuptake_npp_fraction_patch (:) ! frac of npp spent on N acquisition (gN/m2/s) - - contains - - procedure , public :: Init - procedure , public :: Restart - procedure , public :: SetValues - procedure , private :: InitAllocate - procedure , private :: InitHistory - procedure , private :: InitCold - - end type cnveg_nitrogenflux_type - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(cnveg_nitrogenflux_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate (bounds) - call this%InitHistory (bounds) - call this%InitCold (bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize patch nitrogen flux - ! - ! !ARGUMENTS: - class (cnveg_nitrogenflux_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp,endp - integer :: begc,endc - integer :: begg,endg - !------------------------------------------------------------------------ - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - allocate(this%m_leafn_to_litter_patch (begp:endp)) ; this%m_leafn_to_litter_patch (:) = nan - allocate(this%m_frootn_to_litter_patch (begp:endp)) ; this%m_frootn_to_litter_patch (:) = nan - allocate(this%m_leafn_storage_to_litter_patch (begp:endp)) ; this%m_leafn_storage_to_litter_patch (:) = nan - allocate(this%m_frootn_storage_to_litter_patch (begp:endp)) ; this%m_frootn_storage_to_litter_patch (:) = nan - allocate(this%m_livestemn_storage_to_litter_patch (begp:endp)) ; this%m_livestemn_storage_to_litter_patch (:) = nan - allocate(this%m_deadstemn_storage_to_litter_patch (begp:endp)) ; this%m_deadstemn_storage_to_litter_patch (:) = nan - allocate(this%m_livecrootn_storage_to_litter_patch (begp:endp)) ; this%m_livecrootn_storage_to_litter_patch (:) = nan - allocate(this%m_deadcrootn_storage_to_litter_patch (begp:endp)) ; this%m_deadcrootn_storage_to_litter_patch (:) = nan - allocate(this%m_leafn_xfer_to_litter_patch (begp:endp)) ; this%m_leafn_xfer_to_litter_patch (:) = nan - allocate(this%m_frootn_xfer_to_litter_patch (begp:endp)) ; this%m_frootn_xfer_to_litter_patch (:) = nan - allocate(this%m_livestemn_xfer_to_litter_patch (begp:endp)) ; this%m_livestemn_xfer_to_litter_patch (:) = nan - allocate(this%m_deadstemn_xfer_to_litter_patch (begp:endp)) ; this%m_deadstemn_xfer_to_litter_patch (:) = nan - allocate(this%m_livecrootn_xfer_to_litter_patch (begp:endp)) ; this%m_livecrootn_xfer_to_litter_patch (:) = nan - allocate(this%m_deadcrootn_xfer_to_litter_patch (begp:endp)) ; this%m_deadcrootn_xfer_to_litter_patch (:) = nan - allocate(this%m_livestemn_to_litter_patch (begp:endp)) ; this%m_livestemn_to_litter_patch (:) = nan - allocate(this%m_deadstemn_to_litter_patch (begp:endp)) ; this%m_deadstemn_to_litter_patch (:) = nan - allocate(this%m_livecrootn_to_litter_patch (begp:endp)) ; this%m_livecrootn_to_litter_patch (:) = nan - allocate(this%m_deadcrootn_to_litter_patch (begp:endp)) ; this%m_deadcrootn_to_litter_patch (:) = nan - allocate(this%m_retransn_to_litter_patch (begp:endp)) ; this%m_retransn_to_litter_patch (:) = nan - allocate(this%hrv_leafn_to_litter_patch (begp:endp)) ; this%hrv_leafn_to_litter_patch (:) = nan - allocate(this%hrv_frootn_to_litter_patch (begp:endp)) ; this%hrv_frootn_to_litter_patch (:) = nan - allocate(this%hrv_leafn_storage_to_litter_patch (begp:endp)) ; this%hrv_leafn_storage_to_litter_patch (:) = nan - allocate(this%hrv_frootn_storage_to_litter_patch (begp:endp)) ; this%hrv_frootn_storage_to_litter_patch (:) = nan - allocate(this%hrv_livestemn_storage_to_litter_patch (begp:endp)) ; this%hrv_livestemn_storage_to_litter_patch (:) = nan - allocate(this%hrv_deadstemn_storage_to_litter_patch (begp:endp)) ; this%hrv_deadstemn_storage_to_litter_patch (:) = nan - allocate(this%hrv_livecrootn_storage_to_litter_patch (begp:endp)) ; this%hrv_livecrootn_storage_to_litter_patch (:) = nan - allocate(this%hrv_deadcrootn_storage_to_litter_patch (begp:endp)) ; this%hrv_deadcrootn_storage_to_litter_patch (:) = nan - allocate(this%hrv_leafn_xfer_to_litter_patch (begp:endp)) ; this%hrv_leafn_xfer_to_litter_patch (:) = nan - allocate(this%hrv_frootn_xfer_to_litter_patch (begp:endp)) ; this%hrv_frootn_xfer_to_litter_patch (:) = nan - allocate(this%hrv_livestemn_xfer_to_litter_patch (begp:endp)) ; this%hrv_livestemn_xfer_to_litter_patch (:) = nan - allocate(this%hrv_deadstemn_xfer_to_litter_patch (begp:endp)) ; this%hrv_deadstemn_xfer_to_litter_patch (:) = nan - allocate(this%hrv_livecrootn_xfer_to_litter_patch (begp:endp)) ; this%hrv_livecrootn_xfer_to_litter_patch (:) = nan - allocate(this%hrv_deadcrootn_xfer_to_litter_patch (begp:endp)) ; this%hrv_deadcrootn_xfer_to_litter_patch (:) = nan - allocate(this%hrv_livestemn_to_litter_patch (begp:endp)) ; this%hrv_livestemn_to_litter_patch (:) = nan - allocate(this%hrv_livecrootn_to_litter_patch (begp:endp)) ; this%hrv_livecrootn_to_litter_patch (:) = nan - allocate(this%hrv_deadcrootn_to_litter_patch (begp:endp)) ; this%hrv_deadcrootn_to_litter_patch (:) = nan - allocate(this%hrv_retransn_to_litter_patch (begp:endp)) ; this%hrv_retransn_to_litter_patch (:) = nan - - allocate(this%m_leafn_to_fire_patch (begp:endp)) ; this%m_leafn_to_fire_patch (:) = nan - allocate(this%m_leafn_storage_to_fire_patch (begp:endp)) ; this%m_leafn_storage_to_fire_patch (:) = nan - allocate(this%m_leafn_xfer_to_fire_patch (begp:endp)) ; this%m_leafn_xfer_to_fire_patch (:) = nan - allocate(this%m_livestemn_to_fire_patch (begp:endp)) ; this%m_livestemn_to_fire_patch (:) = nan - allocate(this%m_livestemn_storage_to_fire_patch (begp:endp)) ; this%m_livestemn_storage_to_fire_patch (:) = nan - allocate(this%m_livestemn_xfer_to_fire_patch (begp:endp)) ; this%m_livestemn_xfer_to_fire_patch (:) = nan - allocate(this%m_deadstemn_to_fire_patch (begp:endp)) ; this%m_deadstemn_to_fire_patch (:) = nan - allocate(this%m_deadstemn_storage_to_fire_patch (begp:endp)) ; this%m_deadstemn_storage_to_fire_patch (:) = nan - allocate(this%m_deadstemn_xfer_to_fire_patch (begp:endp)) ; this%m_deadstemn_xfer_to_fire_patch (:) = nan - allocate(this%m_frootn_to_fire_patch (begp:endp)) ; this%m_frootn_to_fire_patch (:) = nan - allocate(this%m_frootn_storage_to_fire_patch (begp:endp)) ; this%m_frootn_storage_to_fire_patch (:) = nan - allocate(this%m_frootn_xfer_to_fire_patch (begp:endp)) ; this%m_frootn_xfer_to_fire_patch (:) = nan - allocate(this%m_livecrootn_to_fire_patch (begp:endp)) ; - allocate(this%m_livecrootn_storage_to_fire_patch (begp:endp)) ; this%m_livecrootn_storage_to_fire_patch (:) = nan - allocate(this%m_livecrootn_xfer_to_fire_patch (begp:endp)) ; this%m_livecrootn_xfer_to_fire_patch (:) = nan - allocate(this%m_deadcrootn_to_fire_patch (begp:endp)) ; this%m_deadcrootn_to_fire_patch (:) = nan - allocate(this%m_deadcrootn_storage_to_fire_patch (begp:endp)) ; this%m_deadcrootn_storage_to_fire_patch (:) = nan - allocate(this%m_deadcrootn_xfer_to_fire_patch (begp:endp)) ; this%m_deadcrootn_xfer_to_fire_patch (:) = nan - allocate(this%m_retransn_to_fire_patch (begp:endp)) ; this%m_retransn_to_fire_patch (:) = nan - - allocate(this%m_leafn_to_litter_fire_patch (begp:endp)) ; this%m_leafn_to_litter_fire_patch (:) = nan - allocate(this%m_leafn_storage_to_litter_fire_patch (begp:endp)) ; this%m_leafn_storage_to_litter_fire_patch (:) = nan - allocate(this%m_leafn_xfer_to_litter_fire_patch (begp:endp)) ; this%m_leafn_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_livestemn_to_litter_fire_patch (begp:endp)) ; this%m_livestemn_to_litter_fire_patch (:) = nan - allocate(this%m_livestemn_storage_to_litter_fire_patch (begp:endp)) ; this%m_livestemn_storage_to_litter_fire_patch (:) = nan - allocate(this%m_livestemn_xfer_to_litter_fire_patch (begp:endp)) ; this%m_livestemn_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_livestemn_to_deadstemn_fire_patch (begp:endp)) ; this%m_livestemn_to_deadstemn_fire_patch (:) = nan - allocate(this%m_deadstemn_to_litter_fire_patch (begp:endp)) ; this%m_deadstemn_to_litter_fire_patch (:) = nan - allocate(this%m_deadstemn_storage_to_litter_fire_patch (begp:endp)) ; this%m_deadstemn_storage_to_litter_fire_patch (:) = nan - allocate(this%m_deadstemn_xfer_to_litter_fire_patch (begp:endp)) ; this%m_deadstemn_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_frootn_to_litter_fire_patch (begp:endp)) ; this%m_frootn_to_litter_fire_patch (:) = nan - allocate(this%m_frootn_storage_to_litter_fire_patch (begp:endp)) ; this%m_frootn_storage_to_litter_fire_patch (:) = nan - allocate(this%m_frootn_xfer_to_litter_fire_patch (begp:endp)) ; this%m_frootn_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_livecrootn_to_litter_fire_patch (begp:endp)) ; this%m_livecrootn_to_litter_fire_patch (:) = nan - allocate(this%m_livecrootn_storage_to_litter_fire_patch (begp:endp)) ; this%m_livecrootn_storage_to_litter_fire_patch (:) = nan - allocate(this%m_livecrootn_xfer_to_litter_fire_patch (begp:endp)) ; this%m_livecrootn_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_livecrootn_to_deadcrootn_fire_patch (begp:endp)) ; this%m_livecrootn_to_deadcrootn_fire_patch (:) = nan - allocate(this%m_deadcrootn_to_litter_fire_patch (begp:endp)) ; this%m_deadcrootn_to_litter_fire_patch (:) = nan - allocate(this%m_deadcrootn_storage_to_litter_fire_patch (begp:endp)) ; this%m_deadcrootn_storage_to_litter_fire_patch (:) = nan - allocate(this%m_deadcrootn_xfer_to_litter_fire_patch (begp:endp)) ; this%m_deadcrootn_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_retransn_to_litter_fire_patch (begp:endp)) ; this%m_retransn_to_litter_fire_patch (:) = nan - - allocate(this%leafn_xfer_to_leafn_patch (begp:endp)) ; this%leafn_xfer_to_leafn_patch (:) = nan - allocate(this%frootn_xfer_to_frootn_patch (begp:endp)) ; this%frootn_xfer_to_frootn_patch (:) = nan - allocate(this%livestemn_xfer_to_livestemn_patch (begp:endp)) ; this%livestemn_xfer_to_livestemn_patch (:) = nan - allocate(this%deadstemn_xfer_to_deadstemn_patch (begp:endp)) ; this%deadstemn_xfer_to_deadstemn_patch (:) = nan - allocate(this%livecrootn_xfer_to_livecrootn_patch (begp:endp)) ; this%livecrootn_xfer_to_livecrootn_patch (:) = nan - allocate(this%deadcrootn_xfer_to_deadcrootn_patch (begp:endp)) ; this%deadcrootn_xfer_to_deadcrootn_patch (:) = nan - allocate(this%leafn_to_litter_patch (begp:endp)) ; this%leafn_to_litter_patch (:) = nan - allocate(this%leafn_to_retransn_patch (begp:endp)) ; this%leafn_to_retransn_patch (:) = nan - allocate(this%frootn_to_retransn_patch (begp:endp)) ; this%frootn_to_retransn_patch (:) = nan - allocate(this%frootn_to_litter_patch (begp:endp)) ; this%frootn_to_litter_patch (:) = nan - allocate(this%retransn_to_npool_patch (begp:endp)) ; this%retransn_to_npool_patch (:) = nan - allocate(this%free_retransn_to_npool_patch (begp:endp)) ; this%free_retransn_to_npool_patch (:) = nan - allocate(this%sminn_to_npool_patch (begp:endp)) ; this%sminn_to_npool_patch (:) = nan - - allocate(this%npool_to_leafn_patch (begp:endp)) ; this%npool_to_leafn_patch (:) = nan - allocate(this%npool_to_leafn_storage_patch (begp:endp)) ; this%npool_to_leafn_storage_patch (:) = nan - allocate(this%npool_to_frootn_patch (begp:endp)) ; this%npool_to_frootn_patch (:) = nan - allocate(this%npool_to_frootn_storage_patch (begp:endp)) ; this%npool_to_frootn_storage_patch (:) = nan - allocate(this%npool_to_livestemn_patch (begp:endp)) ; this%npool_to_livestemn_patch (:) = nan - allocate(this%npool_to_livestemn_storage_patch (begp:endp)) ; this%npool_to_livestemn_storage_patch (:) = nan - allocate(this%npool_to_deadstemn_patch (begp:endp)) ; this%npool_to_deadstemn_patch (:) = nan - allocate(this%npool_to_deadstemn_storage_patch (begp:endp)) ; this%npool_to_deadstemn_storage_patch (:) = nan - allocate(this%npool_to_livecrootn_patch (begp:endp)) ; this%npool_to_livecrootn_patch (:) = nan - allocate(this%npool_to_livecrootn_storage_patch (begp:endp)) ; this%npool_to_livecrootn_storage_patch (:) = nan - allocate(this%npool_to_deadcrootn_patch (begp:endp)) ; this%npool_to_deadcrootn_patch (:) = nan - allocate(this%npool_to_deadcrootn_storage_patch (begp:endp)) ; this%npool_to_deadcrootn_storage_patch (:) = nan - allocate(this%leafn_storage_to_xfer_patch (begp:endp)) ; this%leafn_storage_to_xfer_patch (:) = nan - allocate(this%frootn_storage_to_xfer_patch (begp:endp)) ; this%frootn_storage_to_xfer_patch (:) = nan - allocate(this%livestemn_storage_to_xfer_patch (begp:endp)) ; this%livestemn_storage_to_xfer_patch (:) = nan - allocate(this%deadstemn_storage_to_xfer_patch (begp:endp)) ; this%deadstemn_storage_to_xfer_patch (:) = nan - allocate(this%livecrootn_storage_to_xfer_patch (begp:endp)) ; this%livecrootn_storage_to_xfer_patch (:) = nan - allocate(this%deadcrootn_storage_to_xfer_patch (begp:endp)) ; this%deadcrootn_storage_to_xfer_patch (:) = nan - allocate(this%livestemn_to_deadstemn_patch (begp:endp)) ; this%livestemn_to_deadstemn_patch (:) = nan - allocate(this%livestemn_to_retransn_patch (begp:endp)) ; this%livestemn_to_retransn_patch (:) = nan - allocate(this%livecrootn_to_deadcrootn_patch (begp:endp)) ; this%livecrootn_to_deadcrootn_patch (:) = nan - allocate(this%livecrootn_to_retransn_patch (begp:endp)) ; this%livecrootn_to_retransn_patch (:) = nan - allocate(this%ndeploy_patch (begp:endp)) ; this%ndeploy_patch (:) = nan - allocate(this%wood_harvestn_patch (begp:endp)) ; this%wood_harvestn_patch (:) = nan - allocate(this%fire_nloss_patch (begp:endp)) ; this%fire_nloss_patch (:) = nan - allocate(this%npool_to_grainn_patch (begp:endp)) ; this%npool_to_grainn_patch (:) = nan - allocate(this%npool_to_grainn_storage_patch (begp:endp)) ; this%npool_to_grainn_storage_patch (:) = nan - allocate(this%livestemn_to_litter_patch (begp:endp)) ; this%livestemn_to_litter_patch (:) = nan - allocate(this%grainn_to_food_patch (begp:endp)) ; this%grainn_to_food_patch (:) = nan - allocate(this%grainn_to_seed_patch (begp:endp)) ; this%grainn_to_seed_patch (:) = nan - allocate(this%grainn_xfer_to_grainn_patch (begp:endp)) ; this%grainn_xfer_to_grainn_patch (:) = nan - allocate(this%grainn_storage_to_xfer_patch (begp:endp)) ; this%grainn_storage_to_xfer_patch (:) = nan - allocate(this%fert_patch (begp:endp)) ; this%fert_patch (:) = nan - allocate(this%fert_counter_patch (begp:endp)) ; this%fert_counter_patch (:) = nan - allocate(this%soyfixn_patch (begp:endp)) ; this%soyfixn_patch (:) = nan - - allocate(this%grainn_to_cropprodn_patch (begp:endp)) ; this%grainn_to_cropprodn_patch (:) = nan - allocate(this%grainn_to_cropprodn_col (begc:endc)) ; this%grainn_to_cropprodn_col (:) = nan - - allocate(this%fire_nloss_col (begc:endc)) ; this%fire_nloss_col (:) = nan - allocate(this%fire_nloss_p2c_col (begc:endc)) ; this%fire_nloss_p2c_col (:) = nan - - allocate(this%m_n_to_litr_met_fire_col (begc:endc,1:nlevdecomp_full)) ; this%m_n_to_litr_met_fire_col (:,:) = nan - allocate(this%m_n_to_litr_cel_fire_col (begc:endc,1:nlevdecomp_full)) ; this%m_n_to_litr_cel_fire_col (:,:) = nan - allocate(this%m_n_to_litr_lig_fire_col (begc:endc,1:nlevdecomp_full)) ; this%m_n_to_litr_lig_fire_col (:,:) = nan - - allocate(this%dwt_seedn_to_leaf_patch (begp:endp)) ; this%dwt_seedn_to_leaf_patch (:) = nan - allocate(this%dwt_seedn_to_leaf_grc (begg:endg)) ; this%dwt_seedn_to_leaf_grc (:) = nan - allocate(this%dwt_seedn_to_deadstem_patch (begp:endp)) ; this%dwt_seedn_to_deadstem_patch (:) = nan - allocate(this%dwt_seedn_to_deadstem_grc (begg:endg)) ; this%dwt_seedn_to_deadstem_grc (:) = nan - allocate(this%dwt_conv_nflux_patch (begp:endp)) ; this%dwt_conv_nflux_patch (:) = nan - allocate(this%dwt_conv_nflux_grc (begg:endg)) ; this%dwt_conv_nflux_grc (:) = nan - allocate(this%dwt_wood_productn_gain_patch (begp:endp)) ; this%dwt_wood_productn_gain_patch (:) = nan - allocate(this%dwt_crop_productn_gain_patch (begp:endp)) ; this%dwt_crop_productn_gain_patch (:) = nan - allocate(this%wood_harvestn_col (begc:endc)) ; this%wood_harvestn_col (:) = nan - - allocate(this%dwt_frootn_to_litr_met_n_col (begc:endc,1:nlevdecomp_full)) ; this%dwt_frootn_to_litr_met_n_col (:,:) = nan - allocate(this%dwt_frootn_to_litr_cel_n_col (begc:endc,1:nlevdecomp_full)) ; this%dwt_frootn_to_litr_cel_n_col (:,:) = nan - allocate(this%dwt_frootn_to_litr_lig_n_col (begc:endc,1:nlevdecomp_full)) ; this%dwt_frootn_to_litr_lig_n_col (:,:) = nan - allocate(this%dwt_livecrootn_to_cwdn_col (begc:endc,1:nlevdecomp_full)) ; this%dwt_livecrootn_to_cwdn_col (:,:) = nan - allocate(this%dwt_deadcrootn_to_cwdn_col (begc:endc,1:nlevdecomp_full)) ; this%dwt_deadcrootn_to_cwdn_col (:,:) = nan - - allocate(this%crop_seedn_to_leaf_patch (begp:endp)) ; this%crop_seedn_to_leaf_patch (:) = nan - - allocate(this%m_decomp_npools_to_fire_vr_col (begc:endc,1:nlevdecomp_full,1:ndecomp_pools)) - allocate(this%m_decomp_npools_to_fire_col (begc:endc,1:ndecomp_pools )) - - this%m_decomp_npools_to_fire_vr_col (:,:,:) = nan - this%m_decomp_npools_to_fire_col (:,:) = nan - - allocate(this%phenology_n_to_litr_met_n_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%phenology_n_to_litr_cel_n_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%phenology_n_to_litr_lig_n_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%gap_mortality_n_to_litr_met_n_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%gap_mortality_n_to_litr_cel_n_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%gap_mortality_n_to_litr_lig_n_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%gap_mortality_n_to_cwdn_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%fire_mortality_n_to_cwdn_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%harvest_n_to_litr_met_n_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%harvest_n_to_litr_cel_n_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%harvest_n_to_litr_lig_n_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%harvest_n_to_cwdn_col (begc:endc, 1:nlevdecomp_full)) - - this%phenology_n_to_litr_met_n_col (:,:) = nan - this%phenology_n_to_litr_cel_n_col (:,:) = nan - this%phenology_n_to_litr_lig_n_col (:,:) = nan - this%gap_mortality_n_to_litr_met_n_col (:,:) = nan - this%gap_mortality_n_to_litr_cel_n_col (:,:) = nan - this%gap_mortality_n_to_litr_lig_n_col (:,:) = nan - this%gap_mortality_n_to_cwdn_col (:,:) = nan - this%fire_mortality_n_to_cwdn_col (:,:) = nan - this%harvest_n_to_litr_met_n_col (:,:) = nan - this%harvest_n_to_litr_cel_n_col (:,:) = nan - this%harvest_n_to_litr_lig_n_col (:,:) = nan - this%harvest_n_to_cwdn_col (:,:) = nan - - allocate(this%plant_ndemand_patch (begp:endp)) ; this%plant_ndemand_patch (:) = nan - allocate(this%avail_retransn_patch (begp:endp)) ; this%avail_retransn_patch (:) = nan - allocate(this%plant_nalloc_patch (begp:endp)) ; this%plant_nalloc_patch (:) = nan - - allocate(this%plant_ndemand_retrans_patch (begp:endp)) ; this%plant_ndemand_retrans_patch (:) = nan - allocate(this%plant_ndemand_season_patch (begp:endp)) ; this%plant_ndemand_season_patch (:) = nan - allocate(this%plant_ndemand_stress_patch (begp:endp)) ; this%plant_ndemand_stress_patch (:) = nan - allocate(this%Nactive_patch (begp:endp)) ; this%Nactive_patch (:) = nan - allocate(this%Nnonmyc_patch (begp:endp)) ; this%Nnonmyc_patch (:) = nan - allocate(this%Nam_patch (begp:endp)) ; this%Nam_patch (:) = nan - allocate(this%Necm_patch (begp:endp)) ; this%Necm_patch (:) = nan - allocate(this%Nactive_no3_patch (begp:endp)) ; this%Nactive_no3_patch (:) = nan - allocate(this%Nactive_nh4_patch (begp:endp)) ; this%Nactive_nh4_patch (:) = nan - allocate(this%Nnonmyc_no3_patch (begp:endp)) ; this%Nnonmyc_no3_patch (:) = nan - allocate(this%Nnonmyc_nh4_patch (begp:endp)) ; this%Nnonmyc_nh4_patch (:) = nan - allocate(this%Nam_no3_patch (begp:endp)) ; this%Nam_no3_patch (:) = nan - allocate(this%Nam_nh4_patch (begp:endp)) ; this%Nam_nh4_patch (:) = nan - allocate(this%Necm_no3_patch (begp:endp)) ; this%Necm_no3_patch (:) = nan - allocate(this%Necm_nh4_patch (begp:endp)) ; this%Necm_nh4_patch (:) = nan - allocate(this%Npassive_patch (begp:endp)) ; this%Npassive_patch (:) = nan - allocate(this%Nfix_patch (begp:endp)) ; this%Nfix_patch (:) = nan - allocate(this%Nretrans_patch (begp:endp)) ; this%Nretrans_patch (:) = nan - allocate(this%Nretrans_org_patch (begp:endp)) ; this%Nretrans_org_patch (:) = nan - allocate(this%Nretrans_season_patch (begp:endp)) ; this%Nretrans_season_patch (:) = nan - allocate(this%Nretrans_stress_patch (begp:endp)) ; this%Nretrans_stress_patch (:) = nan - allocate(this%Nuptake_patch (begp:endp)) ; this%Nuptake_patch (:) = nan - allocate(this%sminn_to_plant_fun_patch (begp:endp)) ; this%sminn_to_plant_fun_patch (:) = nan - allocate(this%sminn_to_plant_fun_vr_patch (begp:endp,1:nlevdecomp_full)) - this%sminn_to_plant_fun_vr_patch (:,:) = nan - allocate(this%sminn_to_plant_fun_no3_vr_patch (begp:endp,1:nlevdecomp_full)) - this%sminn_to_plant_fun_no3_vr_patch (:,:) = nan - allocate(this%sminn_to_plant_fun_nh4_vr_patch (begp:endp,1:nlevdecomp_full)) - this%sminn_to_plant_fun_nh4_vr_patch (:,:) = nan - allocate(this%cost_nfix_patch (begp:endp)) ; this%cost_nfix_patch (:) = nan - allocate(this%cost_nactive_patch (begp:endp)) ; this%cost_nactive_patch (:) = nan - allocate(this%cost_nretrans_patch (begp:endp)) ; this%cost_nretrans_patch (:) = nan - allocate(this%nuptake_npp_fraction_patch (begp:endp)) ; this%nuptake_npp_fraction_patch (:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : nlevsno, nlevgrnd - use histFileMod , only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp - ! - ! !ARGUMENTS: - class(cnveg_nitrogenflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: k,l - integer :: begp, endp - integer :: begc, endc - integer :: begg, endg - character(10) :: active - character(24) :: fieldname - character(100) :: longname - character(8) :: vr_suffix - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - ! add suffix if number of soil decomposition depths is greater than 1 - if (nlevdecomp > 1) then - vr_suffix = "_vr" - else - vr_suffix = "" - endif - - this%m_leafn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='leaf N mortality', & - ptr_patch=this%m_leafn_to_litter_patch, default='inactive') - - this%m_frootn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='fine root N mortality', & - ptr_patch=this%m_frootn_to_litter_patch, default='inactive') - - this%m_leafn_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFN_STORAGE_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='leaf N storage mortality', & - ptr_patch=this%m_leafn_storage_to_litter_patch, default='inactive') - - this%m_frootn_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTN_STORAGE_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='fine root N storage mortality', & - ptr_patch=this%m_frootn_storage_to_litter_patch, default='inactive') - - this%m_livestemn_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMN_STORAGE_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='live stem N storage mortality', & - ptr_patch=this%m_livestemn_storage_to_litter_patch, default='inactive') - - this%m_deadstemn_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMN_STORAGE_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N storage mortality', & - ptr_patch=this%m_deadstemn_storage_to_litter_patch, default='inactive') - - this%m_livecrootn_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTN_STORAGE_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N storage mortality', & - ptr_patch=this%m_livecrootn_storage_to_litter_patch, default='inactive') - - this%m_deadcrootn_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTN_STORAGE_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N storage mortality', & - ptr_patch=this%m_deadcrootn_storage_to_litter_patch, default='inactive') - - this%m_leafn_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFN_XFER_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='leaf N transfer mortality', & - ptr_patch=this%m_leafn_xfer_to_litter_patch, default='inactive') - - this%m_frootn_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTN_XFER_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='fine root N transfer mortality', & - ptr_patch=this%m_frootn_xfer_to_litter_patch, default='inactive') - - this%m_livestemn_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMN_XFER_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='live stem N transfer mortality', & - ptr_patch=this%m_livestemn_xfer_to_litter_patch, default='inactive') - - this%m_deadstemn_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMN_XFER_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N transfer mortality', & - ptr_patch=this%m_deadstemn_xfer_to_litter_patch, default='inactive') - - this%m_livecrootn_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTN_XFER_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N transfer mortality', & - ptr_patch=this%m_livecrootn_xfer_to_litter_patch, default='inactive') - - this%m_deadcrootn_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTN_XFER_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N transfer mortality', & - ptr_patch=this%m_deadcrootn_xfer_to_litter_patch, default='inactive') - - this%m_livestemn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='live stem N mortality', & - ptr_patch=this%m_livestemn_to_litter_patch, default='inactive') - - this%m_deadstemn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N mortality', & - ptr_patch=this%m_deadstemn_to_litter_patch, default='inactive') - - this%m_livecrootn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N mortality', & - ptr_patch=this%m_livecrootn_to_litter_patch, default='inactive') - - this%m_deadcrootn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N mortality', & - ptr_patch=this%m_deadcrootn_to_litter_patch, default='inactive') - - this%m_retransn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_RETRANSN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='retranslocated N pool mortality', & - ptr_patch=this%m_retransn_to_litter_patch, default='inactive') - - this%m_leafn_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='leaf N fire loss', & - ptr_patch=this%m_leafn_to_fire_patch, default='inactive') - - this%m_frootn_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='fine root N fire loss ', & - ptr_patch=this%m_frootn_to_fire_patch, default='inactive') - - this%m_leafn_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFN_STORAGE_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='leaf N storage fire loss', & - ptr_patch=this%m_leafn_storage_to_fire_patch, default='inactive') - - this%m_frootn_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTN_STORAGE_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='fine root N storage fire loss', & - ptr_patch=this%m_frootn_storage_to_fire_patch, default='inactive') - - this%m_livestemn_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMN_STORAGE_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live stem N storage fire loss', & - ptr_patch=this%m_livestemn_storage_to_fire_patch, default='inactive') - - this%m_deadstemn_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMN_STORAGE_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N storage fire loss', & - ptr_patch=this%m_deadstemn_storage_to_fire_patch, default='inactive') - - this%m_livecrootn_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTN_STORAGE_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N storage fire loss', & - ptr_patch=this%m_livecrootn_storage_to_fire_patch, default='inactive') - - this%m_deadcrootn_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTN_STORAGE_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N storage fire loss', & - ptr_patch=this%m_deadcrootn_storage_to_fire_patch, default='inactive') - - this%m_leafn_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFN_XFER_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='leaf N transfer fire loss', & - ptr_patch=this%m_leafn_xfer_to_fire_patch, default='inactive') - - this%m_frootn_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTN_XFER_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='fine root N transfer fire loss', & - ptr_patch=this%m_frootn_xfer_to_fire_patch, default='inactive') - - this%m_livestemn_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMN_XFER_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live stem N transfer fire loss', & - ptr_patch=this%m_livestemn_xfer_to_fire_patch, default='inactive') - - this%m_deadstemn_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMN_XFER_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N transfer fire loss', & - ptr_patch=this%m_deadstemn_xfer_to_fire_patch, default='inactive') - - this%m_livecrootn_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTN_XFER_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N transfer fire loss', & - ptr_patch=this%m_livecrootn_xfer_to_fire_patch, default='inactive') - - this%m_deadcrootn_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTN_XFER_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N transfer fire loss', & - ptr_patch=this%m_deadcrootn_xfer_to_fire_patch, default='inactive') - - this%m_livestemn_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live stem N fire loss', & - ptr_patch=this%m_livestemn_to_fire_patch, default='inactive') - - this%m_deadstemn_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N fire loss', & - ptr_patch=this%m_deadstemn_to_fire_patch, default='inactive') - - this%m_deadstemn_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMN_TO_LITTER_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N fire mortality to litter', & - ptr_patch=this%m_deadstemn_to_litter_fire_patch, default='inactive') - - this%m_livecrootn_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N fire loss', & - ptr_patch=this%m_livecrootn_to_fire_patch, default='inactive') - - this%m_deadcrootn_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N fire loss', & - ptr_patch=this%m_deadcrootn_to_fire_patch, default='inactive') - - this%m_deadcrootn_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTN_TO_LITTER_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N fire mortality to litter', & - ptr_patch=this%m_deadcrootn_to_litter_fire_patch, default='inactive') - - this%m_retransn_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_RETRANSN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='retranslocated N pool fire loss', & - ptr_patch=this%m_retransn_to_fire_patch, default='inactive') - - this%leafn_xfer_to_leafn_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFN_XFER_TO_LEAFN', units='gN/m^2/s', & - avgflag='A', long_name='leaf N growth from storage', & - ptr_patch=this%leafn_xfer_to_leafn_patch, default='inactive') - - this%frootn_xfer_to_frootn_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTN_XFER_TO_FROOTN', units='gN/m^2/s', & - avgflag='A', long_name='fine root N growth from storage', & - ptr_patch=this%frootn_xfer_to_frootn_patch, default='inactive') - - this%livestemn_xfer_to_livestemn_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMN_XFER_TO_LIVESTEMN', units='gN/m^2/s', & - avgflag='A', long_name='live stem N growth from storage', & - ptr_patch=this%livestemn_xfer_to_livestemn_patch, default='inactive') - - this%deadstemn_xfer_to_deadstemn_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMN_XFER_TO_DEADSTEMN', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N growth from storage', & - ptr_patch=this%deadstemn_xfer_to_deadstemn_patch, default='inactive') - - this%livecrootn_xfer_to_livecrootn_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTN_XFER_TO_LIVECROOTN', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N growth from storage', & - ptr_patch=this%livecrootn_xfer_to_livecrootn_patch, default='inactive') - - this%deadcrootn_xfer_to_deadcrootn_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTN_XFER_TO_DEADCROOTN', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N growth from storage', & - ptr_patch=this%deadcrootn_xfer_to_deadcrootn_patch, default='inactive') - - this%leafn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='leaf N litterfall', & - ptr_patch=this%leafn_to_litter_patch, default='inactive') - - this%leafn_to_retransn_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFN_TO_RETRANSN', units='gN/m^2/s', & - avgflag='A', long_name='leaf N to retranslocated N pool', & - ptr_patch=this%leafn_to_retransn_patch, default='inactive') - - this%frootn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='fine root N litterfall', & - ptr_patch=this%frootn_to_litter_patch, default='inactive') - - this%retransn_to_npool_patch(begp:endp) = spval - call hist_addfld1d (fname='RETRANSN_TO_NPOOL', units='gN/m^2/s', & - avgflag='A', long_name='deployment of retranslocated N', & - ptr_patch=this%retransn_to_npool_patch, default='inactive') - - this%free_retransn_to_npool_patch(begp:endp) = spval - call hist_addfld1d (fname='FREE_RETRANSN_TO_NPOOL', units='gN/m^2/s', & - avgflag='A', long_name='deployment of retranslocated N', & - ptr_patch=this%free_retransn_to_npool_patch, default='inactive') - - this%sminn_to_npool_patch(begp:endp) = spval - call hist_addfld1d (fname='SMINN_TO_NPOOL', units='gN/m^2/s', & - avgflag='A', long_name='deployment of soil mineral N uptake', & - ptr_patch=this%sminn_to_npool_patch, default='inactive') - - this%npool_to_leafn_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_LEAFN', units='gN/m^2/s', & - avgflag='A', long_name='allocation to leaf N', & - ptr_patch=this%npool_to_leafn_patch, default='inactive') - - this%npool_to_leafn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_LEAFN_STORAGE', units='gN/m^2/s', & - avgflag='A', long_name='allocation to leaf N storage', & - ptr_patch=this%npool_to_leafn_storage_patch, default='inactive') - - this%npool_to_frootn_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_FROOTN', units='gN/m^2/s', & - avgflag='A', long_name='allocation to fine root N', & - ptr_patch=this%npool_to_frootn_patch, default='inactive') - - this%npool_to_frootn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_FROOTN_STORAGE', units='gN/m^2/s', & - avgflag='A', long_name='allocation to fine root N storage', & - ptr_patch=this%npool_to_frootn_storage_patch, default='inactive') - - this%npool_to_livestemn_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_LIVESTEMN', units='gN/m^2/s', & - avgflag='A', long_name='allocation to live stem N', & - ptr_patch=this%npool_to_livestemn_patch, default='inactive') - - this%npool_to_livestemn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_LIVESTEMN_STORAGE', units='gN/m^2/s', & - avgflag='A', long_name='allocation to live stem N storage', & - ptr_patch=this%npool_to_livestemn_storage_patch, default='inactive') - - this%npool_to_deadstemn_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_DEADSTEMN', units='gN/m^2/s', & - avgflag='A', long_name='allocation to dead stem N', & - ptr_patch=this%npool_to_deadstemn_patch, default='inactive') - - this%npool_to_deadstemn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_DEADSTEMN_STORAGE', units='gN/m^2/s', & - avgflag='A', long_name='allocation to dead stem N storage', & - ptr_patch=this%npool_to_deadstemn_storage_patch, default='inactive') - - this%npool_to_livecrootn_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_LIVECROOTN', units='gN/m^2/s', & - avgflag='A', long_name='allocation to live coarse root N', & - ptr_patch=this%npool_to_livecrootn_patch, default='inactive') - - this%npool_to_livecrootn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_LIVECROOTN_STORAGE', units='gN/m^2/s', & - avgflag='A', long_name='allocation to live coarse root N storage', & - ptr_patch=this%npool_to_livecrootn_storage_patch, default='inactive') - - this%npool_to_deadcrootn_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_DEADCROOTN', units='gN/m^2/s', & - avgflag='A', long_name='allocation to dead coarse root N', & - ptr_patch=this%npool_to_deadcrootn_patch, default='inactive') - - this%npool_to_deadcrootn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_DEADCROOTN_STORAGE', units='gN/m^2/s', & - avgflag='A', long_name='allocation to dead coarse root N storage', & - ptr_patch=this%npool_to_deadcrootn_storage_patch, default='inactive') - - this%leafn_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFN_STORAGE_TO_XFER', units='gN/m^2/s', & - avgflag='A', long_name='leaf N shift storage to transfer', & - ptr_patch=this%leafn_storage_to_xfer_patch, default='inactive') - - this%frootn_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTN_STORAGE_TO_XFER', units='gN/m^2/s', & - avgflag='A', long_name='fine root N shift storage to transfer', & - ptr_patch=this%frootn_storage_to_xfer_patch, default='inactive') - - this%livestemn_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMN_STORAGE_TO_XFER', units='gN/m^2/s', & - avgflag='A', long_name='live stem N shift storage to transfer', & - ptr_patch=this%livestemn_storage_to_xfer_patch, default='inactive') - - this%deadstemn_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMN_STORAGE_TO_XFER', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N shift storage to transfer', & - ptr_patch=this%deadstemn_storage_to_xfer_patch, default='inactive') - - this%livecrootn_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTN_STORAGE_TO_XFER', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N shift storage to transfer', & - ptr_patch=this%livecrootn_storage_to_xfer_patch, default='inactive') - - this%deadcrootn_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTN_STORAGE_TO_XFER', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N shift storage to transfer', & - ptr_patch=this%deadcrootn_storage_to_xfer_patch, default='inactive') - - this%livestemn_to_deadstemn_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMN_TO_DEADSTEMN', units='gN/m^2/s', & - avgflag='A', long_name='live stem N turnover', & - ptr_patch=this%livestemn_to_deadstemn_patch, default='inactive') - - this%livestemn_to_retransn_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMN_TO_RETRANSN', units='gN/m^2/s', & - avgflag='A', long_name='live stem N to retranslocated N pool', & - ptr_patch=this%livestemn_to_retransn_patch, default='inactive') - - this%livecrootn_to_deadcrootn_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTN_TO_DEADCROOTN', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N turnover', & - ptr_patch=this%livecrootn_to_deadcrootn_patch, default='inactive') - - this%livecrootn_to_retransn_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTN_TO_RETRANSN', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N to retranslocated N pool', & - ptr_patch=this%livecrootn_to_retransn_patch, default='inactive') - - this%ndeploy_patch(begp:endp) = spval - call hist_addfld1d (fname='NDEPLOY', units='gN/m^2/s', & - avgflag='A', long_name='total N deployed in new growth', & - ptr_patch=this%ndeploy_patch, default='inactive') - - this%wood_harvestn_patch(begp:endp) = spval - call hist_addfld1d (fname='WOOD_HARVESTN', units='gN/m^2/s', & - avgflag='A', long_name='wood harvest N (to product pools)', & - ptr_patch=this%wood_harvestn_patch, default='inactive') - - this%fire_nloss_patch(begp:endp) = spval - call hist_addfld1d (fname='PFT_FIRE_NLOSS', units='gN/m^2/s', & - avgflag='A', long_name='total patch-level fire N loss', & - ptr_patch=this%fire_nloss_patch, default='inactive') - - if (use_crop) then - this%fert_patch(begp:endp) = spval - call hist_addfld1d (fname='NFERTILIZATION', units='gN/m^2/s', & - avgflag='A', long_name='fertilizer added', & - ptr_patch=this%fert_patch, default='inactive') - end if - - if (use_crop) then - this%soyfixn_patch(begp:endp) = spval - call hist_addfld1d (fname='SOYFIXN', units='gN/m^2/s', & - avgflag='A', long_name='soybean fixation', & - ptr_patch=this%soyfixn_patch, default='inactive') - end if - - if (use_crop) then - this%fert_counter_patch(begp:endp) = spval - call hist_addfld1d (fname='FERT_COUNTER', units='seconds', & - avgflag='A', long_name='time left to fertilize', & - ptr_patch=this%fert_counter_patch, default='inactive') - end if - - !------------------------------- - ! N flux variables - native to column - !------------------------------- - - do k = 1, ndecomp_pools - if ( decomp_cascade_con%is_litter(k) .or. decomp_cascade_con%is_cwd(k) ) then - this%m_decomp_npools_to_fire_col(begc:endc,k) = spval - data1dptr => this%m_decomp_npools_to_fire_col(:,k) - fieldname = 'M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'N_TO_FIRE' - longname = trim(decomp_cascade_con%decomp_pool_name_long(k))//' N fire loss' - call hist_addfld1d (fname=fieldname, units='gN/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - - if ( nlevdecomp_full > 1 ) then - this%m_decomp_npools_to_fire_vr_col(begc:endc,:,k) = spval - data2dptr => this%m_decomp_npools_to_fire_vr_col(:,:,k) - fieldname = 'M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'N_TO_FIRE'//trim(vr_suffix) - longname = trim(decomp_cascade_con%decomp_pool_name_long(k))//' N fire loss' - call hist_addfld_decomp (fname=fieldname, units='gN/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - endif - end do - - this%fire_nloss_col(begc:endc) = spval - call hist_addfld1d (fname='COL_FIRE_NLOSS', units='gN/m^2/s', & - avgflag='A', long_name='total column-level fire N loss', & - ptr_col=this%fire_nloss_col, default='inactive') - - this%dwt_seedn_to_leaf_grc(begg:endg) = spval - call hist_addfld1d (fname='DWT_SEEDN_TO_LEAF', units='gN/m^2/s', & - avgflag='A', long_name='seed source to patch-level leaf', & - ptr_gcell=this%dwt_seedn_to_leaf_grc, default='inactive') - - this%dwt_seedn_to_leaf_patch(begp:endp) = spval - call hist_addfld1d (fname='DWT_SEEDN_TO_LEAF_PATCH', units='gN/m^2/s', & - avgflag='A', & - long_name='patch-level seed source to patch-level leaf ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_seedn_to_leaf_patch, default='inactive') - - this%dwt_seedn_to_deadstem_grc(begg:endg) = spval - call hist_addfld1d (fname='DWT_SEEDN_TO_DEADSTEM', units='gN/m^2/s', & - avgflag='A', long_name='seed source to patch-level deadstem', & - ptr_gcell=this%dwt_seedn_to_deadstem_grc, default='inactive') - - this%dwt_seedn_to_deadstem_patch(begp:endp) = spval - call hist_addfld1d (fname='DWT_SEEDN_TO_DEADSTEM_PATCH', units='gN/m^2/s', & - avgflag='A', & - long_name='patch-level seed source to patch-level deadstem ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_seedn_to_deadstem_patch, default='inactive') - - this%dwt_conv_nflux_grc(begg:endg) = spval - call hist_addfld1d (fname='DWT_CONV_NFLUX', units='gN/m^2/s', & - avgflag='A', & - long_name='conversion N flux (immediate loss to atm) (0 at all times except first timestep of year)', & - ptr_gcell=this%dwt_conv_nflux_grc, default='inactive') - - this%dwt_conv_nflux_patch(begp:endp) = spval - call hist_addfld1d (fname='DWT_CONV_NFLUX_PATCH', units='gN/m^2/s', & - avgflag='A', & - long_name='patch-level conversion N flux (immediate loss to atm) ' // & - '(0 at all times except first timestep of year) ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_conv_nflux_patch, default='inactive') - - this%dwt_frootn_to_litr_met_n_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_FROOTN_TO_LITR_MET_N', units='gN/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='fine root to litter due to landcover change', & - ptr_col=this%dwt_frootn_to_litr_met_n_col, default='inactive') - - this%dwt_frootn_to_litr_cel_n_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_FROOTN_TO_LITR_CEL_N', units='gN/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='fine root to litter due to landcover change', & - ptr_col=this%dwt_frootn_to_litr_cel_n_col, default='inactive') - - this%dwt_frootn_to_litr_lig_n_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_FROOTN_TO_LITR_LIG_N', units='gN/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='fine root to litter due to landcover change', & - ptr_col=this%dwt_frootn_to_litr_lig_n_col, default='inactive') - - this%dwt_livecrootn_to_cwdn_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_LIVECROOTN_TO_CWDN', units='gN/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='live coarse root to CWD due to landcover change', & - ptr_col=this%dwt_livecrootn_to_cwdn_col, default='inactive') - - this%dwt_deadcrootn_to_cwdn_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_DEADCROOTN_TO_CWDN', units='gN/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='dead coarse root to CWD due to landcover change', & - ptr_col=this%dwt_deadcrootn_to_cwdn_col, default='inactive') - - this%crop_seedn_to_leaf_patch(begp:endp) = spval - call hist_addfld1d (fname='CROP_SEEDN_TO_LEAF', units='gN/m^2/s', & - avgflag='A', long_name='crop seed source to leaf', & - ptr_patch=this%crop_seedn_to_leaf_patch, default='inactive') - - this%plant_ndemand_patch(begp:endp) = spval - call hist_addfld1d (fname='PLANT_NDEMAND', units='gN/m^2/s', & - avgflag='A', long_name='N flux required to support initial GPP', & - ptr_patch=this%plant_ndemand_patch, default='inactive') - - this%avail_retransn_patch(begp:endp) = spval - call hist_addfld1d (fname='AVAIL_RETRANSN', units='gN/m^2/s', & - avgflag='A', long_name='N flux available from retranslocation pool', & - ptr_patch=this%avail_retransn_patch, default='inactive') - - this%plant_nalloc_patch(begp:endp) = spval - call hist_addfld1d (fname='PLANT_NALLOC', units='gN/m^2/s', & - avgflag='A', long_name='total allocated N flux', & - ptr_patch=this%plant_nalloc_patch, default='inactive') - - if ( use_fun ) then - this%Nactive_patch(begp:endp) = spval - call hist_addfld1d (fname='NACTIVE', units='gN/m^2/s', & - avgflag='A', long_name='Mycorrhizal N uptake flux', & - ptr_patch=this%Nactive_patch, default='inactive') - - this%Nnonmyc_patch(begp:endp) = spval - call hist_addfld1d (fname='NNONMYC', units='gN/m^2/s', & - avgflag='A', long_name='Non-mycorrhizal N uptake flux', & - ptr_patch=this%Nnonmyc_patch, default='inactive') - - this%Nam_patch(begp:endp) = spval - call hist_addfld1d (fname='NAM', units='gN/m^2/s', & - avgflag='A', long_name='AM-associated N uptake flux', & - ptr_patch=this%Nam_patch, default='inactive') - - this%Necm_patch(begp:endp) = spval - call hist_addfld1d (fname='NECM', units='gN/m^2/s', & - avgflag='A', long_name='ECM-associated N uptake flux', & - ptr_patch=this%Necm_patch, default='inactive') - - if (use_nitrif_denitrif) then - this%Nactive_no3_patch(begp:endp) = spval - call hist_addfld1d (fname='NACTIVE_NO3', units='gN/m^2/s', & - avgflag='A', long_name='Mycorrhizal N uptake flux', & - ptr_patch=this%Nactive_no3_patch, default='inactive') - - this%Nactive_nh4_patch(begp:endp) = spval - call hist_addfld1d (fname='NACTIVE_NH4', units='gN/m^2/s', & - avgflag='A', long_name='Mycorrhizal N uptake flux', & - ptr_patch=this%Nactive_nh4_patch, default='inactive') - - this%Nnonmyc_no3_patch(begp:endp) = spval - call hist_addfld1d (fname='NNONMYC_NO3', units='gN/m^2/s', & - avgflag='A', long_name='Non-mycorrhizal N uptake flux', & - ptr_patch=this%Nnonmyc_no3_patch, default='inactive') - - this%Nnonmyc_nh4_patch(begp:endp) = spval - call hist_addfld1d (fname='NNONMYC_NH4', units='gN/m^2/s', & - avgflag='A', long_name='Non-mycorrhizal N uptake flux', & - ptr_patch=this%Nnonmyc_nh4_patch, default='inactive') - - this%Nam_no3_patch(begp:endp) = spval - call hist_addfld1d (fname='NAM_NO3', units='gN/m^2/s', & - avgflag='A', long_name='AM-associated N uptake flux', & - ptr_patch=this%Nam_no3_patch, default='inactive') - - this%Nam_nh4_patch(begp:endp) = spval - call hist_addfld1d (fname='NAM_NH4', units='gN/m^2/s', & - avgflag='A', long_name='AM-associated N uptake flux', & - ptr_patch=this%Nam_nh4_patch, default='inactive') - - this%Necm_no3_patch(begp:endp) = spval - call hist_addfld1d (fname='NECM_NO3', units='gN/m^2/s', & - avgflag='A', long_name='ECM-associated N uptake flux', & - ptr_patch=this%Necm_no3_patch, default='inactive') - - this%Necm_nh4_patch(begp:endp) = spval - call hist_addfld1d (fname='NECM_NH4', units='gN/m^2/s', & - avgflag='A', long_name='ECM-associated N uptake flux', & - ptr_patch=this%Necm_nh4_patch, default='inactive') - end if - - this%Npassive_patch(begp:endp) = spval - call hist_addfld1d (fname='NPASSIVE', units='gN/m^2/s', & - avgflag='A', long_name='Passive N uptake flux', & - ptr_patch=this%Npassive_patch, default='inactive') - - this%Nfix_patch(begp:endp) = spval - call hist_addfld1d (fname='NFIX', units='gN/m^2/s', & - avgflag='A', long_name='Symbiotic BNF uptake flux', & - ptr_patch=this%Nfix_patch, default='inactive') - - this%Nretrans_patch(begp:endp) = spval - call hist_addfld1d (fname='NRETRANS', units='gN/m^2/s', & - avgflag='A', long_name='Retranslocated N uptake flux', & - ptr_patch=this%Nretrans_patch, default='inactive') - - this%Nretrans_org_patch(begp:endp) = spval - call hist_addfld1d (fname='NRETRANS_REG', units='gN/m^2/s', & - avgflag='A', long_name='Retranslocated N uptake flux', & - ptr_patch=this%Nretrans_org_patch, default='inactive') - - this%Nretrans_season_patch(begp:endp) = spval - call hist_addfld1d (fname='NRETRANS_SEASON', units='gN/m^2/s', & - avgflag='A', long_name='Retranslocated N uptake flux', & - ptr_patch=this%Nretrans_season_patch, default='inactive') - - this%Nretrans_stress_patch(begp:endp) = spval - call hist_addfld1d (fname='NRETRANS_STRESS', units='gN/m^2/s', & - avgflag='A', long_name='Retranslocated N uptake flux', & - ptr_patch=this%Nretrans_stress_patch, default='inactive') - - this%Nuptake_patch(begp:endp) = spval - call hist_addfld1d (fname='NUPTAKE', units='gN/m^2/s', & - avgflag='A', long_name='Total N uptake of FUN', & - ptr_patch=this%Nuptake_patch, default='inactive') - - this%sminn_to_plant_fun_patch(begp:endp) = spval - call hist_addfld1d (fname='SMINN_TO_PLANT_FUN', units='gN/m^2/s',& - avgflag='A', long_name='Total soil N uptake of FUN', & - ptr_patch=this%sminn_to_plant_fun_patch, default='inactive') - - this%cost_nfix_patch(begp:endp) = spval - call hist_addfld1d (fname='COST_NFIX', units='gN/gC', & - avgflag='A', long_name='Cost of fixation', & - ptr_patch=this%cost_nfix_patch, default='inactive') - - this%cost_nactive_patch(begp:endp) = spval - call hist_addfld1d (fname='COST_NACTIVE', units='gN/gC', & - avgflag='A', long_name='Cost of active uptake', & - ptr_patch=this%cost_nactive_patch, default='inactive') - - this%cost_nretrans_patch(begp:endp) = spval - call hist_addfld1d (fname='COST_NRETRANS', units='gN/gC', & - avgflag='A', long_name='Cost of retranslocation', & - ptr_patch=this%cost_nretrans_patch, default='inactive') - - this%nuptake_npp_fraction_patch(begp:endp) = spval - call hist_addfld1d (fname='NUPTAKE_NPP_FRACTION', units='-', & - avgflag='A', long_name='frac of NPP used in N uptake', & - ptr_patch=this%nuptake_npp_fraction_patch, default='inactive') - - - end if - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !DESCRIPTION: - ! Initializes time varying variables used only in coupled carbon-nitrogen mode (CN): - ! - ! !USES: - use landunit_varcon , only : istsoil, istcrop - ! - ! !ARGUMENTS: - class(cnveg_nitrogenflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p,c,l,j - integer :: fp, fc ! filter indices - integer :: num_special_col ! number of good values in special_col filter - integer :: num_special_patch ! number of good values in special_patch filter - integer :: special_col(bounds%endc-bounds%begc+1) ! special landunit filter - columns - integer :: special_patch(bounds%endp-bounds%begp+1) ! special landunit filter - patches - !--------------------------------------------------------------------- - - ! Set column filters - - num_special_col = 0 - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - num_special_col = num_special_col + 1 - special_col(num_special_col) = c - end if - end do - - ! Set patch filters - - num_special_patch = 0 - do p = bounds%begp,bounds%endp - l = patch%landunit(p) - if (lun%ifspecial(l)) then - num_special_patch = num_special_patch + 1 - special_patch(num_special_patch) = p - end if - end do - - !----------------------------------------------- - ! initialize nitrogen flux variables - !----------------------------------------------- - - do p = bounds%begp,bounds%endp - l = patch%landunit(p) - - if ( use_crop )then - this%fert_counter_patch(p) = spval - this%fert_patch(p) = 0._r8 - this%soyfixn_patch(p) = 0._r8 - end if - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%fert_counter_patch(p) = 0._r8 - end if - if ( use_fun ) then - if (lun%ifspecial(l)) then - this%plant_ndemand_patch(p) = spval - this%avail_retransn_patch(p) = spval - this%plant_nalloc_patch(p) = spval - this%Npassive_patch(p) = spval - this%Nactive_patch(p) = spval - this%Nnonmyc_patch(p) = spval - this%Nam_patch(p) = spval - this%Necm_patch(p) = spval - if (use_nitrif_denitrif) then - this%Nactive_no3_patch(p) = spval - this%Nactive_nh4_patch(p) = spval - this%Nnonmyc_no3_patch(p) = spval - this%Nnonmyc_nh4_patch(p) = spval - this%Nam_no3_patch(p) = spval - this%Nam_nh4_patch(p) = spval - this%Necm_no3_patch(p) = spval - this%Necm_nh4_patch(p) = spval - end if - this%Nfix_patch(p) = spval - this%Nretrans_patch(p) = spval - this%Nretrans_org_patch(p) = spval - this%Nretrans_season_patch(p) = spval - this%Nretrans_stress_patch(p) = spval - this%Nuptake_patch(p) = spval - this%sminn_to_plant_fun_patch(p) = spval - this%cost_nfix_patch = spval - this%cost_nactive_patch = spval - this%cost_nretrans_patch = spval - this%nuptake_npp_fraction_patch = spval - - do j = 1, nlevdecomp - this%sminn_to_plant_fun_vr_patch(p,j) = spval - this%sminn_to_plant_fun_no3_vr_patch(p,j) = spval - this%sminn_to_plant_fun_nh4_vr_patch(p,j) = spval - end do - end if - end if - end do - - ! initialize fields for special filters - - call this%SetValues (& - num_patch=num_special_patch, filter_patch=special_patch, value_patch=0._r8, & - num_column=num_special_col, filter_column=special_col, value_column=0._r8) - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart (this, bounds, ncid, flag ) - ! - ! !DESCRIPTION: - ! Read/write CN restart data for carbon state - ! - ! !USES: - use restUtilMod - use ncdio_pio - ! - ! !ARGUMENTS: - class (cnveg_nitrogenflux_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag !'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - logical :: readvar ! determine if variable is on initial file - real(r8), pointer :: ptr2d(:,:) ! temp. pointers for slicing larger arrays - real(r8), pointer :: ptr1d(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='fert_counter', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fert_counter_patch) - - call restartvar(ncid=ncid, flag=flag, varname='fert', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fert_patch) - end if - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='grainn_xfer_to_grainn', xtype=ncd_double, & - dim1name='pft', & - long_name='grain N growth from storage', units='gN/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%grainn_xfer_to_grainn_patch) - end if - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='livestemn_to_litter', xtype=ncd_double, & - dim1name='pft', & - long_name='livestem N to litter', units='gN/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%livestemn_to_litter_patch) - end if - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='grainn_to_food', xtype=ncd_double, & - dim1name='pft', & - long_name='grain N to food', units='gN/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%grainn_to_food_patch) - end if - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='npool_to_grainn', xtype=ncd_double, & - dim1name='pft', & - long_name='allocation to grain N', units='gN/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%npool_to_grainn_patch) - end if - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='npool_to_grainn_storage', xtype=ncd_double, & - dim1name='pft', & - long_name='allocation to grain N storage', units='gN/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%npool_to_grainn_storage_patch) - end if - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='grainn_storage_to_xfer', xtype=ncd_double, & - dim1name='pft', & - long_name='grain N shift storage to transfer', units='gN/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%grainn_storage_to_xfer_patch) - end if - - call restartvar(ncid=ncid, flag=flag, varname='plant_ndemand', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%plant_ndemand_patch) - - call restartvar(ncid=ncid, flag=flag, varname='avail_retransn', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%avail_retransn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='plant_nalloc', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%plant_nalloc_patch) - - if ( use_fun ) then - call restartvar(ncid=ncid, flag=flag, varname='Nactive', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nactive_patch) -! - call restartvar(ncid=ncid, flag=flag, varname='Nnonmyc', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nnonmyc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='Nam', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nam_patch) - - call restartvar(ncid=ncid, flag=flag, varname='Necm', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Necm_patch) - - if (use_nitrif_denitrif) then - call restartvar(ncid=ncid, flag=flag, varname='Nactive_no3', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nactive_no3_patch) - - call restartvar(ncid=ncid, flag=flag, varname='Nactive_nh4', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nactive_nh4_patch) - - call restartvar(ncid=ncid, flag=flag, varname='Nnonmyc_no3', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nnonmyc_no3_patch) - - call restartvar(ncid=ncid, flag=flag, varname='Nnonmyc_nh4', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nnonmyc_nh4_patch) - - call restartvar(ncid=ncid, flag=flag, varname='Nam_no3', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nam_no3_patch) - - call restartvar(ncid=ncid, flag=flag, varname='Nam_nh4', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nam_nh4_patch) - - call restartvar(ncid=ncid, flag=flag, varname='Necm_no3', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Necm_no3_patch) - - call restartvar(ncid=ncid, flag=flag, varname='Necm_nh4', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Necm_nh4_patch) - end if -! - call restartvar(ncid=ncid, flag=flag, varname='Npassive', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Npassive_patch) - - call restartvar(ncid=ncid, flag=flag, varname='Nfix', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nfix_patch) - - call restartvar(ncid=ncid, flag=flag, varname='Nretrans', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nretrans_patch) - - call restartvar(ncid=ncid, flag=flag, varname='Nretrans_org', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nretrans_org_patch) - - call restartvar(ncid=ncid, flag=flag, varname='Nretrans_season', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nretrans_season_patch) - - call restartvar(ncid=ncid, flag=flag, varname='Nretrans_stress', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nretrans_stress_patch) - - call restartvar(ncid=ncid, flag=flag, varname='Nuptake', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nuptake_patch) - - call restartvar(ncid=ncid, flag=flag, varname='sminn_to_plant_fun', xtype=ncd_double, & - dim1name='pft', & - long_name='Total soil N uptake of FUN', units='gN/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%sminn_to_plant_fun_patch) - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine SetValues ( this, & - num_patch, filter_patch, value_patch, & - num_column, filter_column, value_column) - ! - ! !DESCRIPTION: - ! Set nitrogen flux variables - ! - ! !ARGUMENTS: - ! !ARGUMENTS: - class (cnveg_nitrogenflux_type) :: this - integer , intent(in) :: num_patch - integer , intent(in) :: filter_patch(:) - real(r8), intent(in) :: value_patch - integer , intent(in) :: num_column - integer , intent(in) :: filter_column(:) - real(r8), intent(in) :: value_column - ! - ! !LOCAL VARIABLES: - integer :: fi,i,j,k,l ! loop index - !------------------------------------------------------------------------ - - do fi = 1,num_patch - i=filter_patch(fi) - - this%m_leafn_to_litter_patch(i) = value_patch - this%m_frootn_to_litter_patch(i) = value_patch - this%m_leafn_storage_to_litter_patch(i) = value_patch - this%m_frootn_storage_to_litter_patch(i) = value_patch - this%m_livestemn_storage_to_litter_patch(i) = value_patch - this%m_deadstemn_storage_to_litter_patch(i) = value_patch - this%m_livecrootn_storage_to_litter_patch(i) = value_patch - this%m_deadcrootn_storage_to_litter_patch(i) = value_patch - this%m_leafn_xfer_to_litter_patch(i) = value_patch - this%m_frootn_xfer_to_litter_patch(i) = value_patch - this%m_livestemn_xfer_to_litter_patch(i) = value_patch - this%m_deadstemn_xfer_to_litter_patch(i) = value_patch - this%m_livecrootn_xfer_to_litter_patch(i) = value_patch - this%m_deadcrootn_xfer_to_litter_patch(i) = value_patch - this%m_livestemn_to_litter_patch(i) = value_patch - this%m_deadstemn_to_litter_patch(i) = value_patch - this%m_livecrootn_to_litter_patch(i) = value_patch - this%m_deadcrootn_to_litter_patch(i) = value_patch - this%m_retransn_to_litter_patch(i) = value_patch - this%hrv_leafn_to_litter_patch(i) = value_patch - this%hrv_frootn_to_litter_patch(i) = value_patch - this%hrv_leafn_storage_to_litter_patch(i) = value_patch - this%hrv_frootn_storage_to_litter_patch(i) = value_patch - this%hrv_livestemn_storage_to_litter_patch(i) = value_patch - this%hrv_deadstemn_storage_to_litter_patch(i) = value_patch - this%hrv_livecrootn_storage_to_litter_patch(i) = value_patch - this%hrv_deadcrootn_storage_to_litter_patch(i) = value_patch - this%hrv_leafn_xfer_to_litter_patch(i) = value_patch - this%hrv_frootn_xfer_to_litter_patch(i) = value_patch - this%hrv_livestemn_xfer_to_litter_patch(i) = value_patch - this%hrv_deadstemn_xfer_to_litter_patch(i) = value_patch - this%hrv_livecrootn_xfer_to_litter_patch(i) = value_patch - this%hrv_deadcrootn_xfer_to_litter_patch(i) = value_patch - this%hrv_livestemn_to_litter_patch(i) = value_patch - this%hrv_livecrootn_to_litter_patch(i) = value_patch - this%hrv_deadcrootn_to_litter_patch(i) = value_patch - this%hrv_retransn_to_litter_patch(i) = value_patch - - this%m_leafn_to_fire_patch(i) = value_patch - this%m_leafn_storage_to_fire_patch(i) = value_patch - this%m_leafn_xfer_to_fire_patch(i) = value_patch - this%m_livestemn_to_fire_patch(i) = value_patch - this%m_livestemn_storage_to_fire_patch(i) = value_patch - this%m_livestemn_xfer_to_fire_patch(i) = value_patch - this%m_deadstemn_to_fire_patch(i) = value_patch - this%m_deadstemn_storage_to_fire_patch(i) = value_patch - this%m_deadstemn_xfer_to_fire_patch(i) = value_patch - this%m_frootn_to_fire_patch(i) = value_patch - this%m_frootn_storage_to_fire_patch(i) = value_patch - this%m_frootn_xfer_to_fire_patch(i) = value_patch - this%m_livecrootn_to_fire_patch(i) = value_patch - this%m_livecrootn_storage_to_fire_patch(i) = value_patch - this%m_livecrootn_xfer_to_fire_patch(i) = value_patch - this%m_deadcrootn_to_fire_patch(i) = value_patch - this%m_deadcrootn_storage_to_fire_patch(i) = value_patch - this%m_deadcrootn_xfer_to_fire_patch(i) = value_patch - this%m_retransn_to_fire_patch(i) = value_patch - - - this%m_leafn_to_litter_fire_patch(i) = value_patch - this%m_leafn_storage_to_litter_fire_patch(i) = value_patch - this%m_leafn_xfer_to_litter_fire_patch(i) = value_patch - this%m_livestemn_to_litter_fire_patch(i) = value_patch - this%m_livestemn_storage_to_litter_fire_patch(i) = value_patch - this%m_livestemn_xfer_to_litter_fire_patch(i) = value_patch - this%m_livestemn_to_deadstemn_fire_patch(i) = value_patch - this%m_deadstemn_to_litter_fire_patch(i) = value_patch - this%m_deadstemn_storage_to_litter_fire_patch(i) = value_patch - this%m_deadstemn_xfer_to_litter_fire_patch(i) = value_patch - this%m_frootn_to_litter_fire_patch(i) = value_patch - this%m_frootn_storage_to_litter_fire_patch(i) = value_patch - this%m_frootn_xfer_to_litter_fire_patch(i) = value_patch - this%m_livecrootn_to_litter_fire_patch(i) = value_patch - this%m_livecrootn_storage_to_litter_fire_patch(i) = value_patch - this%m_livecrootn_xfer_to_litter_fire_patch(i) = value_patch - this%m_livecrootn_to_deadcrootn_fire_patch(i) = value_patch - this%m_deadcrootn_to_litter_fire_patch(i) = value_patch - this%m_deadcrootn_storage_to_litter_fire_patch(i) = value_patch - this%m_deadcrootn_xfer_to_litter_fire_patch(i) = value_patch - this%m_retransn_to_litter_fire_patch(i) = value_patch - - this%leafn_xfer_to_leafn_patch(i) = value_patch - this%frootn_xfer_to_frootn_patch(i) = value_patch - this%livestemn_xfer_to_livestemn_patch(i) = value_patch - this%deadstemn_xfer_to_deadstemn_patch(i) = value_patch - this%livecrootn_xfer_to_livecrootn_patch(i) = value_patch - this%deadcrootn_xfer_to_deadcrootn_patch(i) = value_patch - this%leafn_to_litter_patch(i) = value_patch - this%leafn_to_retransn_patch(i) = value_patch - this%frootn_to_litter_patch(i) = value_patch - this%retransn_to_npool_patch(i) = value_patch - this%free_retransn_to_npool_patch(i) = value_patch - this%sminn_to_npool_patch(i) = value_patch - this%npool_to_leafn_patch(i) = value_patch - this%npool_to_leafn_storage_patch(i) = value_patch - this%npool_to_frootn_patch(i) = value_patch - this%npool_to_frootn_storage_patch(i) = value_patch - this%npool_to_livestemn_patch(i) = value_patch - this%npool_to_livestemn_storage_patch(i) = value_patch - this%npool_to_deadstemn_patch(i) = value_patch - this%npool_to_deadstemn_storage_patch(i) = value_patch - this%npool_to_livecrootn_patch(i) = value_patch - this%npool_to_livecrootn_storage_patch(i) = value_patch - this%npool_to_deadcrootn_patch(i) = value_patch - this%npool_to_deadcrootn_storage_patch(i) = value_patch - this%leafn_storage_to_xfer_patch(i) = value_patch - this%frootn_storage_to_xfer_patch(i) = value_patch - this%livestemn_storage_to_xfer_patch(i) = value_patch - this%deadstemn_storage_to_xfer_patch(i) = value_patch - this%livecrootn_storage_to_xfer_patch(i) = value_patch - this%deadcrootn_storage_to_xfer_patch(i) = value_patch - this%livestemn_to_deadstemn_patch(i) = value_patch - this%livestemn_to_retransn_patch(i) = value_patch - this%livecrootn_to_deadcrootn_patch(i) = value_patch - this%livecrootn_to_retransn_patch(i) = value_patch - this%ndeploy_patch(i) = value_patch - this%wood_harvestn_patch(i) = value_patch - this%fire_nloss_patch(i) = value_patch - - this%crop_seedn_to_leaf_patch(i) = value_patch - this%grainn_to_cropprodn_patch(i) = value_patch - end do - - if ( use_crop )then - do fi = 1,num_patch - i = filter_patch(fi) - this%livestemn_to_litter_patch(i) = value_patch - this%grainn_to_food_patch(i) = value_patch - this%grainn_to_seed_patch(i) = value_patch - this%grainn_xfer_to_grainn_patch(i) = value_patch - this%npool_to_grainn_patch(i) = value_patch - this%npool_to_grainn_storage_patch(i) = value_patch - this%grainn_storage_to_xfer_patch(i) = value_patch - this%soyfixn_patch(i) = value_patch - this%frootn_to_retransn_patch(i) = value_patch - end do - end if - - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - - ! phenology: litterfall and crop fluxes associated wit - this%phenology_n_to_litr_met_n_col(i,j) = value_column - this%phenology_n_to_litr_cel_n_col(i,j) = value_column - this%phenology_n_to_litr_lig_n_col(i,j) = value_column - - ! gap mortality - this%gap_mortality_n_to_litr_met_n_col(i,j) = value_column - this%gap_mortality_n_to_litr_cel_n_col(i,j) = value_column - this%gap_mortality_n_to_litr_lig_n_col(i,j) = value_column - this%gap_mortality_n_to_cwdn_col(i,j) = value_column - - ! fire - this%fire_mortality_n_to_cwdn_col(i,j) = value_column - this%m_n_to_litr_met_fire_col(i,j) = value_column - this%m_n_to_litr_cel_fire_col(i,j) = value_column - this%m_n_to_litr_lig_fire_col(i,j) = value_column - - ! harvest - this%harvest_n_to_litr_met_n_col(i,j) = value_column - this%harvest_n_to_litr_cel_n_col(i,j) = value_column - this%harvest_n_to_litr_lig_n_col(i,j) = value_column - this%harvest_n_to_cwdn_col(i,j) = value_column - end do - end do - - do fi = 1,num_column - i = filter_column(fi) - - this%grainn_to_cropprodn_col(i) = value_column - this%fire_nloss_col(i) = value_column - - ! Zero p2c column fluxes - this%fire_nloss_col(i) = value_column - this%wood_harvestn_col(i) = value_column - end do - - do k = 1, ndecomp_pools - do fi = 1,num_column - i = filter_column(fi) - this%m_decomp_npools_to_fire_col(i,k) = value_column - end do - end do - - do k = 1, ndecomp_pools - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%m_decomp_npools_to_fire_vr_col(i,j,k) = value_column - end do - end do - end do - - end subroutine SetValues - -end module CNVegNitrogenFluxType - diff --git a/src/biogeochem/CNVegNitrogenStateType.F90 b/src/biogeochem/CNVegNitrogenStateType.F90 deleted file mode 100644 index 5910caadb5..0000000000 --- a/src/biogeochem/CNVegNitrogenStateType.F90 +++ /dev/null @@ -1,911 +0,0 @@ -module CNVegNitrogenStateType - -#include "shr_assert.h" - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : isnan => shr_infnan_isnan, nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools, nlevcan - use clm_varpar , only : nlevdecomp_full, nlevdecomp - use clm_varcon , only : spval, ispval, dzsoi_decomp, zisoi - use landunit_varcon , only : istcrop, istsoil - use clm_varctl , only : use_nitrif_denitrif, use_vertsoilc, use_century_decomp - use clm_varctl , only : iulog, override_bgc_restart_mismatch_dump - use clm_varctl , only : use_crop - use CNSharedParamsMod , only : use_fun - use decompMod , only : bounds_type - use pftconMod , only : npcropmin, noveg, pftcon - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use abortutils , only : endrun - use spmdMod , only : masterproc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use CNSpeciesMod , only : CN_SPECIES_N - use CNVegComputeSeedMod, only : ComputeSeedAmounts - ! - ! !PUBLIC TYPES: - implicit none - - private - - - ! - type, public :: cnveg_nitrogenstate_type - - real(r8), pointer :: grainn_patch (:) ! (gN/m2) grain N (crop) - real(r8), pointer :: grainn_storage_patch (:) ! (gN/m2) grain N storage (crop) - real(r8), pointer :: grainn_xfer_patch (:) ! (gN/m2) grain N transfer (crop) - real(r8), pointer :: leafn_patch (:) ! (gN/m2) leaf N - real(r8), pointer :: leafn_storage_patch (:) ! (gN/m2) leaf N storage - real(r8), pointer :: leafn_xfer_patch (:) ! (gN/m2) leaf N transfer - real(r8), pointer :: leafn_storage_xfer_acc_patch (:) ! (gN/m2) Accmulated leaf N transfer - real(r8), pointer :: storage_ndemand_patch (:) ! (gN/m2) N demand during the offset period - real(r8), pointer :: frootn_patch (:) ! (gN/m2) fine root N - real(r8), pointer :: frootn_storage_patch (:) ! (gN/m2) fine root N storage - real(r8), pointer :: frootn_xfer_patch (:) ! (gN/m2) fine root N transfer - real(r8), pointer :: livestemn_patch (:) ! (gN/m2) live stem N - real(r8), pointer :: livestemn_storage_patch (:) ! (gN/m2) live stem N storage - real(r8), pointer :: livestemn_xfer_patch (:) ! (gN/m2) live stem N transfer - real(r8), pointer :: deadstemn_patch (:) ! (gN/m2) dead stem N - real(r8), pointer :: deadstemn_storage_patch (:) ! (gN/m2) dead stem N storage - real(r8), pointer :: deadstemn_xfer_patch (:) ! (gN/m2) dead stem N transfer - real(r8), pointer :: livecrootn_patch (:) ! (gN/m2) live coarse root N - real(r8), pointer :: livecrootn_storage_patch (:) ! (gN/m2) live coarse root N storage - real(r8), pointer :: livecrootn_xfer_patch (:) ! (gN/m2) live coarse root N transfer - real(r8), pointer :: deadcrootn_patch (:) ! (gN/m2) dead coarse root N - real(r8), pointer :: deadcrootn_storage_patch (:) ! (gN/m2) dead coarse root N storage - real(r8), pointer :: deadcrootn_xfer_patch (:) ! (gN/m2) dead coarse root N transfer - real(r8), pointer :: retransn_patch (:) ! (gN/m2) plant pool of retranslocated N - real(r8), pointer :: npool_patch (:) ! (gN/m2) temporary plant N pool - real(r8), pointer :: ntrunc_patch (:) ! (gN/m2) patch-level sink for N truncation - real(r8), pointer :: cropseedn_deficit_patch (:) ! (gN/m2) pool for seeding new crop growth; this is a NEGATIVE term, indicating the amount of seed usage that needs to be repaid - real(r8), pointer :: seedn_grc (:) ! (gN/m2) gridcell-level pool for seeding new pFTs via dynamic landcover - - ! summary (diagnostic) state variables, not involved in mass balance - real(r8), pointer :: dispvegn_patch (:) ! (gN/m2) displayed veg nitrogen, excluding storage - real(r8), pointer :: storvegn_patch (:) ! (gN/m2) stored vegetation nitrogen - real(r8), pointer :: totvegn_patch (:) ! (gN/m2) total vegetation nitrogen - real(r8), pointer :: totvegn_col (:) ! (gN/m2) total vegetation nitrogen (p2c) - real(r8), pointer :: totn_patch (:) ! (gN/m2) total patch-level nitrogen - real(r8), pointer :: totn_p2c_col (:) ! (gN/m2) totn_patch averaged to col - real(r8), pointer :: totn_col (:) ! (gN/m2) total column nitrogen, incl veg - real(r8), pointer :: totecosysn_col (:) ! (gN/m2) total ecosystem nitrogen, incl veg - - contains - - procedure , public :: Init - procedure , public :: Restart - procedure , public :: SetValues - procedure , private :: InitAllocate - procedure , private :: InitHistory - procedure , private :: InitCold - - end type cnveg_nitrogenstate_type - !------------------------------------------------------------------------ - - ! !PRIVATE DATA: - character(len=*), parameter :: sourcefile = & - __FILE__ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, & - leafc_patch, leafc_storage_patch, frootc_patch, frootc_storage_patch, deadstemc_patch) - - class(cnveg_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: leafc_patch (bounds%begp:) - real(r8) , intent(in) :: leafc_storage_patch (bounds%begp:) - real(r8) , intent(in) :: frootc_patch (bounds%begp:) - real(r8) , intent(in) :: frootc_storage_patch (bounds%begp:) - real(r8) , intent(in) :: deadstemc_patch (bounds%begp:) - - call this%InitAllocate (bounds ) - call this%InitHistory (bounds) - call this%InitCold ( bounds, & - leafc_patch, leafc_storage_patch, frootc_patch, frootc_storage_patch, deadstemc_patch) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !ARGUMENTS: - class (cnveg_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp,endp - integer :: begc,endc - integer :: begg,endg - !------------------------------------------------------------------------ - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - allocate(this%grainn_patch (begp:endp)) ; this%grainn_patch (:) = nan - allocate(this%grainn_storage_patch (begp:endp)) ; this%grainn_storage_patch (:) = nan - allocate(this%grainn_xfer_patch (begp:endp)) ; this%grainn_xfer_patch (:) = nan - allocate(this%leafn_patch (begp:endp)) ; this%leafn_patch (:) = nan - allocate(this%leafn_storage_patch (begp:endp)) ; this%leafn_storage_patch (:) = nan - allocate(this%leafn_xfer_patch (begp:endp)) ; this%leafn_xfer_patch (:) = nan - allocate(this%leafn_storage_xfer_acc_patch (begp:endp)) ; this%leafn_storage_xfer_acc_patch (:) = nan - allocate(this%storage_ndemand_patch (begp:endp)) ; this%storage_ndemand_patch (:) = nan - allocate(this%frootn_patch (begp:endp)) ; this%frootn_patch (:) = nan - allocate(this%frootn_storage_patch (begp:endp)) ; this%frootn_storage_patch (:) = nan - allocate(this%frootn_xfer_patch (begp:endp)) ; this%frootn_xfer_patch (:) = nan - allocate(this%livestemn_patch (begp:endp)) ; this%livestemn_patch (:) = nan - allocate(this%livestemn_storage_patch (begp:endp)) ; this%livestemn_storage_patch (:) = nan - allocate(this%livestemn_xfer_patch (begp:endp)) ; this%livestemn_xfer_patch (:) = nan - allocate(this%deadstemn_patch (begp:endp)) ; this%deadstemn_patch (:) = nan - allocate(this%deadstemn_storage_patch (begp:endp)) ; this%deadstemn_storage_patch (:) = nan - allocate(this%deadstemn_xfer_patch (begp:endp)) ; this%deadstemn_xfer_patch (:) = nan - allocate(this%livecrootn_patch (begp:endp)) ; this%livecrootn_patch (:) = nan - allocate(this%livecrootn_storage_patch (begp:endp)) ; this%livecrootn_storage_patch (:) = nan - allocate(this%livecrootn_xfer_patch (begp:endp)) ; this%livecrootn_xfer_patch (:) = nan - allocate(this%deadcrootn_patch (begp:endp)) ; this%deadcrootn_patch (:) = nan - allocate(this%deadcrootn_storage_patch (begp:endp)) ; this%deadcrootn_storage_patch (:) = nan - allocate(this%deadcrootn_xfer_patch (begp:endp)) ; this%deadcrootn_xfer_patch (:) = nan - allocate(this%retransn_patch (begp:endp)) ; this%retransn_patch (:) = nan - allocate(this%npool_patch (begp:endp)) ; this%npool_patch (:) = nan - allocate(this%ntrunc_patch (begp:endp)) ; this%ntrunc_patch (:) = nan - allocate(this%dispvegn_patch (begp:endp)) ; this%dispvegn_patch (:) = nan - allocate(this%storvegn_patch (begp:endp)) ; this%storvegn_patch (:) = nan - allocate(this%totvegn_patch (begp:endp)) ; this%totvegn_patch (:) = nan - allocate(this%totn_patch (begp:endp)) ; this%totn_patch (:) = nan - - allocate(this%cropseedn_deficit_patch (begp:endp)) ; this%cropseedn_deficit_patch (:) = nan - allocate(this%seedn_grc (begg:endg)) ; this%seedn_grc (:) = nan - allocate(this%totvegn_col (begc:endc)) ; this%totvegn_col (:) = nan - allocate(this%totn_p2c_col (begc:endc)) ; this%totn_p2c_col (:) = nan - allocate(this%totn_col (begc:endc)) ; this%totn_col (:) = nan - allocate(this%totecosysn_col (begc:endc)) ; this%totecosysn_col (:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! add history fields for all CN variables, always set as default='inactive' - ! - ! !USES: - use histFileMod, only : hist_addfld1d - ! - ! !ARGUMENTS: - class(cnveg_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: k,l,ii,jj - integer :: begp,endp - integer :: begc,endc - integer :: begg,endg - character(24) :: fieldname - character(100) :: longname - real(r8), pointer :: data1dptr(:) ! temp. pointer for slicing larger arrays - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - !------------------------------- - ! patch state variables - !------------------------------- - - if (use_crop) then - this%grainn_patch(begp:endp) = spval - call hist_addfld1d (fname='GRAINN', units='gN/m^2', & - avgflag='A', long_name='grain N', & - ptr_patch=this%grainn_patch, default='inactive') - call hist_addfld1d (fname='CROPSEEDN_DEFICIT', units='gN/m^2', & - avgflag='A', long_name='N used for crop seed that needs to be repaid', & - ptr_patch=this%cropseedn_deficit_patch, default='inactive') - end if - - this%leafn_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFN', units='gN/m^2', & - avgflag='A', long_name='leaf N', & - ptr_patch=this%leafn_patch, default='inactive') - - this%leafn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFN_STORAGE', units='gN/m^2', & - avgflag='A', long_name='leaf N storage', & - ptr_patch=this%leafn_storage_patch, default='inactive') - - this%leafn_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFN_XFER', units='gN/m^2', & - avgflag='A', long_name='leaf N transfer', & - ptr_patch=this%leafn_xfer_patch, default='inactive') - - if ( use_fun ) then - this%leafn_storage_xfer_acc_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFN_STORAGE_XFER_ACC', units='gN/m^2', & - avgflag='A', long_name='Accmulated leaf N transfer', & - ptr_patch=this%leafn_storage_xfer_acc_patch, default='inactive') - - this%storage_ndemand_patch(begp:endp) = spval - call hist_addfld1d (fname='STORAGE_NDEMAND', units='gN/m^2', & - avgflag='A', long_name='N demand during the offset period', & - ptr_patch=this%storage_ndemand_patch, default='inactive') - end if - - this%frootn_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTN', units='gN/m^2', & - avgflag='A', long_name='fine root N', & - ptr_patch=this%frootn_patch, default='inactive') - - this%frootn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTN_STORAGE', units='gN/m^2', & - avgflag='A', long_name='fine root N storage', & - ptr_patch=this%frootn_storage_patch, default='inactive') - - this%frootn_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTN_XFER', units='gN/m^2', & - avgflag='A', long_name='fine root N transfer', & - ptr_patch=this%frootn_xfer_patch, default='inactive') - - this%livestemn_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMN', units='gN/m^2', & - avgflag='A', long_name='live stem N', & - ptr_patch=this%livestemn_patch, default='inactive') - - this%livestemn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMN_STORAGE', units='gN/m^2', & - avgflag='A', long_name='live stem N storage', & - ptr_patch=this%livestemn_storage_patch, default='inactive') - - this%livestemn_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMN_XFER', units='gN/m^2', & - avgflag='A', long_name='live stem N transfer', & - ptr_patch=this%livestemn_xfer_patch, default='inactive') - - this%deadstemn_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMN', units='gN/m^2', & - avgflag='A', long_name='dead stem N', & - ptr_patch=this%deadstemn_patch, default='inactive') - - this%deadstemn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMN_STORAGE', units='gN/m^2', & - avgflag='A', long_name='dead stem N storage', & - ptr_patch=this%deadstemn_storage_patch, default='inactive') - - this%deadstemn_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMN_XFER', units='gN/m^2', & - avgflag='A', long_name='dead stem N transfer', & - ptr_patch=this%deadstemn_xfer_patch, default='inactive') - - this%livecrootn_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTN', units='gN/m^2', & - avgflag='A', long_name='live coarse root N', & - ptr_patch=this%livecrootn_patch, default='inactive') - - this%livecrootn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTN_STORAGE', units='gN/m^2', & - avgflag='A', long_name='live coarse root N storage', & - ptr_patch=this%livecrootn_storage_patch, default='inactive') - - this%livecrootn_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTN_XFER', units='gN/m^2', & - avgflag='A', long_name='live coarse root N transfer', & - ptr_patch=this%livecrootn_xfer_patch, default='inactive') - - this%deadcrootn_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTN', units='gN/m^2', & - avgflag='A', long_name='dead coarse root N', & - ptr_patch=this%deadcrootn_patch, default='inactive') - - this%deadcrootn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTN_STORAGE', units='gN/m^2', & - avgflag='A', long_name='dead coarse root N storage', & - ptr_patch=this%deadcrootn_storage_patch, default='inactive') - - this%deadcrootn_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTN_XFER', units='gN/m^2', & - avgflag='A', long_name='dead coarse root N transfer', & - ptr_patch=this%deadcrootn_xfer_patch, default='inactive') - - this%retransn_patch(begp:endp) = spval - call hist_addfld1d (fname='RETRANSN', units='gN/m^2', & - avgflag='A', long_name='plant pool of retranslocated N', & - ptr_patch=this%retransn_patch, default='inactive') - - this%npool_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL', units='gN/m^2', & - avgflag='A', long_name='temporary plant N pool', & - ptr_patch=this%npool_patch, default='inactive') - - this%ntrunc_patch(begp:endp) = spval - call hist_addfld1d (fname='PFT_NTRUNC', units='gN/m^2', & - avgflag='A', long_name='patch-level sink for N truncation', & - ptr_patch=this%ntrunc_patch, default='inactive') - - this%dispvegn_patch(begp:endp) = spval - call hist_addfld1d (fname='DISPVEGN', units='gN/m^2', & - avgflag='A', long_name='displayed vegetation nitrogen', & - ptr_patch=this%dispvegn_patch, default='inactive') - - this%storvegn_patch(begp:endp) = spval - call hist_addfld1d (fname='STORVEGN', units='gN/m^2', & - avgflag='A', long_name='stored vegetation nitrogen', & - ptr_patch=this%storvegn_patch, default='inactive') - - this%totvegn_patch(begp:endp) = spval - call hist_addfld1d (fname='TOTVEGN', units='gN/m^2', & - avgflag='A', long_name='total vegetation nitrogen', & - ptr_patch=this%totvegn_patch, default='inactive') - - this%totn_patch(begp:endp) = spval - call hist_addfld1d (fname='TOTPFTN', units='gN/m^2', & - avgflag='A', long_name='total patch-level nitrogen', & - ptr_patch=this%totn_patch, default='inactive') - - !------------------------------- - ! column state variables - !------------------------------- - - this%seedn_grc(begg:endg) = spval - call hist_addfld1d (fname='SEEDN', units='gN/m^2', & - avgflag='A', long_name='pool for seeding new PFTs via dynamic landcover', & - ptr_gcell=this%seedn_grc, default='inactive') - - this%totecosysn_col(begc:endc) = spval - call hist_addfld1d (fname='TOTECOSYSN', units='gN/m^2', & - avgflag='A', long_name='total ecosystem N, excluding product pools', & - ptr_col=this%totecosysn_col, default='inactive') - - this%totn_col(begc:endc) = spval - call hist_addfld1d (fname='TOTCOLN', units='gN/m^2', & - avgflag='A', long_name='total column-level N, excluding product pools', & - ptr_col=this%totn_col, default='inactive') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds, & - leafc_patch, leafc_storage_patch, frootc_patch, frootc_storage_patch, deadstemc_patch) - ! - ! !DESCRIPTION: - ! Initializes time varying variables used only in coupled carbon-nitrogen mode (CN): - ! - use clm_varctl , only : MM_Nuptake_opt - ! !ARGUMENTS: - class(cnveg_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: leafc_patch(bounds%begp:) - real(r8) , intent(in) :: leafc_storage_patch(bounds%begp:) - real(r8) , intent(in) :: frootc_patch(bounds%begp:) - real(r8) , intent(in) :: frootc_storage_patch(bounds%begp:) - real(r8) , intent(in) :: deadstemc_patch(bounds%begp:) - ! - ! !LOCAL VARIABLES: - integer :: fc,fp,g,l,c,p,j,k ! indices - integer :: num_special_col ! number of good values in special_col filter - integer :: num_special_patch ! number of good values in special_patch filter - integer :: special_col (bounds%endc-bounds%begc+1) ! special landunit filter - columns - integer :: special_patch (bounds%endp-bounds%begp+1) ! special landunit filter - patches - !------------------------------------------------------------------------ - - SHR_ASSERT_ALL((ubound(leafc_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(leafc_storage_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frootc_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frootc_storage_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(deadstemc_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - ! Set column filters - - num_special_patch = 0 - do p = bounds%begp,bounds%endp - l = patch%landunit(p) - if (lun%ifspecial(l)) then - num_special_patch = num_special_patch + 1 - special_patch(num_special_patch) = p - end if - end do - - ! Set patch filters - - num_special_col = 0 - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - num_special_col = num_special_col + 1 - special_col(num_special_col) = c - end if - end do - - !------------------------------------------- - ! initialize patch-level variables - !------------------------------------------- - - do p = bounds%begp,bounds%endp - - l = patch%landunit(p) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - - if (patch%itype(p) == noveg) then - this%leafn_patch(p) = 0._r8 - this%leafn_storage_patch(p) = 0._r8 - if (MM_Nuptake_opt .eqv. .true.) then - this%frootn_patch(p) = 0._r8 - this%frootn_storage_patch(p) = 0._r8 - end if - else - this%leafn_patch(p) = leafc_patch(p) / pftcon%leafcn(patch%itype(p)) - this%leafn_storage_patch(p) = leafc_storage_patch(p) / pftcon%leafcn(patch%itype(p)) - if (MM_Nuptake_opt .eqv. .true.) then - this%frootn_patch(p) = frootc_patch(p) / pftcon%frootcn(patch%itype(p)) - this%frootn_storage_patch(p) = frootc_storage_patch(p) / pftcon%frootcn(patch%itype(p)) - end if - end if - - this%leafn_xfer_patch(p) = 0._r8 - - this%leafn_storage_xfer_acc_patch(p) = 0._r8 - this%storage_ndemand_patch(p) = 0._r8 - - if ( use_crop )then - this%grainn_patch(p) = 0._r8 - this%grainn_storage_patch(p) = 0._r8 - this%grainn_xfer_patch(p) = 0._r8 - this%cropseedn_deficit_patch(p) = 0._r8 - end if - if (MM_Nuptake_opt .eqv. .false.) then ! if not running in floating CN ratio option - this%frootn_patch(p) = 0._r8 - this%frootn_storage_patch(p) = 0._r8 - end if - this%frootn_xfer_patch(p) = 0._r8 - this%livestemn_patch(p) = 0._r8 - this%livestemn_storage_patch(p) = 0._r8 - this%livestemn_xfer_patch(p) = 0._r8 - - ! tree types need to be initialized with some stem mass so that - ! roughness length is not zero in canopy flux calculation - - if (pftcon%woody(patch%itype(p)) == 1._r8) then - this%deadstemn_patch(p) = deadstemc_patch(p) / pftcon%deadwdcn(patch%itype(p)) - else - this%deadstemn_patch(p) = 0._r8 - end if - - this%deadstemn_storage_patch(p) = 0._r8 - this%deadstemn_xfer_patch(p) = 0._r8 - this%livecrootn_patch(p) = 0._r8 - this%livecrootn_storage_patch(p) = 0._r8 - this%livecrootn_xfer_patch(p) = 0._r8 - this%deadcrootn_patch(p) = 0._r8 - this%deadcrootn_storage_patch(p) = 0._r8 - this%deadcrootn_xfer_patch(p) = 0._r8 - this%retransn_patch(p) = 0._r8 - this%npool_patch(p) = 0._r8 - this%ntrunc_patch(p) = 0._r8 - this%dispvegn_patch(p) = 0._r8 - this%storvegn_patch(p) = 0._r8 - this%totvegn_patch(p) = 0._r8 - this%totn_patch(p) = 0._r8 - end if - end do - - !------------------------------------------- - ! initialize column-level variables - !------------------------------------------- - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - ! total nitrogen pools - this%totecosysn_col(c) = 0._r8 - this%totn_p2c_col(c) = 0._r8 - this%totn_col(c) = 0._r8 - end if - end do - - - do g = bounds%begg, bounds%endg - this%seedn_grc(g) = 0._r8 - end do - - ! now loop through special filters and explicitly set the variables that - ! have to be in place for biogeophysics - - ! initialize fields for special filters - - call this%SetValues (& - num_patch=num_special_patch, filter_patch=special_patch, value_patch=0._r8, & - num_column=num_special_col, filter_column=special_col, value_column=0._r8) - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart ( this, bounds, ncid, flag, leafc_patch, & - leafc_storage_patch, frootc_patch, frootc_storage_patch, & - deadstemc_patch, filter_reseed_patch, num_reseed_patch ) - ! - ! !DESCRIPTION: - ! Read/write restart data - ! - ! !USES: - use restUtilMod - use ncdio_pio - use clm_varctl , only : spinup_state, use_cndv - use clm_time_manager , only : get_nstep, is_restart - use clm_varctl , only : MM_Nuptake_opt - - ! - ! !ARGUMENTS: - class (cnveg_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid - character(len=*) , intent(in) :: flag !'read' or 'write' or 'define' - real(r8) , intent(in) :: leafc_patch(bounds%begp:) - real(r8) , intent(in) :: leafc_storage_patch(bounds%begp:) - real(r8) , intent(in) :: frootc_patch(bounds%begp:) - real(r8) , intent(in) :: frootc_storage_patch(bounds%begp:) - real(r8) , intent(in) :: deadstemc_patch(bounds%begp:) - integer , intent(in) :: filter_reseed_patch(:) - integer , intent(in) :: num_reseed_patch - ! - ! !LOCAL VARIABLES: - integer :: i, p, l - logical :: readvar - real(r8), pointer :: ptr1d(:) ! temp. pointers for slicing larger arrays - character(len=128) :: varname ! temporary - logical :: exit_spinup = .false. - logical :: enter_spinup = .false. - integer :: idata - - ! spinup state as read from restart file, for determining whether to enter or exit spinup mode. - integer :: restart_file_spinup_state - - !------------------------------------------------------------------------ - - !-------------------------------- - ! patch nitrogen state variables - !-------------------------------- - - call restartvar(ncid=ncid, flag=flag, varname='leafn', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='leafn_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafn_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='leafn_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafn_xfer_patch) - - if ( use_fun ) then - call restartvar(ncid=ncid, flag=flag, varname='leafn_storage_xfer_acc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafn_storage_xfer_acc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='storage_ndemand', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%storage_ndemand_patch) - end if - - - call restartvar(ncid=ncid, flag=flag, varname='frootn', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='frootn_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootn_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='frootn_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootn_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livestemn', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livestemn_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemn_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livestemn_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemn_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadstemn', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadstemn_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemn_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadstemn_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemn_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livecrootn', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livecrootn_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootn_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livecrootn_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootn_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootn', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootn_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootn_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootn_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootn_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='retransn', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%retransn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='npool', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%npool_patch) - - call restartvar(ncid=ncid, flag=flag, varname='pft_ntrunc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%ntrunc_patch) - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='grainn', xtype=ncd_double, & - dim1name='pft', long_name='grain N', units='gN/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='grainn_storage', xtype=ncd_double, & - dim1name='pft', long_name='grain N storage', units='gN/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainn_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='grainn_xfer', xtype=ncd_double, & - dim1name='pft', long_name='grain N transfer', units='gN/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainn_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='cropseedn_deficit', xtype=ncd_double, & - dim1name='pft', long_name='pool for seeding new crop growth', units='gN/m2', & - interpinic_flag='interp', readvar=readvar, data=this%cropseedn_deficit_patch) - end if - - !-------------------------------- - ! gridcell nitrogen state variables - !-------------------------------- - - ! BACKWARDS_COMPATIBILITY(wjs, 2017-01-12) Naming this with a _g suffix in order to - ! distinguish it from the old column-level seedn restart variable - call restartvar(ncid=ncid, flag=flag, varname='seedn_g', xtype=ncd_double, & - dim1name='gridcell', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%seedn_grc) - - - if (flag == 'read') then - call restartvar(ncid=ncid, flag=flag, varname='spinup_state', xtype=ncd_int, & - long_name='Spinup state of the model that wrote this restart file: ' & - // ' 0 = normal model mode, 1 = AD spinup', units='', & - interpinic_flag='copy', readvar=readvar, data=idata) - - if (readvar) then - restart_file_spinup_state = idata - else - restart_file_spinup_state = spinup_state - if ( masterproc ) then - write(iulog,*) ' CNRest: WARNING! Restart file does not contain info ' & - // ' on spinup state used to generate the restart file. ' - write(iulog,*) ' Assuming the same as current setting: ', spinup_state - end if - end if - end if - - if (flag == 'read' .and. spinup_state /= restart_file_spinup_state .and. .not. use_cndv) then - if (spinup_state <= 1 .and. restart_file_spinup_state == 2 ) then - if ( masterproc ) write(iulog,*) ' CNRest: taking Dead wood N pools out of AD spinup mode' - exit_spinup = .true. - if ( masterproc ) write(iulog, *) 'Multiplying stemn and crootn by 10 for exit spinup ' - do i = bounds%begp,bounds%endp - this%deadstemn_patch(i) = this%deadstemn_patch(i) * 10._r8 - this%deadcrootn_patch(i) = this%deadcrootn_patch(i) * 10._r8 - end do - else if (spinup_state == 2 .and. restart_file_spinup_state <= 1 ) then - if ( masterproc ) write(iulog,*) ' CNRest: taking Dead wood N pools into AD spinup mode' - enter_spinup = .true. - if ( masterproc ) write(iulog, *) 'Dividing stemn and crootn by 10 for enter spinup ' - do i = bounds%begp,bounds%endp - this%deadstemn_patch(i) = this%deadstemn_patch(i) / 10._r8 - this%deadcrootn_patch(i) = this%deadcrootn_patch(i) / 10._r8 - end do - endif - - end if - ! Reseed dead plants - if ( flag == 'read' .and. num_reseed_patch > 0 )then - if ( masterproc ) write(iulog, *) 'Reseed dead plants for CNVegNitrogenState' - do i = 1, num_reseed_patch - p = filter_reseed_patch(i) - - l = patch%landunit(p) - - if (patch%itype(p) == noveg) then - this%leafn_patch(p) = 0._r8 - this%leafn_storage_patch(p) = 0._r8 - if (MM_Nuptake_opt .eqv. .true.) then - this%frootn_patch(p) = 0._r8 - this%frootn_storage_patch(p) = 0._r8 - end if - else - this%leafn_patch(p) = leafc_patch(p) / pftcon%leafcn(patch%itype(p)) - this%leafn_storage_patch(p) = leafc_storage_patch(p) / pftcon%leafcn(patch%itype(p)) - if (MM_Nuptake_opt .eqv. .true.) then - this%frootn_patch(p) = frootc_patch(p) / pftcon%frootcn(patch%itype(p)) - this%frootn_storage_patch(p) = frootc_storage_patch(p) / pftcon%frootcn(patch%itype(p)) - end if - end if - - this%leafn_xfer_patch(p) = 0._r8 - - this%leafn_storage_xfer_acc_patch(p) = 0._r8 - this%storage_ndemand_patch(p) = 0._r8 - - if ( use_crop )then - this%grainn_patch(p) = 0._r8 - this%grainn_storage_patch(p) = 0._r8 - this%grainn_xfer_patch(p) = 0._r8 - this%cropseedn_deficit_patch(p) = 0._r8 - end if - if (MM_Nuptake_opt .eqv. .false.) then ! if not running in floating CN ratio option - this%frootn_patch(p) = 0._r8 - this%frootn_storage_patch(p) = 0._r8 - end if - this%frootn_xfer_patch(p) = 0._r8 - this%livestemn_patch(p) = 0._r8 - this%livestemn_storage_patch(p) = 0._r8 - this%livestemn_xfer_patch(p) = 0._r8 - - ! tree types need to be initialized with some stem mass so that - ! roughness length is not zero in canopy flux calculation - - if (pftcon%woody(patch%itype(p)) == 1._r8) then - this%deadstemn_patch(p) = deadstemc_patch(p) / pftcon%deadwdcn(patch%itype(p)) - else - this%deadstemn_patch(p) = 0._r8 - end if - - this%deadstemn_storage_patch(p) = 0._r8 - this%deadstemn_xfer_patch(p) = 0._r8 - this%livecrootn_patch(p) = 0._r8 - this%livecrootn_storage_patch(p) = 0._r8 - this%livecrootn_xfer_patch(p) = 0._r8 - this%deadcrootn_patch(p) = 0._r8 - this%deadcrootn_storage_patch(p) = 0._r8 - this%deadcrootn_xfer_patch(p) = 0._r8 - this%retransn_patch(p) = 0._r8 - this%npool_patch(p) = 0._r8 - this%ntrunc_patch(p) = 0._r8 - this%dispvegn_patch(p) = 0._r8 - this%storvegn_patch(p) = 0._r8 - this%totvegn_patch(p) = 0._r8 - this%totn_patch(p) = 0._r8 - - ! calculate totvegc explicitly so that it is available for the isotope - ! code on the first time step. - - this%totvegn_patch(p) = & - this%leafn_patch(p) + & - this%leafn_storage_patch(p) + & - this%leafn_xfer_patch(p) + & - this%frootn_patch(p) + & - this%frootn_storage_patch(p) + & - this%frootn_xfer_patch(p) + & - this%livestemn_patch(p) + & - this%livestemn_storage_patch(p) + & - this%livestemn_xfer_patch(p) + & - this%deadstemn_patch(p) + & - this%deadstemn_storage_patch(p) + & - this%deadstemn_xfer_patch(p) + & - this%livecrootn_patch(p) + & - this%livecrootn_storage_patch(p) + & - this%livecrootn_xfer_patch(p) + & - this%deadcrootn_patch(p) + & - this%deadcrootn_storage_patch(p) + & - this%deadcrootn_xfer_patch(p) + & - this%npool_patch(p) - - if ( use_crop )then - this%totvegn_patch(p) = & - this%totvegn_patch(p) + & - this%grainn_patch(p) + & - this%grainn_storage_patch(p) + & - this%grainn_xfer_patch(p) - end if - end do - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine SetValues ( this, & - num_patch, filter_patch, value_patch, & - num_column, filter_column, value_column) - ! - ! !DESCRIPTION: - ! Set nitrogen state variables - ! - ! !ARGUMENTS: - class (cnveg_nitrogenstate_type) :: this - integer , intent(in) :: num_patch - integer , intent(in) :: filter_patch(:) - real(r8), intent(in) :: value_patch - integer , intent(in) :: num_column - integer , intent(in) :: filter_column(:) - real(r8), intent(in) :: value_column - ! - ! !LOCAL VARIABLES: - integer :: fi,i ! loop index - integer :: j,k ! indices - !------------------------------------------------------------------------ - - do fi = 1,num_patch - i = filter_patch(fi) - - this%leafn_patch(i) = value_patch - this%leafn_storage_patch(i) = value_patch - this%leafn_xfer_patch(i) = value_patch - this%leafn_storage_xfer_acc_patch(i) = value_patch - this%frootn_patch(i) = value_patch - this%frootn_storage_patch(i) = value_patch - this%frootn_xfer_patch(i) = value_patch - this%livestemn_patch(i) = value_patch - this%livestemn_storage_patch(i) = value_patch - this%livestemn_xfer_patch(i) = value_patch - this%deadstemn_patch(i) = value_patch - this%deadstemn_storage_patch(i) = value_patch - this%deadstemn_xfer_patch(i) = value_patch - this%livecrootn_patch(i) = value_patch - this%livecrootn_storage_patch(i) = value_patch - this%livecrootn_xfer_patch(i) = value_patch - this%deadcrootn_patch(i) = value_patch - this%deadcrootn_storage_patch(i) = value_patch - this%deadcrootn_xfer_patch(i) = value_patch - this%retransn_patch(i) = value_patch - this%npool_patch(i) = value_patch - this%ntrunc_patch(i) = value_patch - this%dispvegn_patch(i) = value_patch - this%storvegn_patch(i) = value_patch - this%totvegn_patch(i) = value_patch - this%totn_patch(i) = value_patch - end do - - if ( use_crop )then - do fi = 1,num_patch - i = filter_patch(fi) - this%grainn_patch(i) = value_patch - this%grainn_storage_patch(i) = value_patch - this%grainn_xfer_patch(i) = value_patch - this%cropseedn_deficit_patch(i) = value_patch - end do - end if - - do fi = 1,num_column - i = filter_column(fi) - - this%totecosysn_col(i) = value_column - this%totvegn_col(i) = value_column - this%totn_p2c_col(i) = value_column - this%totn_col(i) = value_column - end do - - end subroutine SetValues - -end module CNVegNitrogenStateType diff --git a/src/biogeochem/CNVegStateType.F90 b/src/biogeochem/CNVegStateType.F90 deleted file mode 100644 index 1d78017a52..0000000000 --- a/src/biogeochem/CNVegStateType.F90 +++ /dev/null @@ -1,905 +0,0 @@ -module CNVegStateType - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use abortutils , only : endrun - use spmdMod , only : masterproc - use clm_varpar , only : nlevsno, nlevgrnd, nlevlak, nlevsoi - use clm_varctl , only : use_cn, iulog, fsurdat, use_crop, use_cndv - use clm_varcon , only : spval, ispval, grlnd - use landunit_varcon, only : istsoil, istcrop - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC TYPES: - type, public :: cnveg_state_type - - integer , pointer :: burndate_patch (:) ! patch crop burn date - real(r8) , pointer :: dwt_smoothed_patch (:) ! change in patch weight (-1 to 1) on the gridcell in this time step; changes in first time step of year are smoothed (dribbled) over the whole year - - ! Prognostic crop model - ! - ! TODO(wjs, 2016-02-22) Most / all of these crop-specific state variables should be - ! moved to CropType - real(r8) , pointer :: hdidx_patch (:) ! patch cold hardening index? - real(r8) , pointer :: cumvd_patch (:) ! patch cumulative vernalization d?ependence? - real(r8) , pointer :: gddmaturity_patch (:) ! patch growing degree days (gdd) needed to harvest (ddays) - real(r8) , pointer :: huileaf_patch (:) ! patch heat unit index needed from planting to leaf emergence - real(r8) , pointer :: huigrain_patch (:) ! patch heat unit index needed to reach vegetative maturity - real(r8) , pointer :: aleafi_patch (:) ! patch saved leaf allocation coefficient from phase 2 - real(r8) , pointer :: astemi_patch (:) ! patch saved stem allocation coefficient from phase 2 - real(r8) , pointer :: aleaf_patch (:) ! patch leaf allocation coefficient - real(r8) , pointer :: astem_patch (:) ! patch stem allocation coefficient - real(r8) , pointer :: htmx_patch (:) ! patch max hgt attained by a crop during yr (m) - integer , pointer :: peaklai_patch (:) ! patch 1: max allowed lai; 0: not at max - - integer , pointer :: idop_patch (:) ! patch date of planting - - real(r8) , pointer :: gdp_lf_col (:) ! col global real gdp data (k US$/capita) - real(r8) , pointer :: peatf_lf_col (:) ! col global peatland fraction data (0-1) - integer , pointer :: abm_lf_col (:) ! col global peak month of crop fire emissions - - real(r8) , pointer :: lgdp_col (:) ! col gdp limitation factor for fire occurrence (0-1) - real(r8) , pointer :: lgdp1_col (:) ! col gdp limitation factor for fire spreading (0-1) - real(r8) , pointer :: lpop_col (:) ! col pop limitation factor for fire spreading (0-1) - - real(r8) , pointer :: tempavg_t2m_patch (:) ! patch temporary average 2m air temperature (K) - real(r8) , pointer :: annavg_t2m_patch (:) ! patch annual average 2m air temperature (K) - real(r8) , pointer :: annavg_t2m_col (:) ! col annual average of 2m air temperature, averaged from patch-level (K) - real(r8) , pointer :: annsum_counter_col (:) ! col seconds since last annual accumulator turnover - - ! Fire - real(r8) , pointer :: nfire_col (:) ! col fire counts (count/km2/sec), valid only in Reg. C - real(r8) , pointer :: fsr_col (:) ! col fire spread rate at column level (m/s) - real(r8) , pointer :: fd_col (:) ! col fire duration at column level (hr) - real(r8) , pointer :: lfc_col (:) ! col conversion area fraction of BET and BDT that haven't burned before (/timestep) - real(r8) , pointer :: lfc2_col (:) ! col conversion area fraction of BET and BDT that burned (/sec) - real(r8) , pointer :: dtrotr_col (:) ! col annual decreased fraction coverage of BET on the gridcell (0-1) - real(r8) , pointer :: trotr1_col (:) ! col patch weight of BET on the column (0-1) - real(r8) , pointer :: trotr2_col (:) ! col patch weight of BDT on the column (0-1) - real(r8) , pointer :: cropf_col (:) ! col crop fraction in veg column (0-1) - real(r8) , pointer :: baf_crop_col (:) ! col baf for cropland(/sec) - real(r8) , pointer :: baf_peatf_col (:) ! col baf for peatland (/sec) - real(r8) , pointer :: fbac_col (:) ! col total burned area out of conversion (/sec) - real(r8) , pointer :: fbac1_col (:) ! col burned area out of conversion region due to land use fire (/sec) - real(r8) , pointer :: wtlf_col (:) ! col fractional coverage of non-crop Patches (0-1) - real(r8) , pointer :: lfwt_col (:) ! col fractional coverage of non-crop and non-bare-soil Patches (0-1) - real(r8) , pointer :: farea_burned_col (:) ! col fractional area burned (/sec) - - real(r8), pointer :: dormant_flag_patch (:) ! patch dormancy flag - real(r8), pointer :: days_active_patch (:) ! patch number of days since last dormancy - real(r8), pointer :: onset_flag_patch (:) ! patch onset flag - real(r8), pointer :: onset_counter_patch (:) ! patch onset days counter - real(r8), pointer :: onset_gddflag_patch (:) ! patch onset flag for growing degree day sum - real(r8), pointer :: onset_fdd_patch (:) ! patch onset freezing degree days counter - real(r8), pointer :: onset_gdd_patch (:) ! patch onset growing degree days - real(r8), pointer :: onset_swi_patch (:) ! patch onset soil water index - real(r8), pointer :: offset_flag_patch (:) ! patch offset flag - real(r8), pointer :: offset_counter_patch (:) ! patch offset days counter - real(r8), pointer :: offset_fdd_patch (:) ! patch offset freezing degree days counter - real(r8), pointer :: offset_swi_patch (:) ! patch offset soil water index - real(r8), pointer :: grain_flag_patch (:) ! patch 1: grain fill stage; 0: not - real(r8), pointer :: lgsf_patch (:) ! patch long growing season factor [0-1] - real(r8), pointer :: bglfr_patch (:) ! patch background litterfall rate (1/s) - real(r8), pointer :: bgtr_patch (:) ! patch background transfer growth rate (1/s) - real(r8), pointer :: c_allometry_patch (:) ! patch C allocation index (DIM) - real(r8), pointer :: n_allometry_patch (:) ! patch N allocation index (DIM) - - real(r8), pointer :: tempsum_potential_gpp_patch (:) ! patch temporary annual sum of potential GPP - real(r8), pointer :: annsum_potential_gpp_patch (:) ! patch annual sum of potential GPP - real(r8), pointer :: tempmax_retransn_patch (:) ! patch temporary annual max of retranslocated N pool (gN/m2) - real(r8), pointer :: annmax_retransn_patch (:) ! patch annual max of retranslocated N pool (gN/m2) - real(r8), pointer :: downreg_patch (:) ! patch fractional reduction in GPP due to N limitation (DIM) - real(r8), pointer :: leafcn_offset_patch (:) ! patch leaf C:N used by FUN - real(r8), pointer :: plantCN_patch (:) ! patch plant C:N used by FUN - - contains - - procedure, public :: Init - procedure, public :: Restart - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - end type cnveg_state_type - !------------------------------------------------------------------------ - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(cnveg_state_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate ( bounds ) - if (use_cn) then - call this%InitHistory ( bounds ) - end if - call this%InitCold ( bounds ) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(cnveg_state_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - logical :: allows_non_annual_delta - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - allocate(this%burndate_patch (begp:endp)) ; this%burndate_patch (:) = ispval - allocate(this%dwt_smoothed_patch (begp:endp)) ; this%dwt_smoothed_patch (:) = nan - - allocate(this%hdidx_patch (begp:endp)) ; this%hdidx_patch (:) = nan - allocate(this%cumvd_patch (begp:endp)) ; this%cumvd_patch (:) = nan - allocate(this%gddmaturity_patch (begp:endp)) ; this%gddmaturity_patch (:) = spval - allocate(this%huileaf_patch (begp:endp)) ; this%huileaf_patch (:) = nan - allocate(this%huigrain_patch (begp:endp)) ; this%huigrain_patch (:) = 0.0_r8 - allocate(this%aleafi_patch (begp:endp)) ; this%aleafi_patch (:) = nan - allocate(this%astemi_patch (begp:endp)) ; this%astemi_patch (:) = nan - allocate(this%aleaf_patch (begp:endp)) ; this%aleaf_patch (:) = nan - allocate(this%astem_patch (begp:endp)) ; this%astem_patch (:) = nan - allocate(this%htmx_patch (begp:endp)) ; this%htmx_patch (:) = 0.0_r8 - allocate(this%peaklai_patch (begp:endp)) ; this%peaklai_patch (:) = 0 - - allocate(this%idop_patch (begp:endp)) ; this%idop_patch (:) = huge(1) - - allocate(this%gdp_lf_col (begc:endc)) ; - allocate(this%peatf_lf_col (begc:endc)) ; - allocate(this%abm_lf_col (begc:endc)) ; - - allocate(this%lgdp_col (begc:endc)) ; - allocate(this%lgdp1_col (begc:endc)) ; - allocate(this%lpop_col (begc:endc)) ; - - allocate(this%tempavg_t2m_patch (begp:endp)) ; this%tempavg_t2m_patch (:) = nan - allocate(this%annsum_counter_col (begc:endc)) ; this%annsum_counter_col (:) = nan - allocate(this%annavg_t2m_col (begc:endc)) ; this%annavg_t2m_col (:) = nan - allocate(this%annavg_t2m_patch (begp:endp)) ; this%annavg_t2m_patch (:) = nan - - allocate(this%nfire_col (begc:endc)) ; this%nfire_col (:) = spval - allocate(this%fsr_col (begc:endc)) ; this%fsr_col (:) = nan - allocate(this%fd_col (begc:endc)) ; this%fd_col (:) = nan - allocate(this%lfc_col (begc:endc)) ; this%lfc_col (:) = spval - allocate(this%lfc2_col (begc:endc)) ; this%lfc2_col (:) = 0._r8 - allocate(this%dtrotr_col (begc:endc)) ; this%dtrotr_col (:) = 0._r8 - allocate(this%trotr1_col (begc:endc)) ; this%trotr1_col (:) = 0._r8 - allocate(this%trotr2_col (begc:endc)) ; this%trotr2_col (:) = 0._r8 - allocate(this%cropf_col (begc:endc)) ; this%cropf_col (:) = nan - allocate(this%baf_crop_col (begc:endc)) ; this%baf_crop_col (:) = nan - allocate(this%baf_peatf_col (begc:endc)) ; this%baf_peatf_col (:) = nan - allocate(this%fbac_col (begc:endc)) ; this%fbac_col (:) = nan - allocate(this%fbac1_col (begc:endc)) ; this%fbac1_col (:) = nan - allocate(this%wtlf_col (begc:endc)) ; this%wtlf_col (:) = nan - allocate(this%lfwt_col (begc:endc)) ; this%lfwt_col (:) = nan - allocate(this%farea_burned_col (begc:endc)) ; this%farea_burned_col (:) = nan - - allocate(this%dormant_flag_patch (begp:endp)) ; this%dormant_flag_patch (:) = nan - allocate(this%days_active_patch (begp:endp)) ; this%days_active_patch (:) = nan - allocate(this%onset_flag_patch (begp:endp)) ; this%onset_flag_patch (:) = nan - allocate(this%onset_counter_patch (begp:endp)) ; this%onset_counter_patch (:) = nan - allocate(this%onset_gddflag_patch (begp:endp)) ; this%onset_gddflag_patch (:) = nan - allocate(this%onset_fdd_patch (begp:endp)) ; this%onset_fdd_patch (:) = nan - allocate(this%onset_gdd_patch (begp:endp)) ; this%onset_gdd_patch (:) = nan - allocate(this%onset_swi_patch (begp:endp)) ; this%onset_swi_patch (:) = nan - allocate(this%offset_flag_patch (begp:endp)) ; this%offset_flag_patch (:) = nan - allocate(this%offset_counter_patch (begp:endp)) ; this%offset_counter_patch (:) = nan - allocate(this%offset_fdd_patch (begp:endp)) ; this%offset_fdd_patch (:) = nan - allocate(this%offset_swi_patch (begp:endp)) ; this%offset_swi_patch (:) = nan - allocate(this%grain_flag_patch (begp:endp)) ; this%grain_flag_patch (:) = nan - allocate(this%lgsf_patch (begp:endp)) ; this%lgsf_patch (:) = nan - allocate(this%bglfr_patch (begp:endp)) ; this%bglfr_patch (:) = nan - allocate(this%bgtr_patch (begp:endp)) ; this%bgtr_patch (:) = nan - allocate(this%c_allometry_patch (begp:endp)) ; this%c_allometry_patch (:) = nan - allocate(this%n_allometry_patch (begp:endp)) ; this%n_allometry_patch (:) = nan - allocate(this%tempsum_potential_gpp_patch (begp:endp)) ; this%tempsum_potential_gpp_patch (:) = nan - allocate(this%annsum_potential_gpp_patch (begp:endp)) ; this%annsum_potential_gpp_patch (:) = nan - allocate(this%tempmax_retransn_patch (begp:endp)) ; this%tempmax_retransn_patch (:) = nan - allocate(this%annmax_retransn_patch (begp:endp)) ; this%annmax_retransn_patch (:) = nan - allocate(this%downreg_patch (begp:endp)) ; this%downreg_patch (:) = nan - allocate(this%leafcn_offset_patch (begp:endp)) ; this%leafcn_offset_patch (:) = nan - allocate(this%plantCN_patch (begp:endp)) ; this%plantCN_patch (:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use histFileMod , only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp, no_snow_normal - ! - ! !ARGUMENTS: - class(cnveg_state_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - character(8) :: vr_suffix - character(10) :: active - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - if ( use_crop) then - this%gddmaturity_patch(begp:endp) = spval - call hist_addfld1d (fname='GDDHARV', units='ddays', & - avgflag='A', long_name='Growing degree days (gdd) needed to harvest', & - ptr_patch=this%gddmaturity_patch, default='inactive') - end if - - this%lfc2_col(begc:endc) = spval - call hist_addfld1d (fname='LFC2', units='per sec', & - avgflag='A', long_name='conversion area fraction of BET and BDT that burned', & - ptr_col=this%lfc2_col, default='inactive') - - this%annsum_counter_col(begc:endc) = spval - call hist_addfld1d (fname='ANNSUM_COUNTER', units='s', & - avgflag='A', long_name='seconds since last annual accumulator turnover', & - ptr_col=this%annsum_counter_col, default='inactive') - - this%annavg_t2m_col(begc:endc) = spval - call hist_addfld1d (fname='CANNAVG_T2M', units='K', & - avgflag='A', long_name='annual average of 2m air temperature', & - ptr_col=this%annavg_t2m_col, default='inactive') - - this%nfire_col(begc:endc) = spval - call hist_addfld1d (fname='NFIRE', units='counts/km2/sec', & - avgflag='A', long_name='fire counts valid only in Reg.C', & - ptr_col=this%nfire_col, default='inactive') - - this%farea_burned_col(begc:endc) = spval - call hist_addfld1d (fname='FAREA_BURNED', units='proportion/sec', & - avgflag='A', long_name='timestep fractional area burned', & - ptr_col=this%farea_burned_col, default='inactive') - - this%baf_crop_col(begc:endc) = spval - call hist_addfld1d (fname='BAF_CROP', units='proportion/sec', & - avgflag='A', long_name='fractional area burned for crop', & - ptr_col=this%baf_crop_col, default='inactive') - - this%baf_peatf_col(begc:endc) = spval - call hist_addfld1d (fname='BAF_PEATF', units='proportion/sec', & - avgflag='A', long_name='fractional area burned in peatland', & - ptr_col=this%baf_peatf_col, default='inactive') - - this%annavg_t2m_patch(begp:endp) = spval - call hist_addfld1d (fname='ANNAVG_T2M', units='K', & - avgflag='A', long_name='annual average 2m air temperature', & - ptr_patch=this%annavg_t2m_patch, default='inactive') - - this%tempavg_t2m_patch(begp:endp) = spval - call hist_addfld1d (fname='TEMPAVG_T2M', units='K', & - avgflag='A', long_name='temporary average 2m air temperature', & - ptr_patch=this%tempavg_t2m_patch, default='inactive') - - this%dormant_flag_patch(begp:endp) = spval - call hist_addfld1d (fname='DORMANT_FLAG', units='none', & - avgflag='A', long_name='dormancy flag', & - ptr_patch=this%dormant_flag_patch, default='inactive') - - this%days_active_patch(begp:endp) = spval - call hist_addfld1d (fname='DAYS_ACTIVE', units='days', & - avgflag='A', long_name='number of days since last dormancy', & - ptr_patch=this%days_active_patch, default='inactive') - - this%onset_flag_patch(begp:endp) = spval - call hist_addfld1d (fname='ONSET_FLAG', units='none', & - avgflag='A', long_name='onset flag', & - ptr_patch=this%onset_flag_patch, default='inactive') - - this%onset_counter_patch(begp:endp) = spval - call hist_addfld1d (fname='ONSET_COUNTER', units='days', & - avgflag='A', long_name='onset days counter', & - ptr_patch=this%onset_counter_patch, default='inactive') - - this%onset_gddflag_patch(begp:endp) = spval - call hist_addfld1d (fname='ONSET_GDDFLAG', units='none', & - avgflag='A', long_name='onset flag for growing degree day sum', & - ptr_patch=this%onset_gddflag_patch, default='inactive') - - this%onset_fdd_patch(begp:endp) = spval - call hist_addfld1d (fname='ONSET_FDD', units='C degree-days', & - avgflag='A', long_name='onset freezing degree days counter', & - ptr_patch=this%onset_fdd_patch, default='inactive') - - this%onset_gdd_patch(begp:endp) = spval - call hist_addfld1d (fname='ONSET_GDD', units='C degree-days', & - avgflag='A', long_name='onset growing degree days', & - ptr_patch=this%onset_gdd_patch, default='inactive') - - this%onset_swi_patch(begp:endp) = spval - call hist_addfld1d (fname='ONSET_SWI', units='none', & - avgflag='A', long_name='onset soil water index', & - ptr_patch=this%onset_swi_patch, default='inactive') - - this%offset_flag_patch(begp:endp) = spval - call hist_addfld1d (fname='OFFSET_FLAG', units='none', & - avgflag='A', long_name='offset flag', & - ptr_patch=this%offset_flag_patch, default='inactive') - - this%offset_counter_patch(begp:endp) = spval - call hist_addfld1d (fname='OFFSET_COUNTER', units='days', & - avgflag='A', long_name='offset days counter', & - ptr_patch=this%offset_counter_patch, default='inactive') - - this%offset_fdd_patch(begp:endp) = spval - call hist_addfld1d (fname='OFFSET_FDD', units='C degree-days', & - avgflag='A', long_name='offset freezing degree days counter', & - ptr_patch=this%offset_fdd_patch, default='inactive') - - this%offset_swi_patch(begp:endp) = spval - call hist_addfld1d (fname='OFFSET_SWI', units='none', & - avgflag='A', long_name='offset soil water index', & - ptr_patch=this%offset_swi_patch, default='inactive') - - this%lgsf_patch(begp:endp) = spval - call hist_addfld1d (fname='LGSF', units='proportion', & - avgflag='A', long_name='long growing season factor', & - ptr_patch=this%lgsf_patch, default='inactive') - - this%bglfr_patch(begp:endp) = spval - call hist_addfld1d (fname='BGLFR', units='1/s', & - avgflag='A', long_name='background litterfall rate', & - ptr_patch=this%bglfr_patch, default='inactive') - - this%bgtr_patch(begp:endp) = spval - call hist_addfld1d (fname='BGTR', units='1/s', & - avgflag='A', long_name='background transfer growth rate', & - ptr_patch=this%bgtr_patch, default='inactive') - - this%c_allometry_patch(begp:endp) = spval - call hist_addfld1d (fname='C_ALLOMETRY', units='none', & - avgflag='A', long_name='C allocation index', & - ptr_patch=this%c_allometry_patch, default='inactive') - - this%n_allometry_patch(begp:endp) = spval - call hist_addfld1d (fname='N_ALLOMETRY', units='none', & - avgflag='A', long_name='N allocation index', & - ptr_patch=this%n_allometry_patch, default='inactive') - - this%tempsum_potential_gpp_patch(begp:endp) = spval - call hist_addfld1d (fname='TEMPSUM_POTENTIAL_GPP', units='gC/m^2/yr', & - avgflag='A', long_name='temporary annual sum of potential GPP', & - ptr_patch=this%tempsum_potential_gpp_patch, default='inactive') - - this%annsum_potential_gpp_patch(begp:endp) = spval - call hist_addfld1d (fname='ANNSUM_POTENTIAL_GPP', units='gN/m^2/yr', & - avgflag='A', long_name='annual sum of potential GPP', & - ptr_patch=this%annsum_potential_gpp_patch, default='inactive') - - this%tempmax_retransn_patch(begp:endp) = spval - call hist_addfld1d (fname='TEMPMAX_RETRANSN', units='gN/m^2', & - avgflag='A', long_name='temporary annual max of retranslocated N pool', & - ptr_patch=this%tempmax_retransn_patch, default='inactive') - - this%annmax_retransn_patch(begp:endp) = spval - call hist_addfld1d (fname='ANNMAX_RETRANSN', units='gN/m^2', & - avgflag='A', long_name='annual max of retranslocated N pool', & - ptr_patch=this%annmax_retransn_patch, default='inactive') - - this%downreg_patch(begp:endp) = spval - call hist_addfld1d (fname='DOWNREG', units='proportion', & - avgflag='A', long_name='fractional reduction in GPP due to N limitation', & - ptr_patch=this%downreg_patch, default='inactive') - - this%leafcn_offset_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFCN_OFFSET', units='unitless', & - avgflag='A', long_name='Leaf C:N used by FUN', & - ptr_patch=this%leafcn_offset_patch, default='inactive') - - this%plantCN_patch(begp:endp) = spval - call hist_addfld1d (fname='PLANTCN', units='unitless', & - avgflag='A', long_name='Plant C:N used by FUN', & - ptr_patch=this%plantCN_patch, default='inactive') - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine initCold(this, bounds) - ! - ! !USES: - use spmdMod , only : masterproc - use fileutils , only : getfil - use clm_varctl , only : nsrest, nsrStartup - use ncdio_pio - ! - ! !ARGUMENTS: - class(cnveg_state_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g,l,c,p,n,j,m ! indices - real(r8) ,pointer :: gdp (:) ! global gdp data (needs to be a pointer for use in ncdio) - real(r8) ,pointer :: peatf (:) ! global peatf data (needs to be a pointer for use in ncdio) - integer ,pointer :: abm (:) ! global abm data (needs to be a pointer for use in ncdio) - real(r8) ,pointer :: gti (:) ! read in - fmax (needs to be a pointer for use in ncdio) - integer :: dimid ! dimension id - integer :: ier ! error status - type(file_desc_t) :: ncid ! netcdf id - logical :: readvar - character(len=256) :: locfn ! local filename - integer :: begc, endc - integer :: begg, endg - !----------------------------------------------------------------------- - - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - ! -------------------------------------------------------------------- - ! Open surface dataset - ! -------------------------------------------------------------------- - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - - ! -------------------------------------------------------------------- - ! Read in GDP data - ! -------------------------------------------------------------------- - - allocate(gdp(bounds%begg:bounds%endg)) - call ncd_io(ncid=ncid, varname='gdp', flag='read', data=gdp, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: gdp NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - this%gdp_lf_col(c) = gdp(g) - end do - deallocate(gdp) - - ! -------------------------------------------------------------------- - ! Read in peatf data - ! -------------------------------------------------------------------- - - allocate(peatf(bounds%begg:bounds%endg)) - call ncd_io(ncid=ncid, varname='peatf', flag='read', data=peatf, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: peatf NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - this%peatf_lf_col(c) = peatf(g) - end do - deallocate(peatf) - - ! -------------------------------------------------------------------- - ! Read in ABM data - ! -------------------------------------------------------------------- - - allocate(abm(bounds%begg:bounds%endg)) - call ncd_io(ncid=ncid, varname='abm', flag='read', data=abm, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: abm NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - this%abm_lf_col(c) = abm(g) - end do - deallocate(abm) - - ! Close file - - call ncd_pio_closefile(ncid) - - if (masterproc) then - write(iulog,*) 'Successfully read fmax, soil color, sand and clay boundary data' - write(iulog,*) - endif - - ! -------------------------------------------------------------------- - ! Initialize terms needed for dust model - ! TODO - move these terms to DUSTMod module variables - ! -------------------------------------------------------------------- - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - this%annsum_counter_col (c) = spval - this%annavg_t2m_col (c) = spval - this%nfire_col (c) = spval - this%baf_crop_col (c) = spval - this%baf_peatf_col (c) = spval - this%fbac_col (c) = spval - this%fbac1_col (c) = spval - this%farea_burned_col (c) = spval - end if - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%annsum_counter_col(c) = 0._r8 - this%annavg_t2m_col(c) = 280._r8 - - ! fire related variables - this%baf_crop_col(c) = 0._r8 - this%baf_peatf_col(c) = 0._r8 - this%fbac_col(c) = 0._r8 - this%fbac1_col(c) = 0._r8 - this%farea_burned_col(c) = 0._r8 - this%nfire_col(c) = 0._r8 - end if - end do - - ! ecophysiological and phenology variables - - do p = bounds%begp,bounds%endp - l = patch%landunit(p) - - if (lun%ifspecial(l)) then - this%annavg_t2m_patch (p) = spval - this%tempavg_t2m_patch (p) = spval - this%dormant_flag_patch(p) = spval - this%days_active_patch(p) = spval - this%onset_flag_patch(p) = spval - this%onset_counter_patch(p) = spval - this%onset_gddflag_patch(p) = spval - this%onset_fdd_patch(p) = spval - this%onset_gdd_patch(p) = spval - this%onset_swi_patch(p) = spval - this%offset_flag_patch(p) = spval - this%offset_counter_patch(p) = spval - this%offset_fdd_patch(p) = spval - this%offset_swi_patch(p) = spval - this%grain_flag_patch(p) = spval - this%lgsf_patch(p) = spval - this%bglfr_patch(p) = spval - this%bgtr_patch(p) = spval - this%c_allometry_patch(p) = spval - this%n_allometry_patch(p) = spval - this%tempsum_potential_gpp_patch(p) = spval - this%annsum_potential_gpp_patch(p) = spval - this%tempmax_retransn_patch(p) = spval - this%annmax_retransn_patch(p) = spval - this%downreg_patch(p) = spval - this%leafcn_offset_patch(p) = spval - this%plantCN_patch(p) = spval - end if - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - ! phenology variables - this%dormant_flag_patch(p) = 1._r8 - this%days_active_patch(p) = 0._r8 - this%onset_flag_patch(p) = 0._r8 - this%onset_counter_patch(p) = 0._r8 - this%onset_gddflag_patch(p) = 0._r8 - this%onset_fdd_patch(p) = 0._r8 - this%onset_gdd_patch(p) = 0._r8 - this%onset_swi_patch(p) = 0._r8 - this%offset_flag_patch(p) = 0._r8 - this%offset_counter_patch(p) = 0._r8 - this%offset_fdd_patch(p) = 0._r8 - this%offset_swi_patch(p) = 0._r8 - this%lgsf_patch(p) = 0._r8 - this%bglfr_patch(p) = 0._r8 - this%bgtr_patch(p) = 0._r8 - this%annavg_t2m_patch(p) = 280._r8 - this%tempavg_t2m_patch(p) = 0._r8 - this%grain_flag_patch(p) = 0._r8 - - ! non-phenology variables - this%c_allometry_patch(p) = 0._r8 - this%n_allometry_patch(p) = 0._r8 - this%tempsum_potential_gpp_patch(p) = 0._r8 - this%annsum_potential_gpp_patch(p) = 0._r8 - this%tempmax_retransn_patch(p) = 0._r8 - this%annmax_retransn_patch(p) = 0._r8 - this%downreg_patch(p) = 0._r8 - this%leafcn_offset_patch(p) = spval - this%plantCN_patch(p) = spval - end if - - end do - - ! fire variables - - do c = bounds%begc,bounds%endc - this%lfc2_col(c) = 0._r8 - end do - - end subroutine initCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag, cnveg_carbonstate, & - cnveg_nitrogenstate, filter_reseed_patch, num_reseed_patch) - ! - ! !USES: - use shr_log_mod, only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc - use abortutils , only : endrun - use CNVegNitrogenStateType, only: cnveg_nitrogenstate_type - use CNVegCarbonStateType , only: cnveg_carbonstate_type - use restUtilMod - use ncdio_pio - use pftconMod , only : pftcon - ! - ! !ARGUMENTS: - class(cnveg_state_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid - character(len=*) , intent(in) :: flag - type(cnveg_nitrogenstate_type), intent(in) :: cnveg_nitrogenstate - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate - integer , intent(out), optional :: filter_reseed_patch(:) - integer , intent(out), optional :: num_reseed_patch - ! - ! !LOCAL VARIABLES: - integer :: j,c,i,p ! indices - logical :: readvar ! determine if variable is on initial file - real(r8), pointer :: ptr2d(:,:) ! temp. pointers for slicing larger arrays - real(r8), pointer :: ptr1d(:) ! temp. pointers for slicing larger arrays - !----------------------------------------------------------------------- - - call restartvar(ncid=ncid, flag=flag, varname='dormant_flag', xtype=ncd_double, & - dim1name='pft', & - long_name='dormancy flag', units='unitless', & - interpinic_flag='interp', readvar=readvar, data=this%dormant_flag_patch) - - call restartvar(ncid=ncid, flag=flag, varname='days_active', xtype=ncd_double, & - dim1name='pft', & - long_name='number of days since last dormancy', units='days' , & - interpinic_flag='interp', readvar=readvar, data=this%days_active_patch) - - call restartvar(ncid=ncid, flag=flag, varname='onset_flag', xtype=ncd_double, & - dim1name='pft', & - long_name='flag if critical growing degree-day sum is exceeded', units='unitless' , & - interpinic_flag='interp', readvar=readvar, data=this%onset_flag_patch) - - call restartvar(ncid=ncid, flag=flag, varname='onset_counter', xtype=ncd_double, & - dim1name='pft', & - long_name='onset days counter', units='sec' , & - interpinic_flag='interp', readvar=readvar, data=this%onset_counter_patch) - - call restartvar(ncid=ncid, flag=flag, varname='onset_gddflag', xtype=ncd_double, & - dim1name='pft', & - long_name='onset flag for growing degree day sum', units='' , & - interpinic_flag='interp', readvar=readvar, data=this%onset_gddflag_patch) - - call restartvar(ncid=ncid, flag=flag, varname='onset_fdd', xtype=ncd_double, & - dim1name='pft', & - long_name='onset freezing degree days counter', units='days' , & - interpinic_flag='interp', readvar=readvar, data=this%onset_fdd_patch) - - call restartvar(ncid=ncid, flag=flag, varname='onset_gdd', xtype=ncd_double, & - dim1name='pft', & - long_name='onset growing degree days', units='days' , & - interpinic_flag='interp', readvar=readvar, data=this%onset_gdd_patch) - - call restartvar(ncid=ncid, flag=flag, varname='onset_swi', xtype=ncd_double, & - dim1name='pft', & - long_name='onset soil water index', units='days' , & - interpinic_flag='interp', readvar=readvar, data=this%onset_swi_patch) - - call restartvar(ncid=ncid, flag=flag, varname='offset_flag', xtype=ncd_double, & - dim1name='pft', & - long_name='offset flag', units='unitless' , & - interpinic_flag='interp', readvar=readvar, data=this%offset_flag_patch) - - call restartvar(ncid=ncid, flag=flag, varname='offset_counter', xtype=ncd_double, & - dim1name='pft', & - long_name='offset days counter', units='sec' , & - interpinic_flag='interp', readvar=readvar, data=this%offset_counter_patch) - - call restartvar(ncid=ncid, flag=flag, varname='offset_fdd', xtype=ncd_double, & - dim1name='pft', & - long_name='offset freezing degree days counter', units='days' , & - interpinic_flag='interp', readvar=readvar, data=this%offset_fdd_patch) - - call restartvar(ncid=ncid, flag=flag, varname='offset_swi', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%offset_swi_patch) - - call restartvar(ncid=ncid, flag=flag, varname='lgsf', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%lgsf_patch) - - call restartvar(ncid=ncid, flag=flag, varname='bglfr', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%bglfr_patch) - - call restartvar(ncid=ncid, flag=flag, varname='bgtr', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%bgtr_patch) - - call restartvar(ncid=ncid, flag=flag, varname='annavg_t2m', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%annavg_t2m_patch) - - call restartvar(ncid=ncid, flag=flag, varname='tempavg_t2m', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tempavg_t2m_patch) - - call restartvar(ncid=ncid, flag=flag, varname='c_allometry', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%c_allometry_patch) - - call restartvar(ncid=ncid, flag=flag, varname='n_allometry', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%n_allometry_patch) - - call restartvar(ncid=ncid, flag=flag, varname='tempsum_potential_gpp', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tempsum_potential_gpp_patch) - - call restartvar(ncid=ncid, flag=flag, varname='annsum_potential_gpp', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%annsum_potential_gpp_patch) - - call restartvar(ncid=ncid, flag=flag, varname='tempmax_retransn', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tempmax_retransn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='annmax_retransn', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%annmax_retransn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='downreg', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%downreg_patch) - - call restartvar(ncid=ncid, flag=flag, varname='leafcn_offset', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafcn_offset_patch) - - call restartvar(ncid=ncid, flag=flag, varname='plantCN', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%plantCN_patch) - - call restartvar(ncid=ncid, flag=flag, varname='annsum_counter', xtype=ncd_double, & - dim1name='column', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%annsum_counter_col) - - call restartvar(ncid=ncid, flag=flag, varname='burndate', xtype=ncd_int, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%burndate_patch) - - call restartvar(ncid=ncid, flag=flag, varname='lfc', xtype=ncd_double, & - dim1name='column', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%lfc_col) - - call restartvar(ncid=ncid, flag=flag, varname='cannavg_t2m', xtype=ncd_double, & - dim1name='column', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%annavg_t2m_col) - - if (use_crop) then - - call restartvar(ncid=ncid, flag=flag, varname='htmx', xtype=ncd_double, & - dim1name='pft', long_name='max height attained by a crop during year', units='m', & - interpinic_flag='interp', readvar=readvar, data=this%htmx_patch) - - call restartvar(ncid=ncid, flag=flag, varname='peaklai', xtype=ncd_int, & - dim1name='pft', long_name='Flag if at max allowed LAI or not', & - flag_values=(/0,1/), nvalid_range=(/0,1/), & - flag_meanings=(/'NOT-at-peak', 'AT_peak-LAI' /) , & - interpinic_flag='interp', readvar=readvar, data=this%peaklai_patch) - - call restartvar(ncid=ncid, flag=flag, varname='idop', xtype=ncd_int, & - dim1name='pft', long_name='Date of planting', units='jday', nvalid_range=(/1,366/), & - interpinic_flag='interp', readvar=readvar, data=this%idop_patch) - - call restartvar(ncid=ncid, flag=flag, varname='aleaf', xtype=ncd_double, & - dim1name='pft', long_name='leaf allocation coefficient', units='', & - interpinic_flag='interp', readvar=readvar, data=this%aleaf_patch) - - call restartvar(ncid=ncid, flag=flag, varname='aleafi', xtype=ncd_double, & - dim1name='pft', long_name='Saved leaf allocation coefficient from phase 2', units='', & - interpinic_flag='interp', readvar=readvar, data=this%aleafi_patch) - - call restartvar(ncid=ncid, flag=flag, varname='astem', xtype=ncd_double, & - dim1name='pft', long_name='stem allocation coefficient', units='', & - interpinic_flag='interp', readvar=readvar, data=this%astem_patch) - - call restartvar(ncid=ncid, flag=flag, varname='astemi', xtype=ncd_double, & - dim1name='pft', long_name='Saved stem allocation coefficient from phase 2', units='', & - interpinic_flag='interp', readvar=readvar, data=this%astemi_patch) - - call restartvar(ncid=ncid, flag=flag, varname='hdidx', xtype=ncd_double, & - dim1name='pft', long_name='cold hardening index', units='', & - interpinic_flag='interp', readvar=readvar, data=this%hdidx_patch) - - call restartvar(ncid=ncid, flag=flag, varname='cumvd', xtype=ncd_double, & - dim1name='pft', long_name='cumulative vernalization d', units='', & - interpinic_flag='interp', readvar=readvar, data=this%cumvd_patch) - - call restartvar(ncid=ncid, flag=flag, varname='gddmaturity', xtype=ncd_double, & - dim1name='pft', long_name='Growing degree days needed to harvest', units='ddays', & - interpinic_flag='interp', readvar=readvar, data=this%gddmaturity_patch) - - call restartvar(ncid=ncid, flag=flag, varname='huileaf', xtype=ncd_double, & - dim1name='pft', long_name='heat unit index needed from planting to leaf emergence', units='', & - interpinic_flag='interp', readvar=readvar, data=this%huileaf_patch) - - call restartvar(ncid=ncid, flag=flag, varname='huigrain', xtype=ncd_double, & - dim1name='pft', long_name='heat unit index needed to reach vegetative maturity', units='', & - interpinic_flag='interp', readvar=readvar, data=this%huigrain_patch) - - call restartvar(ncid=ncid, flag=flag, varname='grain_flag', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%grain_flag_patch) - end if - if ( flag == 'read' .and. num_reseed_patch > 0 )then - if ( masterproc ) write(iulog, *) 'Reseed dead plants for CNVegState' - do i = 1, num_reseed_patch - p = filter_reseed_patch(i) - ! phenology variables - this%dormant_flag_patch(p) = 1._r8 - this%days_active_patch(p) = 0._r8 - this%onset_flag_patch(p) = 0._r8 - this%onset_counter_patch(p) = 0._r8 - this%onset_gddflag_patch(p) = 0._r8 - this%onset_fdd_patch(p) = 0._r8 - this%onset_gdd_patch(p) = 0._r8 - this%onset_swi_patch(p) = 0._r8 - this%offset_flag_patch(p) = 0._r8 - this%offset_counter_patch(p) = 0._r8 - this%offset_fdd_patch(p) = 0._r8 - this%offset_swi_patch(p) = 0._r8 - this%lgsf_patch(p) = 0._r8 - this%bglfr_patch(p) = 0._r8 - this%bgtr_patch(p) = 0._r8 - this%annavg_t2m_patch(p) = 280._r8 - this%tempavg_t2m_patch(p) = 0._r8 - this%grain_flag_patch(p) = 0._r8 - - this%c_allometry_patch(p) = 0._r8 - this%n_allometry_patch(p) = 0._r8 - this%tempsum_potential_gpp_patch(p) = 0._r8 - this%annsum_potential_gpp_patch(p) = 0._r8 - this%tempmax_retransn_patch(p) = 0._r8 - this%annmax_retransn_patch(p) = 0._r8 - this%downreg_patch(p) = 0._r8 - this%leafcn_offset_patch(p) = spval - this%plantCN_patch(p) = spval - end do - end if - - end subroutine Restart - -end module CNVegStateType diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 deleted file mode 100644 index 27b677b04d..0000000000 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ /dev/null @@ -1,307 +0,0 @@ -module CNVegStructUpdateMod - - !----------------------------------------------------------------------- - ! Module for vegetation structure updates (LAI, SAI, htop, hbot) - ! - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_PI - use clm_varctl , only : iulog, use_cndv - use CNDVType , only : dgv_ecophyscon - use WaterStateType , only : waterstate_type - use FrictionVelocityMod , only : frictionvel_type - use CNDVType , only : dgvs_type - use CNVegStateType , only : cnveg_state_type - use CropType , only : crop_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CanopyStateType , only : canopystate_type - use PatchType , only : patch - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: CNVegStructUpdate - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CNVegStructUpdate(num_soilp, filter_soilp, & - waterstate_inst, frictionvel_inst, dgvs_inst, cnveg_state_inst, crop_inst, & - cnveg_carbonstate_inst, canopystate_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, use C state variables and epc to diagnose - ! vegetation structure (LAI, SAI, height) - ! - ! !USES: - use pftconMod , only : noveg, nc3crop, nc3irrig, nbrdlf_evr_shrub, nbrdlf_dcd_brl_shrub - use pftconMod , only : npcropmin - use pftconMod , only : ntmp_corn, nirrig_tmp_corn - use pftconMod , only : ntrp_corn, nirrig_trp_corn - use pftconMod , only : nsugarcane, nirrig_sugarcane - use pftconMod , only : pftcon - use clm_varctl , only : spinup_state - use clm_time_manager , only : get_rad_step_size - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilp ! number of column soil points in patch filter - integer , intent(in) :: filter_soilp(:) ! patch filter for soil points - type(waterstate_type) , intent(in) :: waterstate_inst - type(frictionvel_type) , intent(in) :: frictionvel_inst - type(dgvs_type) , intent(in) :: dgvs_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(crop_type) , intent(in) :: crop_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - ! - ! !REVISION HISTORY: - ! 10/28/03: Created by Peter Thornton - ! 2/29/08, David Lawrence: revised snow burial fraction for short vegetation - ! - ! !LOCAL VARIABLES: - integer :: p,c,g ! indices - integer :: fp ! lake filter indices - real(r8) :: taper ! ratio of height:radius_breast_height (tree allometry) - real(r8) :: stocking ! #stems / ha (stocking density) - real(r8) :: ol ! thickness of canopy layer covered by snow (m) - real(r8) :: fb ! fraction of canopy layer covered by snow - real(r8) :: tlai_old ! for use in Zeng tsai formula - real(r8) :: tsai_old ! for use in Zeng tsai formula - real(r8) :: tsai_min ! PATCH derived minimum tsai - real(r8) :: tsai_alpha ! monthly decay rate of tsai - real(r8) :: dt ! radiation time step (sec) - - real(r8), parameter :: dtsmonth = 2592000._r8 ! number of seconds in a 30 day month (60x60x24x30) - !----------------------------------------------------------------------- - ! tsai formula from Zeng et. al. 2002, Journal of Climate, p1835 - ! - ! tsai(p) = max( tsai_alpha(ivt(p))*tsai_old + max(tlai_old-tlai(p),0_r8), tsai_min(ivt(p)) ) - ! notes: - ! * RHS tsai & tlai are from previous timestep - ! * should create tsai_alpha(ivt(p)) & tsai_min(ivt(p)) in pftconMod.F90 - slevis - ! * all non-crop patches use same values: - ! crop tsai_alpha,tsai_min = 0.0,0.1 - ! noncrop tsai_alpha,tsai_min = 0.5,1.0 (includes bare soil and urban) - !------------------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - slatop => pftcon%slatop , & ! Input: specific leaf area at top of canopy, projected area basis [m^2/gC] - dsladlai => pftcon%dsladlai , & ! Input: dSLA/dLAI, projected area basis [m^2/gC] - z0mr => pftcon%z0mr , & ! Input: ratio of momentum roughness length to canopy top height (-) - displar => pftcon%displar , & ! Input: ratio of displacement height to canopy top height (-) - dwood => pftcon%dwood , & ! Input: density of wood (gC/m^3) - ztopmx => pftcon%ztopmx , & ! Input: - laimx => pftcon%laimx , & ! Input: - - allom2 => dgv_ecophyscon%allom2 , & ! Input: [real(r8) (:) ] ecophys const - allom3 => dgv_ecophyscon%allom3 , & ! Input: [real(r8) (:) ] ecophys const - - nind => dgvs_inst%nind_patch , & ! Input: [real(r8) (:) ] number of individuals (#/m**2) - fpcgrid => dgvs_inst%fpcgrid_patch , & ! Input: [real(r8) (:) ] fractional area of patch (pft area/nat veg area) - - snow_depth => waterstate_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - - forc_hgt_u_patch => frictionvel_inst%forc_hgt_u_patch , & ! Input: [real(r8) (:) ] observational height of wind at patch-level [m] - - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C - deadstemc => cnveg_carbonstate_inst%deadstemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C - - farea_burned => cnveg_state_inst%farea_burned_col , & ! Input: [real(r8) (:) ] F. Li and S. Levis - htmx => cnveg_state_inst%htmx_patch , & ! Output: [real(r8) (:) ] max hgt attained by a crop during yr (m) - peaklai => cnveg_state_inst%peaklai_patch , & ! Output: [integer (:) ] 1: max allowed lai; 0: not at max - - harvdate => crop_inst%harvdate_patch , & ! Input: [integer (:) ] harvest date - - ! *** Key Output from CN*** - tlai => canopystate_inst%tlai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index, no burying by snow - tsai => canopystate_inst%tsai_patch , & ! Output: [real(r8) (:) ] one-sided stem area index, no burying by snow - htop => canopystate_inst%htop_patch , & ! Output: [real(r8) (:) ] canopy top (m) - hbot => canopystate_inst%hbot_patch , & ! Output: [real(r8) (:) ] canopy bottom (m) - elai => canopystate_inst%elai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index with burying by snow - esai => canopystate_inst%esai_patch , & ! Output: [real(r8) (:) ] one-sided stem area index with burying by snow - frac_veg_nosno_alb => canopystate_inst%frac_veg_nosno_alb_patch & ! Output: [integer (:) ] frac of vegetation not covered by snow [-] - ) - - dt = real( get_rad_step_size(), r8 ) - - ! constant allometric parameters - taper = 200._r8 - stocking = 1000._r8 - - ! convert from stems/ha -> stems/m^2 - stocking = stocking / 10000._r8 - - ! patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - g = patch%gridcell(p) - - if (ivt(p) /= noveg) then - - tlai_old = tlai(p) ! n-1 value - tsai_old = tsai(p) ! n-1 value - - ! update the leaf area index based on leafC and SLA - ! Eq 3 from Thornton and Zimmerman, 2007, J Clim, 20, 3902-3923. - if (dsladlai(ivt(p)) > 0._r8) then - tlai(p) = (slatop(ivt(p))*(exp(leafc(p)*dsladlai(ivt(p))) - 1._r8))/dsladlai(ivt(p)) - else - tlai(p) = slatop(ivt(p)) * leafc(p) - end if - tlai(p) = max(0._r8, tlai(p)) - - ! update the stem area index and height based on LAI, stem mass, and veg type. - ! With the exception of htop for woody vegetation, this follows the DGVM logic. - - ! tsai formula from Zeng et. al. 2002, Journal of Climate, p1835 (see notes) - ! Assumes doalb time step .eq. CLM time step, SAI min and monthly decay factor - ! alpha are set by PFT, and alpha is scaled to CLM time step by multiplying by - ! dt and dividing by dtsmonth (seconds in average 30 day month) - ! tsai_min scaled by 0.5 to match MODIS satellite derived values - if (ivt(p) == nc3crop .or. ivt(p) == nc3irrig) then ! generic crops - - tsai_alpha = 1.0_r8-1.0_r8*dt/dtsmonth - tsai_min = 0.1_r8 - else - tsai_alpha = 1.0_r8-0.5_r8*dt/dtsmonth - tsai_min = 1.0_r8 - end if - tsai_min = tsai_min * 0.5_r8 - tsai(p) = max(tsai_alpha*tsai_old+max(tlai_old-tlai(p),0._r8),tsai_min) - - if (woody(ivt(p)) == 1._r8) then - - ! trees and shrubs - - ! if shrubs have a squat taper - if (ivt(p) >= nbrdlf_evr_shrub .and. ivt(p) <= nbrdlf_dcd_brl_shrub) then - taper = 10._r8 - ! otherwise have a tall taper - else - taper = 200._r8 - end if - - ! trees and shrubs for now have a very simple allometry, with hard-wired - ! stem taper (height:radius) and hard-wired stocking density (#individuals/area) - if (use_cndv) then - - if (fpcgrid(p) > 0._r8 .and. nind(p) > 0._r8) then - - stocking = nind(p)/fpcgrid(p) !#ind/m2 nat veg area -> #ind/m2 patch area - htop(p) = allom2(ivt(p)) * ( (24._r8 * deadstemc(p) / & - (SHR_CONST_PI * stocking * dwood(ivt(p)) * taper))**(1._r8/3._r8) )**allom3(ivt(p)) ! lpj's htop w/ cn's stemdiam - - else - htop(p) = 0._r8 - end if - - else - !correct height calculation if doing accelerated spinup - if (spinup_state == 2) then - htop(p) = ((3._r8 * deadstemc(p) * 10._r8 * taper * taper)/ & - (SHR_CONST_PI * stocking * dwood(ivt(p))))**(1._r8/3._r8) - else - htop(p) = ((3._r8 * deadstemc(p) * taper * taper)/ & - (SHR_CONST_PI * stocking * dwood(ivt(p))))**(1._r8/3._r8) - end if - - endif - - ! Peter Thornton, 5/3/2004 - ! Adding test to keep htop from getting too close to forcing height for windspeed - ! Also added for grass, below, although it is not likely to ever be an issue. - htop(p) = min(htop(p),(forc_hgt_u_patch(p)/(displar(ivt(p))+z0mr(ivt(p))))-3._r8) - - ! Peter Thornton, 8/11/2004 - ! Adding constraint to keep htop from going to 0.0. - ! This becomes an issue when fire mortality is pushing deadstemc - ! to 0.0. - htop(p) = max(htop(p), 0.01_r8) - - hbot(p) = max(0._r8, min(3._r8, htop(p)-1._r8)) - - else if (ivt(p) >= npcropmin) then ! prognostic crops - - if (tlai(p) >= laimx(ivt(p))) peaklai(p) = 1 ! used in CNAllocation - - if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & - ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & - ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane) then - tsai(p) = 0.1_r8 * tlai(p) - else - tsai(p) = 0.2_r8 * tlai(p) - end if - - ! "stubble" after harvest - if (harvdate(p) < 999 .and. tlai(p) == 0._r8) then - tsai(p) = 0.25_r8*(1._r8-farea_burned(c)*0.90_r8) !changed by F. Li and S. Levis - htmx(p) = 0._r8 - peaklai(p) = 0 - end if - !if (harvdate(p) < 999 .and. tlai(p) > 0._r8) write(iulog,*) 'CNVegStructUpdate: tlai>0 after harvest!' ! remove after initial debugging? - - ! canopy top and bottom heights - htop(p) = ztopmx(ivt(p)) * (min(tlai(p)/(laimx(ivt(p))-1._r8),1._r8))**2 - htmx(p) = max(htmx(p), htop(p)) - htop(p) = max(0.05_r8, max(htmx(p),htop(p))) - hbot(p) = 0.02_r8 - - else ! generic crops and ... - - ! grasses - - ! height for grasses depends only on LAI - htop(p) = max(0.25_r8, tlai(p) * 0.25_r8) - - htop(p) = min(htop(p),(forc_hgt_u_patch(p)/(displar(ivt(p))+z0mr(ivt(p))))-3._r8) - - ! Peter Thornton, 8/11/2004 - ! Adding constraint to keep htop from going to 0.0. - htop(p) = max(htop(p), 0.01_r8) - - hbot(p) = max(0.0_r8, min(0.05_r8, htop(p)-0.20_r8)) - end if - - else - - tlai(p) = 0._r8 - tsai(p) = 0._r8 - htop(p) = 0._r8 - hbot(p) = 0._r8 - - end if - - ! adjust lai and sai for burying by snow. - ! snow burial fraction for short vegetation (e.g. grasses) as in - ! Wang and Zeng, 2007. - if (ivt(p) > noveg .and. ivt(p) <= nbrdlf_dcd_brl_shrub ) then - ol = min( max(snow_depth(c)-hbot(p), 0._r8), htop(p)-hbot(p)) - fb = 1._r8 - ol / max(1.e-06_r8, htop(p)-hbot(p)) - else - fb = 1._r8 - max(min(snow_depth(c),0.2_r8),0._r8)/0.2_r8 ! 0.2m is assumed - !depth of snow required for complete burial of grasses - endif - - elai(p) = max(tlai(p)*fb, 0.0_r8) - esai(p) = max(tsai(p)*fb, 0.0_r8) - - ! Fraction of vegetation free of snow - if ((elai(p) + esai(p)) > 0._r8) then - frac_veg_nosno_alb(p) = 1 - else - frac_veg_nosno_alb(p) = 0 - end if - - end do - - end associate - - end subroutine CNVegStructUpdate - -end module CNVegStructUpdateMod diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 deleted file mode 100644 index 02d0f98ab0..0000000000 --- a/src/biogeochem/CNVegetationFacade.F90 +++ /dev/null @@ -1,422 +0,0 @@ -module CNVegetationFacade - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Facade for the CN Vegetation subsystem. - ! - ! (A "facade", in software engineering terms, is a unified interface to a set of - ! interfaces in a subsystem. The facade defines a higher-level interface that makes the - ! subsystem easier to use.) - ! - ! NOTE(wjs, 2016-02-19) I envision that we will introduce an abstract base class - ! (VegBase). Then both CNVeg and EDVeg will extend VegBase. The rest of the CLM code can - ! then have an instance of VegBase, which depending on the run, can be either a CNVeg or - ! EDVeg instance. - ! - ! In addition, we probably want an implementation when running without CN or fates - i.e., - ! an SPVeg inst. This would provide implementations for get_leafn_patch, - ! get_downreg_patch, etc., so that we don't need to handle the non-cn case here (note - ! that, currently, we return NaN for most of these getters, because these arrays are - ! invalid and shouldn't be used when running in SP mode). Also, in its EcosystemDynamics - ! routine, it would call SatellitePhenology (but note that the desired interface for - ! EcosystemDynamics would be quite different... could just pass everything needed by any - ! model, and ignore unneeded arguments). Then we can get rid of comments in this module - ! like, "only call if use_cn is true", as well as use_cn conditionals in this module. - ! - ! NOTE(wjs, 2016-02-23) Currently, SatellitePhenology is called even when running with - ! CN, for the sake of dry deposition. This seems weird to me, and my gut feeling - - ! without understanding it well - is that this should be rewritten to depend on LAI from - ! CN rather than from satellite phenology. Until that is done, the separation between SP - ! and other Veg modes will be messier. - ! - ! NOTE(wjs, 2016-02-23) Currently, this class coordinates calls to soil BGC routines as - ! well as veg BGC routines (even though it doesn't contain any soil BGC types). This is - ! because CNDriver coordinates both the veg & soil BGC. We should probably split up - ! CNDriver so that there is a cleaner separation between veg BGC and soil BGC, to allow - ! easier swapping of (for example) CN and ED. At that point, this class could - ! coordinate just the calls to veg BGC routines, with a similar facade class - ! coordinating the calls to soil BGC routines. - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use perf_mod , only : t_startf, t_stopf - use decompMod , only : bounds_type - use clm_varctl , only : iulog, use_cn - use abortutils , only : endrun - use spmdMod , only : masterproc - use CNBalanceCheckMod , only : cn_balance_type - use CNVegStateType , only : cnveg_state_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNProductsMod , only : cn_products_type - use SpeciesIsotopeType , only : species_isotope_type - use SpeciesNonIsotopeType , only : species_non_isotope_type - use CNDriverMod , only : CNDriverInit - ! - implicit none - private - - ! !PUBLIC TYPES: - - type, public :: cn_vegetation_type - ! FIXME(bja, 2016-06) These need to be public for use when fates is - ! turned on. Should either be moved out of here or create some ED - ! version of the facade.... - type(cnveg_state_type) :: cnveg_state_inst - type(cnveg_carbonstate_type) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) :: cnveg_carbonflux_inst - - !X!private - - type(cnveg_carbonstate_type) :: c13_cnveg_carbonstate_inst - type(cnveg_carbonstate_type) :: c14_cnveg_carbonstate_inst - type(cnveg_carbonflux_type) :: c13_cnveg_carbonflux_inst - type(cnveg_carbonflux_type) :: c14_cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) :: cnveg_nitrogenstate_inst - type(cnveg_nitrogenflux_type) :: cnveg_nitrogenflux_inst - - type(cn_products_type) :: c_products_inst - type(cn_products_type) :: c13_products_inst - type(cn_products_type) :: c14_products_inst - type(cn_products_type) :: n_products_inst - - type(cn_balance_type) :: cn_balance_inst - - ! Control variables - logical, private :: reseed_dead_plants ! Flag to indicate if should reseed dead plants when starting up the model - - ! TODO(wjs, 2016-02-19) Evaluate whether some other variables should be moved in - ! here. Whether they should be moved in depends on how tightly they are tied in with - ! the other CN Vegetation stuff. A question to ask is: Is this module used when - ! running with SP or ED? If so, then it should probably remain outside of CNVeg. - ! - ! From the clm_instMod section on "CN vegetation types": - ! - nutrient_competition_method - ! - I'm pretty sure this should be moved into here; it's just a little messy to do - ! so, because of how it's initialized (specifically, the call to readParameters - ! in clm_initializeMod). - ! - ! From the clm_instMod section on "general biogeochem types": - ! - ch4_inst - ! - probably not: really seems to belong in soilbiogeochem - ! - crop_inst - ! - dust_inst - ! - vocemis_inst - ! - fireemis_inst - ! - drydepvel_inst - - contains - procedure, public :: Init - procedure, public :: InitAccBuffer - procedure, public :: InitAccVars - procedure, public :: Restart - - procedure, public :: Init2 ! Do initialization in initialize phase, after subgrid weights are determined - procedure, public :: WriteHistory ! Do any history writes that are specific to veg dynamics - - procedure, public :: get_totvegc_col ! Get column-level total vegetation carbon array - - procedure, private :: CNReadNML ! Read in the CN general namelist - end type cn_vegetation_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - subroutine Init(this, bounds, NLFilename) - ! - ! !DESCRIPTION: - ! Initialize a CNVeg object. - ! - ! Should be called regardless of whether use_cn is true - ! - ! !USES: - use clm_varcon , only : c13ratio, c14ratio - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - character(len=*) , intent(in) :: NLFilename ! namelist filename - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - - character(len=*), parameter :: subname = 'Init' - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - - ! Note - always initialize the memory for cnveg_state_inst (used in biogeophys/) - call this%cnveg_state_inst%Init(bounds) - - if (use_cn) then - - ! Read in the general CN namelist - call this%CNReadNML( NLFilename ) ! MUST be called first as passes down control information to others - - call this%cnveg_carbonstate_inst%Init(bounds, carbon_type='c12', ratio=1._r8, NLFilename=NLFilename) - call this%cnveg_carbonflux_inst%Init(bounds, carbon_type='c12') - call this%cnveg_nitrogenstate_inst%Init(bounds, & - this%cnveg_carbonstate_inst%leafc_patch(begp:endp), & - this%cnveg_carbonstate_inst%leafc_storage_patch(begp:endp), & - this%cnveg_carbonstate_inst%frootc_patch(begp:endp), & - this%cnveg_carbonstate_inst%frootc_storage_patch(begp:endp), & - this%cnveg_carbonstate_inst%deadstemc_patch(begp:endp) ) - call this%cnveg_nitrogenflux_inst%Init(bounds) - - call this%c_products_inst%Init(bounds, species_non_isotope_type('C')) - call this%n_products_inst%Init(bounds, species_non_isotope_type('N')) - - call this%cn_balance_inst%Init(bounds) - - end if - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine CNReadNML( this, NLFilename ) - ! - ! !DESCRIPTION: - ! Read in the general CN control namelist - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(inout) :: this - character(len=*) , intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'CNReadNML' - character(len=*), parameter :: nmlname = 'cn_general' ! MUST match what is in namelist below - !----------------------------------------------------------------------- - logical :: reseed_dead_plants - namelist /cn_general/ reseed_dead_plants - - reseed_dead_plants = this%reseed_dead_plants - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=cn_general, iostat=ierr) ! Namelist name here MUST be the same as in nmlname above! - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (reseed_dead_plants , mpicom) - - this%reseed_dead_plants = reseed_dead_plants - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=cn_general) ! Name here MUST be the same as in nmlname above! - write(iulog,*) ' ' - end if - - !----------------------------------------------------------------------- - - end subroutine CNReadNML - - - !----------------------------------------------------------------------- - subroutine InitAccBuffer(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize accumulation buffer for types contained here - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'InitAccBuffer' - !----------------------------------------------------------------------- - - end subroutine InitAccBuffer - - !----------------------------------------------------------------------- - subroutine InitAccVars(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize variables that are associated with accumulated fields - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'InitAccVars' - !----------------------------------------------------------------------- - - end subroutine InitAccVars - - !----------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag) - ! - ! !DESCRIPTION: - ! Handle restart (read / write) for CNVeg - ! - ! Should be called regardless of whether use_cn is true - ! - ! !USES: - use ncdio_pio, only : file_desc_t - use clm_varcon, only : c3_r2, c14ratio - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid - character(len=*) , intent(in) :: flag - integer :: reseed_patch(bounds%endp-bounds%begp+1) - integer :: num_reseed_patch - ! - ! !LOCAL VARIABLES: - - integer :: begp, endp - - character(len=*), parameter :: subname = 'Restart' - !----------------------------------------------------------------------- - - if (use_cn) then - begp = bounds%begp - endp = bounds%endp - call this%cnveg_carbonstate_inst%restart(bounds, ncid, flag=flag, carbon_type='c12', & - reseed_dead_plants=this%reseed_dead_plants, filter_reseed_patch=reseed_patch, & - num_reseed_patch=num_reseed_patch ) - if ( flag /= 'read' .and. num_reseed_patch /= 0 )then - call endrun(msg="ERROR num_reseed should be zero and is not"//errmsg(sourcefile, __LINE__)) - end if - call this%cnveg_carbonflux_inst%restart(bounds, ncid, flag=flag, carbon_type='c12') - - call this%cnveg_nitrogenstate_inst%restart(bounds, ncid, flag=flag, & - leafc_patch=this%cnveg_carbonstate_inst%leafc_patch(begp:endp), & - leafc_storage_patch=this%cnveg_carbonstate_inst%leafc_storage_patch(begp:endp), & - frootc_patch=this%cnveg_carbonstate_inst%frootc_patch(begp:endp), & - frootc_storage_patch=this%cnveg_carbonstate_inst%frootc_storage_patch(begp:endp), & - deadstemc_patch=this%cnveg_carbonstate_inst%deadstemc_patch(begp:endp), & - filter_reseed_patch=reseed_patch, num_reseed_patch=num_reseed_patch) - call this%cnveg_nitrogenflux_inst%restart(bounds, ncid, flag=flag) - call this%cnveg_state_inst%restart(bounds, ncid, flag=flag, & - cnveg_carbonstate=this%cnveg_carbonstate_inst, & - cnveg_nitrogenstate=this%cnveg_nitrogenstate_inst, & - filter_reseed_patch=reseed_patch, num_reseed_patch=num_reseed_patch) - - call this%c_products_inst%restart(bounds, ncid, flag) - call this%n_products_inst%restart(bounds, ncid, flag) - - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine Init2(this, bounds, NLFilename) - ! - ! !DESCRIPTION: - ! Do initialization that is needed in the initialize phase, after subgrid weights are - ! determined - ! - ! Should only be called if use_cn is true - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - character(len=*) , intent(in) :: NLFilename ! namelist filename - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'Init2' - !----------------------------------------------------------------------- - - call CNDriverInit(bounds, NLFilename ) - - end subroutine Init2 - - - !----------------------------------------------------------------------- - subroutine WriteHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Do any history writes that are specific to vegetation dynamics - ! - ! NOTE(wjs, 2016-02-23) This could probably be combined with - ! EndOfTimeStepVegDynamics, except for the fact that (currently) history writes are - ! done with proc bounds rather than clump bounds. If that were changed, then the body - ! of this could be moved into EndOfTimeStepVegDynamics, inside a "if (.not. - ! use_noio)" conditional. - ! - ! Should only be called if use_cn is true - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(in) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'WriteHistory' - !----------------------------------------------------------------------- - - end subroutine WriteHistory - - !----------------------------------------------------------------------- - function get_totvegc_col(this, bounds) result(totvegc_col) - ! - ! !DESCRIPTION: - ! Get column-level total vegetation carbon array - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - real(r8) :: totvegc_col(bounds%begc:bounds%endc) ! function result: (gC/m2) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_totvegc_col' - !----------------------------------------------------------------------- - - if (use_cn) then - totvegc_col(bounds%begc:bounds%endc) = & - this%cnveg_carbonstate_inst%totvegc_col(bounds%begc:bounds%endc) - else - totvegc_col(bounds%begc:bounds%endc) = nan - end if - - end function get_totvegc_col - - -end module CNVegetationFacade diff --git a/src/biogeochem/CropType.F90 b/src/biogeochem/CropType.F90 deleted file mode 100644 index 1b28927b35..0000000000 --- a/src/biogeochem/CropType.F90 +++ /dev/null @@ -1,644 +0,0 @@ -module CropType - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing variables needed for the crop model - ! - ! TODO(wjs, 2014-08-05) Move more crop-specific variables into here - many are - ! currently in CNVegStateType - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc - use abortutils , only : endrun - use decompMod , only : bounds_type - use clm_varcon , only : spval - use clm_varctl , only : iulog, use_crop - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC DATA TYPES: - ! - ! Crop state variables structure - type, public :: crop_type - - ! Note that cropplant and harvdate could be 2D to facilitate rotation - integer , pointer :: nyrs_crop_active_patch (:) ! number of years this crop patch has been active (0 for non-crop patches) - logical , pointer :: croplive_patch (:) ! patch Flag, true if planted, not harvested - logical , pointer :: cropplant_patch (:) ! patch Flag, true if planted - integer , pointer :: harvdate_patch (:) ! patch harvest date - real(r8), pointer :: fertnitro_patch (:) ! patch fertilizer nitrogen - real(r8), pointer :: gddplant_patch (:) ! patch accum gdd past planting date for crop (ddays) - real(r8), pointer :: gddtsoi_patch (:) ! patch growing degree-days from planting (top two soil layers) (ddays) - real(r8), pointer :: vf_patch (:) ! patch vernalization factor for cereal - real(r8), pointer :: cphase_patch (:) ! phenology phase - real(r8), pointer :: latbaset_patch (:) ! Latitude vary baset for gddplant (degree C) - character(len=20) :: baset_mapping - real(r8) :: baset_latvary_intercept - real(r8) :: baset_latvary_slope - - contains - ! Public routines - procedure, public :: Init ! Initialize the crop type - procedure, public :: InitAccBuffer - procedure, public :: InitAccVars - procedure, public :: Restart - ! NOTE(wjs, 2014-09-29) need to rename this from UpdateAccVars to CropUpdateAccVars - ! to prevent cryptic error messages with pgi (v. 13.9 on yellowstone) - ! This is probably related to this bug - ! , which was fixed in pgi 14.7. - procedure, public :: CropUpdateAccVars - - procedure, public :: CropIncrementYear - - ! Private routines - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - procedure, private, nopass :: checkDates - - end type crop_type - - character(len=*), parameter, private :: baset_map_constant = 'constant' - character(len=*), parameter, private :: baset_map_latvary = 'varytropicsbylat' - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !------------------------------------------------------------------------ - -contains - - !----------------------------------------------------------------------- - subroutine Init(this, bounds) - ! - ! !ARGUMENTS: - class(crop_type) , intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'Init' - !----------------------------------------------------------------------- - - call this%InitAllocate(bounds) - - if (use_crop) then - call this%InitHistory(bounds) - call this%InitCold(bounds) - end if - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! !USES: - ! - ! !ARGUMENTS: - class(crop_type) , intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - - character(len=*), parameter :: subname = 'InitAllocate' - !----------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - allocate(this%nyrs_crop_active_patch(begp:endp)) ; this%nyrs_crop_active_patch(:) = 0 - allocate(this%croplive_patch (begp:endp)) ; this%croplive_patch (:) = .false. - allocate(this%cropplant_patch(begp:endp)) ; this%cropplant_patch(:) = .false. - allocate(this%harvdate_patch (begp:endp)) ; this%harvdate_patch (:) = huge(1) - allocate(this%fertnitro_patch (begp:endp)) ; this%fertnitro_patch (:) = spval - allocate(this%gddplant_patch (begp:endp)) ; this%gddplant_patch (:) = spval - allocate(this%gddtsoi_patch (begp:endp)) ; this%gddtsoi_patch (:) = spval - allocate(this%vf_patch (begp:endp)) ; this%vf_patch (:) = 0.0_r8 - allocate(this%cphase_patch (begp:endp)) ; this%cphase_patch (:) = 0.0_r8 - allocate(this%latbaset_patch (begp:endp)) ; this%latbaset_patch (:) = spval - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !USES: - use histFileMod , only : hist_addfld1d - ! - ! !ARGUMENTS: - class(crop_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - - character(len=*), parameter :: subname = 'InitHistory' - !----------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - this%fertnitro_patch(begp:endp) = spval - call hist_addfld1d (fname='FERTNITRO', units='gN/m2/yr', & - avgflag='A', long_name='Nitrogen fertilizer for each crop', & - ptr_patch=this%fertnitro_patch, default='inactive') - - this%gddplant_patch(begp:endp) = spval - call hist_addfld1d (fname='GDDPLANT', units='ddays', & - avgflag='A', long_name='Accumulated growing degree days past planting date for crop', & - ptr_patch=this%gddplant_patch, default='inactive') - - this%gddtsoi_patch(begp:endp) = spval - call hist_addfld1d (fname='GDDTSOI', units='ddays', & - avgflag='A', long_name='Growing degree-days from planting (top two soil layers)', & - ptr_patch=this%gddtsoi_patch, default='inactive') - - this%cphase_patch(begp:endp) = spval - call hist_addfld1d (fname='CPHASE', units='0-not planted, 1-planted, 2-leaf emerge, 3-grain fill, 4-harvest', & - avgflag='A', long_name='crop phenology phase', & - ptr_patch=this%cphase_patch, default='inactive') - - if ( (trim(this%baset_mapping) == baset_map_latvary) )then - this%latbaset_patch(begp:endp) = spval - call hist_addfld1d (fname='LATBASET', units='degree C', & - avgflag='A', long_name='latitude vary base temperature for gddplant', & - ptr_patch=this%latbaset_patch, default='inactive') - end if - - end subroutine InitHistory - - subroutine InitCold(this, bounds) - ! !USES: - use LandunitType, only : lun - use landunit_varcon, only : istcrop - use PatchType, only : patch - use clm_instur, only : fert_cft - use pftconMod , only : pftcon - use GridcellType , only : grc - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! !ARGUMENTS: - class(crop_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: c, l, g, p, m, ivt ! indices - - character(len=*), parameter :: subname = 'InitCold' - !----------------------------------------------------------------------- - -!DLL - added wheat & sugarcane restrictions to base T vary by lat - do p= bounds%begp,bounds%endp - g = patch%gridcell(p) - ivt = patch%itype(p) - - this%nyrs_crop_active_patch(p) = 0 - - if ( grc%latdeg(g) >= 0.0_r8 .and. grc%latdeg(g) <= 30.0_r8) then - this%latbaset_patch(p)=pftcon%baset(ivt)+12._r8-0.4_r8*grc%latdeg(g) - else if (grc%latdeg(g) < 0.0_r8 .and. grc%latdeg(g) >= -30.0_r8) then - this%latbaset_patch(p)=pftcon%baset(ivt)+12._r8+0.4_r8*grc%latdeg(g) - else - this%latbaset_patch(p)=pftcon%baset(ivt) - end if - if ( trim(this%baset_mapping) == baset_map_constant ) then - this%latbaset_patch(p) = nan - end if - end do -!DLL -- end of mods - - if (use_crop) then - do p= bounds%begp,bounds%endp - g = patch%gridcell(p) - l = patch%landunit(p) - c = patch%column(p) - - if (lun%itype(l) == istcrop) then - m = patch%itype(p) - this%fertnitro_patch(p) = fert_cft(g,m) - end if - end do - end if - - end subroutine InitCold - - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - subroutine InitAccBuffer (this, bounds) - ! - ! !DESCRIPTION: - ! Initialize accumulation buffer for all required module accumulated fields - ! This routine set defaults values that are then overwritten by the - ! restart file for restart or branch runs - ! Each interval and accumulation type is unique to each field processed. - ! Routine [initAccBuffer] defines the fields to be processed - ! and the type of accumulation. - ! Routine [updateAccVars] does the actual accumulation for a given field. - ! Fields are accumulated by calls to subroutine [update_accum_field]. - ! To accumulate a field, it must first be defined in subroutine [initAccVars] - ! and then accumulated by calls to [updateAccVars]. - ! - ! Should only be called if use_crop is true - ! - ! !USES - use accumulMod , only : init_accum_field - ! - ! !ARGUMENTS: - class(crop_type) , intent(in) :: this - type(bounds_type), intent(in) :: bounds - - ! - ! !LOCAL VARIABLES: - integer, parameter :: not_used = huge(1) - - !--------------------------------------------------------------------- - - call init_accum_field (name='GDDPLANT', units='K', & - desc='growing degree-days from planting', accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field (name='GDDTSOI', units='K', & - desc='growing degree-days from planting (top two soil layers)', accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - end subroutine InitAccBuffer - - !----------------------------------------------------------------------- - subroutine InitAccVars(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module variables that are associated with - ! time accumulated fields. This routine is called for both an initial run - ! and a restart run (and must therefore must be called after the restart file - ! is read in and the accumulation buffer is obtained) - ! - ! !USES: - use accumulMod , only : extract_accum_field - use clm_time_manager , only : get_nstep - ! - ! !ARGUMENTS: - class(crop_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: nstep - integer :: ier - real(r8), pointer :: rbufslp(:) ! temporary - - character(len=*), parameter :: subname = 'InitAccVars' - !----------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - ! Allocate needed dynamic memory for single level patch field - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)' in ' - call endrun(msg=" allocation error for rbufslp"//& - errMsg(sourcefile, __LINE__)) - endif - - nstep = get_nstep() - - call extract_accum_field ('GDDPLANT', rbufslp, nstep) - this%gddplant_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('GDDTSOI', rbufslp, nstep) - this%gddtsoi_patch(begp:endp) = rbufslp(begp:endp) - - deallocate(rbufslp) - - end subroutine InitAccVars - - !----------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag) - ! - ! !USES: - use restUtilMod - use ncdio_pio - use PatchType, only : patch - use pftconMod, only : npcropmin, npcropmax - ! - ! !ARGUMENTS: - class(crop_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid - character(len=*) , intent(in) :: flag - ! - ! !LOCAL VARIABLES: - integer, pointer :: temp1d(:) ! temporary - integer :: restyear - integer :: p - logical :: readvar ! determine if variable is on initial file - - character(len=*), parameter :: subname = 'Restart' - !----------------------------------------------------------------------- - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='nyrs_crop_active', xtype=ncd_int, & - dim1name='pft', & - long_name='Number of years this crop patch has been active (0 for non-crop patches)', & - units='years', & - interpinic_flag='interp', readvar=readvar, data=this%nyrs_crop_active_patch) - if (flag == 'read' .and. .not. readvar) then - ! BACKWARDS_COMPATIBILITY(wjs, 2017-02-17) Old restart files did not have this - ! patch-level variable. Instead, they had a single scalar tracking the number - ! of years the crop model ran. Copy this scalar onto all *active* crop patches. - - ! Some arguments in the following restartvar call are irrelevant, because we - ! only call this for 'read'. I'm simply maintaining the old restartvar call. - call restartvar(ncid=ncid, flag=flag, varname='restyear', xtype=ncd_int, & - long_name='Number of years prognostic crop ran', units="years", & - interpinic_flag='copy', readvar=readvar, data=restyear) - if (readvar) then - do p = bounds%begp, bounds%endp - if (patch%itype(p) >= npcropmin .and. patch%itype(p) <= npcropmax .and. & - patch%active(p)) then - this%nyrs_crop_active_patch(p) = restyear - end if - end do - end if - end if - - allocate(temp1d(bounds%begp:bounds%endp)) - if (flag == 'write') then - do p= bounds%begp,bounds%endp - if (this%croplive_patch(p)) then - temp1d(p) = 1 - else - temp1d(p) = 0 - end if - end do - end if - call restartvar(ncid=ncid, flag=flag, varname='croplive', xtype=ncd_log, & - dim1name='pft', & - long_name='Flag that crop is alive, but not harvested', & - interpinic_flag='interp', readvar=readvar, data=temp1d) - if (flag == 'read') then - do p= bounds%begp,bounds%endp - if (temp1d(p) == 1) then - this%croplive_patch(p) = .true. - else - this%croplive_patch(p) = .false. - end if - end do - end if - deallocate(temp1d) - - allocate(temp1d(bounds%begp:bounds%endp)) - if (flag == 'write') then - do p= bounds%begp,bounds%endp - if (this%cropplant_patch(p)) then - temp1d(p) = 1 - else - temp1d(p) = 0 - end if - end do - end if - call restartvar(ncid=ncid, flag=flag, varname='cropplant', xtype=ncd_log, & - dim1name='pft', & - long_name='Flag that crop is planted, but not harvested' , & - interpinic_flag='interp', readvar=readvar, data=temp1d) - if (flag == 'read') then - do p= bounds%begp,bounds%endp - if (temp1d(p) == 1) then - this%cropplant_patch(p) = .true. - else - this%cropplant_patch(p) = .false. - end if - end do - end if - deallocate(temp1d) - - call restartvar(ncid=ncid, flag=flag, varname='harvdate', xtype=ncd_int, & - dim1name='pft', long_name='harvest date', units='jday', nvalid_range=(/1,366/), & - interpinic_flag='interp', readvar=readvar, data=this%harvdate_patch) - - call restartvar(ncid=ncid, flag=flag, varname='vf', xtype=ncd_double, & - dim1name='pft', long_name='vernalization factor', units='', & - interpinic_flag='interp', readvar=readvar, data=this%vf_patch) - - call restartvar(ncid=ncid, flag=flag, varname='cphase',xtype=ncd_double, & - dim1name='pft', long_name='crop phenology phase', & - units='0-not planted, 1-planted, 2-leaf emerge, 3-grain fill, 4-harvest', & - interpinic_flag='interp', readvar=readvar, data=this%cphase_patch) - if (flag=='read' )then - call this%checkDates( ) ! Check that restart date is same calendar date (even if year is different) - ! This is so that it properly goes through - ! the crop phases - end if - end if - - end subroutine Restart - - - !----------------------------------------------------------------------- - subroutine CropUpdateAccVars(this, bounds, t_ref2m_patch, t_soisno_col) - ! - ! !DESCRIPTION: - ! Update accumulated variables. Should be called every time step. - ! Should only be called if use_crop is true. - ! - ! !USES: - use accumulMod , only : update_accum_field, extract_accum_field, accumResetVal - use shr_const_mod , only : SHR_CONST_CDAY, SHR_CONST_TKFRZ - use clm_time_manager , only : get_step_size, get_nstep - use clm_varpar , only : nlevsno, nlevgrnd - use pftconMod , only : nswheat, nirrig_swheat, pftcon - use pftconMod , only : nwwheat, nirrig_wwheat - use pftconMod , only : nsugarcane, nirrig_sugarcane - use ColumnType , only : col - use PatchType , only : patch - ! - ! !ARGUMENTS: - implicit none - class(crop_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: t_ref2m_patch( bounds%begp:) - real(r8) , intent(inout) :: t_soisno_col(bounds%begc:, -nlevsno+1:) - ! - ! !LOCAL VARIABLES: - integer :: p,c,g ! indices - integer :: ivt ! vegetation type - integer :: dtime ! timestep size [seconds] - integer :: nstep ! timestep number - integer :: ier ! error status - integer :: begp, endp - integer :: begc, endc - real(r8), pointer :: rbufslp(:) ! temporary single level - patch level - character(len=*), parameter :: subname = 'CropUpdateAccVars' - !----------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(t_ref2m_patch) == (/endp/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno_col) == (/endc,nlevgrnd/)) , errMsg(sourcefile, __LINE__)) - - dtime = get_step_size() - nstep = get_nstep() - - ! Allocate needed dynamic memory for single level patch field - - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)'update_accum_hist allocation error for rbuf1dp' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - - ! Accumulate and extract GDDPLANT - - call extract_accum_field ('GDDPLANT', rbufslp, nstep) - do p = begp,endp - rbufslp(p) = max(0.,this%gddplant_patch(p)-rbufslp(p)) - end do - call update_accum_field ('GDDPLANT', rbufslp, nstep) - do p = begp,endp - if (this%croplive_patch(p)) then ! relative to planting date - ivt = patch%itype(p) - if ( (trim(this%baset_mapping) == baset_map_latvary) .and. & - ((ivt == nswheat) .or. (ivt == nirrig_swheat) .or. & - (ivt == nsugarcane) .or. (ivt == nirrig_sugarcane)) ) then - rbufslp(p) = max(0._r8, min(pftcon%mxtmp(ivt), & - t_ref2m_patch(p)-(SHR_CONST_TKFRZ + this%latbaset_patch(p)))) & - * dtime/SHR_CONST_CDAY - else - rbufslp(p) = max(0._r8, min(pftcon%mxtmp(ivt), & - t_ref2m_patch(p)-(SHR_CONST_TKFRZ + pftcon%baset(ivt)))) & - * dtime/SHR_CONST_CDAY - end if - if (ivt == nwwheat .or. ivt == nirrig_wwheat) then - rbufslp(p) = rbufslp(p) * this%vf_patch(p) - end if - else - rbufslp(p) = accumResetVal - end if - end do - call update_accum_field ('GDDPLANT', rbufslp, nstep) - call extract_accum_field ('GDDPLANT', this%gddplant_patch, nstep) - - ! Accumulate and extract GDDTSOI - ! In agroibis this variable is calculated - ! to 0.05 m, so here we use the top two soil layers - - do p = begp,endp - if (this%croplive_patch(p)) then ! relative to planting date - ivt = patch%itype(p) - c = patch%column(p) - rbufslp(p) = max(0._r8, min(pftcon%mxtmp(ivt), & - ((t_soisno_col(c,1)*col%dz(c,1) + & - t_soisno_col(c,2)*col%dz(c,2))/(col%dz(c,1)+col%dz(c,2))) - & - (SHR_CONST_TKFRZ + pftcon%baset(ivt)))) * dtime/SHR_CONST_CDAY - if (ivt == nwwheat .or. ivt == nwwheat) then - rbufslp(p) = rbufslp(p) * this%vf_patch(p) - end if - else - rbufslp(p) = accumResetVal - end if - end do - call update_accum_field ('GDDTSOI', rbufslp, nstep) - call extract_accum_field ('GDDTSOI', this%gddtsoi_patch, nstep) - - deallocate(rbufslp) - - end subroutine CropUpdateAccVars - - !----------------------------------------------------------------------- - subroutine CropIncrementYear (this, num_pcropp, filter_pcropp) - ! - ! !DESCRIPTION: - ! Increment the crop year, if appropriate - ! - ! This routine should be called every time step - ! - ! !USES: - use clm_time_manager , only : get_curr_date, is_first_step - ! - ! !ARGUMENTS: - class(crop_type) :: this - integer , intent(in) :: num_pcropp ! number of prog. crop patches in filter - integer , intent(in) :: filter_pcropp(:) ! filter for prognostic crop patches - ! - ! !LOCAL VARIABLES: - integer kyr ! current year - integer kmo ! month of year (1, ..., 12) - integer kda ! day of month (1, ..., 31) - integer mcsec ! seconds of day (0, ..., seconds/day) - integer :: fp, p - !----------------------------------------------------------------------- - - call get_curr_date ( kyr, kmo, kda, mcsec) - ! Update nyrs when it's the end of the year (unless it's the very start of the - ! run). This assumes that, if this patch is active at the end of the year, then it was - ! active for the whole year. - if ((kmo == 1 .and. kda == 1 .and. mcsec == 0) .and. .not. is_first_step()) then - do fp = 1, num_pcropp - p = filter_pcropp(fp) - - this%nyrs_crop_active_patch(p) = this%nyrs_crop_active_patch(p) + 1 - end do - end if - - end subroutine CropIncrementYear - - !----------------------------------------------------------------------- - subroutine checkDates( ) - ! - ! !DESCRIPTION: - ! Make sure the dates are compatible. The date given to startup the model - ! and the date on the restart file must be the same although years can be - ! different. The dates need to be checked when the restart file is being - ! read in for a startup or branch case (they are NOT allowed to be different - ! for a restart case). - ! - ! For the prognostic crop model the date of planting is tracked and growing - ! degree days is tracked (with a 20 year mean) -- so shifting the start dates - ! messes up these bits of saved information. - ! - ! !ARGUMENTS: - use clm_time_manager, only : get_driver_start_ymd, get_start_date - use clm_varctl , only : iulog - use clm_varctl , only : nsrest, nsrBranch, nsrStartup - ! - ! !LOCAL VARIABLES: - integer :: stymd ! Start date YYYYMMDD from driver - integer :: styr ! Start year from driver - integer :: stmon_day ! Start date MMDD from driver - integer :: rsmon_day ! Restart date MMDD from restart file - integer :: rsyr ! Restart year from restart file - integer :: rsmon ! Restart month from restart file - integer :: rsday ! Restart day from restart file - integer :: tod ! Restart time of day from restart file - character(len=*), parameter :: formDate = '(A,i4.4,"/",i2.2,"/",i2.2)' ! log output format - character(len=32) :: subname = 'CropRest::checkDates' - !----------------------------------------------------------------------- - ! - ! If branch or startup make sure the startdate is compatible with the date - ! on the restart file. - ! - if ( nsrest == nsrBranch .or. nsrest == nsrStartup )then - stymd = get_driver_start_ymd() - styr = stymd / 10000 - stmon_day = stymd - styr*10000 - call get_start_date( rsyr, rsmon, rsday, tod ) - rsmon_day = rsmon*100 + rsday - if ( masterproc ) & - write(iulog,formDate) 'Date on the restart file is: ', rsyr, rsmon, rsday - if ( stmon_day /= rsmon_day )then - write(iulog,formDate) 'Start date is: ', styr, stmon_day/100, & - (stmon_day - stmon_day/100) - call endrun(msg=' ERROR: For prognostic crop to work correctly, the start date (month and day)'// & - ' and the date on the restart file needs to match (years can be different)'//& - errMsg(sourcefile, __LINE__)) - end if - end if - - end subroutine checkDates - -end module CropType - diff --git a/src/biogeochem/DUSTMod.F90 b/src/biogeochem/DUSTMod.F90 deleted file mode 100644 index 6a906e41ea..0000000000 --- a/src/biogeochem/DUSTMod.F90 +++ /dev/null @@ -1,925 +0,0 @@ -module DUSTMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Routines in this module calculate Dust mobilization and dry deposition for dust. - ! Simulates dust mobilization due to wind from the surface into the - ! lowest atmospheric layer. On output flx_mss_vrt_dst(ndst) is the surface dust - ! emission (kg/m**2/s) [ + = to atm]. - ! Calculates the turbulent component of dust dry deposition, (the turbulent deposition - ! velocity through the lowest atmospheric layer). CAM will calculate the settling - ! velocity through the whole atmospheric column. The two calculations will determine - ! the dust dry deposition flux to the surface. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : dst_src_nbr, ndst, sz_nbr - use clm_varcon , only : grav, spval - use landunit_varcon , only : istcrop, istsoil - use clm_varctl , only : iulog - use abortutils , only : endrun - use subgridAveMod , only : p2l_1d - use decompMod , only : bounds_type - use atm2lndType , only : atm2lnd_type - use SoilStateType , only : soilstate_type - use CanopyStateType , only : canopystate_type - use WaterstateType , only : waterstate_type - use FrictionVelocityMod , only : frictionvel_type - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - ! - public DustEmission ! Dust mobilization - public DustDryDep ! Turbulent dry deposition for dust - ! - ! !PUBLIC DATA: - ! - real(r8) , allocatable :: ovr_src_snk_mss(:,:) - real(r8) , allocatable :: dmt_vwr(:) ![m] Mass-weighted mean diameter resolved - real(r8) , allocatable :: stk_crc(:) ![frc] Correction to Stokes settling velocity - real(r8) tmp1 !Factor in saltation computation (named as in Charlie's code) - real(r8) dns_aer ![kg m-3] Aerosol density - ! - ! !PUBLIC DATA TYPES: - ! - type, public :: dust_type - - real(r8), pointer, PUBLIC :: flx_mss_vrt_dst_patch (:,:) ! surface dust emission (kg/m**2/s) [ + = to atm] (ndst) - real(r8), pointer, private :: flx_mss_vrt_dst_tot_patch (:) ! total dust flux into atmosphere - real(r8), pointer, private :: vlc_trb_patch (:,:) ! turbulent deposition velocity (m/s) (ndst) - real(r8), pointer, private :: vlc_trb_1_patch (:) ! turbulent deposition velocity 1(m/s) - real(r8), pointer, private :: vlc_trb_2_patch (:) ! turbulent deposition velocity 2(m/s) - real(r8), pointer, private :: vlc_trb_3_patch (:) ! turbulent deposition velocity 3(m/s) - real(r8), pointer, private :: vlc_trb_4_patch (:) ! turbulent deposition velocity 4(m/s) - real(r8), pointer, private :: mbl_bsn_fct_col (:) ! basin factor - - contains - - procedure , public :: Init - procedure , private :: InitAllocate - procedure , private :: InitHistory - procedure , private :: InitCold - procedure , private :: InitDustVars ! Initialize variables used in subroutine Dust - - end type dust_type - !------------------------------------------------------------------------ - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(dust_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate (bounds) - call this%InitHistory (bounds) - call this%InitCold (bounds) - call this%InitDustVars (bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !ARGUMENTS: - class (dust_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp,endp - integer :: begc,endc - !------------------------------------------------------------------------ - - begp = bounds%begp ; endp = bounds%endp - begc = bounds%begc ; endc = bounds%endc - - allocate(this%flx_mss_vrt_dst_patch (begp:endp,1:ndst)) ; this%flx_mss_vrt_dst_patch (:,:) = nan - allocate(this%flx_mss_vrt_dst_tot_patch (begp:endp)) ; this%flx_mss_vrt_dst_tot_patch (:) = nan - allocate(this%vlc_trb_patch (begp:endp,1:ndst)) ; this%vlc_trb_patch (:,:) = nan - allocate(this%vlc_trb_1_patch (begp:endp)) ; this%vlc_trb_1_patch (:) = nan - allocate(this%vlc_trb_2_patch (begp:endp)) ; this%vlc_trb_2_patch (:) = nan - allocate(this%vlc_trb_3_patch (begp:endp)) ; this%vlc_trb_3_patch (:) = nan - allocate(this%vlc_trb_4_patch (begp:endp)) ; this%vlc_trb_4_patch (:) = nan - allocate(this%mbl_bsn_fct_col (begc:endc)) ; this%mbl_bsn_fct_col (:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !USES: - use histFileMod, only : hist_addfld1d - ! - ! - ! !ARGUMENTS: - class (dust_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp,endp - !------------------------------------------------------------------------ - - begp = bounds%begp; endp = bounds%endp - - this%flx_mss_vrt_dst_tot_patch(begp:endp) = spval - call hist_addfld1d (fname='DSTFLXT', units='kg/m2/s', & - avgflag='A', long_name='total surface dust emission', & - ptr_patch=this%flx_mss_vrt_dst_tot_patch, set_lake=0._r8, set_urb=0._r8, default='inactive') - - this%vlc_trb_1_patch(begp:endp) = spval - call hist_addfld1d (fname='DPVLTRB1', units='m/s', & - avgflag='A', long_name='turbulent deposition velocity 1', & - ptr_patch=this%vlc_trb_1_patch, default='inactive') - - this%vlc_trb_2_patch(begp:endp) = spval - call hist_addfld1d (fname='DPVLTRB2', units='m/s', & - avgflag='A', long_name='turbulent deposition velocity 2', & - ptr_patch=this%vlc_trb_2_patch, default='inactive') - - this%vlc_trb_3_patch(begp:endp) = spval - call hist_addfld1d (fname='DPVLTRB3', units='m/s', & - avgflag='A', long_name='turbulent deposition velocity 3', & - ptr_patch=this%vlc_trb_3_patch, default='inactive') - - this%vlc_trb_4_patch(begp:endp) = spval - call hist_addfld1d (fname='DPVLTRB4', units='m/s', & - avgflag='A', long_name='turbulent deposition velocity 4', & - ptr_patch=this%vlc_trb_4_patch, default='inactive') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !ARGUMENTS: - class (dust_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: c,l - !----------------------------------------------------------------------- - - ! Set basin factor to 1 for now - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - - if (.not.lun%lakpoi(l)) then - this%mbl_bsn_fct_col(c) = 1.0_r8 - end if - end do - - end subroutine InitCold - - !------------------------------------------------------------------------ - subroutine DustEmission (bounds, & - num_nolakep, filter_nolakep, & - atm2lnd_inst, soilstate_inst, canopystate_inst, waterstate_inst, & - frictionvel_inst, dust_inst) - ! - ! !DESCRIPTION: - ! Dust mobilization. This code simulates dust mobilization due to wind - ! from the surface into the lowest atmospheric layer - ! On output flx_mss_vrt_dst(ndst) is the surface dust emission - ! (kg/m**2/s) [ + = to atm] - ! Source: C. Zender's dust model - ! - ! !USES - use shr_const_mod, only : SHR_CONST_RHOFW - use subgridaveMod, only : p2g - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakep ! number of column non-lake points in patch filter - integer , intent(in) :: filter_nolakep(num_nolakep) ! patch filter for non-lake points - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(frictionvel_type) , intent(in) :: frictionvel_inst - type(dust_type) , intent(inout) :: dust_inst - - ! - ! !LOCAL VARIABLES - integer :: fp,p,c,l,g,m,n ! indices - real(r8) :: liqfrac ! fraction of total water that is liquid - real(r8) :: wnd_frc_rat ! [frc] Wind friction threshold over wind friction - real(r8) :: wnd_frc_slt_dlt ! [m s-1] Friction velocity increase from saltatn - real(r8) :: wnd_rfr_dlt ! [m s-1] Reference windspeed excess over threshld - real(r8) :: dst_slt_flx_rat_ttl - real(r8) :: flx_mss_hrz_slt_ttl - real(r8) :: flx_mss_vrt_dst_ttl(bounds%begp:bounds%endp) - real(r8) :: frc_thr_wet_fct - real(r8) :: frc_thr_rgh_fct - real(r8) :: wnd_frc_thr_slt - real(r8) :: wnd_rfr_thr_slt - real(r8) :: wnd_frc_slt - real(r8) :: lnd_frc_mbl(bounds%begp:bounds%endp) - real(r8) :: bd - real(r8) :: gwc_sfc - real(r8) :: ttlai(bounds%begp:bounds%endp) - real(r8) :: tlai_lu(bounds%begl:bounds%endl) - real(r8) :: sumwt(bounds%begl:bounds%endl) ! sum of weights - logical :: found ! temporary for error check - integer :: index - ! - ! constants - ! - real(r8), parameter :: cst_slt = 2.61_r8 ! [frc] Saltation constant - real(r8), parameter :: flx_mss_fdg_fct = 5.0e-4_r8 ! [frc] Empir. mass flx tuning eflx_lh_vegt - real(r8), parameter :: vai_mbl_thr = 0.3_r8 ! [m2 m-2] VAI threshold quenching dust mobilization - !------------------------------------------------------------------------ - - associate( & - forc_rho => atm2lnd_inst%forc_rho_downscaled_col , & ! Input: [real(r8) (:) ] downscaled density (kg/m**3) - - gwc_thr => soilstate_inst%gwc_thr_col , & ! Input: [real(r8) (:) ] threshold gravimetric soil moisture based on clay content - mss_frc_cly_vld => soilstate_inst%mss_frc_cly_vld_col , & ! Input: [real(r8) (:) ] [frc] Mass fraction clay limited to 0.20 - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] saturated volumetric soil water - - tlai => canopystate_inst%tlai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index, no burying by snow - tsai => canopystate_inst%tsai_patch , & ! Input: [real(r8) (:) ] one-sided stem area index, no burying by snow - - frac_sno => waterstate_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid soil water (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] frozen soil water (kg/m2) - - fv => frictionvel_inst%fv_patch , & ! Input: [real(r8) (:) ] friction velocity (m/s) (for dust model) - u10 => frictionvel_inst%u10_patch , & ! Input: [real(r8) (:) ] 10-m wind (m/s) (created for dust model) - - mbl_bsn_fct => dust_inst%mbl_bsn_fct_col , & ! Input: [real(r8) (:) ] basin factor - flx_mss_vrt_dst => dust_inst%flx_mss_vrt_dst_patch , & ! Output: [real(r8) (:,:) ] surface dust emission (kg/m**2/s) - flx_mss_vrt_dst_tot => dust_inst%flx_mss_vrt_dst_tot_patch & ! Output: [real(r8) (:) ] total dust flux back to atmosphere (pft) - ) - - ttlai(bounds%begp : bounds%endp) = 0._r8 - ! make lai average at landunit level - do fp = 1,num_nolakep - p = filter_nolakep(fp) - ttlai(p) = tlai(p)+tsai(p) - enddo - - tlai_lu(bounds%begl : bounds%endl) = spval - sumwt(bounds%begl : bounds%endl) = 0._r8 - do p = bounds%begp,bounds%endp - if (ttlai(p) /= spval .and. patch%active(p) .and. patch%wtlunit(p) /= 0._r8) then - c = patch%column(p) - l = patch%landunit(p) - if (sumwt(l) == 0._r8) tlai_lu(l) = 0._r8 - tlai_lu(l) = tlai_lu(l) + ttlai(p) * patch%wtlunit(p) - sumwt(l) = sumwt(l) + patch%wtlunit(p) - end if - end do - found = .false. - do l = bounds%begl,bounds%endl - if (sumwt(l) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = l - exit - else if (sumwt(l) /= 0._r8) then - tlai_lu(l) = tlai_lu(l)/sumwt(l) - end if - end do - if (found) then - write(iulog,*) 'p2l_1d error: sumwt is greater than 1.0 at l= ',index - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! Loop through patches - - ! initialize variables which get passed to the atmosphere - flx_mss_vrt_dst(bounds%begp:bounds%endp,:)=0._r8 - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - c = patch%column(p) - l = patch%landunit(p) - - ! the following code from subr. lnd_frc_mbl_get was adapted for lsm use - ! purpose: return fraction of each gridcell suitable for dust mobilization - - ! the "bare ground" fraction of the current sub-gridscale cell decreases - ! linearly from 1 to 0 as VAI(=tlai+tsai) increases from 0 to vai_mbl_thr - ! if ice sheet, wetland, or lake, no dust allowed - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - if (tlai_lu(l) < vai_mbl_thr) then - lnd_frc_mbl(p) = 1.0_r8 - (tlai_lu(l))/vai_mbl_thr - else - lnd_frc_mbl(p) = 0.0_r8 - endif - lnd_frc_mbl(p) = lnd_frc_mbl(p) * (1.0_r8 - frac_sno(c)) - else - lnd_frc_mbl(p) = 0.0_r8 - end if - end do - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - if (lnd_frc_mbl(p)>1.0_r8 .or. lnd_frc_mbl(p)<0.0_r8) then - write(iulog,*)'Error dstmbl: pft= ',p,' lnd_frc_mbl(p)= ',lnd_frc_mbl(p) - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - end do - - ! reset history output variables before next if-statement to avoid output = inf - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - flx_mss_vrt_dst_tot(p) = 0.0_r8 - end do - do n = 1, ndst - do fp = 1,num_nolakep - p = filter_nolakep(fp) - flx_mss_vrt_dst(p,n) = 0.0_r8 - end do - end do - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - c = patch%column(p) - l = patch%landunit(p) - g = patch%gridcell(p) - - ! only perform the following calculations if lnd_frc_mbl is non-zero - - if (lnd_frc_mbl(p) > 0.0_r8) then - - ! the following comes from subr. frc_thr_rgh_fct_get - ! purpose: compute factor by which surface roughness increases threshold - ! friction velocity (currently a constant) - - frc_thr_rgh_fct = 1.0_r8 - - ! the following comes from subr. frc_thr_wet_fct_get - ! purpose: compute factor by which soil moisture increases threshold friction velocity - ! adjust threshold velocity for inhibition by moisture - ! modified 4/5/2002 (slevis) to use gravimetric instead of volumetric - ! water content - - bd = (1._r8-watsat(c,1))*2.7e3_r8 ![kg m-3] Bulk density of dry surface soil - gwc_sfc = h2osoi_vol(c,1)*SHR_CONST_RHOFW/bd ![kg kg-1] Gravimetric H2O cont - if (gwc_sfc > gwc_thr(c)) then - frc_thr_wet_fct = sqrt(1.0_r8 + 1.21_r8 * (100.0_r8*(gwc_sfc - gwc_thr(c)))**0.68_r8) - else - frc_thr_wet_fct = 1.0_r8 - end if - - ! slevis: adding liqfrac here, because related to effects from soil water - - liqfrac = max( 0.0_r8, min( 1.0_r8, h2osoi_liq(c,1) / (h2osoi_ice(c,1)+h2osoi_liq(c,1)+1.0e-6_r8) ) ) - - ! the following lines come from subr. dst_mbl - ! purpose: adjust threshold friction velocity to acct for moisture and - ! roughness. The ratio tmp1 / sqrt(forc_rho) comes from - ! subr. wnd_frc_thr_slt_get which computes dry threshold - ! friction velocity for saltation - - wnd_frc_thr_slt = tmp1 / sqrt(forc_rho(c)) * frc_thr_wet_fct * frc_thr_rgh_fct - - ! reset these variables which will be updated in the following if-block - - wnd_frc_slt = fv(p) - flx_mss_hrz_slt_ttl = 0.0_r8 - flx_mss_vrt_dst_ttl(p) = 0.0_r8 - - ! the following line comes from subr. dst_mbl - ! purpose: threshold saltation wind speed - - wnd_rfr_thr_slt = u10(p) * wnd_frc_thr_slt / fv(p) - - ! the following if-block comes from subr. wnd_frc_slt_get - ! purpose: compute the saltating friction velocity - ! theory: saltation roughens the boundary layer, AKA "Owen's effect" - - if (u10(p) >= wnd_rfr_thr_slt) then - wnd_rfr_dlt = u10(p) - wnd_rfr_thr_slt - wnd_frc_slt_dlt = 0.003_r8 * wnd_rfr_dlt * wnd_rfr_dlt - wnd_frc_slt = fv(p) + wnd_frc_slt_dlt - end if - - ! the following comes from subr. flx_mss_hrz_slt_ttl_Whi79_get - ! purpose: compute vertically integrated streamwise mass flux of particles - - if (wnd_frc_slt > wnd_frc_thr_slt) then - wnd_frc_rat = wnd_frc_thr_slt / wnd_frc_slt - flx_mss_hrz_slt_ttl = cst_slt * forc_rho(c) * (wnd_frc_slt**3.0_r8) * & - (1.0_r8 - wnd_frc_rat) * (1.0_r8 + wnd_frc_rat) * (1.0_r8 + wnd_frc_rat) / grav - - ! the following loop originates from subr. dst_mbl - ! purpose: apply land sfc and veg limitations and global tuning factor - ! slevis: multiply flx_mss_hrz_slt_ttl by liqfrac to incude the effect - ! of frozen soil - - flx_mss_hrz_slt_ttl = flx_mss_hrz_slt_ttl * lnd_frc_mbl(p) * mbl_bsn_fct(c) * & - flx_mss_fdg_fct * liqfrac - end if - - ! the following comes from subr. flx_mss_vrt_dst_ttl_MaB95_get - ! purpose: diagnose total vertical mass flux of dust from vertically - ! integrated streamwise mass flux - - dst_slt_flx_rat_ttl = 100.0_r8 * exp( log(10.0_r8) * (13.4_r8 * mss_frc_cly_vld(c) - 6.0_r8) ) - flx_mss_vrt_dst_ttl(p) = flx_mss_hrz_slt_ttl * dst_slt_flx_rat_ttl - - end if ! lnd_frc_mbl > 0.0 - - end do - - ! the following comes from subr. flx_mss_vrt_dst_prt in C. Zender's code - ! purpose: partition total vertical mass flux of dust into transport bins - - do n = 1, ndst - do m = 1, dst_src_nbr - do fp = 1,num_nolakep - p = filter_nolakep(fp) - if (lnd_frc_mbl(p) > 0.0_r8) then - flx_mss_vrt_dst(p,n) = flx_mss_vrt_dst(p,n) + ovr_src_snk_mss(m,n) * flx_mss_vrt_dst_ttl(p) - end if - end do - end do - end do - - do n = 1, ndst - do fp = 1,num_nolakep - p = filter_nolakep(fp) - if (lnd_frc_mbl(p) > 0.0_r8) then - flx_mss_vrt_dst_tot(p) = flx_mss_vrt_dst_tot(p) + flx_mss_vrt_dst(p,n) - end if - end do - end do - - end associate - - end subroutine DustEmission - - !------------------------------------------------------------------------ - subroutine DustDryDep (bounds, & - atm2lnd_inst, frictionvel_inst, dust_inst) - ! - ! !DESCRIPTION: - ! - ! Determine Turbulent dry deposition for dust. Calculate the turbulent - ! component of dust dry deposition, (the turbulent deposition velocity - ! through the lowest atmospheric layer. CAM will calculate the settling - ! velocity through the whole atmospheric column. The two calculations - ! will determine the dust dry deposition flux to the surface. - ! Note: Same process should occur over oceans. For the coupled CESM, - ! we may find it more efficient to let CAM calculate the turbulent dep - ! velocity over all surfaces. This would require passing the - ! aerodynamic resistance, ram(1), and the friction velocity, fv, from - ! the land to the atmosphere component. In that case, dustini need not - ! calculate particle diamter (dmt_vwr) and particle density (dns_aer). - ! Source: C. Zender's dry deposition code - ! - ! !USES - use shr_const_mod, only : SHR_CONST_PI, SHR_CONST_RDAIR, SHR_CONST_BOLTZ - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(frictionvel_type) , intent(in) :: frictionvel_inst - type(dust_type) , intent(inout) :: dust_inst - ! - ! !LOCAL VARIABLES - integer :: p,c,g,m,n ! indices - real(r8) :: vsc_dyn_atm(bounds%begp:bounds%endp) ! [kg m-1 s-1] Dynamic viscosity of air - real(r8) :: vsc_knm_atm(bounds%begp:bounds%endp) ! [m2 s-1] Kinematic viscosity of atmosphere - real(r8) :: shm_nbr_xpn ! [frc] Sfc-dep exponent for aerosol-diffusion dependence on Schmidt number - real(r8) :: shm_nbr ! [frc] Schmidt number - real(r8) :: stk_nbr ! [frc] Stokes number - real(r8) :: mfp_atm ! [m] Mean free path of air - real(r8) :: dff_aer ! [m2 s-1] Brownian diffusivity of particle - real(r8) :: rss_trb ! [s m-1] Resistance to turbulent deposition - real(r8) :: slp_crc(bounds%begp:bounds%endp,ndst) ! [frc] Slip correction factor - real(r8) :: vlc_grv(bounds%begp:bounds%endp,ndst) ! [m s-1] Settling velocity - real(r8) :: rss_lmn(bounds%begp:bounds%endp,ndst) ! [s m-1] Quasi-laminar layer resistance - real(r8) :: tmp ! temporary - real(r8), parameter::shm_nbr_xpn_lnd=-2._r8/3._r8 ![frc] shm_nbr_xpn over land - !------------------------------------------------------------------------ - - associate( & - forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] atm pressure (Pa) - forc_rho => atm2lnd_inst%forc_rho_downscaled_col , & ! Input: [real(r8) (:) ] atm density (kg/m**3) - forc_t => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:) ] atm temperature (K) - - ram1 => frictionvel_inst%ram1_patch , & ! Input: [real(r8) (:) ] aerodynamical resistance (s/m) - fv => frictionvel_inst%fv_patch , & ! Input: [real(r8) (:) ] friction velocity (m/s) - - vlc_trb => dust_inst%vlc_trb_patch , & ! Output: [real(r8) (:,:) ] Turbulent deposn velocity (m/s) - vlc_trb_1 => dust_inst%vlc_trb_1_patch , & ! Output: [real(r8) (:) ] Turbulent deposition velocity 1 - vlc_trb_2 => dust_inst%vlc_trb_2_patch , & ! Output: [real(r8) (:) ] Turbulent deposition velocity 2 - vlc_trb_3 => dust_inst%vlc_trb_3_patch , & ! Output: [real(r8) (:) ] Turbulent deposition velocity 3 - vlc_trb_4 => dust_inst%vlc_trb_4_patch & ! Output: [real(r8) (:) ] Turbulent deposition velocity 4 - ) - - do p = bounds%begp,bounds%endp - if (patch%active(p)) then - g = patch%gridcell(p) - c = patch%column(p) - - ! from subroutine dst_dps_dry (consider adding sanity checks from line 212) - ! when code asks to use midlayer density, pressure, temperature, - ! I use the data coming in from the atmosphere, ie forc_t, forc_pbot, forc_rho - - ! Quasi-laminar layer resistance: call rss_lmn_get - ! Size-independent thermokinetic properties - - vsc_dyn_atm(p) = 1.72e-5_r8 * ((forc_t(c)/273.0_r8)**1.5_r8) * 393.0_r8 / & - (forc_t(c)+120.0_r8) ![kg m-1 s-1] RoY94 p. 102 - mfp_atm = 2.0_r8 * vsc_dyn_atm(p) / & ![m] SeP97 p. 455 - (forc_pbot(c)*sqrt(8.0_r8/(SHR_CONST_PI*SHR_CONST_RDAIR*forc_t(c)))) - vsc_knm_atm(p) = vsc_dyn_atm(p) / forc_rho(c) ![m2 s-1] Kinematic viscosity of air - - do m = 1, ndst - slp_crc(p,m) = 1.0_r8 + 2.0_r8 * mfp_atm * & - (1.257_r8+0.4_r8*exp(-1.1_r8*dmt_vwr(m)/(2.0_r8*mfp_atm))) / & - dmt_vwr(m) ![frc] Slip correction factor SeP97 p. 464 - vlc_grv(p,m) = (1.0_r8/18.0_r8) * dmt_vwr(m) * dmt_vwr(m) * dns_aer * & - grav * slp_crc(p,m) / vsc_dyn_atm(p) ![m s-1] Stokes' settling velocity SeP97 p. 466 - vlc_grv(p,m) = vlc_grv(p,m) * stk_crc(m) ![m s-1] Correction to Stokes settling velocity - end do - end if - end do - - do m = 1, ndst - do p = bounds%begp,bounds%endp - if (patch%active(p)) then - g = patch%gridcell(p) - c = patch%column(p) - - stk_nbr = vlc_grv(p,m) * fv(p) * fv(p) / (grav * vsc_knm_atm(p)) ![frc] SeP97 p.965 - dff_aer = SHR_CONST_BOLTZ * forc_t(c) * slp_crc(p,m) / & ![m2 s-1] - (3.0_r8*SHR_CONST_PI * vsc_dyn_atm(p) * dmt_vwr(m)) !SeP97 p.474 - shm_nbr = vsc_knm_atm(p) / dff_aer ![frc] SeP97 p.972 - shm_nbr_xpn = shm_nbr_xpn_lnd ![frc] - - ! fxm: Turning this on dramatically reduces - ! deposition velocity in low wind regimes - ! Schmidt number exponent is -2/3 over solid surfaces and - ! -1/2 over liquid surfaces SlS80 p. 1014 - ! if (oro(i)==0.0) shm_nbr_xpn=shm_nbr_xpn_ocn else shm_nbr_xpn=shm_nbr_xpn_lnd - ! [frc] Surface-dependent exponent for aerosol-diffusion dependence on Schmidt # - - tmp = shm_nbr**shm_nbr_xpn + 10.0_r8**(-3.0_r8/stk_nbr) - rss_lmn(p,m) = 1.0_r8 / (tmp * fv(p)) ![s m-1] SeP97 p.972,965 - end if - end do - end do - - ! Lowest layer: Turbulent deposition (CAM will calc. gravitational dep) - - do m = 1, ndst - do p = bounds%begp,bounds%endp - if (patch%active(p)) then - rss_trb = ram1(p) + rss_lmn(p,m) + ram1(p) * rss_lmn(p,m) * vlc_grv(p,m) ![s m-1] - vlc_trb(p,m) = 1.0_r8 / rss_trb ![m s-1] - end if - end do - end do - - do p = bounds%begp,bounds%endp - if (patch%active(p)) then - vlc_trb_1(p) = vlc_trb(p,1) - vlc_trb_2(p) = vlc_trb(p,2) - vlc_trb_3(p) = vlc_trb(p,3) - vlc_trb_4(p) = vlc_trb(p,4) - end if - end do - - end associate - - end subroutine DustDryDep - - !------------------------------------------------------------------------ - subroutine InitDustVars(this, bounds) - ! - ! !DESCRIPTION: - ! - ! Compute source efficiency factor from topography - ! Initialize other variables used in subroutine Dust: - ! ovr_src_snk_mss(m,n) and tmp1. - ! Define particle diameter and density needed by atm model - ! as well as by dry dep model - ! Source: Paul Ginoux (for source efficiency factor) - ! Modifications by C. Zender and later by S. Levis - ! Rest of subroutine from C. Zender's dust model - ! - ! !USES - use shr_const_mod , only: SHR_CONST_PI, SHR_CONST_RDAIR - use shr_spfn_mod , only: erf => shr_spfn_erf - use decompMod , only : get_proc_bounds - ! - ! !ARGUMENTS: - class(dust_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES - integer :: fc,c,l,m,n ! indices - real(r8) :: ovr_src_snk_frc - real(r8) :: sqrt2lngsdi ! [frc] Factor in erf argument - real(r8) :: lndmaxjovrdmdni ! [frc] Factor in erf argument - real(r8) :: lndminjovrdmdni ! [frc] Factor in erf argument - real(r8) :: ryn_nbr_frc_thr_prx_opt ! [frc] Threshold friction Reynolds number approximation for optimal size - real(r8) :: ryn_nbr_frc_thr_opt_fnc ! [frc] Threshold friction Reynolds factor for saltation calculation - real(r8) :: icf_fct ! Interpartical cohesive forces factor for saltation calc - real(r8) :: dns_fct ! Density ratio factor for saltation calculation - real(r8) :: dmt_min(ndst) ! [m] Size grid minimum - real(r8) :: dmt_max(ndst) ! [m] Size grid maximum - real(r8) :: dmt_ctr(ndst) ! [m] Diameter at bin center - real(r8) :: dmt_dlt(ndst) ! [m] Width of size bin - real(r8) :: slp_crc(ndst) ! [frc] Slip correction factor - real(r8) :: vlm_rsl(ndst) ! [m3 m-3] Volume concentration resolved - real(r8) :: vlc_stk(ndst) ! [m s-1] Stokes settling velocity - real(r8) :: vlc_grv(ndst) ! [m s-1] Settling velocity - real(r8) :: ryn_nbr_grv(ndst) ! [frc] Reynolds number at terminal velocity - real(r8) :: cff_drg_grv(ndst) ! [frc] Drag coefficient at terminal velocity - real(r8) :: tmp ! temporary - real(r8) :: ln_gsd ! [frc] ln(gsd) - real(r8) :: gsd_anl ! [frc] Geometric standard deviation - real(r8) :: dmt_vma ! [m] Mass median diameter analytic She84 p.75 Tabl.1 - real(r8) :: dmt_nma ! [m] Number median particle diameter - real(r8) :: lgn_dst ! Lognormal distribution at sz_ctr - real(r8) :: eps_max ! [frc] Relative accuracy for convergence - real(r8) :: eps_crr ! [frc] Current relative accuracy - real(r8) :: itr_idx ! [idx] Counting index - real(r8) :: dns_mdp ! [kg m-3] Midlayer density - real(r8) :: mfp_atm ! [m] Mean free path of air - real(r8) :: vsc_dyn_atm ! [kg m-1 s-1] Dynamic viscosity of air - real(r8) :: vsc_knm_atm ! [kg m-1 s-1] Kinematic viscosity of air - real(r8) :: vlc_grv_old ! [m s-1] Previous gravitational settling velocity - real(r8) :: series_ratio ! Factor for logarithmic grid - real(r8) :: lngsdsqrttwopi_rcp ! Factor in lognormal distribution - real(r8) :: sz_min(sz_nbr) ! [m] Size Bin minima - real(r8) :: sz_max(sz_nbr) ! [m] Size Bin maxima - real(r8) :: sz_ctr(sz_nbr) ! [m] Size Bin centers - real(r8) :: sz_dlt(sz_nbr) ! [m] Size Bin widths - - ! constants - real(r8), allocatable :: dmt_vma_src(:) ! [m] Mass median diameter BSM96 p. 73 Table 2 - real(r8), allocatable :: gsd_anl_src(:) ! [frc] Geometric std deviation BSM96 p. 73 Table 2 - real(r8), allocatable :: mss_frc_src(:) ! [frc] Mass fraction BSM96 p. 73 Table 2 - - real(r8) :: dmt_grd(5) = & ! [m] Particle diameter grid - (/ 0.1e-6_r8, 1.0e-6_r8, 2.5e-6_r8, 5.0e-6_r8, 10.0e-6_r8 /) - real(r8), parameter :: dmt_slt_opt = 75.0e-6_r8 ! [m] Optim diam for saltation - real(r8), parameter :: dns_slt = 2650.0_r8 ! [kg m-3] Density of optimal saltation particles - !------------------------------------------------------------------------ - - associate(& - mbl_bsn_fct => this%mbl_bsn_fct_col & ! Output: [real(r8) (:)] basin factor - ) - - ! allocate module variable - allocate (ovr_src_snk_mss(dst_src_nbr,ndst)) - allocate (dmt_vwr(ndst)) - allocate (stk_crc(ndst)) - - ! allocate local variable - allocate (dmt_vma_src(dst_src_nbr)) - allocate (gsd_anl_src(dst_src_nbr)) - allocate (mss_frc_src(dst_src_nbr)) - - dmt_vma_src(:) = (/ 0.832e-6_r8 , 4.82e-6_r8 , 19.38e-6_r8 /) - gsd_anl_src(:) = (/ 2.10_r8 , 1.90_r8 , 1.60_r8 /) - mss_frc_src(:) = (/ 0.036_r8 , 0.957_r8 , 0.007_r8 /) - - ! the following comes from (1) szdstlgn.F subroutine ovr_src_snk_frc_get - ! and (2) dstszdst.F subroutine dst_szdst_ini - ! purpose(1): given one set (the "source") of lognormal distributions, - ! and one set of bin boundaries (the "sink"), compute and return - ! the overlap factors between the source and sink distributions - ! purpose(2): set important statistics of size distributions - - do m = 1, dst_src_nbr - sqrt2lngsdi = sqrt(2.0_r8) * log(gsd_anl_src(m)) - do n = 1, ndst - lndmaxjovrdmdni = log(dmt_grd(n+1)/dmt_vma_src(m)) - lndminjovrdmdni = log(dmt_grd(n )/dmt_vma_src(m)) - ovr_src_snk_frc = 0.5_r8 * (erf(lndmaxjovrdmdni/sqrt2lngsdi) - & - erf(lndminjovrdmdni/sqrt2lngsdi)) - ovr_src_snk_mss(m,n) = ovr_src_snk_frc * mss_frc_src(m) - end do - end do - - ! The following code from subroutine wnd_frc_thr_slt_get was placed - ! here because tmp1 needs to be defined just once - - ryn_nbr_frc_thr_prx_opt = 0.38_r8 + 1331.0_r8 * (100.0_r8*dmt_slt_opt)**1.56_r8 - - if (ryn_nbr_frc_thr_prx_opt < 0.03_r8) then - write(iulog,*) 'dstmbl: ryn_nbr_frc_thr_prx_opt < 0.03' - call endrun(msg=errMsg(sourcefile, __LINE__)) - else if (ryn_nbr_frc_thr_prx_opt < 10.0_r8) then - ryn_nbr_frc_thr_opt_fnc = -1.0_r8 + 1.928_r8 * (ryn_nbr_frc_thr_prx_opt**0.0922_r8) - ryn_nbr_frc_thr_opt_fnc = 0.1291_r8 * 0.1291_r8 / ryn_nbr_frc_thr_opt_fnc - else - ryn_nbr_frc_thr_opt_fnc = 1.0_r8 - 0.0858_r8 * exp(-0.0617_r8*(ryn_nbr_frc_thr_prx_opt-10.0_r8)) - ryn_nbr_frc_thr_opt_fnc = 0.120_r8 * 0.120_r8 * ryn_nbr_frc_thr_opt_fnc * ryn_nbr_frc_thr_opt_fnc - end if - - icf_fct = 1.0_r8 + 6.0e-07_r8 / (dns_slt * grav * (dmt_slt_opt**2.5_r8)) - dns_fct = dns_slt * grav * dmt_slt_opt - tmp1 = sqrt(icf_fct * dns_fct * ryn_nbr_frc_thr_opt_fnc) - - ! Introducing particle diameter. Needed by atm model and by dry dep model. - ! Taken from Charlie Zender's subroutines dst_psd_ini, dst_sz_rsl, - ! grd_mk (dstpsd.F90) and subroutine lgn_evl (psdlgn.F90) - - ! Charlie allows logarithmic or linear option for size distribution - ! however, he hardwires the distribution to logarithmic in his code - ! therefore, I take his logarithmic code only - ! furthermore, if dst_nbr == 4, he overrides the automatic grid calculation - ! he currently works with dst_nbr = 4, so I only take the relevant code - ! if ndst ever becomes different from 4, must add call grd_mk (dstpsd.F90) - ! as done in subroutine dst_psd_ini - ! note that here ndst = dst_nbr - - ! Override automatic grid with preset grid if available - - if (ndst == 4) then - do n = 1, ndst - dmt_min(n) = dmt_grd(n) ![m] Max diameter in bin - dmt_max(n) = dmt_grd(n+1) ![m] Min diameter in bin - dmt_ctr(n) = 0.5_r8 * (dmt_min(n)+dmt_max(n)) ![m] Diameter at bin ctr - dmt_dlt(n) = dmt_max(n)-dmt_min(n) ![m] Width of size bin - end do - else - write(iulog,*) 'Dustini error: ndst must equal to 4 with current code' - call endrun(msg=errMsg(sourcefile, __LINE__)) - !see more comments above end if ndst == 4 - end if - - ! Bin physical properties - - gsd_anl = 2.0_r8 ! [frc] Geometric std dev PaG77 p. 2080 Table1 - ln_gsd = log(gsd_anl) - dns_aer = 2.5e+3_r8 ! [kg m-3] Aerosol density - - ! Set a fundamental statistic for each bin - - dmt_vma = 3.5000e-6_r8 ! [m] Mass median diameter analytic She84 p.75 Table1 - - ! Compute analytic size statistics - ! Convert mass median diameter to number median diameter (call vma2nma) - - dmt_nma = dmt_vma * exp(-3.0_r8*ln_gsd*ln_gsd) ! [m] - - ! Compute resolved size statistics for each size distribution - ! In C. Zender's code call dst_sz_rsl - - do n = 1, ndst - - series_ratio = (dmt_max(n)/dmt_min(n))**(1.0_r8/sz_nbr) - sz_min(1) = dmt_min(n) - do m = 2, sz_nbr ! Loop starts at 2 - sz_min(m) = sz_min(m-1) * series_ratio - end do - - ! Derived grid values - do m = 1, sz_nbr-1 ! Loop ends at sz_nbr-1 - sz_max(m) = sz_min(m+1) ! [m] - end do - sz_max(sz_nbr) = dmt_max(n) ! [m] - - ! Final derived grid values - do m = 1, sz_nbr - sz_ctr(m) = 0.5_r8 * (sz_min(m)+sz_max(m)) - sz_dlt(m) = sz_max(m)-sz_min(m) - end do - - lngsdsqrttwopi_rcp = 1.0_r8 / (ln_gsd*sqrt(2.0_r8*SHR_CONST_PI)) - dmt_vwr(n) = 0.0_r8 ! [m] Mass wgted diameter resolved - vlm_rsl(n) = 0.0_r8 ! [m3 m-3] Volume concentration resolved - - do m = 1, sz_nbr - - ! Evaluate lognormal distribution for these sizes (call lgn_evl) - tmp = log(sz_ctr(m)/dmt_nma) / ln_gsd - lgn_dst = lngsdsqrttwopi_rcp * exp(-0.5_r8*tmp*tmp) / sz_ctr(m) - - ! Integrate moments of size distribution - dmt_vwr(n) = dmt_vwr(n) + sz_ctr(m) * & - SHR_CONST_PI / 6.0_r8 * (sz_ctr(m)**3.0_r8) * & ![m3] Volume - lgn_dst * sz_dlt(m) ![# m-3] Number concentrn - vlm_rsl(n) = vlm_rsl(n) + & - SHR_CONST_PI / 6.0_r8 * (sz_ctr(m)**3.0_r8) * & ![m3] Volume - lgn_dst * sz_dlt(m) ![# m-3] Number concentrn - - end do - - dmt_vwr(n) = dmt_vwr(n) / vlm_rsl(n) ![m] Mass weighted diameter resolved - - end do - - ! calculate correction to Stokes' settling velocity (subroutine stk_crc_get) - - eps_max = 1.0e-4_r8 - dns_mdp = 100000._r8 / (295.0_r8*SHR_CONST_RDAIR) ![kg m-3] const prs_mdp & tpt_vrt - - ! Size-independent thermokinetic properties - - vsc_dyn_atm = 1.72e-5_r8 * ((295.0_r8/273.0_r8)**1.5_r8) * 393.0_r8 / & - (295.0_r8+120.0_r8) ![kg m-1 s-1] RoY94 p.102 tpt_mdp=295.0 - mfp_atm = 2.0_r8 * vsc_dyn_atm / & !SeP97 p. 455 constant prs_mdp, tpt_mdp - (100000._r8*sqrt(8.0_r8/(SHR_CONST_PI*SHR_CONST_RDAIR*295.0_r8))) - vsc_knm_atm = vsc_dyn_atm / dns_mdp ![m2 s-1] Kinematic viscosity of air - - do m = 1, ndst - slp_crc(m) = 1.0_r8 + 2.0_r8 * mfp_atm * & - (1.257_r8+0.4_r8*exp(-1.1_r8*dmt_vwr(m)/(2.0_r8*mfp_atm))) / & - dmt_vwr(m) ! [frc] Slip correction factor SeP97 p.464 - vlc_stk(m) = (1.0_r8/18.0_r8) * dmt_vwr(m) * dmt_vwr(m) * dns_aer * & - grav * slp_crc(m) / vsc_dyn_atm ! [m s-1] SeP97 p.466 - end do - - ! For Reynolds number flows Re < 0.1 Stokes' velocity is valid for - ! vlc_grv SeP97 p. 466 (8.42). For larger Re, inertial effects become - ! important and empirical drag coefficients must be employed - ! Implicit equation for Re, Cd, and Vt is SeP97 p. 467 (8.44) - ! Using Stokes' velocity rather than iterative solution with empirical - ! drag coefficient causes 60% errors for D = 200 um SeP97 p. 468 - - ! Iterative solution for drag coefficient, Reynolds number, and terminal veloc - do m = 1, ndst - - ! Initialize accuracy and counter - eps_crr = eps_max + 1.0_r8 ![frc] Current relative accuracy - itr_idx = 0 ![idx] Counting index - - ! Initial guess for vlc_grv is exact for Re < 0.1 - vlc_grv(m) = vlc_stk(m) ![m s-1] - - do while(eps_crr > eps_max) - - ! Save terminal velocity for convergence test - vlc_grv_old = vlc_grv(m) ![m s-1] - ryn_nbr_grv(m) = vlc_grv(m) * dmt_vwr(m) / vsc_knm_atm !SeP97 p.460 - - ! Update drag coefficient based on new Reynolds number - if (ryn_nbr_grv(m) < 0.1_r8) then - cff_drg_grv(m) = 24.0_r8 / ryn_nbr_grv(m) !Stokes' law Sep97 p.463 (8.32) - else if (ryn_nbr_grv(m) < 2.0_r8) then - cff_drg_grv(m) = (24.0_r8/ryn_nbr_grv(m)) * & - (1.0_r8 + 3.0_r8*ryn_nbr_grv(m)/16.0_r8 + & - 9.0_r8*ryn_nbr_grv(m)*ryn_nbr_grv(m)* & - log(2.0_r8*ryn_nbr_grv(m))/160.0_r8) !Sep97 p.463 (8.32) - else if (ryn_nbr_grv(m) < 500.0_r8) then - cff_drg_grv(m) = (24.0_r8/ryn_nbr_grv(m)) * & - (1.0_r8 + 0.15_r8*ryn_nbr_grv(m)**0.687_r8) !Sep97 p.463 (8.32) - else if (ryn_nbr_grv(m) < 2.0e5_r8) then - cff_drg_grv(m) = 0.44_r8 !Sep97 p.463 (8.32) - else - write(iulog,'(a,es9.2)') "ryn_nbr_grv(m) = ",ryn_nbr_grv(m) - write(iulog,*)'Dustini error: Reynolds number too large in stk_crc_get()' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! Update terminal velocity based on new Reynolds number and drag coeff - ! [m s-1] Terminal veloc SeP97 p.467 (8.44) - - vlc_grv(m) = sqrt(4.0_r8 * grav * dmt_vwr(m) * slp_crc(m) * dns_aer / & - (3.0_r8*cff_drg_grv(m)*dns_mdp)) - eps_crr = abs((vlc_grv(m)-vlc_grv_old)/vlc_grv(m)) !Relative convergence - if (itr_idx == 12) then - ! Numerical pingpong may occur when Re = 0.1, 2.0, or 500.0 - ! due to discontinuities in derivative of drag coefficient - vlc_grv(m) = 0.5_r8 * (vlc_grv(m)+vlc_grv_old) ! [m s-1] - end if - if (itr_idx > 20) then - write(iulog,*) 'Dustini error: Terminal velocity not converging ',& - ' in stk_crc_get(), breaking loop...' - goto 100 !to next iteration - end if - itr_idx = itr_idx + 1 - - end do !end while - -100 continue !Label to jump to when iteration does not converge - end do !end loop over size - - ! Compute factors to convert Stokes' settling velocities to - ! actual settling velocities - - do m = 1, ndst - stk_crc(m) = vlc_grv(m) / vlc_stk(m) - end do - - end associate - - end subroutine InitDustVars - -end module DUSTMod diff --git a/src/biogeochem/DryDepVelocity.F90 b/src/biogeochem/DryDepVelocity.F90 deleted file mode 100644 index 603e9d24c4..0000000000 --- a/src/biogeochem/DryDepVelocity.F90 +++ /dev/null @@ -1,678 +0,0 @@ -Module DryDepVelocity - - !----------------------------------------------------------------------- - ! - ! Purpose: - ! Deposition velocity (m/s) - ! - ! Method: - ! This code simulates dry deposition velocities using the Wesely scheme. - ! Details of this method can be found in: - ! - ! M.L Wesely. Parameterization of surface resistances to gaseous dry deposition - ! in regional-scale numericl models. 1989. Atmospheric Environment vol.23 No.6 - ! pp. 1293-1304. - ! - ! In Wesely (1998) "the magnitude of the dry deposition velocity can be found - ! as: - ! - ! |vd|=(ra+rb+rc)^-1 - ! - ! where ra is the aerodynamic resistance (common to all gases) between a - ! specific height and the surface, rb is the quasilaminar sublayer resistance - ! (whose only dependence on the porperties of the gas of interest is its - ! molecular diffusivity in air), and rc is the bulk surface resistance". - ! - ! In this subroutine both ra and rb are calculated elsewhere in CLM. - ! - ! In Wesely (1989) rc is estimated for five seasonal categories and 11 landuse - ! types. For each season and landuse type, Wesely compiled data into a - ! look-up-table for several parameters used to calculate rc. In this subroutine - ! the same values are used as found in wesely's look-up-tables, the only - ! difference is that this subroutine uses a CLM generated LAI to select values - ! from the look-up-table instead of seasonality. Inaddition, Wesely(1989) - ! land use types are "mapped" into CLM patch types. - ! - ! Subroutine written to operate at the patch level. - ! - ! Output: - ! - ! vd(n_species) !Dry deposition velocity [m s-1] for each molecule or species - ! - ! Author: Beth Holland and James Sulzman - ! - ! Modified: Francis Vitt -- 30 Mar 2007 - ! Modified: Maria Val Martin -- 15 Jan 2014 - ! Corrected major bugs in the leaf and stomatal resitances. The code is now - ! coupled to LAI and Rs uses the Ball-Berry Scheme. Also, corrected minor - ! bugs in rlu and rcl calculations. Added - ! no vegetation removal for CO. See README for details and - ! Val Martin et al., 2014 GRL for major corrections - ! Modified: Louisa Emmons -- 30 November 2017 - ! Corrected the equation calculating stomatal resistance from rssun and rssha, - ! and removed factor that scaled Rs to match observations - ! - !----------------------------------------------------------------------- - - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_kind_mod , only : r8 => shr_kind_r8 - use abortutils , only : endrun - use clm_time_manager , only : get_nstep, get_curr_date, get_curr_time - use spmdMod , only : masterproc - use seq_drydep_mod , only : n_drydep, drydep_list - use seq_drydep_mod , only : drydep_method, DD_XLND - use seq_drydep_mod , only : index_o3=>o3_ndx, index_o3a=>o3a_ndx, index_so2=>so2_ndx, index_h2=>h2_ndx - use seq_drydep_mod , only : index_co=>co_ndx, index_ch4=>ch4_ndx, index_pan=>pan_ndx - use seq_drydep_mod , only : index_xpan=>xpan_ndx - use decompMod , only : bounds_type - use clm_varcon , only : namep - use atm2lndType , only : atm2lnd_type - use CanopyStateType , only : canopystate_type - use FrictionVelocityMod , only : frictionvel_type - use PhotosynthesisMod , only : photosyns_type - use WaterstateType , only : waterstate_type - use GridcellType , only : grc - use LandunitType , only : lun - use PatchType , only : patch - ! - implicit none - private - ! - public :: depvel_compute - ! - type, public :: drydepvel_type - - real(r8), pointer, public :: velocity_patch (:,:) ! Dry Deposition Velocity - real(r8), pointer, private :: rs_drydep_patch (:) ! Stomatal resistance associated with dry deposition velocity for Ozone - - contains - - procedure , public :: Init - procedure , private :: InitAllocate - procedure , private :: InitHistory - - end type drydepvel_type - !----------------------------------------------------------------------- - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -CONTAINS - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(drydepvel_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND - ! - ! !ARGUMENTS: - class(drydepvel_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - - ! Dry Deposition Velocity - if ( n_drydep > 0 .and. drydep_method == DD_XLND )then - allocate(this%velocity_patch(begp:endp, n_drydep)); this%velocity_patch(:,:) = nan - allocate(this%rs_drydep_patch(begp:endp)) ; this%rs_drydep_patch(:) = nan - end if - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize history output fields for dry deposition diagnositics - ! - ! !USES - use clm_varcon , only : spval - use histFileMod , only : hist_addfld1d - use seq_drydep_mod , only : mapping - ! - ! !ARGUMENTS: - class(drydepvel_type) :: this - type(bounds_type), intent(in) :: bounds - real(r8), pointer :: ptr_1d(:) ! pointer to 1d patch array - ! - ! !LOCAL VARIABLES - integer :: ispec - integer :: begp, endp - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - if ( n_drydep == 0 .or. drydep_method /= DD_XLND ) return - - do ispec=1,n_drydep - if(mapping(ispec) <= 0) cycle - - this%velocity_patch(begp:endp,ispec)= spval - ptr_1d => this%velocity_patch(begp:endp,ispec) - call hist_addfld1d ( fname='DRYDEPV_'//trim(drydep_list(ispec)), units='cm/sec', & - avgflag='A', long_name='Dry Deposition Velocity', & - ptr_patch=ptr_1d, default='inactive' ) - end do - - this%rs_drydep_patch(begp:endp)= spval - call hist_addfld1d ( fname='RS_DRYDEP_O3', units='s/m', & - avgflag='A', long_name='Stomatal Resistance Associated with Ozone Dry Deposition Velocity', & - ptr_patch=this%rs_drydep_patch, default='inactive' ) - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine depvel_compute( bounds, & - atm2lnd_inst, canopystate_inst, waterstate_inst, frictionvel_inst, & - photosyns_inst, drydepvel_inst) - ! - ! !DESCRIPTION: - ! computes the dry deposition velocity of tracers - ! - ! !USES: - use shr_const_mod , only : tmelt => shr_const_tkfrz - use seq_drydep_mod , only : seq_drydep_setHCoeff, mapping, drat, foxd - use seq_drydep_mod , only : rcls, h2_a, h2_b, h2_c, ri, rac, rclo, rlu, rgss, rgso - use landunit_varcon, only : istsoil, istice_mec, istdlak, istwet - use clm_varctl , only : iulog - use pftconMod , only : noveg, ndllf_evr_tmp_tree, ndllf_evr_brl_tree - use pftconMod , only : ndllf_dcd_brl_tree, nbrdlf_evr_trp_tree - use pftconMod , only : nbrdlf_evr_tmp_tree, nbrdlf_dcd_trp_tree - use pftconMod , only : nbrdlf_dcd_tmp_tree, nbrdlf_dcd_brl_tree - use pftconMod , only : nbrdlf_evr_shrub, nbrdlf_dcd_tmp_shrub - use pftconMod , only : nbrdlf_dcd_brl_shrub,nc3_arctic_grass - use pftconMod , only : nc3_nonarctic_grass, nc4_grass, nc3crop - use pftconMod , only : nc3irrig, npcropmin, npcropmax - use clm_varcon , only : spval - - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(frictionvel_type) , intent(in) :: frictionvel_inst - type(photosyns_type) , intent(in) :: photosyns_inst - type(drydepvel_type) , intent(inout) :: drydepvel_inst - ! - ! !LOCAL VARIABLES: - integer :: c - real(r8) :: soilw, var_soilw, fact_h2, dv_soil_h2 - integer :: pi,g, l - integer :: ispec - integer :: length - integer :: wesveg !wesely vegegation index - integer :: clmveg !clm veg index from ivegtype - integer :: i - integer :: index_season !seasonal index based on LAI. This indexs wesely data tables - integer :: nstep !current step - integer :: indexp - - real(r8) :: pg ! surface pressure - real(r8) :: tc ! temperature in celsius - real(r8) :: es ! saturation vapor pressur - real(r8) :: ws ! saturation mixing ratio - real(r8) :: rmx ! resistance by vegetation - real(r8) :: qs ! saturation specific humidity - real(r8) :: dewm ! multiplier for rs when dew occurs - real(r8) :: crs ! multiplier to calculate crs - real(r8) :: rdc ! part of lower canopy resistance - real(r8) :: rain ! rain fall - real(r8) :: spec_hum ! specific humidity - real(r8) :: solar_flux ! solar radiation(direct beam) W/m2 - real(r8) :: lat ! latitude in degrees - real(r8) :: lon ! longitude in degrees - real(r8) :: sfc_temp ! surface temp - real(r8) :: minlai ! minimum of monthly lai - real(r8) :: maxlai ! maximum of monthly lai - real(r8) :: rds ! resistance for aerosols - - !mvm 11/30/2013 - real(r8) :: rlu_lai ! constant to calculate rlu over bulk canopy - - logical :: has_dew - logical :: has_rain - real(r8), parameter :: rain_threshold = 1.e-7_r8 ! of the order of 1cm/day expressed in m/s - - ! local arrays: dependent on species only - real(r8), dimension(n_drydep) :: rsmx !vegetative resistance (plant mesophyll) - real(r8), dimension(n_drydep) :: rclx !lower canopy resistance - real(r8), dimension(n_drydep) :: rlux !vegetative resistance (upper canopy) - real(r8), dimension(n_drydep) :: rgsx !gournd resistance - real(r8), dimension(n_drydep) :: heff - real(r8) :: rs ! stomatal resistance associated with dry deposition velocity (s/m) - real(r8) :: rc !combined surface resistance - real(r8) :: cts !correction to flu rcl and rgs for frost - real(r8) :: rlux_o3 !to calculate O3 leaf resistance in dew/rain conditions - - ! constants - real(r8), parameter :: slope = 0._r8 ! Used to calculate rdc in (lower canopy resistance) - integer, parameter :: wveg_unset = -1 ! Unset Wesley vegetation type - character(len=32), parameter :: subname = "depvel_compute" - - ! jfl : mods for PAN - real(r8) :: dv_pan - real(r8) :: c0_pan(11) = (/ 0.000_r8, 0.006_r8, 0.002_r8, 0.009_r8, 0.015_r8, & - 0.006_r8, 0.000_r8, 0.000_r8, 0.000_r8, 0.002_r8, 0.002_r8 /) - real(r8) :: k_pan (11) = (/ 0.000_r8, 0.010_r8, 0.005_r8, 0.004_r8, 0.003_r8, & - 0.005_r8, 0.000_r8, 0.000_r8, 0.000_r8, 0.075_r8, 0.002_r8 /) - !----------------------------------------------------------------------- - - if ( n_drydep == 0 .or. drydep_method /= DD_XLND ) return - - associate( & - forc_solai => atm2lnd_inst%forc_solai_grc , & ! Input: [real(r8) (:,:) ] direct beam radiation (visible only) - forc_solad => atm2lnd_inst%forc_solad_grc , & ! Input: [real(r8) (:,:) ] direct beam radiation (visible only) - forc_t => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:) ] downscaled atmospheric temperature (Kelvin) - forc_q => atm2lnd_inst%forc_q_downscaled_col , & ! Input: [real(r8) (:) ] downscaled atmospheric specific humidity (kg/kg) - forc_psrf => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] downscaled surface pressure (Pa) - forc_rain => atm2lnd_inst%forc_rain_downscaled_col , & ! Input: [real(r8) (:) ] downscaled rain rate [mm/s] - - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) - snow_depth => waterstate_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - - ram1 => frictionvel_inst%ram1_patch , & ! Input: [real(r8) (:) ] aerodynamical resistance - rb1 => frictionvel_inst%rb1_patch , & ! Input: [real(r8) (:) ] leaf boundary layer resistance [s/m] - vds => frictionvel_inst%vds_patch , & ! Input: [real(r8) (:) ] aerodynamical resistance - - rssun => photosyns_inst%rssun_patch , & ! Input: [real(r8) (:) ] stomatal resistance - rssha => photosyns_inst%rssha_patch , & ! Input: [real(r8) (:) ] shaded stomatal resistance (s/m) - - fsun => canopystate_inst%fsun_patch , & ! Input: [real(r8) (:) ] sunlit fraction of canopy - elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index with burying by snow - mlaidiff => canopystate_inst%mlaidiff_patch , & ! Input: [real(r8) (:) ] difference in lai between month one and month two - annlai => canopystate_inst%annlai_patch , & ! Input: [real(r8) (:,:) ] 12 months of monthly lai from input data set - - velocity => drydepvel_inst%velocity_patch , & ! Output: [real(r8) (:,:) ] cm/sec - rs_drydep => drydepvel_inst%rs_drydep_patch & ! Output: [real(r8) (:) ] stomatal resistance associated with Ozone dry deposition velocity (s/m) - ) - - !_________________________________________________________________ - ! Begin loop through patches - - pft_loop: do pi = bounds%begp,bounds%endp - l = patch%landunit(pi) - - active: if (patch%active(pi)) then - - c = patch%column(pi) - g = patch%gridcell(pi) - pg = forc_psrf(c) - spec_hum = forc_q(c) - rain = forc_rain(c) - sfc_temp = forc_t(c) - solar_flux = forc_solad(g,1) - lat = grc%latdeg(g) - lon = grc%londeg(g) - clmveg = patch%itype(pi) - soilw = h2osoi_vol(c,1) - - !map CLM veg type into Wesely veg type - wesveg = wveg_unset - if (clmveg == noveg ) wesveg = 8 - if (clmveg == ndllf_evr_tmp_tree ) wesveg = 5 - if (clmveg == ndllf_evr_brl_tree ) wesveg = 5 - if (clmveg == ndllf_dcd_brl_tree ) wesveg = 5 - if (clmveg == nbrdlf_evr_trp_tree ) wesveg = 4 - if (clmveg == nbrdlf_evr_tmp_tree ) wesveg = 4 - if (clmveg == nbrdlf_dcd_trp_tree ) wesveg = 4 - if (clmveg == nbrdlf_dcd_tmp_tree ) wesveg = 4 - if (clmveg == nbrdlf_dcd_brl_tree ) wesveg = 4 - if (clmveg == nbrdlf_evr_shrub ) wesveg = 11 - if (clmveg == nbrdlf_dcd_tmp_shrub ) wesveg = 11 - if (clmveg == nbrdlf_dcd_brl_shrub ) wesveg = 11 - if (clmveg == nc3_arctic_grass ) wesveg = 3 - if (clmveg == nc3_nonarctic_grass ) wesveg = 3 - if (clmveg == nc4_grass ) wesveg = 3 - if (clmveg == nc3crop ) wesveg = 2 - if (clmveg == nc3irrig ) wesveg = 2 - if (clmveg >= npcropmin .and. clmveg <= npcropmax ) wesveg = 2 - if (wesveg == wveg_unset )then - write(iulog,*) 'clmveg = ', clmveg, 'lun%itype = ', lun%itype(l) - call endrun(decomp_index=pi, clmlevel=namep, & - msg='ERROR: Not able to determine Wesley vegetation type'//& - errMsg(sourcefile, __LINE__)) - end if - - ! create seasonality index used to index wesely data tables from LAI, Bascially - !if elai is between max lai from input data and half that max the index_season=1 - - - !mail1j and mlai2j are the two monthly lai values pulled from a CLM input data set - !/fs/cgd/csm/inputdata/lnd/clm2/rawdata/mksrf_lai.nc. lai for dates in the middle - !of the month are interpolated using using these values and stored in the variable - !elai (done elsewhere). If the difference between mlai1j and mlai2j is greater - !than zero it is assumed to be fall and less than zero it is assumed to be spring. - - !wesely seasonal "index_season" - ! 1 - midsummer with lush vegetation - ! 2 - Autumn with unharvested cropland - ! 3 - Late autumn after frost, no snow - ! 4 - Winter, snow on ground and subfreezing - ! 5 - Transitional spring with partially green short annuals - - - !mlaidiff=jan-feb - minlai=minval(annlai(:,pi)) - maxlai=maxval(annlai(:,pi)) - - index_season = -1 - - if ( lun%itype(l) /= istsoil )then - if ( lun%itype(l) == istice_mec ) then - wesveg = 8 - index_season = 4 - elseif ( lun%itype(l) == istdlak ) then - wesveg = 7 - index_season = 4 - elseif ( lun%itype(l) == istwet ) then - wesveg = 9 - index_season = 2 - elseif ( lun%urbpoi(l) ) then - wesveg = 1 - index_season = 2 - end if - else if ( snow_depth(c) > 0 ) then - index_season = 4 - else if(elai(pi) > 0.5_r8*maxlai) then - index_season = 1 - endif - - if (index_season<0) then - if (elai(pi) < (minlai+0.05*(maxlai-minlai))) then - index_season = 3 - endif - endif - - if (index_season<0) then - if (mlaidiff(pi) > 0.0_r8) then - index_season = 2 - elseif (mlaidiff(pi) < 0.0_r8) then - index_season = 5 - elseif (mlaidiff(pi).eq.0.0_r8) then - index_season = 3 - endif - endif - - if (index_season<0) then - call endrun('ERROR: not able to determine season'//errmsg(sourcefile, __LINE__)) - endif - - ! saturation specific humidity - ! - es = 611_r8*exp(5414.77_r8*((1._r8/tmelt)-(1._r8/sfc_temp))) - ws = .622_r8*es/(pg-es) - qs = ws/(1._r8+ws) - - has_dew = .false. - if( qs <= spec_hum ) then - has_dew = .true. - end if - if( sfc_temp < tmelt ) then - has_dew = .false. - end if - - has_rain = rain > rain_threshold - - if ( has_dew .or. has_rain ) then - dewm = 3._r8 - else - dewm = 1._r8 - end if - - !Define tc - tc = sfc_temp - tmelt - - ! - ! rdc (lower canopy res) - ! - rdc=100._r8*(1._r8+1000._r8/(solar_flux+10._r8))/(1._r8+1000._r8*slope) - - ! surface resistance : depends on both land type and species - ! land types are computed seperately, then resistance is computed as average of values - ! following wesely rc=(1/(rs+rm) + 1/rlu +1/(rdc+rcl) + 1/(rac+rgs))**-1 - - !******************************************************* - call seq_drydep_setHCoeff( sfc_temp, heff(:n_drydep) ) - !********************************************************* - - species_loop1: do ispec=1, n_drydep - if(mapping(ispec) <= 0) cycle - - if(ispec.eq.index_o3.or.ispec.eq.index_o3a.or.ispec.eq.index_so2) then - rmx=0._r8 - else - rmx=1._r8/((heff(ispec)/3000._r8)+(100._r8*foxd(ispec))) - endif - - ! correction for frost - cts = 1000._r8*exp( -tc - 4._r8 ) - - !ground resistance - rgsx(ispec) = 1._r8/((heff(ispec)/(1.e5_r8*(rgss(index_season,wesveg)+cts))) + & - (foxd(ispec)/(rgso(index_season,wesveg)+cts))) - - !------------------------------------------------------------------------------------- - ! special case for H2 and CO;; CH4 is set ot a fraction of dv(H2) - !------------------------------------------------------------------------------------- - if( ispec == index_h2 .or. ispec == index_co .or. ispec == index_ch4 ) then - - if( ispec == index_co ) then - fact_h2 = 1.0_r8 - elseif ( ispec == index_h2 ) then - fact_h2 = 0.5_r8 - elseif ( ispec == index_ch4 ) then - fact_h2 = 50.0_r8 - end if - - !------------------------------------------------------------------------------------- - ! no deposition on snow, ice, desert, and water - !------------------------------------------------------------------------------------- - if( wesveg == 1 .or. wesveg == 7 .or. wesveg == 8 .or. index_season == 4 ) then - rgsx(ispec) = spval - else - var_soilw = max( .1_r8,min( soilw,.3_r8 ) ) - if( wesveg == 3 ) then - var_soilw = log( var_soilw ) - end if - dv_soil_h2 = h2_c(wesveg) + var_soilw*(h2_b(wesveg) + var_soilw*h2_a(wesveg)) - if( dv_soil_h2 > 0._r8 ) then - rgsx(ispec) = fact_h2/(dv_soil_h2*1.e-4_r8) - end if - end if - end if - - !------------------------------------------------------------------------------------- - ! no deposition on water or no vegetation or snow (elai<=0) - !------------------------------------------------------------------------------------- - - no_dep: if( wesveg == 7 .or. elai(pi).le.0_r8 ) then !mvm 11/26/2013 - rclx(ispec) = spval - rsmx(ispec) = spval - rlux(ispec) = spval - rs = spval - else - - !Stomatal resistance - - ! fvitt -- at midnight rssun and/or rssha can be zero in some places which sets rs to zero - ! --- this fix prevents divide by zero error (when rsmx is zero) - if (rssun(pi)>0._r8 .and. rssun(pi)<1.e30 .and. rssha(pi)>0._r8 .and. rssha(pi)<1.e30 ) then - !LKE: corrected rs to add rssun and rssha in parallel (11/30/2017) - rs=1._r8/(fsun(pi)*elai(pi)/rssun(pi) + (1.-fsun(pi))*elai(pi)/rssha(pi)) - else - rs=spval - endif - - rsmx(ispec) = rs*drat(ispec)+rmx - - ! Leaf resistance - !MVM: adjusted rlu by LAI to get leaf resistance over bulk canopy (gao and wesely, 1995) - rlu_lai=cts+rlu(index_season,wesveg)/elai(pi) - rlux(ispec) = rlu_lai/(1.e-5_r8*heff(ispec)+foxd(ispec)) - - !Lower canopy resistance - rclx(ispec) = 1._r8/((heff(ispec)/(1.e5_r8*(rcls(index_season,wesveg)+cts))) + & - (foxd(ispec)/(rclo(index_season,wesveg)+cts))) - - !----------------------------------- - !mvm 11/30/2013: special case for CO - !Dry deposition of CO and hydrocarbons is negligibly - !small in vegetation [Mueller and Brasseur, 1995]. - !------------------------------------ - if( ispec == index_co ) then - rclx(ispec) = spval - rsmx(ispec) = spval - rlux(ispec) = spval - endif - - !-------------------------------------------- - ! jfl : special case for PAN - !-------------------------------------------- - if( ispec == index_pan ) then - dv_pan = c0_pan(wesveg) * (1._r8 - exp(-k_pan(wesveg)*(rs*drat(ispec))*1.e-2_r8 )) - - if( dv_pan > 0._r8 .and. index_season /= 4 ) then - rsmx(ispec) = ( 1._r8/dv_pan ) - end if - end if - - endif no_dep - if ( ispec == index_o3 )then - rs_drydep(pi) = rs - end if - - end do species_loop1 - - - !---------------------------------------------- - !Adjustment for dew and rain in leaf resitances - !--------------------------------------------- - ! no effect over water - no_water: if( wesveg.ne.7 ) then - !MVM: effect only on vegetated areas (elai> 0) - with_LAI: if (elai(pi).gt.0._r8) then - - ! - ! no effect if sfc_temp < O C - ! - non_freezing: if(sfc_temp.gt.tmelt) then - if( has_dew ) then - rlu_lai=cts+rlu(index_season,wesveg)/elai(pi) - rlux_o3 = 1._r8/((1._r8/3000._r8)+(1._r8/(3._r8*rlu_lai))) - - if (index_o3 > 0) then - rlux(index_o3) = rlux_o3 - endif - if (index_o3a > 0) then - rlux(index_o3a) = rlux_o3 - endif - endif - - if(has_rain) then - rlu_lai=cts+rlu(index_season,wesveg)/elai(pi) - rlux_o3 = 1._r8/((1._r8/1000._r8)+(1._r8/(3._r8*rlu_lai))) - - if (index_o3 > 0) then - rlux(index_o3) = rlux_o3 - endif - if (index_o3a > 0) then - rlux(index_o3a) = rlux_o3 - endif - endif - - species_loop2: do ispec=1,n_drydep - if(mapping(ispec).le.0) cycle - if(ispec.ne.index_o3.and.ispec.ne.index_o3a.and.ispec.ne.index_so2) then - - if( has_dew .or. has_rain) then - rlu_lai=cts+rlu(index_season,wesveg)/elai(pi) - rlux(ispec)=1._r8/((1._r8/(3._r8*rlu_lai))+ & - (1.e-7_r8*heff(ispec))+(foxd(ispec)/rlux_o3)) - endif - - elseif(ispec.eq.index_so2) then - - if( has_dew ) then - rlux(ispec) = 100._r8 - endif - - if(has_rain) then - rlu_lai=cts+rlu(index_season,wesveg)/elai(pi) - rlux(ispec) = 1._r8/((1._r8/5000._r8)+(1._r8/(3._r8*rlu_lai))) - endif - - if( has_dew .or. has_rain ) then - !MVM:rlux=50 for SO2 in dew or rain only for *urban land* type surfaces. - if (wesveg.eq.1) then - rlux(ispec)=50._r8 - endif - endif - end if - !mvm 11/30/2013: special case for CO - if( ispec.eq.index_co ) then - rlux(ispec) = spval - endif - end do species_loop2 - endif non_freezing - endif with_LAI - endif no_water - - ! resistance for aerosols - rds = 1._r8/vds(pi) - - species_loop3: do ispec=1,n_drydep - if(mapping(ispec) <= 0) cycle - - ! - ! compute rc - ! - rc = 1._r8/((1._r8/rsmx(ispec))+(1._r8/rlux(ispec)) + & - (1._r8/(rdc+rclx(ispec)))+(1._r8/(rac(index_season,wesveg)+rgsx(ispec)))) - rc = max( 10._r8, rc) - ! - ! assume no surface resistance for SO2 over water - ! - if ( drydep_list(ispec) == 'SO2' .and. wesveg == 7 ) then - rc = 0._r8 - end if - - select case( drydep_list(ispec) ) - case ( 'SO4' ) - velocity(pi,ispec) = (1._r8/(ram1(pi)+rds))*100._r8 - case ( 'NH4','NH4NO3','XNH4NO3' ) - velocity(pi,ispec) = (1._r8/(ram1(pi)+0.5_r8*rds))*100._r8 - case ( 'Pb' ) - velocity(pi,ispec) = 0.2_r8 - case ( 'CB1', 'CB2', 'OC1', 'OC2', 'SOAM', 'SOAI', 'SOAT', 'SOAB', 'SOAX' ) - velocity(pi,ispec) = 0.10_r8 - case ( 'SO2' ) - velocity(pi,ispec) = (1._r8/(ram1(pi)+rb1(pi)+rc))*200._r8 - case default - velocity(pi,ispec) = (1._r8/(ram1(pi)+rb1(pi)+rc))*100._r8 - end select - end do species_loop3 - endif active - end do pft_loop - - end associate - - end subroutine depvel_compute - -end module DryDepVelocity diff --git a/src/biogeochem/SatellitePhenologyMod.F90 b/src/biogeochem/SatellitePhenologyMod.F90 deleted file mode 100644 index 78b2cf0e24..0000000000 --- a/src/biogeochem/SatellitePhenologyMod.F90 +++ /dev/null @@ -1,684 +0,0 @@ -module SatellitePhenologyMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! CLM Satelitte Phenology model (SP) ecosystem dynamics (phenology, vegetation). - ! Allow some subroutines to be used by the CLM Carbon Nitrogen model (CLMCN) - ! so that DryDeposition code can get estimates of LAI differences between months. - ! - ! !USES: - use shr_strdata_mod , only : shr_strdata_type, shr_strdata_create - use shr_strdata_mod , only : shr_strdata_print, shr_strdata_advance - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_kind_mod , only : CL => shr_kind_CL - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_varctl , only : scmlat,scmlon,single_column - use clm_varctl , only : iulog, use_lai_streams - use clm_varcon , only : grlnd - use controlMod , only : NLFilename - use decompMod , only : gsmap_lnd_gdc2glo - use domainMod , only : ldomain - use fileutils , only : getavu, relavu - use PatchType , only : patch - use CanopyStateType , only : canopystate_type - use WaterstateType , only : waterstate_type - use perf_mod , only : t_startf, t_stopf - use spmdMod , only : masterproc - use spmdMod , only : mpicom, comp_id - use mct_mod - use ncdio_pio - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: SatellitePhenology ! CLMSP Ecosystem dynamics: phenology, vegetation - public :: SatellitePhenologyInit ! Dynamically allocate memory - public :: interpMonthlyVeg ! interpolate monthly vegetation data - public :: readAnnualVegetation ! Read in annual vegetation (needed for Dry-deposition) - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: readMonthlyVegetation ! read monthly vegetation data for two months - private :: lai_init ! position datasets for LAI - private :: lai_interp ! interpolates between two years of LAI data - - ! !PRIVATE MEMBER DATA: - type(shr_strdata_type) :: sdat_lai ! LAI input data stream - ! - ! !PRIVATE TYPES: - integer , private :: InterpMonths1 ! saved month index - real(r8), private :: timwt(2) ! time weights for month 1 and month 2 - real(r8), private, allocatable :: mlai2t(:,:) ! lai for interpolation (2 months) - real(r8), private, allocatable :: msai2t(:,:) ! sai for interpolation (2 months) - real(r8), private, allocatable :: mhvt2t(:,:) ! top vegetation height for interpolation (2 months) - real(r8), private, allocatable :: mhvb2t(:,:) ! bottom vegetation height for interpolation(2 months) - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - ! - ! lai_init - ! - !----------------------------------------------------------------------- - subroutine lai_init(bounds) - ! - ! Initialize data stream information for LAI. - ! - ! - ! !USES: - use clm_varctl , only : inst_name - use clm_time_manager , only : get_calendar - use ncdio_pio , only : pio_subsystem - use shr_pio_mod , only : shr_pio_getiotype - use clm_nlUtilsMod , only : find_nlgroup_name - use ndepStreamMod , only : clm_domain_mct - use histFileMod , only : hist_addfld1d - use shr_stream_mod , only : shr_stream_file_null - use shr_string_mod , only : shr_string_listCreateField - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - ! - ! !LOCAL VARIABLES: - integer :: i ! index - integer :: stream_year_first_lai ! first year in Lai stream to use - integer :: stream_year_last_lai ! last year in Lai stream to use - integer :: model_year_align_lai ! align stream_year_first_lai with - integer :: nu_nml ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information - character(len=CL) :: stream_fldFileName_lai ! lai stream filename to read - character(len=CL) :: lai_mapalgo = 'bilinear' ! Mapping alogrithm - - character(*), parameter :: subName = "('laidyn_init')" - character(*), parameter :: F00 = "('(laidyn_init) ',4a)" - character(*), parameter :: laiString = "LAI" ! base string for field string - integer , parameter :: numLaiFields = 16 ! number of fields to build field string - character(SHR_KIND_CXX) :: fldList ! field string - !----------------------------------------------------------------------- - ! - ! deal with namelist variables here in init - ! - namelist /lai_streams/ & - stream_year_first_lai, & - stream_year_last_lai, & - model_year_align_lai, & - lai_mapalgo, & - stream_fldFileName_lai - - ! Default values for namelist - stream_year_first_lai = 1 ! first year in stream to use - stream_year_last_lai = 1 ! last year in stream to use - model_year_align_lai = 1 ! align stream_year_first_lai with this model year - stream_fldFileName_lai = shr_stream_file_null - - ! Read lai_streams namelist - if (masterproc) then - nu_nml = getavu() - open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - call find_nlgroup_name(nu_nml, 'lai_streams', status=nml_error) - if (nml_error == 0) then - read(nu_nml, nml=lai_streams,iostat=nml_error) - if (nml_error /= 0) then - call endrun(subname // ':: ERROR reading lai_streams namelist') - end if - else - call endrun(subname // ':: ERROR finding lai_streams namelist') - end if - close(nu_nml) - call relavu( nu_nml ) - endif - - call shr_mpi_bcast(stream_year_first_lai, mpicom) - call shr_mpi_bcast(stream_year_last_lai, mpicom) - call shr_mpi_bcast(model_year_align_lai, mpicom) - call shr_mpi_bcast(stream_fldFileName_lai, mpicom) - - if (masterproc) then - - write(iulog,*) ' ' - write(iulog,*) 'lai_stream settings:' - write(iulog,*) ' stream_year_first_lai = ',stream_year_first_lai - write(iulog,*) ' stream_year_last_lai = ',stream_year_last_lai - write(iulog,*) ' model_year_align_lai = ',model_year_align_lai - write(iulog,*) ' stream_fldFileName_lai = ',trim(stream_fldFileName_lai) - - endif - - call clm_domain_mct (bounds, dom_clm) - - ! - ! create the field list for these lai fields...use in shr_strdata_create - ! - fldList = shr_string_listCreateField( numLaiFields, laiString ) - - call shr_strdata_create(sdat_lai,name="laidyn", & - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & - mpicom=mpicom, compid=comp_id, & - gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & - nxg=ldomain%ni, nyg=ldomain%nj, & - yearFirst=stream_year_first_lai, & - yearLast=stream_year_last_lai, & - yearAlign=model_year_align_lai, & - offset=0, & - domFilePath='', & - domFileName=trim(stream_fldFileName_lai), & - domTvarName='time', & - domXvarName='lon' , & - domYvarName='lat' , & - domAreaName='area', & - domMaskName='mask', & - filePath='', & - filename=(/stream_fldFileName_lai/), & - fldListFile=fldList, & - fldListModel=fldList, & - fillalgo='none', & - mapalgo=lai_mapalgo, & - calendar=get_calendar(), & - taxmode='cycle' ) - - if (masterproc) then - call shr_strdata_print(sdat_lai,'LAI data') - endif - - end subroutine lai_init - - !----------------------------------------------------------------------- - ! - ! lai_interp - ! - !----------------------------------------------------------------------- - subroutine lai_interp(bounds, canopystate_inst) - ! - ! Interpolate data stream information for Lai. - ! - ! !USES: - use clm_time_manager, only : get_curr_date - use pftconMod , only : noveg - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds - type(canopystate_type) , intent(inout) :: canopystate_inst - ! - ! !LOCAL VARIABLES: - integer :: ivt, p, g, ip, ig, gpft - integer :: year ! year (0, ...) for nstep+1 - integer :: mon ! month (1, ..., 12) for nstep+1 - integer :: day ! day of month (1, ..., 31) for nstep+1 - integer :: sec ! seconds into current date for nstep+1 - integer :: mcdate ! Current model date (yyyymmdd) - character(len=CL) :: stream_var_name - !----------------------------------------------------------------------- - - call get_curr_date(year, mon, day, sec) - mcdate = year*10000 + mon*100 + day - - call shr_strdata_advance(sdat_lai, mcdate, sec, mpicom, 'laidyn') - - do p = bounds%begp, bounds%endp - ivt = patch%itype(p) - if (ivt /= noveg) then ! vegetated pft - write(stream_var_name,"(i6)") ivt - stream_var_name = 'LAI_'//trim(adjustl(stream_var_name)) - ip = mct_aVect_indexRA(sdat_lai%avs(1),trim(stream_var_name)) - endif - gpft = patch%gridcell(p) - - ! - ! Determine vector index corresponding to gpft - ! - ig = 0 - do g = bounds%begg,bounds%endg - ig = ig+1 - if (g == gpft) exit - end do - - ! - ! Set lai for each gridcell/patch combination - ! - if (ivt /= noveg) then ! vegetated pft - canopystate_inst%tlai_patch(p) = sdat_lai%avs(1)%rAttr(ip,ig) - else ! non-vegetated pft - canopystate_inst%tlai_patch(p) = 0._r8 - endif - end do - - end subroutine lai_interp - - !----------------------------------------------------------------------- - subroutine SatellitePhenologyInit (bounds) - ! - ! !DESCRIPTION: - ! Dynamically allocate memory and set to signaling NaN. - ! - ! !USES: - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: ier ! error code - !----------------------------------------------------------------------- - - InterpMonths1 = -999 ! saved month index - - ier = 0 - if(.not.allocated(mlai2t)) then - allocate (mlai2t(bounds%begp:bounds%endp,2), & - msai2t(bounds%begp:bounds%endp,2), & - mhvt2t(bounds%begp:bounds%endp,2), & - mhvb2t(bounds%begp:bounds%endp,2), stat=ier) - end if - if (ier /= 0) then - write(iulog,*) 'EcosystemDynini allocation error' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - mlai2t(bounds%begp : bounds%endp, :) = nan - msai2t(bounds%begp : bounds%endp, :) = nan - mhvt2t(bounds%begp : bounds%endp, :) = nan - mhvb2t(bounds%begp : bounds%endp, :) = nan - - if (use_lai_streams) then - call lai_init(bounds) - endif - - end subroutine SatellitePhenologyInit - - !----------------------------------------------------------------------- - subroutine SatellitePhenology(bounds, num_nolakep, filter_nolakep, & - waterstate_inst, canopystate_inst) - ! - ! !DESCRIPTION: - ! Ecosystem dynamics: phenology, vegetation - ! Calculates leaf areas (tlai, elai), stem areas (tsai, esai) and height (htop). - ! - ! !USES: - use pftconMod, only : noveg, nbrdlf_dcd_brl_shrub - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakep ! number of column non-lake points in patch filter - integer , intent(in) :: filter_nolakep(bounds%endp-bounds%begp+1) ! patch filter for non-lake points - type(waterstate_type) , intent(in) :: waterstate_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - ! - ! !LOCAL VARIABLES: - integer :: fp,p,c ! indices - real(r8) :: ol ! thickness of canopy layer covered by snow (m) - real(r8) :: fb ! fraction of canopy layer covered by snow - !----------------------------------------------------------------------- - - associate( & - frac_sno => waterstate_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - snow_depth => waterstate_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - tlai => canopystate_inst%tlai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index, no burying by snow - tsai => canopystate_inst%tsai_patch , & ! Output: [real(r8) (:) ] one-sided stem area index, no burying by snow - elai => canopystate_inst%elai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index with burying by snow - esai => canopystate_inst%esai_patch , & ! Output: [real(r8) (:) ] one-sided stem area index with burying by snow - htop => canopystate_inst%htop_patch , & ! Output: [real(r8) (:) ] canopy top (m) - hbot => canopystate_inst%hbot_patch , & ! Output: [real(r8) (:) ] canopy bottom (m) - frac_veg_nosno_alb => canopystate_inst%frac_veg_nosno_alb_patch & ! Output: [integer (:) ] fraction of vegetation not covered by snow (0 OR 1) [-] - ) - - if (use_lai_streams) then - call lai_interp(bounds, canopystate_inst) - endif - - do fp = 1, num_nolakep - p = filter_nolakep(fp) - c = patch%column(p) - - ! need to update elai and esai only every albedo time step so do not - ! have any inconsistency in lai and sai between SurfaceAlbedo calls (i.e., - ! if albedos are not done every time step). - ! leaf phenology - ! Set leaf and stem areas based on day of year - ! Interpolate leaf area index, stem area index, and vegetation heights - ! between two monthly - ! The weights below (timwt(1) and timwt(2)) were obtained by a call to - ! routine InterpMonthlyVeg in subroutine NCARlsm. - ! Field Monthly Values - ! ------------------------- - ! leaf area index LAI <- mlai1 and mlai2 - ! leaf area index SAI <- msai1 and msai2 - ! top height HTOP <- mhvt1 and mhvt2 - ! bottom height HBOT <- mhvb1 and mhvb2 - - if (.not. use_lai_streams) then - tlai(p) = timwt(1)*mlai2t(p,1) + timwt(2)*mlai2t(p,2) - endif - - tsai(p) = timwt(1)*msai2t(p,1) + timwt(2)*msai2t(p,2) - htop(p) = timwt(1)*mhvt2t(p,1) + timwt(2)*mhvt2t(p,2) - hbot(p) = timwt(1)*mhvb2t(p,1) + timwt(2)*mhvb2t(p,2) - - ! adjust lai and sai for burying by snow. if exposed lai and sai - ! are less than 0.05, set equal to zero to prevent numerical - ! problems associated with very small lai and sai. - - ! snow burial fraction for short vegetation (e.g. grasses) as in - ! Wang and Zeng, 2007. - - if (patch%itype(p) > noveg .and. patch%itype(p) <= nbrdlf_dcd_brl_shrub ) then - ol = min( max(snow_depth(c)-hbot(p), 0._r8), htop(p)-hbot(p)) - fb = 1._r8 - ol / max(1.e-06_r8, htop(p)-hbot(p)) - else - fb = 1._r8 - max(min(snow_depth(c),0.2_r8),0._r8)/0.2_r8 ! 0.2m is assumed - !depth of snow required for complete burial of grasses - endif - - ! area weight by snow covered fraction - - elai(p) = max(tlai(p)*(1.0_r8 - frac_sno(c)) + tlai(p)*fb*frac_sno(c), 0.0_r8) - esai(p) = max(tsai(p)*(1.0_r8 - frac_sno(c)) + tsai(p)*fb*frac_sno(c), 0.0_r8) - if (elai(p) < 0.05_r8) elai(p) = 0._r8 - if (esai(p) < 0.05_r8) esai(p) = 0._r8 - - ! Fraction of vegetation free of snow - - if ((elai(p) + esai(p)) >= 0.05_r8) then - frac_veg_nosno_alb(p) = 1 - else - frac_veg_nosno_alb(p) = 0 - end if - - end do ! end of patch loop - - end associate - - end subroutine SatellitePhenology - - !----------------------------------------------------------------------- - subroutine interpMonthlyVeg (bounds, canopystate_inst) - ! - ! !DESCRIPTION: - ! Determine if 2 new months of data are to be read. - ! - ! !USES: - use clm_varctl , only : fsurdat - use clm_time_manager, only : get_curr_date, get_step_size, get_nstep - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - type(canopystate_type), intent(inout) :: canopystate_inst - ! - ! !LOCAL VARIABLES: - integer :: kyr ! year (0, ...) for nstep+1 - integer :: kmo ! month (1, ..., 12) - integer :: kda ! day of month (1, ..., 31) - integer :: ksec ! seconds into current date for nstep+1 - real(r8):: dtime ! land model time step (sec) - real(r8):: t ! a fraction: kda/ndaypm - integer :: it(2) ! month 1 and month 2 (step 1) - integer :: months(2) ! months to be interpolated (1 to 12) - integer, dimension(12) :: ndaypm= & - (/31,28,31,30,31,30,31,31,30,31,30,31/) !days per month - !----------------------------------------------------------------------- - - dtime = get_step_size() - - call get_curr_date(kyr, kmo, kda, ksec, offset=int(dtime)) - - t = (kda-0.5_r8) / ndaypm(kmo) - it(1) = t + 0.5_r8 - it(2) = it(1) + 1 - months(1) = kmo + it(1) - 1 - months(2) = kmo + it(2) - 1 - if (months(1) < 1) months(1) = 12 - if (months(2) > 12) months(2) = 1 - timwt(1) = (it(1)+0.5_r8) - t - timwt(2) = 1._r8-timwt(1) - - if (InterpMonths1 /= months(1)) then - if (masterproc) then - write(iulog,*) 'Attempting to read monthly vegetation data .....' - write(iulog,*) 'nstep = ',get_nstep(),' month = ',kmo,' day = ',kda - end if - call t_startf('readMonthlyVeg') - call readMonthlyVegetation (bounds, fsurdat, months, canopystate_inst) - InterpMonths1 = months(1) - call t_stopf('readMonthlyVeg') - end if - - end subroutine interpMonthlyVeg - - !----------------------------------------------------------------------- - subroutine readAnnualVegetation (bounds, canopystate_inst) - ! - ! !DESCRIPTION: - ! read 12 months of veg data for dry deposition - ! - ! !USES: - use clm_varpar , only : numpft - use pftconMod , only : noveg - use domainMod , only : ldomain - use fileutils , only : getfil - use clm_varctl , only : fsurdat - use shr_scam_mod, only : shr_scam_getCloseLatLon - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - type(canopystate_type), intent(inout) :: canopystate_inst - ! - ! !LOCAL VARIABLES: - type(file_desc_t) :: ncid ! netcdf id - real(r8), pointer :: annlai(:,:) ! 12 months of monthly lai from input data set - real(r8), pointer :: mlai(:,:) ! lai read from input files - real(r8):: closelat,closelon ! single column vars - integer :: ier ! error code - integer :: g,k,l,m,n,p ! indices - integer :: ni,nj,ns ! indices - integer :: dimid,varid ! input netCDF id's - integer :: ntim ! number of input data time samples - integer :: nlon_i ! number of input data longitudes - integer :: nlat_i ! number of input data latitudes - integer :: npft_i ! number of input data patch types - integer :: closelatidx,closelonidx ! single column vars - logical :: isgrid2d ! true => file is 2d - character(len=256) :: locfn ! local file name - character(len=32) :: subname = 'readAnnualVegetation' - !----------------------------------------------------------------------- - - annlai => canopystate_inst%annlai_patch - - ! Determine necessary indices - - allocate(mlai(bounds%begg:bounds%endg,0:numpft), stat=ier) - if (ier /= 0) then - write(iulog,*)subname, 'allocation error ' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - if (masterproc) then - write (iulog,*) 'Attempting to read annual vegetation data .....' - end if - - call getfil(fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_inqfdims (ncid, isgrid2d, ni, nj, ns) - - if (ldomain%ns /= ns .or. ldomain%ni /= ni .or. ldomain%nj /= nj) then - write(iulog,*)trim(subname), 'ldomain and input file do not match dims ' - write(iulog,*)trim(subname), 'ldomain%ni,ni,= ',ldomain%ni,ni - write(iulog,*)trim(subname), 'ldomain%nj,nj,= ',ldomain%nj,nj - write(iulog,*)trim(subname), 'ldomain%ns,ns,= ',ldomain%ns,ns - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - call check_dim(ncid, 'lsmpft', numpft+1) - - if (single_column) then - call shr_scam_getCloseLatLon(locfn, scmlat, scmlon, & - closelat, closelon, closelatidx, closelonidx) - endif - - do k=1,12 !! loop over months and read vegetated data - - call ncd_io(ncid=ncid, varname='MONTHLY_LAI', flag='read', data=mlai, & - dim1name=grlnd, nt=k) - - !! only vegetated patches have nonzero values - !! Assign lai/sai/hgtt/hgtb to the top [maxpatch_pft] patches - !! as determined in subroutine surfrd - - do p = bounds%begp,bounds%endp - g =patch%gridcell(p) - if (patch%itype(p) /= noveg) then !! vegetated pft - do l = 0, numpft - if (l == patch%itype(p)) then - annlai(k,p) = mlai(g,l) - end if - end do - else !! non-vegetated pft - annlai(k,p) = 0._r8 - end if - end do ! end of loop over patches - - enddo ! months loop - - call ncd_pio_closefile(ncid) - - deallocate(mlai) - - endsubroutine readAnnualVegetation - - !----------------------------------------------------------------------- - subroutine readMonthlyVegetation (bounds, & - fveg, months, canopystate_inst) - ! - ! !DESCRIPTION: - ! Read monthly vegetation data for two consec. months. - ! - ! !USES: - use clm_varpar , only : numpft - use pftconMod , only : noveg - use fileutils , only : getfil - use spmdMod , only : masterproc, mpicom, MPI_REAL8, MPI_INTEGER - use shr_scam_mod , only : shr_scam_getCloseLatLon - use clm_time_manager , only : get_nstep - use netcdf - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - character(len=*) , intent(in) :: fveg ! file with monthly vegetation data - integer , intent(in) :: months(2) ! months to be interpolated (1 to 12) - type(canopystate_type), intent(inout) :: canopystate_inst - ! - ! !LOCAL VARIABLES: - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! netcdf id - integer :: g,n,k,l,m,p,ni,nj,ns ! indices - integer :: dimid,varid ! input netCDF id's - integer :: ntim ! number of input data time samples - integer :: nlon_i ! number of input data longitudes - integer :: nlat_i ! number of input data latitudes - integer :: npft_i ! number of input data patch types - integer :: ier ! error code - integer :: closelatidx,closelonidx - real(r8):: closelat,closelon - logical :: readvar - real(r8), pointer :: mlai(:,:) ! lai read from input files - real(r8), pointer :: msai(:,:) ! sai read from input files - real(r8), pointer :: mhgtt(:,:) ! top vegetation height - real(r8), pointer :: mhgtb(:,:) ! bottom vegetation height - character(len=32) :: subname = 'readMonthlyVegetation' - !----------------------------------------------------------------------- - - ! Determine necessary indices - - allocate(& - mlai(bounds%begg:bounds%endg,0:numpft), & - msai(bounds%begg:bounds%endg,0:numpft), & - mhgtt(bounds%begg:bounds%endg,0:numpft), & - mhgtb(bounds%begg:bounds%endg,0:numpft), & - stat=ier) - if (ier /= 0) then - write(iulog,*)subname, 'allocation big error ' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! ---------------------------------------------------------------------- - ! Open monthly vegetation file - ! Read data and convert from gridcell to patch data - ! ---------------------------------------------------------------------- - - call getfil(fveg, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - - if (single_column) then - call shr_scam_getCloseLatLon (ncid, scmlat, scmlon, closelat, closelon,& - closelatidx, closelonidx) - endif - - do k=1,2 !loop over months and read vegetated data - - call ncd_io(ncid=ncid, varname='MONTHLY_LAI', flag='read', data=mlai, dim1name=grlnd, & - nt=months(k), readvar=readvar) - if (.not. readvar) call endrun(msg=' ERROR: MONTHLY_LAI NOT on fveg file'//errMsg(sourcefile, __LINE__)) - - call ncd_io(ncid=ncid, varname='MONTHLY_SAI', flag='read', data=msai, dim1name=grlnd, & - nt=months(k), readvar=readvar) - if (.not. readvar) call endrun(msg=' ERROR: MONTHLY_SAI NOT on fveg file'//errMsg(sourcefile, __LINE__)) - - call ncd_io(ncid=ncid, varname='MONTHLY_HEIGHT_TOP', flag='read', data=mhgtt, dim1name=grlnd, & - nt=months(k), readvar=readvar) - if (.not. readvar) call endrun(msg=' ERROR: MONTHLY_HEIGHT_TOP NOT on fveg file'//errMsg(sourcefile, __LINE__)) - - call ncd_io(ncid=ncid, varname='MONTHLY_HEIGHT_BOT', flag='read', data=mhgtb, dim1name=grlnd, & - nt=months(k), readvar=readvar) - if (.not. readvar) call endrun(msg=' ERROR: MONTHLY_HEIGHT_TOP NOT on fveg file'//errMsg(sourcefile, __LINE__)) - - ! Only vegetated patches have nonzero values - ! Assign lai/sai/hgtt/hgtb to the top [maxpatch_pft] patches - ! as determined in subroutine surfrd - - do p = bounds%begp,bounds%endp - g =patch%gridcell(p) - if (patch%itype(p) /= noveg) then ! vegetated pft - do l = 0, numpft - if (l == patch%itype(p)) then - mlai2t(p,k) = mlai(g,l) - msai2t(p,k) = msai(g,l) - mhvt2t(p,k) = mhgtt(g,l) - mhvb2t(p,k) = mhgtb(g,l) - end if - end do - else ! non-vegetated pft - mlai2t(p,k) = 0._r8 - msai2t(p,k) = 0._r8 - mhvt2t(p,k) = 0._r8 - mhvb2t(p,k) = 0._r8 - end if - end do ! end of loop over patches - - end do ! end of loop over months - - call ncd_pio_closefile(ncid) - - if (masterproc) then - k = 2 - write(iulog,*) 'Successfully read monthly vegetation data for' - write(iulog,*) 'month ', months(k) - write(iulog,*) - end if - - deallocate(mlai, msai, mhgtt, mhgtb) - - do p = bounds%begp,bounds%endp - canopystate_inst%mlaidiff_patch(p) = mlai2t(p,1)-mlai2t(p,2) - enddo - - end subroutine readMonthlyVegetation - -end module SatellitePhenologyMod diff --git a/src/biogeochem/SpeciesBaseType.F90 b/src/biogeochem/SpeciesBaseType.F90 deleted file mode 100644 index 239ca91fe3..0000000000 --- a/src/biogeochem/SpeciesBaseType.F90 +++ /dev/null @@ -1,67 +0,0 @@ -module SpeciesBaseType - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Defines a base class for working with chemical species, such as building history and - ! restart field names. - ! - ! !USES: - ! - implicit none - private - - ! !PUBLIC TYPES: - - type, abstract, public :: species_base_type - contains - ! Get a history field name for this species - procedure(hist_fname_interface), public, deferred :: hist_fname - - ! Get a restart field name for this species - procedure(rest_fname_interface), public, deferred :: rest_fname - - ! Get the full species name - procedure(get_species_interface), public, deferred :: get_species - end type species_base_type - - abstract interface - pure function hist_fname_interface(this, basename, suffix) result(fname) - ! Get a history field name for this species - ! - ! basename gives the base name of the history field - ! - ! suffix, if provided, gives a suffix that appears after all species information - ! in the field name - import :: species_base_type - - character(len=:) , allocatable :: fname ! function result - class(species_base_type) , intent(in) :: this - character(len=*) , intent(in) :: basename - character(len=*) , optional, intent(in) :: suffix - end function hist_fname_interface - - function rest_fname_interface(this, basename, suffix) result(fname) - ! Get a restart field name for this species - ! - ! basename gives the base name of the restart field - ! - ! suffix, if provided, gives a suffix that appears after all species information - ! in the field name - import :: species_base_type - - character(len=:) , allocatable :: fname ! function result - class(species_base_type) , intent(in) :: this - character(len=*) , intent(in) :: basename - character(len=*) , optional, intent(in) :: suffix - end function rest_fname_interface - - pure function get_species_interface(this) result(species_name) - ! Get the full species name - import :: species_base_type - - character(len=:), allocatable :: species_name - class(species_base_type) , intent(in) :: this - end function get_species_interface - end interface - -end module SpeciesBaseType diff --git a/src/biogeochem/SpeciesIsotopeType.F90 b/src/biogeochem/SpeciesIsotopeType.F90 deleted file mode 100644 index b5fb749823..0000000000 --- a/src/biogeochem/SpeciesIsotopeType.F90 +++ /dev/null @@ -1,136 +0,0 @@ -module SpeciesIsotopeType - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Defines a class for working with chemical species, such as building history and - ! restart field names. - ! - ! This version is used for isotopic species - ! - ! !USES: - ! - use SpeciesBaseType, only : species_base_type - use abortutils, only : endrun - use shr_log_mod, only : errMsg => shr_log_errMsg - use clm_varctl, only : iulog - - implicit none - save - private - - ! COMPILER_BUG(wjs, 2016-03-16, pgi 15.10) Ideally, we would use allocatable characters - ! for species_name and isotope_name. However, this causes problems for pgi: it seems - ! that these allocatable characters randomly get changed. So, for now, using - ! fixed-length character variables. (It's possible that this was programmer error on my - ! part, although using allocatable character variables worked with other compilers.) - ! - ! If species_name and isotope_name were changed back to allocatable-length characters, - ! then we could remove the error checking in the constructor as well as various 'trim' - ! statements scattered throughout the code (because this%species_name and - ! this%isotope_name would already be trimmed). - integer, parameter :: species_name_maxlen = 8 - integer, parameter :: isotope_name_maxlen = 8 - - type, extends(species_base_type), public :: species_isotope_type - private - character(len=species_name_maxlen) :: species_name ! does not contain the isotope number - character(len=isotope_name_maxlen) :: isotope_name ! e.g., just the 13 for C13 - contains - procedure, public :: hist_fname - procedure, public :: rest_fname - procedure, public :: get_species - end type species_isotope_type - - interface species_isotope_type - module procedure constructor - end interface species_isotope_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - function constructor(species_name, isotope_name) result(this) - ! Create a species_isotope_type object - - type(species_isotope_type) :: this ! function result - character(len=*), intent(in) :: species_name ! e.g., 'C' or 'N' - without the isotope number - character(len=*), intent(in) :: isotope_name ! e.g., '13' for C13 - !----------------------------------------------------------------------- - - if (len_trim(species_name) > species_name_maxlen) then - write(iulog,*) 'species_isotope_type constructor: species_name too long' - write(iulog,*) trim(species_name) // ' exceeds max length: ', species_name_maxlen - call endrun(msg='species_isotope_type constructor: species_name too long: '// & - errMsg(sourcefile, __LINE__)) - end if - if (len_trim(isotope_name) > isotope_name_maxlen) then - write(iulog,*) 'species_isotope_type constructor: isotope_name too long' - write(iulog,*) trim(isotope_name) // ' exceeds max length: ', isotope_name_maxlen - call endrun(msg='species_isotope_type constructor: isotope_name too long: '// & - errMsg(sourcefile, __LINE__)) - end if - - this%species_name = trim(species_name) - this%isotope_name = trim(isotope_name) - end function constructor - - pure function hist_fname(this, basename, suffix) result(fname) - ! Get a history field name for this species - ! - ! basename gives the base name of the history field - ! - ! suffix, if provided, gives a suffix that appears after all species information - ! in the field name - - character(len=:), allocatable :: fname ! function result - class(species_isotope_type) , intent(in) :: this - character(len=*), intent(in) :: basename - character(len=*), optional, intent(in) :: suffix - !----------------------------------------------------------------------- - - fname = trim(this%species_name) // trim(this%isotope_name) // '_' // & - trim(basename) // trim(this%species_name) - if (present(suffix)) then - fname = trim(fname) // trim(suffix) - end if - - end function hist_fname - - function rest_fname(this, basename, suffix) result(fname) - ! Get a restart field name for this species - ! - ! basename gives the base name of the restart field - ! - ! suffix, if provided, gives a suffix that appears after all species information in - ! the field name - use shr_string_mod, only : shr_string_toLower - - character(len=:), allocatable :: fname ! function result - class(species_isotope_type) , intent(in) :: this - character(len=*), intent(in) :: basename - character(len=*), optional, intent(in) :: suffix - - character(len=:), allocatable :: species_name_lcase - !----------------------------------------------------------------------- - - species_name_lcase = shr_string_toLower(trim(this%species_name)) - fname = trim(basename) // species_name_lcase // '_' // trim(this%isotope_name) - if (present(suffix)) then - fname = trim(fname) // trim(suffix) - end if - - end function rest_fname - - pure function get_species(this) result(species_name) - ! Get the full species name (e.g., 'C13') - - character(len=:), allocatable :: species_name - class(species_isotope_type) , intent(in) :: this - !----------------------------------------------------------------------- - - species_name = trim(this%species_name) // trim(this%isotope_name) - - end function get_species - -end module SpeciesIsotopeType diff --git a/src/biogeochem/SpeciesNonIsotopeType.F90 b/src/biogeochem/SpeciesNonIsotopeType.F90 deleted file mode 100644 index 0daf6b3f72..0000000000 --- a/src/biogeochem/SpeciesNonIsotopeType.F90 +++ /dev/null @@ -1,125 +0,0 @@ -module SpeciesNonIsotopeType - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Defines a class for working with chemical species, such as building history and - ! restart field names. - ! - ! This version is used for non-isotopic species - ! - ! !USES: - ! - use SpeciesBaseType, only : species_base_type - use abortutils, only : endrun - use shr_log_mod, only : errMsg => shr_log_errMsg - use clm_varctl, only : iulog - - implicit none - save - private - - ! COMPILER_BUG(wjs, 2016-03-16, pgi 15.10) Ideally, we would use an allocatable - ! character variable for species_name. However, this causes problems for pgi: it seems - ! that this allocatable character variable randomly gets changed. So, for now, using a - ! fixed-length character variable. (It's possible that this was programmer error on my - ! part, although using allocatable character variables worked with other compilers.) - ! - ! If species_name was changed back to an allocatable-length character variable, then we - ! could remove the error checking in the constructor as well as various 'trim' - ! statements scattered throughout the code (because this%species_name would already be - ! trimmed). - integer, parameter :: species_name_maxlen = 8 - - type, extends(species_base_type), public :: species_non_isotope_type - private - character(len=species_name_maxlen) :: species_name - contains - procedure, public :: hist_fname - procedure, public :: rest_fname - procedure, public :: get_species - end type species_non_isotope_type - - interface species_non_isotope_type - module procedure constructor - end interface species_non_isotope_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - function constructor(species_name) result(this) - ! Create a species_non_isotope_type object - - type(species_non_isotope_type) :: this ! function result - character(len=*), intent(in) :: species_name ! e.g., 'C' or 'N' - !----------------------------------------------------------------------- - - if (len_trim(species_name) > species_name_maxlen) then - write(iulog,*) 'species_isotope_type constructor: species_name too long' - write(iulog,*) trim(species_name) // ' exceeds max length: ', species_name_maxlen - call endrun(msg='species_isotope_type constructor: species_name too long: '// & - errMsg(sourcefile, __LINE__)) - end if - - this%species_name = trim(species_name) - end function constructor - - pure function hist_fname(this, basename, suffix) result(fname) - ! Get a history field name for this species - ! - ! basename gives the base name of the history field - ! - ! suffix, if provided, gives a suffix that appears after all species information - ! in the field name - - character(len=:), allocatable :: fname ! function result - class(species_non_isotope_type) , intent(in) :: this - character(len=*), intent(in) :: basename - character(len=*), optional, intent(in) :: suffix - !----------------------------------------------------------------------- - - fname = trim(basename) // trim(this%species_name) - if (present(suffix)) then - fname = trim(fname) // trim(suffix) - end if - - end function hist_fname - - function rest_fname(this, basename, suffix) result(fname) - ! Get a restart field name for this species - ! - ! basename gives the base name of the restart field - ! - ! suffix, if provided, gives a suffix that appears after all species information in - ! the field name - use shr_string_mod, only : shr_string_toLower - - character(len=:), allocatable :: fname ! function result - class(species_non_isotope_type) , intent(in) :: this - character(len=*), intent(in) :: basename - character(len=*), optional, intent(in) :: suffix - - character(len=:), allocatable :: species_name_lcase - !----------------------------------------------------------------------- - - species_name_lcase = shr_string_toLower(trim(this%species_name)) - fname = trim(basename) // trim(species_name_lcase) - if (present(suffix)) then - fname = trim(fname) // trim(suffix) - end if - - end function rest_fname - - pure function get_species(this) result(species_name) - ! Get the full species name - - character(len=:), allocatable :: species_name - class(species_non_isotope_type) , intent(in) :: this - !----------------------------------------------------------------------- - - species_name = trim(this%species_name) - - end function get_species - -end module SpeciesNonIsotopeType diff --git a/src/biogeochem/VOCEmissionMod.F90 b/src/biogeochem/VOCEmissionMod.F90 deleted file mode 100644 index 1c9a0e58f6..0000000000 --- a/src/biogeochem/VOCEmissionMod.F90 +++ /dev/null @@ -1,26 +0,0 @@ -module VOCEmissionMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Volatile organic compound emission - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - ! - ! !PUBLIC TYPES: - type, public :: vocemis_type - end type vocemis_type - ! - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -end module VOCEmissionMod - - diff --git a/src/biogeochem/ch4Mod.F90 b/src/biogeochem/ch4Mod.F90 deleted file mode 100644 index 81978bf6dd..0000000000 --- a/src/biogeochem/ch4Mod.F90 +++ /dev/null @@ -1,123 +0,0 @@ -module ch4Mod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module holding routines to calculate methane fluxes - ! The driver averages up to gridcell, weighting by finundated, and checks for balance errors. - ! Sources, sinks, "competition" for CH4 & O2, & transport are resolved in ch4_tran. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=), shr_infnan_isnan - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - ! - implicit none - private - - ! Non-tunable constants - real(r8) :: rgasm ! J/mol.K; rgas / 1000; will be set below - real(r8), parameter :: rgasLatm = 0.0821_r8 ! L.atm/mol.K - - type, public :: ch4_type - real(r8), pointer, private :: ch4_prod_depth_sat_col (:,:) ! col CH4 production rate from methanotrophs (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_prod_depth_unsat_col (:,:) ! col CH4 production rate from methanotrophs (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_prod_depth_lake_col (:,:) ! col CH4 production rate from methanotrophs (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_oxid_depth_sat_col (:,:) ! col CH4 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_oxid_depth_unsat_col (:,:) ! col CH4 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_oxid_depth_lake_col (:,:) ! col CH4 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_aere_depth_sat_col (:,:) ! col CH4 loss rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_aere_depth_unsat_col (:,:) ! col CH4 loss rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_tran_depth_sat_col (:,:) ! col CH4 loss rate via transpiration in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_tran_depth_unsat_col (:,:) ! col CH4 loss rate via transpiration in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_ebul_depth_sat_col (:,:) ! col CH4 loss rate via ebullition in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_ebul_depth_unsat_col (:,:) ! col CH4 loss rate via ebullition in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_ebul_total_sat_col (:) ! col Total col CH4 ebullition (mol/m2/s) - real(r8), pointer, private :: ch4_ebul_total_unsat_col (:) ! col Total col CH4 ebullition (mol/m2/s) - real(r8), pointer, private :: ch4_surf_aere_sat_col (:) ! col CH4 aerenchyma flux to atmosphere (after oxidation) (mol/m2/s) - real(r8), pointer, private :: ch4_surf_aere_unsat_col (:) ! col CH4 aerenchyma flux to atmosphere (after oxidation) (mol/m2/s) - real(r8), pointer, private :: ch4_surf_ebul_sat_col (:) ! col CH4 ebullition flux to atmosphere (after oxidation) (mol/m2/s) - real(r8), pointer, private :: ch4_surf_ebul_unsat_col (:) ! col CH4 ebullition flux to atmosphere (after oxidation) (mol/m2/s) - real(r8), pointer, private :: ch4_surf_ebul_lake_col (:) ! col CH4 ebullition flux to atmosphere (after oxidation) (mol/m2/s) - real(r8), pointer, private :: co2_aere_depth_sat_col (:,:) ! col CO2 loss rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: co2_aere_depth_unsat_col (:,:) ! col CO2 loss rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: o2_oxid_depth_sat_col (:,:) ! col O2 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: o2_oxid_depth_unsat_col (:,:) ! col O2 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: o2_aere_depth_sat_col (:,:) ! col O2 gain rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: o2_aere_depth_unsat_col (:,:) ! col O2 gain rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: co2_decomp_depth_sat_col (:,:) ! col CO2 production during decomposition in each soil layer (nlevsoi) (mol/m3/s) - real(r8), pointer, private :: co2_decomp_depth_unsat_col (:,:) ! col CO2 production during decomposition in each soil layer (nlevsoi) (mol/m3/s) - real(r8), pointer, private :: co2_oxid_depth_sat_col (:,:) ! col CO2 production rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: co2_oxid_depth_unsat_col (:,:) ! col CO2 production rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: conc_o2_lake_col (:,:) ! col O2 conc in each soil layer (mol/m3) (nlevsoi) - real(r8), pointer, private :: conc_ch4_sat_col (:,:) ! col CH4 conc in each soil layer (mol/m3) (nlevsoi) - real(r8), pointer, private :: conc_ch4_unsat_col (:,:) ! col CH4 conc in each soil layer (mol/m3) (nlevsoi) - real(r8), pointer, private :: conc_ch4_lake_col (:,:) ! col CH4 conc in each soil layer (mol/m3) (nlevsoi) - real(r8), pointer, private :: ch4_surf_diff_sat_col (:) ! col CH4 surface flux (mol/m2/s) - real(r8), pointer, private :: ch4_surf_diff_unsat_col (:) ! col CH4 surface flux (mol/m2/s) - real(r8), pointer, private :: ch4_surf_diff_lake_col (:) ! col CH4 surface flux (mol/m2/s) - real(r8), pointer, private :: ch4_dfsat_flux_col (:) ! col CH4 flux to atm due to decreasing fsat (kg C/m^2/s) [+] - - real(r8), pointer, private :: zwt_ch4_unsat_col (:) ! col depth of water table for unsaturated fraction (m) - real(r8), pointer, private :: lake_soilc_col (:,:) ! col total soil organic matter found in level (g C / m^3) (nlevsoi) - real(r8), pointer, private :: totcolch4_col (:) ! col total methane found in soil col (g C / m^2) - real(r8), pointer, private :: totcolch4_bef_col (:) ! col total methane found in soil col, start of timestep (g C / m^2) - real(r8), pointer, private :: annsum_counter_col (:) ! col seconds since last annual accumulator turnover - real(r8), pointer, private :: tempavg_somhr_col (:) ! col temporary average SOM heterotrophic resp. (gC/m2/s) - real(r8), pointer, private :: annavg_somhr_col (:) ! col annual average SOM heterotrophic resp. (gC/m2/s) - real(r8), pointer, private :: tempavg_finrw_col (:) ! col respiration-weighted annual average of finundated - real(r8), pointer, private :: annavg_finrw_col (:) ! col respiration-weighted annual average of finundated - real(r8), pointer, private :: sif_col (:) ! col (unitless) ratio applied to sat. prod. to account for seasonal inundation - real(r8), pointer, private :: ch4stress_unsat_col (:,:) ! col Ratio of methane available to the total per-timestep methane sinks (nlevsoi) - real(r8), pointer, private :: ch4stress_sat_col (:,:) ! col Ratio of methane available to the total per-timestep methane sinks (nlevsoi) - real(r8), pointer, private :: qflx_surf_lag_col (:) ! col time-lagged surface runoff (mm H2O /s) - real(r8), pointer, private :: finundated_lag_col (:) ! col time-lagged fractional inundated area - real(r8), pointer, private :: layer_sat_lag_col (:,:) ! col Lagged saturation status of soil layer in the unsaturated zone (1 = sat) - real(r8), pointer, private :: zwt0_col (:) ! col coefficient for determining finundated (m) - real(r8), pointer, private :: f0_col (:) ! col maximum inundated fraction for a gridcell (for methane code) - real(r8), pointer, private :: p3_col (:) ! col coefficient for determining finundated (m) - real(r8), pointer, private :: pH_col (:) ! col pH values for methane production - ! - real(r8), pointer, private :: dyn_ch4bal_adjustments_col (:) ! adjustments to each column made in this timestep via dynamic column area adjustments (only makes sense at the column-level: meaningless if averaged to the gridcell-level) (g C / m^2) - ! - real(r8), pointer, private :: c_atm_grc (:,:) ! grc atmospheric conc of CH4, O2, CO2 (mol/m3) - real(r8), pointer, private :: ch4co2f_grc (:) ! grc CO2 production from CH4 oxidation (g C/m**2/s) - real(r8), pointer, private :: ch4prodg_grc (:) ! grc average CH4 production (g C/m^2/s) - ! - ! for aerenchyma calculations - real(r8), pointer, private :: annavg_agnpp_patch (:) ! patch (gC/m2/s) annual average aboveground NPP - real(r8), pointer, private :: annavg_bgnpp_patch (:) ! patch (gC/m2/s) annual average belowground NPP - real(r8), pointer, private :: tempavg_agnpp_patch (:) ! patch (gC/m2/s) temp. average aboveground NPP - real(r8), pointer, private :: tempavg_bgnpp_patch (:) ! patch (gC/m2/s) temp. average belowground NPP - ! - ! The following variable reports whether this is the first timestep that includes - ! ch4. It is true in the first timestep of the run, and remains true until the - ! methane code is first run - at which point it becomes false, and remains - ! false. This could be a scalar, but scalars cause problems with threading, so we use - ! a column-level array (column-level for convenience, because it is referenced in - ! column-level loops). - logical , pointer, private :: ch4_first_time_col (:) ! col whether this is the first time step that includes ch4 - ! - real(r8), pointer, public :: finundated_col (:) ! col fractional inundated area (excluding dedicated wetland cols) - real(r8), pointer, public :: finundated_pre_snow_col (:) ! col fractional inundated area (excluding dedicated wetland cols) before snow - real(r8), pointer, public :: o2stress_unsat_col (:,:) ! col Ratio of oxygen available to that demanded by roots, aerobes, & methanotrophs (nlevsoi) - real(r8), pointer, public :: o2stress_sat_col (:,:) ! col Ratio of oxygen available to that demanded by roots, aerobes, & methanotrophs (nlevsoi) - real(r8), pointer, public :: conc_o2_sat_col (:,:) ! col O2 conc in each soil layer (mol/m3) (nlevsoi) - real(r8), pointer, public :: conc_o2_unsat_col (:,:) ! col O2 conc in each soil layer (mol/m3) (nlevsoi) - real(r8), pointer, public :: o2_decomp_depth_sat_col (:,:) ! col O2 consumption during decomposition in each soil layer (nlevsoi) (mol/m3/s) - real(r8), pointer, public :: o2_decomp_depth_unsat_col (:,:) ! col O2 consumption during decomposition in each soil layer (nlevsoi) (mol/m3/s) - real(r8), pointer, public :: ch4_surf_flux_tot_col (:) ! col CH4 surface flux (to atm) (kg C/m**2/s) - - real(r8), pointer, public :: grnd_ch4_cond_patch (:) ! patch tracer conductance for boundary layer [m/s] - real(r8), pointer, public :: grnd_ch4_cond_col (:) ! col tracer conductance for boundary layer [m/s] - - end type ch4_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -end module ch4Mod - diff --git a/src/biogeophys/ActiveLayerMod.F90 b/src/biogeophys/ActiveLayerMod.F90 deleted file mode 100644 index a1b871829c..0000000000 --- a/src/biogeophys/ActiveLayerMod.F90 +++ /dev/null @@ -1,155 +0,0 @@ -module ActiveLayerMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module holding routines for calculation of active layer dynamics - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ - use clm_varctl , only : iulog - use TemperatureType , only : temperature_type - use CanopyStateType , only : canopystate_type - use GridcellType , only : grc - use ColumnType , only : col - ! - implicit none - save - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public:: alt_calc - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine alt_calc(num_soilc, filter_soilc, & - temperature_inst, canopystate_inst) - ! - ! !DESCRIPTION: - ! define active layer thickness similarly to frost_table, except set as deepest thawed layer and define on nlevgrnd - ! also update annual maxima, and keep track of prior year for rooting memory - ! - ! BUG(wjs, 2014-12-15, bugz 2107) Because of this routine's placement in the driver - ! sequence (it is called very early in each timestep, before weights are adjusted and - ! filters are updated), it may be necessary for this routine to compute values over - ! inactive as well as active points (since some inactive points may soon become - ! active) - so that's what is done now. Currently, it seems to be okay to do this, - ! because the variables computed here seem to only depend on quantities that are valid - ! over inactive as well as active points. - ! - ! !USES: - use shr_const_mod , only : SHR_CONST_TKFRZ - use clm_varpar , only : nlevgrnd - use clm_time_manager , only : get_curr_date, get_step_size - use clm_varctl , only : iulog - use clm_varcon , only : zsoi - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(temperature_type) , intent(in) :: temperature_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - ! - ! !LOCAL VARIABLES: - integer :: c, j, fc, g ! counters - integer :: alt_ind ! index of base of activel layer - integer :: year ! year (0, ...) for nstep+1 - integer :: mon ! month (1, ..., 12) for nstep+1 - integer :: day ! day of month (1, ..., 31) for nstep+1 - integer :: sec ! seconds into current date for nstep+1 - integer :: dtime ! time step length in seconds - integer :: k_frz ! index of first nonfrozen soil layer - logical :: found_thawlayer ! used to break loop when first unfrozen layer reached - real(r8) :: t1, t2, z1, z2 ! temporary variables - !----------------------------------------------------------------------- - - associate( & - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - - alt => canopystate_inst%alt_col , & ! Output: [real(r8) (:) ] current depth of thaw - altmax => canopystate_inst%altmax_col , & ! Output: [real(r8) (:) ] maximum annual depth of thaw - altmax_lastyear => canopystate_inst%altmax_lastyear_col , & ! Output: [real(r8) (:) ] prior year maximum annual depth of thaw - alt_indx => canopystate_inst%alt_indx_col , & ! Output: [integer (:) ] current depth of thaw - altmax_indx => canopystate_inst%altmax_indx_col , & ! Output: [integer (:) ] maximum annual depth of thaw - altmax_lastyear_indx => canopystate_inst%altmax_lastyear_indx_col & ! Output: [integer (:) ] prior year maximum annual depth of thaw - ) - - ! on a set annual timestep, update annual maxima - ! make this 1 January for NH columns, 1 July for SH columns - call get_curr_date(year, mon, day, sec) - dtime = get_step_size() - if ( (mon .eq. 1) .and. (day .eq. 1) .and. ( sec / dtime .eq. 1) ) then - do fc = 1,num_soilc - c = filter_soilc(fc) - g = col%gridcell(c) - if ( grc%lat(g) > 0. ) then - altmax_lastyear(c) = altmax(c) - altmax_lastyear_indx(c) = altmax_indx(c) - altmax(c) = 0. - altmax_indx(c) = 0 - endif - end do - endif - if ( (mon .eq. 7) .and. (day .eq. 1) .and. ( sec / dtime .eq. 1) ) then - do fc = 1,num_soilc - c = filter_soilc(fc) - g = col%gridcell(c) - if ( grc%lat(g) <= 0. ) then - altmax_lastyear(c) = altmax(c) - altmax_lastyear_indx(c) = altmax_indx(c) - altmax(c) = 0. - altmax_indx(c) = 0 - endif - end do - endif - - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! calculate alt for a given timestep - ! start from base of soil and search upwards for first thawed layer. - ! note that this will put talik in with active layer - ! a different way of doing this could be to keep track of how long a given layer has ben frozen for, and define ALT as the first layer that has been frozen for less than 2 years. - if (t_soisno(c,nlevgrnd) > SHR_CONST_TKFRZ ) then - alt(c) = zsoi(nlevgrnd) - alt_indx(c) = nlevgrnd - else - k_frz=0 - found_thawlayer = .false. - do j=nlevgrnd-1,1,-1 - if ( ( t_soisno(c,j) > SHR_CONST_TKFRZ ) .and. .not. found_thawlayer ) then - k_frz=j - found_thawlayer = .true. - endif - end do - - if ( k_frz > 0 ) then - ! define active layer as the depth at which the linearly interpolated temperature line intersects with zero - z1 = zsoi(k_frz) - z2 = zsoi(k_frz+1) - t1 = t_soisno(c,k_frz) - t2 = t_soisno(c,k_frz+1) - alt(c) = z1 + (t1-SHR_CONST_TKFRZ)*(z2-z1)/(t1-t2) - alt_indx(c) = k_frz - else - alt(c)=0._r8 - alt_indx(c) = 0 - endif - endif - - - ! if appropriate, update maximum annual active layer thickness - if (alt(c) > altmax(c)) then - altmax(c) = alt(c) - altmax_indx(c) = alt_indx(c) - endif - - end do - - end associate - - end subroutine alt_calc - -end module ActiveLayerMod diff --git a/src/biogeophys/AerosolMod.F90 b/src/biogeophys/AerosolMod.F90 deleted file mode 100644 index 06111cd1d0..0000000000 --- a/src/biogeophys/AerosolMod.F90 +++ /dev/null @@ -1,29 +0,0 @@ -module AerosolMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use abortutils , only : endrun - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - ! - ! !PUBLIC DATA MEMBERS: - real(r8), public, parameter :: snw_rds_min = 54.526_r8 ! minimum allowed snow effective radius (also cold "fresh snow" value) [microns] - real(r8), public :: fresh_snw_rds_max = 204.526_r8 ! maximum warm fresh snow effective radius [microns] - ! - type, public :: aerosol_type - - end type aerosol_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -end module AerosolMod diff --git a/src/biogeophys/BandDiagonalMod.F90 b/src/biogeophys/BandDiagonalMod.F90 deleted file mode 100644 index 5065ea59b5..0000000000 --- a/src/biogeophys/BandDiagonalMod.F90 +++ /dev/null @@ -1,224 +0,0 @@ -module BandDiagonalMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Band Diagonal matrix solution - ! - ! !USES: - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varctl , only : iulog - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: BandDiagonal - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine BandDiagonal(bounds, lbj, ubj, jtop, jbot, numf, filter, nband, b, r, u) - ! - ! !DESCRIPTION: - ! Tridiagonal matrix solution - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds - integer , intent(in) :: lbj, ubj ! lbinning and ubing level indices - integer , intent(in) :: jtop( bounds%begc: ) ! top level for each column [col] - integer , intent(in) :: jbot( bounds%begc: ) ! bottom level for each column [col] - integer , intent(in) :: numf ! filter dimension - integer , intent(in) :: nband ! band width - integer , intent(in) :: filter(:) ! filter - real(r8), intent(in) :: b( bounds%begc: , 1: , lbj: ) ! compact band matrix [col, nband, j] - real(r8), intent(in) :: r( bounds%begc: , lbj: ) ! "r" rhs of linear system [col, j] - real(r8), intent(inout) :: u( bounds%begc: , lbj: ) ! solution [col, j] - ! - ! ! LOCAL VARIABLES: - integer :: j,ci,fc,info,m,n !indices - integer :: kl,ku !number of sub/super diagonals - integer, allocatable :: ipiv(:) !temporary - real(r8),allocatable :: ab(:,:),temp(:,:) !compact storage array - real(r8),allocatable :: result(:) - - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(jtop) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(jbot) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(b) == (/bounds%endc, nband, ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(r) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(u) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - - -!!$ SUBROUTINE SGBSV( N, KL, KU, NRHS, AB, LDAB, IPIV, B, LDB, INFO ) -!!$* -!!$* -- LAPACK driver routine (version 3.1) -- -!!$* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. -!!$* November 2006 -!!$* -!!$* .. Scalar Arguments .. -!!$ INTEGER INFO, KL, KU, LDAB, LDB, N, NRHS -!!$* .. -!!$* .. Array Arguments .. -!!$ INTEGER IPIV( * ) -!!$ REAL AB( LDAB, * ), B( LDB, * ) -!!$* .. -!!$* -!!$* Purpose -!!$* ======= -!!$* -!!$* SGBSV computes the solution to a real system of linear equations -!!$* A * X = B, where A is a band matrix of order N with KL subdiagonals -!!$* and KU superdiagonals, and X and B are N-by-NRHS matrices. -!!$* -!!$* The LU decomposition with partial pivoting and row interchanges is -!!$* used to factor A as A = L * U, where L is a product of permutation -!!$* and unit lower triangular matrices with KL subdiagonals, and U is -!!$* upper triangular with KL+KU superdiagonals. The factored form of A -!!$* is then used to solve the system of equations A * X = B. -!!$* -!!$* Arguments -!!$* ========= -!!$* -!!$* N (input) INTEGER -!!$* The number of linear equations, i.e., the order of the -!!$* matrix A. N >= 0. -!!$* -!!$* KL (input) INTEGER -!!$* The number of subdiagonals within the band of A. KL >= 0. -!!$* -!!$* KU (input) INTEGER -!!$* The number of superdiagonals within the band of A. KU >= 0. -!!$* -!!$* NRHS (input) INTEGER -!!$* The number of right hand sides, i.e., the number of columns -!!$* of the matrix B. NRHS >= 0. -!!$* -!!$* AB (input/output) REAL array, dimension (LDAB,N) -!!$* On entry, the matrix A in band storage, in rows KL+1 to -!!$* 2*KL+KU+1; rows 1 to KL of the array need not be set. -!!$* The j-th column of A is stored in the j-th column of the -!!$* array AB as follows: -!!$* AB(KL+KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+KL) -!!$* On exit, details of the factorization: U is stored as an -!!$* upper triangular band matrix with KL+KU superdiagonals in -!!$* rows 1 to KL+KU+1, and the multipliers used during the -!!$* factorization are stored in rows KL+KU+2 to 2*KL+KU+1. -!!$* See below for further details. -!!$* -!!$* LDAB (input) INTEGER -!!$* The leading dimension of the array AB. LDAB >= 2*KL+KU+1. -!!$* -!!$* IPIV (output) INTEGER array, dimension (N) -!!$* The pivot indices that define the permutation matrix P; -!!$* row i of the matrix was interchanged with row IPIV(i). -!!$* -!!$* B (input/output) REAL array, dimension (LDB,NRHS) -!!$* On entry, the N-by-NRHS right hand side matrix B. -!!$* On exit, if INFO = 0, the N-by-NRHS solution matrix X. -!!$* -!!$* LDB (input) INTEGER -!!$* The leading dimension of the array B. LDB >= max(1,N). -!!$* -!!$* INFO (output) INTEGER -!!$* = 0: successful exit -!!$* < 0: if INFO = -i, the i-th argument had an illegal value -!!$* > 0: if INFO = i, U(i,i) is exactly zero. The factorization -!!$* has been completed, but the factor U is exactly -!!$* singular, and the solution has not been computed. -!!$* -!!$* Further Details -!!$* =============== -!!$* -!!$* The band storage scheme is illustrated by the following example, when -!!$* M = N = 6, KL = 2, KU = 1: -!!$* -!!$* On entry: On exit: -!!$* -!!$* * * * + + + * * * u14 u25 u36 -!!$* * * + + + + * * u13 u24 u35 u46 -!!$* * a12 a23 a34 a45 a56 * u12 u23 u34 u45 u56 -!!$* a11 a22 a33 a44 a55 a66 u11 u22 u33 u44 u55 u66 -!!$* a21 a32 a43 a54 a65 * m21 m32 m43 m54 m65 * -!!$* a31 a42 a53 a64 * * m31 m42 m53 m64 * * -!!$* -!!$* Array elements marked * are not used by the routine; elements marked -!!$* + need not be set on entry, but are required by the routine to store -!!$* elements of U because of fill-in resulting from the row interchanges. - - -!Set up input matrix AB -!An m-by-n band matrix with kl subdiagonals and ku superdiagonals -!may be stored compactly in a two-dimensional array with -!kl+ku+1 rows and n columns -!AB(KL+KU+1+i-j,j) = A(i,j) - - do fc = 1,numf - ci = filter(fc) - - kl=(nband-1)/2 - ku=kl -! m is the number of rows required for storage space by dgbsv - m=2*kl+ku+1 -! n is the number of levels (snow/soil) -!scs: replace ubj with jbot - n=jbot(ci)-jtop(ci)+1 - - allocate(ab(m,n)) - ab=0.0 - - ab(kl+ku-1,3:n)=b(ci,1,jtop(ci):jbot(ci)-2) ! 2nd superdiagonal - ab(kl+ku+0,2:n)=b(ci,2,jtop(ci):jbot(ci)-1) ! 1st superdiagonal - ab(kl+ku+1,1:n)=b(ci,3,jtop(ci):jbot(ci)) ! diagonal - ab(kl+ku+2,1:n-1)=b(ci,4,jtop(ci)+1:jbot(ci)) ! 1st subdiagonal - ab(kl+ku+3,1:n-2)=b(ci,5,jtop(ci)+2:jbot(ci)) ! 2nd subdiagonal - - allocate(temp(m,n)) - temp=ab - - allocate(ipiv(n)) - allocate(result(n)) - -! on input result is rhs, on output result is solution vector - result(:)=r(ci,jtop(ci):jbot(ci)) - -! DGBSV( N, KL, KU, NRHS, AB, LDAB, IPIV, B, LDB, INFO ) - call dgbsv( n, kl, ku, 1, ab, m, ipiv, result, n, info ) - u(ci,jtop(ci):jbot(ci))=result(:) - - if(info /= 0) then - write(iulog,*)'index: ', ci - write(iulog,*)'n,kl,ku,m ',n,kl,ku,m - write(iulog,*)'dgbsv info: ',ci,info - - write(iulog,*) '' - write(iulog,*) 'ab matrix' - do j=1,n - ! write(iulog,'(i2,7f18.7)') j,temp(:,j) - write(iulog,'(i2,5f18.7)') j,temp(3:7,j) - enddo - write(iulog,*) '' - call endrun( 'BandDiagonal ERROR: dgbsv returned error code' ) - endif - deallocate(temp) - - deallocate(ab) - deallocate(ipiv) - deallocate(result) - end do - - end subroutine BandDiagonal - -end module BandDiagonalMod diff --git a/src/biogeophys/CanopyStateType.F90 b/src/biogeophys/CanopyStateType.F90 deleted file mode 100644 index beef9527d5..0000000000 --- a/src/biogeophys/CanopyStateType.F90 +++ /dev/null @@ -1,640 +0,0 @@ -module CanopyStateType - - !------------------------------------------------------------------------------ - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, shr_infnan_isnan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use decompMod , only : bounds_type - use landunit_varcon , only : istsoil, istcrop - use clm_varpar , only : nlevcan, nvegwcs - use clm_varcon , only : spval - use clm_varctl , only : iulog, use_cn, use_fates, use_hydrstress - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - implicit none - save - private - ! - ! !PUBLIC TYPES: - type, public :: CanopyState_type - - integer , pointer :: frac_veg_nosno_patch (:) ! patch fraction of vegetation not covered by snow (0 OR 1) [-] - integer , pointer :: frac_veg_nosno_alb_patch (:) ! patch fraction of vegetation not covered by snow (0 OR 1) [-] - - real(r8) , pointer :: tlai_patch (:) ! patch canopy one-sided leaf area index, no burying by snow - real(r8) , pointer :: tsai_patch (:) ! patch canopy one-sided stem area index, no burying by snow - real(r8) , pointer :: elai_patch (:) ! patch canopy one-sided leaf area index with burying by snow - real(r8) , pointer :: esai_patch (:) ! patch canopy one-sided stem area index with burying by snow - real(r8) , pointer :: elai240_patch (:) ! patch canopy one-sided leaf area index with burying by snow average over 10days - real(r8) , pointer :: laisun_patch (:) ! patch patch sunlit projected leaf area index - real(r8) , pointer :: laisha_patch (:) ! patch patch shaded projected leaf area index - real(r8) , pointer :: laisun_z_patch (:,:) ! patch patch sunlit leaf area for canopy layer - real(r8) , pointer :: laisha_z_patch (:,:) ! patch patch shaded leaf area for canopy layer - real(r8) , pointer :: mlaidiff_patch (:) ! patch difference between lai month one and month two (for dry deposition of chemical tracers) - real(r8) , pointer :: annlai_patch (:,:) ! patch 12 months of monthly lai from input data set (for dry deposition of chemical tracers) - real(r8) , pointer :: htop_patch (:) ! patch canopy top (m) - real(r8) , pointer :: hbot_patch (:) ! patch canopy bottom (m) - real(r8) , pointer :: displa_patch (:) ! patch displacement height (m) - real(r8) , pointer :: fsun_patch (:) ! patch sunlit fraction of canopy - real(r8) , pointer :: fsun24_patch (:) ! patch 24hr average of sunlit fraction of canopy - real(r8) , pointer :: fsun240_patch (:) ! patch 240hr average of sunlit fraction of canopy - - real(r8) , pointer :: alt_col (:) ! col current depth of thaw - integer , pointer :: alt_indx_col (:) ! col current depth of thaw - real(r8) , pointer :: altmax_col (:) ! col maximum annual depth of thaw - real(r8) , pointer :: altmax_lastyear_col (:) ! col prior year maximum annual depth of thaw - integer , pointer :: altmax_indx_col (:) ! col maximum annual depth of thaw - integer , pointer :: altmax_lastyear_indx_col (:) ! col prior year maximum annual depth of thaw - - real(r8) , pointer :: dewmx_patch (:) ! patch maximum allowed dew [mm] - real(r8) , pointer :: dleaf_patch (:) ! patch characteristic leaf width (diameter) [m] - ! for non-ED/FATES this is the same as pftcon%dleaf() - real(r8) , pointer :: rscanopy_patch (:) ! patch canopy stomatal resistance (s/m) (ED specific) - - real(r8) , pointer :: vegwp_patch (:,:) ! patch vegetation water matric potential (mm) - - real(r8) :: leaf_mr_vcm = spval ! Scalar constant of leaf respiration with Vcmax - - contains - - procedure, public :: Init - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - procedure, public :: ReadNML - procedure, public :: InitAccBuffer - procedure, public :: InitAccVars - procedure, public :: UpdateAccVars - procedure, public :: Restart - - end type CanopyState_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(canopystate_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - - if ( this%leaf_mr_vcm == spval ) then - call endrun(msg="ERROR canopystate Init called before ReadNML"//errmsg(sourcefile, __LINE__)) - end if - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !USES: - ! - ! !ARGUMENTS: - class(canopystate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begg, endg - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - allocate(this%frac_veg_nosno_patch (begp:endp)) ; this%frac_veg_nosno_patch (:) = huge(1) - allocate(this%frac_veg_nosno_alb_patch (begp:endp)) ; this%frac_veg_nosno_alb_patch (:) = 0 - allocate(this%tlai_patch (begp:endp)) ; this%tlai_patch (:) = nan - allocate(this%tsai_patch (begp:endp)) ; this%tsai_patch (:) = nan - allocate(this%elai_patch (begp:endp)) ; this%elai_patch (:) = nan - allocate(this%elai240_patch (begp:endp)) ; this%elai240_patch (:) = nan - allocate(this%esai_patch (begp:endp)) ; this%esai_patch (:) = nan - allocate(this%laisun_patch (begp:endp)) ; this%laisun_patch (:) = nan - allocate(this%laisha_patch (begp:endp)) ; this%laisha_patch (:) = nan - allocate(this%laisun_z_patch (begp:endp,1:nlevcan)) ; this%laisun_z_patch (:,:) = nan - allocate(this%laisha_z_patch (begp:endp,1:nlevcan)) ; this%laisha_z_patch (:,:) = nan - allocate(this%mlaidiff_patch (begp:endp)) ; this%mlaidiff_patch (:) = nan - allocate(this%annlai_patch (12,begp:endp)) ; this%annlai_patch (:,:) = nan - allocate(this%htop_patch (begp:endp)) ; this%htop_patch (:) = nan - allocate(this%hbot_patch (begp:endp)) ; this%hbot_patch (:) = nan - allocate(this%displa_patch (begp:endp)) ; this%displa_patch (:) = nan - allocate(this%fsun_patch (begp:endp)) ; this%fsun_patch (:) = nan - allocate(this%fsun24_patch (begp:endp)) ; this%fsun24_patch (:) = nan - allocate(this%fsun240_patch (begp:endp)) ; this%fsun240_patch (:) = nan - - allocate(this%alt_col (begc:endc)) ; this%alt_col (:) = spval - allocate(this%altmax_col (begc:endc)) ; this%altmax_col (:) = spval - allocate(this%altmax_lastyear_col (begc:endc)) ; this%altmax_lastyear_col (:) = spval - allocate(this%alt_indx_col (begc:endc)) ; this%alt_indx_col (:) = huge(1) - allocate(this%altmax_indx_col (begc:endc)) ; this%altmax_indx_col (:) = huge(1) - allocate(this%altmax_lastyear_indx_col (begc:endc)) ; this%altmax_lastyear_indx_col (:) = huge(1) - - allocate(this%dewmx_patch (begp:endp)) ; this%dewmx_patch (:) = nan - allocate(this%dleaf_patch (begp:endp)) ; this%dleaf_patch (:) = nan - allocate(this%rscanopy_patch (begp:endp)) ; this%rscanopy_patch (:) = nan -! allocate(this%gccanopy_patch (begp:endp)) ; this%gccanopy_patch (:) = 0.0_r8 - allocate(this%vegwp_patch (begp:endp,1:nvegwcs)) ; this%vegwp_patch (:,:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !USES: - use histFileMod , only: hist_addfld1d, hist_addfld2d - ! - ! !ARGUMENTS: - class(canopystate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - integer :: begp, endp - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !--------------------------------------------------------------------- - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - this%elai_patch(begp:endp) = spval - call hist_addfld1d (fname='ELAI', units='m^2/m^2', & - avgflag='A', long_name='exposed one-sided leaf area index', & - ptr_patch=this%elai_patch, default='inactive') - - this%esai_patch(begp:endp) = spval - call hist_addfld1d (fname='ESAI', units='m^2/m^2', & - avgflag='A', long_name='exposed one-sided stem area index', & - ptr_patch=this%esai_patch, default='inactive') - - this%tlai_patch(begp:endp) = spval - call hist_addfld1d (fname='TLAI', units='none', & - avgflag='A', long_name='total projected leaf area index', & - ptr_patch=this%tlai_patch, default='inactive') - - this%tsai_patch(begp:endp) = spval - call hist_addfld1d (fname='TSAI', units='none', & - avgflag='A', long_name='total projected stem area index', & - ptr_patch=this%tsai_patch, default='inactive') - - this%laisun_patch(begp:endp) = spval - call hist_addfld1d (fname='LAISUN', units='none', & - avgflag='A', long_name='sunlit projected leaf area index', & - ptr_patch=this%laisun_patch, set_urb=0._r8, default='inactive') - - this%laisha_patch(begp:endp) = spval - call hist_addfld1d (fname='LAISHA', units='none', & - avgflag='A', long_name='shaded projected leaf area index', & - ptr_patch=this%laisha_patch, set_urb=0._r8, default='inactive') - - if (use_cn .or. use_fates) then - this%fsun_patch(begp:endp) = spval - call hist_addfld1d (fname='FSUN', units='proportion', & - avgflag='A', long_name='sunlit fraction of canopy', & - ptr_patch=this%fsun_patch, default='inactive') - - this%dewmx_patch(begp:endp) = spval - call hist_addfld1d (fname='DEWMX', units='mm', & - avgflag='A', long_name='Maximum allowed dew', & - ptr_patch=this%dewmx_patch, default='inactive') - - this%htop_patch(begp:endp) = spval - call hist_addfld1d (fname='HTOP', units='m', & - avgflag='A', long_name='canopy top', & - ptr_patch=this%htop_patch, default='inactive') - - this%hbot_patch(begp:endp) = spval - call hist_addfld1d (fname='HBOT', units='m', & - avgflag='A', long_name='canopy bottom', & - ptr_patch=this%hbot_patch, default='inactive') - - this%displa_patch(begp:endp) = spval - call hist_addfld1d (fname='DISPLA', units='m', & - avgflag='A', long_name='displacement height', & - ptr_patch=this%displa_patch, default='inactive') - end if - - if (use_cn) then - this%alt_col(begc:endc) = spval - call hist_addfld1d (fname='ALT', units='m', & - avgflag='A', long_name='current active layer thickness', & - ptr_col=this%alt_col, default='inactive') - - this%altmax_col(begc:endc) = spval - call hist_addfld1d (fname='ALTMAX', units='m', & - avgflag='A', long_name='maximum annual active layer thickness', & - ptr_col=this%altmax_col, default='inactive') - - this%altmax_lastyear_col(begc:endc) = spval - call hist_addfld1d (fname='ALTMAX_LASTYEAR', units='m', & - avgflag='A', long_name='maximum prior year active layer thickness', & - ptr_col=this%altmax_lastyear_col, default='inactive') - end if - - ! Allow active layer fields to be optionally output even if not running CN - - if (.not. use_cn) then - this%alt_col(begc:endc) = spval - call hist_addfld1d (fname='ALT', units='m', & - avgflag='A', long_name='current active layer thickness', & - ptr_col=this%alt_col, default='inactive') - - this%altmax_col(begc:endc) = spval - call hist_addfld1d (fname='ALTMAX', units='m', & - avgflag='A', long_name='maximum annual active layer thickness', & - ptr_col=this%altmax_col, default='inactive') - - this%altmax_lastyear_col(begc:endc) = spval - call hist_addfld1d (fname='ALTMAX_LASTYEAR', units='m', & - avgflag='A', long_name='maximum prior year active layer thickness', & - ptr_col=this%altmax_lastyear_col, default='inactive') - end if - - - - ! Accumulated fields - this%fsun24_patch(begp:endp) = spval - call hist_addfld1d (fname='FSUN24', units='K', & - avgflag='A', long_name='fraction sunlit (last 24hrs)', & - ptr_patch=this%fsun24_patch, default='inactive') - - this%fsun240_patch(begp:endp) = spval - call hist_addfld1d (fname='FSUN240', units='K', & - avgflag='A', long_name='fraction sunlit (last 240hrs)', & - ptr_patch=this%fsun240_patch, default='inactive') - - this%elai240_patch(begp:endp) = spval - call hist_addfld1d (fname='LAI240', units='m^2/m^2', & - avgflag='A', long_name='240hr average of leaf area index', & - ptr_patch=this%elai240_patch, default='inactive') - - ! Ed specific field - if ( use_fates ) then - this%rscanopy_patch(begp:endp) = spval - call hist_addfld1d (fname='RSCANOPY', units=' s m-1', & - avgflag='A', long_name='canopy resistance', & - ptr_patch=this%rscanopy_patch, set_lake=0._r8, set_urb=0._r8, default='inactive') - end if - -! call hist_addfld1d (fname='GCCANOPY', units='none', & -! avgflag='A', long_name='Canopy Conductance: mmol m-2 s-1', & -! ptr_patch=this%GCcanopy_patch, set_lake=0._r8, set_urb=0._r8) - - if ( use_hydrstress ) then - this%vegwp_patch(begp:endp,:) = spval - call hist_addfld2d (fname='VEGWP', units='mm', type2d='nvegwcs', & - avgflag='A', long_name='vegetation water matric potential for sun/sha canopy,xyl,root segments', & - ptr_patch=this%vegwp_patch, default='inactive') - end if - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitAccBuffer (this, bounds) - ! - ! !DESCRIPTION: - ! Initialize accumulation buffer for all required module accumulated fields - ! This routine set defaults values that are then overwritten by the - ! restart file for restart or branch runs - ! - ! !USES - use accumulMod , only : init_accum_field - ! - ! !ARGUMENTS: - class(canopystate_type) :: this - type(bounds_type), intent(in) :: bounds - !--------------------------------------------------------------------- - - this%fsun24_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='FSUN24', units='fraction', & - desc='24hr average of diffuse solar radiation', accum_type='runmean', accum_period=-1, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - this%fsun240_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='FSUN240', units='fraction', & - desc='240hr average of diffuse solar radiation', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - this%elai240_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='LAI240', units='m2/m2', & - desc='240hr average of leaf area index', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - end subroutine InitAccBuffer - - !----------------------------------------------------------------------- - subroutine InitAccVars(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module variables that are associated with - ! time accumulated fields. This routine is called for both an initial run - ! and a restart run (and must therefore must be called after the restart file - ! is read in and the accumulation buffer is obtained) - ! - ! !USES - use accumulMod , only : extract_accum_field - use clm_time_manager , only : get_nstep - ! - ! !ARGUMENTS: - class(canopystate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: nstep - integer :: ier - real(r8), pointer :: rbufslp(:) ! temporary - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - ! Allocate needed dynamic memory for single level patch field - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)' in ' - call endrun(msg="extract_accum_hist allocation error for rbufslp"//& - errMsg(sourcefile, __LINE__)) - endif - - ! Determine time step - nstep = get_nstep() - - call extract_accum_field ('FSUN24', rbufslp, nstep) - this%fsun24_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('FSUN240', rbufslp, nstep) - this%fsun240_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('LAI240', rbufslp, nstep) - this%elai240_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('FSUN24', rbufslp, nstep) - this%fsun24_patch(begp:endp) = rbufslp(begp:endp) - - deallocate(rbufslp) - - end subroutine InitAccVars - - !----------------------------------------------------------------------- - subroutine ReadNML( this, NLFilename ) - ! - ! Read in canopy parameter namelist - ! - ! USES: - use shr_mpi_mod , only : shr_mpi_bcast - use abortutils , only : endrun - use spmdMod , only : masterproc, mpicom - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - use shr_log_mod , only : errMsg => shr_log_errMsg - ! - ! ARGUMENTS: - implicit none - class(canopystate_type) :: this - character(len=*), intent(IN) :: NLFilename ! Namelist filename - ! LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - real(r8) :: leaf_mr_vcm ! Scalar of leaf respiration to vcmax - character(len=32) :: subname = 'CanopyStateType::ReadNML' ! subroutine name - !----------------------------------------------------------------------- - namelist / clm_canopy_inparm / leaf_mr_vcm - - ! ---------------------------------------------------------------------- - ! Read namelist from input namelist filename - ! ---------------------------------------------------------------------- - - if ( masterproc )then - - unitn = getavu() - write(iulog,*) 'Read in clm_canopy_inparm namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, 'clm_canopy_inparm', status=ierr) - if (ierr == 0) then - read(unitn, clm_canopy_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading clm_canopy_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR finding clm_canopy_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - - end if - - ! Broadcast namelist variables read in - call shr_mpi_bcast(leaf_mr_vcm, mpicom) - this%leaf_mr_vcm = leaf_mr_vcm - - end subroutine ReadNML - - !----------------------------------------------------------------------- - subroutine UpdateAccVars (this, bounds) - ! - ! USES - use clm_time_manager, only : get_nstep - use accumulMod , only : update_accum_field, extract_accum_field - use abortutils , only : endrun - ! - ! !ARGUMENTS: - class(canopystate_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g,p ! indices - integer :: dtime ! timestep size [seconds] - integer :: nstep ! timestep number - integer :: ier ! error status - integer :: begp, endp - real(r8), pointer :: rbufslp(:) ! temporary single level - patch level - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - nstep = get_nstep() - - ! Allocate needed dynamic memory for single level patch field - - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)'update_accum_hist allocation error for rbuf1dp' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - - ! Accumulate and extract fsun24 & fsun240 - do p = begp,endp - rbufslp(p) = this%fsun_patch(p) - end do - call update_accum_field ('FSUN24' , rbufslp , nstep) - call extract_accum_field ('FSUN24' , this%fsun24_patch , nstep) - call update_accum_field ('FSUN240', rbufslp , nstep) - call extract_accum_field ('FSUN240', this%fsun240_patch , nstep) - - ! Accumulate and extract elai240 - do p = begp,endp - rbufslp(p) = this%elai_patch(p) - end do - call update_accum_field ('LAI240', rbufslp , nstep) - call extract_accum_field ('LAI240', this%elai240_patch , nstep) - - deallocate(rbufslp) - - end subroutine UpdateAccVars - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !ARGUMENTS: - class(canopystate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p,l,c,g - !----------------------------------------------------------------------- - - do p = bounds%begp, bounds%endp - l = patch%landunit(p) - - this%frac_veg_nosno_patch(p) = 0._r8 - this%tlai_patch(p) = 0._r8 - this%tsai_patch(p) = 0._r8 - this%elai_patch(p) = 0._r8 - this%esai_patch(p) = 0._r8 - this%htop_patch(p) = 0._r8 - this%hbot_patch(p) = 0._r8 - this%dewmx_patch(p) = 0.1_r8 - this%vegwp_patch(p,:) = -2.5e4_r8 - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%laisun_patch(p) = 0._r8 - this%laisha_patch(p) = 0._r8 - end if - - ! needs to be initialized to spval to avoid problems when averaging for the accum - ! field - this%fsun_patch(p) = spval - end do - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%alt_col(c) = 0._r8 !iniitialized to spval for all columns - this%altmax_col(c) = 0._r8 !iniitialized to spval for all columns - this%altmax_lastyear_col(c) = 0._r8 !iniitialized to spval for all columns - this%alt_indx_col(c) = 0 !initiialized to huge for all columns - this%altmax_indx_col(c) = 0 !initiialized to huge for all columns - this%altmax_lastyear_indx_col = 0 !initiialized to huge for all columns - end if - end do - - end subroutine InitCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag) - ! - ! !USES: - use spmdMod , only : masterproc - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_double, ncd_int, ncd_inqvdlen - use restUtilMod - ! - ! !ARGUMENTS: - class(canopystate_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: j,p,c,iv ! indices - logical :: readvar ! determine if variable is on initial file - integer :: begp, endp - !----------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - call restartvar(ncid=ncid, flag=flag, varname='FRAC_VEG_NOSNO_ALB', xtype=ncd_int, & - dim1name='pft', long_name='fraction of vegetation not covered by snow (0 or 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frac_veg_nosno_alb_patch) - - call restartvar(ncid=ncid, flag=flag, varname='tlai', xtype=ncd_double, & - dim1name='pft', long_name='one-sided leaf area index, no burying by snow', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tlai_patch) - - call restartvar(ncid=ncid, flag=flag, varname='tsai', xtype=ncd_double, & - dim1name='pft', long_name='one-sided stem area index, no burying by snow', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tsai_patch) - - call restartvar(ncid=ncid, flag=flag, varname='elai', xtype=ncd_double, & - dim1name='pft', long_name='one-sided leaf area index, with burying by snow', units='', & - interpinic_flag='interp', readvar=readvar, data=this%elai_patch) - - call restartvar(ncid=ncid, flag=flag, varname='esai', xtype=ncd_double, & - dim1name='pft', long_name='one-sided stem area index, with burying by snow', units='', & - interpinic_flag='interp', readvar=readvar, data=this%esai_patch) - - call restartvar(ncid=ncid, flag=flag, varname='htop', xtype=ncd_double, & - dim1name='pft', long_name='canopy top', units='m', & - interpinic_flag='interp', readvar=readvar, data=this%htop_patch) - - call restartvar(ncid=ncid, flag=flag, varname='hbot', xtype=ncd_double, & - dim1name='pft', long_name='canopy botton', units='m', & - interpinic_flag='interp', readvar=readvar, data=this%hbot_patch) - - call restartvar(ncid=ncid, flag=flag, varname='mlaidiff', xtype=ncd_double, & - dim1name='pft', long_name='difference between lai month one and month two', units='', & - interpinic_flag='interp', readvar=readvar, data=this%mlaidiff_patch) - - call restartvar(ncid=ncid, flag=flag, varname='fsun', xtype=ncd_double, & - dim1name='pft', long_name='sunlit fraction of canopy', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fsun_patch) - - if (flag=='read' )then - do p = bounds%begp,bounds%endp - if (shr_infnan_isnan(this%fsun_patch(p)) ) then - this%fsun_patch(p) = spval - end if - end do - end if - - if (use_cn .or. use_fates) then - call restartvar(ncid=ncid, flag=flag, varname='altmax', xtype=ncd_double, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%altmax_col) - - call restartvar(ncid=ncid, flag=flag, varname='altmax_lastyear', xtype=ncd_double, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%altmax_lastyear_col) - - call restartvar(ncid=ncid, flag=flag, varname='altmax_indx', xtype=ncd_int, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%altmax_indx_col) - - call restartvar(ncid=ncid, flag=flag, varname='altmax_lastyear_indx', xtype=ncd_int, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%altmax_lastyear_indx_col) - end if - - if ( use_hydrstress ) then - call restartvar(ncid=ncid, flag=flag, varname='vegwp', xtype=ncd_double, & - dim1name='pft', dim2name='vegwcs', switchdim=.true., & - long_name='vegetation water matric potential', units='mm', & - interpinic_flag='interp', readvar=readvar, data=this%vegwp_patch) - - end if - - end subroutine Restart - -end module CanopyStateType diff --git a/src/biogeophys/EnergyFluxType.F90 b/src/biogeophys/EnergyFluxType.F90 index 83b5281e80..940783766d 100644 --- a/src/biogeophys/EnergyFluxType.F90 +++ b/src/biogeophys/EnergyFluxType.F90 @@ -7,9 +7,7 @@ module EnergyFluxType ! use shr_kind_mod , only : r8 => shr_kind_r8 use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varcon , only : spval use decompMod , only : bounds_type - use LandunitType , only : lun use ColumnType , only : col use PatchType , only : patch ! @@ -20,105 +18,14 @@ module EnergyFluxType type, public :: energyflux_type ! Fluxes - real(r8), pointer :: eflx_sh_grnd_patch (:) ! patch sensible heat flux from ground (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_veg_patch (:) ! patch sensible heat flux from leaves (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_snow_patch (:) ! patch sensible heat flux from snow (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_soil_patch (:) ! patch sensible heat flux from soil (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_h2osfc_patch (:) ! patch sensible heat flux from surface water (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_tot_patch (:) ! patch total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_tot_u_patch (:) ! patch urban total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_tot_r_patch (:) ! patch rural total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_precip_conversion_col(:) ! col sensible heat flux from precipitation conversion (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_tot_patch (:) ! patch total latent heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_tot_u_patch (:) ! patch urban total latent heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_tot_r_patch (:) ! patch rural total latent heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_vegt_patch (:) ! patch transpiration heat flux from veg (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_vege_patch (:) ! patch evaporation heat flux from veg (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_grnd_patch (:) ! patch evaporation heat flux from ground (W/m**2) [+ to atm] - real(r8), pointer :: eflx_soil_grnd_patch (:) ! patch soil heat flux (W/m**2) [+ = into soil] - real(r8), pointer :: eflx_soil_grnd_u_patch (:) ! patch urban soil heat flux (W/m**2) [+ = into soil] - real(r8), pointer :: eflx_soil_grnd_r_patch (:) ! patch rural soil heat flux (W/m**2) [+ = into soil] - real(r8), pointer :: eflx_lwrad_net_patch (:) ! patch net infrared (longwave) rad (W/m**2) [+ = to atm] - real(r8), pointer :: eflx_lwrad_net_r_patch (:) ! patch rural net infrared (longwave) rad (W/m**2) [+ = to atm] - real(r8), pointer :: eflx_lwrad_net_u_patch (:) ! patch urban net infrared (longwave) rad (W/m**2) [+ = to atm] real(r8), pointer :: eflx_lwrad_out_patch (:) ! patch emitted infrared (longwave) radiation (W/m**2) - real(r8), pointer :: eflx_lwrad_out_r_patch (:) ! patch rural emitted infrared (longwave) rad (W/m**2) - real(r8), pointer :: eflx_lwrad_out_u_patch (:) ! patch urban emitted infrared (longwave) rad (W/m**2) - real(r8), pointer :: eflx_snomelt_col (:) ! col snow melt heat flux (W/m**2) - real(r8), pointer :: eflx_snomelt_r_col (:) ! col rural snow melt heat flux (W/m**2) - real(r8), pointer :: eflx_snomelt_u_col (:) ! col urban snow melt heat flux (W/m**2) - real(r8), pointer :: eflx_gnet_patch (:) ! patch net heat flux into ground (W/m**2) - real(r8), pointer :: eflx_grnd_lake_patch (:) ! patch net heat flux into lake / snow surface, excluding light transmission (W/m**2) - real(r8), pointer :: eflx_dynbal_grc (:) ! grc dynamic land cover change conversion energy flux (W/m**2) - real(r8), pointer :: eflx_bot_col (:) ! col heat flux from beneath the soil or ice column (W/m**2) - real(r8), pointer :: eflx_fgr12_col (:) ! col ground heat flux between soil layers 1 and 2 (W/m**2) - real(r8), pointer :: eflx_fgr_col (:,:) ! col (rural) soil downward heat flux (W/m2) (1:nlevgrnd) (pos upward; usually eflx_bot >= 0) - real(r8), pointer :: eflx_building_heat_errsoi_col(:) ! col heat flux to interior surface of walls and roof for errsoi check (W m-2) - real(r8), pointer :: eflx_urban_ac_col (:) ! col urban air conditioning flux (W/m**2) - real(r8), pointer :: eflx_urban_heat_col (:) ! col urban heating flux (W/m**2) - real(r8), pointer :: eflx_anthro_patch (:) ! patch total anthropogenic heat flux (W/m**2) - real(r8), pointer :: eflx_traffic_patch (:) ! patch traffic sensible heat flux (W/m**2) - real(r8), pointer :: eflx_wasteheat_patch (:) ! patch sensible heat flux from domestic heating/cooling sources of waste heat (W/m**2) - real(r8), pointer :: eflx_heat_from_ac_patch (:) ! patch sensible heat flux put back into canyon due to removal by AC (W/m**2) - real(r8), pointer :: eflx_traffic_lun (:) ! lun traffic sensible heat flux (W/m**2) - real(r8), pointer :: eflx_wasteheat_lun (:) ! lun sensible heat flux from domestic heating/cooling sources of waste heat (W/m**2) - real(r8), pointer :: eflx_heat_from_ac_lun (:) ! lun sensible heat flux to be put back into canyon due to removal by AC (W/m**2) - real(r8), pointer :: eflx_building_lun (:) ! lun building heat flux from change in interior building air temperature (W/m**2) - real(r8), pointer :: eflx_urban_ac_lun (:) ! lun urban air conditioning flux (W/m**2) - real(r8), pointer :: eflx_urban_heat_lun (:) ! lun urban heating flux (W/m**2) - - ! Derivatives of energy fluxes - real(r8), pointer :: dgnetdT_patch (:) ! patch derivative of net ground heat flux wrt soil temp (W/m**2 K) - real(r8), pointer :: netrad_patch (:) ! col net radiation (W/m**2) [+ = to sfc] - real(r8), pointer :: cgrnd_patch (:) ! col deriv. of soil energy flux wrt to soil temp [W/m2/k] - real(r8), pointer :: cgrndl_patch (:) ! col deriv. of soil latent heat flux wrt soil temp [W/m**2/k] - real(r8), pointer :: cgrnds_patch (:) ! col deriv. of soil sensible heat flux wrt soil temp [W/m2/k] - - ! Canopy radiation - real(r8), pointer :: dlrad_patch (:) ! col downward longwave radiation below the canopy [W/m2] - real(r8), pointer :: ulrad_patch (:) ! col upward longwave radiation above the canopy [W/m2] - - ! Wind Stress - real(r8), pointer :: taux_patch (:) ! patch wind (shear) stress: e-w (kg/m/s**2) - real(r8), pointer :: tauy_patch (:) ! patch wind (shear) stress: n-s (kg/m/s**2) - - ! Conductance - real(r8), pointer :: canopy_cond_patch (:) ! patch tracer conductance for canopy [m/s] - - ! Transpiration - real(r8), pointer :: btran_patch (:) ! patch transpiration wetness factor (0 to 1) - real(r8), pointer :: btran_min_patch (:) ! patch daily minimum transpiration wetness factor (0 to 1) - real(r8), pointer :: btran_min_inst_patch (:) ! patch instantaneous daily minimum transpiration wetness factor (0 to 1) - real(r8), pointer :: bsun_patch (:) ! patch sunlit canopy transpiration wetness factor (0 to 1) - real(r8), pointer :: bsha_patch (:) ! patch shaded canopy transpiration wetness factor (0 to 1) - - ! Roots - real(r8), pointer :: btran2_patch (:) ! patch root zone soil wetness factor (0 to 1) - real(r8), pointer :: rresis_patch (:,:) ! patch root resistance by layer (0-1) (nlevgrnd) - - ! Latent heat - real(r8), pointer :: htvp_col (:) ! latent heat of vapor of water (or sublimation) [j/kg] - - ! Balance Checks - real(r8), pointer :: errsoi_patch (:) ! soil/lake energy conservation error (W/m**2) - real(r8), pointer :: errsoi_col (:) ! soil/lake energy conservation error (W/m**2) - real(r8), pointer :: errseb_patch (:) ! surface energy conservation error (W/m**2) - real(r8), pointer :: errseb_col (:) ! surface energy conservation error (W/m**2) - real(r8), pointer :: errsol_patch (:) ! solar radiation conservation error (W/m**2) - real(r8), pointer :: errsol_col (:) ! solar radiation conservation error (W/m**2) - real(r8), pointer :: errlon_patch (:) ! longwave radiation conservation error (W/m**2) - real(r8), pointer :: errlon_col (:) ! longwave radiation conservation error (W/m**2) contains procedure, public :: Init ! Public initialization method procedure, private :: InitAllocate ! initialize/allocate - procedure, private :: InitHistory ! setup history fields procedure, private :: InitCold ! initialize for cold start procedure, public :: Restart ! setup restart fields - procedure, public :: InitAccBuffer - procedure, public :: InitAccVars - procedure, public :: UpdateAccVars end type energyflux_type @@ -129,7 +36,7 @@ module EnergyFluxType contains !------------------------------------------------------------------------ - subroutine Init(this, bounds, t_grnd_col, is_simple_buildtemp, is_prog_buildtemp ) + subroutine Init(this, bounds, t_grnd_col) ! ! !DESCRIPTION: ! Allocate and initialize the data type and setup history, and initialize for cold-start. @@ -139,14 +46,11 @@ subroutine Init(this, bounds, t_grnd_col, is_simple_buildtemp, is_prog_buildtemp class(energyflux_type) :: this type(bounds_type) , intent(in) :: bounds real(r8) , intent(in) :: t_grnd_col( bounds%begc: ) - logical , intent(in) :: is_simple_buildtemp ! If using simple building temp method - logical , intent(in) :: is_prog_buildtemp ! If using prognostic building temp method SHR_ASSERT_ALL((ubound(t_grnd_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) call this%InitAllocate ( bounds ) - call this%InitHistory ( bounds, is_simple_buildtemp ) - call this%InitCold ( bounds, t_grnd_col, is_simple_buildtemp, is_prog_buildtemp ) + call this%InitCold ( bounds, t_grnd_col) end subroutine Init @@ -158,7 +62,6 @@ subroutine InitAllocate(this, bounds) ! ! !USES: use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : nlevsno, nlevgrnd, nlevlak implicit none ! ! !ARGUMENTS: @@ -167,610 +70,52 @@ subroutine InitAllocate(this, bounds) ! ! !LOCAL VARIABLES: integer :: begp, endp - integer :: begc, endc - integer :: begl, endl - integer :: begg, endg !------------------------------------------------------------------------ begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begl = bounds%begl; endl= bounds%endl - begg = bounds%begg; endg= bounds%endg - - allocate( this%eflx_sh_snow_patch (begp:endp)) ; this%eflx_sh_snow_patch (:) = nan - allocate( this%eflx_sh_soil_patch (begp:endp)) ; this%eflx_sh_soil_patch (:) = nan - allocate( this%eflx_sh_h2osfc_patch (begp:endp)) ; this%eflx_sh_h2osfc_patch (:) = nan - allocate( this%eflx_sh_tot_patch (begp:endp)) ; this%eflx_sh_tot_patch (:) = nan - allocate( this%eflx_sh_tot_u_patch (begp:endp)) ; this%eflx_sh_tot_u_patch (:) = nan - allocate( this%eflx_sh_tot_r_patch (begp:endp)) ; this%eflx_sh_tot_r_patch (:) = nan - allocate( this%eflx_sh_grnd_patch (begp:endp)) ; this%eflx_sh_grnd_patch (:) = nan - allocate( this%eflx_sh_veg_patch (begp:endp)) ; this%eflx_sh_veg_patch (:) = nan - allocate( this%eflx_sh_precip_conversion_col(begc:endc)) ; this%eflx_sh_precip_conversion_col(:) = nan - allocate( this%eflx_lh_tot_u_patch (begp:endp)) ; this%eflx_lh_tot_u_patch (:) = nan - allocate( this%eflx_lh_tot_patch (begp:endp)) ; this%eflx_lh_tot_patch (:) = nan - allocate( this%eflx_lh_tot_r_patch (begp:endp)) ; this%eflx_lh_tot_r_patch (:) = nan - allocate( this%eflx_lh_grnd_patch (begp:endp)) ; this%eflx_lh_grnd_patch (:) = nan - allocate( this%eflx_lh_vege_patch (begp:endp)) ; this%eflx_lh_vege_patch (:) = nan - allocate( this%eflx_lh_vegt_patch (begp:endp)) ; this%eflx_lh_vegt_patch (:) = nan - allocate( this%eflx_soil_grnd_patch (begp:endp)) ; this%eflx_soil_grnd_patch (:) = nan - allocate( this%eflx_soil_grnd_u_patch (begp:endp)) ; this%eflx_soil_grnd_u_patch (:) = nan - allocate( this%eflx_soil_grnd_r_patch (begp:endp)) ; this%eflx_soil_grnd_r_patch (:) = nan - allocate( this%eflx_lwrad_net_patch (begp:endp)) ; this%eflx_lwrad_net_patch (:) = nan - allocate( this%eflx_lwrad_net_u_patch (begp:endp)) ; this%eflx_lwrad_net_u_patch (:) = nan - allocate( this%eflx_lwrad_net_r_patch (begp:endp)) ; this%eflx_lwrad_net_r_patch (:) = nan allocate( this%eflx_lwrad_out_patch (begp:endp)) ; this%eflx_lwrad_out_patch (:) = nan - allocate( this%eflx_lwrad_out_u_patch (begp:endp)) ; this%eflx_lwrad_out_u_patch (:) = nan - allocate( this%eflx_lwrad_out_r_patch (begp:endp)) ; this%eflx_lwrad_out_r_patch (:) = nan - allocate( this%eflx_gnet_patch (begp:endp)) ; this%eflx_gnet_patch (:) = nan - allocate( this%eflx_grnd_lake_patch (begp:endp)) ; this%eflx_grnd_lake_patch (:) = nan - allocate( this%eflx_dynbal_grc (begg:endg)) ; this%eflx_dynbal_grc (:) = nan - allocate( this%eflx_bot_col (begc:endc)) ; this%eflx_bot_col (:) = nan - allocate( this%eflx_snomelt_col (begc:endc)) ; this%eflx_snomelt_col (:) = nan - allocate( this%eflx_snomelt_r_col (begc:endc)) ; this%eflx_snomelt_r_col (:) = nan - allocate( this%eflx_snomelt_u_col (begc:endc)) ; this%eflx_snomelt_u_col (:) = nan - allocate( this%eflx_fgr12_col (begc:endc)) ; this%eflx_fgr12_col (:) = nan - allocate( this%eflx_fgr_col (begc:endc, 1:nlevgrnd)) ; this%eflx_fgr_col (:,:) = nan - allocate( this%eflx_building_heat_errsoi_col (begc:endc)) ; this%eflx_building_heat_errsoi_col(:)= nan - allocate( this%eflx_urban_ac_col (begc:endc)) ; this%eflx_urban_ac_col (:) = nan - allocate( this%eflx_urban_heat_col (begc:endc)) ; this%eflx_urban_heat_col (:) = nan - allocate( this%eflx_wasteheat_patch (begp:endp)) ; this%eflx_wasteheat_patch (:) = nan - allocate( this%eflx_traffic_patch (begp:endp)) ; this%eflx_traffic_patch (:) = nan - allocate( this%eflx_heat_from_ac_patch (begp:endp)) ; this%eflx_heat_from_ac_patch (:) = nan - allocate( this%eflx_heat_from_ac_lun (begl:endl)) ; this%eflx_heat_from_ac_lun (:) = nan - allocate( this%eflx_building_lun (begl:endl)) ; this%eflx_building_lun (:) = nan - allocate( this%eflx_urban_ac_lun (begl:endl)) ; this%eflx_urban_ac_lun (:) = nan - allocate( this%eflx_urban_heat_lun (begl:endl)) ; this%eflx_urban_heat_lun (:) = nan - allocate( this%eflx_traffic_lun (begl:endl)) ; this%eflx_traffic_lun (:) = nan - allocate( this%eflx_wasteheat_lun (begl:endl)) ; this%eflx_wasteheat_lun (:) = nan - allocate( this%eflx_anthro_patch (begp:endp)) ; this%eflx_anthro_patch (:) = nan - - allocate( this%dgnetdT_patch (begp:endp)) ; this%dgnetdT_patch (:) = nan - allocate( this%cgrnd_patch (begp:endp)) ; this%cgrnd_patch (:) = nan - allocate( this%cgrndl_patch (begp:endp)) ; this%cgrndl_patch (:) = nan - allocate( this%cgrnds_patch (begp:endp)) ; this%cgrnds_patch (:) = nan - allocate( this%dlrad_patch (begp:endp)) ; this%dlrad_patch (:) = nan - allocate( this%ulrad_patch (begp:endp)) ; this%ulrad_patch (:) = nan - allocate( this%netrad_patch (begp:endp)) ; this%netrad_patch (:) = nan - - allocate( this%taux_patch (begp:endp)) ; this%taux_patch (:) = nan - allocate( this%tauy_patch (begp:endp)) ; this%tauy_patch (:) = nan - - allocate( this%canopy_cond_patch (begp:endp)) ; this%canopy_cond_patch (:) = nan - - allocate( this%htvp_col (begc:endc)) ; this%htvp_col (:) = nan - - allocate(this%rresis_patch (begp:endp,1:nlevgrnd)) ; this%rresis_patch (:,:) = nan - allocate(this%btran_patch (begp:endp)) ; this%btran_patch (:) = nan - allocate(this%btran_min_patch (begp:endp)) ; this%btran_min_patch (:) = nan - allocate(this%btran_min_inst_patch (begp:endp)) ; this%btran_min_inst_patch (:) = nan - allocate(this%btran2_patch (begp:endp)) ; this%btran2_patch (:) = nan - allocate( this%bsun_patch (begp:endp)) ; this%bsun_patch (:) = nan - allocate( this%bsha_patch (begp:endp)) ; this%bsha_patch (:) = nan - allocate( this%errsoi_patch (begp:endp)) ; this%errsoi_patch (:) = nan - allocate( this%errsoi_col (begc:endc)) ; this%errsoi_col (:) = nan - allocate( this%errseb_patch (begp:endp)) ; this%errseb_patch (:) = nan - allocate( this%errseb_col (begc:endc)) ; this%errseb_col (:) = nan - allocate( this%errsol_patch (begp:endp)) ; this%errsol_patch (:) = nan - allocate( this%errsol_col (begc:endc)) ; this%errsol_col (:) = nan - allocate( this%errlon_patch (begp:endp)) ; this%errlon_patch (:) = nan - allocate( this%errlon_col (begc:endc)) ; this%errlon_col (:) = nan end subroutine InitAllocate - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds, is_simple_buildtemp) - ! - ! !DESCRIPTION: - ! Setup fields that can be output to history files - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : nlevsno, nlevgrnd - use clm_varctl , only : use_cn, use_hydrstress - use histFileMod , only : hist_addfld1d, hist_addfld2d, no_snow_normal - use ncdio_pio , only : ncd_inqvdlen - implicit none - ! - ! !ARGUMENTS: - class(energyflux_type) :: this - type(bounds_type), intent(in) :: bounds - logical , intent(in) :: is_simple_buildtemp ! If using simple building temp method - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begl, endl - integer :: begg, endg - integer :: dimlen - integer :: err_code - logical :: do_io - character(10) :: active - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begl = bounds%begl; endl= bounds%endl - begg = bounds%begg; endg= bounds%endg - - - this%eflx_dynbal_grc(begg:endg) = spval - call hist_addfld1d (fname='EFLX_DYNBAL', units='W/m^2', & - avgflag='A', long_name='dynamic land cover change conversion energy flux', & - ptr_lnd=this%eflx_dynbal_grc, default='inactive') - - this%eflx_snomelt_col(begc:endc) = spval - call hist_addfld1d (fname='FSM', units='W/m^2', & - avgflag='A', long_name='snow melt heat flux', & - ptr_col=this%eflx_snomelt_col, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='FSM_ICE', units='W/m^2', & - avgflag='A', long_name='snow melt heat flux (ice landunits only)', & - ptr_col=this%eflx_snomelt_col, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%eflx_snomelt_r_col(begc:endc) = spval - call hist_addfld1d (fname='FSM_R', units='W/m^2', & - avgflag='A', long_name='Rural snow melt heat flux', & - ptr_col=this%eflx_snomelt_r_col, set_spec=spval, default='inactive') - - this%eflx_snomelt_u_col(begc:endc) = spval - call hist_addfld1d (fname='FSM_U', units='W/m^2', & - avgflag='A', long_name='Urban snow melt heat flux', & - ptr_col=this%eflx_snomelt_u_col, c2l_scale_type='urbanf', set_nourb=spval, default='inactive') - - this%eflx_lwrad_net_patch(begp:endp) = spval - call hist_addfld1d (fname='FIRA', units='W/m^2', & - avgflag='A', long_name='net infrared (longwave) radiation', & - ptr_patch=this%eflx_lwrad_net_patch, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='FIRA_ICE', units='W/m^2', & - avgflag='A', long_name='net infrared (longwave) radiation (ice landunits only)', & - ptr_patch=this%eflx_lwrad_net_patch, c2l_scale_type='urbanf', l2g_scale_type='ice',& - default='inactive') - - this%eflx_lwrad_net_r_patch(begp:endp) = spval - call hist_addfld1d (fname='FIRA_R', units='W/m^2', & - avgflag='A', long_name='Rural net infrared (longwave) radiation', & - ptr_patch=this%eflx_lwrad_net_r_patch, set_spec=spval, default='inactive') - - this%eflx_lwrad_out_patch(begp:endp) = spval - call hist_addfld1d (fname='FIRE', units='W/m^2', & - avgflag='A', long_name='emitted infrared (longwave) radiation', & - ptr_patch=this%eflx_lwrad_out_patch, c2l_scale_type='urbanf', default='inactive') - ! Rename of FIRE for Urban intercomparision project - call hist_addfld1d (fname='LWup', units='W/m^2', & - avgflag='A', long_name='upwelling longwave radiation', & - ptr_patch=this%eflx_lwrad_out_patch, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='FIRE_ICE', units='W/m^2', & - avgflag='A', long_name='emitted infrared (longwave) radiation (ice landunits only)', & - ptr_patch=this%eflx_lwrad_out_patch, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%eflx_lwrad_out_r_patch(begp:endp) = spval - call hist_addfld1d (fname='FIRE_R', units='W/m^2', & - avgflag='A', long_name='Rural emitted infrared (longwave) radiation', & - ptr_patch=this%eflx_lwrad_out_r_patch, set_spec=spval, default='inactive') - - this%eflx_lh_vegt_patch(begp:endp) = spval - call hist_addfld1d (fname='FCTR', units='W/m^2', & - avgflag='A', long_name='canopy transpiration', & - ptr_patch=this%eflx_lh_vegt_patch, set_lake=0._r8, c2l_scale_type='urbanf', default='inactive') - - this%eflx_lh_vege_patch(begp:endp) = spval - call hist_addfld1d (fname='FCEV', units='W/m^2', & - avgflag='A', long_name='canopy evaporation', & - ptr_patch=this%eflx_lh_vege_patch, set_lake=0._r8, c2l_scale_type='urbanf', default='inactive') - - this%eflx_lh_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='FGEV', units='W/m^2', & - avgflag='A', long_name='ground evaporation', & - ptr_patch=this%eflx_lh_grnd_patch, c2l_scale_type='urbanf', default='inactive') - - this%eflx_sh_tot_patch(begp:endp) = spval - call hist_addfld1d (fname='FSH', units='W/m^2', & - avgflag='A', long_name='sensible heat not including correction for land use change and rain/snow conversion', & - ptr_patch=this%eflx_sh_tot_patch, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='FSH_ICE', units='W/m^2', & - avgflag='A', & - long_name='sensible heat not including correction for land use change and rain/snow conversion (ice landunits only)', & - ptr_patch=this%eflx_sh_tot_patch, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%eflx_sh_tot_r_patch(begp:endp) = spval - call hist_addfld1d (fname='FSH_R', units='W/m^2', & - avgflag='A', long_name='Rural sensible heat', & - ptr_patch=this%eflx_sh_tot_r_patch, set_spec=spval, default='inactive') - - this%eflx_sh_tot_patch(begp:endp) = spval - call hist_addfld1d (fname='Qh', units='W/m^2', & - avgflag='A', long_name='sensible heat', & - ptr_patch=this%eflx_sh_tot_patch, c2l_scale_type='urbanf', & - default = 'inactive') - - this%eflx_lh_tot_patch(begp:endp) = spval - call hist_addfld1d (fname='Qle', units='W/m^2', & - avgflag='A', long_name='total evaporation', & - ptr_patch=this%eflx_lh_tot_patch, c2l_scale_type='urbanf', & - default = 'inactive') - - this%eflx_lh_tot_patch(begp:endp) = spval - call hist_addfld1d (fname='EFLX_LH_TOT', units='W/m^2', & - avgflag='A', long_name='total latent heat flux [+ to atm]', & - ptr_patch=this%eflx_lh_tot_patch, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='EFLX_LH_TOT_ICE', units='W/m^2', & - avgflag='A', long_name='total latent heat flux [+ to atm] (ice landunits only)', & - ptr_patch=this%eflx_lh_tot_patch, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%eflx_lh_tot_r_patch(begp:endp) = spval - call hist_addfld1d (fname='EFLX_LH_TOT_R', units='W/m^2', & - avgflag='A', long_name='Rural total evaporation', & - ptr_patch=this%eflx_lh_tot_r_patch, set_spec=spval, default='inactive') - - this%eflx_soil_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='Qstor', units='W/m^2', & - avgflag='A', long_name='storage heat flux (includes snowmelt)', & - ptr_patch=this%eflx_soil_grnd_patch, c2l_scale_type='urbanf', & - default = 'inactive') - this%eflx_sh_veg_patch(begp:endp) = spval - call hist_addfld1d (fname='FSH_V', units='W/m^2', & - avgflag='A', long_name='sensible heat from veg', & - ptr_patch=this%eflx_sh_veg_patch, set_lake=0._r8, c2l_scale_type='urbanf', default='inactive') - - this%eflx_sh_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='FSH_G', units='W/m^2', & - avgflag='A', long_name='sensible heat from ground', & - ptr_patch=this%eflx_sh_grnd_patch, c2l_scale_type='urbanf', default='inactive') - - this%eflx_soil_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='FGR', units='W/m^2', & - avgflag='A', long_name='heat flux into soil/snow including snow melt and lake / snow light transmission', & - ptr_patch=this%eflx_soil_grnd_patch, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='FGR_ICE', units='W/m^2', & - avgflag='A', & - long_name='heat flux into soil/snow including snow melt and lake / snow light transmission (ice landunits only)', & - ptr_patch=this%eflx_soil_grnd_patch, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%eflx_soil_grnd_r_patch(begp:endp) = spval - call hist_addfld1d (fname='FGR_R', units='W/m^2', & - avgflag='A', long_name='Rural heat flux into soil/snow including snow melt and snow light transmission', & - ptr_patch=this%eflx_soil_grnd_r_patch, set_spec=spval, default='inactive') - - this%eflx_lwrad_net_u_patch(begp:endp) = spval - call hist_addfld1d (fname='FIRA_U', units='W/m^2', & - avgflag='A', long_name='Urban net infrared (longwave) radiation', & - ptr_patch=this%eflx_lwrad_net_u_patch, c2l_scale_type='urbanf', set_nourb=spval, default='inactive') - - this%eflx_soil_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='EFLX_SOIL_GRND', units='W/m^2', & - avgflag='A', long_name='soil heat flux [+ into soil]', & - ptr_patch=this%eflx_soil_grnd_patch, default='inactive', c2l_scale_type='urbanf') - - this%eflx_lwrad_out_u_patch(begp:endp) = spval - call hist_addfld1d (fname='FIRE_U', units='W/m^2', & - avgflag='A', long_name='Urban emitted infrared (longwave) radiation', & - ptr_patch=this%eflx_lwrad_out_u_patch, c2l_scale_type='urbanf', set_nourb=spval, default='inactive') - - this%eflx_sh_tot_u_patch(begp:endp) = spval - call hist_addfld1d (fname='FSH_U', units='W/m^2', & - avgflag='A', long_name='Urban sensible heat', & - ptr_patch=this%eflx_sh_tot_u_patch, c2l_scale_type='urbanf', set_nourb=spval, default='inactive') - - this%eflx_sh_precip_conversion_col(begc:endc) = spval - call hist_addfld1d (fname = 'FSH_PRECIP_CONVERSION', units='W/m^2', & - avgflag='A', long_name='Sensible heat flux from conversion of rain/snow atm forcing', & - ptr_col=this%eflx_sh_precip_conversion_col, c2l_scale_type='urbanf', default='inactive') - - this%eflx_lh_tot_u_patch(begp:endp) = spval - call hist_addfld1d (fname='EFLX_LH_TOT_U', units='W/m^2', & - avgflag='A', long_name='Urban total evaporation', & - ptr_patch=this%eflx_lh_tot_u_patch, c2l_scale_type='urbanf', set_nourb=spval, default='inactive') - - this%eflx_soil_grnd_u_patch(begp:endp) = spval - call hist_addfld1d (fname='FGR_U', units='W/m^2', & - avgflag='A', long_name='Urban heat flux into soil/snow including snow melt', & - ptr_patch=this%eflx_soil_grnd_u_patch, c2l_scale_type='urbanf', set_nourb=spval, default='inactive') - - this%netrad_patch(begp:endp) = spval - call hist_addfld1d (fname='Rnet', units='W/m^2', & - avgflag='A', long_name='net radiation', & - ptr_patch=this%netrad_patch, c2l_scale_type='urbanf', & - default='inactive') - - if (use_cn) then - this%dlrad_patch(begp:endp) = spval - call hist_addfld1d (fname='DLRAD', units='W/m^2', & - avgflag='A', long_name='downward longwave radiation below the canopy', & - ptr_patch=this%dlrad_patch, default='inactive', c2l_scale_type='urbanf') - end if - - if (use_cn) then - this%ulrad_patch(begp:endp) = spval - call hist_addfld1d (fname='ULRAD', units='W/m^2', & - avgflag='A', long_name='upward longwave radiation above the canopy', & - ptr_patch=this%ulrad_patch, default='inactive', c2l_scale_type='urbanf') - end if - - if (use_cn) then - this%cgrnd_patch(begp:endp) = spval - call hist_addfld1d (fname='CGRND', units='W/m^2/K', & - avgflag='A', long_name='deriv. of soil energy flux wrt to soil temp', & - ptr_patch=this%cgrnd_patch, default='inactive', c2l_scale_type='urbanf') - end if - - if (use_cn) then - this%cgrndl_patch(begp:endp) = spval - call hist_addfld1d (fname='CGRNDL', units='W/m^2/K', & - avgflag='A', long_name='deriv. of soil latent heat flux wrt soil temp', & - ptr_patch=this%cgrndl_patch, default='inactive', c2l_scale_type='urbanf') - end if - - if (use_cn) then - this%cgrnds_patch(begp:endp) = spval - call hist_addfld1d (fname='CGRNDS', units='W/m^2/K', & - avgflag='A', long_name='deriv. of soil sensible heat flux wrt soil temp', & - ptr_patch=this%cgrnds_patch, default='inactive', c2l_scale_type='urbanf') - end if - - if (use_cn) then - this%eflx_gnet_patch(begp:endp) = spval - call hist_addfld1d (fname='EFLX_GNET', units='W/m^2', & - avgflag='A', long_name='net heat flux into ground', & - ptr_patch=this%eflx_gnet_patch, default='inactive', c2l_scale_type='urbanf') - end if - - this%eflx_grnd_lake_patch(begp:endp) = spval - call hist_addfld1d (fname='EFLX_GRND_LAKE', units='W/m^2', & - avgflag='A', long_name='net heat flux into lake/snow surface, excluding light transmission', & - ptr_patch=this%eflx_grnd_lake_patch, set_nolake=spval, default='inactive') - - if ( is_simple_buildtemp )then - this%eflx_building_heat_errsoi_col(begc:endc) = spval - call hist_addfld1d (fname='BUILDHEAT', units='W/m^2', & - avgflag='A', long_name='heat flux from urban building interior to walls and roof', & - ptr_col=this%eflx_building_heat_errsoi_col, set_nourb=0._r8, c2l_scale_type='urbanf', default='inactive') - - this%eflx_urban_ac_col(begc:endc) = spval - call hist_addfld1d (fname='URBAN_AC', units='W/m^2', & - avgflag='A', long_name='urban air conditioning flux', & - ptr_col=this%eflx_urban_ac_col, set_nourb=0._r8, c2l_scale_type='urbanf', default='inactive') - - this%eflx_urban_heat_col(begc:endc) = spval - call hist_addfld1d (fname='URBAN_HEAT', units='W/m^2', & - avgflag='A', long_name='urban heating flux', & - ptr_col=this%eflx_urban_heat_col, set_nourb=0._r8, c2l_scale_type='urbanf', default='inactive') - else - this%eflx_urban_ac_lun(begl:endl) = spval - call hist_addfld1d (fname='EFLXBUILD', units='W/m^2', & - avgflag='A', long_name='building heat flux from change in interior building air temperature', & - ptr_lunit=this%eflx_building_lun, set_nourb=0._r8, l2g_scale_type='unity', default='inactive') - - this%eflx_urban_ac_lun(begl:endl) = spval - call hist_addfld1d (fname='URBAN_AC', units='W/m^2', & - avgflag='A', long_name='urban air conditioning flux', & - ptr_lunit=this%eflx_urban_ac_lun, set_nourb=0._r8, l2g_scale_type='unity', default='inactive') - - this%eflx_urban_heat_lun(begl:endl) = spval - call hist_addfld1d (fname='URBAN_HEAT', units='W/m^2', & - avgflag='A', long_name='urban heating flux', & - ptr_lunit=this%eflx_urban_heat_lun, set_nourb=0._r8, l2g_scale_type='unity', default='inactive') - end if - - - this%dgnetdT_patch(begp:endp) = spval - call hist_addfld1d (fname='DGNETDT', units='W/m^2/K', & - avgflag='A', long_name='derivative of net ground heat flux wrt soil temp', & - ptr_patch=this%dgnetdT_patch, default='inactive', c2l_scale_type='urbanf') - - this%eflx_fgr12_col(begc:endc) = spval - call hist_addfld1d (fname='FGR12', units='W/m^2', & - avgflag='A', long_name='heat flux between soil layers 1 and 2', & - ptr_col=this%eflx_fgr12_col, set_lake=spval, default='inactive') - - this%eflx_fgr_col(begc:endc,:) = spval - call hist_addfld2d (fname='FGR_SOIL_R', units='watt/m^2', type2d='levgrnd', & - avgflag='A', long_name='Rural downward heat flux at interface below each soil layer', & - ptr_col=this%eflx_fgr_col, set_spec=spval, default='inactive') - - this%eflx_traffic_patch(begp:endp) = spval - call hist_addfld1d (fname='TRAFFICFLUX', units='W/m^2', & - avgflag='A', long_name='sensible heat flux from urban traffic', & - ptr_patch=this%eflx_traffic_patch, set_nourb=0._r8, c2l_scale_type='urbanf', & - default='inactive') - - this%eflx_wasteheat_patch(begp:endp) = spval - call hist_addfld1d (fname='WASTEHEAT', units='W/m^2', & - avgflag='A', long_name='sensible heat flux from heating/cooling sources of urban waste heat', & - ptr_patch=this%eflx_wasteheat_patch, set_nourb=0._r8, c2l_scale_type='urbanf', default='inactive') - - this%eflx_heat_from_ac_patch(begp:endp) = spval - call hist_addfld1d (fname='HEAT_FROM_AC', units='W/m^2', & - avgflag='A', long_name='sensible heat flux put into canyon due to heat removed from air conditioning', & - ptr_patch=this%eflx_heat_from_ac_patch, set_nourb=0._r8, c2l_scale_type='urbanf', default='inactive') - - if ( is_simple_buildtemp )then - this%eflx_anthro_patch(begp:endp) = spval - call hist_addfld1d (fname='Qanth', units='W/m^2', & - avgflag='A', long_name='anthropogenic heat flux', & - ptr_patch=this%eflx_anthro_patch, set_nourb=0._r8, c2l_scale_type='urbanf', & - default='inactive') - end if - - this%taux_patch(begp:endp) = spval - call hist_addfld1d (fname='TAUX', units='kg/m/s^2', & - avgflag='A', long_name='zonal surface stress', & - ptr_patch=this%taux_patch, default='inactive') - ! Rename of TAUX for Urban intercomparision project (when U=V) - call hist_addfld1d (fname='Qtau', units='kg/m/s^2', & - avgflag='A', long_name='momentum flux', & - ptr_patch=this%taux_patch, default='inactive') - - this%tauy_patch(begp:endp) = spval - call hist_addfld1d (fname='TAUY', units='kg/m/s^2', & - avgflag='A', long_name='meridional surface stress', & - ptr_patch=this%tauy_patch, default='inactive') - - this%btran_patch(begp:endp) = spval - if (.not. use_hydrstress) then - call hist_addfld1d (fname='BTRAN', units='unitless', & - avgflag='A', long_name='transpiration beta factor', & - ptr_patch=this%btran_patch, set_lake=spval, set_urb=spval, default='inactive') - end if - - this%btran_min_patch(begp:endp) = spval - call hist_addfld1d (fname='BTRANMN', units='unitless', & - avgflag='A', long_name='daily minimum of transpiration beta factor', & - ptr_patch=this%btran_min_patch, set_lake=spval, set_urb=spval, default='inactive') - - this%btran2_patch(begp:endp) = spval - call hist_addfld1d (fname='BTRAN2', units='unitless', & - avgflag='A', long_name='root zone soil wetness factor', & - ptr_patch=this%btran2_patch, set_lake=spval, set_urb=spval, default='inactive') - - if (use_cn) then - this%rresis_patch(begp:endp,:) = spval - call hist_addfld2d (fname='RRESIS', units='proportion', type2d='levgrnd', & - avgflag='A', long_name='root resistance in each soil layer', & - ptr_patch=this%rresis_patch, default='inactive') - end if - - this%errsoi_col(begc:endc) = spval - call hist_addfld1d (fname='ERRSOI', units='W/m^2', & - avgflag='A', long_name='soil/lake energy conservation error', & - ptr_col=this%errsoi_col, default='inactive') - - this%errseb_patch(begp:endp) = spval - call hist_addfld1d (fname='ERRSEB', units='W/m^2', & - avgflag='A', long_name='surface energy conservation error', & - ptr_patch=this%errseb_patch, default='inactive') - - this%errsol_patch(begp:endp) = spval - call hist_addfld1d (fname='ERRSOL', units='W/m^2', & - avgflag='A', long_name='solar radiation conservation error', & - ptr_patch=this%errsol_patch, set_urb=spval, default='inactive') - - end subroutine InitHistory - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds, t_grnd_col, is_simple_buildtemp, is_prog_buildtemp) + subroutine InitCold(this, bounds, t_grnd_col) ! ! !DESCRIPTION: ! Initialize cold start conditions for module variables ! ! !USES: use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ - use clm_varpar , only : nlevsoi, nlevgrnd, nlevsno, nlevlak, nlevurb - use clm_varcon , only : denice, denh2o, sb - use landunit_varcon , only : istwet, istsoil, istdlak - use column_varcon , only : icol_road_imperv, icol_roof, icol_sunwall - use column_varcon , only : icol_shadewall, icol_road_perv - use clm_varctl , only : iulog, use_vancouver, use_mexicocity + use clm_varcon , only : sb implicit none ! ! !ARGUMENTS: class(energyflux_type) :: this type(bounds_type) , intent(in) :: bounds real(r8) , intent(in) :: t_grnd_col( bounds%begc: ) - logical , intent(in) :: is_simple_buildtemp ! If using simple building temp method - logical , intent(in) :: is_prog_buildtemp ! If using prognostic building temp method ! ! !LOCAL VARIABLES: - integer :: j,l,c,p,levs,lev + integer :: c,p !----------------------------------------------------------------------- SHR_ASSERT_ALL((ubound(t_grnd_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - ! Columns - if ( is_simple_buildtemp )then - do c = bounds%begc, bounds%endc - l = col%landunit(c) - - if (lun%urbpoi(l)) then - this%eflx_building_heat_errsoi_col(c) = 0._r8 - this%eflx_urban_ac_col(c) = 0._r8 - this%eflx_urban_heat_col(c) = 0._r8 - else - this%eflx_building_heat_errsoi_col(c) = 0._r8 - this%eflx_urban_ac_col(c) = 0._r8 - this%eflx_urban_heat_col(c) = 0._r8 - end if - - end do - end if - ! Patches do p = bounds%begp, bounds%endp c = patch%column(p) - l = patch%landunit(p) - - if (.not. lun%urbpoi(l)) then ! non-urban - this%eflx_lwrad_net_u_patch(p) = spval - this%eflx_lwrad_out_u_patch(p) = spval - this%eflx_lh_tot_u_patch(p) = spval - this%eflx_sh_tot_u_patch(p) = spval - this%eflx_soil_grnd_u_patch(p) = spval - end if - this%eflx_lwrad_out_patch(p) = sb * (t_grnd_col(c))**4 end do - ! patches - do p = bounds%begp, bounds%endp - l = patch%landunit(p) - - if (.not. lun%urbpoi(l)) then - this%eflx_traffic_lun(l) = spval - this%eflx_wasteheat_lun(l) = spval - if ( is_prog_buildtemp )then - this%eflx_building_lun(l) = 0._r8 - this%eflx_urban_ac_lun(l) = 0._r8 - this%eflx_urban_heat_lun(l) = 0._r8 - end if - - this%eflx_wasteheat_patch(p) = 0._r8 - this%eflx_heat_from_ac_patch(p) = 0._r8 - this%eflx_traffic_patch(p) = 0._r8 - if ( is_simple_buildtemp) & - this%eflx_anthro_patch(p) = 0._r8 - else - if ( is_prog_buildtemp )then - this%eflx_building_lun(l) = 0._r8 - this%eflx_urban_ac_lun(l) = 0._r8 - this%eflx_urban_heat_lun(l) = 0._r8 - end if - end if - end do - - ! initialize rresis, for use in ecosystemdyn - do p = bounds%begp,bounds%endp - do lev = 1,nlevgrnd - this%rresis_patch(p,lev) = 0._r8 - end do - end do - end subroutine InitCold !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag, is_simple_buildtemp, is_prog_buildtemp) + subroutine Restart(this, bounds, ncid, flag) ! ! !DESCRIPTION: ! Read/Write module information to/from restart file. ! ! !USES: - use shr_log_mod, only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_double, ncd_int, & - ncd_inqvdlen + use ncdio_pio , only : file_desc_t, ncd_double use restUtilMod - use decompMod , only : get_proc_global implicit none ! ! !ARGUMENTS: @@ -778,245 +123,16 @@ subroutine Restart(this, bounds, ncid, flag, is_simple_buildtemp, is_prog_buildt type(bounds_type), intent(in) :: bounds type(file_desc_t), intent(inout) :: ncid character(len=*) , intent(in) :: flag - logical , intent(in) :: is_simple_buildtemp ! If using simple building temp method - logical , intent(in) :: is_prog_buildtemp ! If using prognostic building temp method ! ! !LOCAL VARIABLES: - integer :: j,c ! indices - integer :: dimlen - integer :: err_code - integer :: numl_global logical :: readvar ! determine if variable is on initial file - logical :: do_io !----------------------------------------------------------------------- - call get_proc_global(nl=numl_global) call restartvar(ncid=ncid, flag=flag, varname='EFLX_LWRAD_OUT', xtype=ncd_double, & dim1name='pft', & long_name='emitted infrared (longwave) radiation', units='watt/m^2', & interpinic_flag='interp', readvar=readvar, data=this%eflx_lwrad_out_patch) - ! Restart for building air temperature method - if ( is_prog_buildtemp )then - ! landunit urban energy state variable - eflx_urban_ac - do_io = .true. - ! On a read, confirm that this variable has the expected size (landunit-level); if not, - ! don't read it (instead give it a default value). This is needed to support older initial - ! conditions for which this variable had a different size (column-level). - if (flag == 'read') then - call ncd_inqvdlen(ncid, 'URBAN_AC_L', 1, dimlen, err_code) - if (dimlen /= numl_global) then - do_io = .false. - readvar = .false. - end if - end if - if (do_io) then - call restartvar(ncid=ncid, flag=flag, varname='URBAN_AC_L', xtype=ncd_double, & - dim1name='landunit',& - long_name='urban air conditioning flux', units='watt/m^2', & - interpinic_flag='interp', readvar=readvar, data=this%eflx_urban_ac_lun) - else - this%eflx_urban_ac_lun = 0.0_r8 - end if - ! landunit urban energy state variable - eflx_urban_heat - do_io = .true. - ! On a read, confirm that this variable has the expected size (landunit-level); if not, - ! don't read it (instead give it a default value). This is needed to support older initial - ! conditions for which this variable had a different size (column-level). - if (flag == 'read') then - call ncd_inqvdlen(ncid, 'URBAN_HEAT_L', 1, dimlen, err_code) - if (dimlen /= numl_global) then - do_io = .false. - readvar = .false. - end if - end if - if (do_io) then - call restartvar(ncid=ncid, flag=flag, varname='URBAN_HEAT_L', xtype=ncd_double, & - dim1name='landunit',& - long_name='urban heating flux', units='watt/m^2', & - interpinic_flag='interp', readvar=readvar, data=this%eflx_urban_heat_lun) - else - this%eflx_urban_heat_lun = 0.0_r8 - end if - else if ( is_simple_buildtemp )then - call restartvar(ncid=ncid, flag=flag, varname='URBAN_AC', xtype=ncd_double, & - dim1name='column', & - long_name='urban air conditioning flux', units='watt/m^2', & - interpinic_flag='interp', readvar=readvar, data=this%eflx_urban_ac_col) - call restartvar(ncid=ncid, flag=flag, varname='URBAN_HEAT', xtype=ncd_double, & - dim1name='column', & - long_name='urban heating flux', units='watt/m^2', & - interpinic_flag='interp', readvar=readvar, data=this%eflx_urban_heat_col) - end if - - call restartvar(ncid=ncid, flag=flag, varname='btran2', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%btran2_patch) - - call restartvar(ncid=ncid, flag=flag, varname='BTRAN_MIN', xtype=ncd_double, & - dim1name='pft', & - long_name='daily minimum of transpiration wetness factor', units='', & - interpinic_flag='interp', readvar=readvar, data=this%btran_min_patch) - - call restartvar(ncid=ncid, flag=flag, varname='BTRAN_MIN_INST', xtype=ncd_double, & - dim1name='pft', & - long_name='instantaneous daily minimum of transpiration wetness factor', units='', & - interpinic_flag='interp', readvar=readvar, data=this%btran_min_inst_patch) - - call restartvar(ncid=ncid, flag=flag, varname='eflx_grnd_lake', xtype=ncd_double, & - dim1name='pft', & - long_name='net heat flux into lake/snow surface, excluding light transmission', units='W/m^2', & - interpinic_flag='interp', readvar=readvar, data=this%eflx_grnd_lake_patch) - end subroutine Restart - !----------------------------------------------------------------------- - subroutine InitAccBuffer (this, bounds) - ! - ! !DESCRIPTION: - ! Initialize accumulation buffer for all required module accumulated fields - ! This routine set defaults values that are then overwritten by the - ! restart file for restart or branch runs - ! Each interval and accumulation type is unique to each field processed. - ! Routine [initAccBuffer] defines the fields to be processed - ! and the type of accumulation. - ! Routine [updateAccVars] does the actual accumulation for a given field. - ! Fields are accumulated by calls to subroutine [update_accum_field]. - ! To accumulate a field, it must first be defined in subroutine [initAccVars] - ! and then accumulated by calls to [updateAccVars]. - ! Four types of accumulations are possible: - ! o average over time interval - ! o running mean over time interval - ! o running accumulation over time interval - ! Time average fields are only valid at the end of the averaging interval. - ! Running means are valid once the length of the simulation exceeds the - ! averaging interval. Accumulated fields are continuously accumulated. - ! The trigger value "-99999." resets the accumulation to zero. - ! - ! !USES - use accumulMod , only : init_accum_field - use clm_time_manager , only : get_step_size - use shr_const_mod , only : SHR_CONST_CDAY, SHR_CONST_TKFRZ - ! - ! !ARGUMENTS: - class(energyflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - real(r8) :: dtime - integer, parameter :: not_used = huge(1) - !--------------------------------------------------------------------- - - dtime = get_step_size() - - call init_accum_field(name='BTRANAV', units='-', & - desc='average over an hour of btran', accum_type='timeavg', accum_period=nint(3600._r8/dtime), & - subgrid_type='pft', numlev=1, init_value=0._r8) - - end subroutine InitAccBuffer - !----------------------------------------------------------------------- - subroutine InitAccVars(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module variables that are associated with - ! time accumulated fields. This routine is called for both an initial run - ! and a restart run (and must therefore must be called after the restart file - ! is read in and the accumulation buffer is obtained) - ! - ! !USES - use accumulMod , only : init_accum_field, extract_accum_field - use clm_time_manager , only : get_nstep - use clm_varctl , only : nsrest, nsrStartup - use abortutils , only : endrun - ! - ! !ARGUMENTS: - class(energyflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: nstep - integer :: ier - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - ! Initialize variables that are to be time accumulated - ! Initialize btran min values - if (nsrest == nsrStartup) then - this%btran_min_patch(begp:endp) = spval - - this%btran_min_inst_patch(begp:endp) = spval - end if - - end subroutine InitAccVars - !----------------------------------------------------------------------- - subroutine UpdateAccVars (this, bounds) - ! - ! USES - use shr_const_mod , only : SHR_CONST_CDAY, SHR_CONST_TKFRZ - use clm_time_manager , only : get_step_size, get_nstep, is_end_curr_day, get_curr_date - use accumulMod , only : update_accum_field, extract_accum_field, accumResetVal - use clm_varctl , only : iulog - use abortutils , only : endrun - ! - ! !ARGUMENTS: - class(energyflux_type) :: this - type(bounds_type) , intent(in) :: bounds - - ! - ! !LOCAL VARIABLES: - integer :: m,g,l,c,p ! indices - integer :: ier ! error status - integer :: dtime ! timestep size [seconds] - integer :: nstep ! timestep number - integer :: year ! year (0, ...) for nstep - integer :: month ! month (1, ..., 12) for nstep - integer :: day ! day of month (1, ..., 31) for nstep - integer :: secs ! seconds into current date for nstep - logical :: end_cd ! temporary for is_end_curr_day() value - integer :: begp, endp - real(r8), pointer :: rbufslp(:) ! temporary single level - pft level - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - dtime = get_step_size() - nstep = get_nstep() - call get_curr_date (year, month, day, secs) - - ! Allocate needed dynamic memory for single level pft field - - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)'update_accum_hist allocation error for rbuf1dp' - call endrun(msg=errMsg(__FILE__, __LINE__)) - endif - - ! Accumulate and extract BTRANAV - hourly average btran - ! Used to compute minimum of hourly averaged btran - ! over a day. Note that "spval" is returned by the call to - ! accext if the time step does not correspond to the end of an - ! accumulation interval. First, initialize the necessary values for - ! an initial run at the first time step the accumulator is called - - call update_accum_field ('BTRANAV', this%btran_patch, nstep) - call extract_accum_field ('BTRANAV', rbufslp, nstep) - end_cd = is_end_curr_day() - do p = begp,endp - if (rbufslp(p) /= spval) then - this%btran_min_inst_patch(p) = min(rbufslp(p), this%btran_min_inst_patch(p)) - endif - if (end_cd) then - this%btran_min_patch(p) = this%btran_min_inst_patch(p) - this%btran_min_inst_patch(p) = spval - else if (secs == dtime) then - this%btran_min_patch(p) = spval - endif - end do - - deallocate(rbufslp) - - end subroutine UpdateAccVars end module EnergyFluxType diff --git a/src/biogeophys/FrictionVelocityMod.F90 b/src/biogeophys/FrictionVelocityMod.F90 deleted file mode 100644 index 46ce60875a..0000000000 --- a/src/biogeophys/FrictionVelocityMod.F90 +++ /dev/null @@ -1,772 +0,0 @@ -module FrictionVelocityMod - -#include "shr_assert.h" - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Calculation of the friction velocity, relation for potential - ! temperature and humidity profiles of surface boundary layer. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use clm_varcon , only : spval - use clm_varctl , only : use_cn, use_luna - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: FrictionVelocity ! Calculate friction velocity - public :: MoninObukIni ! Initialization of the Monin-Obukhov length - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: StabilityFunc1 ! Stability function for rib < 0. - private :: StabilityFunc2 ! Stability function for rib < 0. - - type, public :: frictionvel_type - - ! Roughness length/resistance for friction velocity calculation - - real(r8), pointer, public :: forc_hgt_u_patch (:) ! patch wind forcing height (10m+z0m+d) (m) - real(r8), pointer, public :: forc_hgt_t_patch (:) ! patch temperature forcing height (10m+z0m+d) (m) - real(r8), pointer, public :: forc_hgt_q_patch (:) ! patch specific humidity forcing height (10m+z0m+d) (m) - real(r8), pointer, public :: u10_patch (:) ! patch 10-m wind (m/s) (for dust model) - real(r8), pointer, public :: u10_clm_patch (:) ! patch 10-m wind (m/s) (for clm_map2gcell) - real(r8), pointer, public :: va_patch (:) ! patch atmospheric wind speed plus convective velocity (m/s) - real(r8), pointer, public :: vds_patch (:) ! patch deposition velocity term (m/s) (for dry dep SO4, NH4NO3) - real(r8), pointer, public :: fv_patch (:) ! patch friction velocity (m/s) (for dust model) - real(r8), pointer, public :: rb1_patch (:) ! patch aerodynamical resistance (s/m) (for dry deposition of chemical tracers) - real(r8), pointer, public :: rb10_patch (:) ! 10-day mean patch aerodynamical resistance (s/m) (for LUNA model) - real(r8), pointer, public :: ram1_patch (:) ! patch aerodynamical resistance (s/m) - real(r8), pointer, public :: z0m_patch (:) ! patch momentum roughness length (m) - real(r8), pointer, public :: z0mv_patch (:) ! patch roughness length over vegetation, momentum [m] - real(r8), pointer, public :: z0hv_patch (:) ! patch roughness length over vegetation, sensible heat [m] - real(r8), pointer, public :: z0qv_patch (:) ! patch roughness length over vegetation, latent heat [m] - real(r8), pointer, public :: z0mg_col (:) ! col roughness length over ground, momentum [m] - real(r8), pointer, public :: z0hg_col (:) ! col roughness length over ground, sensible heat [m] - real(r8), pointer, public :: z0qg_col (:) ! col roughness length over ground, latent heat [m] - - contains - - ! Public procedures - procedure, public :: Init - procedure, public :: Restart - - ! Private procedures - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - end type frictionvel_type - - type, public :: frictionvel_parms_type - real(r8) :: zetamaxstable ! Max value zeta ("height" used in Monin-Obukhov theory) can go to under stable conditions - end type frictionvel_parms_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------------ - - type(frictionvel_parms_type), public, protected :: frictionvel_parms_inst - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(frictionvel_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(frictionvel_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - allocate(this%forc_hgt_u_patch (begp:endp)) ; this%forc_hgt_u_patch (:) = nan - allocate(this%forc_hgt_t_patch (begp:endp)) ; this%forc_hgt_t_patch (:) = nan - allocate(this%forc_hgt_q_patch (begp:endp)) ; this%forc_hgt_q_patch (:) = nan - allocate(this%u10_patch (begp:endp)) ; this%u10_patch (:) = nan - allocate(this%u10_clm_patch (begp:endp)) ; this%u10_clm_patch (:) = nan - allocate(this%va_patch (begp:endp)) ; this%va_patch (:) = nan - allocate(this%vds_patch (begp:endp)) ; this%vds_patch (:) = nan - allocate(this%fv_patch (begp:endp)) ; this%fv_patch (:) = nan - allocate(this%rb1_patch (begp:endp)) ; this%rb1_patch (:) = nan - allocate(this%rb10_patch (begp:endp)) ; this%rb10_patch (:) = spval - allocate(this%ram1_patch (begp:endp)) ; this%ram1_patch (:) = nan - allocate(this%z0m_patch (begp:endp)) ; this%z0m_patch (:) = nan - allocate(this%z0mv_patch (begp:endp)) ; this%z0mv_patch (:) = nan - allocate(this%z0hv_patch (begp:endp)) ; this%z0hv_patch (:) = nan - allocate(this%z0qv_patch (begp:endp)) ; this%z0qv_patch (:) = nan - allocate(this%z0mg_col (begc:endc)) ; this%z0mg_col (:) = nan - allocate(this%z0qg_col (begc:endc)) ; this%z0qg_col (:) = nan - allocate(this%z0hg_col (begc:endc)) ; this%z0hg_col (:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! History fields initialization - ! - ! !USES: - use shr_infnan_mod, only: nan => shr_infnan_nan, assignment(=) - use histFileMod , only: hist_addfld1d, hist_addfld2d - ! - ! !ARGUMENTS: - class(frictionvel_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - integer :: begp, endp - !--------------------------------------------------------------------- - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - this%z0mg_col(begc:endc) = spval - call hist_addfld1d (fname='Z0MG', units='m', & - avgflag='A', long_name='roughness length over ground, momentum', & - ptr_col=this%z0mg_col, default='inactive') - - this%z0hg_col(begc:endc) = spval - call hist_addfld1d (fname='Z0HG', units='m', & - avgflag='A', long_name='roughness length over ground, sensible heat', & - ptr_col=this%z0hg_col, default='inactive') - - this%z0qg_col(begc:endc) = spval - call hist_addfld1d (fname='Z0QG', units='m', & - avgflag='A', long_name='roughness length over ground, latent heat', & - ptr_col=this%z0qg_col, default='inactive') - - this%va_patch(begp:endp) = spval - call hist_addfld1d (fname='VA', units='m/s', & - avgflag='A', long_name='atmospheric wind speed plus convective velocity', & - ptr_patch=this%va_patch, default='inactive') - - this%u10_clm_patch(begp:endp) = spval - call hist_addfld1d (fname='U10', units='m/s', & - avgflag='A', long_name='10-m wind', & - ptr_patch=this%u10_clm_patch, default='inactive') - - call hist_addfld1d (fname='U10_ICE', units='m/s', & - avgflag='A', long_name='10-m wind (ice landunits only)', & - ptr_patch=this%u10_clm_patch, l2g_scale_type='ice', default='inactive') - - this%u10_patch(begp:endp) = spval - call hist_addfld1d (fname='U10_DUST', units='m/s', & - avgflag='A', long_name='10-m wind for dust model', & - ptr_patch=this%u10_patch, default='inactive') - - if (use_cn) then - this%ram1_patch(begp:endp) = spval - call hist_addfld1d (fname='RAM1', units='s/m', & - avgflag='A', long_name='aerodynamical resistance ', & - ptr_patch=this%ram1_patch, default='inactive') - end if - - if (use_cn) then - this%fv_patch(begp:endp) = spval - call hist_addfld1d (fname='FV', units='m/s', & - avgflag='A', long_name='friction velocity for dust model', & - ptr_patch=this%fv_patch, default='inactive') - end if - - if (use_cn) then - this%z0hv_patch(begp:endp) = spval - call hist_addfld1d (fname='Z0HV', units='m', & - avgflag='A', long_name='roughness length over vegetation, sensible heat', & - ptr_patch=this%z0hv_patch, default='inactive') - end if - - if (use_cn) then - this%z0m_patch(begp:endp) = spval - call hist_addfld1d (fname='Z0M', units='m', & - avgflag='A', long_name='momentum roughness length', & - ptr_patch=this%z0m_patch, default='inactive') - end if - - if (use_cn) then - this%z0mv_patch(begp:endp) = spval - call hist_addfld1d (fname='Z0MV', units='m', & - avgflag='A', long_name='roughness length over vegetation, momentum', & - ptr_patch=this%z0mv_patch, default='inactive') - end if - - if (use_cn) then - this%z0qv_patch(begp:endp) = spval - call hist_addfld1d (fname='Z0QV', units='m', & - avgflag='A', long_name='roughness length over vegetation, latent heat', & - ptr_patch=this%z0qv_patch, default='inactive') - end if - - if (use_luna) then - call hist_addfld1d (fname='RB10', units='s/m', & - avgflag='A', long_name='10 day running mean boundary layer resistance', & - ptr_patch=this%rb10_patch, default='inactive') - end if - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! Initialize module surface albedos to reasonable values - ! - ! !ARGUMENTS: - class(frictionvel_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p, c, l ! indices - !----------------------------------------------------------------------- - - ! Added 5/4/04, PET: initialize forc_hgt_u (gridcell-level), - ! since this is not initialized before first call to CNVegStructUpdate, - ! and it is required to set the upper bound for canopy top height. - ! Changed 3/21/08, KO: still needed but don't have sufficient information - ! to set this properly (e.g., patch-level displacement height and roughness - ! length). So leave at 30m. - - if (use_cn) then - do p = bounds%begp, bounds%endp - this%forc_hgt_u_patch(p) = 30._r8 - end do - end if - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%lakpoi(l)) then !lake - this%z0mg_col(c) = 0.0004_r8 - end if - end do - - end subroutine InitCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag) - ! - ! !DESCRIPTION: - ! Read/Write module information to/from restart file. - ! - ! !USES: - use spmdMod , only : masterproc - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_double, ncd_int, ncd_inqvdlen - use restUtilMod - ! - ! !ARGUMENTS: - class(frictionvel_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - logical :: readvar ! determine if variable is on initial file - !----------------------------------------------------------------------- - - call restartvar(ncid=ncid, flag=flag, varname='Z0MG', xtype=ncd_double, & - dim1name='column', & - long_name='ground momentum roughness length', units='m', & - interpinic_flag='interp', readvar=readvar, data=this%z0mg_col) - - if(use_luna)then - call restartvar(ncid=ncid, flag=flag, varname='rb10', xtype=ncd_double, & - dim1name='pft', long_name='10-day mean boundary layer resistance at the pacth', units='s/m', & - interpinic_flag='interp', readvar=readvar, data=this%rb10_patch) - endif - - end subroutine Restart - - !------------------------------------------------------------------------------ - subroutine FrictionVelocity(lbn, ubn, fn, filtern, & - displa, z0m, z0h, z0q, & - obu, iter, ur, um, ustar, & - temp1, temp2, temp12m, temp22m, fm, frictionvel_inst, landunit_index) - ! - ! !DESCRIPTION: - ! Calculation of the friction velocity, relation for potential - ! temperature and humidity profiles of surface boundary layer. - ! The scheme is based on the work of Zeng et al. (1998): - ! Intercomparison of bulk aerodynamic algorithms for the computation - ! of sea surface fluxes using TOGA CORE and TAO data. J. Climate, - ! Vol. 11, 2628-2644. - ! - ! !USES: - use clm_varcon, only : vkc - use clm_varctl, only : iulog - ! - ! !ARGUMENTS: - integer , intent(in) :: lbn, ubn ! pft/landunit array bounds - integer , intent(in) :: fn ! number of filtered pft/landunit elements - integer , intent(in) :: filtern(fn) ! pft/landunit filter - real(r8) , intent(in) :: displa ( lbn: ) ! displacement height (m) [lbn:ubn] - real(r8) , intent(in) :: z0m ( lbn: ) ! roughness length over vegetation, momentum [m] [lbn:ubn] - real(r8) , intent(in) :: z0h ( lbn: ) ! roughness length over vegetation, sensible heat [m] [lbn:ubn] - real(r8) , intent(in) :: z0q ( lbn: ) ! roughness length over vegetation, latent heat [m] [lbn:ubn] - real(r8) , intent(in) :: obu ( lbn: ) ! monin-obukhov length (m) [lbn:ubn] - integer , intent(in) :: iter ! iteration number - real(r8) , intent(in) :: ur ( lbn: ) ! wind speed at reference height [m/s] [lbn:ubn] - real(r8) , intent(in) :: um ( lbn: ) ! wind speed including the stablity effect [m/s] [lbn:ubn] - real(r8) , intent(out) :: ustar ( lbn: ) ! friction velocity [m/s] [lbn:ubn] - real(r8) , intent(out) :: temp1 ( lbn: ) ! relation for potential temperature profile [lbn:ubn] - real(r8) , intent(out) :: temp12m ( lbn: ) ! relation for potential temperature profile applied at 2-m [lbn:ubn] - real(r8) , intent(out) :: temp2 ( lbn: ) ! relation for specific humidity profile [lbn:ubn] - real(r8) , intent(out) :: temp22m ( lbn: ) ! relation for specific humidity profile applied at 2-m [lbn:ubn] - real(r8) , intent(inout) :: fm ( lbn: ) ! diagnose 10m wind (DUST only) [lbn:ubn] - type(frictionvel_type) , intent(inout) :: frictionvel_inst - logical , intent(in), optional :: landunit_index ! optional argument that defines landunit or pft level - ! - ! !LOCAL VARIABLES: - real(r8), parameter :: zetam = 1.574_r8 ! transition point of flux-gradient relation (wind profile) - real(r8), parameter :: zetat = 0.465_r8 ! transition point of flux-gradient relation (temp. profile) - integer :: f ! pft/landunit filter index - integer :: n ! pft/landunit index - integer :: g ! gridcell index - integer :: pp ! pfti,pftf index - real(r8) :: zldis(lbn:ubn) ! reference height "minus" zero displacement heght [m] - real(r8) :: zeta(lbn:ubn) ! dimensionless height used in Monin-Obukhov theory - real(r8) :: tmp1,tmp2,tmp3,tmp4 ! Used to diagnose the 10 meter wind - real(r8) :: fmnew ! Used to diagnose the 10 meter wind - real(r8) :: fm10 ! Used to diagnose the 10 meter wind - real(r8) :: zeta10 ! Used to diagnose the 10 meter wind - real(r8) :: vds_tmp ! Temporary for dry deposition velocity - !------------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(displa) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(z0m) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(z0h) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(z0q) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(obu) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(ur) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(um) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(ustar) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(temp1) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(temp12m) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(temp2) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(temp22m) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fm) == (/ubn/)), errMsg(sourcefile, __LINE__)) - - associate( & - pfti => lun%patchi , & ! Input: [integer (:) ] beginning pfti index for landunit - pftf => lun%patchf , & ! Input: [integer (:) ] final pft index for landunit - - forc_hgt_u_patch => frictionvel_inst%forc_hgt_u_patch , & ! Input: [real(r8) (:) ] observational height of wind at pft level [m] - forc_hgt_t_patch => frictionvel_inst%forc_hgt_t_patch , & ! Input: [real(r8) (:) ] observational height of temperature at pft level [m] - forc_hgt_q_patch => frictionvel_inst%forc_hgt_q_patch , & ! Input: [real(r8) (:) ] observational height of specific humidity at pft level [m] - vds => frictionvel_inst%vds_patch , & ! Output: [real(r8) (:) ] dry deposition velocity term (m/s) (for SO4 NH4NO3) - u10 => frictionvel_inst%u10_patch , & ! Output: [real(r8) (:) ] 10-m wind (m/s) (for dust model) - u10_clm => frictionvel_inst%u10_clm_patch , & ! Output: [real(r8) (:) ] 10-m wind (m/s) - va => frictionvel_inst%va_patch , & ! Output: [real(r8) (:) ] atmospheric wind speed plus convective velocity (m/s) - fv => frictionvel_inst%fv_patch & ! Output: [real(r8) (:) ] friction velocity (m/s) (for dust model) - ) - - ! Adjustment factors for unstable (moz < 0) or stable (moz > 0) conditions. - - do f = 1, fn - n = filtern(f) - if (present(landunit_index)) then - g = lun%gridcell(n) - else - g = patch%gridcell(n) - end if - - ! Wind profile - - if (present(landunit_index)) then - zldis(n) = forc_hgt_u_patch(pfti(n))-displa(n) - else - zldis(n) = forc_hgt_u_patch(n)-displa(n) - end if - zeta(n) = zldis(n)/obu(n) - if (zeta(n) < -zetam) then - ustar(n) = vkc*um(n)/(log(-zetam*obu(n)/z0m(n))& - - StabilityFunc1(-zetam) & - + StabilityFunc1(z0m(n)/obu(n)) & - + 1.14_r8*((-zeta(n))**0.333_r8-(zetam)**0.333_r8)) - else if (zeta(n) < 0._r8) then - ustar(n) = vkc*um(n)/(log(zldis(n)/z0m(n))& - - StabilityFunc1(zeta(n))& - + StabilityFunc1(z0m(n)/obu(n))) - else if (zeta(n) <= 1._r8) then - ustar(n) = vkc*um(n)/(log(zldis(n)/z0m(n)) + 5._r8*zeta(n) -5._r8*z0m(n)/obu(n)) - else - ustar(n) = vkc*um(n)/(log(obu(n)/z0m(n))+5._r8-5._r8*z0m(n)/obu(n) & - +(5._r8*log(zeta(n))+zeta(n)-1._r8)) - end if - - if (zeta(n) < 0._r8) then - vds_tmp = 2.e-3_r8*ustar(n) * ( 1._r8 + (300._r8/(-obu(n)))**0.666_r8) - else - vds_tmp = 2.e-3_r8*ustar(n) - endif - - if (present(landunit_index)) then - do pp = pfti(n),pftf(n) - vds(pp) = vds_tmp - end do - else - vds(n) = vds_tmp - end if - - ! Calculate a 10-m wind (10m + z0m + d) - ! For now, this will not be the same as the 10-m wind calculated for the dust - ! model because the CLM stability functions are used here, not the LSM stability - ! functions used in the dust model. We will eventually change the dust model to be - ! consistent with the following formulation. - ! Note that the 10-m wind calculated this way could actually be larger than the - ! atmospheric forcing wind because 1) this includes the convective velocity, 2) - ! this includes the 1 m/s minimum wind threshold - - ! If forcing height is less than or equal to 10m, then set 10-m wind to um - if (present(landunit_index)) then - do pp = pfti(n),pftf(n) - if (zldis(n)-z0m(n) <= 10._r8) then - u10_clm(pp) = um(n) - else - if (zeta(n) < -zetam) then - u10_clm(pp) = um(n) - ( ustar(n)/vkc*(log(-zetam*obu(n)/(10._r8+z0m(n))) & - - StabilityFunc1(-zetam) & - + StabilityFunc1((10._r8+z0m(n))/obu(n)) & - + 1.14_r8*((-zeta(n))**0.333_r8-(zetam)**0.333_r8)) ) - else if (zeta(n) < 0._r8) then - u10_clm(pp) = um(n) - ( ustar(n)/vkc*(log(zldis(n)/(10._r8+z0m(n))) & - - StabilityFunc1(zeta(n)) & - + StabilityFunc1((10._r8+z0m(n))/obu(n))) ) - else if (zeta(n) <= 1._r8) then - u10_clm(pp) = um(n) - ( ustar(n)/vkc*(log(zldis(n)/(10._r8+z0m(n))) & - + 5._r8*zeta(n) - 5._r8*(10._r8+z0m(n))/obu(n)) ) - else - u10_clm(pp) = um(n) - ( ustar(n)/vkc*(log(obu(n)/(10._r8+z0m(n))) & - + 5._r8 - 5._r8*(10._r8+z0m(n))/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) ) - - end if - end if - va(pp) = um(n) - end do - else - if (zldis(n)-z0m(n) <= 10._r8) then - u10_clm(n) = um(n) - else - if (zeta(n) < -zetam) then - u10_clm(n) = um(n) - ( ustar(n)/vkc*(log(-zetam*obu(n)/(10._r8+z0m(n))) & - - StabilityFunc1(-zetam) & - + StabilityFunc1((10._r8+z0m(n))/obu(n)) & - + 1.14_r8*((-zeta(n))**0.333_r8-(zetam)**0.333_r8)) ) - else if (zeta(n) < 0._r8) then - u10_clm(n) = um(n) - ( ustar(n)/vkc*(log(zldis(n)/(10._r8+z0m(n))) & - - StabilityFunc1(zeta(n)) & - + StabilityFunc1((10._r8+z0m(n))/obu(n))) ) - else if (zeta(n) <= 1._r8) then - u10_clm(n) = um(n) - ( ustar(n)/vkc*(log(zldis(n)/(10._r8+z0m(n))) & - + 5._r8*zeta(n) - 5._r8*(10._r8+z0m(n))/obu(n)) ) - else - u10_clm(n) = um(n) - ( ustar(n)/vkc*(log(obu(n)/(10._r8+z0m(n))) & - + 5._r8 - 5._r8*(10._r8+z0m(n))/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) ) - end if - end if - va(n) = um(n) - end if - - ! Temperature profile - - if (present(landunit_index)) then - zldis(n) = forc_hgt_t_patch(pfti(n))-displa(n) - else - zldis(n) = forc_hgt_t_patch(n)-displa(n) - end if - zeta(n) = zldis(n)/obu(n) - if (zeta(n) < -zetat) then - temp1(n) = vkc/(log(-zetat*obu(n)/z0h(n))& - - StabilityFunc2(-zetat) & - + StabilityFunc2(z0h(n)/obu(n)) & - + 0.8_r8*((zetat)**(-0.333_r8)-(-zeta(n))**(-0.333_r8))) - else if (zeta(n) < 0._r8) then - temp1(n) = vkc/(log(zldis(n)/z0h(n)) & - - StabilityFunc2(zeta(n)) & - + StabilityFunc2(z0h(n)/obu(n))) - else if (zeta(n) <= 1._r8) then - temp1(n) = vkc/(log(zldis(n)/z0h(n)) + 5._r8*zeta(n) - 5._r8*z0h(n)/obu(n)) - else - temp1(n) = vkc/(log(obu(n)/z0h(n)) + 5._r8 - 5._r8*z0h(n)/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) - end if - - ! Humidity profile - - if (present(landunit_index)) then - if (forc_hgt_q_patch(pfti(n)) == forc_hgt_t_patch(pfti(n)) .and. z0q(n) == z0h(n)) then - temp2(n) = temp1(n) - else - zldis(n) = forc_hgt_q_patch(pfti(n))-displa(n) - zeta(n) = zldis(n)/obu(n) - if (zeta(n) < -zetat) then - temp2(n) = vkc/(log(-zetat*obu(n)/z0q(n)) & - - StabilityFunc2(-zetat) & - + StabilityFunc2(z0q(n)/obu(n)) & - + 0.8_r8*((zetat)**(-0.333_r8)-(-zeta(n))**(-0.333_r8))) - else if (zeta(n) < 0._r8) then - temp2(n) = vkc/(log(zldis(n)/z0q(n)) & - - StabilityFunc2(zeta(n)) & - + StabilityFunc2(z0q(n)/obu(n))) - else if (zeta(n) <= 1._r8) then - temp2(n) = vkc/(log(zldis(n)/z0q(n)) + 5._r8*zeta(n)-5._r8*z0q(n)/obu(n)) - else - temp2(n) = vkc/(log(obu(n)/z0q(n)) + 5._r8 - 5._r8*z0q(n)/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) - end if - end if - else - if (forc_hgt_q_patch(n) == forc_hgt_t_patch(n) .and. z0q(n) == z0h(n)) then - temp2(n) = temp1(n) - else - zldis(n) = forc_hgt_q_patch(n)-displa(n) - zeta(n) = zldis(n)/obu(n) - if (zeta(n) < -zetat) then - temp2(n) = vkc/(log(-zetat*obu(n)/z0q(n)) & - - StabilityFunc2(-zetat) & - + StabilityFunc2(z0q(n)/obu(n)) & - + 0.8_r8*((zetat)**(-0.333_r8)-(-zeta(n))**(-0.333_r8))) - else if (zeta(n) < 0._r8) then - temp2(n) = vkc/(log(zldis(n)/z0q(n)) & - - StabilityFunc2(zeta(n)) & - + StabilityFunc2(z0q(n)/obu(n))) - else if (zeta(n) <= 1._r8) then - temp2(n) = vkc/(log(zldis(n)/z0q(n)) + 5._r8*zeta(n)-5._r8*z0q(n)/obu(n)) - else - temp2(n) = vkc/(log(obu(n)/z0q(n)) + 5._r8 - 5._r8*z0q(n)/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) - end if - endif - endif - - ! Temperature profile applied at 2-m - - zldis(n) = 2.0_r8 + z0h(n) - zeta(n) = zldis(n)/obu(n) - if (zeta(n) < -zetat) then - temp12m(n) = vkc/(log(-zetat*obu(n)/z0h(n))& - - StabilityFunc2(-zetat) & - + StabilityFunc2(z0h(n)/obu(n)) & - + 0.8_r8*((zetat)**(-0.333_r8)-(-zeta(n))**(-0.333_r8))) - else if (zeta(n) < 0._r8) then - temp12m(n) = vkc/(log(zldis(n)/z0h(n)) & - - StabilityFunc2(zeta(n)) & - + StabilityFunc2(z0h(n)/obu(n))) - else if (zeta(n) <= 1._r8) then - temp12m(n) = vkc/(log(zldis(n)/z0h(n)) + 5._r8*zeta(n) - 5._r8*z0h(n)/obu(n)) - else - temp12m(n) = vkc/(log(obu(n)/z0h(n)) + 5._r8 - 5._r8*z0h(n)/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) - end if - - ! Humidity profile applied at 2-m - - if (z0q(n) == z0h(n)) then - temp22m(n) = temp12m(n) - else - zldis(n) = 2.0_r8 + z0q(n) - zeta(n) = zldis(n)/obu(n) - if (zeta(n) < -zetat) then - temp22m(n) = vkc/(log(-zetat*obu(n)/z0q(n)) - & - StabilityFunc2(-zetat) + StabilityFunc2(z0q(n)/obu(n)) & - + 0.8_r8*((zetat)**(-0.333_r8)-(-zeta(n))**(-0.333_r8))) - else if (zeta(n) < 0._r8) then - temp22m(n) = vkc/(log(zldis(n)/z0q(n)) - & - StabilityFunc2(zeta(n))+StabilityFunc2(z0q(n)/obu(n))) - else if (zeta(n) <= 1._r8) then - temp22m(n) = vkc/(log(zldis(n)/z0q(n)) + 5._r8*zeta(n)-5._r8*z0q(n)/obu(n)) - else - temp22m(n) = vkc/(log(obu(n)/z0q(n)) + 5._r8 - 5._r8*z0q(n)/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) - end if - end if - - ! diagnose 10-m wind for dust model (dstmbl.F) - ! Notes from C. Zender's dst.F: - ! According to Bon96 p. 62, the displacement height d (here displa) is - ! 0.0 <= d <= 0.34 m in dust source regions (i.e., regions w/o trees). - ! Therefore d <= 0.034*z1 and may safely be neglected. - ! Code from LSM routine SurfaceTemperature was used to obtain u10 - - if (present(landunit_index)) then - zldis(n) = forc_hgt_u_patch(pfti(n))-displa(n) - else - zldis(n) = forc_hgt_u_patch(n)-displa(n) - end if - zeta(n) = zldis(n)/obu(n) - if (min(zeta(n), 1._r8) < 0._r8) then - tmp1 = (1._r8 - 16._r8*min(zeta(n),1._r8))**0.25_r8 - tmp2 = log((1._r8+tmp1*tmp1)/2._r8) - tmp3 = log((1._r8+tmp1)/2._r8) - fmnew = 2._r8*tmp3 + tmp2 - 2._r8*atan(tmp1) + 1.5707963_r8 - else - fmnew = -5._r8*min(zeta(n),1._r8) - endif - if (iter == 1) then - fm(n) = fmnew - else - fm(n) = 0.5_r8 * (fm(n)+fmnew) - end if - zeta10 = min(10._r8/obu(n), 1._r8) - if (zeta(n) == 0._r8) zeta10 = 0._r8 - if (zeta10 < 0._r8) then - tmp1 = (1.0_r8 - 16.0_r8 * zeta10)**0.25_r8 - tmp2 = log((1.0_r8 + tmp1*tmp1)/2.0_r8) - tmp3 = log((1.0_r8 + tmp1)/2.0_r8) - fm10 = 2.0_r8*tmp3 + tmp2 - 2.0_r8*atan(tmp1) + 1.5707963_r8 - else ! not stable - fm10 = -5.0_r8 * zeta10 - end if - if (present(landunit_index)) then - tmp4 = log( max( 1.0_r8, forc_hgt_u_patch(pfti(n)) / 10._r8) ) - else - tmp4 = log( max( 1.0_r8, forc_hgt_u_patch(n) / 10._r8) ) - end if - if (present(landunit_index)) then - do pp = pfti(n),pftf(n) - u10(pp) = ur(n) - ustar(n)/vkc * (tmp4 - fm(n) + fm10) - fv(pp) = ustar(n) - end do - else - u10(n) = ur(n) - ustar(n)/vkc * (tmp4 - fm(n) + fm10) - fv(n) = ustar(n) - end if - - end do - - end associate - end subroutine FrictionVelocity - - !------------------------------------------------------------------------------ - real(r8) function StabilityFunc1(zeta) - ! - ! !DESCRIPTION: - ! Stability function for rib < 0. - ! - ! !USES: - use shr_const_mod, only: SHR_CONST_PI - ! - ! !ARGUMENTS: - implicit none - real(r8), intent(in) :: zeta ! dimensionless height used in Monin-Obukhov theory - ! - ! !LOCAL VARIABLES: - real(r8) :: chik, chik2 - !------------------------------------------------------------------------------ - - chik2 = sqrt(1._r8-16._r8*zeta) - chik = sqrt(chik2) - StabilityFunc1 = 2._r8*log((1._r8+chik)*0.5_r8) & - + log((1._r8+chik2)*0.5_r8)-2._r8*atan(chik)+SHR_CONST_PI*0.5_r8 - - end function StabilityFunc1 - - !------------------------------------------------------------------------------ - real(r8) function StabilityFunc2(zeta) - ! - ! !DESCRIPTION: - ! Stability function for rib < 0. - ! - ! !USES: - use shr_const_mod, only: SHR_CONST_PI - ! - ! !ARGUMENTS: - implicit none - real(r8), intent(in) :: zeta ! dimensionless height used in Monin-Obukhov theory - ! - ! !LOCAL VARIABLES: - real(r8) :: chik2 - !------------------------------------------------------------------------------ - - chik2 = sqrt(1._r8-16._r8*zeta) - StabilityFunc2 = 2._r8*log((1._r8+chik2)*0.5_r8) - - end function StabilityFunc2 - - !----------------------------------------------------------------------- - subroutine MoninObukIni (ur, thv, dthv, zldis, z0m, um, obu) - ! - ! !DESCRIPTION: - ! Initialization of the Monin-Obukhov length. - ! The scheme is based on the work of Zeng et al. (1998): - ! Intercomparison of bulk aerodynamic algorithms for the computation - ! of sea surface fluxes using TOGA CORE and TAO data. J. Climate, - ! Vol. 11, 2628-2644. - ! - ! !USES: - use clm_varcon, only : grav - ! - ! !ARGUMENTS: - implicit none - real(r8), intent(in) :: ur ! wind speed at reference height [m/s] - real(r8), intent(in) :: thv ! virtual potential temperature (kelvin) - real(r8), intent(in) :: dthv ! diff of vir. poten. temp. between ref. height and surface - real(r8), intent(in) :: zldis ! reference height "minus" zero displacement heght [m] - real(r8), intent(in) :: z0m ! roughness length, momentum [m] - real(r8), intent(out) :: um ! wind speed including the stability effect [m/s] - real(r8), intent(out) :: obu ! monin-obukhov length (m) - ! - ! !LOCAL VARIABLES: - real(r8) :: wc ! convective velocity [m/s] - real(r8) :: rib ! bulk Richardson number - real(r8) :: zeta ! dimensionless height used in Monin-Obukhov theory - real(r8) :: ustar ! friction velocity [m/s] - !----------------------------------------------------------------------- - - ! Initial values of u* and convective velocity - - ustar=0.06_r8 - wc=0.5_r8 - if (dthv >= 0._r8) then - um=max(ur,0.1_r8) - else - um=sqrt(ur*ur+wc*wc) - endif - - rib=grav*zldis*dthv/(thv*um*um) - - if (rib >= 0._r8) then ! neutral or stable - zeta = rib*log(zldis/z0m)/(1._r8-5._r8*min(rib,0.19_r8)) - zeta = min(frictionvel_parms_inst%zetamaxstable,max(zeta,0.01_r8 )) - else ! unstable - zeta=rib*log(zldis/z0m) - zeta = max(-100._r8,min(zeta,-0.01_r8 )) - endif - - obu=zldis/zeta - - end subroutine MoninObukIni - -end module FrictionVelocityMod diff --git a/src/biogeophys/GlacierSurfaceMassBalanceMod.F90 b/src/biogeophys/GlacierSurfaceMassBalanceMod.F90 deleted file mode 100644 index adaa6ceec4..0000000000 --- a/src/biogeophys/GlacierSurfaceMassBalanceMod.F90 +++ /dev/null @@ -1,452 +0,0 @@ -module GlacierSurfaceMassBalanceMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Computes fluxes that are specific to glaciers - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use clm_varcon , only : spval, secspday - use clm_varpar , only : nlevgrnd - use clm_varctl , only : glc_snow_persistence_max_days - use clm_time_manager, only : get_step_size - use landunit_varcon, only : istice_mec - use ColumnType , only : col - use LandunitType , only : lun - use glc2lndMod , only : glc2lnd_type - use WaterstateType , only : waterstate_type - use WaterfluxType , only : waterflux_type - - ! !PUBLIC TYPES: - implicit none - private - save - - type, public :: glacier_smb_type - private - - ! ------------------------------------------------------------------------ - ! Public data - ! ------------------------------------------------------------------------ - - real(r8), pointer, public :: qflx_glcice_col(:) ! col net flux of new glacial ice (growth - melt) (mm H2O/s), passed to GLC; only valid inside the do_smb_c filter - real(r8), pointer, public :: qflx_glcice_dyn_water_flux_col(:) ! col water flux needed for balance check due to glc_dyn_runoff_routing (mm H2O/s) (positive means addition of water to the system); valid for all columns - - ! ------------------------------------------------------------------------ - ! Private data - ! ------------------------------------------------------------------------ - - real(r8), pointer :: qflx_glcice_frz_col (:) ! col ice growth (positive definite) (mm H2O/s); only valid inside the do_smb_c filter - real(r8), pointer :: qflx_glcice_melt_col(:) ! col ice melt (positive definite) (mm H2O/s); only valid inside the do_smb_c filter - - contains - - ! ------------------------------------------------------------------------ - ! Public routines - ! ------------------------------------------------------------------------ - - procedure, public :: Init - - ! The science routines need to be separated into a few pieces so they can be - ! sequenced properly based on what variables they depend on, and what they affect - procedure, public :: HandleIceMelt ! compute ice melt in glacier columns, and convert liquid back to ice - procedure, public :: ComputeSurfaceMassBalance ! compute fluxes other than ice melt - procedure, public :: AdjustRunoffTerms ! adjust liquid and ice runoff fluxes due to glacier fluxes - - ! ------------------------------------------------------------------------ - ! Private routines - ! ------------------------------------------------------------------------ - - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - end type glacier_smb_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ======================================================================== - ! Infrastructure routines - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine Init(this, bounds) - class(glacier_smb_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - !----------------------------------------------------------------------- - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - class(glacier_smb_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - - integer :: begc, endc - !----------------------------------------------------------------------- - - begc = bounds%begc; endc = bounds%endc - - allocate(this%qflx_glcice_col (begc:endc)) ; this%qflx_glcice_col (:) = nan - allocate(this%qflx_glcice_dyn_water_flux_col(begc:endc)) ; this%qflx_glcice_dyn_water_flux_col (:) = nan - allocate(this%qflx_glcice_frz_col (begc:endc)) ; this%qflx_glcice_frz_col (:) = nan - allocate(this%qflx_glcice_melt_col (begc:endc)) ; this%qflx_glcice_melt_col (:) = nan - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !USES: - use histFileMod , only : hist_addfld1d - ! - ! !ARGUMENTS: - class(glacier_smb_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - !----------------------------------------------------------------------- - - begc = bounds%begc; endc = bounds%endc - - this%qflx_glcice_col(begc:endc) = spval - call hist_addfld1d (fname='QICE', units='mm/s', & - avgflag='A', long_name='ice growth/melt', & - ptr_col=this%qflx_glcice_col, l2g_scale_type='ice', default='inactive') - - this%qflx_glcice_frz_col(begc:endc) = spval - call hist_addfld1d (fname='QICE_FRZ', units='mm/s', & - avgflag='A', long_name='ice growth', & - ptr_col=this%qflx_glcice_frz_col, l2g_scale_type='ice', default='inactive') - - this%qflx_glcice_melt_col(begc:endc) = spval - call hist_addfld1d (fname='QICE_MELT', units='mm/s', & - avgflag='A', long_name='ice melt', & - ptr_col=this%qflx_glcice_melt_col, l2g_scale_type='ice', default='inactive') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - class(glacier_smb_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - - integer :: c - !----------------------------------------------------------------------- - - ! Initialize qflx_glcice_dyn_water_flux_col to 0 for all columns because we want this - ! flux to remain 0 for columns where is is never set, including non-glacier columns. - ! - ! Other fluxes intentionally remain unset (spval) outside the do_smb filter, so that - ! they are flagged as missing value outside that filter. - do c = bounds%begc, bounds%endc - this%qflx_glcice_dyn_water_flux_col(c) = 0._r8 - end do - - end subroutine InitCold - - ! ======================================================================== - ! Science routines - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine HandleIceMelt(this, bounds, num_do_smb_c, filter_do_smb_c, & - waterstate_inst) - ! - ! !DESCRIPTION: - ! Compute ice melt in glacier columns, and convert liquid back to ice - ! - ! Ideally this should be called immediately after ice is melted, so that liquid is - ! converted back to ice as soon as possible. - ! - ! NOTE(wjs, 2016-06-29) Currently this is separated from the main ComputeSurfaceMassBalance - ! routine so that it can be called from the same place in the driver loop where it was - ! done before the introduction of GlacierSurfaceMassBalanceMod. This was needed to maintain - ! identical answers, due to the adjustment of h2osoi_ice and h2osoi_liq in this - ! routine. In principle we should be able to do these adjustments of h2osoi_ice and - ! h2osoi_liq later in the driver loop: this would just mean that some intervening - ! science code is operating on the temporarily-thawed state, before the water runs off - ! and is replaced by ice from below. The main reason to make this change would be to - ! simplify the driver logic, consolidating calls to this module. On the other hand, - ! having a period when there is liquid water at the top of the glacier column could - ! defeat some of the purpose of converting it immediately back to ice (i.e., so that - ! the surface fluxes are always generated based on an ice-covered surface) - so it - ! may be best to keep this separate. - ! - ! !ARGUMENTS: - class(glacier_smb_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - integer, intent(in) :: num_do_smb_c ! number of column points in filter_do_smb_c - integer, intent(in) :: filter_do_smb_c(:) ! column filter for points where SMB is calculated - type(waterstate_type), intent(inout) :: waterstate_inst - ! - ! !LOCAL VARIABLES: - integer :: j - integer :: fc, c, l - real(r8) :: dtime ! land model time step (sec) - - character(len=*), parameter :: subname = 'HandleIceMelt' - !----------------------------------------------------------------------- - - associate( & - qflx_glcice_melt => this%qflx_glcice_melt_col , & ! Output: [real(r8) (:) ] ice melt (positive definite) (mm H2O/s) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) - ) - - dtime = get_step_size() - - do fc = 1, num_do_smb_c - c = filter_do_smb_c(fc) - qflx_glcice_melt(c) = 0._r8 - end do - - ! Note that, because the following code only operates over the do_smb filter, that - ! means that the conversion of water back to ice only happens for glacier columns - ! where we're computing SMB. - - do j = 1, nlevgrnd - do fc = 1, num_do_smb_c - c = filter_do_smb_c(fc) - l = col%landunit(c) - - if (lun%itype(l) == istice_mec) then - if (h2osoi_liq(c,j) > 0._r8) then ! ice layer with meltwater - qflx_glcice_melt(c) = qflx_glcice_melt(c) + h2osoi_liq(c,j)/dtime - - ! convert layer back to pure ice by "borrowing" ice from below the column - h2osoi_ice(c,j) = h2osoi_ice(c,j) + h2osoi_liq(c,j) - h2osoi_liq(c,j) = 0._r8 - end if ! liquid water is present - end if ! istice_mec - end do - end do - - end associate - - end subroutine HandleIceMelt - - !----------------------------------------------------------------------- - subroutine ComputeSurfaceMassBalance(this, bounds, num_allc, filter_allc, & - num_do_smb_c, filter_do_smb_c, glc2lnd_inst, waterstate_inst, waterflux_inst) - ! - ! !DESCRIPTION: - ! Compute glacier fluxes other than ice melt. - ! - ! This sets the public fields qflx_glcice_col and qflx_glcice_dyn_water_flux_col to - ! their final values. - ! - ! Should be called after HandleIceMelt, and after waterflux_inst%qflx_snwcp_ice_col is - ! computed - ! - ! !ARGUMENTS: - class(glacier_smb_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - integer, intent(in) :: num_allc ! number of column points in filter_allc - integer, intent(in) :: filter_allc(:) ! column filter for all points - integer, intent(in) :: num_do_smb_c ! number of column points in filter_do_smb_c - integer, intent(in) :: filter_do_smb_c(:) ! column filter for points where SMB is calculated - type(glc2lnd_type), intent(in) :: glc2lnd_inst - type(waterstate_type), intent(in) :: waterstate_inst - type(waterflux_type), intent(in) :: waterflux_inst - ! - ! !LOCAL VARIABLES: - integer :: fc, c, l, g - - character(len=*), parameter :: subname = 'ComputeSurfaceMassBalance' - !----------------------------------------------------------------------- - - associate( & - qflx_glcice => this%qflx_glcice_col , & ! Output: [real(r8) (:)] net flux of new glacial ice (growth - melt) (mm H2O/s) - qflx_glcice_frz => this%qflx_glcice_frz_col , & ! Output: [real(r8) (:)] ice growth (positive definite) (mm H2O/s) - qflx_glcice_dyn_water_flux => this%qflx_glcice_dyn_water_flux_col , & ! Output: [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) - qflx_glcice_melt => this%qflx_glcice_melt_col , & ! Input: [real(r8) (:)] ice melt (positive definite) (mm H2O/s) - glc_dyn_runoff_routing => glc2lnd_inst%glc_dyn_runoff_routing_grc , & ! Input: [real(r8) (:)] whether we're doing runoff routing appropriate for having a dynamic icesheet - snow_persistence => waterstate_inst%snow_persistence_col , & ! Input: [real(r8) (:)] counter for length of time snow-covered - qflx_snwcp_ice => waterflux_inst%qflx_snwcp_ice_col & ! Input: [real(r8) (:)] excess solid h2o due to snow capping (outgoing) (mm H2O /s) [+] - ) - - ! NOTE(wjs, 2016-06-29) The following initialization is done in case the columns - ! included / excluded in the do_smb_c filter can change mid-run (besides just being - ! active vs. inactive): If an active column was inside this filter in the previous - ! timestep, but is no longer inside this filter in this timestep, we want this flux to - ! be 0 (rather than remaining at its previous value). (Currently, the set of active - ! columns included in the do_smb filter cannot change mid-run, but the logic is - ! complex enough that I don't want to assume that that will always remain true.) This - ! initialization also handles the case where glc_dyn_runoff_routing may change - ! mid-run, so that a point previously inside that mask no longer is. - do fc = 1, num_allc - c = filter_allc(fc) - qflx_glcice_dyn_water_flux(c) = 0._r8 - end do - - - ! Calculate positive surface mass balance to ice sheets, both from already-glaciated - ! landunits and from non-glaciated landunits (glacial inception) - do fc = 1, num_do_smb_c - c = filter_do_smb_c(fc) - l = col%landunit(c) - g = col%gridcell(c) - ! In the following, we convert glc_snow_persistence_max_days to r8 to avoid overflow - if ( (snow_persistence(c) >= (real(glc_snow_persistence_max_days, r8) * secspday)) & - .or. lun%itype(l) == istice_mec) then - qflx_glcice_frz(c) = qflx_snwcp_ice(c) - else - qflx_glcice_frz(c) = 0._r8 - end if - - qflx_glcice(c) = qflx_glcice_frz(c) - qflx_glcice_melt(c) - - ! For glc_dyn_runoff_routing > 0:: - ! (1) All or part of the excess snow (from snow capping) has been incorporated in - ! qflx_glcice_frz. This flux must be included here to complete the water - ! balance, because it is a sink of water as far as CLM is concerned (this water - ! will now be owned by CISM). - ! (2) Meltwater from ice (qflx_glcice_melt) is allowed to run off and is included - ! in qflx_qrgwl, but the water content of the ice column has not changed - ! because an equivalent ice mass has been "borrowed" from the base of the - ! column. So this borrowing is a source of water as far as CLM is concerned. - ! - ! For glc_dyn_runoff_routing = 0: Point (2) is the same as for the - ! glc_dyn_runoff_routing > 0 case: there is a source of water equal to - ! qflx_glcice_melt. However, in this case, the sink of water is also equal to - ! qflx_glcice_melt: We have simply replaced some liquid water with an equal amount - ! of solid ice. Another way to think about this is: - ! (1) qflx_ice_runoff_snwcp is reduced by an amount equal to qflx_glcice_melt (done - ! elsewhere in this module). The amount of snow removal is therefore given by - ! (qflx_ice_runoff_snwcp + qflx_glcice_melt), meaning that there is an - ! additional sink of water equal to qflx_glcice_melt. - ! (2) Meltwater from ice (qflx_glcice_melt) is allowed to run off and is included - ! in qflx_qrgwl, but the water content of the ice column has not changed - ! because an equivalent ice mass has been "borrowed" from the base of the - ! column. So this borrowing is a source of water as far as CLM is concerned. - ! These two corrections cancel out, so nothing is done here. - qflx_glcice_dyn_water_flux(c) = glc_dyn_runoff_routing(g) * (qflx_glcice_melt(c) - qflx_glcice_frz(c)) - end do - - end associate - - end subroutine ComputeSurfaceMassBalance - - !----------------------------------------------------------------------- - subroutine AdjustRunoffTerms(this, bounds, num_do_smb_c, filter_do_smb_c, & - glc2lnd_inst, qflx_qrgwl, qflx_ice_runoff_snwcp) - ! - ! !DESCRIPTION: - ! Adjust liquid and ice runoff fluxes due to glacier fluxes - ! - ! Should be called after ComputeSurfaceMassBalance, and after qflx_qrgwl and - ! qflx_ice_runoff_snwcp have been given their initial values - ! - ! !USES: - ! - ! !ARGUMENTS: - class(glacier_smb_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - integer, intent(in) :: num_do_smb_c ! number of column points in filter_do_smb_c - integer, intent(in) :: filter_do_smb_c(:) ! column filter for points where SMB is calculated - type(glc2lnd_type), intent(in) :: glc2lnd_inst - real(r8), intent(inout) :: qflx_qrgwl( bounds%begc: ) ! col qflx_surf at glaciers, wetlands, lakes - real(r8), intent(inout) :: qflx_ice_runoff_snwcp( bounds%begc: ) ! col solid runoff from snow capping (mm H2O /s) - ! - ! !LOCAL VARIABLES: - integer :: fc, c, g - - character(len=*), parameter :: subname = 'AdjustRunoffTerms' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(qflx_qrgwl) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(qflx_ice_runoff_snwcp) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - qflx_glcice_frz => this%qflx_glcice_frz_col , & ! Input: [real(r8) (:)] ice growth (positive definite) (mm H2O/s) - qflx_glcice_melt => this%qflx_glcice_melt_col , & ! Input: [real(r8) (:)] ice melt (positive definite) (mm H2O/s) - glc_dyn_runoff_routing => glc2lnd_inst%glc_dyn_runoff_routing_grc & ! Input: [real(r8) (:)] gridcell fraction coupled to dynamic ice sheet - ) - - ! Note that, because the following code only operates over the do_smb filter, that - ! means that the adjustments here are only applied for glacier columns where we're - ! computing SMB. This is consistent with the use of the do_smb filter in - ! HandleIceMelt. - - do fc = 1, num_do_smb_c - c = filter_do_smb_c(fc) - g = col%gridcell(c) - - ! Melt is only generated for glacier columns. But it doesn't hurt to do this for - ! all columns in the do_smb filter: this melt term will be 0 for other columns. - ! Note: Ice melt is added to the runoff whether or not the column is coupled - ! to a dynamic glacier model. - - qflx_qrgwl(c) = qflx_qrgwl(c) + qflx_glcice_melt(c) - - ! For the part of the column that is coupled to a dynamic glacier model, - ! the glacier model handles the fate of capped snow, so we do not want it sent to runoff. - qflx_ice_runoff_snwcp(c) = qflx_ice_runoff_snwcp(c) - glc_dyn_runoff_routing(g)*qflx_glcice_frz(c) - - ! In places where we are not coupled to a dynamic glacier model, CLM sends all of - ! the snow capping to the ocean as an ice runoff term. (This is essentially a crude - ! parameterization of calving, assuming steady state - i.e., all ice gain is - ! balanced by an ice loss.) But each unit of melt that happens is an indication - ! that 1 unit of the ice shouldn't have made it to the ocean - but instead melted - ! before it got there. So we need to correct for that by removing 1 unit of ice - ! runoff for each unit of melt. Note that, for a given point in space & time, this - ! can result in negative ice runoff. However, we expect that, in a temporally and - ! spatially-integrated sense (if we're near equilibrium), this will just serve to - ! decrease the too-high positive ice runoff. - ! - ! Another way to think about this is: ice melt removes mass; the snow capping flux - ! also removes mass. If both the accumulation and melt remove mass, there is a - ! double-counting. So we need to correct that by: for each unit of ice melt - ! (resulting in 1 unit of liquid runoff), remove 1 unit of ice runoff. (This is not - ! an issue for parts of the column coupled to the dynamic glacier model, because - ! then the snow capping mass is retained in the LND-GLC coupled system.) - ! - ! The alternative of simply not adding ice melt to the runoff stream where - ! glc_dyn_runoff_routing = 0 conserves mass, but fails to conserve energy, for a - ! similar reason: Ice melt in CLM removes energy; also, the ocean's melting of the - ! snow capping flux removes energy. If both the accumulation and melting remove - ! energy, there is a double-counting. - ! - ! Yet another way to think about this is: When ice melted, we let the liquid run - ! off, and replaced it with new ice from below. But that new ice needed to come - ! from somewhere to keep the system in water balance. We "request" the new ice from - ! the ocean by generating a negataive ice runoff equivalent to the amount we have - ! melted (i.e., equivalent to the amount of new ice that we created from below). - - ! As above: Melt is only generated for glacier columns. But it doesn't hurt to do - ! this for all columns in the do_smb filter: this melt term will be 0 for other - ! columns. - - qflx_ice_runoff_snwcp(c) = qflx_ice_runoff_snwcp(c) - (1.0_r8 - glc_dyn_runoff_routing(g)) * qflx_glcice_melt(c) - - ! Recall that glc_dyn_runoff_routing = min(lfrac, Sg_icemask_coupled_fluxes_l) / lfrac. - ! - ! Consider a cell with lfrac = 0.8 and Sg_icemask_coupled_fluxes_l = 0.4. (For - ! instance, the cell might have half its land coverage in Greenland and the other - ! half in Ellemere.) Given qflx_ice_runoff_snwcp(c) = 1 m/yr, half the flux (0.5 - ! m/yr) will be sent to the runoff model, where it will be multiplied by lfrac to - ! give a net flux of 0.4 m/yr times the cell area. - ! - ! The full SMB of 1 m/yr will be sent to the coupler's prep_glc_mod, but it will be - ! weighted by 0.4 when integrating over the whole ice sheet. So a net flux of 0.4 - ! m/yr will also be applied to the ice sheet model. The total flux of 0.8 m/yr, - ! split evenly between runoff and ice sheet, is what we want. - - end do - - end associate - - end subroutine AdjustRunoffTerms - -end module GlacierSurfaceMassBalanceMod diff --git a/src/biogeophys/LakeCon.F90 b/src/biogeophys/LakeCon.F90 deleted file mode 100644 index a42a3d0137..0000000000 --- a/src/biogeophys/LakeCon.F90 +++ /dev/null @@ -1,178 +0,0 @@ -module LakeCon - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing constants and parameters for the Lake code - ! (CLM4-LISSS, documented in Subin et al. 2011, JAMES) - ! Also contains time constant variables for Lake code - ! Created by Zack Subin, 2011 - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use clm_varctl , only : iulog - use spmdMod , only : masterproc - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: LakeConInit - !----------------------------------------------------------------------- - - !------------------------------------------------------------------ - ! Lake Model non-tuneable constants - !------------------------------------------------------------------ - - ! temperature of maximum water density (K) - ! This is from Hostetler and Bartlein (1990); more updated sources suggest 277.13 K. - real(r8), parameter :: tdmax = 277._r8 - - !------------------------------------------------------------------ - ! Lake Model tuneable constants - !------------------------------------------------------------------ - - ! lake emissivity. This is used for both frozen and unfrozen lakes. - ! This is pulled in from CLM4 and the reference is unclear. - real(r8), parameter :: emg_lake = 0.97_r8 - - ! The fraction of the visible (e.g. vis not nir from atm) sunlight - ! absorbed in ~1 m of water (the surface layer za_lake). - ! This is roughly the fraction over 700 nm but may depend on the details - ! of atmospheric radiative transfer. As long as NIR = 700 nm and up, this can be zero. - real(r8) :: betavis = 0.0_r8 - - ! Momentum Roughness length over frozen lakes without snow (m) - ! Typical value found in the literature, and consistent with Mironov expressions. - ! See e.g. Morris EM 1989, Andreas EL 1987, Guest & Davidson 1991 (as cited in Vavrus 1996) - real(r8), parameter :: z0frzlake = 0.001_r8 - - ! Base of surface light absorption layer for lakes (m) - real(r8), parameter :: za_lake = 0.6_r8 - - ! For calculating prognostic roughness length - real(r8), parameter :: cur0 = 0.01_r8 ! min. Charnock parameter - real(r8), parameter :: cus = 0.1_r8 ! empirical constant for roughness under smooth flow - real(r8), parameter :: curm = 0.1_r8 ! maximum Charnock parameter - - ! The following will be set in initLake based on namelists. !TODO - fix this commend - real(r8) :: fcrit ! critical dimensionless fetch for Charnock parameter. - real(r8) :: minz0lake ! (m) Minimum allowed roughness length for unfrozen lakes. - - ! For calculating enhanced diffusivity - real(r8), parameter :: n2min = 7.5e-5_r8 ! (s^-2) (yields diffusivity about 6 times km) ! Fang & Stefan 1996 - - ! Note, this will be adjusted in initLake if the timestep is not 1800 s. - ! Lake top numerics can oscillate with 0.01m top layer and 1800 s timestep. - ! The problem is that the surface flux is fixed during the calculation of the top - ! layer temperature in the diffusion and not corrected for the tendency of the top layer. - ! This thickness will be added to all minimum and maximum snow layer thicknesses compared to that used over non-lakes. - ! Analysis of the CFL condition suggests that the minimum snow layer thickness for 1800 s needs - ! to be at least ~1.2 cm for the bulk snow values of conductivity and heat capacity - ! and as much as 2.3 cm for pure ice. - ! Alternatively, a check could be done in LakeTemperature in case - ! t_grnd(c) - t_soisno(c,snl(c)+1) changed sign after the Crank-Nicholson step. - ! Such an approach, while perhaps allowing additional snow layer resolution, has not been tested. - ! The approach used over non-lakes is to have a first-order surface flux correction. - ! We choose not to do that here because t_grnd can vary independently of the top model - ! layer temperature, while it is fixed to the top layer temperature if tbot > tfrz and - ! the lake is frozen, or if there is an unstable density gradient in the top unfrozen lake layer. - real(r8) :: lsadz = 0.03_r8 ! m - - !! The following will be set in initLake based on namelists. - real(r8) :: pudz ! (m) Optional minimum total ice thickness required to allow lake puddling. - ! Currently used for sensitivity tests only. - real(r8) :: depthcrit ! (m) Depth beneath which to increase mixing. See discussion in Subin et al. 2011 - real(r8) :: mixfact ! Mixing increase factor. - - !!!!!!!!!!! - ! Namelists (some of these have not been extensively tested and are hardwired to default values currently). - !!!!!!!!!!! - - ! used in LakeFluxes - ! true => use old fcrit & minz0 as per Subin et al 2011 form - ! See initLakeMod for details. Difference is very small for - ! small lakes and negligible for large lakes. Currently hardwired off. - logical, public :: lake_use_old_fcrit_minz0 = .false. - - ! used in LakeTemperature - ! Increase mixing by a large factor for deep lakes - ! Crude but enhanced performance at all 4 deep lakes tested. - ! See Subin et al 2011 (JAMES) for details - - ! (m) minimum lake depth to invoke deepmixing - real(r8), public :: deepmixing_depthcrit = 25._r8 - - ! factor to increase mixing by - real(r8), public :: deepmixing_mixfact = 10._r8 - - ! true => Suppress enhanced diffusion. Small differences. - ! Currently hardwired .false. - ! See Subin et al 2011 for details. - ! Enhanced diffusion is intended for under ice and at large depths. - ! It is a much smaller change on its own than the "deepmixing" - ! above, but it increases the effect of deepmixing under ice and for large depths. - logical, public :: lake_no_ed = .false. - - ! puddling (not extensively tested and currently hardwired off) - ! used in LakeTemperature and SurfaceAlbedo - - ! true => suppress convection when greater than minimum amount - ! of ice is present. This also effectively sets lake_no_melt_icealb. - logical, public :: lakepuddling = .false. - - ! (m) minimum amount of total ice nominal thickness before - ! convection is suppressed - real(r8), public :: lake_puddle_thick = 0.2_r8 - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine LakeConInit() - ! - ! !DESCRIPTION: - ! Initialize time invariant variables for S Lake code - !------------------------------------------------------------------------ - - if (masterproc) write (iulog,*) 'Attempting to initialize time invariant variables for lakes' - - ! Set LakeCon constants according to namelist fields - if (lake_use_old_fcrit_minz0) then - ! critical dimensionless fetch for Charnock parameter. From Vickers & Mahrt 1997 - ! but converted to use u instead of u* (Form used in Subin et al. 2011) - fcrit = 22._r8 - - ! (m) Minimum allowed roughness length for unfrozen lakes. - ! (Used in Subin et al. 2011) - minz0lake = 1.e-5_r8 - else - ! Vickers & Mahrt 1997 - fcrit = 100._r8 - - ! (m) Minimum allowed roughness length for unfrozen lakes. - ! Now set low so it is only to avoid floating point exceptions. - minz0lake = 1.e-10_r8 - end if - - if (lakepuddling) then - ! (m) Minimum total ice thickness required to allow lake puddling. Default is 0.2m. - ! This option has not been extensively tested. - ! This option turns on lake_no_melt_icealb, as the decrease in albedo will be based - ! on whether there is water over nice, not purely a function of ice top temperature. - pudz = lake_puddle_thick - end if - - ! (m) Depth beneath which to increase mixing. See discussion in Subin et al. 2011 - depthcrit = deepmixing_depthcrit - - ! Mixing increase factor. ! Defaults are 25 m, increase by 10. - ! Note some other namelists will be used directly in lake physics during model integration. - mixfact = deepmixing_mixfact - - if (masterproc) write (iulog,*) 'Successfully initialized time invariant variables for lakes' - - end subroutine LakeConInit - -end module LakeCon diff --git a/src/biogeophys/LakeStateType.F90 b/src/biogeophys/LakeStateType.F90 deleted file mode 100644 index f440a81957..0000000000 --- a/src/biogeophys/LakeStateType.F90 +++ /dev/null @@ -1,296 +0,0 @@ -module LakeStateType - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Lake data types and associated procesures - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varcon , only : spval, grlnd - use decompMod , only : bounds_type - use spmdMod , only : masterproc - use abortUtils , only : endrun - use LandunitType , only : lun - use ColumnType , only : col - ! - implicit none - save - private - ! - ! !PUBLIC TYPES: - type, public :: lakestate_type - ! Time constant variables - real(r8), pointer :: lakefetch_col (:) ! col lake fetch from surface data (m) - real(r8), pointer :: etal_col (:) ! col lake extinction coefficient from surface data (1/m) - - ! Time varying variables - real(r8), pointer :: lake_raw_col (:) ! col aerodynamic resistance for moisture (s/m) - real(r8), pointer :: ks_col (:) ! col coefficient for calculation of decay of eddy diffusivity with depth - real(r8), pointer :: ws_col (:) ! col surface friction velocity (m/s) - real(r8), pointer :: ust_lake_col (:) ! col friction velocity (m/s) - real(r8), pointer :: betaprime_col (:) ! col effective beta: sabg_lyr(p,jtop) for snow layers, beta otherwise - real(r8), pointer :: savedtke1_col (:) ! col top level eddy conductivity from previous timestep (W/mK) - real(r8), pointer :: lake_icefrac_col (:,:) ! col mass fraction of lake layer that is frozen - real(r8), pointer :: lake_icefracsurf_col(:) ! col mass fraction of surface lake layer that is frozen - real(r8), pointer :: lake_icethick_col (:) ! col ice thickness (m) (integrated if lakepuddling) - real(r8), pointer :: lakeresist_col (:) ! col [s/m] (Needed for calc. of grnd_ch4_cond) - real(r8), pointer :: ram1_lake_patch (:) ! patch aerodynamical resistance (s/m) - - contains - - procedure, public :: Init - procedure, public :: Restart - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - end type lakestate_type - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(lakestate_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate ( bounds ) - call this%InitHistory ( bounds ) - call this%InitCold ( bounds ) - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Allocate module variables and data structures - ! - ! !USES: - use shr_infnan_mod, only: nan => shr_infnan_nan, assignment(=) - use clm_varpar , only: nlevlak, nlevsno - ! - ! !ARGUMENTS: - class(lakestate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - !--------------------------------------------------------------------- - - ! Initialize savedtke1 to spval so that c->g averaging will be done correctly - ! TODO: can this be now be set to nan??? - ! Initialize ust_lake to spval to detect input from restart file if not arbinit - ! TODO: can this be removed now??? - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc = bounds%endc - - allocate(this%etal_col (begc:endc)) ; this%etal_col (:) = nan - allocate(this%lakefetch_col (begc:endc)) ; this%lakefetch_col (:) = nan - allocate(this%lakeresist_col (begc:endc)) ; this%lakeresist_col (:) = nan - allocate(this%savedtke1_col (begc:endc)) ; this%savedtke1_col (:) = spval - allocate(this%lake_icefrac_col (begc:endc,1:nlevlak)) ; this%lake_icefrac_col (:,:) = nan - allocate(this%lake_icefracsurf_col (begc:endc)) ; this%lake_icefracsurf_col (:) = nan - allocate(this%lake_icethick_col (begc:endc)) ; this%lake_icethick_col (:) = nan - allocate(this%ust_lake_col (begc:endc)) ; this%ust_lake_col (:) = spval - allocate(this%ram1_lake_patch (begp:endp)) ; this%ram1_lake_patch (:) = nan - allocate(this%lake_raw_col (begc:endc)) ; this%lake_raw_col (:) = nan - allocate(this%ks_col (begc:endc)) ; this%ks_col (:) = nan - allocate(this%ws_col (begc:endc)) ; this%ws_col (:) = nan - allocate(this%betaprime_col (begc:endc)) ; this%betaprime_col (:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! History fields initialization - ! - ! !USES: - use shr_infnan_mod, only: nan => shr_infnan_nan, assignment(=) - use histFileMod , only: hist_addfld1d, hist_addfld2d - ! - ! !ARGUMENTS: - class(lakestate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - !--------------------------------------------------------------------- - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - this%lake_icefrac_col(begc:endc,:) = spval - call hist_addfld2d (fname='LAKEICEFRAC', units='unitless', type2d='levlak', & - avgflag='A', long_name='lake layer ice mass fraction', & - ptr_col=this%lake_icefrac_col, default='inactive') - - this%lake_icefracsurf_col(begc:endc) = spval - call hist_addfld1d (fname='LAKEICEFRAC_SURF', units='unitless', & - avgflag='A', long_name='surface lake layer ice mass fraction', & - ptr_col=this%lake_icefracsurf_col, set_nolake=spval, default='inactive') - - this%lake_icethick_col(begc:endc) = spval ! This will be more useful than LAKEICEFRAC for many users. - call hist_addfld1d (fname='LAKEICETHICK', units='m', & - avgflag='A', long_name='thickness of lake ice (including physical expansion on freezing)', & - ptr_col=this%lake_icethick_col, set_nolake=spval, default='inactive') - - this%savedtke1_col(begc:endc) = spval - call hist_addfld1d (fname='TKE1', units='W/(mK)', & - avgflag='A', long_name='top lake level eddy thermal conductivity', & - ptr_col=this%savedtke1_col, default='inactive') - - this%ram1_lake_patch(begp:endp) = spval - call hist_addfld1d (fname='RAM_LAKE', units='s/m', & - avgflag='A', long_name='aerodynamic resistance for momentum (lakes only)', & - ptr_patch=this%ram1_lake_patch, set_nolake=spval, default='inactive') - - this%ust_lake_col(begc:endc) = spval - call hist_addfld1d (fname='UST_LAKE', units='m/s', & - avgflag='A', long_name='friction velocity (lakes only)', & - ptr_col=this%ust_lake_col, set_nolake=spval, default='inactive') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize time constant and time varying module variables - ! - ! !USES: - use clm_varctl , only : fsurdat - use clm_varctl , only : iulog - use clm_varpar , only : nlevlak - use clm_varcon , only : tkwat - use fileutils , only : getfil - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_double, ncd_int, ncd_inqvdlen - use ncdio_pio , only : ncd_pio_openfile, ncd_inqfdims, ncd_pio_closefile, ncd_inqdid, ncd_inqdlen - ! - ! !ARGUMENTS: - class(lakestate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: c,g,i,j,l,lev - logical :: readvar - type(file_desc_t) :: ncid ! netcdf id - character(len=256) :: locfn ! local filename - real(r8) :: depthratio ! ratio of lake depth to standard deep lake depth - real(r8) ,pointer :: lakefetch_in (:) ! read in - lakefetch - real(r8) ,pointer :: etal_in (:) ! read in - etal - !----------------------------------------------------------------------- - - !------------------------------------------------- - ! Initialize time constant variables - !------------------------------------------------- - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - - ! Read lake eta - allocate(etal_in(bounds%begg:bounds%endg)) - call ncd_io(ncid=ncid, varname='ETALAKE', flag='read', data=etal_in, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - if (masterproc) then - write(iulog,*) 'WARNING:: ETALAKE not found on surface data set. All lake columns will have eta', & - ' set equal to default value as a function of depth.' - end if - etal_in(:) = -1._r8 - end if - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - this%etal_col(c) = etal_in(g) - end do - deallocate(etal_in) - - ! Read lake fetch - allocate(lakefetch_in(bounds%begg:bounds%endg)) - call ncd_io(ncid=ncid, varname='LAKEFETCH', flag='read', data=lakefetch_in, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - if (masterproc) then - write(iulog,*) 'WARNING:: LAKEFETCH not found on surface data set. All lake columns will have fetch', & - ' set equal to default value as a function of depth.' - end if - lakefetch_in(:) = -1._r8 - end if - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - this%lakefetch_col(c) = lakefetch_in(g) - end do - deallocate(lakefetch_in) - - call ncd_pio_closefile(ncid) - - !------------------------------------------------- - ! Initialize time varying variables - !------------------------------------------------- - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%lakpoi(l)) then - - ! Set lake ice fraction and top eddy conductivity from previous timestep - ! Always initialize with no ice to prevent excessive ice sheets from forming when - ! starting with old lake model that has unrealistically cold lake conseratures. - ! Keep lake temperature as is, and the energy deficit below freezing (which is no smaller - ! than it would have been with prognostic ice, as the temperature would then have been higher - ! and more heat would have flowed out of the lake) will be converted to ice in the first timestep. - this%lake_icefrac_col(c,1:nlevlak) = 0._r8 - - ! Set lake top eddy conductivity from previous timestep - this%savedtke1_col(c) = tkwat - - ! Set column friction vlocity - this%ust_lake_col(c) = 0.1_r8 - end if - end do - - end subroutine InitCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag) - ! - ! !DESCRIPTION: - ! Read/Write module information to/from restart file. - ! - ! !USES: - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_double, ncd_int, ncd_inqvdlen - use restUtilMod - ! - ! !ARGUMENTS: - class(lakestate_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - logical :: readvar ! determine if variable is on initial file - !----------------------------------------------------------------------- - - call restartvar(ncid=ncid, flag=flag, varname='LAKE_ICEFRAC', xtype=ncd_double, & - dim1name='column', dim2name='levlak', switchdim=.true., & - long_name='lake layer ice fraction', units='kg/kg', & - interpinic_flag='interp', readvar=readvar, data=this%lake_icefrac_col) - - call restartvar(ncid=ncid, flag=flag, varname='SAVEDTKE1', xtype=ncd_double, & - dim1name='column', & - long_name='top lake layer eddy conductivity', units='W/(m K)', & - interpinic_flag='interp', readvar=readvar, data=this%savedtke1_col) - - call restartvar(ncid=ncid, flag=flag, varname='USTLAKE', xtype=ncd_double, & - dim1name='column', & - long_name='friction velocity for lakes', units='m/s', & - interpinic_flag='interp', readvar=readvar, data=this%ust_lake_col) - - end subroutine Restart - -end module LakeStateType - diff --git a/src/biogeophys/OzoneBaseMod.F90 b/src/biogeophys/OzoneBaseMod.F90 deleted file mode 100644 index c50818f380..0000000000 --- a/src/biogeophys/OzoneBaseMod.F90 +++ /dev/null @@ -1,146 +0,0 @@ -module OzoneBaseMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Define the interface for ozone_type, which calculates ozone-induced stress. The type - ! defined here is abstract; it will get instantiated as a concrete type that extends - ! this base type (e.g., an ozone-off or ozone-on version). - ! - ! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - - implicit none - save - private - - ! !PUBLIC TYPES: - type, abstract, public :: ozone_base_type - private - - ! Public data members - ! These should be treated as read-only by other modules (except that they can be - ! modified by extensions of the ozone_base_type) - real(r8), pointer, public :: o3coefvsha_patch(:) ! ozone coefficient for photosynthesis, shaded leaves (0 - 1) - real(r8), pointer, public :: o3coefvsun_patch(:) ! ozone coefficient for photosynthesis, sunlit leaves (0 - 1) - real(r8), pointer, public :: o3coefgsha_patch(:) ! ozone coefficient for conductance, shaded leaves (0 - 1) - real(r8), pointer, public :: o3coefgsun_patch(:) ! ozone coefficient for conductance, sunlit leaves (0 - 1) - - - contains - ! The following routines need to be implemented by all type extensions - procedure(Init_interface) , public, deferred :: Init - procedure(Restart_interface) , public, deferred :: Restart - procedure(CalcOzoneStress_interface) , public, deferred :: CalcOzoneStress - - ! The following routines should only be called by extensions of the ozone_base_type - procedure, public :: InitAllocateBase - procedure, public :: InitColdBase - - end type ozone_base_type - - abstract interface - - subroutine Init_interface(this, bounds) - use decompMod, only : bounds_type - import :: ozone_base_type - - class(ozone_base_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - end subroutine Init_interface - - subroutine Restart_interface(this, bounds, ncid, flag) - use decompMod , only : bounds_type - use ncdio_pio , only : file_desc_t - import :: ozone_base_type - - class(ozone_base_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read', 'write' or 'define' - end subroutine Restart_interface - - subroutine CalcOzoneStress_interface(this, bounds, num_exposedvegp, filter_exposedvegp, & - forc_pbot, forc_th, rssun, rssha, rb, ram, tlai) - use decompMod , only : bounds_type - use shr_kind_mod , only : r8 => shr_kind_r8 - import :: ozone_base_type - - class(ozone_base_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp - integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg - real(r8) , intent(in) :: forc_pbot( bounds%begc: ) ! atmospheric pressure (Pa) - real(r8) , intent(in) :: forc_th( bounds%begc: ) ! atmospheric potential temperature (K) - real(r8) , intent(in) :: rssun( bounds%begp: ) ! leaf stomatal resistance, sunlit leaves (s/m) - real(r8) , intent(in) :: rssha( bounds%begp: ) ! leaf stomatal resistance, shaded leaves (s/m) - real(r8) , intent(in) :: rb( bounds%begp: ) ! boundary layer resistance (s/m) - real(r8) , intent(in) :: ram( bounds%begp: ) ! aerodynamical resistance (s/m) - real(r8) , intent(in) :: tlai( bounds%begp: ) ! one-sided leaf area index, no burying by snow - end subroutine CalcOzoneStress_interface - - end interface - -contains - - !----------------------------------------------------------------------- - subroutine InitAllocateBase(this, bounds) - ! - ! !DESCRIPTION: - ! Allocate variables in the base class - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(ozone_base_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - - character(len=*), parameter :: subname = 'InitAllocateBase' - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - - allocate(this%o3coefvsha_patch(begp:endp)) ; this%o3coefvsha_patch(:) = nan - allocate(this%o3coefvsun_patch(begp:endp)) ; this%o3coefvsun_patch(:) = nan - allocate(this%o3coefgsha_patch(begp:endp)) ; this%o3coefgsha_patch(:) = nan - allocate(this%o3coefgsun_patch(begp:endp)) ; this%o3coefgsun_patch(:) = nan - - end subroutine InitAllocateBase - - - !----------------------------------------------------------------------- - subroutine InitColdBase(this, bounds) - ! - ! !DESCRIPTION: - ! Do cold start initialization for variables in the base class. Note that this - ! initialization will be the same for all ozone implementations, including the - ! ozone-off implementation. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(ozone_base_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - - character(len=*), parameter :: subname = 'InitColdBase' - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - - this%o3coefvsha_patch(begp:endp) = 1._r8 - this%o3coefvsun_patch(begp:endp) = 1._r8 - this%o3coefgsha_patch(begp:endp) = 1._r8 - this%o3coefgsun_patch(begp:endp) = 1._r8 - - end subroutine InitColdBase - -end module OzoneBaseMod diff --git a/src/biogeophys/OzoneFactoryMod.F90 b/src/biogeophys/OzoneFactoryMod.F90 deleted file mode 100644 index 2b28587a99..0000000000 --- a/src/biogeophys/OzoneFactoryMod.F90 +++ /dev/null @@ -1,53 +0,0 @@ -module OzoneFactoryMod - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Factory to create an instance of ozone_base_type. This module figures out the - ! particular type to return. - ! - ! !USES: - use decompMod , only : bounds_type - - implicit none - save - private - - ! - ! !PUBLIC ROUTINES: - public :: create_and_init_ozone_type ! create an object of class ozone_base_type - -contains - - !----------------------------------------------------------------------- - function create_and_init_ozone_type(bounds) result(ozone) - ! - ! !DESCRIPTION: - ! Create and initialize an object of ozone_base_type, and return this object. The - ! particular type is determined based on the use_ozone namelist parameter. - ! - ! !USES: - use clm_varctl , only : use_ozone - use OzoneBaseMod , only : ozone_base_type - use OzoneOffMod , only : ozone_off_type - use OzoneMod , only : ozone_type - ! - ! !ARGUMENTS: - class(ozone_base_type), allocatable :: ozone ! function result - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'create_and_init_ozone_type' - !----------------------------------------------------------------------- - - if (use_ozone) then - allocate(ozone, source = ozone_type()) - else - allocate(ozone, source = ozone_off_type()) - end if - - call ozone%Init(bounds) - - end function create_and_init_ozone_type - -end module OzoneFactoryMod diff --git a/src/biogeophys/OzoneMod.F90 b/src/biogeophys/OzoneMod.F90 deleted file mode 100644 index 6c0e35779a..0000000000 --- a/src/biogeophys/OzoneMod.F90 +++ /dev/null @@ -1,543 +0,0 @@ -module OzoneMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculates ozone-induced stress. - ! - ! Note that the ozone calculations need to happen AFTER rssun and rsshade are computed - ! by the Photosynthesis routine. However, Photosynthesis also uses the ozone stress - ! computed here. Thus, the ozone stress computed in timestep i is applied in timestep - ! (i+1), requiring these stresses to be saved on the restart file. - ! - ! Developed by Danica Lombardozzi. - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod, only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use clm_varcon , only : spval - use shr_log_mod , only : errMsg => shr_log_errMsg - use OzoneBaseMod, only : ozone_base_type - use abortutils , only : endrun - - implicit none - save - private - - ! !PUBLIC TYPES: - type, extends(ozone_base_type), public :: ozone_type - private - ! Private data members - real(r8), pointer :: o3uptakesha_patch(:) ! ozone dose, shaded leaves (mmol O3/m^2) - real(r8), pointer :: o3uptakesun_patch(:) ! ozone dose, sunlit leaves (mmol O3/m^2) - - ! NOTE(wjs, 2014-09-29) tlai_old_patch really belongs alongside tlai_patch in - ! CanopyStateType. But there are problems with any way I can think to implement - ! that: - ! - ! - Updating tlai_old from a call in clm_driver, just before tlai is updated: This - ! is problematic to do correctly because tlai is updated in different places - ! depending on whether you're using SP, CN or ED. - ! - ! - Updating tlai_old within each routine that updates tlai: This feels fragile, - ! since it depends on each scheme remembering to do this update at the correct - ! time. - ! - ! - Making tlai a private member of CanopyFluxes, with getter and setter methods. - ! Then the setter method would also set tlai_old. This feels like the most robust - ! solution, but we don't have any precedent for using getters and setters for data - ! arrays. - real(r8), pointer :: tlai_old_patch(:) ! tlai from last time step - - contains - ! Public routines - procedure, public :: Init - procedure, public :: Restart - procedure, public :: CalcOzoneStress - - ! Private routines - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - ! Calculate ozone stress for a single point, for just sunlit or shaded leaves - procedure, private, nopass :: CalcOzoneStressOnePoint - end type ozone_type - - interface ozone_type - module procedure constructor - end interface ozone_type - - ! !PRIVATE TYPES: - - ! TODO(wjs, 2014-09-29) This parameter will eventually become a spatially-varying - ! value, obtained from ATM - real(r8), parameter :: forc_ozone = 100._r8 * 1.e-9_r8 ! ozone partial pressure [mol/mol] - - ! TODO(wjs, 2014-09-29) The following parameters should eventually be moved to the - ! params file. Parameters differentiated on veg type should be put on the params file - ! with a pft dimension. - - ! o3:h2o resistance ratio defined by Sitch et al. 2007 - real(r8), parameter :: ko3 = 1.67_r8 - - ! LAI threshold for LAIs that asymptote and don't reach 0 - real(r8), parameter :: lai_thresh = 0.5_r8 - - ! threshold below which o3flux is set to 0 (nmol m^-2 s^-1) - real(r8), parameter :: o3_flux_threshold = 0.8_r8 - - ! o3 intercepts and slopes for photosynthesis - real(r8), parameter :: needleleafPhotoInt = 0.8390_r8 ! units = unitless - real(r8), parameter :: needleleafPhotoSlope = 0._r8 ! units = per mmol m^-2 - real(r8), parameter :: broadleafPhotoInt = 0.8752_r8 ! units = unitless - real(r8), parameter :: broadleafPhotoSlope = 0._r8 ! units = per mmol m^-2 - real(r8), parameter :: nonwoodyPhotoInt = 0.8021_r8 ! units = unitless - real(r8), parameter :: nonwoodyPhotoSlope = -0.0009_r8 ! units = per mmol m^-2 - - ! o3 intercepts and slopes for conductance - real(r8), parameter :: needleleafCondInt = 0.7823_r8 ! units = unitless - real(r8), parameter :: needleleafCondSlope = 0.0048_r8 ! units = per mmol m^-2 - real(r8), parameter :: broadleafCondInt = 0.9125_r8 ! units = unitless - real(r8), parameter :: broadleafCondSlope = 0._r8 ! units = per mmol m^-2 - real(r8), parameter :: nonwoodyCondInt = 0.7511_r8 ! units = unitless - real(r8), parameter :: nonwoodyCondSlope = 0._r8 ! units = per mmol m^-2 - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ======================================================================== - ! Infrastructure routines (initialization, restart, etc.) - ! ======================================================================== - - !----------------------------------------------------------------------- - function constructor() result(ozone) - ! - ! !DESCRIPTION: - ! Return an instance of ozone_type - ! - ! !USES: - ! - ! !ARGUMENTS: - type(ozone_type) :: ozone ! function result - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'constructor' - !----------------------------------------------------------------------- - - ! DO NOTHING (simply return a variable of the appropriate type) - - ! Eventually this should call the Init routine (or replace the Init routine - ! entirely). But I think it would be confusing to do that until we switch everything - ! to use a constructor rather than the init routine. - - end function constructor - - - !----------------------------------------------------------------------- - subroutine Init(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize ozone data structure - ! - ! !ARGUMENTS: - class(ozone_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - !----------------------------------------------------------------------- - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - - end subroutine Init - - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Allocate memory for ozone data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(ozone_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - - call this%InitAllocateBase(bounds) - - allocate(this%o3uptakesha_patch(begp:endp)) ; this%o3uptakesha_patch(:) = nan - allocate(this%o3uptakesun_patch(begp:endp)) ; this%o3uptakesun_patch(:) = nan - allocate(this%tlai_old_patch(begp:endp)) ; this%tlai_old_patch(:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize ozone history variables - ! - ! !USES: - use histFileMod , only : hist_addfld1d - ! - ! !ARGUMENTS: - class(ozone_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - - character(len=*), parameter :: subname = 'InitHistory' - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - - this%o3uptakesun_patch(begp:endp) = spval - call hist_addfld1d (fname='O3UPTAKESUN', units='mmol/m^2', & - avgflag='A', long_name='total ozone flux into sunlit leaves', & - ptr_patch=this%o3uptakesun_patch, default='inactive') - - this%o3uptakesha_patch(begp:endp) = spval - call hist_addfld1d (fname='O3UPTAKESHA', units='mmol/m^2', & - avgflag='A', long_name='total ozone flux into shaded leaves', & - ptr_patch=this%o3uptakesha_patch, default='inactive') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !DESCRIPTION: - ! Perform cold-start initialization for ozone - ! - ! !ARGUMENTS: - class(ozone_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - - character(len=*), parameter :: subname = 'InitCold' - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - - call this%InitColdBase(bounds) - - this%o3uptakesha_patch(begp:endp) = 0._r8 - this%o3uptakesun_patch(begp:endp) = 0._r8 - this%tlai_old_patch(begp:endp) = 0._r8 - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag) - ! - ! !DESCRIPTION: - ! Handle restart of ozone variables. - ! - ! !USES: - use ncdio_pio , only : file_desc_t, ncd_inqvdlen, ncd_double - use restUtilMod - ! - ! !ARGUMENTS: - class(ozone_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read', 'write' or 'define' - ! - ! !LOCAL VARIABLES: - logical :: readvar - - character(len=*), parameter :: subname = 'Restart' - !----------------------------------------------------------------------- - - call restartvar(ncid=ncid, flag=flag, varname='o3_tlaiold', xtype=ncd_double, & - dim1name='pft', & - long_name='one-sided leaf area index, from previous timestep, for ozone calculations', units='', & - readvar=readvar, interpinic_flag='interp', data=this%tlai_old_patch) - - call restartvar(ncid=ncid, flag=flag, varname='o3uptakesha', xtype=ncd_double, & - dim1name='pft', & - long_name='ozone uptake for shaded leaves', units='mmol m^-3', & - readvar=readvar, interpinic_flag='interp', data=this%o3uptakesha_patch) - - call restartvar(ncid=ncid, flag=flag, varname='o3uptakesun', xtype=ncd_double, & - dim1name='pft', & - long_name='ozone uptake for sunlit leaves', units='mmol m^-3', & - readvar=readvar, interpinic_flag='interp', data=this%o3uptakesun_patch) - - call restartvar(ncid=ncid, flag=flag, varname='o3coefvsun', xtype=ncd_double, & - dim1name='pft', & - long_name='ozone coefficient for photosynthesis for sunlit leaves', units='unitless', & - readvar=readvar, interpinic_flag='interp', data=this%o3coefvsun_patch) - - call restartvar(ncid=ncid, flag=flag, varname='o3coefgsun', xtype=ncd_double, & - dim1name='pft', & - long_name='ozone coefficient for stomatal conductance for sunlit leaves', units='unitless', & - readvar=readvar, interpinic_flag='interp', data=this%o3coefgsun_patch) - - call restartvar(ncid=ncid, flag=flag, varname='o3coefvsha', xtype=ncd_double, & - dim1name='pft', & - long_name='ozone coefficient for photosynthesis for shaded leaves', units='unitless', & - readvar=readvar, interpinic_flag='interp', data=this%o3coefvsha_patch) - - call restartvar(ncid=ncid, flag=flag, varname='o3coefgsha', xtype=ncd_double, & - dim1name='pft', & - long_name='ozone coefficient for stomatal conductance for shaded leaves', units='unitless', & - readvar=readvar, interpinic_flag='interp', data=this%o3coefgsha_patch) - - end subroutine Restart - - ! ======================================================================== - ! Science routines - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp, & - forc_pbot, forc_th, rssun, rssha, rb, ram, tlai) - ! - ! !DESCRIPTION: - ! Calculate ozone stress. - ! - ! !USES: - use PatchType , only : patch - ! - ! !ARGUMENTS: - class(ozone_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp - integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg - real(r8) , intent(in) :: forc_pbot( bounds%begc: ) ! atmospheric pressure (Pa) - real(r8) , intent(in) :: forc_th( bounds%begc: ) ! atmospheric potential temperature (K) - real(r8) , intent(in) :: rssun( bounds%begp: ) ! leaf stomatal resistance, sunlit leaves (s/m) - real(r8) , intent(in) :: rssha( bounds%begp: ) ! leaf stomatal resistance, shaded leaves (s/m) - real(r8) , intent(in) :: rb( bounds%begp: ) ! boundary layer resistance (s/m) - real(r8) , intent(in) :: ram( bounds%begp: ) ! aerodynamical resistance (s/m) - real(r8) , intent(in) :: tlai( bounds%begp: ) ! one-sided leaf area index, no burying by snow - ! - ! !LOCAL VARIABLES: - integer :: fp ! filter index - integer :: p ! patch index - integer :: c ! column index - - character(len=*), parameter :: subname = 'CalcOzoneStress' - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(forc_pbot) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(forc_th) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rssun) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rssha) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rb) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(ram) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tlai) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - associate( & - o3coefvsha => this%o3coefvsha_patch , & ! Output: [real(r8) (:)] ozone coef - o3coefvsun => this%o3coefvsun_patch , & ! Output: [real(r8) (:)] ozone coef - o3coefgsha => this%o3coefgsha_patch , & ! Output: [real(r8) (:)] ozone coef - o3coefgsun => this%o3coefgsun_patch , & ! Output: [real(r8) (:)] ozone coef - o3uptakesha => this%o3uptakesha_patch , & ! Output: [real(r8) (:)] ozone dose - o3uptakesun => this%o3uptakesun_patch , & ! Output: [real(r8) (:)] ozone dose - tlai_old => this%tlai_old_patch & ! Output: [real(r8) (:)] tlai from last time step - ) - - do fp = 1, num_exposedvegp - p = filter_exposedvegp(fp) - c = patch%column(p) - -! if (.not.patch%is_fates(p)) then ! When FATES coexists with other vegetation, - ! or when it has an ozone compatible module, this - ! logic will likely come into play - - ! Ozone stress for shaded leaves - call CalcOzoneStressOnePoint( & - forc_ozone=forc_ozone, forc_pbot=forc_pbot(c), forc_th=forc_th(c), & - rs=rssha(p), rb=rb(p), ram=ram(p), & - tlai=tlai(p), tlai_old=tlai_old(p), pft_type=patch%itype(p), & - o3uptake=o3uptakesha(p), o3coefv=o3coefvsha(p), o3coefg=o3coefgsha(p)) - - ! Ozone stress for sunlit leaves - call CalcOzoneStressOnePoint( & - forc_ozone=forc_ozone, forc_pbot=forc_pbot(c), forc_th=forc_th(c), & - rs=rssun(p), rb=rb(p), ram=ram(p), & - tlai=tlai(p), tlai_old=tlai_old(p), pft_type=patch%itype(p), & - o3uptake=o3uptakesun(p), o3coefv=o3coefvsun(p), o3coefg=o3coefgsun(p)) - - tlai_old(p) = tlai(p) - -! else -! ! FATES is fundamentlaly incompatible with this type of patch-level -! ! association with plant functional type, so for the time -! ! being, fates patches will just push these values to invalid -! o3uptakesha(p) = spval -! o3coefvsha(p) = spval -! o3coefgsha(p) = spval -! o3uptakesun(p) = spval -! o3coefvsun(p) = spval -! o3coefgsun(p) = spval -! -! end if - -! else -! ! FATES is fundamentlaly incompatible with this type of patch-level -! ! association with plant functional type, so for the time -! ! being, fates patches will just push these values to invalid -! o3uptakesha(p) = spval -! o3coefvsha(p) = spval -! o3coefgsha(p) = spval -! o3uptakesun(p) = spval -! o3coefvsun(p) = spval -! o3coefgsun(p) = spval -! -! end if - - end do - - end associate - - end subroutine CalcOzoneStress - - !----------------------------------------------------------------------- - subroutine CalcOzoneStressOnePoint( & - forc_ozone, forc_pbot, forc_th, & - rs, rb, ram, & - tlai, tlai_old, pft_type, & - o3uptake, o3coefv, o3coefg) - ! - ! !DESCRIPTION: - ! Calculates ozone stress for a single point, for just sunlit or shaded leaves - ! - ! !USES: - use shr_const_mod , only : SHR_CONST_RGAS - use pftconMod , only : pftcon - use clm_time_manager , only : get_step_size - ! - ! !ARGUMENTS: - real(r8) , intent(in) :: forc_ozone ! ozone partial pressure (mol/mol) - real(r8) , intent(in) :: forc_pbot ! atmospheric pressure (Pa) - real(r8) , intent(in) :: forc_th ! atmospheric potential temperature (K) - real(r8) , intent(in) :: rs ! leaf stomatal resistance (s/m) - real(r8) , intent(in) :: rb ! boundary layer resistance (s/m) - real(r8) , intent(in) :: ram ! aerodynamical resistance (s/m) - real(r8) , intent(in) :: tlai ! one-sided leaf area index, no burying by snow - real(r8) , intent(in) :: tlai_old ! tlai from last time step - integer , intent(in) :: pft_type ! vegetation type, for indexing into pftvarcon arrays - real(r8) , intent(inout) :: o3uptake ! ozone entering the leaf - real(r8) , intent(out) :: o3coefv ! ozone coefficient for photosynthesis (0 - 1) - real(r8) , intent(out) :: o3coefg ! ozone coefficient for conductance (0 - 1) - ! - ! !LOCAL VARIABLES: - integer :: dtime ! land model time step (sec) - real(r8) :: dtimeh ! time step in hours - real(r8) :: o3concnmolm3 ! o3 concentration (nmol/m^3) - real(r8) :: o3flux ! instantaneous o3 flux (nmol m^-2 s^-1) - real(r8) :: o3fluxcrit ! instantaneous o3 flux beyond threshold (nmol m^-2 s^-1) - real(r8) :: o3fluxperdt ! o3 flux per timestep (mmol m^-2) - real(r8) :: heal ! o3uptake healing rate based on % of new leaves growing (mmol m^-2) - real(r8) :: leafturn ! leaf turnover time / mortality rate (per hour) - real(r8) :: decay ! o3uptake decay rate based on leaf lifetime (mmol m^-2) - real(r8) :: photoInt ! intercept for photosynthesis - real(r8) :: photoSlope ! slope for photosynthesis - real(r8) :: condInt ! intercept for conductance - real(r8) :: condSlope ! slope for conductance - - character(len=*), parameter :: subname = 'CalcOzoneStressOnePoint' - !----------------------------------------------------------------------- - - ! convert o3 from mol/mol to nmol m^-3 - o3concnmolm3 = forc_ozone * 1.e9_r8 * (forc_pbot/(forc_th*SHR_CONST_RGAS*0.001_r8)) - - ! calculate instantaneous flux - o3flux = o3concnmolm3/ (ko3*rs+ rb + ram) - - ! apply o3 flux threshold - if (o3flux < o3_flux_threshold) then - o3fluxcrit = 0._r8 - else - o3fluxcrit = o3flux - o3_flux_threshold - endif - - dtime = get_step_size() - dtimeh = dtime / 3600._r8 - - ! calculate o3 flux per timestep - o3fluxperdt = o3fluxcrit * dtime * 0.000001_r8 - - if (tlai > lai_thresh) then - ! checking if new leaf area was added - if (tlai - tlai_old > 0) then - ! minimizing o3 damage to new leaves - heal = max(0._r8,(((tlai-tlai_old)/tlai)*o3fluxperdt)) - else - heal = 0._r8 - endif - - if (pftcon%evergreen(pft_type) == 1) then - leafturn = 1._r8/(pftcon%leaf_long(pft_type)*365._r8*24._r8) - else - leafturn = 0._r8 - endif - - ! o3 uptake decay based on leaf lifetime for evergreen plants - decay = o3uptake * leafturn * dtimeh - !cumulative uptake (mmol m^-2) - o3uptake = max(0._r8, o3uptake + o3fluxperdt - decay - heal) - - else - o3uptake = 0._r8 - end if - - - if (o3uptake == 0._r8) then - ! No o3 damage if no o3 uptake - o3coefv = 1._r8 - o3coefg = 1._r8 - else - ! Determine parameter values for this pft - ! TODO(wjs, 2014-10-01) Once these parameters are moved into the params file, this - ! logic can be removed. - if (pft_type>3) then - if (pftcon%woody(pft_type)==0) then - photoInt = nonwoodyPhotoInt - photoSlope = nonwoodyPhotoSlope - condInt = nonwoodyCondInt - condSlope = nonwoodyCondSlope - else - photoInt = broadleafPhotoInt - photoSlope = broadleafPhotoSlope - condInt = broadleafCondInt - condSlope = broadleafCondSlope - end if - else - photoInt = needleleafPhotoInt - photoSlope = needleleafPhotoSlope - condInt = needleleafCondInt - condSlope = needleleafCondSlope - end if - - ! Apply parameter values to compute o3 coefficients - o3coefv = max(0._r8, min(1._r8, photoInt + photoSlope * o3uptake)) - o3coefg = max(0._r8, min(1._r8, condInt + condSlope * o3uptake)) - - end if - - end subroutine CalcOzoneStressOnePoint - - -end module OzoneMod diff --git a/src/biogeophys/OzoneOffMod.F90 b/src/biogeophys/OzoneOffMod.F90 deleted file mode 100644 index 8d0df71fd3..0000000000 --- a/src/biogeophys/OzoneOffMod.F90 +++ /dev/null @@ -1,118 +0,0 @@ -module OzoneOffMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Provides an implementatio of ozone_base_type for the ozone-off case. Note that very - ! little needs to be done in this case, so this module mainly provides empty - ! implementations to satisfy the interface. - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod, only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use OzoneBaseMod, only : ozone_base_type - - implicit none - save - private - - ! !PUBLIC TYPES: - type, extends(ozone_base_type), public :: ozone_off_type - private - contains - procedure, public :: Init - procedure, public :: Restart - procedure, public :: CalcOzoneStress - end type ozone_off_type - - interface ozone_off_type - module procedure constructor - end interface ozone_off_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - function constructor() result(ozone_off) - ! - ! !DESCRIPTION: - ! Return an instance of ozone_off_type - ! - ! !USES: - ! - ! !ARGUMENTS: - type(ozone_off_type) :: ozone_off ! function result - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'constructor' - !----------------------------------------------------------------------- - - ! DO NOTHING (simply return a variable of the appropriate type) - - ! Eventually this should call the Init routine (or replace the Init routine - ! entirely). But I think it would be confusing to do that until we switch everything - ! to use a constructor rather than the init routine. - - end function constructor - - - subroutine Init(this, bounds) - class(ozone_off_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - - call this%InitAllocateBase(bounds) - call this%InitColdBase(bounds) - end subroutine Init - - subroutine Restart(this, bounds, ncid, flag) - use ncdio_pio , only : file_desc_t - - class(ozone_off_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read', 'write' or 'define' - - ! DO NOTHING - - end subroutine Restart - - subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp, & - forc_pbot, forc_th, rssun, rssha, rb, ram, tlai) - - class(ozone_off_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp - integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg - real(r8) , intent(in) :: forc_pbot( bounds%begc: ) ! atmospheric pressure (Pa) - real(r8) , intent(in) :: forc_th( bounds%begc: ) ! atmospheric potential temperature (K) - real(r8) , intent(in) :: rssun( bounds%begp: ) ! leaf stomatal resistance, sunlit leaves (s/m) - real(r8) , intent(in) :: rssha( bounds%begp: ) ! leaf stomatal resistance, shaded leaves (s/m) - real(r8) , intent(in) :: rb( bounds%begp: ) ! boundary layer resistance (s/m) - real(r8) , intent(in) :: ram( bounds%begp: ) ! aerodynamical resistance (s/m) - real(r8) , intent(in) :: tlai( bounds%begp: ) ! one-sided leaf area index, no burying by snow - - ! Enforce expected array sizes (mainly so that a debug-mode threaded test with - ! ozone-off can pick up problems with the call to this routine) - SHR_ASSERT_ALL((ubound(forc_pbot) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(forc_th) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rssun) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rssha) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rb) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(ram) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tlai) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - ! Explicitly set outputs to 1. This isn't really needed, because they should still be - ! at 1 from cold-start initialization, but do this for clarity here. - - this%o3coefvsha_patch(bounds%begp:bounds%endp) = 1._r8 - this%o3coefvsun_patch(bounds%begp:bounds%endp) = 1._r8 - this%o3coefgsha_patch(bounds%begp:bounds%endp) = 1._r8 - this%o3coefgsun_patch(bounds%begp:bounds%endp) = 1._r8 - - end subroutine CalcOzoneStress - -end module OzoneOffMod diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 deleted file mode 100644 index 311780b65a..0000000000 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ /dev/null @@ -1,612 +0,0 @@ -module PhotosynthesisMod - -#include "shr_assert.h" - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Leaf photosynthesis and stomatal conductance calculation as described by - ! Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 and extended to - ! a multi-layer canopy - ! - ! !USES: - use shr_sys_mod , only : shr_sys_flush - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use abortutils , only : endrun - use clm_varctl , only : use_cn, use_cndv, use_fates, use_luna, use_hydrstress - use clm_varctl , only : iulog - use clm_varpar , only : nlevcan, nvegwcs, mxpft - use clm_varcon , only : namep, spval - use decompMod , only : bounds_type - use pftconMod , only : pftcon - use atm2lndType , only : atm2lnd_type - use CanopyStateType , only : canopystate_type - use WaterStateType , only : waterstate_type - use WaterfluxType , only : waterflux_type - use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type - use SolarAbsorbedType , only : solarabs_type - use SurfaceAlbedoType , only : surfalb_type - use OzoneBaseMod , only : ozone_base_type - use LandunitType , only : lun - use PatchType , only : patch - use GridcellType , only : grc - ! - implicit none - private - ! - ! !PRIVATE DATA: - integer, parameter, private :: leafresp_mtd_ryan1991 = 1 ! Ryan 1991 method for lmr25top - integer, parameter, private :: leafresp_mtd_atkin2015 = 2 ! Atkin 2015 method for lmr25top - integer, parameter, private :: sun=1 ! index for sunlit - integer, parameter, private :: sha=2 ! index for shaded - integer, parameter, private :: xyl=3 ! index for xylem - integer, parameter, private :: root=4 ! index for root - integer, parameter, private :: veg=0 ! index for vegetation - integer, parameter, private :: soil=1 ! index for soil - integer, parameter, private :: stomatalcond_mtd_bb1987 = 1 ! Ball-Berry 1987 method for photosynthesis - integer, parameter, private :: stomatalcond_mtd_medlyn2011 = 2 ! Medlyn 2011 method for photosynthesis - ! !PUBLIC VARIABLES: - - type :: photo_params_type - real(r8), allocatable, public :: krmax (:) - real(r8), allocatable, private :: kmax (:,:) - real(r8), allocatable, private :: psi50 (:,:) - real(r8), allocatable, private :: ck (:,:) - real(r8), allocatable, public :: psi_soil_ref (:) - real(r8), allocatable, private :: lmr_intercept_atkin(:) - contains - procedure, private :: allocParams - end type photo_params_type - ! - type(photo_params_type), public, protected :: params_inst ! params_inst is populated in readParamsMod - - type, public :: photosyns_type - - logical , pointer, private :: c3flag_patch (:) ! patch true if C3 and false if C4 - ! Plant hydraulic stress specific variables - real(r8), pointer, private :: ac_phs_patch (:,:,:) ! patch Rubisco-limited gross photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: aj_phs_patch (:,:,:) ! patch RuBP-limited gross photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: ap_phs_patch (:,:,:) ! patch product-limited (C3) or CO2-limited (C4) gross photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: ag_phs_patch (:,:,:) ! patch co-limited gross leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: an_sun_patch (:,:) ! patch sunlit net leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: an_sha_patch (:,:) ! patch shaded net leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: vcmax_z_phs_patch (:,:,:) ! patch maximum rate of carboxylation (umol co2/m**2/s) - real(r8), pointer, private :: kp_z_phs_patch (:,:,:) ! patch initial slope of CO2 response curve (C4 plants) - real(r8), pointer, private :: tpu_z_phs_patch (:,:,:) ! patch triose phosphate utilization rate (umol CO2/m**2/s) - real(r8), pointer, private :: gs_mol_sun_patch (:,:) ! patch sunlit leaf stomatal conductance (umol H2O/m**2/s) - real(r8), pointer, private :: gs_mol_sha_patch (:,:) ! patch shaded leaf stomatal conductance (umol H2O/m**2/s) - - real(r8), pointer, private :: ac_patch (:,:) ! patch Rubisco-limited gross photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: aj_patch (:,:) ! patch RuBP-limited gross photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: ap_patch (:,:) ! patch product-limited (C3) or CO2-limited (C4) gross photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: ag_patch (:,:) ! patch co-limited gross leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: an_patch (:,:) ! patch net leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: vcmax_z_patch (:,:) ! patch maximum rate of carboxylation (umol co2/m**2/s) - real(r8), pointer, private :: cp_patch (:) ! patch CO2 compensation point (Pa) - real(r8), pointer, private :: kc_patch (:) ! patch Michaelis-Menten constant for CO2 (Pa) - real(r8), pointer, private :: ko_patch (:) ! patch Michaelis-Menten constant for O2 (Pa) - real(r8), pointer, private :: qe_patch (:) ! patch quantum efficiency, used only for C4 (mol CO2 / mol photons) - real(r8), pointer, private :: tpu_z_patch (:,:) ! patch triose phosphate utilization rate (umol CO2/m**2/s) - real(r8), pointer, private :: kp_z_patch (:,:) ! patch initial slope of CO2 response curve (C4 plants) - real(r8), pointer, private :: theta_cj_patch (:) ! patch empirical curvature parameter for ac, aj photosynthesis co-limitation - real(r8), pointer, private :: bbb_patch (:) ! patch Ball-Berry minimum leaf conductance (umol H2O/m**2/s) - real(r8), pointer, private :: mbb_patch (:) ! patch Ball-Berry slope of conductance-photosynthesis relationship - real(r8), pointer, private :: gs_mol_patch (:,:) ! patch leaf stomatal conductance (umol H2O/m**2/s) - real(r8), pointer, private :: gb_mol_patch (:) ! patch leaf boundary layer conductance (umol H2O/m**2/s) - real(r8), pointer, private :: rh_leaf_patch (:) ! patch fractional humidity at leaf surface (dimensionless) - - real(r8), pointer, private :: alphapsnsun_patch (:) ! patch sunlit 13c fractionation ([]) - real(r8), pointer, private :: alphapsnsha_patch (:) ! patch shaded 13c fractionation ([]) - - real(r8), pointer, public :: psnsun_patch (:) ! patch sunlit leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, public :: psnsha_patch (:) ! patch shaded leaf photosynthesis (umol CO2/m**2/s) - - real(r8), pointer, private :: psnsun_z_patch (:,:) ! patch canopy layer: sunlit leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: psnsha_z_patch (:,:) ! patch canopy layer: shaded leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: psnsun_wc_patch (:) ! patch Rubsico-limited sunlit leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: psnsha_wc_patch (:) ! patch Rubsico-limited shaded leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: psnsun_wj_patch (:) ! patch RuBP-limited sunlit leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: psnsha_wj_patch (:) ! patch RuBP-limited shaded leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: psnsun_wp_patch (:) ! patch product-limited sunlit leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: psnsha_wp_patch (:) ! patch product-limited shaded leaf photosynthesis (umol CO2/m**2/s) - - real(r8), pointer, public :: fpsn_patch (:) ! patch photosynthesis (umol CO2/m**2 ground/s) - real(r8), pointer, private :: fpsn_wc_patch (:) ! patch Rubisco-limited photosynthesis (umol CO2/m**2 ground/s) - real(r8), pointer, private :: fpsn_wj_patch (:) ! patch RuBP-limited photosynthesis (umol CO2/m**2 ground/s) - real(r8), pointer, private :: fpsn_wp_patch (:) ! patch product-limited photosynthesis (umol CO2/m**2 ground/s) - - real(r8), pointer, public :: lnca_patch (:) ! top leaf layer leaf N concentration (gN leaf/m^2) - - real(r8), pointer, public :: lmrsun_patch (:) ! patch sunlit leaf maintenance respiration rate (umol CO2/m**2/s) - real(r8), pointer, public :: lmrsha_patch (:) ! patch shaded leaf maintenance respiration rate (umol CO2/m**2/s) - real(r8), pointer, private :: lmrsun_z_patch (:,:) ! patch canopy layer: sunlit leaf maintenance respiration rate (umol CO2/m**2/s) - real(r8), pointer, private :: lmrsha_z_patch (:,:) ! patch canopy layer: shaded leaf maintenance respiration rate (umol CO2/m**2/s) - - real(r8), pointer, public :: cisun_z_patch (:,:) ! patch intracellular sunlit leaf CO2 (Pa) - real(r8), pointer, public :: cisha_z_patch (:,:) ! patch intracellular shaded leaf CO2 (Pa) - - real(r8), pointer, private :: rssun_z_patch (:,:) ! patch canopy layer: sunlit leaf stomatal resistance (s/m) - real(r8), pointer, private :: rssha_z_patch (:,:) ! patch canopy layer: shaded leaf stomatal resistance (s/m) - real(r8), pointer, public :: rssun_patch (:) ! patch sunlit stomatal resistance (s/m) - real(r8), pointer, public :: rssha_patch (:) ! patch shaded stomatal resistance (s/m) - real(r8), pointer, public :: luvcmax25top_patch (:) ! vcmax25 ! (umol/m2/s) - real(r8), pointer, public :: lujmax25top_patch (:) ! vcmax25 (umol/m2/s) - real(r8), pointer, public :: lutpu25top_patch (:) ! vcmax25 (umol/m2/s) -!! - - - ! LUNA specific variables - real(r8), pointer, public :: vcmx25_z_patch (:,:) ! patch leaf Vc,max25 (umol CO2/m**2/s) for canopy layer - real(r8), pointer, public :: jmx25_z_patch (:,:) ! patch leaf Jmax25 (umol electron/m**2/s) for canopy layer - real(r8), pointer, public :: pnlc_z_patch (:,:) ! patch proportion of leaf nitrogen allocated for light capture for canopy layer - real(r8), pointer, public :: enzs_z_patch (:,:) ! enzyme decay status 1.0-fully active; 0-all decayed during stress - real(r8), pointer, public :: fpsn24_patch (:) ! 24 hour mean patch photosynthesis (umol CO2/m**2 ground/day) - - ! Logical switches for different options - logical, public :: rootstem_acc ! Respiratory acclimation for roots and stems - logical, private :: light_inhibit ! If light should inhibit respiration - integer, private :: leafresp_method ! leaf maintencence respiration at 25C for canopy top method to use - integer, private :: stomatalcond_mtd ! Stomatal conduction method type - logical, private :: modifyphoto_and_lmr_forcrop ! Modify photosynthesis and LMR for crop - contains - - ! Public procedures - procedure, public :: Init - procedure, public :: Restart - procedure, public :: ReadParams - - ! Private procedures - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - end type photosyns_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(photosyns_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate (bounds) - call this%InitHistory (bounds) - call this%InitCold (bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !ARGUMENTS: - class(photosyns_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - allocate(this%c3flag_patch (begp:endp)) ; this%c3flag_patch (:) =.false. - allocate(this%ac_phs_patch (begp:endp,2,1:nlevcan)) ; this%ac_phs_patch (:,:,:) = nan - allocate(this%aj_phs_patch (begp:endp,2,1:nlevcan)) ; this%aj_phs_patch (:,:,:) = nan - allocate(this%ap_phs_patch (begp:endp,2,1:nlevcan)) ; this%ap_phs_patch (:,:,:) = nan - allocate(this%ag_phs_patch (begp:endp,2,1:nlevcan)) ; this%ag_phs_patch (:,:,:) = nan - allocate(this%an_sun_patch (begp:endp,1:nlevcan)) ; this%an_sun_patch (:,:) = nan - allocate(this%an_sha_patch (begp:endp,1:nlevcan)) ; this%an_sha_patch (:,:) = nan - allocate(this%vcmax_z_phs_patch (begp:endp,2,1:nlevcan)) ; this%vcmax_z_phs_patch (:,:,:) = nan - allocate(this%tpu_z_phs_patch (begp:endp,2,1:nlevcan)) ; this%tpu_z_phs_patch (:,:,:) = nan - allocate(this%kp_z_phs_patch (begp:endp,2,1:nlevcan)) ; this%kp_z_phs_patch (:,:,:) = nan - allocate(this%gs_mol_sun_patch (begp:endp,1:nlevcan)) ; this%gs_mol_sun_patch (:,:) = nan - allocate(this%gs_mol_sha_patch (begp:endp,1:nlevcan)) ; this%gs_mol_sha_patch (:,:) = nan - allocate(this%ac_patch (begp:endp,1:nlevcan)) ; this%ac_patch (:,:) = nan - allocate(this%aj_patch (begp:endp,1:nlevcan)) ; this%aj_patch (:,:) = nan - allocate(this%ap_patch (begp:endp,1:nlevcan)) ; this%ap_patch (:,:) = nan - allocate(this%ag_patch (begp:endp,1:nlevcan)) ; this%ag_patch (:,:) = nan - allocate(this%an_patch (begp:endp,1:nlevcan)) ; this%an_patch (:,:) = nan - allocate(this%vcmax_z_patch (begp:endp,1:nlevcan)) ; this%vcmax_z_patch (:,:) = nan - allocate(this%tpu_z_patch (begp:endp,1:nlevcan)) ; this%tpu_z_patch (:,:) = nan - allocate(this%kp_z_patch (begp:endp,1:nlevcan)) ; this%kp_z_patch (:,:) = nan - allocate(this%gs_mol_patch (begp:endp,1:nlevcan)) ; this%gs_mol_patch (:,:) = nan - allocate(this%cp_patch (begp:endp)) ; this%cp_patch (:) = nan - allocate(this%kc_patch (begp:endp)) ; this%kc_patch (:) = nan - allocate(this%ko_patch (begp:endp)) ; this%ko_patch (:) = nan - allocate(this%qe_patch (begp:endp)) ; this%qe_patch (:) = nan - allocate(this%theta_cj_patch (begp:endp)) ; this%theta_cj_patch (:) = nan - allocate(this%bbb_patch (begp:endp)) ; this%bbb_patch (:) = nan - allocate(this%mbb_patch (begp:endp)) ; this%mbb_patch (:) = nan - allocate(this%gb_mol_patch (begp:endp)) ; this%gb_mol_patch (:) = nan - allocate(this%rh_leaf_patch (begp:endp)) ; this%rh_leaf_patch (:) = nan - - allocate(this%psnsun_patch (begp:endp)) ; this%psnsun_patch (:) = nan - allocate(this%psnsha_patch (begp:endp)) ; this%psnsha_patch (:) = nan - - allocate(this%psnsun_z_patch (begp:endp,1:nlevcan)) ; this%psnsun_z_patch (:,:) = nan - allocate(this%psnsha_z_patch (begp:endp,1:nlevcan)) ; this%psnsha_z_patch (:,:) = nan - allocate(this%psnsun_wc_patch (begp:endp)) ; this%psnsun_wc_patch (:) = nan - allocate(this%psnsha_wc_patch (begp:endp)) ; this%psnsha_wc_patch (:) = nan - allocate(this%psnsun_wj_patch (begp:endp)) ; this%psnsun_wj_patch (:) = nan - allocate(this%psnsha_wj_patch (begp:endp)) ; this%psnsha_wj_patch (:) = nan - allocate(this%psnsun_wp_patch (begp:endp)) ; this%psnsun_wp_patch (:) = nan - allocate(this%psnsha_wp_patch (begp:endp)) ; this%psnsha_wp_patch (:) = nan - allocate(this%fpsn_patch (begp:endp)) ; this%fpsn_patch (:) = nan - allocate(this%fpsn_wc_patch (begp:endp)) ; this%fpsn_wc_patch (:) = nan - allocate(this%fpsn_wj_patch (begp:endp)) ; this%fpsn_wj_patch (:) = nan - allocate(this%fpsn_wp_patch (begp:endp)) ; this%fpsn_wp_patch (:) = nan - - allocate(this%lnca_patch (begp:endp)) ; this%lnca_patch (:) = nan - - allocate(this%lmrsun_z_patch (begp:endp,1:nlevcan)) ; this%lmrsun_z_patch (:,:) = nan - allocate(this%lmrsha_z_patch (begp:endp,1:nlevcan)) ; this%lmrsha_z_patch (:,:) = nan - allocate(this%lmrsun_patch (begp:endp)) ; this%lmrsun_patch (:) = nan - allocate(this%lmrsha_patch (begp:endp)) ; this%lmrsha_patch (:) = nan - - allocate(this%alphapsnsun_patch (begp:endp)) ; this%alphapsnsun_patch (:) = nan - allocate(this%alphapsnsha_patch (begp:endp)) ; this%alphapsnsha_patch (:) = nan - - allocate(this%cisun_z_patch (begp:endp,1:nlevcan)) ; this%cisun_z_patch (:,:) = nan - allocate(this%cisha_z_patch (begp:endp,1:nlevcan)) ; this%cisha_z_patch (:,:) = nan - - allocate(this%rssun_z_patch (begp:endp,1:nlevcan)) ; this%rssun_z_patch (:,:) = nan - allocate(this%rssha_z_patch (begp:endp,1:nlevcan)) ; this%rssha_z_patch (:,:) = nan - allocate(this%rssun_patch (begp:endp)) ; this%rssun_patch (:) = nan - allocate(this%rssha_patch (begp:endp)) ; this%rssha_patch (:) = nan - allocate(this%luvcmax25top_patch(begp:endp)) ; this%luvcmax25top_patch(:) = nan - allocate(this%lujmax25top_patch (begp:endp)) ; this%lujmax25top_patch(:) = nan - allocate(this%lutpu25top_patch (begp:endp)) ; this%lutpu25top_patch(:) = nan -!! -! allocate(this%psncanopy_patch (begp:endp)) ; this%psncanopy_patch (:) = nan -! allocate(this%lmrcanopy_patch (begp:endp)) ; this%lmrcanopy_patch (:) = nan - if(use_luna)then - ! NOTE(bja, 2015-09) because these variables are only allocated - ! when luna is turned on, they can not be placed into associate - ! statements. - allocate(this%vcmx25_z_patch (begp:endp,1:nlevcan)) ; this%vcmx25_z_patch (:,:) = 30._r8 - allocate(this%jmx25_z_patch (begp:endp,1:nlevcan)) ; this%jmx25_z_patch (:,:) = 60._r8 - allocate(this%pnlc_z_patch (begp:endp,1:nlevcan)) ; this%pnlc_z_patch (:,:) = 0.01_r8 - allocate(this%fpsn24_patch (begp:endp)) ; this%fpsn24_patch (:) = nan - allocate(this%enzs_z_patch (begp:endp,1:nlevcan)) ; this%enzs_z_patch (:,:) = 1._r8 - endif - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !USES: - use histFileMod , only: hist_addfld1d, hist_addfld2d - ! - ! !ARGUMENTS: - class(photosyns_type) :: this - type(bounds_type), intent(in) :: bounds - real(r8), pointer :: ptr_1d(:) ! pointer to 1d patch array - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - !--------------------------------------------------------------------- - - begp = bounds%begp; endp= bounds%endp - - this%rh_leaf_patch(begp:endp) = spval - call hist_addfld1d (fname='RH_LEAF', units='fraction', & - avgflag='A', long_name='fractional humidity at leaf surface', & - ptr_patch=this%rh_leaf_patch, set_spec=spval, default='inactive') - this%lnca_patch(begp:endp) = spval - call hist_addfld1d (fname='LNC', units='gN leaf/m^2', & - avgflag='A', long_name='leaf N concentration', & - ptr_patch=this%lnca_patch, set_spec=spval, default='inactive') - - ! Don't output photosynthesis variables when FATES is on as they aren't calculated - if (.not. use_fates) then - this%fpsn_patch(begp:endp) = spval - call hist_addfld1d (fname='FPSN', units='umol/m2s', & - avgflag='A', long_name='photosynthesis', & - ptr_patch=this%fpsn_patch, set_lake=0._r8, set_urb=0._r8, default='inactive') - - ! Don't by default output this rate limiting step as only makes sense if you are outputing - ! the others each time-step - this%fpsn_wc_patch(begp:endp) = spval - call hist_addfld1d (fname='FPSN_WC', units='umol/m2s', & - avgflag='I', long_name='Rubisco-limited photosynthesis', & - ptr_patch=this%fpsn_wc_patch, set_lake=0._r8, set_urb=0._r8, & - default='inactive') - - ! Don't by default output this rate limiting step as only makes sense if you are outputing - ! the others each time-step - this%fpsn_wj_patch(begp:endp) = spval - call hist_addfld1d (fname='FPSN_WJ', units='umol/m2s', & - avgflag='I', long_name='RuBP-limited photosynthesis', & - ptr_patch=this%fpsn_wj_patch, set_lake=0._r8, set_urb=0._r8, & - default='inactive') - - ! Don't by default output this rate limiting step as only makes sense if you are outputing - ! the others each time-step - this%fpsn_wp_patch(begp:endp) = spval - call hist_addfld1d (fname='FPSN_WP', units='umol/m2s', & - avgflag='I', long_name='Product-limited photosynthesis', & - ptr_patch=this%fpsn_wp_patch, set_lake=0._r8, set_urb=0._r8, & - default='inactive') - end if - - if (use_cn) then - this%psnsun_patch(begp:endp) = spval - call hist_addfld1d (fname='PSNSUN', units='umolCO2/m^2/s', & - avgflag='A', long_name='sunlit leaf photosynthesis', & - ptr_patch=this%psnsun_patch, default='inactive') - - this%psnsha_patch(begp:endp) = spval - call hist_addfld1d (fname='PSNSHA', units='umolCO2/m^2/s', & - avgflag='A', long_name='shaded leaf photosynthesis', & - ptr_patch=this%psnsha_patch, default='inactive') - end if - - this%rssun_patch(begp:endp) = spval - call hist_addfld1d (fname='RSSUN', units='s/m', & - avgflag='M', long_name='sunlit leaf stomatal resistance', & - ptr_patch=this%rssun_patch, set_lake=spval, set_urb=spval, default='inactive') - - this%rssha_patch(begp:endp) = spval - call hist_addfld1d (fname='RSSHA', units='s/m', & - avgflag='M', long_name='shaded leaf stomatal resistance', & - ptr_patch=this%rssha_patch, set_lake=spval, set_urb=spval, default='inactive') - - this%gs_mol_sun_patch(begp:endp,:) = spval - this%gs_mol_sha_patch(begp:endp,:) = spval - if (nlevcan>1) then - call hist_addfld2d (fname='GSSUN', units='umol H20/m2/s', type2d='nlevcan', & - avgflag='A', long_name='sunlit leaf stomatal conductance', & - ptr_patch=this%gs_mol_sun_patch, set_lake=spval, set_urb=spval, default='inactive') - - call hist_addfld2d (fname='GSSHA', units='umol H20/m2/s', type2d='nlevcan', & - avgflag='A', long_name='shaded leaf stomatal conductance', & - ptr_patch=this%gs_mol_sha_patch, set_lake=spval, set_urb=spval, default='inactive') - else - ptr_1d => this%gs_mol_sun_patch(begp:endp,1) - call hist_addfld1d (fname='GSSUN', units='umol H20/m2/s', & - avgflag='A', long_name='sunlit leaf stomatal conductance', & - ptr_patch=ptr_1d, default='inactive') - - ptr_1d => this%gs_mol_sha_patch(begp:endp,1) - call hist_addfld1d (fname='GSSHA', units='umol H20/m2/s', & - avgflag='A', long_name='shaded leaf stomatal conductance', & - ptr_patch=ptr_1d, default='inactive') - - endif - - if(use_luna)then - if(nlevcan>1)then - call hist_addfld2d (fname='Vcmx25Z', units='umol/m2/s', type2d='nlevcan', & - avgflag='A', long_name='canopy profile of vcmax25 predicted by LUNA model', & - ptr_patch=this%vcmx25_z_patch, default='inactive') - - call hist_addfld2d (fname='Jmx25Z', units='umol/m2/s', type2d='nlevcan', & - avgflag='A', long_name='canopy profile of vcmax25 predicted by LUNA model', & - ptr_patch=this%jmx25_z_patch, default='inactive') - - call hist_addfld2d (fname='PNLCZ', units='unitless', type2d='nlevcan', & - avgflag='A', long_name='Proportion of nitrogen allocated for light capture', & - ptr_patch=this%pnlc_z_patch,default='inactive') - else - ptr_1d => this%vcmx25_z_patch(:,1) - call hist_addfld1d (fname='Vcmx25Z', units='umol/m2/s',& - avgflag='A', long_name='canopy profile of vcmax25 predicted by LUNA model', & - ptr_patch=ptr_1d, default='inactive') - ptr_1d => this%jmx25_z_patch(:,1) - call hist_addfld1d (fname='Jmx25Z', units='umol/m2/s',& - avgflag='A', long_name='canopy profile of vcmax25 predicted by LUNA model', & - ptr_patch=ptr_1d, default='inactive') - ptr_1d => this%pnlc_z_patch(:,1) - call hist_addfld1d (fname='PNLCZ', units='unitless', & - avgflag='A', long_name='Proportion of nitrogen allocated for light capture', & - ptr_patch=ptr_1d,default='inactive') - - this%luvcmax25top_patch(begp:endp) = spval - call hist_addfld1d (fname='VCMX25T', units='umol/m2/s', & - avgflag='M', long_name='canopy profile of vcmax25', & - ptr_patch=this%luvcmax25top_patch, set_lake=spval, set_urb=spval, default='inactive') - - this%lujmax25top_patch(begp:endp) = spval - call hist_addfld1d (fname='JMX25T', units='umol/m2/s', & - avgflag='M', long_name='canopy profile of jmax', & - ptr_patch=this%lujmax25top_patch, set_lake=spval, set_urb=spval, default='inactive') - - this%lutpu25top_patch(begp:endp) = spval - call hist_addfld1d (fname='TPU25T', units='umol/m2/s', & - avgflag='M', long_name='canopy profile of tpu', & - ptr_patch=this%lutpu25top_patch, set_lake=spval, set_urb=spval, default='inactive') - - endif - this%fpsn24_patch = spval - call hist_addfld1d (fname='FPSN24', units='umol CO2/m**2 ground/day',& - avgflag='A', long_name='24 hour accumulative patch photosynthesis starting from mid-night', & - ptr_patch=this%fpsn24_patch, default='inactive') - - endif - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !ARGUMENTS: - class(photosyns_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p,l ! indices - !----------------------------------------------------------------------- - - do p = bounds%begp,bounds%endp - l = patch%landunit(p) - - this%alphapsnsun_patch(p) = spval - this%alphapsnsha_patch(p) = spval - - if (lun%ifspecial(l)) then - this%psnsun_patch(p) = 0._r8 - this%psnsha_patch(p) = 0._r8 - end if - end do - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine allocParams ( this ) - ! - implicit none - - ! !ARGUMENTS: - class(photo_params_type) :: this - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'allocParams' - !----------------------------------------------------------------------- - - ! allocate parameters - - allocate( this%krmax (0:mxpft) ) ; this%krmax(:) = nan - allocate( this%kmax (0:mxpft,nvegwcs) ) ; this%kmax(:,:) = nan - allocate( this%psi50 (0:mxpft,nvegwcs) ) ; this%psi50(:,:) = nan - allocate( this%ck (0:mxpft,nvegwcs) ) ; this%ck(:,:) = nan - allocate( this%psi_soil_ref(0:mxpft) ) ; this%psi_soil_ref(:) = nan - - if ( use_hydrstress .and. nvegwcs /= 4 )then - call endrun(msg='Error:: the Plant Hydraulics Stress methodology is for the spacA function is hardcoded for nvegwcs==4' & - //errMsg(__FILE__, __LINE__)) - end if - - end subroutine allocParams - - !----------------------------------------------------------------------- - subroutine readParams ( this, ncid ) - ! - ! !USES: - use ncdio_pio , only : file_desc_t,ncd_io - implicit none - - ! !ARGUMENTS: - class(photosyns_type) :: this - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'readParams' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: temp1d(0:mxpft) ! temporary to read in parameter - real(r8) :: temp2d(0:mxpft,nvegwcs) ! temporary to read in parameter - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - ! read in parameters - - - call params_inst%allocParams() - - tString = "krmax" - call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%krmax=temp1d - tString = "psi_soil_ref" - call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%psi_soil_ref=temp1d - tString = "lmr_intercept_atkin" - call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%lmr_intercept_atkin=temp1d - tString = "kmax" - call ncd_io(varname=trim(tString),data=temp2d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%kmax=temp2d - tString = "psi50" - call ncd_io(varname=trim(tString),data=temp2d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%psi50=temp2d - tString = "ck" - call ncd_io(varname=trim(tString),data=temp2d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%ck=temp2d - - end subroutine readParams - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag) - ! - ! !USES: - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_double, ncd_int, ncd_inqvdlen - use restUtilMod - ! - ! !ARGUMENTS: - class(photosyns_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - logical :: readvar ! determine if variable is on initial file - !----------------------------------------------------------------------- - - call restartvar(ncid=ncid, flag=flag, varname='GSSUN', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='sunlit leaf stomatal conductance', units='umol H20/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%gs_mol_sun_patch) - - call restartvar(ncid=ncid, flag=flag, varname='GSSHA', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='shaded leaf stomatal conductance', units='umol H20/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%gs_mol_sha_patch) - - call restartvar(ncid=ncid, flag=flag, varname='lnca', xtype=ncd_double, & - dim1name='pft', long_name='leaf N concentration', units='gN leaf/m^2', & - interpinic_flag='interp', readvar=readvar, data=this%lnca_patch) - - if(use_luna) then - call restartvar(ncid=ncid, flag=flag, varname='vcmx25_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Maximum carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & - interpinic_flag='interp', readvar=readvar, data=this%vcmx25_z_patch) - call restartvar(ncid=ncid, flag=flag, varname='jmx25_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Maximum carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & - interpinic_flag='interp', readvar=readvar, data=this%jmx25_z_patch) - call restartvar(ncid=ncid, flag=flag, varname='pnlc_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='proportion of leaf nitrogen allocated for light capture', units='unitless', & - interpinic_flag='interp', readvar=readvar, data=this%pnlc_z_patch ) - call restartvar(ncid=ncid, flag=flag, varname='enzs_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='enzyme decay status during stress: 1.0-fully active; 0.0-all decayed', units='unitless', & - interpinic_flag='interp', readvar=readvar, data=this%enzs_z_patch ) - call restartvar(ncid=ncid, flag=flag, varname='gpp24', xtype=ncd_double, & - dim1name='pft', long_name='accumulative gross primary production', units='umol CO2/m**2 ground/day', & - interpinic_flag='interp', readvar=readvar, data=this%fpsn24_patch) - endif - call restartvar(ncid=ncid, flag=flag, varname='vcmx25t', xtype=ncd_double, & - dim1name='pft', long_name='canopy profile of vcmax25', & - units='umol/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%luvcmax25top_patch) - - call restartvar(ncid=ncid, flag=flag, varname='jmx25t', xtype=ncd_double, & - dim1name='pft', long_name='canopy profile of jmax', & - units='umol/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%lujmax25top_patch) - - call restartvar(ncid=ncid, flag=flag, varname='tpu25t', xtype=ncd_double, & - dim1name='pft', long_name='canopy profile of tpu', & - units='umol/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%lutpu25top_patch) - - end subroutine Restart - -end module PhotosynthesisMod diff --git a/src/biogeophys/QSatMod.F90 b/src/biogeophys/QSatMod.F90 index 0b1819e467..76d1a40689 100644 --- a/src/biogeophys/QSatMod.F90 +++ b/src/biogeophys/QSatMod.F90 @@ -12,7 +12,6 @@ module QSatMod ! ! !PUBLIC MEMBER FUNCTIONS: public :: QSat - public :: rhoSat !----------------------------------------------------------------------- ! For water vapor (temperature range 0C-100C) @@ -123,45 +122,4 @@ subroutine QSat (T, p, es, esdT, qs, qsdT) end subroutine QSat - - -!------------------------------------------------------------------------------- - subroutine rhoSat(T, rho, rhodT) - ! compute the saturated vapor pressure density and its derivative against the temperature - ! jyt - use clm_varcon, only: rwat - use shr_const_mod, only: SHR_CONST_TKFRZ - - implicit none - real(r8), intent(in) :: T - real(r8), intent(out) :: rho - real(r8), optional, intent(out) :: rhodT - - - !------------------ - - real(r8) :: T_limit - real(r8) :: td, es, esdT - - T_limit = T - SHR_CONST_TKFRZ - if (T_limit > 100.0_r8) T_limit=100.0_r8 - if (T_limit < -75.0_r8) T_limit=-75.0_r8 - - td = T_limit - if (td >= 0.0_r8) then - es = a0 + td*(a1 + td*(a2 + td*(a3 + td*(a4 & - + td*(a5 + td*(a6 + td*(a7 + td*a8))))))) - esdT = b0 + td*(b1 + td*(b2 + td*(b3 + td*(b4 & - + td*(b5 + td*(b6 + td*(b7 + td*b8))))))) - else - es = c0 + td*(c1 + td*(c2 + td*(c3 + td*(c4 & - + td*(c5 + td*(c6 + td*(c7 + td*c8))))))) - esdT = d0 + td*(d1 + td*(d2 + td*(d3 + td*(d4 & - + td*(d5 + td*(d6 + td*(d7 + td*d8))))))) - endif - - es = es * 100._r8 ! pa - rho = es/(rwat*T) !kg m^-3 - if(present(rhodT))rhodT= esdT/(rwat*T)-rho/T !kg m^-3 K^-1 - end subroutine rhoSat end module QSatMod diff --git a/src/biogeophys/RootBiophysMod.F90 b/src/biogeophys/RootBiophysMod.F90 deleted file mode 100644 index ba05705614..0000000000 --- a/src/biogeophys/RootBiophysMod.F90 +++ /dev/null @@ -1,332 +0,0 @@ -module RootBiophysMod - -#include "shr_assert.h" - - !-------------------------------------------------------------------------------------- - ! DESCRIPTION: - ! module contains subroutine for root biophysics - ! - ! HISTORY - ! created by Jinyun Tang, Mar 1st, 2014 - implicit none - private - ! - public :: init_vegrootfr - public :: init_rootprof - - integer, private, parameter :: zeng_2001_root = 0 !the zeng 2001 root profile function - integer, private, parameter :: jackson_1996_root = 1 !the jackson 1996 root profile function - integer, private, parameter :: koven_exp_root = 2 !the koven exponential root profile function - - integer, public :: rooting_profile_method_water !select the type of rooting profile parameterization for water - integer, public :: rooting_profile_method_carbon !select the type of rooting profile parameterization for carbon - integer, public :: rooting_profile_varindex_water !select the variant number of rooting profile parameterization for water - integer, public :: rooting_profile_varindex_carbon !select the variant number of rooting profile parameterization for carbon - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !-------------------------------------------------------------------------------------- - -contains - - !-------------------------------------------------------------------------------------- - subroutine init_rootprof(NLFilename) - ! - !DESCRIPTION - ! initialize methods for root profile calculation - - ! !USES: - use abortutils , only : endrun - use fileutils , only : getavu, relavu - use spmdMod , only : mpicom, masterproc - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - use clm_nlUtilsMod , only : find_nlgroup_name - - ! !ARGUMENTS: - !------------------------------------------------------------------------------ - implicit none - character(len=*), intent(in) :: NLFilename - - integer :: nu_nml ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - character(*), parameter :: subName = "('init_rootprof')" - - !----------------------------------------------------------------------- - -! MUST agree with name in namelist and read statement - namelist /rooting_profile_inparm/ rooting_profile_method_water, rooting_profile_method_carbon, & - rooting_profile_varindex_water, rooting_profile_varindex_carbon - - ! Default values for namelist - - rooting_profile_method_water = zeng_2001_root - rooting_profile_method_carbon = zeng_2001_root - rooting_profile_varindex_water = 1 - rooting_profile_varindex_carbon = 2 - - ! Read rooting_profile namelist - if (masterproc) then - nu_nml = getavu() - open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - call find_nlgroup_name(nu_nml, 'rooting_profile_inparm', status=nml_error) - if (nml_error == 0) then - read(nu_nml, nml=rooting_profile_inparm,iostat=nml_error) - if (nml_error /= 0) then - call endrun(subname // ':: ERROR reading rooting_profile namelist') - end if - else - call endrun(subname // ':: ERROR finding rooting_profile namelist') - end if - close(nu_nml) - call relavu( nu_nml ) - - endif - - call shr_mpi_bcast(rooting_profile_method_water, mpicom) - call shr_mpi_bcast(rooting_profile_method_carbon, mpicom) - call shr_mpi_bcast(rooting_profile_varindex_water, mpicom) - call shr_mpi_bcast(rooting_profile_varindex_carbon, mpicom) - - if (masterproc) then - - write(iulog,*) ' ' - write(iulog,*) 'rooting_profile settings:' - write(iulog,*) ' rooting_profile_method_water = ',rooting_profile_method_water - if ( rooting_profile_method_water == jackson_1996_root )then - write(iulog,*) ' (rooting_profile_varindex_water = ',rooting_profile_varindex_water, ')' - end if - write(iulog,*) ' rooting_profile_method_carbon = ',rooting_profile_method_carbon - if ( rooting_profile_method_carbon == jackson_1996_root )then - write(iulog,*) ' (rooting_profile_varindex_carbon = ',rooting_profile_varindex_carbon, ')' - end if - - endif - - end subroutine init_rootprof - - !-------------------------------------------------------------------------------------- - subroutine init_vegrootfr(bounds, nlevsoi, nlevgrnd, rootfr, water_carbon) - ! - !DESCRIPTION - !initialize plant root profiles - ! - ! USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_assert_mod , only : shr_assert - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! bounds - integer, intent(in) :: nlevsoi ! number of hydactive layers - integer, intent(in) :: nlevgrnd ! number of soil layers - real(r8), intent(out):: rootfr(bounds%begp: , 1: ) ! root fraction by layer - character(len=*), intent(in) :: water_carbon ! roots for water or carbon - - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'init_vegrootfr' ! subroutine name - integer :: c,p - integer :: rooting_profile_method ! Rooting profile method to use - integer :: rooting_profile_varidx ! Rooting profile variant index to use - !------------------------------------------------------------------------ - - SHR_ASSERT_ALL((ubound(rootfr) == (/bounds%endp, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - if ( water_carbon == 'water' ) then - rooting_profile_method = rooting_profile_method_water - rooting_profile_varidx = rooting_profile_varindex_water - else if (water_carbon == 'carbon') then - rooting_profile_method = rooting_profile_method_carbon - rooting_profile_varidx = rooting_profile_varindex_carbon - else - call endrun(subname // ':: input type can only be water or carbon = '//water_carbon ) - end if - - select case( rooting_profile_method ) - - case (zeng_2001_root) - rootfr(bounds%begp:bounds%endp, 1 : nlevsoi) = zeng2001_rootfr(bounds, nlevsoi) - case (jackson_1996_root) - rootfr(bounds%begp:bounds%endp, 1 : nlevsoi) = jackson1996_rootfr(bounds, nlevsoi, rooting_profile_varidx, water_carbon) - case (koven_exp_root) - rootfr(bounds%begp:bounds%endp, 1 : nlevsoi) = exponential_rootfr(bounds, nlevsoi) - case default - call endrun(subname // ':: a root fraction function must be specified!') - end select - rootfr(bounds%begp:bounds%endp,nlevsoi+1:nlevgrnd)=0._r8 - - ! shift roots up above bedrock boundary (distribute equally to each layer) - ! may not matter if normalized later - do p = bounds%begp,bounds%endp - c = patch%column(p) - rootfr(p,1:col%nbedrock(c)) = rootfr(p,1:col%nbedrock(c)) & - + sum(rootfr(p,col%nbedrock(c)+1:nlevsoi))/real(col%nbedrock(c)) - rootfr(p,col%nbedrock(c)+1:nlevsoi) = 0._r8 - enddo - end subroutine init_vegrootfr - - !------------------------------------------------------------------------- - function zeng2001_rootfr(bounds, ubj) result(rootfr) - ! - ! DESCRIPTION - ! compute root profile for soil water uptake - ! using equation from Zeng 2001, J. Hydrometeorology - ! - ! USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_assert_mod , only : shr_assert - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use pftconMod , only : pftcon - use PatchType , only : patch - use ColumnType , only : col - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: ubj ! ubnd - ! - ! !RESULT - real(r8) :: rootfr(bounds%begp:bounds%endp , 1:ubj ) ! - ! - ! !LOCAL VARIABLES: - integer :: p, lev, c - !------------------------------------------------------------------------ - - !(computing from surface, d is depth in meter): - ! Y = 1 -1/2 (exp(-ad)+exp(-bd) under the constraint that - ! Y(d =0.1m) = 1-beta^(10 cm) and Y(d=d_obs)=0.99 with - ! beta & d_obs given in Zeng et al. (1998). - - do p = bounds%begp,bounds%endp - - if (.not. patch%is_fates(p)) then - c = patch%column(p) - do lev = 1, ubj-1 - rootfr(p,lev) = .5_r8*( & - exp(-pftcon%roota_par(patch%itype(p)) * col%zi(c,lev-1)) & - + exp(-pftcon%rootb_par(patch%itype(p)) * col%zi(c,lev-1)) & - - exp(-pftcon%roota_par(patch%itype(p)) * col%zi(c,lev )) & - - exp(-pftcon%rootb_par(patch%itype(p)) * col%zi(c,lev )) ) - end do - rootfr(p,ubj) = .5_r8*( & - exp(-pftcon%roota_par(patch%itype(p)) * col%zi(c,ubj-1)) & - + exp(-pftcon%rootb_par(patch%itype(p)) * col%zi(c,ubj-1)) ) - - else - rootfr(p,1:ubj) = 0._r8 - endif - - enddo - return - - end function zeng2001_rootfr - - !------------------------------------------------------------------------- - function jackson1996_rootfr(bounds, ubj, varindx, water_carbon) result(rootfr) - ! - ! DESCRIPTION - ! compute root profile for soil water uptake - ! using equation from Jackson et al. 1996, Oec. - ! - ! USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_assert_mod , only : shr_assert - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use pftconMod , only : pftcon - use PatchType , only : patch - use ColumnType , only : col - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: ubj ! ubnd - integer , intent(in) :: varindx ! variant index - character(len=*) , intent(in) :: water_carbon ! roots for water or carbon - ! - ! !RESULT - real(r8) :: rootfr(bounds%begp:bounds%endp , 1:ubj ) ! - ! - ! !LOCAL VARIABLES: - real(r8), parameter :: m_to_cm = 1.e2_r8 - real(r8) :: beta !patch specific shape parameter - integer :: p, lev, c - !------------------------------------------------------------------------ - - !(computing from surface, d is depth in centimeters): - ! Y = (1 - beta^d); beta given in Jackson et al. (1996). - - rootfr(bounds%begp:bounds%endp, :) = 0._r8 - do p = bounds%begp,bounds%endp - c = patch%column(p) - if (.not.patch%is_fates(p)) then - beta = pftcon%rootprof_beta(patch%itype(p),varindx) - do lev = 1, ubj - rootfr(p,lev) = ( & - beta ** (col%zi(c,lev-1)*m_to_cm) - & - beta ** (col%zi(c,lev)*m_to_cm) ) - end do - else - rootfr(p,:) = 0. - endif - - enddo - return - - end function jackson1996_rootfr - - !------------------------------------------------------------------------- - function exponential_rootfr(bounds, ubj) result(rootfr) - ! - ! DESCRIPTION - ! compute root profile for soil water uptake - ! using equation from Koven - ! - ! USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_assert_mod , only : shr_assert - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use pftconMod , only : pftcon - use PatchType , only : patch - use ColumnType , only : col - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: ubj ! ubnd - ! - ! !RESULT - real(r8) :: rootfr(bounds%begp:bounds%endp , 1:ubj ) ! - ! - ! !LOCAL VARIABLES: - real(r8), parameter :: rootprof_exp = 3. ! how steep profile is for root C inputs (1/ e-folding depth) (1/m) - real(r8) :: norm - integer :: p, lev, c - - !------------------------------------------------------------------------ - - rootfr(bounds%begp:bounds%endp, :) = 0._r8 - do p = bounds%begp,bounds%endp - c = patch%column(p) - if (.not.patch%is_fates(p)) then - do lev = 1, ubj - rootfr(p,lev) = exp(-rootprof_exp * col%z(c,lev)) * col%dz(c,lev) - end do - else - rootfr(p,1) = 0. - endif - norm = -1./rootprof_exp * (exp(-rootprof_exp * col%z(c,ubj)) - 1._r8) - rootfr(p,:) = rootfr(p,:) / norm - - enddo - - return - - end function exponential_rootfr - -end module RootBiophysMod diff --git a/src/biogeophys/SnowSnicarMod.F90 b/src/biogeophys/SnowSnicarMod.F90 deleted file mode 100644 index fe731e5195..0000000000 --- a/src/biogeophys/SnowSnicarMod.F90 +++ /dev/null @@ -1,300 +0,0 @@ -module SnowSnicarMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculate albedo of snow containing impurities - ! and the evolution of snow effective radius - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_flush - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog - use clm_varcon , only : namec , tfrz - use shr_const_mod , only : SHR_CONST_RHOICE - use abortutils , only : endrun - use decompMod , only : bounds_type - use AerosolMod , only : snw_rds_min - ! - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: SnowAge_init ! Initial read in of snow-aging file - public :: SnowOptics_init ! Initial read in of snow-optics file - ! - ! !PUBLIC DATA MEMBERS: - integer, public, parameter :: sno_nbr_aer = 8 ! number of aerosol species in snowpack - ! (indices described above) [nbr] - logical, public, parameter :: DO_SNO_OC = .false. ! parameter to include organic carbon (OC) - ! in snowpack radiative calculations - logical, public, parameter :: DO_SNO_AER = .true. ! parameter to include aerosols in snowpack radiative calculations - - ! !PRIVATE DATA MEMBERS: - integer, parameter :: numrad_snw = 5 ! number of spectral bands used in snow model [nbr] - integer, parameter :: nir_bnd_bgn = 2 ! first band index in near-IR spectrum [idx] - integer, parameter :: nir_bnd_end = 5 ! ending near-IR band index [idx] - - integer, parameter :: idx_Mie_snw_mx = 1471 ! number of effective radius indices used in Mie lookup table [idx] - integer, parameter :: idx_T_max = 11 ! maxiumum temperature index used in aging lookup table [idx] - integer, parameter :: idx_T_min = 1 ! minimum temperature index used in aging lookup table [idx] - integer, parameter :: idx_Tgrd_max = 31 ! maxiumum temperature gradient index used in aging lookup table [idx] - integer, parameter :: idx_Tgrd_min = 1 ! minimum temperature gradient index used in aging lookup table [idx] - integer, parameter :: idx_rhos_max = 8 ! maxiumum snow density index used in aging lookup table [idx] - integer, parameter :: idx_rhos_min = 1 ! minimum snow density index used in aging lookup table [idx] - - integer, parameter :: snw_rds_max_tbl = 1500 ! maximum effective radius defined in Mie lookup table [microns] - integer, parameter :: snw_rds_min_tbl = 30 ! minimium effective radius defined in Mie lookup table [microns] - integer, parameter :: snw_rds_min_int = nint(snw_rds_min) ! minimum allowed snow effective radius as integer [microns] - real(r8), parameter :: snw_rds_max = 1500._r8 ! maximum allowed snow effective radius [microns] - real(r8), parameter :: snw_rds_refrz = 1000._r8 ! effective radius of re-frozen snow [microns] - - real(r8), parameter :: min_snw = 1.0E-30_r8 ! minimum snow mass required for SNICAR RT calculation [kg m-2] - - !real(r8), parameter :: C1_liq_Brun89 = 1.28E-17_r8 ! constant for liquid water grain growth [m3 s-1], - ! from Brun89 - real(r8), parameter :: C1_liq_Brun89 = 0._r8 ! constant for liquid water grain growth [m3 s-1], - ! from Brun89: zeroed to accomodate dry snow aging - real(r8), parameter :: C2_liq_Brun89 = 4.22E-13_r8 ! constant for liquid water grain growth [m3 s-1], - ! from Brun89: corrected for LWC in units of percent - - real(r8), parameter :: tim_cns_bc_rmv = 2.2E-8_r8 ! time constant for removal of BC in snow on sea-ice - ! [s-1] (50% mass removal/year) - real(r8), parameter :: tim_cns_oc_rmv = 2.2E-8_r8 ! time constant for removal of OC in snow on sea-ice - ! [s-1] (50% mass removal/year) - real(r8), parameter :: tim_cns_dst_rmv = 2.2E-8_r8 ! time constant for removal of dust in snow on sea-ice - ! [s-1] (50% mass removal/year) - - ! scaling of the snow aging rate (tuning option): - logical :: flg_snoage_scl = .false. ! flag for scaling the snow aging rate by some arbitrary factor - real(r8), parameter :: xdrdt = 1.0_r8 ! arbitrary factor applied to snow aging rate - - ! snow and aerosol Mie parameters: - ! (arrays declared here, but are set in iniTimeConst) - ! (idx_Mie_snw_mx is number of snow radii with defined parameters (i.e. from 30um to 1500um)) - - ! direct-beam weighted ice optical properties - real(r8) :: ss_alb_snw_drc(idx_Mie_snw_mx,numrad_snw) - real(r8) :: asm_prm_snw_drc(idx_Mie_snw_mx,numrad_snw) - real(r8) :: ext_cff_mss_snw_drc(idx_Mie_snw_mx,numrad_snw) - - ! diffuse radiation weighted ice optical properties - real(r8) :: ss_alb_snw_dfs(idx_Mie_snw_mx,numrad_snw) - real(r8) :: asm_prm_snw_dfs(idx_Mie_snw_mx,numrad_snw) - real(r8) :: ext_cff_mss_snw_dfs(idx_Mie_snw_mx,numrad_snw) - - ! hydrophiliic BC - real(r8) :: ss_alb_bc1(numrad_snw) - real(r8) :: asm_prm_bc1(numrad_snw) - real(r8) :: ext_cff_mss_bc1(numrad_snw) - - ! hydrophobic BC - real(r8) :: ss_alb_bc2(numrad_snw) - real(r8) :: asm_prm_bc2(numrad_snw) - real(r8) :: ext_cff_mss_bc2(numrad_snw) - - ! hydrophobic OC - real(r8) :: ss_alb_oc1(numrad_snw) - real(r8) :: asm_prm_oc1(numrad_snw) - real(r8) :: ext_cff_mss_oc1(numrad_snw) - - ! hydrophilic OC - real(r8) :: ss_alb_oc2(numrad_snw) - real(r8) :: asm_prm_oc2(numrad_snw) - real(r8) :: ext_cff_mss_oc2(numrad_snw) - - ! dust species 1: - real(r8) :: ss_alb_dst1(numrad_snw) - real(r8) :: asm_prm_dst1(numrad_snw) - real(r8) :: ext_cff_mss_dst1(numrad_snw) - - ! dust species 2: - real(r8) :: ss_alb_dst2(numrad_snw) - real(r8) :: asm_prm_dst2(numrad_snw) - real(r8) :: ext_cff_mss_dst2(numrad_snw) - - ! dust species 3: - real(r8) :: ss_alb_dst3(numrad_snw) - real(r8) :: asm_prm_dst3(numrad_snw) - real(r8) :: ext_cff_mss_dst3(numrad_snw) - - ! dust species 4: - real(r8) :: ss_alb_dst4(numrad_snw) - real(r8) :: asm_prm_dst4(numrad_snw) - real(r8) :: ext_cff_mss_dst4(numrad_snw) - - ! best-fit parameters for snow aging defined over: - ! 11 temperatures from 225 to 273 K - ! 31 temperature gradients from 0 to 300 K/m - ! 8 snow densities from 0 to 350 kg/m3 - ! (arrays declared here, but are set in iniTimeConst) - real(r8), pointer :: snowage_tau(:,:,:) ! (idx_rhos_max,idx_Tgrd_max,idx_T_max) - real(r8), pointer :: snowage_kappa(:,:,:) ! (idx_rhos_max,idx_Tgrd_max,idx_T_max) - real(r8), pointer :: snowage_drdt0(:,:,:) ! idx_rhos_max,idx_Tgrd_max,idx_T_max) - ! - ! !REVISION HISTORY: - ! Created by Mark Flanner - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine SnowOptics_init( ) - - use fileutils , only : getfil - use CLM_varctl , only : fsnowoptics - use spmdMod , only : masterproc - use ncdio_pio , only : file_desc_t, ncd_io, ncd_pio_openfile, ncd_pio_closefile - - type(file_desc_t) :: ncid ! netCDF file id - character(len=256) :: locfn ! local filename - character(len= 32) :: subname = 'SnowOptics_init' ! subroutine name - integer :: ier ! error status - - return ! return early - ! - ! Open optics file: - if(masterproc) write(iulog,*) 'Attempting to read snow optical properties .....' - call getfil (fsnowoptics, locfn, 0) - call ncd_pio_openfile(ncid, locfn, 0) - if(masterproc) write(iulog,*) subname,trim(fsnowoptics) - - ! direct-beam snow Mie parameters: - call ncd_io('ss_alb_ice_drc', ss_alb_snw_drc, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_ice_drc',asm_prm_snw_drc, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_ice_drc', ext_cff_mss_snw_drc, 'read', ncid, posNOTonfile=.true.) - - ! diffuse snow Mie parameters - call ncd_io( 'ss_alb_ice_dfs', ss_alb_snw_dfs, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_ice_dfs', asm_prm_snw_dfs, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_ice_dfs', ext_cff_mss_snw_dfs, 'read', ncid, posNOTonfile=.true.) - - ! BC species 1 Mie parameters - call ncd_io( 'ss_alb_bcphil', ss_alb_bc1, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_bcphil', asm_prm_bc1, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_bcphil', ext_cff_mss_bc1, 'read', ncid, posNOTonfile=.true.) - - ! BC species 2 Mie parameters - call ncd_io( 'ss_alb_bcphob', ss_alb_bc2, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_bcphob', asm_prm_bc2, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_bcphob', ext_cff_mss_bc2, 'read', ncid, posNOTonfile=.true.) - - ! OC species 1 Mie parameters - call ncd_io( 'ss_alb_ocphil', ss_alb_oc1, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_ocphil', asm_prm_oc1, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_ocphil', ext_cff_mss_oc1, 'read', ncid, posNOTonfile=.true.) - - ! OC species 2 Mie parameters - call ncd_io( 'ss_alb_ocphob', ss_alb_oc2, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_ocphob', asm_prm_oc2, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_ocphob', ext_cff_mss_oc2, 'read', ncid, posNOTonfile=.true.) - - ! dust species 1 Mie parameters - call ncd_io( 'ss_alb_dust01', ss_alb_dst1, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_dust01', asm_prm_dst1, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_dust01', ext_cff_mss_dst1, 'read', ncid, posNOTonfile=.true.) - - ! dust species 2 Mie parameters - call ncd_io( 'ss_alb_dust02', ss_alb_dst2, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_dust02', asm_prm_dst2, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_dust02', ext_cff_mss_dst2, 'read', ncid, posNOTonfile=.true.) - - ! dust species 3 Mie parameters - call ncd_io( 'ss_alb_dust03', ss_alb_dst3, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_dust03', asm_prm_dst3, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_dust03', ext_cff_mss_dst3, 'read', ncid, posNOTonfile=.true.) - - ! dust species 4 Mie parameters - call ncd_io( 'ss_alb_dust04', ss_alb_dst4, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_dust04', asm_prm_dst4, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_dust04', ext_cff_mss_dst4, 'read', ncid, posNOTonfile=.true.) - - - call ncd_pio_closefile(ncid) - if (masterproc) then - - write(iulog,*) 'Successfully read snow optical properties' - ! print some diagnostics: - write (iulog,*) 'SNICAR: Mie single scatter albedos for direct-beam ice, rds=100um: ', & - ss_alb_snw_drc(71,1), ss_alb_snw_drc(71,2), ss_alb_snw_drc(71,3), & - ss_alb_snw_drc(71,4), ss_alb_snw_drc(71,5) - write (iulog,*) 'SNICAR: Mie single scatter albedos for diffuse ice, rds=100um: ', & - ss_alb_snw_dfs(71,1), ss_alb_snw_dfs(71,2), ss_alb_snw_dfs(71,3), & - ss_alb_snw_dfs(71,4), ss_alb_snw_dfs(71,5) - if (DO_SNO_OC) then - write (iulog,*) 'SNICAR: Including OC aerosols from snow radiative transfer calculations' - else - write (iulog,*) 'SNICAR: Excluding OC aerosols from snow radiative transfer calculations' - endif - write (iulog,*) 'SNICAR: Mie single scatter albedos for hydrophillic BC: ', & - ss_alb_bc1(1), ss_alb_bc1(2), ss_alb_bc1(3), ss_alb_bc1(4), ss_alb_bc1(5) - write (iulog,*) 'SNICAR: Mie single scatter albedos for hydrophobic BC: ', & - ss_alb_bc2(1), ss_alb_bc2(2), ss_alb_bc2(3), ss_alb_bc2(4), ss_alb_bc2(5) - if (DO_SNO_OC) then - write (iulog,*) 'SNICAR: Mie single scatter albedos for hydrophillic OC: ', & - ss_alb_oc1(1), ss_alb_oc1(2), ss_alb_oc1(3), ss_alb_oc1(4), ss_alb_oc1(5) - write (iulog,*) 'SNICAR: Mie single scatter albedos for hydrophobic OC: ', & - ss_alb_oc2(1), ss_alb_oc2(2), ss_alb_oc2(3), ss_alb_oc2(4), ss_alb_oc2(5) - endif - write (iulog,*) 'SNICAR: Mie single scatter albedos for dust species 1: ', & - ss_alb_dst1(1), ss_alb_dst1(2), ss_alb_dst1(3), ss_alb_dst1(4), ss_alb_dst1(5) - write (iulog,*) 'SNICAR: Mie single scatter albedos for dust species 2: ', & - ss_alb_dst2(1), ss_alb_dst2(2), ss_alb_dst2(3), ss_alb_dst2(4), ss_alb_dst2(5) - write (iulog,*) 'SNICAR: Mie single scatter albedos for dust species 3: ', & - ss_alb_dst3(1), ss_alb_dst3(2), ss_alb_dst3(3), ss_alb_dst3(4), ss_alb_dst3(5) - write (iulog,*) 'SNICAR: Mie single scatter albedos for dust species 4: ', & - ss_alb_dst4(1), ss_alb_dst4(2), ss_alb_dst4(3), ss_alb_dst4(4), ss_alb_dst4(5) - write(iulog,*) - end if - - end subroutine SnowOptics_init - - !----------------------------------------------------------------------- - subroutine SnowAge_init( ) - use CLM_varctl , only : fsnowaging - use fileutils , only : getfil - use spmdMod , only : masterproc - use ncdio_pio , only : file_desc_t, ncd_io, ncd_pio_openfile, ncd_pio_closefile - - type(file_desc_t) :: ncid ! netCDF file id - character(len=256) :: locfn ! local filename - character(len= 32) :: subname = 'SnowOptics_init' ! subroutine name - integer :: varid ! netCDF id's - integer :: ier ! error status - - ! Open snow aging (effective radius evolution) file: - allocate(snowage_tau(idx_rhos_max,idx_Tgrd_max,idx_T_max)) - allocate(snowage_kappa(idx_rhos_max,idx_Tgrd_max,idx_T_max)) - allocate(snowage_drdt0(idx_rhos_max,idx_Tgrd_max,idx_T_max)) - - return ! return early - if(masterproc) write(iulog,*) 'Attempting to read snow aging parameters .....' - call getfil (fsnowaging, locfn, 0) - call ncd_pio_openfile(ncid, locfn, 0) - if(masterproc) write(iulog,*) subname,trim(fsnowaging) - - ! snow aging parameters - - call ncd_io('tau', snowage_tau, 'read', ncid, posNOTonfile=.true.) - call ncd_io('kappa', snowage_kappa, 'read', ncid, posNOTonfile=.true.) - call ncd_io('drdsdt0', snowage_drdt0, 'read', ncid, posNOTonfile=.true.) - - call ncd_pio_closefile(ncid) - if (masterproc) then - - write(iulog,*) 'Successfully read snow aging properties' - - ! print some diagnostics: - write (iulog,*) 'SNICAR: snowage tau for T=263K, dTdz = 100 K/m, rhos = 150 kg/m3: ', snowage_tau(3,11,9) - write (iulog,*) 'SNICAR: snowage kappa for T=263K, dTdz = 100 K/m, rhos = 150 kg/m3: ', snowage_kappa(3,11,9) - write (iulog,*) 'SNICAR: snowage dr/dt_0 for T=263K, dTdz = 100 K/m, rhos = 150 kg/m3: ', snowage_drdt0(3,11,9) - endif - - end subroutine SnowAge_init - - end module SnowSnicarMod diff --git a/src/biogeophys/SoilHydrologyInitTimeConstMod.F90 b/src/biogeophys/SoilHydrologyInitTimeConstMod.F90 deleted file mode 100644 index b399b1042a..0000000000 --- a/src/biogeophys/SoilHydrologyInitTimeConstMod.F90 +++ /dev/null @@ -1,565 +0,0 @@ -module SoilHydrologyInitTimeConstMod - - !------------------------------------------------------------------------------ - ! DESCRIPTION: - ! Initialize time constant variables for SoilHydrologyType - ! - ! !USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use SoilHydrologyType , only : soilhydrology_type - use LandunitType , only : lun - use ColumnType , only : col - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: SoilHydrologyInitTimeConst - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: initSoilParVIC ! Convert default CLM soil properties to VIC parameters - private :: initCLMVICMap ! Initialize map from VIC to CLM layers - private :: linear_interp ! function for linear interperation - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - ! -contains - - !----------------------------------------------------------------------- - subroutine SoilHydrologyInitTimeConst(bounds, soilhydrology_inst) - ! - ! !USES: - use shr_const_mod , only : shr_const_pi - use shr_spfn_mod , only : shr_spfn_erf - use abortutils , only : endrun - use clm_varctl , only : fsurdat, paramfile, iulog, use_vichydro, soil_layerstruct - use clm_varpar , only : nlevsoifl, toplev_equalspace - use clm_varpar , only : nlevsoi, nlevgrnd, nlevsno, nlevlak, nlevurb, nlayer, nlayert - use clm_varcon , only : zsoi, dzsoi, zisoi, spval, nlvic, dzvic, pc, grlnd - use clm_varcon , only : aquifer_water_baseline - use landunit_varcon , only : istwet, istsoil, istdlak, istcrop, istice_mec - use column_varcon , only : icol_shadewall, icol_road_perv, icol_road_imperv, icol_roof, icol_sunwall - use fileutils , only : getfil - use organicFileMod , only : organicrd - use ncdio_pio , only : file_desc_t, ncd_io, ncd_pio_openfile, ncd_pio_closefile - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - ! - ! !LOCAL VARIABLES: - integer :: p,c,j,l,g,lev,nlevs - integer :: ivic,ivicstrt,ivicend - real(r8) :: maxslope, slopemax, minslope - real(r8) :: d, fd, dfdd, slope0,slopebeta - real(r8) ,pointer :: tslope(:) - logical :: readvar - type(file_desc_t) :: ncid - character(len=256) :: locfn - real(r8) :: clay,sand ! temporaries - real(r8) :: om_frac ! organic matter fraction - real(r8) :: organic_max ! organic matter (kg/m3) where soil is assumed to act like peat - real(r8) ,pointer :: b2d (:) ! read in - VIC b - real(r8) ,pointer :: ds2d (:) ! read in - VIC Ds - real(r8) ,pointer :: dsmax2d (:) ! read in - VIC Dsmax - real(r8) ,pointer :: ws2d (:) ! read in - VIC Ws - real(r8), pointer :: sandcol (:,:) ! column level sand fraction for calculating VIC parameters - real(r8), pointer :: claycol (:,:) ! column level clay fraction for calculating VIC parameters - real(r8), pointer :: om_fraccol (:,:) ! column level organic matter fraction for calculating VIC parameters - real(r8) ,pointer :: sand3d (:,:) ! read in - soil texture: percent sand - real(r8) ,pointer :: clay3d (:,:) ! read in - soil texture: percent clay - real(r8) ,pointer :: organic3d (:,:) ! read in - organic matter: kg/m3 - real(r8) ,pointer :: zisoifl (:) ! original soil interface depth - real(r8) ,pointer :: zsoifl (:) ! original soil midpoint - real(r8) ,pointer :: dzsoifl (:) ! original soil thickness - !----------------------------------------------------------------------- - ! ----------------------------------------------------------------- - ! Initialize frost table - ! ----------------------------------------------------------------- - - soilhydrology_inst%wa_col(bounds%begc:bounds%endc) = aquifer_water_baseline - soilhydrology_inst%zwt_col(bounds%begc:bounds%endc) = 0._r8 - - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (.not. lun%lakpoi(l)) then !not lake - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_road_perv) then - ! Note that the following hard-coded constants (on the next two lines) - ! seem implicitly related to aquifer_water_baseline - soilhydrology_inst%wa_col(c) = 4800._r8 - soilhydrology_inst%zwt_col(c) = (25._r8 + col%zi(c,nlevsoi)) - soilhydrology_inst%wa_col(c)/0.2_r8 /1000._r8 ! One meter below soil column - else - soilhydrology_inst%wa_col(c) = spval - soilhydrology_inst%zwt_col(c) = spval - end if - ! initialize frost_table, zwt_perched - soilhydrology_inst%zwt_perched_col(c) = spval - soilhydrology_inst%frost_table_col(c) = spval - else - ! Note that the following hard-coded constants (on the next two lines) seem - ! implicitly related to aquifer_water_baseline - soilhydrology_inst%wa_col(c) = 4000._r8 - soilhydrology_inst%zwt_col(c) = (25._r8 + col%zi(c,nlevsoi)) - soilhydrology_inst%wa_col(c)/0.2_r8 /1000._r8 ! One meter below soil column - ! initialize frost_table, zwt_perched to bottom of soil column - soilhydrology_inst%zwt_perched_col(c) = col%zi(c,nlevsoi) - soilhydrology_inst%frost_table_col(c) = col%zi(c,nlevsoi) - end if - end if - end do - - ! Initialize VIC variables - - if (use_vichydro) then - - allocate(b2d (bounds%begg:bounds%endg)) - allocate(ds2d (bounds%begg:bounds%endg)) - allocate(dsmax2d (bounds%begg:bounds%endg)) - allocate(ws2d (bounds%begg:bounds%endg)) - allocate(sandcol (bounds%begc:bounds%endc,1:nlevgrnd )) - allocate(claycol (bounds%begc:bounds%endc,1:nlevgrnd )) - allocate(om_fraccol (bounds%begc:bounds%endc,1:nlevgrnd )) - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - call ncd_io(ncid=ncid, varname='binfl', flag='read', data=b2d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: binfl NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - call ncd_io(ncid=ncid, varname='Ds', flag='read', data=ds2d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: Ds NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - call ncd_io(ncid=ncid, varname='Dsmax', flag='read', data=dsmax2d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: Dsmax NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - call ncd_io(ncid=ncid, varname='Ws', flag='read', data=ws2d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: Ws NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - call ncd_pio_closefile(ncid) - - !define the depth of VIC soil layers here - nlvic(1) = 3 - nlvic(2) = toplev_equalspace - nlvic(1) - nlvic(3) = nlevsoi - (nlvic(1) + nlvic(2)) - - dzvic(:) = 0._r8 - ivicstrt = 1 - - do ivic = 1,nlayer - ivicend = ivicstrt+nlvic(ivic)-1 - do j = ivicstrt,ivicend - dzvic(ivic) = dzvic(ivic)+dzsoi(j) - end do - ivicstrt = ivicend+1 - end do - - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - soilhydrology_inst%b_infil_col(c) = b2d(g) - soilhydrology_inst%ds_col(c) = ds2d(g) - soilhydrology_inst%dsmax_col(c) = dsmax2d(g) - soilhydrology_inst%Wsvic_col(c) = ws2d(g) - end do - - do c = bounds%begc, bounds%endc - soilhydrology_inst%max_infil_col(c) = spval - soilhydrology_inst%i_0_col(c) = spval - do lev = 1, nlayer - soilhydrology_inst%ice_col(c,lev) = spval - soilhydrology_inst%moist_col(c,lev) = spval - soilhydrology_inst%moist_vol_col(c,lev) = spval - soilhydrology_inst%max_moist_col(c,lev) = spval - soilhydrology_inst%porosity_col(c,lev) = spval - soilhydrology_inst%expt_col(c,lev) = spval - soilhydrology_inst%ksat_col(c,lev) = spval - soilhydrology_inst%phi_s_col(c,lev) = spval - soilhydrology_inst%depth_col(c,lev) = spval - sandcol(c,lev) = spval - claycol(c,lev) = spval - om_fraccol(c,lev) = spval - end do - end do - - allocate(sand3d(bounds%begg:bounds%endg,nlevsoifl)) - allocate(clay3d(bounds%begg:bounds%endg,nlevsoifl)) - allocate(organic3d(bounds%begg:bounds%endg,nlevsoifl)) - - call organicrd(organic3d) - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - call ncd_io(ncid=ncid, varname='PCT_SAND', flag='read', data=sand3d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: PCT_SAND NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - call ncd_io(ncid=ncid, varname='PCT_CLAY', flag='read', data=clay3d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: PCT_CLAY NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - call ncd_pio_closefile(ncid) - - ! Determine organic_max - call getfil (paramfile, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_io(ncid=ncid, varname='organic_max', flag='read', data=organic_max, readvar=readvar) - if ( .not. readvar ) then - call endrun(msg=' ERROR: organic_max not on param file'//errMsg(sourcefile, __LINE__)) - end if - call ncd_pio_closefile(ncid) - - ! get original soil depths to be used in interpolation of sand and clay - allocate(zsoifl(1:nlevsoifl), zisoifl(0:nlevsoifl), dzsoifl(1:nlevsoifl)) - do j = 1, nlevsoifl - zsoifl(j) = 0.025*(exp(0.5_r8*(j-0.5_r8))-1._r8) !node depths - enddo - - dzsoifl(1) = 0.5_r8*(zsoifl(1)+zsoifl(2)) !thickness b/n two interfaces - do j = 2,nlevsoifl-1 - dzsoifl(j)= 0.5_r8*(zsoifl(j+1)-zsoifl(j-1)) - enddo - dzsoifl(nlevsoifl) = zsoifl(nlevsoifl)-zsoifl(nlevsoifl-1) - - zisoifl(0) = 0._r8 - do j = 1, nlevsoifl-1 - zisoifl(j) = 0.5_r8*(zsoifl(j)+zsoifl(j+1)) !interface depths - enddo - zisoifl(nlevsoifl) = zsoifl(nlevsoifl) + 0.5_r8*dzsoifl(nlevsoifl) - - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - l = col%landunit(c) - - if (lun%itype(l) /= istdlak) then ! soil columns of both urban and non-urban types - if (lun%itype(l)==istwet .or. lun%itype(l)==istice_mec) then - ! do nothing - else if (lun%urbpoi(l) .and. (col%itype(c) /= icol_road_perv) .and. (col%itype(c) /= icol_road_imperv) )then - ! do nothing - else - do lev = 1,nlevgrnd - if ( soil_layerstruct /= '10SL_3.5m' )then - write(iulog,*) 'Setting clay, sand, organic, in Soil Hydrology for VIC' - if (lev .eq. 1) then - clay = clay3d(g,1) - sand = sand3d(g,1) - om_frac = organic3d(g,1)/organic_max - else if (lev <= nlevsoi) then - do j = 1,nlevsoifl-1 - if (zisoi(lev) >= zisoifl(j) .AND. zisoi(lev) < zisoifl(j+1)) then - clay = clay3d(g,j+1) - sand = sand3d(g,j+1) - om_frac = organic3d(g,j+1)/organic_max - endif - end do - else - clay = clay3d(g,nlevsoifl) - sand = sand3d(g,nlevsoifl) - om_frac = 0._r8 - endif - else - ! duplicate clay and sand values from 10th soil layer - if (lev <= nlevsoi) then - clay = clay3d(g,lev) - sand = sand3d(g,lev) - om_frac = (organic3d(g,lev)/organic_max)**2._r8 - else - clay = clay3d(g,nlevsoi) - sand = sand3d(g,nlevsoi) - om_frac = 0._r8 - endif - end if - - if (lun%urbpoi(l)) om_frac = 0._r8 - claycol(c,lev) = clay - sandcol(c,lev) = sand - om_fraccol(c,lev) = om_frac - end do - end if - end if ! end of if not lake - - if (lun%itype(l) /= istdlak) then ! soil columns of both urban and non-urban types - if (lun%urbpoi(l)) then - if (col%itype(c)==icol_sunwall .or. col%itype(c)==icol_shadewall .or. col%itype(c)==icol_roof) then - ! do nothing - else - soilhydrology_inst%depth_col(c, 1:nlayer) = dzvic - soilhydrology_inst%depth_col(c, nlayer+1:nlayert) = col%dz(c, nlevsoi+1:nlevgrnd) - - ! create weights to map soil moisture profiles (10 layer) to 3 layers for VIC hydrology, M.Huang - call initCLMVICMap(c, soilhydrology_inst) - call initSoilParVIC(c, claycol, sandcol, om_fraccol, soilhydrology_inst) - end if - else - soilhydrology_inst%depth_col(c, 1:nlayer) = dzvic - soilhydrology_inst%depth_col(c, nlayer+1:nlayert) = col%dz(c, nlevsoi+1:nlevgrnd) - - ! create weights to map soil moisture profiles (10 layer) to 3 layers for VIC hydrology, M.Huang - call initCLMVICMap(c, soilhydrology_inst) - call initSoilParVIC(c, claycol, sandcol, om_fraccol, soilhydrology_inst) - end if - end if ! end of if not lake - - end do ! end of loop over columns - - deallocate(b2d, ds2d, dsmax2d, ws2d) - deallocate(sandcol, claycol, om_fraccol) - deallocate(sand3d, clay3d, organic3d) - deallocate(zisoifl, zsoifl, dzsoifl) - - end if ! end of if use_vichydro - - associate(micro_sigma => col%micro_sigma) - do c = bounds%begc, bounds%endc - - ! determine h2osfc threshold ("fill & spill" concept) - ! set to zero for no h2osfc (w/frac_infclust =large) - - soilhydrology_inst%h2osfc_thresh_col(c) = 0._r8 - if (micro_sigma(c) > 1.e-6_r8 .and. (soilhydrology_inst%h2osfcflag /= 0)) then - d = 0.0 - do p = 1,4 - fd = 0.5*(1.0_r8+shr_spfn_erf(d/(micro_sigma(c)*sqrt(2.0)))) - pc - dfdd = exp(-d**2/(2.0*micro_sigma(c)**2))/(micro_sigma(c)*sqrt(2.0*shr_const_pi)) - d = d - fd/dfdd - enddo - soilhydrology_inst%h2osfc_thresh_col(c) = 0.5*d*(1.0_r8+shr_spfn_erf(d/(micro_sigma(c)*sqrt(2.0)))) + & - micro_sigma(c)/sqrt(2.0*shr_const_pi)*exp(-d**2/(2.0*micro_sigma(c)**2)) - soilhydrology_inst%h2osfc_thresh_col(c) = 1.e3_r8 * soilhydrology_inst%h2osfc_thresh_col(c) !convert to mm from meters - else - soilhydrology_inst%h2osfc_thresh_col(c) = 0._r8 - endif - - if (soilhydrology_inst%h2osfcflag == 0) then - soilhydrology_inst%h2osfc_thresh_col(c) = 0._r8 ! set to zero for no h2osfc (w/frac_infclust =large) - endif - - ! set decay factor - soilhydrology_inst%hkdepth_col(c) = 1._r8/2.5_r8 - - end do - end associate - - end subroutine SoilhydrologyInitTimeConst - - !----------------------------------------------------------------------- - subroutine initSoilParVIC(c, claycol, sandcol, om_fraccol, soilhydrology_inst) - ! - ! !DESCRIPTION: - ! Convert default CLM soil properties to VIC parameters - ! to be used for runoff simulations (added by M. Huang) - ! - ! !USES: - use clm_varpar, only : nlevsoi, nlayert, nlayer - ! - ! !ARGUMENTS: - integer , intent(in) :: c ! column index - real(r8) , pointer :: sandcol(:,:) ! read in - soil texture: percent sand - real(r8) , pointer :: claycol(:,:) ! read in - soil texture: percent clay - real(r8) , pointer :: om_fraccol(:,:) ! read in - organic matter: kg/m3 - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - - ! !LOCAL VARIABLES: - real(r8) :: om_watsat = 0.9_r8 ! porosity of organic soil - real(r8) :: om_hksat = 0.1_r8 ! saturated hydraulic conductivity of organic soil [mm/s] - real(r8) :: om_tkm = 0.25_r8 ! thermal conductivity of organic soil (Farouki, 1986) [W/m/K] - real(r8) :: om_sucsat = 10.3_r8 ! saturated suction for organic matter (Letts, 2000) - real(r8) :: om_csol = 2.5_r8 ! heat capacity of peat soil *10^6 (J/K m3) (Farouki, 1986) - real(r8) :: om_tkd = 0.05_r8 ! thermal conductivity of dry organic soil (Farouki, 1981) - real(r8) :: om_b = 2.7_r8 ! Clapp Hornberger paramater for oragnic soil (Letts, 2000) - real(r8) :: om_expt = 3._r8+2._r8*2.7_r8 ! soil expt for VIC - real(r8) :: csol_bedrock = 2.0e6_r8 ! vol. heat capacity of granite/sandstone J/(m3 K)(Shabbir, 2000) - real(r8) :: pc = 0.5_r8 ! percolation threshold - real(r8) :: pcbeta = 0.139_r8 ! percolation exponent - real(r8) :: xksat ! maximum hydraulic conductivity of soil [mm/s] - real(r8) :: perc_frac ! "percolating" fraction of organic soil - real(r8) :: perc_norm ! normalize to 1 when 100% organic soil - real(r8) :: uncon_hksat ! series conductivity of mineral/organic soil - real(r8) :: uncon_frac ! fraction of "unconnected" soil - real(r8) :: temp_sum_frac ! sum of node fractions in each VIC layer - real(r8) :: sandvic(1:nlayert) ! temporary, weighted averaged sand% for VIC layers - real(r8) :: clayvic(1:nlayert) ! temporary, weighted averaged clay% for VIC layers - real(r8) :: om_fracvic(1:nlayert) ! temporary, weighted averaged organic matter fract for VIC layers - integer :: i, j ! indices - !------------------------------------------------------------------------------------------- - - ! soilhydrology_inst%depth_col(:,:) Output: layer depth of upper layer(m) - ! soilhydrology_inst%vic_clm_fract_col(:,:,:) Output: fraction of VIC layers in CLM layers - ! soilhydrology_inst%c_param_col(:) Output: baseflow exponent (Qb) - ! soilhydrology_inst%expt_col(:,:) Output: pore-size distribution related paramter(Q12) - ! soilhydrology_inst%ksat_col(:,:) Output: Saturated hydrologic conductivity (mm/s) - ! soilhydrology_inst%phi_s_col(:,:) Output: soil moisture dissusion parameter - ! soilhydrology_inst%porosity_col(:,:) Output: soil porosity - ! soilhydrology_inst%max_moist_col(:,:) Output: maximum soil moisture (ice + liq) - - ! map parameters between VIC layers and CLM layers - soilhydrology_inst%c_param_col(c) = 2._r8 - - ! map the CLM layers to VIC layers - do i = 1, nlayer - - sandvic(i) = 0._r8 - clayvic(i) = 0._r8 - om_fracvic(i) = 0._r8 - temp_sum_frac = 0._r8 - do j = 1, nlevsoi - sandvic(i) = sandvic(i) + sandcol(c,j) * soilhydrology_inst%vic_clm_fract_col(c,i,j) - clayvic(i) = clayvic(i) + claycol(c,j) * soilhydrology_inst%vic_clm_fract_col(c,i,j) - om_fracvic(i) = om_fracvic(i) + om_fraccol(c,j) * soilhydrology_inst%vic_clm_fract_col(c,i,j) - temp_sum_frac = temp_sum_frac + soilhydrology_inst%vic_clm_fract_col(c,i,j) - end do - - !average soil properties, M.Huang, 08/11/2010 - sandvic(i) = sandvic(i)/temp_sum_frac - clayvic(i) = clayvic(i)/temp_sum_frac - om_fracvic(i) = om_fracvic(i)/temp_sum_frac - - !make sure sand, clay and om fractions are between 0 and 100% - sandvic(i) = min(100._r8 , sandvic(i)) - clayvic(i) = min(100._r8 , clayvic(i)) - om_fracvic(i) = min(100._r8 , om_fracvic(i)) - sandvic(i) = max(0._r8 , sandvic(i)) - clayvic(i) = max(0._r8 , clayvic(i)) - om_fracvic(i) = max(0._r8 , om_fracvic(i)) - - !calculate other parameters based on teh percentages - soilhydrology_inst%porosity_col(c, i) = 0.489_r8 - 0.00126_r8*sandvic(i) - soilhydrology_inst%expt_col(c, i) = 3._r8+ 2._r8*(2.91_r8 + 0.159_r8*clayvic(i)) - xksat = 0.0070556 *( 10.**(-0.884+0.0153*sandvic(i)) ) - - !consider organic matter, M.Huang - soilhydrology_inst%expt_col(c, i) = & - (1._r8 - om_fracvic(i))*soilhydrology_inst%expt_col(c, i) + om_fracvic(i)*om_expt - soilhydrology_inst%porosity_col(c,i) = & - (1._r8 - om_fracvic(i))*soilhydrology_inst%porosity_col(c,i) + om_watsat*om_fracvic(i) - - ! perc_frac is zero unless perf_frac greater than percolation threshold - if (om_fracvic(i) > pc) then - perc_norm=(1._r8 - pc)**(-pcbeta) - perc_frac=perc_norm*(om_fracvic(i) - pc)**pcbeta - else - perc_frac=0._r8 - endif - ! uncon_frac is fraction of mineral soil plus fraction of "nonpercolating" organic soil - uncon_frac=(1._r8-om_fracvic(i))+(1._r8-perc_frac)*om_fracvic(i) - - ! uncon_hksat is series addition of mineral/organic conductivites - if (om_fracvic(i) < 1._r8) then - uncon_hksat=uncon_frac/((1._r8-om_fracvic(i))/xksat & - +((1._r8-perc_frac)*om_fracvic(i))/om_hksat) - else - uncon_hksat = 0._r8 - end if - - soilhydrology_inst%ksat_col(c,i) = & - uncon_frac*uncon_hksat + (perc_frac*om_fracvic(i))*om_hksat - - soilhydrology_inst%max_moist_col(c,i) = & - soilhydrology_inst%porosity_col(c,i) * soilhydrology_inst%depth_col(c,i) * 1000._r8 !in mm! - - soilhydrology_inst%phi_s_col(c,i) = & - -(exp((1.54_r8 - 0.0095_r8*sandvic(i) + & - 0.0063_r8*(100.0_r8-sandvic(i)-clayvic(i)))*log(10.0_r8))*9.8e-5_r8) - - end do ! end of loop over layers - - end subroutine initSoilParVIC - - !----------------------------------------------------------------------- - subroutine initCLMVICMap(c, soilhydrology_inst) - ! - ! !DESCRIPTION: - ! Calculates mapping between CLM and VIC layers - ! added by AWang, modified by M.Huang for CLM4 - ! NOTE: in CLM h2osoil_liq unit is kg/m2, in VIC moist is mm - ! h2osoi_ice is actually water equavlent ice content. - ! - ! !USES: - use clm_varpar , only : nlevsoi, nlayer - ! - ! !ARGUMENTS: - integer , intent(in) :: c - type(soilhydrology_type), intent(inout) :: soilhydrology_inst - ! - ! !REVISION HISTORY: - ! Created by Maoyi Huang - ! 11/13/2012, Maoyi Huang: rewrite the mapping modules in CLM4VIC - ! - ! !LOCAL VARIABLES - real(r8) :: sum_frac(1:nlayer) ! sum of fraction for each layer - real(r8) :: deltal(1:nlayer+1) ! temporary - real(r8) :: zsum ! temporary - real(r8) :: lsum ! temporary - real(r8) :: temp ! temporary - integer :: i, j, fc - !----------------------------------------------------------------------- - - associate( & - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - z => col%z , & ! Input: [real(r8) (:,:) ] layer thickness (m) - - depth => soilhydrology_inst%depth_col , & ! Input: [real(r8) (:,:) ] layer depth of VIC (m) - vic_clm_fract => soilhydrology_inst%vic_clm_fract_col & ! Output: [real(r8) (:,:,:) ] fraction of VIC layers in clm layers - ) - - ! set fraction of VIC layer in each CLM layer - - lsum = 0._r8 - do i = 1, nlayer - deltal(i) = depth(c,i) - end do - do i = 1, nlayer - zsum = 0._r8 - sum_frac(i) = 0._r8 - do j = 1, nlevsoi - if( (zsum < lsum) .and. (zsum + dz(c,j) >= lsum )) then - call linear_interp(lsum, temp, zsum, zsum + dz(c,j), 0._r8, 1._r8) - vic_clm_fract(c,i,j) = 1._r8 - temp - if(lsum + deltal(i) < zsum + dz(c,j)) then - call linear_interp(lsum + deltal(i), temp, zsum, zsum + dz(c,j), 1._r8, 0._r8) - vic_clm_fract(c,i,j) = vic_clm_fract(c,i,j) - temp - end if - else if( (zsum < lsum + deltal(i)) .and. (zsum + dz(c,j) >= lsum + deltal(i)) ) then - call linear_interp(lsum + deltal(i), temp, zsum, zsum + dz(c,j), 0._r8, 1._r8) - vic_clm_fract(c,i,j) = temp - if(zsum<=lsum) then - call linear_interp(lsum, temp, zsum, zsum + dz(c,j), 0._r8, 1._r8) - vic_clm_fract(c,i,j) = vic_clm_fract(c,i,j) - temp - end if - else if( (zsum >= lsum .and. zsum + dz(c,j) <= lsum + deltal(i)) ) then - vic_clm_fract(c,i,j) = 1._r8 - else - vic_clm_fract(c,i,j) = 0._r8 - end if - zsum = zsum + dz(c,j) - sum_frac(i) = sum_frac(i) + vic_clm_fract(c,i,j) - end do ! end CLM layer calculation - lsum = lsum + deltal(i) - end do ! end VIC layer calcultion - - end associate - - end subroutine initCLMVICMap - - !------------------------------------------------------------------- - subroutine linear_interp(x,y, x0, x1, y0, y1) - ! - ! !DESCRIPTION: - ! Provides linear interpolation - ! - ! !ARGUMENTS: - real(r8), intent(in) :: x, x0, y0, x1, y1 - real(r8), intent(out) :: y - !------------------------------------------------------------------- - - y = y0 + (x - x0) * (y1 - y0) / (x1 - x0) - - end subroutine linear_interp - -end module SoilHydrologyInitTimeConstMod diff --git a/src/biogeophys/SoilHydrologyType.F90 b/src/biogeophys/SoilHydrologyType.F90 deleted file mode 100644 index be78df49c0..0000000000 --- a/src/biogeophys/SoilHydrologyType.F90 +++ /dev/null @@ -1,338 +0,0 @@ -Module SoilHydrologyType - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use decompMod , only : bounds_type - use clm_varpar , only : nlevgrnd, nlayer, nlayert, nlevsoi - use clm_varcon , only : spval - use clm_varctl , only : iulog - use LandunitType , only : lun - use ColumnType , only : col - ! - ! !PUBLIC TYPES: - implicit none - save - ! - type, public :: soilhydrology_type - - integer :: h2osfcflag ! true => surface water is active (namelist) - integer :: origflag ! used to control soil hydrology properties (namelist) - - real(r8), pointer :: num_substeps_col (:) ! col adaptive timestep counter - ! NON-VIC - real(r8), pointer :: frost_table_col (:) ! col frost table depth - real(r8), pointer :: zwt_col (:) ! col water table depth - real(r8), pointer :: zwts_col (:) ! col water table depth, the shallower of the two water depths - real(r8), pointer :: zwt_perched_col (:) ! col perched water table depth - real(r8), pointer :: wa_col (:) ! col water in the unconfined aquifer (mm) - real(r8), pointer :: qcharge_col (:) ! col aquifer recharge rate (mm/s) - real(r8), pointer :: fracice_col (:,:) ! col fractional impermeability (-) - real(r8), pointer :: icefrac_col (:,:) ! col fraction of ice - real(r8), pointer :: fcov_col (:) ! col fractional impermeable area - real(r8), pointer :: fsat_col (:) ! col fractional area with water table at surface - real(r8), pointer :: h2osfc_thresh_col (:) ! col level at which h2osfc "percolates" (time constant) - - ! VIC - real(r8), pointer :: hkdepth_col (:) ! col VIC decay factor (m) (time constant) - real(r8), pointer :: b_infil_col (:) ! col VIC b infiltration parameter (time constant) - real(r8), pointer :: ds_col (:) ! col VIC fracton of Dsmax where non-linear baseflow begins (time constant) - real(r8), pointer :: dsmax_col (:) ! col VIC max. velocity of baseflow (mm/day) (time constant) - real(r8), pointer :: Wsvic_col (:) ! col VIC fraction of maximum soil moisutre where non-liear base flow occurs (time constant) - real(r8), pointer :: porosity_col (:,:) ! col VIC porosity (1-bulk_density/soil_density) - real(r8), pointer :: vic_clm_fract_col (:,:,:) ! col VIC fraction of VIC layers in CLM layers - real(r8), pointer :: depth_col (:,:) ! col VIC layer depth of upper layer - real(r8), pointer :: c_param_col (:) ! col VIC baseflow exponent (Qb) - real(r8), pointer :: expt_col (:,:) ! col VIC pore-size distribution related paramter(Q12) - real(r8), pointer :: ksat_col (:,:) ! col VIC Saturated hydrologic conductivity - real(r8), pointer :: phi_s_col (:,:) ! col VIC soil moisture dissusion parameter - real(r8), pointer :: moist_col (:,:) ! col VIC soil moisture (kg/m2) for VIC soil layers - real(r8), pointer :: moist_vol_col (:,:) ! col VIC volumetric soil moisture for VIC soil layers - real(r8), pointer :: max_moist_col (:,:) ! col VIC max layer moist + ice (mm) - real(r8), pointer :: max_infil_col (:) ! col VIC maximum infiltration rate calculated in VIC - real(r8), pointer :: i_0_col (:) ! col VIC average saturation in top soil layers - real(r8), pointer :: ice_col (:,:) ! col VIC soil ice (kg/m2) for VIC soil layers - - contains - - ! Public routines - procedure, public :: Init - procedure, public :: Restart - - ! Private routines - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - procedure, private :: ReadNL - - end type soilhydrology_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, NLFilename) - - class(soilhydrology_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename - - call this%ReadNL(NLFilename) - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(soilhydrology_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begg, endg - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - allocate(this%num_substeps_col (begc:endc)) ; this%num_substeps_col (:) = nan - allocate(this%frost_table_col (begc:endc)) ; this%frost_table_col (:) = nan - allocate(this%zwt_col (begc:endc)) ; this%zwt_col (:) = nan - allocate(this%zwt_perched_col (begc:endc)) ; this%zwt_perched_col (:) = nan - allocate(this%zwts_col (begc:endc)) ; this%zwts_col (:) = nan - - allocate(this%wa_col (begc:endc)) ; this%wa_col (:) = nan - allocate(this%qcharge_col (begc:endc)) ; this%qcharge_col (:) = nan - allocate(this%fracice_col (begc:endc,nlevgrnd)) ; this%fracice_col (:,:) = nan - allocate(this%icefrac_col (begc:endc,nlevgrnd)) ; this%icefrac_col (:,:) = nan - allocate(this%fcov_col (begc:endc)) ; this%fcov_col (:) = nan - allocate(this%fsat_col (begc:endc)) ; this%fsat_col (:) = nan - allocate(this%h2osfc_thresh_col (begc:endc)) ; this%h2osfc_thresh_col (:) = nan - - allocate(this%hkdepth_col (begc:endc)) ; this%hkdepth_col (:) = nan - allocate(this%b_infil_col (begc:endc)) ; this%b_infil_col (:) = nan - allocate(this%ds_col (begc:endc)) ; this%ds_col (:) = nan - allocate(this%dsmax_col (begc:endc)) ; this%dsmax_col (:) = nan - allocate(this%Wsvic_col (begc:endc)) ; this%Wsvic_col (:) = nan - allocate(this%depth_col (begc:endc,nlayert)) ; this%depth_col (:,:) = nan - allocate(this%porosity_col (begc:endc,nlayer)) ; this%porosity_col (:,:) = nan - allocate(this%vic_clm_fract_col (begc:endc,nlayer, nlevsoi)) ; this%vic_clm_fract_col (:,:,:) = nan - allocate(this%c_param_col (begc:endc)) ; this%c_param_col (:) = nan - allocate(this%expt_col (begc:endc,nlayer)) ; this%expt_col (:,:) = nan - allocate(this%ksat_col (begc:endc,nlayer)) ; this%ksat_col (:,:) = nan - allocate(this%phi_s_col (begc:endc,nlayer)) ; this%phi_s_col (:,:) = nan - allocate(this%moist_col (begc:endc,nlayert)) ; this%moist_col (:,:) = nan - allocate(this%moist_vol_col (begc:endc,nlayert)) ; this%moist_vol_col (:,:) = nan - allocate(this%max_moist_col (begc:endc,nlayer)) ; this%max_moist_col (:,:) = nan - allocate(this%max_infil_col (begc:endc)) ; this%max_infil_col (:) = nan - allocate(this%i_0_col (begc:endc)) ; this%i_0_col (:) = nan - allocate(this%ice_col (begc:endc,nlayert)) ; this%ice_col (:,:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !USES: - use histFileMod , only : hist_addfld1d - ! - ! !ARGUMENTS: - class(soilhydrology_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - integer :: begg, endg - !------------------------------------------------------------------------ - - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - this%wa_col(begc:endc) = spval - call hist_addfld1d (fname='WA', units='mm', & - avgflag='A', long_name='water in the unconfined aquifer (vegetated landunits only)', & - ptr_col=this%wa_col, l2g_scale_type='veg', default='inactive') - - this%qcharge_col(begc:endc) = spval - call hist_addfld1d (fname='QCHARGE', units='mm/s', & - avgflag='A', long_name='aquifer recharge rate (vegetated landunits only)', & - ptr_col=this%qcharge_col, l2g_scale_type='veg', default='inactive') - - this%fcov_col(begc:endc) = spval - call hist_addfld1d (fname='FCOV', units='unitless', & - avgflag='A', long_name='fractional impermeable area', & - ptr_col=this%fcov_col, l2g_scale_type='veg', default='inactive') - - this%fsat_col(begc:endc) = spval - call hist_addfld1d (fname='FSAT', units='unitless', & - avgflag='A', long_name='fractional area with water table at surface', & - ptr_col=this%fsat_col, l2g_scale_type='veg', default='inactive') - - this%num_substeps_col(begc:endc) = spval - call hist_addfld1d (fname='NSUBSTEPS', units='unitless', & - avgflag='A', long_name='number of adaptive timesteps in CLM timestep', & - ptr_col=this%num_substeps_col, l2g_scale_type='veg', & - default='inactive') - - this%frost_table_col(begc:endc) = spval - call hist_addfld1d (fname='FROST_TABLE', units='m', & - avgflag='A', long_name='frost table depth (vegetated landunits only)', & - ptr_col=this%frost_table_col, l2g_scale_type='veg', default='inactive') - - this%zwt_col(begc:endc) = spval - call hist_addfld1d (fname='ZWT', units='m', & - avgflag='A', long_name='water table depth (vegetated landunits only)', & - ptr_col=this%zwt_col, l2g_scale_type='veg', default='inactive') - - this%zwt_perched_col(begc:endc) = spval - call hist_addfld1d (fname='ZWT_PERCH', units='m', & - avgflag='A', long_name='perched water table depth (vegetated landunits only)', & - ptr_col=this%zwt_perched_col, l2g_scale_type='veg', default='inactive') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !USES: - ! - ! !ARGUMENTS: - class(soilhydrology_type) :: this - type(bounds_type) , intent(in) :: bounds - ! !LOCAL VARIABLES: - integer :: c ! indices - - !----------------------------------------------------------------------- - - ! Nothing for now - - ! needs to be initialized to spval to avoid problems when - ! averaging for the accum field - do c = bounds%begc, bounds%endc - this%num_substeps_col(c) = spval - end do - - end subroutine InitCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag) - ! - ! !USES: - use ncdio_pio , only : file_desc_t, ncd_io, ncd_double - use restUtilMod - ! - ! !ARGUMENTS: - class(soilhydrology_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - logical :: readvar ! determine if variable is on initial file - !----------------------------------------------------------------------- - - call restartvar(ncid=ncid, flag=flag, varname='FROST_TABLE', xtype=ncd_double, & - dim1name='column', & - long_name='frost table depth', units='m', & - interpinic_flag='interp', readvar=readvar, data=this%frost_table_col) - if (flag == 'read' .and. .not. readvar) then - this%frost_table_col(bounds%begc:bounds%endc) = col%zi(bounds%begc:bounds%endc,nlevsoi) - end if - - call restartvar(ncid=ncid, flag=flag, varname='WA', xtype=ncd_double, & - dim1name='column', & - long_name='water in the unconfined aquifer', units='mm', & - interpinic_flag='interp', readvar=readvar, data=this%wa_col) - - call restartvar(ncid=ncid, flag=flag, varname='ZWT', xtype=ncd_double, & - dim1name='column', & - long_name='water table depth', units='m', & - interpinic_flag='interp', readvar=readvar, data=this%zwt_col) - - call restartvar(ncid=ncid, flag=flag, varname='ZWT_PERCH', xtype=ncd_double, & - dim1name='column', & - long_name='perched water table depth', units='m', & - interpinic_flag='interp', readvar=readvar, data=this%zwt_perched_col) - if (flag == 'read' .and. .not. readvar) then - this%zwt_perched_col(bounds%begc:bounds%endc) = col%zi(bounds%begc:bounds%endc,nlevsoi) - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine ReadNL( this, NLFilename ) - ! - ! !DESCRIPTION: - ! Read namelist for SoilHydrology - ! - ! !USES: - use shr_mpi_mod , only : shr_mpi_bcast - use shr_log_mod , only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc, mpicom - use fileutils , only : getavu, relavu, opnfil - use clm_nlUtilsMod , only : find_nlgroup_name - use clm_varctl , only : iulog - use abortutils , only : endrun - ! - ! !ARGUMENTS: - class(soilhydrology_type) :: this - character(len=*), intent(IN) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - integer :: origflag=0 !use to control soil hydraulic properties - integer :: h2osfcflag=1 !If surface water is active or not - character(len=32) :: subname = 'SoilHydrology_readnl' ! subroutine name - !----------------------------------------------------------------------- - - namelist / clm_soilhydrology_inparm / h2osfcflag, origflag - - ! preset values - - origflag = 0 - h2osfcflag = 1 - - if ( masterproc )then - - unitn = getavu() - write(iulog,*) 'Read in clm_soilhydrology_inparm namelist' - call opnfil (NLFilename, unitn, 'F') - call find_nlgroup_name(unitn, 'clm_soilhydrology_inparm', status=ierr) - if (ierr == 0) then - read(unitn, clm_soilhydrology_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading clm_soilhydrology_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR finding clm_soilhydrology_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - - end if - - call shr_mpi_bcast(h2osfcflag, mpicom) - call shr_mpi_bcast(origflag, mpicom) - - this%h2osfcflag = h2osfcflag - this%origflag = origflag - - end subroutine ReadNL - -end Module SoilHydrologyType diff --git a/src/biogeophys/SoilStateInitTimeConstMod.F90 b/src/biogeophys/SoilStateInitTimeConstMod.F90 deleted file mode 100644 index 1c8f13427e..0000000000 --- a/src/biogeophys/SoilStateInitTimeConstMod.F90 +++ /dev/null @@ -1,630 +0,0 @@ -module SoilStateInitTimeConstMod - - !------------------------------------------------------------------------------ - ! DESCRIPTION: - ! Set hydraulic and thermal properties - ! - ! !USES - use SoilStateType , only : soilstate_type - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: SoilStateInitTimeConst - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: ReadNL - ! - ! !PRIVATE DATA: - ! Control variables (from namelist) - logical, private :: organic_frac_squared ! If organic fraction should be squared (as in CLM4.5) - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - ! -contains - - !----------------------------------------------------------------------- - subroutine ReadNL( nlfilename ) - ! - ! !DESCRIPTION: - ! Read namelist for SoilStateType - ! - ! !USES: - use shr_mpi_mod , only : shr_mpi_bcast - use shr_log_mod , only : errMsg => shr_log_errMsg - use fileutils , only : getavu, relavu, opnfil - use clm_nlUtilsMod , only : find_nlgroup_name - use clm_varctl , only : iulog - use spmdMod , only : mpicom, masterproc - use abortUtils , only : endrun - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: nlfilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - character(len=32) :: subname = 'SoilState_readnl' ! subroutine name - !----------------------------------------------------------------------- - - character(len=*), parameter :: nl_name = 'clm_soilstate_inparm' ! Namelist name - ! MUST agree with name in namelist and read - namelist / clm_soilstate_inparm / organic_frac_squared - - ! preset values - - organic_frac_squared = .false. - - if ( masterproc )then - - unitn = getavu() - write(iulog,*) 'Read in '//nl_name//' namelist' - call opnfil (nlfilename, unitn, 'F') - call find_nlgroup_name(unitn, nl_name, status=ierr) - if (ierr == 0) then - read(unit=unitn, nml=clm_soilstate_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading '//nl_name//' namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR finding '//nl_name//' namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - - end if - - call shr_mpi_bcast(organic_frac_squared, mpicom) - - end subroutine ReadNL - - !----------------------------------------------------------------------- - subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use abortutils , only : endrun - use spmdMod , only : masterproc - use ncdio_pio , only : file_desc_t, ncd_io, ncd_double, ncd_int, ncd_inqvdlen - use ncdio_pio , only : ncd_pio_openfile, ncd_pio_closefile, ncd_inqdlen - use clm_varpar , only : numpft, numrad - use clm_varpar , only : nlevsoi, nlevgrnd, nlevlak, nlevsoifl, nlayer, nlayert, nlevurb, nlevsno - use clm_varcon , only : zsoi, dzsoi, zisoi, spval - use clm_varcon , only : secspday, pc, mu, denh2o, denice, grlnd - use clm_varctl , only : use_cn, use_fates - use clm_varctl , only : iulog, fsurdat, paramfile, soil_layerstruct - use landunit_varcon , only : istdlak, istwet, istsoil, istcrop, istice_mec - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall, icol_road_perv, icol_road_imperv - use fileutils , only : getfil - use organicFileMod , only : organicrd - use FuncPedotransferMod , only : pedotransf, get_ipedof - use RootBiophysMod , only : init_vegrootfr - use GridcellType , only : grc - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(soilstate_type) , intent(inout) :: soilstate_inst - character(len=*) , intent(in) :: nlfilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: p, lev, c, l, g, j ! indices - real(r8) :: om_frac ! organic matter fraction - real(r8) :: om_tkm = 0.25_r8 ! thermal conductivity of organic soil (Farouki, 1986) [W/m/K] - real(r8) :: om_watsat_lake = 0.9_r8 ! porosity of organic soil - real(r8) :: om_hksat_lake = 0.1_r8 ! saturated hydraulic conductivity of organic soil [mm/s] - real(r8) :: om_sucsat_lake = 10.3_r8 ! saturated suction for organic matter (Letts, 2000) - real(r8) :: om_b_lake = 2.7_r8 ! Clapp Hornberger paramater for oragnic soil (Letts, 2000) (lake) - real(r8) :: om_watsat ! porosity of organic soil - real(r8) :: om_hksat ! saturated hydraulic conductivity of organic soil [mm/s] - real(r8) :: om_sucsat ! saturated suction for organic matter (mm)(Letts, 2000) - real(r8) :: om_csol = 2.5_r8 ! heat capacity of peat soil *10^6 (J/K m3) (Farouki, 1986) - real(r8) :: om_tkd = 0.05_r8 ! thermal conductivity of dry organic soil (Farouki, 1981) - real(r8) :: om_b ! Clapp Hornberger paramater for oragnic soil (Letts, 2000) - real(r8) :: zsapric = 0.5_r8 ! depth (m) that organic matter takes on characteristics of sapric peat - real(r8) :: pcalpha = 0.5_r8 ! percolation threshold - real(r8) :: pcbeta = 0.139_r8 ! percolation exponent - real(r8) :: pc_lake = 0.5_r8 ! percolation threshold - real(r8) :: perc_frac ! "percolating" fraction of organic soil - real(r8) :: perc_norm ! normalize to 1 when 100% organic soil - real(r8) :: uncon_hksat ! series conductivity of mineral/organic soil - real(r8) :: uncon_frac ! fraction of "unconnected" soil - real(r8) :: bd ! bulk density of dry soil material [kg/m^3] - real(r8) :: tkm ! mineral conductivity - real(r8) :: xksat ! maximum hydraulic conductivity of soil [mm/s] - real(r8) :: clay,sand ! temporaries - real(r8) :: organic_max ! organic matter (kg/m3) where soil is assumed to act like peat - integer :: dimid ! dimension id - logical :: readvar - type(file_desc_t) :: ncid ! netcdf id - real(r8) ,pointer :: zsoifl (:) ! Output: [real(r8) (:)] original soil midpoint - real(r8) ,pointer :: zisoifl (:) ! Output: [real(r8) (:)] original soil interface depth - real(r8) ,pointer :: dzsoifl (:) ! Output: [real(r8) (:)] original soil thickness - real(r8) ,pointer :: gti (:) ! read in - fmax - real(r8) ,pointer :: sand3d (:,:) ! read in - soil texture: percent sand (needs to be a pointer for use in ncdio) - real(r8) ,pointer :: clay3d (:,:) ! read in - soil texture: percent clay (needs to be a pointer for use in ncdio) - real(r8) ,pointer :: organic3d (:,:) ! read in - organic matter: kg/m3 (needs to be a pointer for use in ncdio) - character(len=256) :: locfn ! local filename - integer :: ipedof - integer :: begp, endp - integer :: begc, endc - integer :: begg, endg - !----------------------------------------------------------------------- - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - do c = begc,endc - soilstate_inst%smpmin_col(c) = -1.e8_r8 - end do - - ! -------------------------------------------------------------------- - ! Read namelist - ! -------------------------------------------------------------------- - - call ReadNL( nlfilename ) - - ! -------------------------------------------------------------------- - ! Initialize root fraction (computing from surface, d is depth in meter): - ! -------------------------------------------------------------------- - - ! Currently pervious road has same properties as soil - do c = begc,endc - l = col%landunit(c) - - if (lun%urbpoi(l) .and. col%itype(c) == icol_road_perv) then - do lev = 1, nlevgrnd - soilstate_inst%rootfr_road_perv_col(c,lev) = 0._r8 - enddo - do lev = 1,nlevsoi - soilstate_inst%rootfr_road_perv_col(c,lev) = 1.0_r8/real(nlevsoi,r8) - end do -! remove roots below bedrock layer - soilstate_inst%rootfr_road_perv_col(c,1:col%nbedrock(c)) = & - soilstate_inst%rootfr_road_perv_col(c,1:col%nbedrock(c)) & - + sum(soilstate_inst%rootfr_road_perv_col(c,col%nbedrock(c)+1:nlevsoi)) & - /real(col%nbedrock(c)) - soilstate_inst%rootfr_road_perv_col(c,col%nbedrock(c)+1:nlevsoi) = 0._r8 - end if - end do - - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - soilstate_inst%rootfr_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - else - ! Inactive CH4 columns - ! (Also includes (lun%itype(l)==istdlak .and. allowlakeprod), which used to be - ! in a separate branch of the conditional) - soilstate_inst%rootfr_col (c,:) = spval - end if - end do - - ! Initialize root fraction - ! Note that fates has its own root fraction root fraction routine and should not - ! use the following since it depends on patch%itype - which fates should not use - - if (.not. use_fates) then - call init_vegrootfr(bounds, nlevsoi, nlevgrnd, & - soilstate_inst%rootfr_patch(begp:endp,1:nlevgrnd),'water') - call init_vegrootfr(bounds, nlevsoi, nlevgrnd, & - soilstate_inst%crootfr_patch(begp:endp,1:nlevgrnd),'carbon') - end if - - ! -------------------------------------------------------------------- - ! dynamic memory allocation - ! -------------------------------------------------------------------- - - allocate(sand3d(begg:endg,nlevsoifl)) - allocate(clay3d(begg:endg,nlevsoifl)) - - ! Determine organic_max from parameter file - - call getfil (paramfile, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_io(ncid=ncid, varname='organic_max', flag='read', data=organic_max, readvar=readvar) - if ( .not. readvar ) call endrun(msg=' ERROR: organic_max not on param file'//errMsg(sourcefile, __LINE__)) - call ncd_pio_closefile(ncid) - - ! -------------------------------------------------------------------- - ! Read surface dataset - ! -------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) 'Attempting to read soil color, sand and clay boundary data .....' - end if - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - - ! Read in organic matter dataset - - allocate(organic3d(begg:endg,nlevsoifl)) - call organicrd(organic3d) - - ! Read in sand and clay data - - call ncd_io(ncid=ncid, varname='PCT_SAND', flag='read', data=sand3d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: PCT_SAND NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='PCT_CLAY', flag='read', data=clay3d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: PCT_CLAY NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - - do p = begp,endp - g = patch%gridcell(p) - if ( sand3d(g,1)+clay3d(g,1) == 0.0_r8 )then - if ( any( sand3d(g,:)+clay3d(g,:) /= 0.0_r8 ) )then - call endrun(msg='found depth points that do NOT sum to zero when surface does'//& - errMsg(sourcefile, __LINE__)) - end if - sand3d(g,:) = 1.0_r8 - clay3d(g,:) = 1.0_r8 - end if - if ( any( sand3d(g,:)+clay3d(g,:) == 0.0_r8 ) )then - call endrun(msg='after setting, found points sum to zero'//errMsg(sourcefile, __LINE__)) - end if - - soilstate_inst%sandfrac_patch(p) = sand3d(g,1)/100.0_r8 - soilstate_inst%clayfrac_patch(p) = clay3d(g,1)/100.0_r8 - end do - - ! Read fmax - - allocate(gti(begg:endg)) - call ncd_io(ncid=ncid, varname='FMAX', flag='read', data=gti, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: FMAX NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - do c = begc, endc - g = col%gridcell(c) - soilstate_inst%wtfact_col(c) = gti(g) - end do - deallocate(gti) - - ! Close file - - call ncd_pio_closefile(ncid) - - ! -------------------------------------------------------------------- - ! get original soil depths to be used in interpolation of sand and clay - ! -------------------------------------------------------------------- - - allocate(zsoifl(1:nlevsoifl), zisoifl(0:nlevsoifl), dzsoifl(1:nlevsoifl)) - do j = 1, nlevsoifl - zsoifl(j) = 0.025*(exp(0.5_r8*(j-0.5_r8))-1._r8) !node depths - enddo - - dzsoifl(1) = 0.5_r8*(zsoifl(1)+zsoifl(2)) !thickness b/n two interfaces - do j = 2,nlevsoifl-1 - dzsoifl(j)= 0.5_r8*(zsoifl(j+1)-zsoifl(j-1)) - enddo - dzsoifl(nlevsoifl) = zsoifl(nlevsoifl)-zsoifl(nlevsoifl-1) - - zisoifl(0) = 0._r8 - do j = 1, nlevsoifl-1 - zisoifl(j) = 0.5_r8*(zsoifl(j)+zsoifl(j+1)) !interface depths - enddo - zisoifl(nlevsoifl) = zsoifl(nlevsoifl) + 0.5_r8*dzsoifl(nlevsoifl) - - ! -------------------------------------------------------------------- - ! Set soil hydraulic and thermal properties: non-lake - ! -------------------------------------------------------------------- - - ! urban roof, sunwall and shadewall thermal properties used to - ! derive thermal conductivity and heat capacity are set to special - ! value because thermal conductivity and heat capacity for urban - ! roof, sunwall and shadewall are prescribed in SoilThermProp.F90 - ! in SoilPhysicsMod.F90 - - - do c = begc, endc - g = col%gridcell(c) - l = col%landunit(c) - - if (lun%itype(l)==istwet .or. lun%itype(l)==istice_mec) then - - do lev = 1,nlevgrnd - soilstate_inst%bsw_col(c,lev) = spval - soilstate_inst%watsat_col(c,lev) = spval - soilstate_inst%watfc_col(c,lev) = spval - soilstate_inst%hksat_col(c,lev) = spval - soilstate_inst%sucsat_col(c,lev) = spval - soilstate_inst%watdry_col(c,lev) = spval - soilstate_inst%watopt_col(c,lev) = spval - soilstate_inst%bd_col(c,lev) = spval - if (lev <= nlevsoi) then - soilstate_inst%cellsand_col(c,lev) = spval - soilstate_inst%cellclay_col(c,lev) = spval - soilstate_inst%cellorg_col(c,lev) = spval - end if - end do - - do lev = 1,nlevgrnd - soilstate_inst%tkmg_col(c,lev) = spval - soilstate_inst%tksatu_col(c,lev) = spval - soilstate_inst%tkdry_col(c,lev) = spval - soilstate_inst%csol_col(c,lev)= spval - end do - - else if (lun%urbpoi(l) .and. (col%itype(c) /= icol_road_perv) .and. (col%itype(c) /= icol_road_imperv) )then - - ! Urban Roof, sunwall, shadewall properties set to special value - do lev = 1,nlevgrnd - soilstate_inst%watsat_col(c,lev) = spval - soilstate_inst%watfc_col(c,lev) = spval - soilstate_inst%bsw_col(c,lev) = spval - soilstate_inst%hksat_col(c,lev) = spval - soilstate_inst%sucsat_col(c,lev) = spval - soilstate_inst%watdry_col(c,lev) = spval - soilstate_inst%watopt_col(c,lev) = spval - soilstate_inst%bd_col(c,lev) = spval - if (lev <= nlevsoi) then - soilstate_inst%cellsand_col(c,lev) = spval - soilstate_inst%cellclay_col(c,lev) = spval - soilstate_inst%cellorg_col(c,lev) = spval - end if - end do - - do lev = 1,nlevgrnd - soilstate_inst%tkmg_col(c,lev) = spval - soilstate_inst%tksatu_col(c,lev) = spval - soilstate_inst%tkdry_col(c,lev) = spval - soilstate_inst%csol_col(c,lev) = spval - end do - - else - - do lev = 1,nlevgrnd - ! DML - this if statement could probably be removed and just the - ! top part used for all soil layer structures - if ( soil_layerstruct /= '10SL_3.5m' )then ! apply soil texture from 10 layer input dataset - if (lev .eq. 1) then - clay = clay3d(g,1) - sand = sand3d(g,1) - om_frac = organic3d(g,1)/organic_max - else if (lev <= nlevsoi) then - do j = 1,nlevsoifl-1 - if (zisoi(lev) >= zisoifl(j) .AND. zisoi(lev) < zisoifl(j+1)) then - clay = clay3d(g,j+1) - sand = sand3d(g,j+1) - om_frac = organic3d(g,j+1)/organic_max - endif - end do - else - clay = clay3d(g,nlevsoifl) - sand = sand3d(g,nlevsoifl) - om_frac = 0._r8 - endif - else - if (lev <= nlevsoi) then ! duplicate clay and sand values from 10th soil layer - clay = clay3d(g,lev) - sand = sand3d(g,lev) - if ( organic_frac_squared )then - om_frac = (organic3d(g,lev)/organic_max)**2._r8 - else - om_frac = organic3d(g,lev)/organic_max - end if - else - clay = clay3d(g,nlevsoi) - sand = sand3d(g,nlevsoi) - om_frac = 0._r8 - endif - end if - - if (lun%itype(l) == istdlak) then - - if (lev <= nlevsoi) then - soilstate_inst%cellsand_col(c,lev) = sand - soilstate_inst%cellclay_col(c,lev) = clay - soilstate_inst%cellorg_col(c,lev) = om_frac*organic_max - end if - - else if (lun%itype(l) /= istdlak) then ! soil columns of both urban and non-urban types - - if (lun%urbpoi(l)) then - om_frac = 0._r8 ! No organic matter for urban - end if - - if (lev <= nlevsoi) then - soilstate_inst%cellsand_col(c,lev) = sand - soilstate_inst%cellclay_col(c,lev) = clay - soilstate_inst%cellorg_col(c,lev) = om_frac*organic_max - end if - - ! Note that the following properties are overwritten for urban impervious road - ! layers that are not soil in SoilThermProp.F90 within SoilTemperatureMod.F90 - - !determine the type of pedotransfer function to be used based on soil order - !I will use the following implementation to further explore the ET problem, now - !I set soil order to 0 for all soils. Jinyun Tang, Mar 20, 2014 - - ipedof=get_ipedof(0) - call pedotransf(ipedof, sand, clay, & - soilstate_inst%watsat_col(c,lev), soilstate_inst%bsw_col(c,lev), soilstate_inst%sucsat_col(c,lev), xksat) - - om_watsat = max(0.93_r8 - 0.1_r8 *(zsoi(lev)/zsapric), 0.83_r8) - om_b = min(2.7_r8 + 9.3_r8 *(zsoi(lev)/zsapric), 12.0_r8) - om_sucsat = min(10.3_r8 - 0.2_r8 *(zsoi(lev)/zsapric), 10.1_r8) - om_hksat = max(0.28_r8 - 0.2799_r8*(zsoi(lev)/zsapric), xksat) - - soilstate_inst%bd_col(c,lev) = (1._r8 - soilstate_inst%watsat_col(c,lev))*2.7e3_r8 - soilstate_inst%watsat_col(c,lev) = (1._r8 - om_frac) * soilstate_inst%watsat_col(c,lev) + om_watsat*om_frac - tkm = (1._r8-om_frac) * (8.80_r8*sand+2.92_r8*clay)/(sand+clay)+om_tkm*om_frac ! W/(m K) - soilstate_inst%bsw_col(c,lev) = (1._r8-om_frac) * (2.91_r8 + 0.159_r8*clay) + om_frac*om_b - soilstate_inst%sucsat_col(c,lev) = (1._r8-om_frac) * soilstate_inst%sucsat_col(c,lev) + om_sucsat*om_frac - soilstate_inst%hksat_min_col(c,lev) = xksat - - ! perc_frac is zero unless perf_frac greater than percolation threshold - if (om_frac > pcalpha) then - perc_norm=(1._r8 - pcalpha)**(-pcbeta) - perc_frac=perc_norm*(om_frac - pcalpha)**pcbeta - else - perc_frac=0._r8 - endif - - ! uncon_frac is fraction of mineral soil plus fraction of "nonpercolating" organic soil - uncon_frac=(1._r8-om_frac)+(1._r8-perc_frac)*om_frac - - ! uncon_hksat is series addition of mineral/organic conductivites - if (om_frac < 1._r8) then - uncon_hksat=uncon_frac/((1._r8-om_frac)/xksat & - +((1._r8-perc_frac)*om_frac)/om_hksat) - else - uncon_hksat = 0._r8 - end if - soilstate_inst%hksat_col(c,lev) = uncon_frac*uncon_hksat + (perc_frac*om_frac)*om_hksat - - soilstate_inst%tkmg_col(c,lev) = tkm ** (1._r8- soilstate_inst%watsat_col(c,lev)) - - soilstate_inst%tksatu_col(c,lev) = soilstate_inst%tkmg_col(c,lev)*0.57_r8**soilstate_inst%watsat_col(c,lev) - - soilstate_inst%tkdry_col(c,lev) = ((0.135_r8*soilstate_inst%bd_col(c,lev) + 64.7_r8) / & - (2.7e3_r8 - 0.947_r8*soilstate_inst%bd_col(c,lev)))*(1._r8-om_frac) + om_tkd*om_frac - - soilstate_inst%csol_col(c,lev) = ((1._r8-om_frac)*(2.128_r8*sand+2.385_r8*clay) / (sand+clay) + & - om_csol*om_frac)*1.e6_r8 ! J/(m3 K) - - soilstate_inst%watdry_col(c,lev) = soilstate_inst%watsat_col(c,lev) * & - (316230._r8/soilstate_inst%sucsat_col(c,lev)) ** (-1._r8/soilstate_inst%bsw_col(c,lev)) - soilstate_inst%watopt_col(c,lev) = soilstate_inst%watsat_col(c,lev) * & - (158490._r8/soilstate_inst%sucsat_col(c,lev)) ** (-1._r8/soilstate_inst%bsw_col(c,lev)) - - !! added by K.Sakaguchi for beta from Lee and Pielke, 1992 - ! water content at field capacity, defined as hk = 0.1 mm/day - ! used eqn (7.70) in CLM3 technote with k = 0.1 (mm/day) / secspday (day/sec) - soilstate_inst%watfc_col(c,lev) = soilstate_inst%watsat_col(c,lev) * & - (0.1_r8 / (soilstate_inst%hksat_col(c,lev)*secspday))**(1._r8/(2._r8*soilstate_inst%bsw_col(c,lev)+3._r8)) - end if - end do - - ! Urban pervious and impervious road - if (col%itype(c) == icol_road_imperv) then - ! Impervious road layers -- same as above except set watdry and watopt as missing - do lev = 1,nlevgrnd - soilstate_inst%watdry_col(c,lev) = spval - soilstate_inst%watopt_col(c,lev) = spval - end do - else if (col%itype(c) == icol_road_perv) then - ! pervious road layers - set in UrbanInitTimeConst - end if - - end if - end do - - ! -------------------------------------------------------------------- - ! Set soil hydraulic and thermal properties: lake - ! -------------------------------------------------------------------- - - do c = begc, endc - g = col%gridcell(c) - l = col%landunit(c) - - if (lun%itype(l)==istdlak) then - - do lev = 1,nlevgrnd - if ( lev <= nlevsoi )then - clay = soilstate_inst%cellclay_col(c,lev) - sand = soilstate_inst%cellsand_col(c,lev) - if ( organic_frac_squared )then - om_frac = (soilstate_inst%cellorg_col(c,lev)/organic_max)**2._r8 - else - om_frac = soilstate_inst%cellorg_col(c,lev)/organic_max - end if - else - clay = soilstate_inst%cellclay_col(c,nlevsoi) - sand = soilstate_inst%cellsand_col(c,nlevsoi) - om_frac = 0.0_r8 - end if - - soilstate_inst%watsat_col(c,lev) = 0.489_r8 - 0.00126_r8*sand - - soilstate_inst%bsw_col(c,lev) = 2.91 + 0.159*clay - - soilstate_inst%sucsat_col(c,lev) = 10._r8 * ( 10._r8**(1.88_r8-0.0131_r8*sand) ) - - bd = (1._r8-soilstate_inst%watsat_col(c,lev))*2.7e3_r8 - - soilstate_inst%watsat_col(c,lev) = (1._r8 - om_frac)*soilstate_inst%watsat_col(c,lev) + om_watsat_lake * om_frac - - tkm = (1._r8-om_frac)*(8.80_r8*sand+2.92_r8*clay)/(sand+clay) + om_tkm * om_frac ! W/(m K) - - soilstate_inst%bsw_col(c,lev) = (1._r8-om_frac)*(2.91_r8 + 0.159_r8*clay) + om_frac * om_b_lake - - soilstate_inst%sucsat_col(c,lev) = (1._r8-om_frac)*soilstate_inst%sucsat_col(c,lev) + om_sucsat_lake * om_frac - - xksat = 0.0070556 *( 10.**(-0.884+0.0153*sand) ) ! mm/s - - ! perc_frac is zero unless perf_frac greater than percolation threshold - if (om_frac > pc_lake) then - perc_norm = (1._r8 - pc_lake)**(-pcbeta) - perc_frac = perc_norm*(om_frac - pc_lake)**pcbeta - else - perc_frac = 0._r8 - endif - - ! uncon_frac is fraction of mineral soil plus fraction of "nonpercolating" organic soil - uncon_frac = (1._r8-om_frac) + (1._r8-perc_frac)*om_frac - - ! uncon_hksat is series addition of mineral/organic conductivites - if (om_frac < 1._r8) then - xksat = 0.0070556 *( 10.**(-0.884+0.0153*sand) ) ! mm/s - uncon_hksat = uncon_frac/((1._r8-om_frac)/xksat + ((1._r8-perc_frac)*om_frac)/om_hksat_lake) - else - uncon_hksat = 0._r8 - end if - - soilstate_inst%hksat_col(c,lev) = uncon_frac*uncon_hksat + (perc_frac*om_frac)*om_hksat_lake - soilstate_inst%tkmg_col(c,lev) = tkm ** (1._r8- soilstate_inst%watsat_col(c,lev)) - soilstate_inst%tksatu_col(c,lev) = soilstate_inst%tkmg_col(c,lev)*0.57_r8**soilstate_inst%watsat_col(c,lev) - soilstate_inst%tkdry_col(c,lev) = ((0.135_r8*bd + 64.7_r8) / (2.7e3_r8 - 0.947_r8*bd))*(1._r8-om_frac) + & - om_tkd * om_frac - soilstate_inst%csol_col(c,lev) = ((1._r8-om_frac)*(2.128_r8*sand+2.385_r8*clay) / (sand+clay) + & - om_csol * om_frac)*1.e6_r8 ! J/(m3 K) - soilstate_inst%watdry_col(c,lev) = soilstate_inst%watsat_col(c,lev) & - * (316230._r8/soilstate_inst%sucsat_col(c,lev)) ** (-1._r8/soilstate_inst%bsw_col(c,lev)) - soilstate_inst%watopt_col(c,lev) = soilstate_inst%watsat_col(c,lev) & - * (158490._r8/soilstate_inst%sucsat_col(c,lev)) ** (-1._r8/soilstate_inst%bsw_col(c,lev)) - - !! added by K.Sakaguchi for beta from Lee and Pielke, 1992 - ! water content at field capacity, defined as hk = 0.1 mm/day - ! used eqn (7.70) in CLM3 technote with k = 0.1 (mm/day) / (# seconds/day) - soilstate_inst%watfc_col(c,lev) = soilstate_inst%watsat_col(c,lev) * (0.1_r8 / & - (soilstate_inst%hksat_col(c,lev)*secspday))**(1._r8/(2._r8*soilstate_inst%bsw_col(c,lev)+3._r8)) - end do - endif - - end do - - ! -------------------------------------------------------------------- - ! Initialize threshold soil moisture and mass fracion of clay limited to 0.20 - ! -------------------------------------------------------------------- - - do c = begc,endc - g = col%gridcell(c) - - soilstate_inst%gwc_thr_col(c) = 0.17_r8 + 0.14_r8 * clay3d(g,1) * 0.01_r8 - soilstate_inst%mss_frc_cly_vld_col(c) = min(clay3d(g,1) * 0.01_r8, 0.20_r8) - end do - - ! -------------------------------------------------------------------- - ! Deallocate memory - ! -------------------------------------------------------------------- - - deallocate(sand3d, clay3d, organic3d) - deallocate(zisoifl, zsoifl, dzsoifl) - - end subroutine SoilStateInitTimeConst - -end module SoilStateInitTimeConstMod diff --git a/src/biogeophys/SoilStateType.F90 b/src/biogeophys/SoilStateType.F90 deleted file mode 100644 index 763165a37b..0000000000 --- a/src/biogeophys/SoilStateType.F90 +++ /dev/null @@ -1,409 +0,0 @@ -module SoilStateType - - !------------------------------------------------------------------------------ - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_varpar , only : nlevsoi, nlevgrnd, nlevlak, nlayer, nlevsno - use clm_varcon , only : spval - use clm_varctl , only : use_hydrstress, use_cn, use_dynroot - use clm_varctl , only : iulog, hist_wrtch4diag - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - implicit none - save - private - ! - ! !PUBLIC TYPES: - type, public :: soilstate_type - - ! sand/ clay/ organic matter - real(r8), pointer :: sandfrac_patch (:) ! patch sand fraction - real(r8), pointer :: clayfrac_patch (:) ! patch clay fraction - real(r8), pointer :: mss_frc_cly_vld_col (:) ! col mass fraction clay limited to 0.20 - real(r8), pointer :: cellorg_col (:,:) ! col organic matter for gridcell containing column (1:nlevsoi) - real(r8), pointer :: cellsand_col (:,:) ! sand value for gridcell containing column (1:nlevsoi) - real(r8), pointer :: cellclay_col (:,:) ! clay value for gridcell containing column (1:nlevsoi) - real(r8), pointer :: bd_col (:,:) ! col bulk density of dry soil material [kg/m^3] (CN) - - ! hydraulic properties - real(r8), pointer :: hksat_col (:,:) ! col hydraulic conductivity at saturation (mm H2O /s) - real(r8), pointer :: hksat_min_col (:,:) ! col mineral hydraulic conductivity at saturation (hksat) (mm/s) - real(r8), pointer :: hk_l_col (:,:) ! col hydraulic conductivity (mm/s) - real(r8), pointer :: smp_l_col (:,:) ! col soil matric potential (mm) - real(r8), pointer :: smpmin_col (:) ! col restriction for min of soil potential (mm) - real(r8), pointer :: bsw_col (:,:) ! col Clapp and Hornberger "b" (nlevgrnd) - real(r8), pointer :: watsat_col (:,:) ! col volumetric soil water at saturation (porosity) - real(r8), pointer :: watdry_col (:,:) ! col btran parameter for btran = 0 - real(r8), pointer :: watopt_col (:,:) ! col btran parameter for btran = 1 - real(r8), pointer :: watfc_col (:,:) ! col volumetric soil water at field capacity (nlevsoi) - real(r8), pointer :: sucsat_col (:,:) ! col minimum soil suction (mm) (nlevgrnd) - real(r8), pointer :: dsl_col (:) ! col dry surface layer thickness (mm) - real(r8), pointer :: soilresis_col (:) ! col soil evaporative resistance S&L14 (s/m) - real(r8), pointer :: soilbeta_col (:) ! col factor that reduces ground evaporation L&P1992(-) - real(r8), pointer :: soilalpha_col (:) ! col factor that reduces ground saturated specific humidity (-) - real(r8), pointer :: soilalpha_u_col (:) ! col urban factor that reduces ground saturated specific humidity (-) - real(r8), pointer :: soilpsi_col (:,:) ! col soil water potential in each soil layer (MPa) (CN) - real(r8), pointer :: wtfact_col (:) ! col maximum saturated fraction for a gridcell - real(r8), pointer :: porosity_col (:,:) ! col soil porisity (1-bulk_density/soil_density) (VIC) - real(r8), pointer :: eff_porosity_col (:,:) ! col effective porosity = porosity - vol_ice (nlevgrnd) - real(r8), pointer :: gwc_thr_col (:) ! col threshold soil moisture based on clay content -!scs: vangenuchten - real(r8), pointer :: msw_col (:,:) ! col vanGenuchtenClapp "m" - real(r8), pointer :: nsw_col (:,:) ! col vanGenuchtenClapp "n" - real(r8), pointer :: alphasw_col (:,:) ! col vanGenuchtenClapp "nalpha" - real(r8), pointer :: watres_col (:,:) ! residual soil water content - ! thermal conductivity / heat capacity - real(r8), pointer :: thk_col (:,:) ! col thermal conductivity of each layer [W/m-K] - real(r8), pointer :: tkmg_col (:,:) ! col thermal conductivity, soil minerals [W/m-K] (new) (nlevgrnd) - real(r8), pointer :: tkdry_col (:,:) ! col thermal conductivity, dry soil (W/m/Kelvin) (nlevgrnd) - real(r8), pointer :: tksatu_col (:,:) ! col thermal conductivity, saturated soil [W/m-K] (new) (nlevgrnd) - real(r8), pointer :: csol_col (:,:) ! col heat capacity, soil solids (J/m**3/Kelvin) (nlevgrnd) - - ! roots - real(r8), pointer :: rootr_patch (:,:) ! patch effective fraction of roots in each soil layer (nlevgrnd) - real(r8), pointer :: rootr_col (:,:) ! col effective fraction of roots in each soil layer (nlevgrnd) - real(r8), pointer :: rootfr_col (:,:) ! col fraction of roots in each soil layer (nlevgrnd) - real(r8), pointer :: rootfr_patch (:,:) ! patch fraction of roots for water in each soil layer (nlevgrnd) - real(r8), pointer :: crootfr_patch (:,:) ! patch fraction of roots for carbon in each soil layer (nlevgrnd) - real(r8), pointer :: root_depth_patch (:) ! root depth - real(r8), pointer :: rootr_road_perv_col (:,:) ! col effective fraction of roots in each soil layer of urban pervious road - real(r8), pointer :: rootfr_road_perv_col (:,:) ! col effective fraction of roots in each soil layer of urban pervious road - real(r8), pointer :: k_soil_root_patch (:,:) ! patch soil-root interface conductance [mm/s] - real(r8), pointer :: root_conductance_patch(:,:) ! patch root conductance [mm/s] - real(r8), pointer :: soil_conductance_patch(:,:) ! patch soil conductance [mm/s] - - contains - - procedure, public :: Init - procedure, public :: Restart - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - end type soilstate_type - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(soilstate_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !ARGUMENTS: - class(soilstate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begg, endg - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - allocate(this%mss_frc_cly_vld_col (begc:endc)) ; this%mss_frc_cly_vld_col (:) = nan - allocate(this%sandfrac_patch (begp:endp)) ; this%sandfrac_patch (:) = nan - allocate(this%clayfrac_patch (begp:endp)) ; this%clayfrac_patch (:) = nan - allocate(this%cellorg_col (begc:endc,nlevsoi)) ; this%cellorg_col (:,:) = nan - allocate(this%cellsand_col (begc:endc,nlevsoi)) ; this%cellsand_col (:,:) = nan - allocate(this%cellclay_col (begc:endc,nlevsoi)) ; this%cellclay_col (:,:) = nan - allocate(this%bd_col (begc:endc,nlevgrnd)) ; this%bd_col (:,:) = nan - - allocate(this%hksat_col (begc:endc,nlevgrnd)) ; this%hksat_col (:,:) = spval - allocate(this%hksat_min_col (begc:endc,nlevgrnd)) ; this%hksat_min_col (:,:) = spval - allocate(this%hk_l_col (begc:endc,nlevgrnd)) ; this%hk_l_col (:,:) = nan - allocate(this%smp_l_col (begc:endc,nlevgrnd)) ; this%smp_l_col (:,:) = nan - allocate(this%smpmin_col (begc:endc)) ; this%smpmin_col (:) = nan - - allocate(this%bsw_col (begc:endc,nlevgrnd)) ; this%bsw_col (:,:) = nan - allocate(this%watsat_col (begc:endc,nlevgrnd)) ; this%watsat_col (:,:) = nan - allocate(this%watdry_col (begc:endc,nlevgrnd)) ; this%watdry_col (:,:) = spval - allocate(this%watopt_col (begc:endc,nlevgrnd)) ; this%watopt_col (:,:) = spval - allocate(this%watfc_col (begc:endc,nlevgrnd)) ; this%watfc_col (:,:) = nan - allocate(this%sucsat_col (begc:endc,nlevgrnd)) ; this%sucsat_col (:,:) = spval - allocate(this%dsl_col (begc:endc)) ; this%dsl_col (:) = spval!nan - allocate(this%soilresis_col (begc:endc)) ; this%soilresis_col (:) = spval!nan - allocate(this%soilbeta_col (begc:endc)) ; this%soilbeta_col (:) = nan - allocate(this%soilalpha_col (begc:endc)) ; this%soilalpha_col (:) = nan - allocate(this%soilalpha_u_col (begc:endc)) ; this%soilalpha_u_col (:) = nan - allocate(this%soilpsi_col (begc:endc,nlevgrnd)) ; this%soilpsi_col (:,:) = nan - allocate(this%wtfact_col (begc:endc)) ; this%wtfact_col (:) = nan - allocate(this%porosity_col (begc:endc,nlayer)) ; this%porosity_col (:,:) = spval - allocate(this%eff_porosity_col (begc:endc,nlevgrnd)) ; this%eff_porosity_col (:,:) = spval - allocate(this%gwc_thr_col (begc:endc)) ; this%gwc_thr_col (:) = nan - - allocate(this%thk_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%thk_col (:,:) = nan - allocate(this%tkmg_col (begc:endc,nlevgrnd)) ; this%tkmg_col (:,:) = nan - allocate(this%tkdry_col (begc:endc,nlevgrnd)) ; this%tkdry_col (:,:) = nan - allocate(this%tksatu_col (begc:endc,nlevgrnd)) ; this%tksatu_col (:,:) = nan - allocate(this%csol_col (begc:endc,nlevgrnd)) ; this%csol_col (:,:) = nan - - allocate(this%rootr_patch (begp:endp,1:nlevgrnd)) ; this%rootr_patch (:,:) = nan - allocate(this%root_depth_patch (begp:endp)) ; this%root_depth_patch (:) = nan - allocate(this%rootr_col (begc:endc,nlevgrnd)) ; this%rootr_col (:,:) = nan - allocate(this%rootr_road_perv_col (begc:endc,1:nlevgrnd)) ; this%rootr_road_perv_col (:,:) = nan - allocate(this%rootfr_patch (begp:endp,1:nlevgrnd)) ; this%rootfr_patch (:,:) = nan - allocate(this%crootfr_patch (begp:endp,1:nlevgrnd)) ; this%crootfr_patch (:,:) = nan - allocate(this%rootfr_col (begc:endc,1:nlevgrnd)) ; this%rootfr_col (:,:) = nan - allocate(this%rootfr_road_perv_col (begc:endc,1:nlevgrnd)) ; this%rootfr_road_perv_col (:,:) = nan - allocate(this%k_soil_root_patch (begp:endp,1:nlevsoi)) ; this%k_soil_root_patch (:,:) = nan - allocate(this%root_conductance_patch(begp:endp,1:nlevsoi)) ; this%root_conductance_patch (:,:) = nan - allocate(this%soil_conductance_patch(begp:endp,1:nlevsoi)) ; this%soil_conductance_patch (:,:) = nan - allocate(this%msw_col (begc:endc,1:nlevgrnd)) ; this%msw_col (:,:) = nan - allocate(this%nsw_col (begc:endc,1:nlevgrnd)) ; this%nsw_col (:,:) = nan - allocate(this%alphasw_col (begc:endc,1:nlevgrnd)) ; this%alphasw_col (:,:) = nan - allocate(this%watres_col (begc:endc,1:nlevgrnd)) ; this%watres_col (:,:) = nan - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! History fields initialization - ! - ! !USES: - use histFileMod , only: hist_addfld1d, hist_addfld2d, no_snow_normal - ! - ! !ARGUMENTS: - class(soilstate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - integer :: begp, endp - character(10) :: active - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !--------------------------------------------------------------------- - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - - active = "inactive" - - call hist_addfld2d (fname='SMP', units='mm', type2d='levgrnd', & - avgflag='A', long_name='soil matric potential (vegetated landunits only)', & - ptr_col=this%smp_l_col, set_spec=spval, l2g_scale_type='veg', default='inactive') - - this%root_conductance_patch(begp:endp,:) = spval - call hist_addfld2d (fname='KROOT', units='1/s', type2d='levsoi', & - avgflag='A', long_name='root conductance each soil layer', & - ptr_patch=this%root_conductance_patch, default='inactive') - - this%soil_conductance_patch(begp:endp,:) = spval - call hist_addfld2d (fname='KSOIL', units='1/s', type2d='levsoi', & - avgflag='A', long_name='soil conductance in each soil layer', & - ptr_patch=this%soil_conductance_patch, default='inactive') - - if (use_cn) then - this%bsw_col(begc:endc,:) = spval - call hist_addfld2d (fname='bsw', units='unitless', type2d='levgrnd', & - avgflag='A', long_name='clap and hornberger B', & - ptr_col=this%bsw_col, default='inactive') - end if - - if (use_dynroot) then - this%rootfr_patch(begp:endp,:) = spval - call hist_addfld2d (fname='ROOTFR', units='proportion', type2d='levgrnd', & - avgflag='A', long_name='fraction of roots in each soil layer', & - ptr_patch=this%rootfr_patch, default='inactive') - end if - - if ( use_dynroot ) then - this%root_depth_patch(begp:endp) = spval - call hist_addfld1d (fname='ROOT_DEPTH', units="m", & - avgflag='A', long_name='rooting depth', & - ptr_patch=this%root_depth_patch, default='inactive' ) - end if - - if (use_cn) then - this%rootr_patch(begp:endp,:) = spval - call hist_addfld2d (fname='ROOTR', units='proportion', type2d='levgrnd', & - avgflag='A', long_name='effective fraction of roots in each soil layer', & - ptr_patch=this%rootr_patch, default='inactive') - end if - - if (use_cn) then - this%rootr_col(begc:endc,:) = spval - call hist_addfld2d (fname='ROOTR_COLUMN', units='proportion', type2d='levgrnd', & - avgflag='A', long_name='effective fraction of roots in each soil layer', & - ptr_col=this%rootr_col, default='inactive') - - end if - - if (use_cn) then - this%soilpsi_col(begc:endc,:) = spval - call hist_addfld2d (fname='SOILPSI', units='MPa', type2d='levgrnd', & - avgflag='A', long_name='soil water potential in each soil layer', & - ptr_col=this%soilpsi_col, default='inactive') - end if - - this%thk_col(begc:endc,-nlevsno+1:0) = spval - data2dptr => this%thk_col(:,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_TK', units='W/m-K', type2d='levsno', & - avgflag='A', long_name='Thermal conductivity', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, default='inactive') - - call hist_addfld2d (fname='SNO_TK_ICE', units='W/m-K', type2d='levsno', & - avgflag='A', long_name='Thermal conductivity (ice landunits only)', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, & - l2g_scale_type='ice', default='inactive') - - this%hk_l_col(begc:endc,:) = spval - call hist_addfld2d (fname='HK', units='mm/s', type2d='levgrnd', & - avgflag='A', long_name='hydraulic conductivity (vegetated landunits only)', & - ptr_col=this%hk_l_col, set_spec=spval, l2g_scale_type='veg', default='inactive') - - this%soilalpha_col(begc:endc) = spval - call hist_addfld1d (fname='SoilAlpha', units='unitless', & - avgflag='A', long_name='factor limiting ground evap', & - ptr_col=this%soilalpha_col, set_urb=spval, default='inactive' ) - - this%soilalpha_u_col(begc:endc) = spval - call hist_addfld1d (fname='SoilAlpha_U', units='unitless', & - avgflag='A', long_name='urban factor limiting ground evap', & - ptr_col=this%soilalpha_u_col, set_nourb=spval, default='inactive') - - if (use_cn) then - this%watsat_col(begc:endc,:) = spval - call hist_addfld2d (fname='watsat', units='m^3/m^3', type2d='levgrnd', & - avgflag='A', long_name='water saturated', & - ptr_col=this%watsat_col, default='inactive') - end if - - if (use_cn) then - this%eff_porosity_col(begc:endc,:) = spval - call hist_addfld2d (fname='EFF_POROSITY', units='proportion', type2d='levgrnd', & - avgflag='A', long_name='effective porosity = porosity - vol_ice', & - ptr_col=this%eff_porosity_col, default='inactive') - end if - - if (use_cn) then - this%watfc_col(begc:endc,:) = spval - call hist_addfld2d (fname='watfc', units='m^3/m^3', type2d='levgrnd', & - avgflag='A', long_name='water field capacity', & - ptr_col=this%watfc_col, default='inactive') - end if - - this%soilresis_col(begc:endc) = spval - call hist_addfld1d (fname='SOILRESIS', units='s/m', & - avgflag='A', long_name='soil resistance to evaporation', & - ptr_col=this%soilresis_col, default='inactive') - - this%dsl_col(begc:endc) = spval - call hist_addfld1d (fname='DSL', units='mm', & - avgflag='A', long_name='dry surface layer thickness', & - ptr_col=this%dsl_col, default='inactive') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! Initialize module soil state variables to reasonable values - ! - ! !USES: - use clm_varpar , only : nlevgrnd - ! - ! !ARGUMENTS: - class(soilstate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - !----------------------------------------------------------------------- - - this%smp_l_col(bounds%begc:bounds%endc,1:nlevgrnd) = -1000._r8 - this%hk_l_col(bounds%begc:bounds%endc,1:nlevgrnd) = 0._r8 - - end subroutine InitCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag) - ! - ! !DESCRIPTION: - ! Read/Write module information to/from restart file. - ! - ! !USES: - use ncdio_pio , only : file_desc_t, ncd_io, ncd_double - use restUtilMod - use spmdMod , only : masterproc - use RootBiophysMod , only : init_vegrootfr - ! - ! !ARGUMENTS: - class(soilstate_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: c - logical :: readvar - logical :: readrootfr = .false. - !------------------------------------------------------------------------ - - call restartvar(ncid=ncid, flag=flag, varname='DSL', xtype=ncd_double, & - dim1name='column', long_name='dsl thickness', units='mm', & - interpinic_flag='interp', readvar=readvar, data=this%dsl_col) - - call restartvar(ncid=ncid, flag=flag, varname='SOILRESIS', xtype=ncd_double, & - dim1name='column', long_name='soil resistance', units='s/m', & - interpinic_flag='interp', readvar=readvar, data=this%soilresis_col) - - call restartvar(ncid=ncid, flag=flag, varname='SMP', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='soil matric potential', units='mm', & - interpinic_flag='interp', readvar=readvar, data=this%smp_l_col) - - call restartvar(ncid=ncid, flag=flag, varname='HK', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='hydraulic conductivity', units='mm/s', & - interpinic_flag='interp', readvar=readvar, data=this%hk_l_col) - - if( use_dynroot ) then - call restartvar(ncid=ncid, flag=flag, varname='root_depth', xtype=ncd_double, & - dim1name='pft', & - long_name='root depth', units='m', & - interpinic_flag='interp', readvar=readvar, data=this%root_depth_patch) - - call restartvar(ncid=ncid, flag=flag, varname='rootfr', xtype=ncd_double, & - dim1name='pft', dim2name='levgrnd', switchdim=.true., & - long_name='root fraction', units='', & - interpinic_flag='interp', readvar=readrootfr, data=this%rootfr_patch) - else - readrootfr = .false. - end if - if (flag=='read' .and. .not. readrootfr ) then - if (masterproc) then - write(iulog,*) "can't find rootfr in restart (or initial) file..." - write(iulog,*) "Initialize rootfr to default" - end if - call init_vegrootfr(bounds, nlevsoi, nlevgrnd, & - this%rootfr_patch(bounds%begp:bounds%endp,1:nlevgrnd), 'water') - call init_vegrootfr(bounds, nlevsoi, nlevgrnd, & - this%crootfr_patch(bounds%begp:bounds%endp,1:nlevgrnd), 'carbon') - end if - - end subroutine Restart - -end module SoilStateType diff --git a/src/biogeophys/SoilWaterMovementMod.F90 b/src/biogeophys/SoilWaterMovementMod.F90 deleted file mode 100644 index d458768ed3..0000000000 --- a/src/biogeophys/SoilWaterMovementMod.F90 +++ /dev/null @@ -1,194 +0,0 @@ -module SoilWaterMovementMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! DESCRIPTION - ! module contains different subroutines to couple soil and root water interactions - ! - ! created by Jinyun Tang, Mar 12, 2014 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_flush - - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: init_soilwater_movement - ! - ! !PUBLIC DATA MEMBERS: - - ! !PRIVATE DATA MEMBERS: - - ! Solution method - integer, parameter :: zengdecker_2009 = 0 - integer, parameter :: moisture_form = 1 - integer, parameter :: mixed_form = 2 - integer, parameter :: head_form = 3 - - ! Boundary conditions - integer, parameter :: bc_head = 0 - integer, parameter :: bc_flux = 1 - integer, parameter :: bc_zero_flux = 2 - integer, parameter :: bc_waterTable = 3 - integer, parameter :: bc_aquifer = 4 - - ! Soil hydraulic properties - integer, parameter :: soil_hp_clapphornberg_1978=0 - integer, parameter :: soil_hp_vanGenuchten_1980=1 - - real(r8),parameter :: m_to_mm = 1.e3_r8 !convert meters to mm - - integer :: soilwater_movement_method ! method for solving richards equation - integer :: upper_boundary_condition ! named variable for the boundary condition - integer :: lower_boundary_condition ! named variable for the boundary condition - - ! Adaptive time stepping algorithmic control parameters - real(r8) :: dtmin ! minimum time step length (seconds) - real(r8) :: verySmall ! a very small number: used to check for sub step completion - real(r8) :: xTolerUpper ! tolerance to halve length of substep - real(r8) :: xTolerLower ! tolerance to double length of substep - integer :: expensive - integer :: inexpensive - integer :: flux_calculation - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !----------------------------------------------------------------------- - -contains - -!#1 - !----------------------------------------------------------------------- - subroutine init_soilwater_movement() - ! - !DESCRIPTION - !specify method for doing soil&root water interactions - ! - ! !USES: - use abortutils , only : endrun - use fileutils , only : getavu, relavu - use spmdMod , only : mpicom, masterproc - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog, use_bedrock - use controlMod , only : NLFilename - use clm_nlUtilsMod , only : find_nlgroup_name - - ! !ARGUMENTS: - !------------------------------------------------------------------------------ - implicit none - integer :: nu_nml ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - character(*), parameter :: subName = "('init_soilwater_movement')" - - !----------------------------------------------------------------------- - -! MUST agree with name in namelist and read statement - namelist /soilwater_movement_inparm/ & - soilwater_movement_method, & - upper_boundary_condition, & - lower_boundary_condition, & - dtmin, & - verySmall, & - xTolerUpper, & - xTolerLower, & - expensive, & - inexpensive, & - flux_calculation - - ! Default values for namelist - - soilwater_movement_method = zengdecker_2009 - upper_boundary_condition = bc_flux - lower_boundary_condition = bc_aquifer - - dtmin=60._r8 - verySmall=1.e-8_r8 - xTolerUpper=1.e-1_r8 - xTolerLower=1.e-2_r8 - expensive=42 - inexpensive=1 - flux_calculation=inexpensive - - ! Read soilwater_movement namelist - if (masterproc) then - nu_nml = getavu() - open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - call find_nlgroup_name(nu_nml, 'soilwater_movement_inparm', status=nml_error) - if (nml_error == 0) then - read(nu_nml, nml=soilwater_movement_inparm,iostat=nml_error) - if (nml_error /= 0) then - call endrun(subname // ':: ERROR reading soilwater_movement namelist') - end if - else - call endrun(subname // ':: ERROR reading soilwater_movement namelist') - end if - close(nu_nml) - call relavu( nu_nml ) - -! test for namelist consistency - if((soilwater_movement_method == zengdecker_2009) .and. & - (lower_boundary_condition /= bc_aquifer)) then - call endrun(subname // ':: ERROR inconsistent soilwater_movement namelist: ZD09 must use bc_aquifer lbc') - endif - if((use_bedrock) .and. (lower_boundary_condition /= bc_zero_flux)) then - call endrun(subname // ':: ERROR inconsistent soilwater_movement namelist: use_bedrock requires bc_zero_flux lbc') - endif - endif - - call shr_mpi_bcast(soilwater_movement_method, mpicom) - call shr_mpi_bcast(upper_boundary_condition, mpicom) - call shr_mpi_bcast(lower_boundary_condition, mpicom) - call shr_mpi_bcast(dtmin, mpicom) - call shr_mpi_bcast(verySmall, mpicom) - call shr_mpi_bcast(xTolerUpper, mpicom) - call shr_mpi_bcast(xTolerLower, mpicom) - call shr_mpi_bcast(expensive, mpicom) - call shr_mpi_bcast(inexpensive, mpicom) - call shr_mpi_bcast(flux_calculation, mpicom) - - - if (masterproc) then - - write(iulog,*) ' ' - write(iulog,*) 'soilwater_movement settings:' - write(iulog,*) ' soilwater_movement_method = ',soilwater_movement_method - write(iulog,*) ' upper_boundary_condition = ',upper_boundary_condition - write(iulog,*) ' lower_boundary_condition = ',lower_boundary_condition - - write(iulog,*) ' use_bedrock = ',use_bedrock - write(iulog,*) ' dtmin = ',dtmin - write(iulog,*) ' verySmall = ',verySmall - write(iulog,*) ' xTolerUpper = ',xTolerUpper - write(iulog,*) ' xTolerLower = ',xTolerLower - write(iulog,*) ' expensive = ',expensive - write(iulog,*) ' inexpensive = ',inexpensive - write(iulog,*) ' flux_calculation = ',flux_calculation - endif - - end subroutine init_soilwater_movement - - -!#2 - !------------------------------------------------------------------------------ - function use_aquifer_layer() result(lres) - ! - !DESCRIPTION - ! return true if an aquifer layer is used - ! otherwise false - implicit none - logical :: lres - - if(lower_boundary_condition == bc_aquifer .or. lower_boundary_condition == bc_watertable)then - lres=.true. - else - lres=.false. - endif - return - - end function use_aquifer_layer - - end module SoilWaterMovementMod diff --git a/src/biogeophys/SoilWaterPlantSinkMod.F90 b/src/biogeophys/SoilWaterPlantSinkMod.F90 deleted file mode 100644 index 32854a3b0a..0000000000 --- a/src/biogeophys/SoilWaterPlantSinkMod.F90 +++ /dev/null @@ -1,444 +0,0 @@ -module SoilWaterPlantSinkMod - - use clm_varctl , only : use_hydrstress - use decompMod , only : bounds_type - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use clm_varctl , only : iulog - use landunit_varcon , only : istsoil,istcrop - use column_varcon , only : icol_road_perv - implicit none - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - subroutine Compute_EffecRootFrac_And_VertTranSink(bounds, num_hydrologyc, & - filter_hydrologyc, soilstate_inst, canopystate_inst, waterflux_inst, energyflux_inst) - - ! --------------------------------------------------------------------------------- - ! This is a wrapper for calculating the effective root fraction and soil - ! water sink due to plant transpiration. - ! Calculate Soil Water Sink to Roots over different types - ! of columns and for different process modules - ! The super-set of all columns that should have a root water sink - ! is filter_hydrologyc - ! There are three groups of columns: - ! 1) impervious roads, 2) non-natural vegetation and 3) natural vegetation - ! There are several methods available. - ! 1) the default version, 2) hydstress version and 3) fates boundary conditions - ! - ! There are only two quantities that are the result of this routine, and its - ! children: - ! waterflux_inst%qflx_rootsoi_col(c,j) - ! soilstate_inst%rootr_col(c,j) - ! - ! - ! --------------------------------------------------------------------------------- - - use SoilStateType , only : soilstate_type - use WaterFluxType , only : waterflux_type - use CanopyStateType , only : canopystate_type - use EnergyFluxType , only : energyflux_type - use ColumnType , only : col - use LandunitType , only : lun - - ! Arguments - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: filter_hydrologyc(num_hydrologyc) ! column filter for soil points - type(soilstate_type) , intent(inout) :: soilstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(energyflux_type) , intent(in) :: energyflux_inst - - ! Local Variables - integer :: filterc(bounds%endc-bounds%begc+1) !column filter - integer :: num_filterc - integer :: num_filterc_tot - integer :: fc - integer :: c - integer :: l - - num_filterc_tot = 0 - - ! 1) pervious roads - num_filterc = 0 - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if (col%itype(c) == icol_road_perv) then - num_filterc = num_filterc + 1 - filterc(num_filterc) = c - end if - end do - num_filterc_tot = num_filterc_tot+num_filterc - if(use_hydrstress) then - call Compute_EffecRootFrac_And_VertTranSink_HydStress_Roads(bounds, & - num_filterc,filterc, soilstate_inst, waterflux_inst) - else - call Compute_EffecRootFrac_And_VertTranSink_Default(bounds, & - num_filterc,filterc, soilstate_inst, waterflux_inst) - end if - - - ! Note: 2 and 3 really don't need to be split. But I am leaving - ! it split in case someone wants to calculate uptake in a special - ! way for a specific LU or coverage type (RGK 04/2017). Feel - ! free to consolidate if there are no plans to do such a thing. - - - ! 2) not ( pervious road or natural vegetation) , everything else - num_filterc = 0 - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - l = col%landunit(c) - if ( (col%itype(c) /= icol_road_perv) .and. (lun%itype(l) /= istsoil) ) then - num_filterc = num_filterc + 1 - filterc(num_filterc) = c - end if - end do - num_filterc_tot = num_filterc_tot+num_filterc - if(use_hydrstress) then - call Compute_EffecRootFrac_And_VertTranSink_HydStress(bounds, & - num_filterc, filterc, waterflux_inst, soilstate_inst, & - canopystate_inst, energyflux_inst) - else - call Compute_EffecRootFrac_And_VertTranSink_Default(bounds, & - num_filterc,filterc, soilstate_inst, waterflux_inst) - end if - - - ! 3) Natural vegetation - num_filterc = 0 - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - l = col%landunit(c) - if ( (lun%itype(l) == istsoil) ) then - num_filterc = num_filterc + 1 - filterc(num_filterc) = c - end if - end do - num_filterc_tot = num_filterc_tot+num_filterc - if (use_hydrstress) then - call Compute_EffecRootFrac_And_VertTranSink_HydStress(bounds, & - num_filterc, filterc, waterflux_inst, soilstate_inst, & - canopystate_inst,energyflux_inst) - else - call Compute_EffecRootFrac_And_VertTranSink_Default(bounds, & - num_filterc,filterc, soilstate_inst, waterflux_inst) - end if - - if (num_hydrologyc /= num_filterc_tot) then - write(iulog,*) 'The total number of columns flagged to root water uptake' - write(iulog,*) 'did not match the total number calculated' - write(iulog,*) 'This is likely a problem with the interpretation of column/lu filters.' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - - return - end subroutine Compute_EffecRootFrac_And_VertTranSink - - ! ==================================================================================== - - subroutine Compute_EffecRootFrac_And_VertTranSink_HydStress_Roads(bounds, & - num_filterc,filterc, soilstate_inst, waterflux_inst) - - use SoilStateType , only : soilstate_type - use WaterFluxType , only : waterflux_type - use clm_varpar , only : nlevsoi - use clm_varpar , only : max_patch_per_col - use PatchType , only : patch - use ColumnType , only : col - - ! Arguments - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_filterc - integer , intent(in) :: filterc(:) - type(soilstate_type) , intent(inout) :: soilstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - - ! Locals - integer :: j - integer :: c - integer :: fc - integer :: pi - integer :: p - real(r8) :: temp(bounds%begc:bounds%endc) ! accumulator for rootr weighting - - - associate(& - qflx_rootsoi_col => waterflux_inst%qflx_rootsoi_col , & ! Output: [real(r8) (:,:) ] - ! vegetation/soil water exchange (mm H2O/s) (+ = to atm) - qflx_tran_veg_patch => waterflux_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] - ! vegetation transpiration (mm H2O/s) (+ = to atm) - qflx_tran_veg_col => waterflux_inst%qflx_tran_veg_col , & ! Input: [real(r8) (:) ] - ! vegetation transpiration (mm H2O/s) (+ = to atm) - rootr_patch => soilstate_inst%rootr_patch , & ! Input: [real(r8) (:,:) ] - ! effective fraction of roots in each soil layer - rootr_col => soilstate_inst%rootr_col & ! Output: [real(r8) (:,:) ] - !effective fraction of roots in each soil layer - ) - - ! First step is to calculate the column-level effective rooting - ! fraction in each soil layer. This is done outside the usual - ! PATCH-to-column averaging routines because it is not a simple - ! weighted average of the PATCH level rootr arrays. Instead, the - ! weighting depends on both the per-unit-area transpiration - ! of the PATCH and the PATCHEs area relative to all PATCHES. - - temp(bounds%begc : bounds%endc) = 0._r8 - - - do j = 1, nlevsoi - do fc = 1, num_filterc - c = filterc(fc) - rootr_col(c,j) = 0._r8 - end do - end do - - do pi = 1,max_patch_per_col - do j = 1,nlevsoi - do fc = 1, num_filterc - c = filterc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - if (patch%active(p)) then - rootr_col(c,j) = rootr_col(c,j) + rootr_patch(p,j) * & - qflx_tran_veg_patch(p) * patch%wtcol(p) - end if - end if - end do - end do - do fc = 1, num_filterc - c = filterc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - if (patch%active(p)) then - temp(c) = temp(c) + qflx_tran_veg_patch(p) * patch%wtcol(p) - end if - end if - end do - end do - - - do j = 1, nlevsoi - do fc = 1, num_filterc - c = filterc(fc) - if (temp(c) /= 0._r8) then - rootr_col(c,j) = rootr_col(c,j)/temp(c) - end if - qflx_rootsoi_col(c,j) = rootr_col(c,j)*qflx_tran_veg_col(c) - end do - end do - end associate - return - end subroutine Compute_EffecRootFrac_And_VertTranSink_HydStress_Roads - - ! ================================================================================== - - subroutine Compute_EffecRootFrac_And_VertTranSink_HydStress( bounds, & - num_filterc, filterc, waterflux_inst, soilstate_inst, & - canopystate_inst, energyflux_inst) - - - ! - !USES: - use decompMod , only : bounds_type - use clm_varpar , only : nlevsoi - use clm_varpar , only : max_patch_per_col - use SoilStateType , only : soilstate_type - use WaterFluxType , only : waterflux_type - use CanopyStateType , only : canopystate_type - use PatchType , only : patch - use ColumnType , only : col - use clm_varctl , only : iulog - use PhotosynthesisMod, only : params_inst - use column_varcon , only : icol_road_perv - use shr_infnan_mod , only : isnan => shr_infnan_isnan - use EnergyFluxType , only : energyflux_type - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_filterc ! number of column soil points in column filter - integer , intent(in) :: filterc(:) ! column filter for soil points - type(waterflux_type) , intent(inout) :: waterflux_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(energyflux_type), intent(in) :: energyflux_inst - ! - ! !LOCAL VARIABLES: - integer :: p,c,fc,j ! do loop indices - integer :: pi ! patch index - real(r8) :: temp(bounds%begc:bounds%endc) ! accumulator for rootr weighting - real(r8) :: grav2 ! soil layer gravitational potential relative to surface (mm H2O) - integer , parameter :: soil=1,root=4 ! index values - !----------------------------------------------------------------------- - - associate(& - k_soil_root => soilstate_inst%k_soil_root_patch , & ! Input: [real(r8) (:,:) ] - ! soil-root interface conductance (mm/s) - qflx_phs_neg_col => waterflux_inst%qflx_phs_neg_col , & ! Input: [real(r8) (:) ] n - ! net neg hydraulic redistribution flux(mm H2O/s) - qflx_tran_veg_col => waterflux_inst%qflx_tran_veg_col , & ! Input: [real(r8) (:) ] - ! vegetation transpiration (mm H2O/s) (+ = to atm) - qflx_tran_veg_patch => waterflux_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] - ! vegetation transpiration (mm H2O/s) (+ = to atm) - qflx_rootsoi_col => waterflux_inst%qflx_rootsoi_col , & ! Output: [real(r8) (:) ] - ! col root and soil water - ! exchange [mm H2O/s] [+ into root] - rootr_col => soilstate_inst%rootr_col , & ! Input: [real(r8) (:,:) ] - ! effective fraction of roots in each soil layer - rootr_patch => soilstate_inst%rootr_patch , & ! Input: [real(r8) (:,:) ] - ! effective fraction of roots in each soil layer - smp => soilstate_inst%smp_l_col , & ! Input: [real(r8) (:,:) ] soil matrix pot. [mm] - frac_veg_nosno => canopystate_inst%frac_veg_nosno_patch , & ! Input: [integer (:) ] - ! fraction of vegetation not - ! covered by snow (0 OR 1) [-] - z => col%z , & ! Input: [real(r8) (:,:) ] layer node depth (m) - vegwp => canopystate_inst%vegwp_patch & ! Input: [real(r8) (:,:) ] vegetation water - ! matric potential (mm) - ) - - do fc = 1, num_filterc - c = filterc(fc) - qflx_phs_neg_col(c) = 0._r8 - - do j = 1, nlevsoi - grav2 = z(c,j) * 1000._r8 - temp(c) = 0._r8 - do pi = 1,max_patch_per_col - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - if (patch%active(p).and.frac_veg_nosno(p)>0) then - if (patch%wtcol(p) > 0._r8) then - temp(c) = temp(c) + k_soil_root(p,j) & - * (smp(c,j) - vegwp(p,4) - grav2)* patch%wtcol(p) - endif - end if - end if - end do - qflx_rootsoi_col(c,j)= temp(c) - - if (temp(c) < 0._r8) qflx_phs_neg_col(c) = qflx_phs_neg_col(c) + temp(c) - end do - - ! Back out the effective root density - if( sum(qflx_rootsoi_col(c,:))>0.0_r8 ) then - do j = 1, nlevsoi - rootr_col(c,j) = qflx_rootsoi_col(c,j)/sum( qflx_rootsoi_col(c,:)) - end do - else - rootr_col(c,:) = 0.0_r8 - end if - end do - - end associate - - return - end subroutine Compute_EffecRootFrac_And_VertTranSink_HydStress - - ! ================================================================================== - - subroutine Compute_EffecRootFrac_And_VertTranSink_Default(bounds, num_filterc, & - filterc, soilstate_inst, waterflux_inst) - - ! - ! Generic routine to apply transpiration as a sink condition that - ! is vertically distributed over the soil column. Should be - ! applicable to any Richards solver that is not coupled to plant - ! hydraulics. - ! - !USES: - use decompMod , only : bounds_type - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varpar , only : nlevsoi, max_patch_per_col - use SoilStateType , only : soilstate_type - use WaterFluxType , only : waterflux_type - use PatchType , only : patch - use ColumnType , only : col - use clm_varctl , only : use_hydrstress - use column_varcon , only : icol_road_perv - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_filterc ! number of column soil points in column filter - integer , intent(in) :: filterc(num_filterc) ! column filter for soil points - type(waterflux_type) , intent(inout) :: waterflux_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - ! - ! !LOCAL VARIABLES: - integer :: p,c,fc,j ! do loop indices - integer :: pi ! patch index - real(r8) :: temp(bounds%begc:bounds%endc) ! accumulator for rootr weighting - associate(& - qflx_rootsoi_col => waterflux_inst%qflx_rootsoi_col , & ! Output: [real(r8) (:,:) ] - ! vegetation/soil water exchange (m H2O/s) (+ = to atm) - qflx_tran_veg_patch => waterflux_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] - ! vegetation transpiration (mm H2O/s) (+ = to atm) - qflx_tran_veg_col => waterflux_inst%qflx_tran_veg_col , & ! Input: [real(r8) (:) ] - ! vegetation transpiration (mm H2O/s) (+ = to atm) - rootr_patch => soilstate_inst%rootr_patch , & ! Input: [real(r8) (:,:) ] - ! effective fraction of roots in each soil layer - rootr_col => soilstate_inst%rootr_col & ! Output: [real(r8) (:,:) ] - ! effective fraction of roots in each soil layer - ) - - ! First step is to calculate the column-level effective rooting - ! fraction in each soil layer. This is done outside the usual - ! PATCH-to-column averaging routines because it is not a simple - ! weighted average of the PATCH level rootr arrays. Instead, the - ! weighting depends on both the per-unit-area transpiration - ! of the PATCH and the PATCHEs area relative to all PATCHES. - - temp(bounds%begc : bounds%endc) = 0._r8 - - do j = 1, nlevsoi - do fc = 1, num_filterc - c = filterc(fc) - rootr_col(c,j) = 0._r8 - end do - end do - - do pi = 1,max_patch_per_col - do j = 1,nlevsoi - do fc = 1, num_filterc - c = filterc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - if (patch%active(p)) then - rootr_col(c,j) = rootr_col(c,j) + rootr_patch(p,j) * & - qflx_tran_veg_patch(p) * patch%wtcol(p) - end if - end if - end do - end do - do fc = 1, num_filterc - c = filterc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - if (patch%active(p)) then - temp(c) = temp(c) + qflx_tran_veg_patch(p) * patch%wtcol(p) - end if - end if - end do - end do - - do j = 1, nlevsoi - do fc = 1, num_filterc - c = filterc(fc) - if (temp(c) /= 0._r8) then - rootr_col(c,j) = rootr_col(c,j)/temp(c) - end if - qflx_rootsoi_col(c,j) = rootr_col(c,j)*qflx_tran_veg_col(c) - - end do - end do - end associate - return - end subroutine Compute_EffecRootFrac_And_VertTranSink_Default - -end module SoilWaterPlantSinkMod - diff --git a/src/biogeophys/SoilWaterRetentionCurveClappHornberg1978Mod.F90 b/src/biogeophys/SoilWaterRetentionCurveClappHornberg1978Mod.F90 deleted file mode 100644 index c82e27d851..0000000000 --- a/src/biogeophys/SoilWaterRetentionCurveClappHornberg1978Mod.F90 +++ /dev/null @@ -1,162 +0,0 @@ -module SoilWaterRetentionCurveClappHornberg1978Mod - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Implementation of soil_water_retention_curve_type using the Clapp-Hornberg 1978 - ! parameterizations. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - implicit none - save - private - ! - ! !PUBLIC TYPES: - public :: soil_water_retention_curve_clapp_hornberg_1978_type - - type, extends(soil_water_retention_curve_type) :: & - soil_water_retention_curve_clapp_hornberg_1978_type - private - contains - procedure :: soil_hk ! compute hydraulic conductivity - procedure :: soil_suction ! compute soil suction potential - procedure :: soil_suction_inverse ! compute relative saturation at which soil suction is equal to a target value - end type soil_water_retention_curve_clapp_hornberg_1978_type - - interface soil_water_retention_curve_clapp_hornberg_1978_type - ! initialize a new soil_water_retention_curve_clapp_hornberg_1978_type object - module procedure constructor - end interface soil_water_retention_curve_clapp_hornberg_1978_type - -contains - - !----------------------------------------------------------------------- - type(soil_water_retention_curve_clapp_hornberg_1978_type) function constructor() - ! - ! !DESCRIPTION: - ! Creates an object of type soil_water_retention_curve_clapp_hornberg_1978_type. - ! For now, this is simply a place-holder. - !----------------------------------------------------------------------- - - end function constructor - - !----------------------------------------------------------------------- - subroutine soil_hk(this, c, j, s, imped, soilstate_inst, hk, dhkds) - ! - ! !DESCRIPTION: - ! Compute hydraulic conductivity - ! - ! !USES: - use SoilStateType , only : soilstate_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_clapp_hornberg_1978_type), intent(in) :: this - integer, intent(in) :: c !column index - integer, intent(in) :: j !level index - real(r8), intent(in) :: s !relative saturation, [0, 1] - real(r8), intent(in) :: imped !ice impedance - type(soilstate_type), intent(in) :: soilstate_inst - real(r8), intent(out) :: hk !hydraulic conductivity [mm/s] - real(r8), optional, intent(out) :: dhkds !d[hk]/ds [mm/s] - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'soil_hk' - !----------------------------------------------------------------------- - - associate(& - hksat => soilstate_inst%hksat_col(c,j) , & ! Input: [real(r8) (:,:) ] hydraulic conductivity at saturation (mm H2O /s) - bsw => soilstate_inst%bsw_col(c,j) & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - ) - - - !compute hydraulic conductivity - hk=imped*hksat*s**(2._r8*bsw+3._r8) - - !compute the derivative - if(present(dhkds))then - dhkds=(2._r8*bsw+3._r8)*hk/s - endif - - end associate - - end subroutine soil_hk - - !----------------------------------------------------------------------- - subroutine soil_suction(this, c, j, s, soilstate_inst, smp, dsmpds) - ! - ! !DESCRIPTION: - ! Compute soil suction potential - ! - ! !USES: - use SoilStateType , only : soilstate_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_clapp_hornberg_1978_type), intent(in) :: this - integer, intent(in) :: c !column index - integer, intent(in) :: j !level index - real(r8), intent(in) :: s !relative saturation, [0, 1] - type(soilstate_type), intent(in) :: soilstate_inst - real(r8), intent(out) :: smp !soil suction, negative, [mm] - real(r8), optional, intent(out) :: dsmpds !d[smp]/ds, [mm] - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'soil_suction' - !----------------------------------------------------------------------- - - associate(& - bsw => soilstate_inst%bsw_col(c,j) , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - sucsat => soilstate_inst%sucsat_col(c,j) & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - ) - - !compute soil suction potential, negative - smp = -sucsat*s**(-bsw) - - !compute derivative - if(present(dsmpds))then - dsmpds=-bsw*smp/s - endif - - end associate - - end subroutine soil_suction - - !----------------------------------------------------------------------- - subroutine soil_suction_inverse(this, c, j, smp_target, soilstate_inst, & - s_target) - ! - ! !DESCRIPTION: - ! Compute relative saturation at which soil suction is equal to a target value. - ! This is done by inverting the soil_suction equation to solve for s. - ! - ! !USES: - use SoilStateType , only : soilstate_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_clapp_hornberg_1978_type), intent(in) :: this - integer, intent(in) :: c !column index - integer, intent(in) :: j !level index - type(soilstate_type), intent(in) :: soilstate_inst - real(r8) , intent(in) :: smp_target ! target soil suction, negative [mm] - real(r8) , intent(out) :: s_target ! relative saturation at which smp = smp_target [0,1] - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'soil_suction_inverse' - !----------------------------------------------------------------------- - - associate(& - bsw => soilstate_inst%bsw_col(c,j) , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - sucsat => soilstate_inst%sucsat_col(c,j) & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - ) - - s_target = (-smp_target/sucsat)**(-1._r8/bsw) - - end associate - - end subroutine soil_suction_inverse - -end module SoilWaterRetentionCurveClappHornberg1978Mod - diff --git a/src/biogeophys/SoilWaterRetentionCurveFactoryMod.F90 b/src/biogeophys/SoilWaterRetentionCurveFactoryMod.F90 deleted file mode 100644 index 61e579dd43..0000000000 --- a/src/biogeophys/SoilWaterRetentionCurveFactoryMod.F90 +++ /dev/null @@ -1,71 +0,0 @@ -module SoilWaterRetentionCurveFactoryMod - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Factory to create an instance of soil_water_retention_curve_type. This module figures - ! out the particular type to return. - ! - ! !USES: - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog - implicit none - save - private - ! - ! !PUBLIC ROUTINES: - public :: create_soil_water_retention_curve ! create an object of class soil_water_retention_curve_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - function create_soil_water_retention_curve() result(soil_water_retention_curve) - ! - ! !DESCRIPTION: - ! Create and return an object of soil_water_retention_curve_type. The particular type - ! is determined based on a namelist parameter. - ! - ! !USES: - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - use SoilWaterRetentionCurveClappHornberg1978Mod, only : soil_water_retention_curve_clapp_hornberg_1978_type - use SoilWaterRetentionCurveVanGenuchten1980Mod, only : soil_water_retention_curve_vangenuchten_1980_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_type), allocatable :: soil_water_retention_curve ! function result - ! - ! !LOCAL VARIABLES: - - ! For now, hard-code the method. Eventually this will be set from namelist, either by - ! this routine (appropriate if the 'method' is in its own namelist group), or do the - ! namelist read outside this module and pass the method in as a parameter (appropriate - ! if the 'method' is part of a larger namelist group). -!scs character(len=*), parameter :: method = "clapphornberg_1978" - character(len=256) :: method - - character(len=*), parameter :: subname = 'create_soil_water_retention_curve' - !----------------------------------------------------------------------- - - method = "clapphornberg_1978" !scs: placeholder until bld scripts changed - - select case (trim(method)) - - case ("clapphornberg_1978") - allocate(soil_water_retention_curve, & - source=soil_water_retention_curve_clapp_hornberg_1978_type()) - - case ("vangenuchten_1980") - allocate(soil_water_retention_curve, & - source=soil_water_retention_curve_vangenuchten_1980_type()) - - case default - write(iulog,*) subname//' ERROR: unknown method: ', method - call endrun(msg=errMsg(sourcefile, __LINE__)) - - end select - - end function create_soil_water_retention_curve - -end module SoilWaterRetentionCurveFactoryMod diff --git a/src/biogeophys/SoilWaterRetentionCurveMod.F90 b/src/biogeophys/SoilWaterRetentionCurveMod.F90 deleted file mode 100644 index 74f8299d54..0000000000 --- a/src/biogeophys/SoilWaterRetentionCurveMod.F90 +++ /dev/null @@ -1,111 +0,0 @@ -module SoilWaterRetentionCurveMod - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Abstract base class for functions to compute soil water retention curve - ! - ! !USES: - implicit none - save - private - ! - ! !PUBLIC TYPES: - public :: soil_water_retention_curve_type - - type, abstract :: soil_water_retention_curve_type - private - contains - ! compute hydraulic conductivity - procedure(soil_hk_interface), deferred :: soil_hk - - ! compute soil suction potential - procedure(soil_suction_interface), deferred :: soil_suction - - ! compute relative saturation at which soil suction is equal to a target value - procedure(soil_suction_inverse_interface), deferred :: soil_suction_inverse - end type soil_water_retention_curve_type - - abstract interface - - ! Note: The following interfaces are set up based on the arguments needed for the - ! clapphornberg1978 implementations. It's likely that these interfaces are not - ! totally general for all desired implementations. In that case, we'll need to think - ! about how to support different interfaces. Some possible solutions are: - ! - ! - Make the interfaces contain all possible inputs that are needed by any - ! implementation; each implementation will then ignore the inputs it doesn't need. - ! - ! - For inputs that are needed only by particular implementations - and particularly - ! for inputs that are constant in time (e.g., this is the case for bsw, I think): - ! pass these into the constructor, and save pointers to these inputs as components - ! of the child type that needs them. Then they aren't needed as inputs to the - ! individual routines, allowing the interfaces for these routines to remain more - ! consistent between different implementations. - - subroutine soil_hk_interface(this, c, j, s, imped, soilstate_inst, & - hk, dhkds) - - ! !DESCRIPTION: - ! Compute hydraulic conductivity - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use SoilStateType , only : soilstate_type - import :: soil_water_retention_curve_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_type), intent(in) :: this - integer, intent(in) :: c !column index - integer, intent(in) :: j !level index - real(r8), intent(in) :: s !relative saturation, [0, 1] - real(r8), intent(in) :: imped !ice impedance - type(soilstate_type), intent(in) :: soilstate_inst - real(r8), intent(out):: hk !hydraulic conductivity [mm/s] - real(r8), optional, intent(out):: dhkds !d[hk]/ds [mm/s] - end subroutine soil_hk_interface - - - subroutine soil_suction_interface(this, c, j, s, soilstate_inst, & - smp, dsmpds) - - ! !DESCRIPTION: - ! Compute soil suction potential - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use SoilStateType , only : soilstate_type - import :: soil_water_retention_curve_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_type), intent(in) :: this - integer, intent(in) :: c !column index - integer, intent(in) :: j !level index - real(r8), intent(in) :: s !relative saturation, [0, 1] - type(soilstate_type), intent(in) :: soilstate_inst - real(r8), intent(out) :: smp !soil suction, negative, [mm] - real(r8), optional, intent(out) :: dsmpds !d[smp]/ds, [mm] - end subroutine soil_suction_interface - - subroutine soil_suction_inverse_interface(this, c, j, smp_target, & - soilstate_inst, s_target) - ! !DESCRIPTION: - ! Compute relative saturation at which soil suction is equal to a target value. - ! This is done by inverting the soil_suction equation to solve for s. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use SoilStateType , only : soilstate_type - import :: soil_water_retention_curve_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_type), intent(in) :: this - integer, intent(in) :: c !column index - integer, intent(in) :: j !level index - real(r8), intent(in) :: smp_target ! target soil suction, negative [mm] - type(soilstate_type), intent(in) :: soilstate_inst - real(r8) , intent(out) :: s_target ! relative saturation at which smp = smp_target [0,1] - end subroutine soil_suction_inverse_interface - - end interface - -end module SoilWaterRetentionCurveMod diff --git a/src/biogeophys/SoilWaterRetentionCurveVanGenuchten1980Mod.F90 b/src/biogeophys/SoilWaterRetentionCurveVanGenuchten1980Mod.F90 deleted file mode 100644 index c8dacccb81..0000000000 --- a/src/biogeophys/SoilWaterRetentionCurveVanGenuchten1980Mod.F90 +++ /dev/null @@ -1,162 +0,0 @@ -module SoilWaterRetentionCurveVanGenuchten1980Mod - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Implementation of soil_water_retention_curve_type using the Clapp-Hornberg 1978 - ! parameterizations. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - implicit none - save - private - ! - ! !PUBLIC TYPES: - public :: soil_water_retention_curve_vangenuchten_1980_type - - type, extends(soil_water_retention_curve_type) :: & - soil_water_retention_curve_vangenuchten_1980_type - private - contains - procedure :: soil_hk ! compute hydraulic conductivity - procedure :: soil_suction ! compute soil suction potential - procedure :: soil_suction_inverse ! compute relative saturation at which soil suction is equal to a target value - end type soil_water_retention_curve_vangenuchten_1980_type - - interface soil_water_retention_curve_vangenuchten_1980_type - ! initialize a new soil_water_retention_curve_vangenuchten_1980_type object - module procedure constructor - end interface soil_water_retention_curve_vangenuchten_1980_type - -contains - - !----------------------------------------------------------------------- - type(soil_water_retention_curve_vangenuchten_1980_type) function constructor() - ! - ! !DESCRIPTION: - ! Creates an object of type soil_water_retention_curve_vangenuchten_1980_type. - ! For now, this is simply a place-holder. - !----------------------------------------------------------------------- - - end function constructor - - !----------------------------------------------------------------------- - subroutine soil_hk(this, c, j, s, imped, soilstate_inst, hk, dhkds) - ! - ! !DESCRIPTION: - ! Compute hydraulic conductivity - ! - ! !USES: - use SoilStateType , only : soilstate_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_vangenuchten_1980_type), intent(in) :: this - integer, intent(in) :: c !column index - integer, intent(in) :: j !level index - real(r8), intent(in) :: s !relative saturation, [0, 1] - real(r8), intent(in) :: imped !ice impedance - type(soilstate_type), intent(in) :: soilstate_inst - real(r8), intent(out) :: hk !hydraulic conductivity [mm/s] - real(r8), optional, intent(out) :: dhkds !d[hk]/ds [mm/s] - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'soil_hk' - !----------------------------------------------------------------------- - - associate(& - hksat => soilstate_inst%hksat_col(c,j) , & ! Input: [real(r8) (:,:) ] hydraulic conductivity at saturation (mm H2O /s) - bsw => soilstate_inst%bsw_col(c,j) & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - ) - - - !compute hydraulic conductivity - hk=imped*hksat*s**(2._r8*bsw+3._r8) - - !compute the derivative - if(present(dhkds))then - dhkds=(2._r8*bsw+3._r8)*hk/s - endif - - end associate - - end subroutine soil_hk - - !----------------------------------------------------------------------- - subroutine soil_suction(this, c, j, s, soilstate_inst, smp, dsmpds) - !j, - ! !DESCRIPTION: - ! Compute soil suction potential - ! - ! !USES: - use SoilStateType , only : soilstate_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_vangenuchten_1980_type), intent(in) :: this - integer, intent(in) :: c !column index - integer, intent(in) :: j !level index - real(r8), intent(in) :: s !relative saturation, [0, 1] - type(soilstate_type), intent(in) :: soilstate_inst - real(r8), intent(out) :: smp !soil suction, negative, [mm] - real(r8), optional, intent(out) :: dsmpds !d[smp]/ds, [mm] - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'soil_suction' - !----------------------------------------------------------------------- - - associate(& - bsw => soilstate_inst%bsw_col(c,j) , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - sucsat => soilstate_inst%sucsat_col(c,j) & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - ) - - !compute soil suction potential, negative - smp = -sucsat*s**(-bsw) - - !compute derivative - if(present(dsmpds))then - dsmpds=-bsw*smp/s - endif - - end associate - - end subroutine soil_suction - - !----------------------------------------------------------------------- - subroutine soil_suction_inverse(this, c, j, smp_target, soilstate_inst, s_target) - ! - ! !DESCRIPTION: - ! Compute relative saturation at which soil suction is equal to a target value. - ! This is done by inverting the soil_suction equation to solve for s. - ! - ! !USES: - use SoilStateType , only : soilstate_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_vangenuchten_1980_type), intent(in) :: this - integer, intent(in) :: c !column index - integer, intent(in) :: j !level index - type(soilstate_type), intent(in) :: soilstate_inst - real(r8) , intent(in) :: smp_target ! target soil suction, negative [mm] - real(r8) , intent(out) :: s_target ! relative saturation at which smp = smp_target [0,1] - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'soil_suction_inverse' - !----------------------------------------------------------------------- - - associate(& - bsw => soilstate_inst%bsw_col(c,j) , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - sucsat => soilstate_inst%sucsat_col(c,j) & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - ) - - s_target = (-smp_target/sucsat)**(-1._r8/bsw) - - end associate - - end subroutine soil_suction_inverse - -end module SoilWaterRetentionCurveVanGenuchten1980Mod - - diff --git a/src/biogeophys/SolarAbsorbedType.F90 b/src/biogeophys/SolarAbsorbedType.F90 deleted file mode 100644 index e167fb3a63..0000000000 --- a/src/biogeophys/SolarAbsorbedType.F90 +++ /dev/null @@ -1,423 +0,0 @@ -module SolarAbsorbedType - - !------------------------------------------------------------------------------ - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_log_mod , only: errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use clm_varcon , only : spval - use clm_varctl , only : use_luna - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - ! !PUBLIC DATA MEMBERS: - type, public :: solarabs_type - - ! Solar reflected - real(r8), pointer :: fsr_patch (:) ! patch solar radiation reflected (W/m**2) - - ! Solar Absorbed - real(r8), pointer :: fsa_patch (:) ! patch solar radiation absorbed (total) (W/m**2) - real(r8), pointer :: fsa_u_patch (:) ! patch urban solar radiation absorbed (total) (W/m**2) - real(r8), pointer :: fsa_r_patch (:) ! patch rural solar radiation absorbed (total) (W/m**2) - real(r8), pointer :: parsun_z_patch (:,:) ! patch absorbed PAR for sunlit leaves in canopy layer (W/m**2) - real(r8), pointer :: parsha_z_patch (:,:) ! patch absorbed PAR for shaded leaves in canopy layer (W/m**2) - real(r8), pointer :: par240d_z_patch (:,:) ! 10-day running mean of daytime patch absorbed PAR for leaves in canopy layer (W/m**2) - real(r8), pointer :: par240x_z_patch (:,:) ! 10-day running mean of maximum patch absorbed PAR for leaves in canopy layer (W/m**2) - real(r8), pointer :: par24d_z_patch (:,:) ! daily accumulated absorbed PAR for leaves in canopy layer from midnight to current step(J/m**2) - real(r8), pointer :: par24x_z_patch (:,:) ! daily max of patch absorbed PAR for leaves in canopy layer from midnight to current step(W/m**2) - real(r8), pointer :: sabg_soil_patch (:) ! patch solar radiation absorbed by soil (W/m**2) - real(r8), pointer :: sabg_snow_patch (:) ! patch solar radiation absorbed by snow (W/m**2) - real(r8), pointer :: sabg_patch (:) ! patch solar radiation absorbed by ground (W/m**2) - real(r8), pointer :: sabg_chk_patch (:) ! patch fsno weighted sum (W/m**2) - real(r8), pointer :: sabg_lyr_patch (:,:) ! patch absorbed radiation in each snow layer and top soil layer (pft,lyr) [W/m2] - real(r8), pointer :: sabg_pen_patch (:) ! patch (rural) shortwave radiation penetrating top soisno layer [W/m2] - - real(r8), pointer :: sub_surf_abs_SW_patch (:) ! patch fraction of solar radiation absorbed below first snow layer - real(r8), pointer :: sabv_patch (:) ! patch solar radiation absorbed by vegetation (W/m**2) - - real(r8), pointer :: sabs_roof_dir_lun (:,:) ! lun direct solar absorbed by roof per unit ground area per unit incident flux - real(r8), pointer :: sabs_roof_dif_lun (:,:) ! lun diffuse solar absorbed by roof per unit ground area per unit incident flux - real(r8), pointer :: sabs_sunwall_dir_lun (:,:) ! lun direct solar absorbed by sunwall per unit wall area per unit incident flux - real(r8), pointer :: sabs_sunwall_dif_lun (:,:) ! lun diffuse solar absorbed by sunwall per unit wall area per unit incident flux - real(r8), pointer :: sabs_shadewall_dir_lun (:,:) ! lun direct solar absorbed by shadewall per unit wall area per unit incident flux - real(r8), pointer :: sabs_shadewall_dif_lun (:,:) ! lun diffuse solar absorbed by shadewall per unit wall area per unit incident flux - real(r8), pointer :: sabs_improad_dir_lun (:,:) ! lun direct solar absorbed by impervious road per unit ground area per unit incident flux - real(r8), pointer :: sabs_improad_dif_lun (:,:) ! lun diffuse solar absorbed by impervious road per unit ground area per unit incident flux - real(r8), pointer :: sabs_perroad_dir_lun (:,:) ! lun direct solar absorbed by pervious road per unit ground area per unit incident flux - real(r8), pointer :: sabs_perroad_dif_lun (:,:) ! lun diffuse solar absorbed by pervious road per unit ground area per unit incident flux - - ! Currently needed by lake code - ! TODO (MV 8/20/2014) should be moved in the future - real(r8), pointer :: fsds_nir_d_patch (:) ! patch incident direct beam nir solar radiation (W/m**2) - real(r8), pointer :: fsds_nir_i_patch (:) ! patch incident diffuse nir solar radiation (W/m**2) - real(r8), pointer :: fsds_nir_d_ln_patch (:) ! patch incident direct beam nir solar radiation at local noon (W/m**2) - real(r8), pointer :: fsr_nir_d_patch (:) ! patch reflected direct beam nir solar radiation (W/m**2) - real(r8), pointer :: fsr_nir_i_patch (:) ! patch reflected diffuse nir solar radiation (W/m**2) - real(r8), pointer :: fsr_nir_d_ln_patch (:) ! patch reflected direct beam nir solar radiation at local noon (W/m**2) - - contains - - procedure, public :: Init - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - procedure, public :: Restart - - end type solarabs_type - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(solarabs_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! - ! Allocate module variables and data structures - ! - ! !USES: - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : nlevcan, nlevcan, numrad, nlevsno - ! - ! !ARGUMENTS: - class(solarabs_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begl, endl - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begl = bounds%begl; endl = bounds%endl - - allocate(this%fsa_patch (begp:endp)) ; this%fsa_patch (:) = nan - allocate(this%fsa_u_patch (begp:endp)) ; this%fsa_u_patch (:) = nan - allocate(this%fsa_r_patch (begp:endp)) ; this%fsa_r_patch (:) = nan - allocate(this%parsun_z_patch (begp:endp,1:nlevcan)) ; this%parsun_z_patch (:,:) = nan - allocate(this%parsha_z_patch (begp:endp,1:nlevcan)) ; this%parsha_z_patch (:,:) = nan - if(use_luna)then - allocate(this%par240d_z_patch (begp:endp,1:nlevcan)) ; this%par240d_z_patch (:,:) = spval - allocate(this%par240x_z_patch (begp:endp,1:nlevcan)) ; this%par240x_z_patch (:,:) = spval - allocate(this%par24d_z_patch (begp:endp,1:nlevcan)) ; this%par24d_z_patch (:,:) = spval - allocate(this%par24x_z_patch (begp:endp,1:nlevcan)) ; this%par24x_z_patch (:,:) = spval - endif - allocate(this%sabv_patch (begp:endp)) ; this%sabv_patch (:) = nan - allocate(this%sabg_patch (begp:endp)) ; this%sabg_patch (:) = nan - allocate(this%sabg_lyr_patch (begp:endp,-nlevsno+1:1)) ; this%sabg_lyr_patch (:,:) = nan - allocate(this%sabg_pen_patch (begp:endp)) ; this%sabg_pen_patch (:) = nan - allocate(this%sabg_soil_patch (begp:endp)) ; this%sabg_soil_patch (:) = nan - allocate(this%sabg_snow_patch (begp:endp)) ; this%sabg_snow_patch (:) = nan - allocate(this%sabg_chk_patch (begp:endp)) ; this%sabg_chk_patch (:) = nan - allocate(this%sabs_roof_dir_lun (begl:endl,1:numrad)) ; this%sabs_roof_dir_lun (:,:) = nan - allocate(this%sabs_roof_dif_lun (begl:endl,1:numrad)) ; this%sabs_roof_dif_lun (:,:) = nan - allocate(this%sabs_sunwall_dir_lun (begl:endl,1:numrad)) ; this%sabs_sunwall_dir_lun (:,:) = nan - allocate(this%sabs_sunwall_dif_lun (begl:endl,1:numrad)) ; this%sabs_sunwall_dif_lun (:,:) = nan - allocate(this%sabs_shadewall_dir_lun (begl:endl,1:numrad)) ; this%sabs_shadewall_dir_lun (:,:) = nan - allocate(this%sabs_shadewall_dif_lun (begl:endl,1:numrad)) ; this%sabs_shadewall_dif_lun (:,:) = nan - allocate(this%sabs_improad_dir_lun (begl:endl,1:numrad)) ; this%sabs_improad_dir_lun (:,:) = nan - allocate(this%sabs_improad_dif_lun (begl:endl,1:numrad)) ; this%sabs_improad_dif_lun (:,:) = nan - allocate(this%sabs_perroad_dir_lun (begl:endl,1:numrad)) ; this%sabs_perroad_dir_lun (:,:) = nan - allocate(this%sabs_perroad_dif_lun (begl:endl,1:numrad)) ; this%sabs_perroad_dif_lun (:,:) = nan - allocate(this%sub_surf_abs_SW_patch (begp:endp)) ; this%sub_surf_abs_SW_patch (:) = nan - allocate(this%fsr_patch (begp:endp)) ; this%fsr_patch (:) = nan - allocate(this%fsr_nir_d_patch (begp:endp)) ; this%fsr_nir_d_patch (:) = nan - allocate(this%fsr_nir_i_patch (begp:endp)) ; this%fsr_nir_i_patch (:) = nan - allocate(this%fsr_nir_d_ln_patch (begp:endp)) ; this%fsr_nir_d_ln_patch (:) = nan - allocate(this%fsds_nir_d_patch (begp:endp)) ; this%fsds_nir_d_patch (:) = nan - allocate(this%fsds_nir_i_patch (begp:endp)) ; this%fsds_nir_i_patch (:) = nan - allocate(this%fsds_nir_d_ln_patch (begp:endp)) ; this%fsds_nir_d_ln_patch (:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! History fields initialization - ! - ! !USES: - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) - use clm_varctl , only : use_snicar_frc - use clm_varpar , only : nlevsno - use histFileMod , only : hist_addfld1d, hist_addfld2d - use histFileMod , only : no_snow_normal - ! - ! !ARGUMENTS: - class(solarabs_type) :: this - type(bounds_type), intent(in) :: bounds - - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - real(r8), pointer :: data2dptr(:,:) ! temp. pointers for slicing larger arrays - real(r8), pointer :: ptr_1d(:) ! pointer to 1d patch array - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - this%fsa_patch(begp:endp) = spval - call hist_addfld1d (fname='FSA', units='W/m^2', & - avgflag='A', long_name='absorbed solar radiation', & - ptr_patch=this%fsa_patch, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='FSA_ICE', units='W/m^2', & - avgflag='A', long_name='absorbed solar radiation (ice landunits only)', & - ptr_patch=this%fsa_patch, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%fsa_r_patch(begp:endp) = spval - call hist_addfld1d (fname='FSA_R', units='W/m^2', & - avgflag='A', long_name='Rural absorbed solar radiation', & - ptr_patch=this%fsa_r_patch, set_spec=spval, default='inactive') - - this%fsa_u_patch(begp:endp) = spval - call hist_addfld1d (fname='FSA_U', units='W/m^2', & - avgflag='A', long_name='Urban absorbed solar radiation', & - ptr_patch=this%fsa_u_patch, c2l_scale_type='urbanf', set_nourb=spval, default='inactive') - - this%fsr_patch(begp:endp) = spval - call hist_addfld1d (fname='FSR', units='W/m^2', & - avgflag='A', long_name='reflected solar radiation', & - ptr_patch=this%fsr_patch, c2l_scale_type='urbanf', default='inactive') - ! Rename of FSR for Urban intercomparision project - call hist_addfld1d (fname='SWup', units='W/m^2', & - avgflag='A', long_name='upwelling shortwave radiation', & - ptr_patch=this%fsr_patch, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='FSR_ICE', units='W/m^2', & - avgflag='A', long_name='reflected solar radiation (ice landunits only)', & - ptr_patch=this%fsr_patch, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%sabg_lyr_patch(begp:endp,-nlevsno+1:0) = spval - data2dptr => this%sabg_lyr_patch(:,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_ABS', units='W/m^2', type2d='levsno', & - avgflag='A', long_name='Absorbed solar radiation in each snow layer', & - ptr_patch=data2dptr, no_snow_behavior=no_snow_normal, default='inactive') - - call hist_addfld2d (fname='SNO_ABS_ICE', units='W/m^2', type2d='levsno', & - avgflag='A', long_name='Absorbed solar radiation in each snow layer (ice landunits only)', & - ptr_patch=data2dptr, no_snow_behavior=no_snow_normal, & - l2g_scale_type='ice', default='inactive') - - this%sabv_patch(begp:endp) = spval - call hist_addfld1d (fname='SABV', units='W/m^2', & - avgflag='A', long_name='solar rad absorbed by veg', & - ptr_patch=this%sabv_patch, c2l_scale_type='urbanf', default='inactive') - - this%sabg_patch(begp:endp) = spval - call hist_addfld1d (fname='SABG', units='W/m^2', & - avgflag='A', long_name='solar rad absorbed by ground', & - ptr_patch=this%sabg_patch, c2l_scale_type='urbanf', default='inactive') - - this%sabg_pen_patch(begp:endp) = spval - call hist_addfld1d (fname='SABG_PEN', units='watt/m^2', & - avgflag='A', long_name='Rural solar rad penetrating top soil or snow layer', & - ptr_patch=this%sabg_pen_patch, set_spec=spval, default='inactive') - - ! Currently needed by lake code - TODO should not be here - this%fsds_nir_d_patch(begp:endp) = spval - call hist_addfld1d (fname='FSDSND', units='W/m^2', & - avgflag='A', long_name='direct nir incident solar radiation', & - ptr_patch=this%fsds_nir_d_patch, default='inactive') - - this%fsds_nir_i_patch(begp:endp) = spval - call hist_addfld1d (fname='FSDSNI', units='W/m^2', & - avgflag='A', long_name='diffuse nir incident solar radiation', & - ptr_patch=this%fsds_nir_i_patch, default='inactive') - - this%fsds_nir_d_ln_patch(begp:endp) = spval - call hist_addfld1d (fname='FSDSNDLN', units='W/m^2', & - avgflag='A', long_name='direct nir incident solar radiation at local noon', & - ptr_patch=this%fsds_nir_d_ln_patch, default='inactive') - - this%fsr_nir_d_patch(begp:endp) = spval - call hist_addfld1d (fname='FSRND', units='W/m^2', & - avgflag='A', long_name='direct nir reflected solar radiation', & - ptr_patch=this%fsr_nir_d_patch, c2l_scale_type='urbanf', default='inactive') - - this%fsr_nir_i_patch(begp:endp) = spval - call hist_addfld1d (fname='FSRNI', units='W/m^2', & - avgflag='A', long_name='diffuse nir reflected solar radiation', & - ptr_patch=this%fsr_nir_i_patch, c2l_scale_type='urbanf', default='inactive') - - this%fsr_nir_d_ln_patch(begp:endp) = spval - call hist_addfld1d (fname='FSRNDLN', units='W/m^2', & - avgflag='A', long_name='direct nir reflected solar radiation at local noon', & - ptr_patch=this%fsr_nir_d_ln_patch, c2l_scale_type='urbanf', default='inactive') - - this%sub_surf_abs_SW_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOINTABS', units='-', & - avgflag='A', long_name='Fraction of incoming solar absorbed by lower snow layers', & - ptr_patch=this%sub_surf_abs_SW_patch, set_lake=spval, set_urb=spval, default='inactive') - - if(use_luna)then - ptr_1d => this%par240d_z_patch(:,1) - call hist_addfld1d (fname='PAR240DZ', units='W/m^2', & - avgflag='A', long_name='10-day running mean of daytime patch absorbed PAR for leaves for top canopy layer', & - ptr_patch=ptr_1d, default='inactive') - ptr_1d => this%par240x_z_patch(:,1) - call hist_addfld1d (fname='PAR240XZ', units='W/m^2', & - avgflag='A', long_name='10-day running mean of maximum patch absorbed PAR for leaves for top canopy layer', & - ptr_patch=ptr_1d, default='inactive') - - endif - - end subroutine InitHistory - - !------------------------------------------------------------------------ - subroutine InitCold(this, bounds) - ! - ! Initialize module surface albedos to reasonable values - ! - use landunit_varcon, only : istsoil, istcrop - ! - ! !ARGUMENTS: - class(solarabs_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begl, endl - !----------------------------------------------------------------------- - - begl = bounds%begl; endl = bounds%endl - - this%sabs_roof_dir_lun (begl:endl, :) = 0._r8 - this%sabs_roof_dif_lun (begl:endl, :) = 0._r8 - this%sabs_sunwall_dir_lun (begl:endl, :) = 0._r8 - this%sabs_sunwall_dif_lun (begl:endl, :) = 0._r8 - this%sabs_shadewall_dir_lun (begl:endl, :) = 0._r8 - this%sabs_shadewall_dif_lun (begl:endl, :) = 0._r8 - this%sabs_improad_dir_lun (begl:endl, :) = 0._r8 - this%sabs_improad_dif_lun (begl:endl, :) = 0._r8 - this%sabs_perroad_dir_lun (begl:endl, :) = 0._r8 - this%sabs_perroad_dif_lun (begl:endl, :) = 0._r8 - - end subroutine InitCold - - !--------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag) - ! - ! !DESCRIPTION: - ! Read/Write module information to/from restart file. - ! - ! !USES: - use shr_infnan_mod , only : shr_infnan_isnan - use clm_varctl , only : use_snicar_frc, iulog - use spmdMod , only : masterproc - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_double, ncd_int, ncd_inqvdlen - use restUtilMod - ! - ! !ARGUMENTS: - class(solarabs_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - logical :: readvar ! determine if variable is on initial file - integer :: p - !--------------------------------------------------------------------- - - call restartvar(ncid=ncid, flag=flag, varname='sabs_roof_dir', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='direct solar absorbed by roof per unit ground area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_roof_dir_lun) - - call restartvar(ncid=ncid, flag=flag, varname='sabs_roof_dif', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='diffuse solar absorbed by roof per unit ground area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_roof_dif_lun) - - call restartvar(ncid=ncid, flag=flag, varname='sabs_sunwall_dir', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='direct solar absorbed by sunwall per unit wall area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_sunwall_dir_lun) - - call restartvar(ncid=ncid, flag=flag, varname='sabs_sunwall_dif', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='diffuse solar absorbed by sunwall per unit wall area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_sunwall_dif_lun) - - call restartvar(ncid=ncid, flag=flag, varname='sabs_shadewall_dir', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='direct solar absorbed by shadewall per unit wall area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_shadewall_dir_lun) - - call restartvar(ncid=ncid, flag=flag, varname='sabs_shadewall_dif', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='diffuse solar absorbed by shadewall per unit wall area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_shadewall_dif_lun) - - call restartvar(ncid=ncid, flag=flag, varname='sabs_improad_dir', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='direct solar absorbed by impervious road per unit ground area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_improad_dir_lun) - - call restartvar(ncid=ncid, flag=flag, varname='sabs_improad_dif', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='diffuse solar absorbed by impervious road per unit ground area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_improad_dif_lun) - - call restartvar(ncid=ncid, flag=flag, varname='sabs_perroad_dir', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='direct solar absorbed by pervious road per unit ground area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_perroad_dir_lun) - - call restartvar(ncid=ncid, flag=flag, varname='sabs_perroad_dif', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='diffuse solar absorbed by pervious road per unit ground area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_perroad_dif_lun) - - if(use_luna)then - call restartvar(ncid=ncid, flag=flag, varname='par240d', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='10-day running mean of daytime absorbed PAR for leaves in canopy layer', units='W/m**2 leaf', & - interpinic_flag='interp', readvar=readvar, data=this%par240d_z_patch ) - call restartvar(ncid=ncid, flag=flag, varname='par24d', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Accumulative daytime absorbed PAR for leaves in canopy layer for 24 hours', units='J/m**2 leaf', & - interpinic_flag='interp', readvar=readvar, data=this%par24d_z_patch ) - - call restartvar(ncid=ncid, flag=flag, varname='par240x', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='10-day running mean of maximum absorbed PAR for leaves in canopy layers', units='W/m**2 leaf', & - interpinic_flag='interp', readvar=readvar, data=this%par240x_z_patch ) - call restartvar(ncid=ncid, flag=flag, varname='par24x', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Maximum absorbed PAR for leaves in canopy layer in 24 hours', units='J/m**2 leaf', & - interpinic_flag='interp', readvar=readvar, data=this%par24x_z_patch ) - - call restartvar(ncid=ncid, flag=flag, varname='parsun', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Instaneous absorbed PAR for sunlit leaves in canopy layer', units='W/m**2 leaf', & - interpinic_flag='interp', readvar=readvar, data=this%parsun_z_patch ) - call restartvar(ncid=ncid, flag=flag, varname='parsha', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Instaneous absorbed PAR for shaded leaves in canopy layer', units='W/m**2 leaf', & - interpinic_flag='interp', readvar=readvar, data=this%parsha_z_patch ) - - endif - - end subroutine Restart - -end module SolarAbsorbedType diff --git a/src/biogeophys/SurfaceAlbedoMod.F90 b/src/biogeophys/SurfaceAlbedoMod.F90 deleted file mode 100644 index 93caf268a8..0000000000 --- a/src/biogeophys/SurfaceAlbedoMod.F90 +++ /dev/null @@ -1,143 +0,0 @@ -module SurfaceAlbedoMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Performs surface albedo calculations - ! - ! !PUBLIC TYPES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use landunit_varcon , only : istsoil, istcrop - use clm_varcon , only : grlnd, namep - use clm_varpar , only : numrad, nlevcan, nlevsno, nlevcan - use clm_varctl , only : fsurdat, iulog, use_snicar_frc - use pftconMod , only : pftcon - use ColumnType , only : col - ! - implicit none - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: SurfaceAlbedoInitTimeConst - ! - ! !PUBLIC DATA MEMBERS: - ! The CLM default albice values are too high. - ! Full-spectral albedo for land ice is ~0.5 (Paterson, Physics of Glaciers, 1994, p. 59) - ! This is the value used in CAM3 by Pritchard et al., GRL, 35, 2008. - - ! albedo land ice by waveband (1=vis, 2=nir) - real(r8), public :: albice(numrad) = (/ 0.80_r8, 0.55_r8 /) - - ! namelist default setting for inputting alblakwi - real(r8), public :: lake_melt_icealb(numrad) = (/ 0.10_r8, 0.10_r8/) - - ! Coefficient for calculating ice "fraction" for lake surface albedo - ! From D. Mironov (2010) Boreal Env. Research - real(r8), parameter :: calb = 95.6_r8 - - ! - ! !PRIVATE DATA MEMBERS: - - ! !PRIVATE DATA FUNCTIONS: - real(r8), allocatable, private :: albsat(:,:) ! wet soil albedo by color class and waveband (1=vis,2=nir) - real(r8), allocatable, private :: albdry(:,:) ! dry soil albedo by color class and waveband (1=vis,2=nir) - integer , allocatable, private :: isoicol(:) ! column soil color class - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine SurfaceAlbedoInitTimeConst(bounds) - ! - ! !DESCRIPTION: - ! Initialize module time constant variables - ! - ! !USES: - use shr_log_mod, only : errMsg => shr_log_errMsg - use fileutils , only : getfil - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_pio_openfile, ncd_pio_closefile - use spmdMod , only : masterproc - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: c,g ! indices - integer :: mxsoil_color ! maximum number of soil color classes - type(file_desc_t) :: ncid ! netcdf id - character(len=256) :: locfn ! local filename - integer :: ier ! error status - logical :: readvar - integer ,pointer :: soic2d (:) ! read in - soil color - !--------------------------------------------------------------------- - - ! Allocate module variable for soil color - - allocate(isoicol(bounds%begc:bounds%endc)) - - ! Determine soil color and number of soil color classes - ! if number of soil color classes is not on input dataset set it to 8 - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - - call ncd_io(ncid=ncid, varname='mxsoil_color', flag='read', data=mxsoil_color, readvar=readvar) - if ( .not. readvar ) mxsoil_color = 8 - - allocate(soic2d(bounds%begg:bounds%endg)) - call ncd_io(ncid=ncid, varname='SOIL_COLOR', flag='read', data=soic2d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: SOIL_COLOR NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - isoicol(c) = soic2d(g) - end do - deallocate(soic2d) - - call ncd_pio_closefile(ncid) - - ! Determine saturated and dry soil albedos for n color classes and - ! numrad wavebands (1=vis, 2=nir) - - allocate(albsat(mxsoil_color,numrad), albdry(mxsoil_color,numrad), stat=ier) - if (ier /= 0) then - write(iulog,*)'allocation error for albsat, albdry' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - if (masterproc) then - write(iulog,*) 'Attempting to read soil colo data .....' - end if - - if (mxsoil_color == 8) then - albsat(1:8,1) = (/0.12_r8,0.11_r8,0.10_r8,0.09_r8,0.08_r8,0.07_r8,0.06_r8,0.05_r8/) - albsat(1:8,2) = (/0.24_r8,0.22_r8,0.20_r8,0.18_r8,0.16_r8,0.14_r8,0.12_r8,0.10_r8/) - albdry(1:8,1) = (/0.24_r8,0.22_r8,0.20_r8,0.18_r8,0.16_r8,0.14_r8,0.12_r8,0.10_r8/) - albdry(1:8,2) = (/0.48_r8,0.44_r8,0.40_r8,0.36_r8,0.32_r8,0.28_r8,0.24_r8,0.20_r8/) - else if (mxsoil_color == 20) then - albsat(1:20,1) = (/0.25_r8,0.23_r8,0.21_r8,0.20_r8,0.19_r8,0.18_r8,0.17_r8,0.16_r8,& - 0.15_r8,0.14_r8,0.13_r8,0.12_r8,0.11_r8,0.10_r8,0.09_r8,0.08_r8,0.07_r8,0.06_r8,0.05_r8,0.04_r8/) - albsat(1:20,2) = (/0.50_r8,0.46_r8,0.42_r8,0.40_r8,0.38_r8,0.36_r8,0.34_r8,0.32_r8,& - 0.30_r8,0.28_r8,0.26_r8,0.24_r8,0.22_r8,0.20_r8,0.18_r8,0.16_r8,0.14_r8,0.12_r8,0.10_r8,0.08_r8/) - albdry(1:20,1) = (/0.36_r8,0.34_r8,0.32_r8,0.31_r8,0.30_r8,0.29_r8,0.28_r8,0.27_r8,& - 0.26_r8,0.25_r8,0.24_r8,0.23_r8,0.22_r8,0.20_r8,0.18_r8,0.16_r8,0.14_r8,0.12_r8,0.10_r8,0.08_r8/) - albdry(1:20,2) = (/0.61_r8,0.57_r8,0.53_r8,0.51_r8,0.49_r8,0.48_r8,0.45_r8,0.43_r8,& - 0.41_r8,0.39_r8,0.37_r8,0.35_r8,0.33_r8,0.31_r8,0.29_r8,0.27_r8,0.25_r8,0.23_r8,0.21_r8,0.16_r8/) - else - write(iulog,*)'maximum color class = ',mxsoil_color,' is not supported' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! Set alblakwi - !alblakwi(:) = lake_melt_icealb(:) - - end subroutine SurfaceAlbedoInitTimeConst - -end module SurfaceAlbedoMod diff --git a/src/biogeophys/SurfaceAlbedoType.F90 b/src/biogeophys/SurfaceAlbedoType.F90 index 1540d9f991..3bda969af9 100644 --- a/src/biogeophys/SurfaceAlbedoType.F90 +++ b/src/biogeophys/SurfaceAlbedoType.F90 @@ -4,10 +4,8 @@ module SurfaceAlbedoType !----------------------------------------------------------------------- use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type - use clm_varpar , only : numrad, nlevcan, nlevsno - use abortutils , only : endrun + use clm_varpar , only : numrad ! ! !PUBLIC TYPES: implicit none @@ -16,55 +14,13 @@ module SurfaceAlbedoType ! !PUBLIC DATA MEMBERS: type, public :: surfalb_type - real(r8), pointer :: coszen_col (:) ! col cosine of solar zenith angle - real(r8), pointer :: albd_patch (:,:) ! patch surface albedo (direct) (numrad) - real(r8), pointer :: albi_patch (:,:) ! patch surface albedo (diffuse) (numrad) - real(r8), pointer :: albgrd_pur_col (:,:) ! col pure snow ground direct albedo (numrad) - real(r8), pointer :: albgri_pur_col (:,:) ! col pure snow ground diffuse albedo (numrad) - real(r8), pointer :: albgrd_bc_col (:,:) ! col ground direct albedo without BC (numrad) - real(r8), pointer :: albgri_bc_col (:,:) ! col ground diffuse albedo without BC (numrad) - real(r8), pointer :: albgrd_oc_col (:,:) ! col ground direct albedo without OC (numrad) - real(r8), pointer :: albgri_oc_col (:,:) ! col ground diffuse albedo without OC (numrad) - real(r8), pointer :: albgrd_dst_col (:,:) ! col ground direct albedo without dust (numrad) - real(r8), pointer :: albgri_dst_col (:,:) ! col ground diffuse albedo without dust (numrad) - real(r8), pointer :: albgrd_col (:,:) ! col ground albedo (direct) (numrad) - real(r8), pointer :: albgri_col (:,:) ! col ground albedo (diffuse) (numrad) - real(r8), pointer :: albsod_col (:,:) ! col soil albedo: direct (col,bnd) [frc] - real(r8), pointer :: albsoi_col (:,:) ! col soil albedo: diffuse (col,bnd) [frc] - real(r8), pointer :: albsnd_hst_col (:,:) ! col snow albedo, direct , for history files (col,bnd) [frc] - real(r8), pointer :: albsni_hst_col (:,:) ! col snow albedo, diffuse, for history files (col,bnd) [frc] - - real(r8), pointer :: ftdd_patch (:,:) ! patch down direct flux below canopy per unit direct flx (numrad) - real(r8), pointer :: ftid_patch (:,:) ! patch down diffuse flux below canopy per unit direct flx (numrad) - real(r8), pointer :: ftii_patch (:,:) ! patch down diffuse flux below canopy per unit diffuse flx (numrad) - real(r8), pointer :: fabd_patch (:,:) ! patch flux absorbed by canopy per unit direct flux (numrad) - real(r8), pointer :: fabd_sun_patch (:,:) ! patch flux absorbed by sunlit canopy per unit direct flux (numrad) - real(r8), pointer :: fabd_sha_patch (:,:) ! patch flux absorbed by shaded canopy per unit direct flux (numrad) - real(r8), pointer :: fabi_patch (:,:) ! patch flux absorbed by canopy per unit diffuse flux (numrad) - real(r8), pointer :: fabi_sun_patch (:,:) ! patch flux absorbed by sunlit canopy per unit diffuse flux (numrad) - real(r8), pointer :: fabi_sha_patch (:,:) ! patch flux absorbed by shaded canopy per unit diffuse flux (numrad) - real(r8), pointer :: fabd_sun_z_patch (:,:) ! patch absorbed sunlit leaf direct PAR (per unit lai+sai) for each canopy layer - real(r8), pointer :: fabd_sha_z_patch (:,:) ! patch absorbed shaded leaf direct PAR (per unit lai+sai) for each canopy layer - real(r8), pointer :: fabi_sun_z_patch (:,:) ! patch absorbed sunlit leaf diffuse PAR (per unit lai+sai) for each canopy layer - real(r8), pointer :: fabi_sha_z_patch (:,:) ! patch absorbed shaded leaf diffuse PAR (per unit lai+sai) for each canopy layer - real(r8), pointer :: flx_absdv_col (:,:) ! col absorbed flux per unit incident direct flux: VIS (col,lyr) [frc] - real(r8), pointer :: flx_absdn_col (:,:) ! col absorbed flux per unit incident direct flux: NIR (col,lyr) [frc] - real(r8), pointer :: flx_absiv_col (:,:) ! col absorbed flux per unit incident diffuse flux: VIS (col,lyr) [frc] - real(r8), pointer :: flx_absin_col (:,:) ! col absorbed flux per unit incident diffuse flux: NIR (col,lyr) [frc] - - real(r8) , pointer :: fsun_z_patch (:,:) ! patch patch sunlit fraction of canopy layer - real(r8) , pointer :: tlai_z_patch (:,:) ! patch tlai increment for canopy layer - real(r8) , pointer :: tsai_z_patch (:,:) ! patch tsai increment for canopy layer - integer , pointer :: ncan_patch (:) ! patch number of canopy layers - integer , pointer :: nrad_patch (:) ! patch number of canopy layers, above snow for radiative transfer - real(r8) , pointer :: vcmaxcintsun_patch (:) ! patch leaf to canopy scaling coefficient, sunlit leaf vcmax - real(r8) , pointer :: vcmaxcintsha_patch (:) ! patch leaf to canopy scaling coefficient, shaded leaf vcmax + real(r8), pointer :: albd_patch(:,:) ! patch surface albedo (direct) (numrad) + real(r8), pointer :: albi_patch(:,:) ! patch surface albedo (diffuse) (numrad) contains procedure, public :: Init procedure, private :: InitAllocate - procedure, private :: InitHistory procedure, private :: InitCold procedure, public :: Restart @@ -83,7 +39,6 @@ subroutine Init(this, bounds) type(bounds_type), intent(in) :: bounds call this%InitAllocate(bounds) - call this%InitHistory(bounds) call this%InitCold(bounds) end subroutine Init @@ -95,7 +50,6 @@ subroutine InitAllocate(this, bounds) ! ! !USES: use shr_infnan_mod, only: nan => shr_infnan_nan, assignment(=) - use clm_varcon , only: spval, ispval ! ! !ARGUMENTS: class(surfalb_type) :: this @@ -103,107 +57,15 @@ subroutine InitAllocate(this, bounds) ! ! !LOCAL VARIABLES: integer :: begp, endp - integer :: begc, endc !--------------------------------------------------------------------- begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - allocate(this%coszen_col (begc:endc)) ; this%coszen_col (:) = nan - allocate(this%albgrd_col (begc:endc,numrad)) ; this%albgrd_col (:,:) = nan - allocate(this%albgri_col (begc:endc,numrad)) ; this%albgri_col (:,:) = nan - allocate(this%albsnd_hst_col (begc:endc,numrad)) ; this%albsnd_hst_col (:,:) = spval - allocate(this%albsni_hst_col (begc:endc,numrad)) ; this%albsni_hst_col (:,:) = spval - allocate(this%albsod_col (begc:endc,numrad)) ; this%albsod_col (:,:) = spval - allocate(this%albsoi_col (begc:endc,numrad)) ; this%albsoi_col (:,:) = spval - allocate(this%albgrd_pur_col (begc:endc,numrad)) ; this%albgrd_pur_col (:,:) = nan - allocate(this%albgri_pur_col (begc:endc,numrad)) ; this%albgri_pur_col (:,:) = nan - allocate(this%albgrd_bc_col (begc:endc,numrad)) ; this%albgrd_bc_col (:,:) = nan - allocate(this%albgri_bc_col (begc:endc,numrad)) ; this%albgri_bc_col (:,:) = nan - allocate(this%albgrd_oc_col (begc:endc,numrad)) ; this%albgrd_oc_col (:,:) = nan - allocate(this%albgri_oc_col (begc:endc,numrad)) ; this%albgri_oc_col (:,:) = nan - allocate(this%albgrd_dst_col (begc:endc,numrad)) ; this%albgrd_dst_col (:,:) = nan - allocate(this%albgri_dst_col (begc:endc,numrad)) ; this%albgri_dst_col (:,:) = nan - allocate(this%albd_patch (begp:endp,numrad)) ; this%albd_patch (:,:) = nan - allocate(this%albi_patch (begp:endp,numrad)) ; this%albi_patch (:,:) = nan - allocate(this%ftdd_patch (begp:endp,numrad)) ; this%ftdd_patch (:,:) = nan - allocate(this%ftid_patch (begp:endp,numrad)) ; this%ftid_patch (:,:) = nan - allocate(this%ftii_patch (begp:endp,numrad)) ; this%ftii_patch (:,:) = nan - allocate(this%fabd_patch (begp:endp,numrad)) ; this%fabd_patch (:,:) = nan - allocate(this%fabd_sun_patch (begp:endp,numrad)) ; this%fabd_sun_patch (:,:) = nan - allocate(this%fabd_sha_patch (begp:endp,numrad)) ; this%fabd_sha_patch (:,:) = nan - allocate(this%fabi_patch (begp:endp,numrad)) ; this%fabi_patch (:,:) = nan - allocate(this%fabi_sun_patch (begp:endp,numrad)) ; this%fabi_sun_patch (:,:) = nan - allocate(this%fabi_sha_patch (begp:endp,numrad)) ; this%fabi_sha_patch (:,:) = nan - allocate(this%fabd_sun_z_patch (begp:endp,nlevcan)) ; this%fabd_sun_z_patch (:,:) = 0._r8 - allocate(this%fabd_sha_z_patch (begp:endp,nlevcan)) ; this%fabd_sha_z_patch (:,:) = 0._r8 - allocate(this%fabi_sun_z_patch (begp:endp,nlevcan)) ; this%fabi_sun_z_patch (:,:) = 0._r8 - allocate(this%fabi_sha_z_patch (begp:endp,nlevcan)) ; this%fabi_sha_z_patch (:,:) = 0._r8 - allocate(this%flx_absdv_col (begc:endc,-nlevsno+1:1)) ; this%flx_absdv_col (:,:) = spval - allocate(this%flx_absdn_col (begc:endc,-nlevsno+1:1)) ; this%flx_absdn_col (:,:) = spval - allocate(this%flx_absiv_col (begc:endc,-nlevsno+1:1)) ; this%flx_absiv_col (:,:) = spval - allocate(this%flx_absin_col (begc:endc,-nlevsno+1:1)) ; this%flx_absin_col (:,:) = spval - - allocate(this%fsun_z_patch (begp:endp,nlevcan)) ; this%fsun_z_patch (:,:) = 0._r8 - allocate(this%tlai_z_patch (begp:endp,nlevcan)) ; this%tlai_z_patch (:,:) = 0._r8 - allocate(this%tsai_z_patch (begp:endp,nlevcan)) ; this%tsai_z_patch (:,:) = 0._r8 - allocate(this%ncan_patch (begp:endp)) ; this%ncan_patch (:) = 0 - allocate(this%nrad_patch (begp:endp)) ; this%nrad_patch (:) = 0 - allocate(this%vcmaxcintsun_patch (begp:endp)) ; this%vcmaxcintsun_patch (:) = nan - allocate(this%vcmaxcintsha_patch (begp:endp)) ; this%vcmaxcintsha_patch (:) = nan + allocate(this%albd_patch(begp:endp,numrad)); this%albd_patch(:,:) = nan + allocate(this%albi_patch(begp:endp,numrad)); this%albi_patch(:,:) = nan end subroutine InitAllocate - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! History fields initialization - ! - ! !USES: - use shr_infnan_mod, only: nan => shr_infnan_nan, assignment(=) - use clm_varcon , only: spval - use histFileMod , only: hist_addfld1d, hist_addfld2d - ! - ! !ARGUMENTS: - class(surfalb_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - this%coszen_col(begc:endc) = spval - call hist_addfld1d (fname='COSZEN', units='none', & - avgflag='A', long_name='cosine of solar zenith angle', & - ptr_col=this%coszen_col, default='inactive') - - this%albgri_col(begc:endc,:) = spval - call hist_addfld2d (fname='ALBGRD', units='proportion', type2d='numrad', & - avgflag='A', long_name='ground albedo (direct)', & - ptr_col=this%albgrd_col, default='inactive') - - this%albgri_col(begc:endc,:) = spval - call hist_addfld2d (fname='ALBGRI', units='proportion', type2d='numrad', & - avgflag='A', long_name='ground albedo (indirect)', & - ptr_col=this%albgri_col, default='inactive') - - this%albd_patch(begp:endp,:) = spval - call hist_addfld2d (fname='ALBD', units='proportion', type2d='numrad', & - avgflag='A', long_name='surface albedo (direct)', & - ptr_patch=this%albd_patch, default='inactive', c2l_scale_type='urbanf') - - this%albi_patch(begp:endp,:) = spval - call hist_addfld2d (fname='ALBI', units='proportion', type2d='numrad', & - avgflag='A', long_name='surface albedo (indirect)', & - ptr_patch=this%albi_patch, default='inactive', c2l_scale_type='urbanf') - - end subroutine InitHistory - !----------------------------------------------------------------------- subroutine InitCold(this, bounds) ! @@ -214,56 +76,25 @@ subroutine InitCold(this, bounds) type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: - integer :: begc, endc integer :: begp, endp !----------------------------------------------------------------------- begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - this%albgrd_col (begc:endc, :) = 0.2_r8 - this%albgri_col (begc:endc, :) = 0.2_r8 - this%albsod_col (begc:endc, :) = 0.2_r8 - this%albsoi_col (begc:endc, :) = 0.2_r8 - this%albsnd_hst_col (begc:endc, :) = 0.6_r8 - this%albsni_hst_col (begc:endc, :) = 0.6_r8 this%albd_patch (begp:endp, :) = 0.2_r8 this%albi_patch (begp:endp, :) = 0.2_r8 - this%albgrd_pur_col (begc:endc, :) = 0.2_r8 - this%albgri_pur_col (begc:endc, :) = 0.2_r8 - this%albgrd_bc_col (begc:endc, :) = 0.2_r8 - this%albgri_bc_col (begc:endc, :) = 0.2_r8 - this%albgrd_oc_col (begc:endc, :) = 0.2_r8 - this%albgri_oc_col (begc:endc, :) = 0.2_r8 - this%albgrd_dst_col (begc:endc, :) = 0.2_r8 - this%albgri_dst_col (begc:endc, :) = 0.2_r8 - - this%fabi_patch (begp:endp, :) = 0.0_r8 - this%fabd_patch (begp:endp, :) = 0.0_r8 - this%fabi_sun_patch (begp:endp, :) = 0.0_r8 - this%fabd_sun_patch (begp:endp, :) = 0.0_r8 - this%fabd_sha_patch (begp:endp, :) = 0.0_r8 - this%fabi_sha_patch (begp:endp, :) = 0.0_r8 - this%ftdd_patch (begp:endp, :) = 1.0_r8 - this%ftid_patch (begp:endp, :) = 0.0_r8 - this%ftii_patch (begp:endp, :) = 1.0_r8 - end subroutine InitCold !--------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag, & - tlai_patch, tsai_patch) + subroutine Restart(this, bounds, ncid, flag) ! ! !DESCRIPTION: ! Read/Write module information to/from restart file. ! ! !USES: - use clm_varctl , only : use_snicar_frc, iulog - use spmdMod , only : masterproc use decompMod , only : bounds_type - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_double, ncd_int, ncd_inqvdlen + use ncdio_pio , only : file_desc_t, ncd_double use restUtilMod ! ! !ARGUMENTS: @@ -271,366 +102,21 @@ subroutine Restart(this, bounds, ncid, flag, & type(bounds_type) , intent(in) :: bounds type(file_desc_t) , intent(inout) :: ncid ! netcdf id character(len=*) , intent(in) :: flag ! 'read' or 'write' - real(r8) , intent(in) :: tlai_patch(bounds%begp:) - real(r8) , intent(in) :: tsai_patch(bounds%begp:) ! ! !LOCAL VARIABLES: logical :: readvar ! determine if variable is on initial file - integer :: iv - integer :: begp, endp - integer :: begc, endc !--------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(tlai_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tsai_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - call restartvar(ncid=ncid, flag=flag, varname='coszen', xtype=ncd_double, & - dim1name='column', & - long_name='cosine of solar zenith angle', units='unitless', & - interpinic_flag='interp', readvar=readvar, data=this%coszen_col) - - call restartvar(ncid=ncid, flag=flag, varname='albd', xtype=ncd_double, & + call restartvar(ncid=ncid, flag=flag, varname='albd', xtype=ncd_double, & dim1name='pft', dim2name='numrad', switchdim=.true., & long_name='surface albedo (direct) (0 to 1)', units='', & interpinic_flag='interp', readvar=readvar, data=this%albd_patch) - call restartvar(ncid=ncid, flag=flag, varname='albi', xtype=ncd_double, & + call restartvar(ncid=ncid, flag=flag, varname='albi', xtype=ncd_double, & dim1name='pft', dim2name='numrad', switchdim=.true., & long_name='surface albedo (diffuse) (0 to 1)', units='', & interpinic_flag='interp', readvar=readvar, data=this%albi_patch) - call restartvar(ncid=ncid, flag=flag, varname='albgrd', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo (direct) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albgrd_col) - - call restartvar(ncid=ncid, flag=flag, varname='albgri', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo (indirect) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albgri_col) - - call restartvar(ncid=ncid, flag=flag, varname='albsod', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='soil albedo (direct) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albsod_col) - - call restartvar(ncid=ncid, flag=flag, varname='albsoi', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='soil albedo (indirect) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albsoi_col) - - call restartvar(ncid=ncid, flag=flag, varname='albsnd_hst', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='snow albedo (direct) (0 to 1)', units='proportion', & - interpinic_flag='interp', readvar=readvar, data=this%albsnd_hst_col) - - call restartvar(ncid=ncid, flag=flag, varname='albsni_hst', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='snow albedo (diffuse) (0 to 1)', units='proportion', & - interpinic_flag='interp', readvar=readvar, data=this%albsni_hst_col) - - call restartvar(ncid=ncid, flag=flag, varname='tlai_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='tlai increment for canopy layer', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tlai_z_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) then - write(iulog,*) "can't find tlai_z in restart (or initial) file..." - write(iulog,*) "Initialize tlai_z to tlai/nlevcan" - end if - do iv=1,nlevcan - this%tlai_z_patch(begp:endp,iv) = tlai_patch(begp:endp) / nlevcan - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='tsai_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='tsai increment for canopy layer', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tsai_z_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) then - write(iulog,*) "can't find tsai_z in restart (or initial) file..." - write(iulog,*) "Initialize tsai_z to tsai/nlevcan" - end if - do iv=1,nlevcan - this%tsai_z_patch(begp:endp,iv) = tsai_patch(begp:endp) / nlevcan - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='ncan', xtype=ncd_int, & - dim1name='pft', long_name='number of canopy layers', units='', & - interpinic_flag='interp', readvar=readvar, data=this%ncan_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find ncan in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize ncan to nlevcan" - this%ncan_patch(begp:endp) = nlevcan - end if - - call restartvar(ncid=ncid, flag=flag, varname='nrad', xtype=ncd_int, & - dim1name='pft', long_name='number of canopy layers, above snow for radiative transfer', units='', & - interpinic_flag='interp', readvar=readvar, data=this%nrad_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find nrad in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize nrad to nlevcan" - this%nrad_patch(begp:endp) = nlevcan - end if - - call restartvar(ncid=ncid, flag=flag, varname='fsun_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='sunlit fraction for canopy layer', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fsun_z_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find fsun_z in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize fsun_z to 0" - do iv=1,nlevcan - this%fsun_z_patch(begp:endp,iv) = 0._r8 - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='vcmaxcintsun', xtype=ncd_double, & - dim1name='pft', long_name='sunlit canopy scaling coefficient', units='', & - interpinic_flag='interp', readvar=readvar, data=this%vcmaxcintsun_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find vcmaxcintsun in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize vcmaxcintsun to 1" - this%vcmaxcintsun_patch(begp:endp) = 1._r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='vcmaxcintsha', xtype=ncd_double, & - dim1name='pft', long_name='shaded canopy scaling coefficient', units='', & - interpinic_flag='interp', readvar=readvar, data=this%vcmaxcintsha_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find vcmaxcintsha in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize vcmaxcintsha to 1" - this%vcmaxcintsha_patch(begp:endp) = 1._r8 - end if - - if (use_snicar_frc) then - - call restartvar(ncid=ncid, flag=flag, varname='albgrd_bc', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo without BC (direct) (0 to 1)', units='', & - interpinic_flag='interp',readvar=readvar, data=this%albgrd_bc_col) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgrd_bc in initial file..." - if (masterproc) write(iulog,*) "Initialize albgrd_bc to albgrd" - this%albgrd_bc_col(begc:endc,:) = this%albgrd_col(begc:endc,:) - end if - - call restartvar(ncid=ncid, flag=flag, varname='albgri_bc', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo without BC (diffuse) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albgri_bc_col) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgri_bc in initial file..." - if (masterproc) write(iulog,*) "Initialize albgri_bc to albgri" - this%albgri_bc_col(begc:endc,:) = this%albgri_col(begc:endc,:) - end if - - call restartvar(ncid=ncid, flag=flag, varname='albgrd_pur', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='pure snow ground albedo (direct) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albgrd_pur_col) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgrd_pur in initial file..." - if (masterproc) write(iulog,*) "Initialize albgrd_pur to albgrd" - this%albgrd_pur_col(begc:endc,:) = this%albgrd_col(begc:endc,:) - end if - - call restartvar(ncid=ncid, flag=flag, varname='albgri_pur', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='pure snow ground albedo (diffuse) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albgri_pur_col) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgri_pur in initial file..." - if (masterproc) write(iulog,*) "Initialize albgri_pur to albgri" - this%albgri_pur_col(begc:endc,:) = this%albgri_col(begc:endc,:) - end if - - call restartvar(ncid=ncid, flag=flag, varname='albgrd_oc', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo without OC (direct) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albgrd_oc_col) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgrd_oc in initial file..." - if (masterproc) write(iulog,*) "Initialize albgrd_oc to albgrd" - this%albgrd_oc_col(begc:endc,:) = this%albgrd_col(begc:endc,:) - end if - - call restartvar(ncid=ncid, flag=flag, varname='albgri_oc', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo without OC (diffuse) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albgri_oc_col) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgri_oc in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize albgri_oc to albgri" - this%albgri_oc_col(begc:endc,:) = this%albgri_col(begc:endc,:) - end if - - call restartvar(ncid=ncid, flag=flag, varname='albgrd_dst', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo without dust (direct) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albgrd_dst_col) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgrd_dst in initial file..." - if (masterproc) write(iulog,*) "Initialize albgrd_dst to albgrd" - this%albgrd_dst_col(begc:endc,:) = this%albgrd_col(begc:endc,:) - end if - - call restartvar(ncid=ncid, flag=flag, varname='albgri_dst', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo without dust (diffuse) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albgri_dst_col) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgri_dst in initial file..." - if (masterproc) write(iulog,*) "Initialize albgri_dst to albgri" - this%albgri_dst_col(begc:endc,:) = this%albgri_col(begc:endc,:) - end if - - end if ! end of if-use_snicar_frc - - ! patch type physical state variable - fabd - call restartvar(ncid=ncid, flag=flag, varname='fabd', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='flux absorbed by veg per unit direct flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabd_patch) - - call restartvar(ncid=ncid, flag=flag, varname='fabi', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='flux absorbed by veg per unit diffuse flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabi_patch) - - call restartvar(ncid=ncid, flag=flag, varname='fabd_sun', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='flux absorbed by sunlit leaf per unit direct flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabd_sun_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find fabd_sun in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize fabd_sun to fabd/2" - this%fabd_sun_patch(begp:endp,:) = this%fabd_patch(begp:endp,:)/2._r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='fabd_sha', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='flux absorbed by shaded leaf per unit direct flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabd_sha_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find fabd_sha in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize fabd_sha to fabd/2" - this%fabd_sha_patch(begp:endp,:) = this%fabd_patch(begp:endp,:)/2._r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='fabi_sun', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='flux absorbed by sunlit leaf per unit diffuse flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabi_sun_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find fabi_sun in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize fabi_sun to fabi/2" - this%fabi_sun_patch(begp:endp,:) = this%fabi_patch(begp:endp,:)/2._r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='fabi_sha', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='flux absorbed by shaded leaf per unit diffuse flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabi_sha_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find fabi_sha in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize fabi_sha to fabi/2" - this%fabi_sha_patch(begp:endp,:) = this%fabi_patch(begp:endp,:)/2._r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='fabd_sun_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='absorbed sunlit leaf direct PAR (per unit lai+sai) for canopy layer', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabd_sun_z_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find fabd_sun_z in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize fabd_sun_z to (fabd/2)/nlevcan" - do iv=1,nlevcan - this%fabd_sun_z_patch(begp:endp,iv) = (this%fabd_patch(begp:endp,1)/2._r8)/nlevcan - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='fabd_sha_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='absorbed shaded leaf direct PAR (per unit lai+sai) for canopy layer', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabd_sha_z_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find fabd_sha_z in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize fabd_sha_z to (fabd/2)/nlevcan" - do iv=1,nlevcan - this%fabd_sha_z_patch(begp:endp,iv) = (this%fabd_patch(begp:endp,1)/2._r8)/nlevcan - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='fabi_sun_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='absorbed sunlit leaf diffuse PAR (per unit lai+sai) for canopy layer', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabi_sun_z_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find fabi_sun_z in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize fabi_sun_z to (fabi/2)/nlevcan" - do iv=1,nlevcan - this%fabi_sun_z_patch(begp:endp,iv) = (this%fabi_patch(begp:endp,1)/2._r8)/nlevcan - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='fabi_sha_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='absorbed shaded leaf diffuse PAR (per unit lai+sai) for canopy layer', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabi_sha_z_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find fabi_sha_z in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize fabi_sha_z to (fabi/2)/nlevcan" - do iv=1,nlevcan - this%fabi_sha_z_patch(begp:endp,iv) = & - (this%fabi_patch(begp:endp,1)/2._r8)/nlevcan - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='ftdd', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='down direct flux below veg per unit direct flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%ftdd_patch) - - call restartvar(ncid=ncid, flag=flag, varname='ftid', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='down diffuse flux below veg per unit direct flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%ftid_patch) - - call restartvar(ncid=ncid, flag=flag, varname='ftii', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='down diffuse flux below veg per unit diffuse flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%ftii_patch) - - !-------------------------------- - ! variables needed for SNICAR - !-------------------------------- - - call restartvar(ncid=ncid, flag=flag, varname='flx_absdv', xtype=ncd_double, & - dim1name='column', dim2name='levsno1', switchdim=.true., lowerb2=-nlevsno+1, upperb2=1, & - long_name='snow layer flux absorption factors (direct, VIS)', units='fraction', & - interpinic_flag='interp', readvar=readvar, data=this%flx_absdv_col) - - call restartvar(ncid=ncid, flag=flag, varname='flx_absdn', xtype=ncd_double, & - dim1name='column', dim2name='levsno1', switchdim=.true., lowerb2=-nlevsno+1, upperb2=1, & - long_name='snow layer flux absorption factors (direct, NIR)', units='fraction', & - interpinic_flag='interp', readvar=readvar, data=this%flx_absdn_col) - - call restartvar(ncid=ncid, flag=flag, varname='flx_absiv', xtype=ncd_double, & - dim1name='column', dim2name='levsno1', switchdim=.true., lowerb2=-nlevsno+1, upperb2=1, & - long_name='snow layer flux absorption factors (diffuse, VIS)', units='fraction', & - interpinic_flag='interp', readvar=readvar, data=this%flx_absiv_col) - - call restartvar(ncid=ncid, flag=flag, varname='flx_absin', xtype=ncd_double, & - dim1name='column', dim2name='levsno1', switchdim=.true., lowerb2=-nlevsno+1, upperb2=1, & - long_name='snow layer flux absorption factors (diffuse, NIR)', units='fraction', & - interpinic_flag='interp', readvar=readvar, data=this%flx_absin_col) - end subroutine Restart end module SurfaceAlbedoType diff --git a/src/biogeophys/SurfaceRadiationMod.F90 b/src/biogeophys/SurfaceRadiationMod.F90 deleted file mode 100644 index f021c6fdbf..0000000000 --- a/src/biogeophys/SurfaceRadiationMod.F90 +++ /dev/null @@ -1,304 +0,0 @@ -module SurfaceRadiationMod - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Calculate solar fluxes absorbed by vegetation and ground surface - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : use_snicar_frc, use_fates - use decompMod , only : bounds_type - use clm_varcon , only : namec - use atm2lndType , only : atm2lnd_type - use WaterstateType , only : waterstate_type - use CanopyStateType , only : canopystate_type - use SurfaceAlbedoType , only : surfalb_type - use SolarAbsorbedType , only : solarabs_type - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - - ! - ! !PRIVATE TYPES: - implicit none - private - - logical :: DEBUG = .false. ! for debugging this module - - ! - ! !PUBLIC MEMBER FUNCTIONS: - - ! - ! !PRIVATE DATA: - type, public :: surfrad_type - real(r8), pointer, private :: sfc_frc_aer_patch (:) ! patch surface forcing of snow with all aerosols (patch) [W/m2] - real(r8), pointer, private :: sfc_frc_bc_patch (:) ! patch surface forcing of snow with BC (patch) [W/m2] - real(r8), pointer, private :: sfc_frc_oc_patch (:) ! patch surface forcing of snow with OC (patch) [W/m2] - real(r8), pointer, private :: sfc_frc_dst_patch (:) ! patch surface forcing of snow with dust (patch) [W/m2] - real(r8), pointer, private :: sfc_frc_aer_sno_patch (:) ! patch surface forcing of snow with all aerosols, averaged only when snow is present (patch) [W/m2] - real(r8), pointer, private :: sfc_frc_bc_sno_patch (:) ! patch surface forcing of snow with BC, averaged only when snow is present (patch) [W/m2] - real(r8), pointer, private :: sfc_frc_oc_sno_patch (:) ! patch surface forcing of snow with OC, averaged only when snow is present (patch) [W/m2] - real(r8), pointer, private :: sfc_frc_dst_sno_patch (:) ! patch surface forcing of snow with dust, averaged only when snow is present (patch) [W/m2] - - real(r8), pointer, private :: parveg_ln_patch (:) ! patch absorbed par by vegetation at local noon (W/m**2) - - real(r8), pointer, private :: fsr_sno_vd_patch (:) ! patch reflected direct beam vis solar radiation from snow (W/m**2) - real(r8), pointer, private :: fsr_sno_nd_patch (:) ! patch reflected direct beam NIR solar radiation from snow (W/m**2) - real(r8), pointer, private :: fsr_sno_vi_patch (:) ! patch reflected diffuse vis solar radiation from snow (W/m**2) - real(r8), pointer, private :: fsr_sno_ni_patch (:) ! patch reflected diffuse NIR solar radiation from snow (W/m**2) - - real(r8), pointer, private :: fsr_vis_d_patch (:) ! patch reflected direct beam vis solar radiation (W/m**2) - real(r8), pointer, private :: fsr_vis_i_patch (:) ! patch reflected diffuse vis solar radiation (W/m**2) - real(r8), pointer, private :: fsr_vis_d_ln_patch (:) ! patch reflected direct beam vis solar radiation at local noon (W/m**2) - - real(r8), pointer, private :: fsds_sno_vd_patch (:) ! patch incident visible, direct radiation on snow (for history files) [W/m2] - real(r8), pointer, private :: fsds_sno_nd_patch (:) ! patch incident near-IR, direct radiation on snow (for history files) [W/m2] - real(r8), pointer, private :: fsds_sno_vi_patch (:) ! patch incident visible, diffuse radiation on snow (for history files) [W/m2] - real(r8), pointer, private :: fsds_sno_ni_patch (:) ! patch incident near-IR, diffuse radiation on snow (for history files) [W/m2] - - real(r8), pointer, private :: fsds_vis_d_patch (:) ! patch incident direct beam vis solar radiation (W/m**2) - real(r8), pointer, private :: fsds_vis_i_patch (:) ! patch incident diffuse vis solar radiation (W/m**2) - real(r8), pointer, private :: fsds_vis_d_ln_patch (:) ! patch incident direct beam vis solar radiation at local noon (W/m**2) - real(r8), pointer, private :: fsds_vis_i_ln_patch (:) ! patch incident diffuse beam vis solar radiation at local noon (W/m**2) - - contains - - procedure, public :: Init - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - end type surfrad_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(surfrad_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! - ! !USES: - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(surfrad_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - allocate(this%sfc_frc_aer_patch (begp:endp)) ; this%sfc_frc_aer_patch (:) = nan - allocate(this%sfc_frc_bc_patch (begp:endp)) ; this%sfc_frc_bc_patch (:) = nan - allocate(this%sfc_frc_oc_patch (begp:endp)) ; this%sfc_frc_oc_patch (:) = nan - allocate(this%sfc_frc_dst_patch (begp:endp)) ; this%sfc_frc_dst_patch (:) = nan - allocate(this%sfc_frc_aer_sno_patch (begp:endp)) ; this%sfc_frc_aer_sno_patch (:) = nan - allocate(this%sfc_frc_bc_sno_patch (begp:endp)) ; this%sfc_frc_bc_sno_patch (:) = nan - allocate(this%sfc_frc_oc_sno_patch (begp:endp)) ; this%sfc_frc_oc_sno_patch (:) = nan - allocate(this%sfc_frc_dst_sno_patch (begp:endp)) ; this%sfc_frc_dst_sno_patch (:) = nan - - allocate(this%parveg_ln_patch (begp:endp)) ; this%parveg_ln_patch (:) = nan - - allocate(this%fsr_vis_d_patch (begp:endp)) ; this%fsr_vis_d_patch (:) = nan - allocate(this%fsr_vis_d_ln_patch (begp:endp)) ; this%fsr_vis_d_ln_patch (:) = nan - allocate(this%fsr_vis_i_patch (begp:endp)) ; this%fsr_vis_i_patch (:) = nan - allocate(this%fsr_sno_vd_patch (begp:endp)) ; this%fsr_sno_vd_patch (:) = nan - allocate(this%fsr_sno_nd_patch (begp:endp)) ; this%fsr_sno_nd_patch (:) = nan - allocate(this%fsr_sno_vi_patch (begp:endp)) ; this%fsr_sno_vi_patch (:) = nan - allocate(this%fsr_sno_ni_patch (begp:endp)) ; this%fsr_sno_ni_patch (:) = nan - - allocate(this%fsds_vis_d_patch (begp:endp)) ; this%fsds_vis_d_patch (:) = nan - allocate(this%fsds_vis_i_patch (begp:endp)) ; this%fsds_vis_i_patch (:) = nan - allocate(this%fsds_vis_d_ln_patch (begp:endp)) ; this%fsds_vis_d_ln_patch (:) = nan - allocate(this%fsds_vis_i_ln_patch (begp:endp)) ; this%fsds_vis_i_ln_patch (:) = nan - allocate(this%fsds_sno_vd_patch (begp:endp)) ; this%fsds_sno_vd_patch (:) = nan - allocate(this%fsds_sno_nd_patch (begp:endp)) ; this%fsds_sno_nd_patch (:) = nan - allocate(this%fsds_sno_vi_patch (begp:endp)) ; this%fsds_sno_vi_patch (:) = nan - allocate(this%fsds_sno_ni_patch (begp:endp)) ; this%fsds_sno_ni_patch (:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! History fields initialization - ! - ! !USES: - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) - use clm_varcon , only : spval - use histFileMod , only : hist_addfld1d, hist_addfld2d - ! - ! !ARGUMENTS: - class(surfrad_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - real(r8), pointer :: data2dptr(:,:) ! temp. pointers for slicing larger arrays - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - if (use_snicar_frc) then - this%sfc_frc_aer_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOAERFRCL', units='W/m^2', & - avgflag='A', long_name='surface forcing of all aerosols in snow (land) ', & - ptr_patch=this%sfc_frc_aer_patch, set_urb=spval, default='inactive') - - this%sfc_frc_aer_sno_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOAERFRC2L', units='W/m^2', & - avgflag='A', long_name='surface forcing of all aerosols in snow, averaged only when snow is present (land)', & - ptr_patch=this%sfc_frc_aer_sno_patch, set_urb=spval, default='inactive') - - this%sfc_frc_bc_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOBCFRCL', units='W/m^2', & - avgflag='A', long_name='surface forcing of BC in snow (land) ', & - ptr_patch=this%sfc_frc_bc_patch, set_urb=spval, default='inactive') - - this%sfc_frc_bc_sno_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOBCFRC2L', units='W/m^2', & - avgflag='A', long_name='surface forcing of BC in snow, averaged only when snow is present (land)', & - ptr_patch=this%sfc_frc_bc_sno_patch, set_urb=spval, default='inactive') - - this%sfc_frc_oc_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOOCFRCL', units='W/m^2', & - avgflag='A', long_name='surface forcing of OC in snow (land) ', & - ptr_patch=this%sfc_frc_oc_patch, set_urb=spval, default='inactive') - - this%sfc_frc_oc_sno_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOOCFRC2L', units='W/m^2', & - avgflag='A', long_name='surface forcing of OC in snow, averaged only when snow is present (land)', & - ptr_patch=this%sfc_frc_oc_sno_patch, set_urb=spval, default='inactive') - - this%sfc_frc_dst_patch(begp:endp) = spval - call hist_addfld1d (fname='SNODSTFRCL', units='W/m^2', & - avgflag='A', long_name='surface forcing of dust in snow (land) ', & - ptr_patch=this%sfc_frc_dst_patch, set_urb=spval, default='inactive') - - this%sfc_frc_dst_sno_patch(begp:endp) = spval - call hist_addfld1d (fname='SNODSTFRC2L', units='W/m^2', & - avgflag='A', long_name='surface forcing of dust in snow, averaged only when snow is present (land)', & - ptr_patch=this%sfc_frc_dst_sno_patch, set_urb=spval, default='inactive') - end if - - this%fsds_vis_d_patch(begp:endp) = spval - call hist_addfld1d (fname='FSDSVD', units='W/m^2', & - avgflag='A', long_name='direct vis incident solar radiation', & - ptr_patch=this%fsds_vis_d_patch, default='inactive') - - this%fsds_vis_i_patch(begp:endp) = spval - call hist_addfld1d (fname='FSDSVI', units='W/m^2', & - avgflag='A', long_name='diffuse vis incident solar radiation', & - ptr_patch=this%fsds_vis_i_patch, default='inactive') - - this%fsr_vis_d_patch(begp:endp) = spval - call hist_addfld1d (fname='FSRVD', units='W/m^2', & - avgflag='A', long_name='direct vis reflected solar radiation', & - ptr_patch=this%fsr_vis_d_patch, c2l_scale_type='urbanf', default='inactive') - - this%fsr_vis_i_patch(begp:endp) = spval - call hist_addfld1d (fname='FSRVI', units='W/m^2', & - avgflag='A', long_name='diffuse vis reflected solar radiation', & - ptr_patch=this%fsr_vis_i_patch, c2l_scale_type='urbanf', default='inactive') - - this%fsds_vis_d_ln_patch(begp:endp) = spval - call hist_addfld1d (fname='FSDSVDLN', units='W/m^2', & - avgflag='A', long_name='direct vis incident solar radiation at local noon', & - ptr_patch=this%fsds_vis_d_ln_patch, default='inactive') - - this%fsds_vis_i_ln_patch(begp:endp) = spval - call hist_addfld1d (fname='FSDSVILN', units='W/m^2', & - avgflag='A', long_name='diffuse vis incident solar radiation at local noon', & - ptr_patch=this%fsds_vis_i_ln_patch, default='inactive') - - this%parveg_ln_patch(begp:endp) = spval - call hist_addfld1d (fname='PARVEGLN', units='W/m^2', & - avgflag='A', long_name='absorbed par by vegetation at local noon', & - ptr_patch=this%parveg_ln_patch, default='inactive') - - this%fsr_vis_d_ln_patch(begp:endp) = spval - call hist_addfld1d (fname='FSRVDLN', units='W/m^2', & - avgflag='A', long_name='direct vis reflected solar radiation at local noon', & - ptr_patch=this%fsr_vis_d_ln_patch, c2l_scale_type='urbanf', default='inactive') - - this%fsds_sno_vd_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOFSDSVD', units='W/m^2', & - avgflag='A', long_name='direct vis incident solar radiation on snow', & - ptr_patch=this%fsds_sno_vd_patch, default='inactive') - - this%fsds_sno_nd_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOFSDSND', units='W/m^2', & - avgflag='A', long_name='direct nir incident solar radiation on snow', & - ptr_patch=this%fsds_sno_nd_patch, default='inactive') - - this%fsds_sno_vi_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOFSDSVI', units='W/m^2', & - avgflag='A', long_name='diffuse vis incident solar radiation on snow', & - ptr_patch=this%fsds_sno_vi_patch, default='inactive') - - this%fsds_sno_ni_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOFSDSNI', units='W/m^2', & - avgflag='A', long_name='diffuse nir incident solar radiation on snow', & - ptr_patch=this%fsds_sno_ni_patch, default='inactive') - - this%fsr_sno_vd_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOFSRVD', units='W/m^2', & - avgflag='A', long_name='direct vis reflected solar radiation from snow', & - ptr_patch=this%fsr_sno_vd_patch, default='inactive') - - this%fsr_sno_nd_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOFSRND', units='W/m^2', & - avgflag='A', long_name='direct nir reflected solar radiation from snow', & - ptr_patch=this%fsr_sno_nd_patch, default='inactive') - - this%fsr_sno_vi_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOFSRVI', units='W/m^2', & - avgflag='A', long_name='diffuse vis reflected solar radiation from snow', & - ptr_patch=this%fsr_sno_vi_patch, default='inactive') - - this%fsr_sno_ni_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOFSRNI', units='W/m^2', & - avgflag='A', long_name='diffuse nir reflected solar radiation from snow', & - ptr_patch=this%fsr_sno_ni_patch, default='inactive') - - - end subroutine InitHistory - - !------------------------------------------------------------------------ - subroutine InitCold(this, bounds) - ! - ! !USES: - ! - ! !ARGUMENTS: - class(surfrad_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p,l - !----------------------------------------------------------------------- - - ! nothing for now - - end subroutine InitCold - -end module SurfaceRadiationMod diff --git a/src/biogeophys/SurfaceResistanceMod.F90 b/src/biogeophys/SurfaceResistanceMod.F90 deleted file mode 100644 index 76813b71c5..0000000000 --- a/src/biogeophys/SurfaceResistanceMod.F90 +++ /dev/null @@ -1,294 +0,0 @@ -module SurfaceResistanceMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module holding routines for calculation of surface resistances of the different tracers - ! transported with BeTR. The surface here refers to water and soil, not including canopy - ! - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_const_mod , only: SHR_CONST_TKFRZ - use clm_varctl , only: iulog - use SoilStateType , only: soilstate_type - use WaterStateType, only: waterstate_type - use TemperatureType , only : temperature_type - implicit none - save - private - integer :: soil_resis_method !choose the method for soil resistance calculation - - integer, parameter :: leepielke_1992 = 0 ! - integer, parameter :: sl_14 = 1 - - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: calc_soilevap_resis - public :: do_soilevap_beta, do_soil_resistance_sl14 - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - ! - ! !REVISION HISTORY: - ! 6/25/2013 Created by Jinyun Tang - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------------ - subroutine calc_soilevap_resis(bounds, num_nolakec, filter_nolakec, & - soilstate_inst, waterstate_inst, temperature_inst) - ! - ! DESCRIPTIONS - ! compute the resis factor for soil evaporation calculation - ! - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_PI - use decompMod , only : bounds_type - use ColumnType , only : col - use LandunitType , only : lun - use abortutils , only : endrun - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec - integer , intent(in) :: filter_nolakec(:) - type(soilstate_type) , intent(inout) :: soilstate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(temperature_type), intent(in) :: temperature_inst - character(len=32) :: subname = 'calc_soilevap_resis' ! subroutine name - associate( & - soilbeta => soilstate_inst%soilbeta_col , & ! Output: [real(r8) (:)] factor that reduces ground evaporation - dsl => soilstate_inst%dsl_col , & ! Output: [real(r8) (:)] soil dry surface layer thickness - soilresis => soilstate_inst%soilresis_col & ! Output: [real(r8) (:)] soil evaporative resistance - ) - - !select the right method and do the calculation - select case (soil_resis_method) - - case (leepielke_1992) - call calc_beta_leepielke1992(bounds, num_nolakec, filter_nolakec, & - soilstate_inst, waterstate_inst, soilbeta(bounds%begc:bounds%endc)) - - case (sl_14) - call calc_soil_resistance_sl14(bounds, num_nolakec, filter_nolakec, & - soilstate_inst, waterstate_inst,temperature_inst, & - dsl(bounds%begc:bounds%endc), soilresis(bounds%begc:bounds%endc)) - case default - call endrun(subname // ':: a soilevap resis function must be specified!') - end select - - end associate - - end subroutine calc_soilevap_resis - - !------------------------------------------------------------------------------ - subroutine calc_beta_leepielke1992(bounds, num_nolakec, filter_nolakec, & - soilstate_inst, waterstate_inst, soilbeta) - ! - ! DESCRIPTION - ! compute the lee-pielke beta factor to scal actual soil evaporation from potential evaporation - ! - ! USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_PI - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use clm_varcon , only : denh2o, denice - use landunit_varcon , only : istice_mec, istwet, istsoil, istcrop - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use column_varcon , only : icol_road_imperv, icol_road_perv - use ColumnType , only : col - use LandunitType , only : lun - ! - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec - integer , intent(in) :: filter_nolakec(:) - type(soilstate_type) , intent(in) :: soilstate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - real(r8) , intent(inout) :: soilbeta(bounds%begc:bounds%endc) - - !local variables - real(r8) :: fac, fac_fc, wx !temporary variables - integer :: c, l, fc !indices - - SHR_ASSERT_ALL((ubound(soilbeta) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:)] volumetric soil water at saturation (porosity) - watfc => soilstate_inst%watfc_col , & ! Input: [real(r8) (:,:)] volumetric soil water at field capacity - - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:)] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:)] liquid water (kg/m2) - frac_sno => waterstate_inst%frac_sno_col , & ! Input: [real(r8) (:)] fraction of ground covered by snow (0 to 1) - frac_h2osfc => waterstate_inst%frac_h2osfc_col & ! Input: [real(r8) (:)] fraction of ground covered by surface water (0 to 1) - ) - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (lun%itype(l)/=istwet .AND. lun%itype(l)/=istice_mec) then - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - wx = (h2osoi_liq(c,1)/denh2o+h2osoi_ice(c,1)/denice)/col%dz(c,1) - fac = min(1._r8, wx/watsat(c,1)) - fac = max( fac, 0.01_r8 ) - !! Lee and Pielke 1992 beta, added by K.Sakaguchi - if (wx < watfc(c,1) ) then !when water content of ths top layer is less than that at F.C. - fac_fc = min(1._r8, wx/watfc(c,1)) !eqn5.66 but divided by theta at field capacity - fac_fc = max( fac_fc, 0.01_r8 ) - ! modify soil beta by snow cover. soilbeta for snow surface is one - soilbeta(c) = (1._r8-frac_sno(c)-frac_h2osfc(c)) & - *0.25_r8*(1._r8 - cos(SHR_CONST_PI*fac_fc))**2._r8 & - + frac_sno(c)+ frac_h2osfc(c) - else !when water content of ths top layer is more than that at F.C. - soilbeta(c) = 1._r8 - end if - else if (col%itype(c) == icol_road_perv) then - soilbeta(c) = 0._r8 - else if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then - soilbeta(c) = 0._r8 - else if (col%itype(c) == icol_roof .or. col%itype(c) == icol_road_imperv) then - soilbeta(c) = 0._r8 - endif - else - soilbeta(c) = 1._r8 - endif - enddo - - end associate - - end subroutine calc_beta_leepielke1992 - - !------------------------------------------------------------------------------ - function do_soilevap_beta()result(lres) - ! - !DESCRIPTION - ! return true if the moisture stress for soil evaporation is computed as beta factor - ! otherwise false - implicit none - logical :: lres - - if(soil_resis_method==leepielke_1992)then - lres=.true. - else - lres=.false. - endif - return - - end function do_soilevap_beta - - !------------------------------------------------------------------------------ - subroutine calc_soil_resistance_sl14(bounds, num_nolakec, filter_nolakec, & - soilstate_inst, waterstate_inst, temperature_inst, dsl, soilresis) - ! - ! DESCRIPTION - ! compute the lee-pielke beta factor to scal actual soil evaporation from potential evaporation - ! - ! USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_PI - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use clm_varcon , only : denh2o, denice - use landunit_varcon , only : istice_mec, istwet, istsoil, istcrop - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use column_varcon , only : icol_road_imperv, icol_road_perv - use ColumnType , only : col - use LandunitType , only : lun - ! - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec - integer , intent(in) :: filter_nolakec(:) - type(soilstate_type) , intent(in) :: soilstate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(temperature_type), intent(in) :: temperature_inst - real(r8) , intent(inout) :: dsl(bounds%begc:bounds%endc) - real(r8) , intent(inout) :: soilresis(bounds%begc:bounds%endc) - - !local variables - real(r8) :: aird, eps, dg, d0, vwc_liq - real(r8) :: eff_por_top - integer :: c, l, fc !indices - - SHR_ASSERT_ALL((ubound(dsl) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(soilresis) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness (m) - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:)] volumetric soil water at saturation (porosity) - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) -! eff_porosity => soilstate_inst%eff_porosity_col , & ! Input: [real(r8) (:,:) ] effective porosity = porosity - vol_ice - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:)] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col & ! Input: [real(r8) (:,:)] liquid water (kg/m2) - ) - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (lun%itype(l)/=istwet .AND. lun%itype(l)/=istice_mec) then - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - vwc_liq = max(h2osoi_liq(c,1),1.0e-6_r8)/(dz(c,1)*denh2o) -! eff_porosity not calculated til SoilHydrology - eff_por_top = max(0.01_r8,watsat(c,1)-min(watsat(c,1), h2osoi_ice(c,1)/(dz(c,1)*denice))) - -! calculate diffusivity and air free pore space - aird = watsat(c,1)*(sucsat(c,1)/1.e7_r8)**(1./bsw(c,1)) - d0 = 2.12e-5*(t_soisno(c,1)/273.15)**1.75 ![Bitelli et al., JH, 08] - eps = watsat(c,1) - aird - dg = eps*d0*(eps/watsat(c,1))**(3._r8/max(3._r8,bsw(c,1))) - -! dsl(c) = dzmm(c,1)*max(0.001_r8,(0.8*eff_porosity(c,1) - vwc_liq)) & -! try arbitrary scaling (not top layer thickness) -! dsl(c) = 15._r8*max(0.001_r8,(0.8*eff_porosity(c,1) - vwc_liq)) & - dsl(c) = 15._r8*max(0.001_r8,(0.8*eff_por_top - vwc_liq)) & - ! /max(0.001_r8,(watsat(c,1)- aird)) - /max(0.001_r8,(0.8*watsat(c,1)- aird)) - - dsl(c)=max(dsl(c),0._r8) - dsl(c)=min(dsl(c),200._r8) - - soilresis(c) = dsl(c)/(dg*eps*1.e3) + 20._r8 - soilresis(c) = min(1.e6_r8,soilresis(c)) - - else if (col%itype(c) == icol_road_perv) then - soilresis(c) = 1.e6_r8 - else if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then - soilresis(c) = 1.e6_r8 - else if (col%itype(c) == icol_roof .or. col%itype(c) == icol_road_imperv) then - soilresis(c) = 1.e6_r8 - endif - else - soilresis(c) = 0._r8 - endif - enddo - end associate - end subroutine calc_soil_resistance_sl14 - - !------------------------------------------------------------------------------ - function do_soil_resistance_sl14()result(lres) - ! - !DESCRIPTION - ! return true if the soil evaporative resistance is computed using a DSL - ! otherwise false - implicit none - logical :: lres - - if(soil_resis_method==sl_14)then - lres=.true. - else - lres=.false. - endif - return - - end function do_soil_resistance_sl14 - -end module SurfaceResistanceMod diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 index a98c143023..5506f56af9 100644 --- a/src/biogeophys/TemperatureType.F90 +++ b/src/biogeophys/TemperatureType.F90 @@ -6,11 +6,8 @@ module TemperatureType use shr_kind_mod , only : r8 => shr_kind_r8 use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_varctl , only : use_cndv, iulog, use_luna, use_crop - use clm_varpar , only : nlevsno, nlevgrnd, nlevlak, nlevlak, nlevurb - use clm_varcon , only : spval, ispval - use GridcellType , only : grc + use clm_varpar , only : nlevsno, nlevgrnd, nlevurb + use clm_varcon , only : spval use LandunitType , only : lun use ColumnType , only : col use PatchType , only : patch @@ -22,104 +19,15 @@ module TemperatureType type, public :: temperature_type ! Temperatures - real(r8), pointer :: t_veg_patch (:) ! patch vegetation temperature (Kelvin) - real(r8), pointer :: t_veg_day_patch (:) ! patch daytime accumulative vegetation temperature (Kelvinx*nsteps), LUNA specific, from midnight to current step - real(r8), pointer :: t_veg_night_patch (:) ! patch night-time accumulative vegetation temperature (Kelvin*nsteps), LUNA specific, from midnight to current step - real(r8), pointer :: t_veg10_day_patch (:) ! 10 day running mean of patch daytime time vegetation temperature (Kelvin), LUNA specific, but can be reused - real(r8), pointer :: t_veg10_night_patch (:) ! 10 day running mean of patch night time vegetation temperature (Kelvin), LUNA specific, but can be reused - integer, pointer :: ndaysteps_patch (:) ! number of daytime steps accumulated from mid-night, LUNA specific - integer, pointer :: nnightsteps_patch (:) ! number of nighttime steps accumulated from mid-night, LUNA specific - real(r8), pointer :: t_h2osfc_col (:) ! col surface water temperature - real(r8), pointer :: t_h2osfc_bef_col (:) ! col surface water temperature from time-step before - real(r8), pointer :: t_ssbef_col (:,:) ! col soil/snow temperature before update (-nlevsno+1:nlevgrnd) - real(r8), pointer :: t_soisno_col (:,:) ! col soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: t_soi10cm_col (:) ! col soil temperature in top 10cm of soil (Kelvin) - real(r8), pointer :: t_soi17cm_col (:) ! col soil temperature in top 17cm of soil (Kelvin) - real(r8), pointer :: t_lake_col (:,:) ! col lake temperature (Kelvin) (1:nlevlak) - real(r8), pointer :: t_grnd_col (:) ! col ground temperature (Kelvin) - real(r8), pointer :: t_grnd_r_col (:) ! col rural ground temperature (Kelvin) - real(r8), pointer :: t_grnd_u_col (:) ! col urban ground temperature (Kelvin) (needed by Hydrology2Mod) - real(r8), pointer :: t_building_lun (:) ! lun internal building air temperature (K) - real(r8), pointer :: t_roof_inner_lun (:) ! lun roof inside surface temperature (K) - real(r8), pointer :: t_sunw_inner_lun (:) ! lun sunwall inside surface temperature (K) - real(r8), pointer :: t_shdw_inner_lun (:) ! lun shadewall inside surface temperature (K) - real(r8), pointer :: t_floor_lun (:) ! lun floor temperature (K) - real(r8), pointer :: snot_top_col (:) ! col temperature of top snow layer [K] - real(r8), pointer :: dTdz_top_col (:) ! col temperature gradient in top layer [K m-1] - real(r8), pointer :: dt_veg_patch (:) ! patch change in t_veg, last iteration (Kelvin) - - real(r8), pointer :: dt_grnd_col (:) ! col change in t_grnd, last iteration (Kelvin) - real(r8), pointer :: thv_col (:) ! col virtual potential temperature (kelvin) - real(r8), pointer :: thm_patch (:) ! patch intermediate variable (forc_t+0.0098*forc_hgt_t_patch) - real(r8), pointer :: t_a10_patch (:) ! patch 10-day running mean of the 2 m temperature (K) - real(r8), pointer :: t_a10min_patch (:) ! patch 10-day running mean of min 2-m temperature - real(r8), pointer :: t_a5min_patch (:) ! patch 5-day running mean of min 2-m temperature - - real(r8), pointer :: taf_lun (:) ! lun urban canopy air temperature (K) - - real(r8), pointer :: t_ref2m_patch (:) ! patch 2 m height surface air temperature (Kelvin) - real(r8), pointer :: t_ref2m_r_patch (:) ! patch rural 2 m height surface air temperature (Kelvin) - real(r8), pointer :: t_ref2m_u_patch (:) ! patch urban 2 m height surface air temperature (Kelvin) - real(r8), pointer :: t_ref2m_min_patch (:) ! patch daily minimum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_min_r_patch (:) ! patch daily minimum of average 2 m height surface air temperature - rural(K) - real(r8), pointer :: t_ref2m_min_u_patch (:) ! patch daily minimum of average 2 m height surface air temperature - urban (K) - real(r8), pointer :: t_ref2m_max_patch (:) ! patch daily maximum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_max_r_patch (:) ! patch daily maximum of average 2 m height surface air temperature - rural(K) - real(r8), pointer :: t_ref2m_max_u_patch (:) ! patch daily maximum of average 2 m height surface air temperature - urban (K) - real(r8), pointer :: t_ref2m_min_inst_patch (:) ! patch instantaneous daily min of average 2 m height surface air temp (K) - real(r8), pointer :: t_ref2m_min_inst_r_patch (:) ! patch instantaneous daily min of average 2 m height surface air temp - rural (K) - real(r8), pointer :: t_ref2m_min_inst_u_patch (:) ! patch instantaneous daily min of average 2 m height surface air temp - urban (K) - real(r8), pointer :: t_ref2m_max_inst_patch (:) ! patch instantaneous daily max of average 2 m height surface air temp (K) - real(r8), pointer :: t_ref2m_max_inst_r_patch (:) ! patch instantaneous daily max of average 2 m height surface air temp - rural (K) - real(r8), pointer :: t_ref2m_max_inst_u_patch (:) ! patch instantaneous daily max of average 2 m height surface air temp - urban (K) - - ! Accumulated quantities - ! - ! TODO(wjs, 2014-08-05) Move these to the module(s) where they are used, to improve - ! modularity. In cases where they are used by two completely different modules, - ! which only use the same variable out of convenience, introduce a duplicate (point - ! being: that way one parameterization is free to change the exact meaning of its - ! accumulator without affecting the other). - ! - real(r8), pointer :: t_veg24_patch (:) ! patch 24hr average vegetation temperature (K) - real(r8), pointer :: t_veg240_patch (:) ! patch 240hr average vegetation temperature (Kelvin) - real(r8), pointer :: gdd0_patch (:) ! patch growing degree-days base 0C from planting (ddays) - real(r8), pointer :: gdd8_patch (:) ! patch growing degree-days base 8C from planting (ddays) - real(r8), pointer :: gdd10_patch (:) ! patch growing degree-days base 10C from planting (ddays) - real(r8), pointer :: gdd020_patch (:) ! patch 20-year average of gdd0 (ddays) - real(r8), pointer :: gdd820_patch (:) ! patch 20-year average of gdd8 (ddays) - real(r8), pointer :: gdd1020_patch (:) ! patch 20-year average of gdd10 (ddays) - - ! Heat content - real(r8), pointer :: beta_col (:) ! coefficient of convective velocity [-] - real(r8), pointer :: heat1_grc (:) ! grc initial gridcell total heat content - real(r8), pointer :: heat2_grc (:) ! grc post land cover change total heat content - real(r8), pointer :: liquid_water_temp1_grc (:) ! grc initial weighted average liquid water temperature (K) - real(r8), pointer :: liquid_water_temp2_grc (:) ! grc post land cover change weighted average liquid water temperature (K) - - ! Flags - integer , pointer :: imelt_col (:,:) ! flag for melting (=1), freezing (=2), Not=0 (-nlevsno+1:nlevgrnd) - - ! Emissivities - real(r8), pointer :: emv_patch (:) ! patch vegetation emissivity - real(r8), pointer :: emg_col (:) ! col ground emissivity - - ! Misc - real(r8), pointer :: xmf_col (:) ! total latent heat of phase change of ground water - real(r8), pointer :: xmf_h2osfc_col (:) ! latent heat of phase change of surface water - real(r8), pointer :: fact_col (:,:) ! used in computing tridiagonal matrix - real(r8), pointer :: c_h2osfc_col (:) ! heat capacity of surface water + real(r8), pointer :: t_soisno_col (:,:) ! col soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) + real(r8), pointer :: t_grnd_col (:) ! col ground temperature (Kelvin) contains procedure, public :: Init procedure, public :: Restart procedure, private :: InitAllocate - procedure, private :: InitHistory procedure, private :: InitCold - procedure, public :: InitAccBuffer - procedure, public :: InitAccVars - procedure, public :: UpdateAccVars end type temperature_type @@ -130,9 +38,7 @@ module TemperatureType contains !------------------------------------------------------------------------ - subroutine Init(this, bounds, & - em_roof_lun, em_wall_lun, em_improad_lun, em_perroad_lun, & - is_simple_buildtemp, is_prog_buildtemp) + subroutine Init(this, bounds) ! ! !DESCRIPTION: ! @@ -141,21 +47,9 @@ subroutine Init(this, bounds, & ! class(temperature_type) :: this type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: em_roof_lun(bounds%begl:) - real(r8) , intent(in) :: em_wall_lun(bounds%begl:) - real(r8) , intent(in) :: em_improad_lun(bounds%begl:) - real(r8) , intent(in) :: em_perroad_lun(bounds%begl:) - logical , intent(in) :: is_simple_buildtemp ! Simple building temp is being used - logical , intent(in) :: is_prog_buildtemp ! Prognostic building temp is being used call this%InitAllocate ( bounds ) - call this%InitHistory ( bounds, is_simple_buildtemp, is_prog_buildtemp ) - call this%InitCold ( bounds, & - em_roof_lun(bounds%begl:bounds%endl), & - em_wall_lun(bounds%begl:bounds%endl), & - em_improad_lun(bounds%begl:bounds%endl), & - em_perroad_lun(bounds%begl:bounds%endl), & - is_simple_buildtemp, is_prog_buildtemp) + call this%InitCold ( bounds) end subroutine Init @@ -173,466 +67,40 @@ subroutine InitAllocate(this, bounds) type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: - integer :: begp, endp integer :: begc, endc - integer :: begl, endl - integer :: begg, endg !------------------------------------------------------------------------ - begp = bounds%begp; endp= bounds%endp begc = bounds%begc; endc= bounds%endc - begl = bounds%begl; endl= bounds%endl - begg = bounds%begg; endg= bounds%endg ! Temperatures - allocate(this%t_veg_patch (begp:endp)) ; this%t_veg_patch (:) = nan - if(use_luna) then - allocate(this%t_veg_day_patch (begp:endp)) ; this%t_veg_day_patch (:) = spval - allocate(this%t_veg_night_patch (begp:endp)) ; this%t_veg_night_patch (:) = spval - allocate(this%t_veg10_day_patch (begp:endp)) ; this%t_veg10_day_patch (:) = spval - allocate(this%t_veg10_night_patch (begp:endp)) ; this%t_veg10_night_patch (:) = spval - allocate(this%ndaysteps_patch (begp:endp)) ; this%ndaysteps_patch (:) = ispval - allocate(this%nnightsteps_patch (begp:endp)) ; this%nnightsteps_patch (:) = ispval - endif - allocate(this%t_h2osfc_col (begc:endc)) ; this%t_h2osfc_col (:) = nan - allocate(this%t_h2osfc_bef_col (begc:endc)) ; this%t_h2osfc_bef_col (:) = nan - allocate(this%t_ssbef_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%t_ssbef_col (:,:) = nan - allocate(this%t_soisno_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%t_soisno_col (:,:) = nan - allocate(this%t_lake_col (begc:endc,1:nlevlak)) ; this%t_lake_col (:,:) = nan - allocate(this%t_grnd_col (begc:endc)) ; this%t_grnd_col (:) = nan - allocate(this%t_grnd_r_col (begc:endc)) ; this%t_grnd_r_col (:) = nan - allocate(this%t_grnd_u_col (begc:endc)) ; this%t_grnd_u_col (:) = nan - allocate(this%t_building_lun (begl:endl)) ; this%t_building_lun (:) = nan - allocate(this%t_roof_inner_lun (begl:endl)) ; this%t_roof_inner_lun (:) = nan - allocate(this%t_sunw_inner_lun (begl:endl)) ; this%t_sunw_inner_lun (:) = nan - allocate(this%t_shdw_inner_lun (begl:endl)) ; this%t_shdw_inner_lun (:) = nan - allocate(this%t_floor_lun (begl:endl)) ; this%t_floor_lun (:) = nan - allocate(this%snot_top_col (begc:endc)) ; this%snot_top_col (:) = nan - allocate(this%dTdz_top_col (begc:endc)) ; this%dTdz_top_col (:) = nan - allocate(this%dt_veg_patch (begp:endp)) ; this%dt_veg_patch (:) = nan - - allocate(this%t_soi10cm_col (begc:endc)) ; this%t_soi10cm_col (:) = nan - allocate(this%t_soi17cm_col (begc:endc)) ; this%t_soi17cm_col (:) = spval - allocate(this%dt_grnd_col (begc:endc)) ; this%dt_grnd_col (:) = nan - allocate(this%thv_col (begc:endc)) ; this%thv_col (:) = nan - allocate(this%thm_patch (begp:endp)) ; this%thm_patch (:) = nan - allocate(this%t_a10_patch (begp:endp)) ; this%t_a10_patch (:) = nan - allocate(this%t_a10min_patch (begp:endp)) ; this%t_a10min_patch (:) = nan - allocate(this%t_a5min_patch (begp:endp)) ; this%t_a5min_patch (:) = nan - - allocate(this%taf_lun (begl:endl)) ; this%taf_lun (:) = nan - - allocate(this%t_ref2m_patch (begp:endp)) ; this%t_ref2m_patch (:) = nan - allocate(this%t_ref2m_r_patch (begp:endp)) ; this%t_ref2m_r_patch (:) = nan - allocate(this%t_ref2m_u_patch (begp:endp)) ; this%t_ref2m_u_patch (:) = nan - allocate(this%t_ref2m_min_patch (begp:endp)) ; this%t_ref2m_min_patch (:) = nan - allocate(this%t_ref2m_min_r_patch (begp:endp)) ; this%t_ref2m_min_r_patch (:) = nan - allocate(this%t_ref2m_min_u_patch (begp:endp)) ; this%t_ref2m_min_u_patch (:) = nan - allocate(this%t_ref2m_max_patch (begp:endp)) ; this%t_ref2m_max_patch (:) = nan - allocate(this%t_ref2m_max_r_patch (begp:endp)) ; this%t_ref2m_max_r_patch (:) = nan - allocate(this%t_ref2m_max_u_patch (begp:endp)) ; this%t_ref2m_max_u_patch (:) = nan - allocate(this%t_ref2m_max_inst_patch (begp:endp)) ; this%t_ref2m_max_inst_patch (:) = nan - allocate(this%t_ref2m_max_inst_r_patch (begp:endp)) ; this%t_ref2m_max_inst_r_patch (:) = nan - allocate(this%t_ref2m_max_inst_u_patch (begp:endp)) ; this%t_ref2m_max_inst_u_patch (:) = nan - allocate(this%t_ref2m_min_inst_patch (begp:endp)) ; this%t_ref2m_min_inst_patch (:) = nan - allocate(this%t_ref2m_min_inst_r_patch (begp:endp)) ; this%t_ref2m_min_inst_r_patch (:) = nan - allocate(this%t_ref2m_min_inst_u_patch (begp:endp)) ; this%t_ref2m_min_inst_u_patch (:) = nan - - ! Accumulated fields - allocate(this%t_veg24_patch (begp:endp)) ; this%t_veg24_patch (:) = nan - allocate(this%t_veg240_patch (begp:endp)) ; this%t_veg240_patch (:) = nan - allocate(this%gdd0_patch (begp:endp)) ; this%gdd0_patch (:) = spval - allocate(this%gdd8_patch (begp:endp)) ; this%gdd8_patch (:) = spval - allocate(this%gdd10_patch (begp:endp)) ; this%gdd10_patch (:) = spval - allocate(this%gdd020_patch (begp:endp)) ; this%gdd020_patch (:) = spval - allocate(this%gdd820_patch (begp:endp)) ; this%gdd820_patch (:) = spval - allocate(this%gdd1020_patch (begp:endp)) ; this%gdd1020_patch (:) = spval - - ! Heat content - allocate(this%beta_col (begc:endc)) ; this%beta_col (:) = nan - allocate(this%heat1_grc (begg:endg)) ; this%heat1_grc (:) = nan - allocate(this%heat2_grc (begg:endg)) ; this%heat2_grc (:) = nan - allocate(this%liquid_water_temp1_grc (begg:endg)) ; this%liquid_water_temp1_grc (:) = nan - allocate(this%liquid_water_temp2_grc (begg:endg)) ; this%liquid_water_temp2_grc (:) = nan - - ! flags - allocate(this%imelt_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%imelt_col (:,:) = huge(1) - - ! emissivities - allocate(this%emv_patch (begp:endp)) ; this%emv_patch (:) = nan - allocate(this%emg_col (begc:endc)) ; this%emg_col (:) = nan - - allocate(this%xmf_col (begc:endc)) ; this%xmf_col (:) = nan - allocate(this%xmf_h2osfc_col (begc:endc)) ; this%xmf_h2osfc_col (:) = nan - allocate(this%fact_col (begc:endc, -nlevsno+1:nlevgrnd)) ; this%fact_col (:,:) = nan - allocate(this%c_h2osfc_col (begc:endc)) ; this%c_h2osfc_col (:) = nan + allocate(this%t_soisno_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%t_soisno_col (:,:) = nan + allocate(this%t_grnd_col (begc:endc)) ; this%t_grnd_col (:) = nan end subroutine InitAllocate - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds, is_simple_buildtemp, is_prog_buildtemp ) - ! - ! !DESCRIPTION: - ! Setup the fields that can be output on history files. - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varctl , only : use_cn, use_cndv - use histFileMod , only : hist_addfld1d, hist_addfld2d, no_snow_normal - ! - ! !ARGUMENTS: - class(temperature_type) :: this - type(bounds_type), intent(in) :: bounds - logical , intent(in) :: is_simple_buildtemp ! Simple building temp is being used - logical , intent(in) :: is_prog_buildtemp ! Prognostic building temp is being used - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begl, endl - integer :: begg, endg - character(10) :: active - character(100) :: lname - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begl = bounds%begl; endl= bounds%endl - begg = bounds%begg; endg= bounds%endg - - this%t_h2osfc_col(begc:endc) = spval - call hist_addfld1d (fname='TH2OSFC', units='K', & - avgflag='A', long_name='surface water temperature', & - ptr_col=this%t_h2osfc_col, default='inactive') - - this%t_grnd_u_col(begc:endc) = spval - call hist_addfld1d (fname='TG_U', units='K', & - avgflag='A', long_name='Urban ground temperature', & - ptr_col=this%t_grnd_u_col, set_nourb=spval, c2l_scale_type='urbans', default='inactive') - - this%t_lake_col(begc:endc,:) = spval - call hist_addfld2d (fname='TLAKE', units='K', type2d='levlak', & - avgflag='A', long_name='lake temperature', & - ptr_col=this%t_lake_col, default='inactive') - - this%t_soisno_col(begc:endc,-nlevsno+1:0) = spval - data2dptr => this%t_soisno_col(:,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_T', units='K', type2d='levsno', & - avgflag='A', long_name='Snow temperatures', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, default='inactive') - - call hist_addfld2d (fname='SNO_T_ICE', units='K', type2d='levsno', & - avgflag='A', long_name='Snow temperatures (ice landunits only)', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, & - l2g_scale_type='ice', default='inactive') - - this%t_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='TSA', units='K', & - avgflag='A', long_name='2m air temperature', & - ptr_patch=this%t_ref2m_patch, default='inactive') - - call hist_addfld1d (fname='TSA_ICE', units='K', & - avgflag='A', long_name='2m air temperature (ice landunits only)', & - ptr_patch=this%t_ref2m_patch, l2g_scale_type='ice', default='inactive') - - this%t_ref2m_r_patch(begp:endp) = spval - call hist_addfld1d (fname='TSA_R', units='K', & - avgflag='A', long_name='Rural 2m air temperature', & - ptr_patch=this%t_ref2m_r_patch, set_spec=spval, default='inactive') - - this%t_ref2m_min_patch(begp:endp) = spval - call hist_addfld1d (fname='TREFMNAV', units='K', & - avgflag='A', long_name='daily minimum of average 2-m temperature', & - ptr_patch=this%t_ref2m_min_patch, default='inactive') - - this%t_ref2m_max_patch(begp:endp) = spval - call hist_addfld1d (fname='TREFMXAV', units='K', & - avgflag='A', long_name='daily maximum of average 2-m temperature', & - ptr_patch=this%t_ref2m_max_patch, default='inactive') - - this%t_ref2m_min_r_patch(begp:endp) = spval - call hist_addfld1d (fname='TREFMNAV_R', units='K', & - avgflag='A', long_name='Rural daily minimum of average 2-m temperature', & - ptr_patch=this%t_ref2m_min_r_patch, set_spec=spval, default='inactive') - - this%t_ref2m_max_r_patch(begp:endp) = spval - call hist_addfld1d (fname='TREFMXAV_R', units='K', & - avgflag='A', long_name='Rural daily maximum of average 2-m temperature', & - ptr_patch=this%t_ref2m_max_r_patch, set_spec=spval, default='inactive') - - this%t_ref2m_u_patch(begp:endp) = spval - call hist_addfld1d (fname='TSA_U', units='K', & - avgflag='A', long_name='Urban 2m air temperature', & - ptr_patch=this%t_ref2m_u_patch, set_nourb=spval, default='inactive') - - this%t_ref2m_min_u_patch(begp:endp) = spval - call hist_addfld1d (fname='TREFMNAV_U', units='K', & - avgflag='A', long_name='Urban daily minimum of average 2-m temperature', & - ptr_patch=this%t_ref2m_min_u_patch, set_nourb=spval, default='inactive') - - this%t_ref2m_max_u_patch(begp:endp) = spval - call hist_addfld1d (fname='TREFMXAV_U', units='K', & - avgflag='A', long_name='Urban daily maximum of average 2-m temperature', & - ptr_patch=this%t_ref2m_max_u_patch, set_nourb=spval, default='inactive') - - this%t_veg_patch(begp:endp) = spval - call hist_addfld1d (fname='TV', units='K', & - avgflag='A', long_name='vegetation temperature', & - ptr_patch=this%t_veg_patch, default='inactive') - - this%t_grnd_col(begc:endc) = spval - call hist_addfld1d (fname='TG', units='K', & - avgflag='A', long_name='ground temperature', & - ptr_col=this%t_grnd_col, c2l_scale_type='urbans', default='inactive') - - call hist_addfld1d (fname='TG_ICE', units='K', & - avgflag='A', long_name='ground temperature (ice landunits only)', & - ptr_col=this%t_grnd_col, c2l_scale_type='urbans', l2g_scale_type='ice', & - default='inactive') - - this%t_grnd_r_col(begc:endc) = spval - call hist_addfld1d (fname='TG_R', units='K', & - avgflag='A', long_name='Rural ground temperature', & - ptr_col=this%t_grnd_r_col, set_spec=spval, default='inactive') - - this%t_soisno_col(begc:endc,:) = spval - call hist_addfld2d (fname='TSOI', units='K', type2d='levgrnd', & - avgflag='A', long_name='soil temperature (vegetated landunits only)', & - ptr_col=this%t_soisno_col, l2g_scale_type='veg', default='inactive') - - call hist_addfld2d (fname='TSOI_ICE', units='K', type2d='levgrnd', & - avgflag='A', long_name='soil temperature (ice landunits only)', & - ptr_col=this%t_soisno_col, l2g_scale_type='ice', default='inactive') - - this%t_soi10cm_col(begc:endc) = spval - call hist_addfld1d (fname='TSOI_10CM', units='K', & - avgflag='A', long_name='soil temperature in top 10cm of soil', & - ptr_col=this%t_soi10cm_col, set_urb=spval, default='inactive') - - if (use_cndv .or. use_crop) then - active = "active" - else - active = "active" - end if - this%t_a10_patch(begp:endp) = spval - call hist_addfld1d (fname='T10', units='K', & - avgflag='A', long_name='10-day running mean of 2-m temperature', & - ptr_patch=this%t_a10_patch, default='inactive') - - if (use_cn .and. use_crop )then - this%t_a5min_patch(begp:endp) = spval - call hist_addfld1d (fname='A5TMIN', units='K', & - avgflag='A', long_name='5-day running mean of min 2-m temperature', & - ptr_patch=this%t_a5min_patch, default='inactive') - end if - - if (use_cn .and. use_crop )then - this%t_a10min_patch(begp:endp) = spval - call hist_addfld1d (fname='A10TMIN', units='K', & - avgflag='A', long_name='10-day running mean of min 2-m temperature', & - ptr_patch=this%t_a10min_patch, default='inactive') - end if - - this%t_building_lun(begl:endl) = spval - if ( is_simple_buildtemp )then - lname = 'internal urban building temperature' - else if ( is_prog_buildtemp )then - lname = 'internal urban building air temperature' - end if - call hist_addfld1d(fname='TBUILD', units='K', & - avgflag='A', long_name=lname, & - ptr_lunit=this%t_building_lun, set_nourb=spval, l2g_scale_type='unity', default='inactive') - - if ( is_prog_buildtemp )then - this%t_roof_inner_lun(begl:endl) = spval - call hist_addfld1d(fname='TROOF_INNER', units='K', & - avgflag='A', long_name='roof inside surface temperature', & - ptr_lunit=this%t_roof_inner_lun, set_nourb=spval, l2g_scale_type='unity', & - default='inactive') - - this%t_sunw_inner_lun(begl:endl) = spval - call hist_addfld1d(fname='TSUNW_INNER', units='K', & - avgflag='A', long_name='sunwall inside surface temperature', & - ptr_lunit=this%t_sunw_inner_lun, set_nourb=spval, l2g_scale_type='unity', & - default='inactive') - - this%t_shdw_inner_lun(begl:endl) = spval - call hist_addfld1d(fname='TSHDW_INNER', units='K', & - avgflag='A', long_name='shadewall inside surface temperature', & - ptr_lunit=this%t_shdw_inner_lun, set_nourb=spval, l2g_scale_type='unity', & - default='inactive') - - this%t_floor_lun(begl:endl) = spval - call hist_addfld1d(fname='TFLOOR', units='K', & - avgflag='A', long_name='floor temperature', & - ptr_lunit=this%t_floor_lun, set_nourb=spval, l2g_scale_type='unity', & - default='inactive') - end if - - this%heat1_grc(begg:endg) = spval - call hist_addfld1d (fname='HEAT_CONTENT1', units='J/m^2', & - avgflag='A', long_name='initial gridcell total heat content', & - ptr_lnd=this%heat1_grc, default='inactive') - call hist_addfld1d (fname='HEAT_CONTENT1_VEG', units='J/m^2', & - avgflag='A', long_name='initial gridcell total heat content - vegetated landunits only', & - ptr_lnd=this%heat1_grc, l2g_scale_type='veg', default='inactive') - - this%heat2_grc(begg:endg) = spval - call hist_addfld1d (fname='HEAT_CONTENT2', units='J/m^2', & - avgflag='A', long_name='post land cover change total heat content', & - ptr_lnd=this%heat2_grc, default='inactive') - - this%liquid_water_temp1_grc(begg:endg) = spval - call hist_addfld1d (fname='LIQUID_WATER_TEMP1', units='K', & - avgflag='A', long_name='initial gridcell weighted average liquid water temperature', & - ptr_lnd=this%liquid_water_temp1_grc, default='inactive') - - this%snot_top_col(begc:endc) = spval - call hist_addfld1d (fname='SNOTTOPL', units='K', & - avgflag='A', long_name='snow temperature (top layer)', & - ptr_col=this%snot_top_col, set_urb=spval, default='inactive') - - call hist_addfld1d (fname='SNOTTOPL_ICE', units='K', & - avgflag='A', long_name='snow temperature (top layer, ice landunits only)', & - ptr_col=this%snot_top_col, set_urb=spval, l2g_scale_type='ice', default='inactive') - - this%dTdz_top_col(begc:endc) = spval - call hist_addfld1d (fname='SNOdTdzL', units='K/m', & - avgflag='A', long_name='top snow layer temperature gradient (land)', & - ptr_col=this%dTdz_top_col, set_urb=spval, default='inactive') - - if (use_cn) then - this%dt_veg_patch(begp:endp) = spval - call hist_addfld1d (fname='DT_VEG', units='K', & - avgflag='A', long_name='change in t_veg, last iteration', & - ptr_patch=this%dt_veg_patch, default='inactive') - end if - - if (use_cn ) then - this%emv_patch(begp:endp) = spval - call hist_addfld1d (fname='EMV', units='proportion', & - avgflag='A', long_name='vegetation emissivity', & - ptr_patch=this%emv_patch, default='inactive') - end if - - if (use_cn) then - this%emg_col(begc:endc) = spval - call hist_addfld1d (fname='EMG', units='proportion', & - avgflag='A', long_name='ground emissivity', & - ptr_col=this%emg_col, default='inactive') - end if - - if (use_cn) then - this%beta_col(begc:endc) = spval - call hist_addfld1d (fname='BETA', units='none', & - avgflag='A', long_name='coefficient of convective velocity', & - ptr_col=this%beta_col, default='inactive') - end if - - ! Accumulated quantities - - this%t_veg24_patch(begp:endp) = spval - call hist_addfld1d (fname='TV24', units='K', & - avgflag='A', long_name='vegetation temperature (last 24hrs)', & - ptr_patch=this%t_veg24_patch, default='inactive') - - this%t_veg240_patch(begp:endp) = spval - call hist_addfld1d (fname='TV240', units='K', & - avgflag='A', long_name='vegetation temperature (last 240hrs)', & - ptr_patch=this%t_veg240_patch, default='inactive') - - if (use_crop) then - this%gdd0_patch(begp:endp) = spval - call hist_addfld1d (fname='GDD0', units='ddays', & - avgflag='A', long_name='Growing degree days base 0C from planting', & - ptr_patch=this%gdd0_patch, default='inactive') - end if - - if (use_crop) then - this%gdd8_patch(begp:endp) = spval - call hist_addfld1d (fname='GDD8', units='ddays', & - avgflag='A', long_name='Growing degree days base 8C from planting', & - ptr_patch=this%gdd8_patch, default='inactive') - - this%gdd10_patch(begp:endp) = spval - call hist_addfld1d (fname='GDD10', units='ddays', & - avgflag='A', long_name='Growing degree days base 10C from planting', & - ptr_patch=this%gdd10_patch, default='inactive') - - this%gdd020_patch(begp:endp) = spval - call hist_addfld1d (fname='GDD020', units='ddays', & - avgflag='A', long_name='Twenty year average of growing degree days base 0C from planting', & - ptr_patch=this%gdd020_patch, default='inactive') - - this%gdd820_patch(begp:endp) = spval - call hist_addfld1d (fname='GDD820', units='ddays', & - avgflag='A', long_name='Twenty year average of growing degree days base 8C from planting', & - ptr_patch=this%gdd820_patch, default='inactive') - - this%gdd1020_patch(begp:endp) = spval - call hist_addfld1d (fname='GDD1020', units='ddays', & - avgflag='A', long_name='Twenty year average of growing degree days base 10C from planting', & - ptr_patch=this%gdd1020_patch, default='inactive') - - end if - if(use_luna)then - call hist_addfld1d (fname='TVEGD10', units='Kelvin', & - avgflag='A', long_name='10 day running mean of patch daytime vegetation temperature', & - ptr_patch=this%t_veg10_day_patch, default='inactive') - call hist_addfld1d (fname='TVEGN10', units='Kelvin', & - avgflag='A', long_name='10 day running mean of patch night-time vegetation temperature', & - ptr_patch=this%t_veg10_night_patch, default='inactive') - endif - - - end subroutine InitHistory - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds, & - em_roof_lun, em_wall_lun, em_improad_lun, em_perroad_lun, & - is_simple_buildtemp, is_prog_buildtemp) + subroutine InitCold(this, bounds) ! ! !DESCRIPTION: ! Initialize cold start conditions for module variables ! ! !USES: use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ - use clm_varcon , only : denice, denh2o, sb - use landunit_varcon, only : istwet, istsoil, istdlak, istice_mec + use landunit_varcon, only : istwet, istice_mec use column_varcon , only : icol_road_imperv, icol_roof, icol_sunwall use column_varcon , only : icol_shadewall, icol_road_perv - use clm_varctl , only : iulog, use_vancouver, use_mexicocity ! ! !ARGUMENTS: class(temperature_type) :: this type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: em_roof_lun(bounds%begl:) - real(r8) , intent(in) :: em_wall_lun(bounds%begl:) - real(r8) , intent(in) :: em_improad_lun(bounds%begl:) - real(r8) , intent(in) :: em_perroad_lun(bounds%begl:) - logical , intent(in) :: is_simple_buildtemp ! Simple building temp is being used - logical , intent(in) :: is_prog_buildtemp ! Prognostic building temp is being used ! ! !LOCAL VARIABLES: integer :: j,l,c,p ! indices - integer :: nlevs ! number of levels - real(r8) :: snowbd ! temporary calculation of snow bulk density (kg/m3) - real(r8) :: fmelt ! snowbd/100 - integer :: lev !----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(em_roof_lun) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(em_wall_lun) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(em_improad_lun) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(em_perroad_lun) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - associate(snl => col%snl) ! Output: [integer (:) ] number of snow layers - ! Set snow/soil temperature - ! t_lake only has valid values over non-lake - ! t_soisno, t_grnd and t_veg have valid values over all land + ! t_soisno, t_grnd have valid values over all land do c = bounds%begc,bounds%endc l = col%landunit(c) @@ -656,33 +124,6 @@ subroutine InitCold(this, bounds, & this%t_soisno_col(c,1:nlevgrnd) = 277._r8 else if (lun%urbpoi(l)) then - if (use_vancouver) then - if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - ! Set road top layer to initial air temperature and interpolate other - ! layers down to 20C in bottom layer - do j = 1, nlevgrnd - this%t_soisno_col(c,j) = 297.56 - (j-1) * ((297.56-293.16)/(nlevgrnd-1)) - end do - ! Set wall and roof layers to initial air temperature - else if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall .or. col%itype(c) == icol_roof) then - this%t_soisno_col(c,1:nlevurb) = 297.56 - else - this%t_soisno_col(c,1:nlevgrnd) = 283._r8 - end if - else if (use_mexicocity) then - if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - ! Set road top layer to initial air temperature and interpolate other - ! layers down to 22C in bottom layer - do j = 1, nlevgrnd - this%t_soisno_col(c,j) = 289.46 - (j-1) * ((289.46-295.16)/(nlevgrnd-1)) - end do - else if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall .or. col%itype(c) == icol_roof) then - ! Set wall and roof layers to initial air temperature - this%t_soisno_col(c,1:nlevurb) = 289.46 - else - this%t_soisno_col(c,1:nlevgrnd) = 283._r8 - end if - else if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then this%t_soisno_col(c,1:nlevgrnd) = 274._r8 else if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & @@ -691,7 +132,6 @@ subroutine InitCold(this, bounds, & ! shock from large heating/air conditioning flux this%t_soisno_col(c,1:nlevurb) = 292._r8 end if - end if else this%t_soisno_col(c,1:nlevgrnd) = 274._r8 @@ -699,130 +139,36 @@ subroutine InitCold(this, bounds, & endif end do - ! Initialize internal building temperature, inner temperatures of building - ! surfaces, and floor temperature - if ( is_prog_buildtemp )then - do l = bounds%begl, bounds%endl - do c = lun%coli(l),lun%colf(l) - if (col%itype(c) == icol_roof) then - this%t_roof_inner_lun(l) = this%t_soisno_col(c,nlevurb) - this%t_building_lun(l) = this%t_soisno_col(c,nlevurb) ! arbitrarily set to roof temperature - this%t_floor_lun(l) = this%t_soisno_col(c,nlevurb) ! arbitrarily set to roof temperature - else if (col%itype(c) == icol_sunwall) then - this%t_sunw_inner_lun(l) = this%t_soisno_col(c,nlevurb) - else if (col%itype(c) == icol_shadewall) then - this%t_shdw_inner_lun(l) = this%t_soisno_col(c,nlevurb) - end if - end do - end do - end if - ! Set Ground temperatures do c = bounds%begc,bounds%endc l = col%landunit(c) - if (lun%lakpoi(l)) then this%t_grnd_col(c) = 277._r8 else this%t_grnd_col(c) = this%t_soisno_col(c,snl(c)+1) end if - this%t_soi17cm_col(c) = this%t_grnd_col(c) end do do c = bounds%begc,bounds%endc l = col%landunit(c) if (lun%lakpoi(l)) then ! lake - this%t_lake_col(c,1:nlevlak) = this%t_grnd_col(c) this%t_soisno_col(c,1:nlevgrnd) = this%t_grnd_col(c) end if end do - ! Set t_h2osfc_col - - this%t_h2osfc_col(bounds%begc:bounds%endc) = 274._r8 - - ! Set t_veg, t_ref2m, t_ref2m_u and tref2m_r - - do p = bounds%begp, bounds%endp - c = patch%column(p) - l = patch%landunit(p) - - if (use_vancouver) then - this%t_veg_patch(p) = 297.56 - else if (use_mexicocity) then - this%t_veg_patch(p) = 289.46 - else - this%t_veg_patch(p) = 283._r8 - end if - - if (use_vancouver) then - this%t_ref2m_patch(p) = 297.56 - else if (use_mexicocity) then - this%t_ref2m_patch(p) = 289.46 - else - this%t_ref2m_patch(p) = 283._r8 - end if - - if (lun%urbpoi(l)) then - if (use_vancouver) then - this%t_ref2m_u_patch(p) = 297.56 - else if (use_mexicocity) then - this%t_ref2m_u_patch(p) = 289.46 - else - this%t_ref2m_u_patch(p) = 283._r8 - end if - else - if (.not. lun%ifspecial(l)) then - if (use_vancouver) then - this%t_ref2m_r_patch(p) = 297.56 - else if (use_mexicocity) then - this%t_ref2m_r_patch(p) = 289.46 - else - this%t_ref2m_r_patch(p) = 283._r8 - end if - else - this%t_ref2m_r_patch(p) = spval - end if - end if - - end do - end associate - do l = bounds%begl, bounds%endl - if (lun%urbpoi(l)) then - if (use_vancouver) then - this%taf_lun(l) = 297.56_r8 - else if (use_mexicocity) then - this%taf_lun(l) = 289.46_r8 - else - this%taf_lun(l) = 283._r8 - end if - end if - end do - - do c = bounds%begc,bounds%endc - l = col%landunit(c) - - if (col%itype(c) == icol_roof ) this%emg_col(c) = em_roof_lun(l) - if (col%itype(c) == icol_sunwall ) this%emg_col(c) = em_wall_lun(l) - if (col%itype(c) == icol_shadewall ) this%emg_col(c) = em_wall_lun(l) - if (col%itype(c) == icol_road_imperv) this%emg_col(c) = em_improad_lun(l) - if (col%itype(c) == icol_road_perv ) this%emg_col(c) = em_perroad_lun(l) - end do - end subroutine InitCold !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag, is_simple_buildtemp, is_prog_buildtemp) + subroutine Restart(this, bounds, ncid, flag) ! ! !DESCRIPTION: ! Read/Write module information to/from restart file. ! ! !USES: use shr_log_mod , only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc use abortutils , only : endrun use ncdio_pio , only : file_desc_t, ncd_double use restUtilMod @@ -832,8 +178,6 @@ subroutine Restart(this, bounds, ncid, flag, is_simple_buildtemp, is_prog_buildt type(bounds_type), intent(in) :: bounds type(file_desc_t), intent(inout) :: ncid character(len=*) , intent(in) :: flag - logical , intent(in) :: is_simple_buildtemp ! Simple building temp is being used - logical , intent(in) :: is_prog_buildtemp ! Prognostic building temp is being used ! ! !LOCAL VARIABLES: integer :: j,c ! indices @@ -845,630 +189,11 @@ subroutine Restart(this, bounds, ncid, flag, is_simple_buildtemp, is_prog_buildt long_name='soil-snow temperature', units='K', & interpinic_flag='interp', readvar=readvar, data=this%t_soisno_col) - call restartvar(ncid=ncid, flag=flag, varname='T_VEG', xtype=ncd_double, & - dim1name='pft', & - long_name='vegetation temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_veg_patch) - - call restartvar(ncid=ncid, flag=flag, varname='TH2OSFC', xtype=ncd_double, & - dim1name='column', & - long_name='surface water temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_h2osfc_col) - if (flag=='read' .and. .not. readvar) then - this%t_h2osfc_col(bounds%begc:bounds%endc) = 274.0_r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='T_LAKE', xtype=ncd_double, & - dim1name='column', dim2name='levlak', switchdim=.true., & - long_name='lake temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_lake_col) - call restartvar(ncid=ncid, flag=flag, varname='T_GRND', xtype=ncd_double, & dim1name='column', & long_name='ground temperature', units='K', & interpinic_flag='interp', readvar=readvar, data=this%t_grnd_col) - call restartvar(ncid=ncid, flag=flag, varname='T_GRND_R', xtype=ncd_double, & - dim1name='column', & - long_name='rural ground temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_grnd_r_col) - - call restartvar(ncid=ncid, flag=flag, varname='T_GRND_U', xtype=ncd_double, & - dim1name='column', & - long_name='urban ground temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_grnd_u_col) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M', xtype=ncd_double, & - dim1name='pft', & - long_name='2m height surface air temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_patch) - if (flag=='read' .and. .not. readvar) call endrun(msg=errMsg(sourcefile, __LINE__)) - - call restartvar(ncid=ncid, flag=flag, varname="T_REF2M_R", xtype=ncd_double, & - dim1name='pft', & - long_name='Rural 2m height surface air temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_r_patch) - - call restartvar(ncid=ncid, flag=flag, varname="T_REF2M_U", xtype=ncd_double, dim1name='pft', & - long_name='Urban 2m height surface air temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_u_patch) - - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MIN', xtype=ncd_double, & - dim1name='pft', & - long_name='daily minimum of average 2 m height surface air temperature (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_min_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MIN_R', xtype=ncd_double, & - dim1name='pft', & - long_name='rural daily minimum of average 2 m height surface air temperature (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_min_r_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MIN_U', xtype=ncd_double, dim1name='pft', & - long_name='urban daily minimum of average 2 m height surface air temperature (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_min_u_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MAX', xtype=ncd_double, & - dim1name='pft', & - long_name='daily maximum of average 2 m height surface air temperature (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_max_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MAX_R', xtype=ncd_double, & - dim1name='pft', & - long_name='rural daily maximum of average 2 m height surface air temperature (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_max_r_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MAX_U', xtype=ncd_double, dim1name='pft', & - long_name='urban daily maximum of average 2 m height surface air temperature (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_max_u_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MIN_INST', xtype=ncd_double, & - dim1name='pft', & - long_name='instantaneous daily min of average 2 m height surface air temp (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_min_inst_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MIN_INST_R', xtype=ncd_double, & - dim1name='pft', & - long_name='rural instantaneous daily min of average 2 m height surface air temp (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_min_inst_r_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MIN_INST_U', xtype=ncd_double, dim1name='pft', & - long_name='urban instantaneous daily min of average 2 m height surface air temp (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_min_inst_u_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MAX_INST', xtype=ncd_double, & - dim1name='pft', & - long_name='instantaneous daily max of average 2 m height surface air temp (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_max_inst_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MAX_INST_R', xtype=ncd_double, & - dim1name='pft', & - long_name='rural instantaneous daily max of average 2 m height surface air temp (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_max_inst_r_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MAX_INST_U', xtype=ncd_double, dim1name='pft', & - long_name='urban instantaneous daily max of average 2 m height surface air temp (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_max_inst_u_patch) - - call restartvar(ncid=ncid, flag=flag, varname='taf', xtype=ncd_double, dim1name='landunit', & - long_name='urban canopy air temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%taf_lun) - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='gdd1020', xtype=ncd_double, & - dim1name='pft', long_name='20 year average of growing degree-days base 10C from planting', units='ddays', & - interpinic_flag='interp', readvar=readvar, data=this%gdd1020_patch) - - call restartvar(ncid=ncid, flag=flag, varname='gdd820', xtype=ncd_double, & - dim1name='pft', long_name='20 year average of growing degree-days base 8C from planting', units='ddays', & - interpinic_flag='interp', readvar=readvar, data=this%gdd820_patch) - - call restartvar(ncid=ncid, flag=flag, varname='gdd020', xtype=ncd_double, & - dim1name='pft', long_name='20 year average of growing degree-days base 0C from planting', units='ddays', & - interpinic_flag='interp', readvar=readvar, data=this%gdd020_patch) - end if - - if(use_luna)then - call restartvar(ncid=ncid, flag=flag, varname='tvegd10', xtype=ncd_double, & - dim1name='pft', long_name='10-day mean daytime vegetation temperature', units='Kelvin', & - interpinic_flag='interp', readvar=readvar, data=this%t_veg10_day_patch ) - call restartvar(ncid=ncid, flag=flag, varname='tvegd', xtype=ncd_double, & - dim1name='pft', long_name='accumulative daytime vegetation temperature', units='Kelvin*steps', & - interpinic_flag='interp', readvar=readvar, data=this%t_veg_day_patch ) - call restartvar(ncid=ncid, flag=flag, varname='tvegn10', xtype=ncd_double, & - dim1name='pft', long_name='10-day mean nighttime vegetation temperature', units='Kelvin', & - interpinic_flag='interp', readvar=readvar, data=this%t_veg10_night_patch ) - call restartvar(ncid=ncid, flag=flag, varname='tvegn', xtype=ncd_double, & - dim1name='pft', long_name='accumulative nighttime vegetation temperature', units='Kelvin*steps', & - interpinic_flag='interp', readvar=readvar, data=this%t_veg_night_patch ) - call restartvar(ncid=ncid, flag=flag, varname='tair10', xtype=ncd_double, & - dim1name='pft', long_name='10-day mean air temperature', units='Kelvin', & - interpinic_flag='interp', readvar=readvar, data=this%t_a10_patch ) - call restartvar(ncid=ncid, flag=flag, varname='ndaysteps', xtype=ncd_double, & - dim1name='pft', long_name='accumulative daytime steps', units='steps', & - interpinic_flag='interp', readvar=readvar, data=this%ndaysteps_patch ) - call restartvar(ncid=ncid, flag=flag, varname='nnightsteps', xtype=ncd_double, & - dim1name='pft', long_name='accumulative nighttime steps', units='steps', & - interpinic_flag='interp', readvar=readvar, data=this%nnightsteps_patch ) - endif - - if ( is_prog_buildtemp )then - ! landunit type physical state variable - t_building - call restartvar(ncid=ncid, flag=flag, varname='t_building', xtype=ncd_double, & - dim1name='landunit', & - long_name='internal building air temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_building_lun) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find t_building in initial file..." - if (masterproc) write(iulog,*) "Initialize t_building to taf" - this%t_building_lun(bounds%begl:bounds%endl) = this%taf_lun(bounds%begl:bounds%endl) - end if - - ! landunit type physical state variable - t_roof_inner - call restartvar(ncid=ncid, flag=flag, varname='t_roof_inner', xtype=ncd_double, & - dim1name='landunit', & - long_name='roof inside surface temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_roof_inner_lun) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find t_roof_inner in initial file..." - if (masterproc) write(iulog,*) "Initialize t_roof_inner to taf" - this%t_roof_inner_lun(bounds%begl:bounds%endl) = this%taf_lun(bounds%begl:bounds%endl) - end if - - ! landunit type physical state variable - t_sunw_inner - call restartvar(ncid=ncid, flag=flag, varname='t_sunw_inner', xtype=ncd_double, & - dim1name='landunit', & - long_name='sunwall inside surface temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_sunw_inner_lun) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find t_sunw_inner in initial file..." - if (masterproc) write(iulog,*) "Initialize t_sunw_inner to taf" - this%t_sunw_inner_lun(bounds%begl:bounds%endl) = this%taf_lun(bounds%begl:bounds%endl) - end if - - ! landunit type physical state variable - t_shdw_inner - call restartvar(ncid=ncid, flag=flag, varname='t_shdw_inner', xtype=ncd_double, & - dim1name='landunit', & - long_name='shadewall inside surface temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_shdw_inner_lun) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find t_shdw_inner in initial file..." - if (masterproc) write(iulog,*) "Initialize t_shdw_inner to taf" - this%t_shdw_inner_lun(bounds%begl:bounds%endl) = this%taf_lun(bounds%begl:bounds%endl) - end if - - ! landunit type physical state variable - t_floor - call restartvar(ncid=ncid, flag=flag, varname='t_floor', xtype=ncd_double, & - dim1name='landunit', & - long_name='floor temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_floor_lun) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find t_floor in initial file..." - if (masterproc) write(iulog,*) "Initialize t_floor to taf" - this%t_floor_lun(bounds%begl:bounds%endl) = this%taf_lun(bounds%begl:bounds%endl) - end if - end if - - end subroutine Restart - !----------------------------------------------------------------------- - subroutine InitAccBuffer (this, bounds) - ! - ! !DESCRIPTION: - ! Initialize accumulation buffer for all required module accumulated fields - ! This routine set defaults values that are then overwritten by the - ! restart file for restart or branch runs - ! Each interval and accumulation type is unique to each field processed. - ! Routine [initAccBuffer] defines the fields to be processed - ! and the type of accumulation. - ! Routine [updateAccVars] does the actual accumulation for a given field. - ! Fields are accumulated by calls to subroutine [update_accum_field]. - ! To accumulate a field, it must first be defined in subroutine [initAccVars] - ! and then accumulated by calls to [updateAccVars]. - ! Four types of accumulations are possible: - ! o average over time interval - ! o running mean over time interval - ! o running accumulation over time interval - ! Time average fields are only valid at the end of the averaging interval. - ! Running means are valid once the length of the simulation exceeds the - ! averaging interval. Accumulated fields are continuously accumulated. - ! The trigger value "-99999." resets the accumulation to zero. - ! - ! !USES - use accumulMod , only : init_accum_field - use clm_time_manager , only : get_step_size - use shr_const_mod , only : SHR_CONST_CDAY, SHR_CONST_TKFRZ - ! - ! !ARGUMENTS: - class(temperature_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - real(r8) :: dtime - integer, parameter :: not_used = huge(1) - !--------------------------------------------------------------------- - - dtime = get_step_size() - - this%t_veg24_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='T_VEG24', units='K', & - desc='24hr average of vegetation temperature', accum_type='runmean', accum_period=-1, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - this%t_veg240_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='T_VEG240', units='K', & - desc='240hr average of vegetation temperature', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field(name='TREFAV', units='K', & - desc='average over an hour of 2-m temperature', accum_type='timeavg', accum_period=nint(3600._r8/dtime), & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field(name='TREFAV_U', units='K', & - desc='average over an hour of urban 2-m temperature', accum_type='timeavg', accum_period=nint(3600._r8/dtime), & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field(name='TREFAV_R', units='K', & - desc='average over an hour of rural 2-m temperature', accum_type='timeavg', accum_period=nint(3600._r8/dtime), & - subgrid_type='pft', numlev=1, init_value=0._r8) - - ! The following is a running mean. The accumulation period is set to -10 for a 10-day running mean. - call init_accum_field (name='T10', units='K', & - desc='10-day running mean of 2-m temperature', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1,init_value=SHR_CONST_TKFRZ+20._r8) - - if ( use_crop )then - call init_accum_field (name='TDM10', units='K', & - desc='10-day running mean of min 2-m temperature', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=SHR_CONST_TKFRZ) - - call init_accum_field (name='TDM5', units='K', & - desc='5-day running mean of min 2-m temperature', accum_type='runmean', accum_period=-5, & - subgrid_type='pft', numlev=1, init_value=SHR_CONST_TKFRZ) - end if - - if ( use_crop )then - - ! All GDD summations are relative to the planting date (Kucharik & Brye 2003) - call init_accum_field (name='GDD0', units='K', & - desc='growing degree-days base 0C from planting', accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field (name='GDD8', units='K', & - desc='growing degree-days base 8C from planting', accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field (name='GDD10', units='K', & - desc='growing degree-days base 10C from planting', accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - end if - - if (use_cndv) then - ! 30-day average of 2m temperature. - call init_accum_field (name='TDA', units='K', & - desc='30-day average of 2-m temperature', accum_type='timeavg', accum_period=-30, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - end if - - end subroutine InitAccBuffer - - !----------------------------------------------------------------------- - subroutine InitAccVars(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module variables that are associated with - ! time accumulated fields. This routine is called for both an initial run - ! and a restart run (and must therefore must be called after the restart file - ! is read in and the accumulation buffer is obtained) - ! - ! !USES - use accumulMod , only : init_accum_field, extract_accum_field - use clm_time_manager , only : get_nstep - use clm_varctl , only : nsrest, nsrStartup - use abortutils , only : endrun - ! - ! !ARGUMENTS: - class(temperature_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: nstep - integer :: ier - real(r8), pointer :: rbufslp(:) ! temporary - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - ! Allocate needed dynamic memory for single level pft field - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)' in ' - call endrun(msg="extract_accum_hist allocation error for rbufslp"//& - errMsg(sourcefile, __LINE__)) - endif - - ! Determine time step - nstep = get_nstep() - - call extract_accum_field ('T_VEG24', rbufslp, nstep) - this%t_veg24_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('T_VEG240', rbufslp, nstep) - this%t_veg240_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('T10', rbufslp, nstep) - this%t_a10_patch(begp:endp) = rbufslp(begp:endp) - - if (use_crop) then - call extract_accum_field ('TDM10', rbufslp, nstep) - this%t_a10min_patch(begp:endp)= rbufslp(begp:endp) - - call extract_accum_field ('TDM5', rbufslp, nstep) - this%t_a5min_patch(begp:endp) = rbufslp(begp:endp) - end if - - ! Initialize variables that are to be time accumulated - ! Initialize 2m ref temperature max and min values - - if (nsrest == nsrStartup) then - this%t_ref2m_max_patch(begp:endp) = spval - this%t_ref2m_max_r_patch(begp:endp) = spval - this%t_ref2m_max_u_patch(begp:endp) = spval - - this%t_ref2m_min_patch(begp:endp) = spval - this%t_ref2m_min_r_patch(begp:endp) = spval - this%t_ref2m_min_u_patch(begp:endp) = spval - - this%t_ref2m_max_inst_patch(begp:endp) = -spval - this%t_ref2m_max_inst_r_patch(begp:endp) = -spval - this%t_ref2m_max_inst_u_patch(begp:endp) = -spval - - this%t_ref2m_min_inst_patch(begp:endp) = spval - this%t_ref2m_min_inst_r_patch(begp:endp) = spval - this%t_ref2m_min_inst_u_patch(begp:endp) = spval - end if - - if ( use_crop ) then - - call extract_accum_field ('GDD0', rbufslp, nstep) - this%gdd0_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('GDD8', rbufslp, nstep) ; - this%gdd8_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('GDD10', rbufslp, nstep) - this%gdd10_patch(begp:endp) = rbufslp(begp:endp) - - end if - - deallocate(rbufslp) - - end subroutine InitAccVars - - !----------------------------------------------------------------------- - subroutine UpdateAccVars (this, bounds) - ! - ! USES - use shr_const_mod , only : SHR_CONST_CDAY, SHR_CONST_TKFRZ - use clm_time_manager , only : get_step_size, get_nstep, is_end_curr_day, get_curr_date - use accumulMod , only : update_accum_field, extract_accum_field, accumResetVal - ! - ! !ARGUMENTS: - class(temperature_type) :: this - type(bounds_type) , intent(in) :: bounds - - ! - ! !LOCAL VARIABLES: - integer :: m,g,l,c,p ! indices - integer :: ier ! error status - integer :: dtime ! timestep size [seconds] - integer :: nstep ! timestep number - integer :: year ! year (0, ...) for nstep - integer :: month ! month (1, ..., 12) for nstep - integer :: day ! day of month (1, ..., 31) for nstep - integer :: secs ! seconds into current date for nstep - logical :: end_cd ! temporary for is_end_curr_day() value - integer :: begp, endp - real(r8), pointer :: rbufslp(:) ! temporary single level - pft level - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - dtime = get_step_size() - nstep = get_nstep() - call get_curr_date (year, month, day, secs) - - ! Allocate needed dynamic memory for single level pft field - - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)'update_accum_hist allocation error for rbuf1dp' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - - ! Accumulate and extract T_VEG24 & T_VEG240 - do p = begp,endp - rbufslp(p) = this%t_veg_patch(p) - end do - call update_accum_field ('T_VEG24' , rbufslp , nstep) - call extract_accum_field ('T_VEG24' , this%t_veg24_patch , nstep) - call update_accum_field ('T_VEG240', rbufslp , nstep) - call extract_accum_field ('T_VEG240', this%t_veg240_patch , nstep) - - ! Accumulate and extract TREFAV - hourly average 2m air temperature - ! Used to compute maximum and minimum of hourly averaged 2m reference - ! temperature over a day. Note that "spval" is returned by the call to - ! accext if the time step does not correspond to the end of an - ! accumulation interval. First, initialize the necessary values for - ! an initial run at the first time step the accumulator is called - - call update_accum_field ('TREFAV', this%t_ref2m_patch, nstep) - call extract_accum_field ('TREFAV', rbufslp, nstep) - end_cd = is_end_curr_day() - do p = begp,endp - if (rbufslp(p) /= spval) then - this%t_ref2m_max_inst_patch(p) = max(rbufslp(p), this%t_ref2m_max_inst_patch(p)) - this%t_ref2m_min_inst_patch(p) = min(rbufslp(p), this%t_ref2m_min_inst_patch(p)) - endif - if (end_cd) then - this%t_ref2m_max_patch(p) = this%t_ref2m_max_inst_patch(p) - this%t_ref2m_min_patch(p) = this%t_ref2m_min_inst_patch(p) - this%t_ref2m_max_inst_patch(p) = -spval - this%t_ref2m_min_inst_patch(p) = spval - else if (secs == dtime) then - this%t_ref2m_max_patch(p) = spval - this%t_ref2m_min_patch(p) = spval - endif - end do - - ! Accumulate and extract TREFAV_U - hourly average urban 2m air temperature - ! Used to compute maximum and minimum of hourly averaged 2m reference - ! temperature over a day. Note that "spval" is returned by the call to - ! accext if the time step does not correspond to the end of an - ! accumulation interval. First, initialize the necessary values for - ! an initial run at the first time step the accumulator is called - - call update_accum_field ('TREFAV_U', this%t_ref2m_u_patch, nstep) - call extract_accum_field ('TREFAV_U', rbufslp, nstep) - do p = begp,endp - l = patch%landunit(p) - if (rbufslp(p) /= spval) then - this%t_ref2m_max_inst_u_patch(p) = max(rbufslp(p), this%t_ref2m_max_inst_u_patch(p)) - this%t_ref2m_min_inst_u_patch(p) = min(rbufslp(p), this%t_ref2m_min_inst_u_patch(p)) - endif - if (end_cd) then - if (lun%urbpoi(l)) then - this%t_ref2m_max_u_patch(p) = this%t_ref2m_max_inst_u_patch(p) - this%t_ref2m_min_u_patch(p) = this%t_ref2m_min_inst_u_patch(p) - this%t_ref2m_max_inst_u_patch(p) = -spval - this%t_ref2m_min_inst_u_patch(p) = spval - end if - else if (secs == dtime) then - this%t_ref2m_max_u_patch(p) = spval - this%t_ref2m_min_u_patch(p) = spval - endif - end do - - ! Accumulate and extract TREFAV_R - hourly average rural 2m air temperature - ! Used to compute maximum and minimum of hourly averaged 2m reference - ! temperature over a day. Note that "spval" is returned by the call to - ! accext if the time step does not correspond to the end of an - ! accumulation interval. First, initialize the necessary values for - ! an initial run at the first time step the accumulator is called - - call update_accum_field ('TREFAV_R', this%t_ref2m_r_patch, nstep) - call extract_accum_field ('TREFAV_R', rbufslp, nstep) - do p = begp,endp - l = patch%landunit(p) - if (rbufslp(p) /= spval) then - this%t_ref2m_max_inst_r_patch(p) = max(rbufslp(p), this%t_ref2m_max_inst_r_patch(p)) - this%t_ref2m_min_inst_r_patch(p) = min(rbufslp(p), this%t_ref2m_min_inst_r_patch(p)) - endif - if (end_cd) then - if (.not.(lun%ifspecial(l))) then - this%t_ref2m_max_r_patch(p) = this%t_ref2m_max_inst_r_patch(p) - this%t_ref2m_min_r_patch(p) = this%t_ref2m_min_inst_r_patch(p) - this%t_ref2m_max_inst_r_patch(p) = -spval - this%t_ref2m_min_inst_r_patch(p) = spval - end if - else if (secs == dtime) then - this%t_ref2m_max_r_patch(p) = spval - this%t_ref2m_min_r_patch(p) = spval - endif - end do - - ! Accumulate and extract T10 - !(acumulates TSA as 10-day running mean) - - call update_accum_field ('T10', this%t_ref2m_patch, nstep) - call extract_accum_field ('T10', this%t_a10_patch, nstep) - - if ( use_crop )then - ! Accumulate and extract TDM10 - - do p = begp,endp - rbufslp(p) = min(this%t_ref2m_min_patch(p),this%t_ref2m_min_inst_patch(p)) !slevis: ok choice? - if (rbufslp(p) > 1.e30_r8) rbufslp(p) = SHR_CONST_TKFRZ !and were 'min'& - end do !'min_inst' not initialized? - call update_accum_field ('TDM10', rbufslp, nstep) - call extract_accum_field ('TDM10', this%t_a10min_patch, nstep) - - ! Accumulate and extract TDM5 - - do p = begp,endp - rbufslp(p) = min(this%t_ref2m_min_patch(p),this%t_ref2m_min_inst_patch(p)) !slevis: ok choice? - if (rbufslp(p) > 1.e30_r8) rbufslp(p) = SHR_CONST_TKFRZ !and were 'min'& - end do !'min_inst' not initialized? - call update_accum_field ('TDM5', rbufslp, nstep) - call extract_accum_field ('TDM5', this%t_a5min_patch, nstep) - - ! Accumulate and extract GDD0 - - do p = begp,endp - ! Avoid unnecessary calculations over inactive points - if (patch%active(p)) then - g = patch%gridcell(p) - if (month==1 .and. day==1 .and. secs==dtime) then - rbufslp(p) = accumResetVal ! reset gdd - else if (( month > 3 .and. month < 10 .and. grc%latdeg(g) >= 0._r8) .or. & - ((month > 9 .or. month < 4) .and. grc%latdeg(g) < 0._r8) ) then - rbufslp(p) = max(0._r8, min(26._r8, this%t_ref2m_patch(p)-SHR_CONST_TKFRZ)) * dtime/SHR_CONST_CDAY - else - rbufslp(p) = 0._r8 ! keeps gdd unchanged at other times (eg, through Dec in NH) - end if - end if - end do - call update_accum_field ('GDD0', rbufslp, nstep) - call extract_accum_field ('GDD0', this%gdd0_patch, nstep) - - ! Accumulate and extract GDD8 - - do p = begp,endp - ! Avoid unnecessary calculations over inactive points - if (patch%active(p)) then - g = patch%gridcell(p) - if (month==1 .and. day==1 .and. secs==dtime) then - rbufslp(p) = accumResetVal ! reset gdd - else if (( month > 3 .and. month < 10 .and. grc%latdeg(g) >= 0._r8) .or. & - ((month > 9 .or. month < 4) .and. grc%latdeg(g) < 0._r8) ) then - rbufslp(p) = max(0._r8, min(30._r8, & - this%t_ref2m_patch(p)-(SHR_CONST_TKFRZ + 8._r8))) * dtime/SHR_CONST_CDAY - else - rbufslp(p) = 0._r8 ! keeps gdd unchanged at other times (eg, through Dec in NH) - end if - end if - end do - call update_accum_field ('GDD8', rbufslp, nstep) - call extract_accum_field ('GDD8', this%gdd8_patch, nstep) - - ! Accumulate and extract GDD10 - - do p = begp,endp - ! Avoid unnecessary calculations over inactive points - if (patch%active(p)) then - g = patch%gridcell(p) - if (month==1 .and. day==1 .and. secs==dtime) then - rbufslp(p) = accumResetVal ! reset gdd - else if (( month > 3 .and. month < 10 .and. grc%latdeg(g) >= 0._r8) .or. & - ((month > 9 .or. month < 4) .and. grc%latdeg(g) < 0._r8) ) then - rbufslp(p) = max(0._r8, min(30._r8, & - this%t_ref2m_patch(p)-(SHR_CONST_TKFRZ + 10._r8))) * dtime/SHR_CONST_CDAY - else - rbufslp(p) = 0._r8 ! keeps gdd unchanged at other times (eg, through Dec in NH) - end if - end if - end do - call update_accum_field ('GDD10', rbufslp, nstep) - call extract_accum_field ('GDD10', this%gdd10_patch, nstep) - - end if - - deallocate(rbufslp) - - end subroutine UpdateAccVars - end module TemperatureType diff --git a/src/biogeophys/TridiagonalMod.F90 b/src/biogeophys/TridiagonalMod.F90 deleted file mode 100644 index 68dbd71cce..0000000000 --- a/src/biogeophys/TridiagonalMod.F90 +++ /dev/null @@ -1,118 +0,0 @@ -module TridiagonalMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Tridiagonal matrix solution - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: Tridiagonal - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine Tridiagonal (bounds, lbj, ubj, jtop, numf, filter, a, b, c, r, u) - ! - ! !DESCRIPTION: - ! Tridiagonal matrix solution - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : nlevurb - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varctl , only : iulog - use decompMod , only : bounds_type - use ColumnType , only : col - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds - integer , intent(in) :: lbj, ubj ! lbinning and ubing level indices - integer , intent(in) :: jtop( bounds%begc: ) ! top level for each column [col] - integer , intent(in) :: numf ! filter dimension - integer , intent(in) :: filter(:) ! filter - real(r8), intent(in) :: a( bounds%begc: , lbj: ) ! "a" left off diagonal of tridiagonal matrix [col, j] - real(r8), intent(in) :: b( bounds%begc: , lbj: ) ! "b" diagonal column for tridiagonal matrix [col, j] - real(r8), intent(in) :: c( bounds%begc: , lbj: ) ! "c" right off diagonal tridiagonal matrix [col, j] - real(r8), intent(in) :: r( bounds%begc: , lbj: ) ! "r" forcing term of tridiagonal matrix [col, j] - real(r8), intent(inout) :: u( bounds%begc: , lbj: ) ! solution [col, j] - ! - integer :: j,ci,fc !indices - real(r8) :: gam(bounds%begc:bounds%endc,lbj:ubj) !temporary - real(r8) :: bet(bounds%begc:bounds%endc) !temporary - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(jtop) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(a) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(b) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(c) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(r) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(u) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - - ! Solve the matrix - - do fc = 1,numf - ci = filter(fc) - bet(ci) = b(ci,jtop(ci)) - end do - - do j = lbj, ubj - do fc = 1,numf - ci = filter(fc) - if ((col%itype(ci) == icol_sunwall .or. col%itype(ci) == icol_shadewall & - .or. col%itype(ci) == icol_roof) .and. j <= nlevurb) then - if (j >= jtop(ci)) then - if (j == jtop(ci)) then - u(ci,j) = r(ci,j) / bet(ci) - else - gam(ci,j) = c(ci,j-1) / bet(ci) - bet(ci) = b(ci,j) - a(ci,j) * gam(ci,j) - u(ci,j) = (r(ci,j) - a(ci,j)*u(ci,j-1)) / bet(ci) - end if - end if - else if (col%itype(ci) /= icol_sunwall .and. col%itype(ci) /= icol_shadewall & - .and. col%itype(ci) /= icol_roof) then - if (j >= jtop(ci)) then - if (j == jtop(ci)) then - u(ci,j) = r(ci,j) / bet(ci) - else - gam(ci,j) = c(ci,j-1) / bet(ci) - bet(ci) = b(ci,j) - a(ci,j) * gam(ci,j) - u(ci,j) = (r(ci,j) - a(ci,j)*u(ci,j-1)) / bet(ci) - end if - end if - end if - end do - end do - - do j = ubj-1,lbj,-1 - do fc = 1,numf - ci = filter(fc) - if ((col%itype(ci) == icol_sunwall .or. col%itype(ci) == icol_shadewall & - .or. col%itype(ci) == icol_roof) .and. j <= nlevurb-1) then - if (j >= jtop(ci)) then - u(ci,j) = u(ci,j) - gam(ci,j+1) * u(ci,j+1) - end if - else if (col%itype(ci) /= icol_sunwall .and. col%itype(ci) /= icol_shadewall & - .and. col%itype(ci) /= icol_roof) then - if (j >= jtop(ci)) then - u(ci,j) = u(ci,j) - gam(ci,j+1) * u(ci,j+1) - end if - end if - end do - end do - - end subroutine Tridiagonal - -end module TridiagonalMod diff --git a/src/biogeophys/UrbBuildTempOleson2015Mod.F90 b/src/biogeophys/UrbBuildTempOleson2015Mod.F90 deleted file mode 100644 index eaf1c14c36..0000000000 --- a/src/biogeophys/UrbBuildTempOleson2015Mod.F90 +++ /dev/null @@ -1,938 +0,0 @@ -module UrbBuildTempOleson2015Mod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculates internal building air temperature - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use perf_mod , only : t_startf, t_stopf - use clm_varctl , only : iulog - use UrbanParamsType , only : urbanparams_type - use UrbanTimeVarType , only : urbantv_type - use EnergyFluxType , only : energyflux_type - use TemperatureType , only : temperature_type - use LandunitType , only : lun - use ColumnType , only : col - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: BuildingTemperature ! Calculation of interior building air temperature, inner - ! surface temperatures of walls and roof, and floor temperature - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: BuildingTemperature -! -! !INTERFACE: - subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, & - filter_nolakec, tk, urbanparams_inst, temperature_inst, & - energyflux_inst, urbantv_inst) -! -! !DESCRIPTION: -! Solve for t_building, inner surface temperatures of roof, sunw, shdw, and floor temperature -! Five equations, five unknowns (t_roof_inner,t_sunw_inner,t_shdw_inner,t_floor,t_building at n+1) -! Derived from energy balance equations at each surface and building air -! rd (radiation), cd (conduction), cv (convection) -! qrd_roof + qcd_roof + qcv_roof = 0 -! qrd_sunw + qcd_sunw + qcv_sunw = 0 -! qrd_shdw + qcd_shdw + qcv_shdw = 0 -! qrd_floor + qcd_floor + qcv_floor = 0 -! Vbld*rho_dair*cpair*(dt_building/dt) = sum(Asfc*hcv_sfc*(t_sfc - t_building) -! + Vvent*rho_dair*cpair*(taf - t_building) -! where Vlbd is volume of building air, -! rho_dair is density of dry air at t_building (kg m-3), -! cpair is specific heat of dry air (J kg-1 K-1), -! dt_building is change in interior building temperature (K), -! dt is timestep (s), -! Asfc is surface area of roof, sunw, shdw, floor (m2) -! hcv_sfc is convective heat transfer coefficient for roof, sunw, shdw, floor (W m-2 K-1) -! t_sfc is inner surface temperature of roof, sunw, shdw, floor (K) -! t_building is interior building temperature (K) -! Vvent is ventilation airflow rate (m3 s-1) -! taf is urban canyon air temperature (K) -! -! This methodology was introduced as part of CLM5.0. -! -! Conduction fluxes are obtained from terms of soil temperature equations -! Radiation fluxes are obtained from linearizing the longwave radiation equations taking into -! account view factors for each surface. - -! qrd is positive away from the surface toward room air, so qrd = emitted - absorbed, -! so positive qrd will result in a decrease in temperature -! qcd_floor is positive away from surface toward room air, so positive -! qcd will result in a decrease in temperature -! qcv is positive toward room air, so positive qcv (t_surface > t_room) will -! result in a decrease in temperature - -! The LAPACK routine DGESV is used to compute the solution to the real system of linear equations -! a * x = b, -! where a is an n-by-n matrix and x and b are n-by-nrhs matrices. -! -! The LU decomposition with partial pivoting and row interchanges is -! used to factor a as -! a = P * L * U, -! where P is a permutation matrix, L is unit lower triangular, and U is -! upper triangular. The factored form of a is then used to solve the -! system of equations a * x = b. - -! The following is from LAPACK documentation -! DGESV computes the solution to system of linear equations A * X = B for GE matrices -! -! =========== DOCUMENTATION =========== -! -! Online html documentation available at -! http://www.netlib.org/lapack/explore-html/ -! -! Download DGESV + dependencies -! -! [TGZ] -! -! [ZIP] -! -! [TXT] -! -! Definition: -! =========== -! -! SUBROUTINE DGESV( N, NRHS, A, LDA, IPIV, B, LDB, INFO ) -! -! .. Scalar Arguments .. -! INTEGER INFO, LDA, LDB, N, NRHS -! .. -! .. Array Arguments .. -! INTEGER IPIV( * ) -! DOUBLE PRECISION A( LDA, * ), B( LDB, * ) -! .. -! -! -! ============= -! -! -! DGESV computes the solution to a real system of linear equations -! A * X = B, -! where A is an N-by-N matrix and X and B are N-by-NRHS matrices. -! -! The LU decomposition with partial pivoting and row interchanges is -! used to factor A as -! A = P * L * U, -! where P is a permutation matrix, L is unit lower triangular, and U is -! upper triangular. The factored form of A is then used to solve the -! system of equations A * X = B. -! -! Arguments: -! ========== -! -! \param[in] N -! N is INTEGER -! The number of linear equations, i.e., the order of the -! matrix A. N >= 0. -! -! \param[in] NRHS -! NRHS is INTEGER -! The number of right hand sides, i.e., the number of columns -! of the matrix B. NRHS >= 0. -! -! \param[in,out] A -! A is DOUBLE PRECISION array, dimension (LDA,N) -! On entry, the N-by-N coefficient matrix A. -! On exit, the factors L and U from the factorization -! A = P*L*U; the unit diagonal elements of L are not stored. -! -! \param[in] LDA -! LDA is INTEGER -! The leading dimension of the array A. LDA >= max(1,N). -! -! \param[out] IPIV -! IPIV is INTEGER array, dimension (N) -! The pivot indices that define the permutation matrix P; -! row i of the matrix was interchanged with row IPIV(i). -! -! \param[in,out] B -! B is DOUBLE PRECISION array, dimension (LDB,NRHS) -! On entry, the N-by-NRHS matrix of right hand side matrix B. -! On exit, if INFO = 0, the N-by-NRHS solution matrix X. -! -! \param[in] LDB -! LDB is INTEGER -! The leading dimension of the array B. LDB >= max(1,N). -! -! \param[out] INFO -! INFO is INTEGER -! = 0: successful exit -! < 0: if INFO = -i, the i-th argument had an illegal value -! > 0: if INFO = i, U(i,i) is exactly zero. The factorization -! has been completed, but the factor U is exactly -! singular, so the solution could not be computed. -! -! Authors: -! ======== -! -! \author Univ. of Tennessee -! \author Univ. of California Berkeley -! \author Univ. of Colorado Denver -! \author NAG Ltd. -! -! \date November 2011 -! -! \ingroup doubleGEsolve - -! !CALLED FROM: -! subroutine SoilTemperature in this module -! -! !REVISION HISTORY: -! 08/17/12 Keith Oleson: Initial code - -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_time_manager, only : get_step_size - use clm_varcon , only : rair, pstd, cpair, sb, hcv_roof, hcv_roof_enhanced, & - hcv_floor, hcv_floor_enhanced, hcv_sunw, hcv_shdw, & - em_roof_int, em_floor_int, em_sunw_int, em_shdw_int, & - dz_floor, dens_floor, cp_floor, vent_ach - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varctl , only : iulog - use abortutils , only : endrun - use clm_varpar , only : nlevurb, nlevsno, nlevgrnd - use UrbanParamsType , only : urban_hac, urban_hac_off, urban_hac_on, urban_wasteheat_on -! -! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: num_urbanl ! number of urban landunits in clump - integer , intent(in) :: filter_urbanl(:) ! urban landunit filter - real(r8), intent(in) :: tk(bounds%begc: , -nlevsno+1: ) ! thermal conductivity (W m-1 K-1) [col, j] - type(urbanparams_type), intent(in) :: urbanparams_inst ! urban parameters - type(temperature_type), intent(inout) :: temperature_inst ! temperature variables - type(energyflux_type) , intent(inout) :: energyflux_inst ! energy flux variables - type(urbantv_type) , intent(in) :: urbantv_inst ! urban time varying variables -! -! !LOCAL VARIABLES: - integer, parameter :: neq = 5 ! number of equation/unknowns - integer :: fc,fl,c,l ! indices - real(r8) :: dtime ! land model time step (s) - real(r8) :: t_roof_inner_bef(bounds%begl:bounds%endl) ! roof inside surface temperature at previous time step (K) - real(r8) :: t_sunw_inner_bef(bounds%begl:bounds%endl) ! sunwall inside surface temperature at previous time step (K) - real(r8) :: t_shdw_inner_bef(bounds%begl:bounds%endl) ! shadewall inside surface temperature at previous time step (K) - real(r8) :: t_floor_bef(bounds%begl:bounds%endl) ! floor temperature at previous time step (K) - real(r8) :: t_building_bef(bounds%begl:bounds%endl) ! internal building air temperature at previous time step [K] - real(r8) :: t_building_bef_hac(bounds%begl:bounds%endl)! internal building air temperature before applying HAC [K] - real(r8) :: hcv_roofi(bounds%begl:bounds%endl) ! roof convective heat transfer coefficient (W m-2 K-1) - real(r8) :: hcv_sunwi(bounds%begl:bounds%endl) ! sunwall convective heat transfer coefficient (W m-2 K-1) - real(r8) :: hcv_shdwi(bounds%begl:bounds%endl) ! shadewall convective heat transfer coefficient (W m-2 K-1) - real(r8) :: hcv_floori(bounds%begl:bounds%endl) ! floor convective heat transfer coefficient (W m-2 K-1) - real(r8) :: em_roofi(bounds%begl:bounds%endl) ! roof inside surface emissivity (-) - real(r8) :: em_sunwi(bounds%begl:bounds%endl) ! sunwall inside surface emissivity (-) - real(r8) :: em_shdwi(bounds%begl:bounds%endl) ! shadewall inside surface emissivity (-) - real(r8) :: em_floori(bounds%begl:bounds%endl) ! floor inside surface emissivity (-) - real(r8) :: dz_floori(bounds%begl:bounds%endl) ! concrete floor thickness (m) - real(r8) :: cp_floori(bounds%begl:bounds%endl) ! concrete floor volumetric heat capacity (J m-3 K-1) - real(r8) :: cv_floori(bounds%begl:bounds%endl) ! intermediate calculation for concrete floor (W m-2 K-1) - real(r8) :: rho_dair(bounds%begl:bounds%endl) ! density of dry air at standard pressure and t_building (kg m-3) - real(r8) :: vf_rf(bounds%begl:bounds%endl) ! view factor of roof for floor (-) - real(r8) :: vf_fr(bounds%begl:bounds%endl) ! view factor of floor for roof (-) - real(r8) :: vf_wf(bounds%begl:bounds%endl) ! view factor of wall for floor (-) - real(r8) :: vf_fw(bounds%begl:bounds%endl) ! view factor of floor for wall (-) - real(r8) :: vf_rw(bounds%begl:bounds%endl) ! view factor of roof for wall (-) - real(r8) :: vf_wr(bounds%begl:bounds%endl) ! view factor of wall for roof (-) - real(r8) :: vf_ww(bounds%begl:bounds%endl) ! view factor of wall for wall (-) - real(r8) :: zi_roof_innerl(bounds%begl:bounds%endl) ! interface depth of nlevurb roof (m) - real(r8) :: z_roof_innerl(bounds%begl:bounds%endl) ! node depth of nlevurb roof (m) - real(r8) :: zi_sunw_innerl(bounds%begl:bounds%endl) ! interface depth of nlevurb sunwall (m) - real(r8) :: z_sunw_innerl(bounds%begl:bounds%endl) ! node depth of nlevurb sunwall (m) - real(r8) :: zi_shdw_innerl(bounds%begl:bounds%endl) ! interface depth of nlevurb shadewall (m) - real(r8) :: z_shdw_innerl(bounds%begl:bounds%endl) ! node depth of nlevurb shadewall (m) - real(r8) :: t_roof_innerl_bef(bounds%begl:bounds%endl) ! roof temperature at nlevurb node depth at previous time step (K) - real(r8) :: t_sunw_innerl_bef(bounds%begl:bounds%endl) ! sunwall temperature at nlevurb node depth at previous time step (K) - real(r8) :: t_shdw_innerl_bef(bounds%begl:bounds%endl) ! shadewall temperature at nlevurb node depth at previous time step (K) - real(r8) :: t_roof_innerl(bounds%begl:bounds%endl) ! roof temperature at nlevurb node depth (K) - real(r8) :: t_sunw_innerl(bounds%begl:bounds%endl) ! sunwall temperature at nlevurb node depth (K) - real(r8) :: t_shdw_innerl(bounds%begl:bounds%endl) ! shadewall temperature at nlevurb node depth (K) - real(r8) :: tk_roof_innerl(bounds%begl:bounds%endl) ! roof thermal conductivity at nlevurb interface depth (W m-1 K-1) - real(r8) :: tk_sunw_innerl(bounds%begl:bounds%endl) ! sunwall thermal conductivity at nlevurb interface depth (W m-1 K-1) - real(r8) :: tk_shdw_innerl(bounds%begl:bounds%endl) ! shadewall thermal conductivity at nlevurb interface depth (W m-1 K-1) - real(r8) :: qrd_roof(bounds%begl:bounds%endl) ! roof inside net longwave for energy balance check (W m-2) - real(r8) :: qrd_sunw(bounds%begl:bounds%endl) ! sunwall inside net longwave for energy balance check (W m-2) - real(r8) :: qrd_shdw(bounds%begl:bounds%endl) ! shadewall inside net longwave for energy balance check (W m-2) - real(r8) :: qrd_floor(bounds%begl:bounds%endl) ! floor inside net longwave for energy balance check (W m-2) - real(r8) :: qrd_building(bounds%begl:bounds%endl) ! building inside net longwave for energy balance check (W m-2) - real(r8) :: qcv_roof(bounds%begl:bounds%endl) ! roof inside convection flux for energy balance check (W m-2) - real(r8) :: qcv_sunw(bounds%begl:bounds%endl) ! sunwall inside convection flux for energy balance check (W m-2) - real(r8) :: qcv_shdw(bounds%begl:bounds%endl) ! shadewall inside convection flux for energy balance check (W m-2) - real(r8) :: qcv_floor(bounds%begl:bounds%endl) ! floor inside convection flux for energy balance check (W m-2) - real(r8) :: qcd_roof(bounds%begl:bounds%endl) ! roof inside conduction flux for energy balance check (W m-2) - real(r8) :: qcd_sunw(bounds%begl:bounds%endl) ! sunwall inside conduction flux for energy balance check (W m-2) - real(r8) :: qcd_shdw(bounds%begl:bounds%endl) ! shadewall inside conduction flux for energy balance check (W m-2) - real(r8) :: qcd_floor(bounds%begl:bounds%endl) ! floor inside conduction flux for energy balance check (W m-2) - real(r8) :: enrgy_bal_roof(bounds%begl:bounds%endl) ! roof inside energy balance (W m-2) - real(r8) :: enrgy_bal_sunw(bounds%begl:bounds%endl) ! sunwall inside energy balance (W m-2) - real(r8) :: enrgy_bal_shdw(bounds%begl:bounds%endl) ! shadewall inside energy balance (W m-2) - real(r8) :: enrgy_bal_floor(bounds%begl:bounds%endl) ! floor inside energy balance (W m-2) - real(r8) :: enrgy_bal_buildair(bounds%begl:bounds%endl)! building air energy balance (W m-2) - real(r8) :: sum ! sum of view factors for floor, wall, roof - integer :: n ! number of linear equations (= neq) - integer :: nrhs ! number of right hand sides (= 1) - real(r8) :: a(neq,neq) ! n-by-n coefficient matrix a - integer :: lda ! leading dimension of the matrix a - integer :: ldb ! leading dimension of the matrix b - real(r8) :: result(neq) ! on entry, the right hand side of matrix b - ! on exit, if info = 0, the n-by-nrhs solution matrix x - integer :: info ! exit information for LAPACK routine dgesv - integer :: ipiv(neq) ! the pivot indices that define the permutation matrix P -!EOP -!----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - associate(& - clandunit => col%landunit , & ! Input: [integer (:)] column's landunit - ctype => col%itype , & ! Input: [integer (:)] column type - zi => col%zi , & ! Input: [real(r8) (:,:)] interface level below a "z" level (m) - z => col%z , & ! Input: [real(r8) (:,:)] layer thickness (m) - - ht_roof => lun%ht_roof , & ! Input: [real(r8) (:)] height of urban roof (m) - canyon_hwr => lun%canyon_hwr , & ! Input: [real(r8) (:)] ratio of building height to street hwidth (-) - wtlunit_roof => lun%wtlunit_roof , & ! Input: [real(r8) (:)] weight of roof with respect to landunit - urbpoi => lun%urbpoi , & ! Input: [logical (:)] true => landunit is an urban point - - taf => temperature_inst%taf_lun , & ! Input: [real(r8) (:)] urban canopy air temperature (K) - tssbef => temperature_inst%t_ssbef_col , & ! Input: [real(r8) (:,:)] temperature at previous time step (K) - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:)] soil temperature (K) - t_roof_inner => temperature_inst%t_roof_inner_lun , & ! InOut: [real(r8) (:)] roof inside surface temperature (K) - t_sunw_inner => temperature_inst%t_sunw_inner_lun , & ! InOut: [real(r8) (:)] sunwall inside surface temperature (K) - t_shdw_inner => temperature_inst%t_shdw_inner_lun , & ! InOut: [real(r8) (:)] shadewall inside surface temperature (K) - t_floor => temperature_inst%t_floor_lun , & ! InOut: [real(r8) (:)] floor temperature (K) - t_building => temperature_inst%t_building_lun , & ! InOut: [real(r8) (:)] internal building air temperature (K) - - t_building_max => urbantv_inst%t_building_max , & ! Input: [real(r8) (:)] maximum internal building air temperature (K) - t_building_min => urbanparams_inst%t_building_min , & ! Input: [real(r8) (:)] minimum internal building air temperature (K) - - eflx_building => energyflux_inst%eflx_building_lun , & ! Output: [real(r8) (:)] building heat flux from change in interior building air temperature (W/m**2) - eflx_urban_ac => energyflux_inst%eflx_urban_ac_lun , & ! Output: [real(r8) (:)] urban air conditioning flux (W/m**2) - eflx_urban_heat => energyflux_inst%eflx_urban_heat_lun & ! Output: [real(r8) (:)] urban heating flux (W/m**2) - ) - - ! Get step size - - dtime = get_step_size() - - ! 1. Save t_* at previous time step - ! 2. Set convective heat transfer coefficients (Bueno et al. 2012, GMD). - ! An alternative is Salamanca et al. 2010, TAC, where they are all set to 8 W m-2 K-1. - ! See clm_varcon.F90 - ! 3. Set inner surface emissivities (Bueno et al. 2012, GMD). - ! 4. Set concrete floor properties (Salamanca et al. 2010, TAC). - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (urbpoi(l)) then - t_roof_inner_bef(l) = t_roof_inner(l) - t_sunw_inner_bef(l) = t_sunw_inner(l) - t_shdw_inner_bef(l) = t_shdw_inner(l) - t_floor_bef(l) = t_floor(l) - t_building_bef(l) = t_building(l) - if (t_roof_inner_bef(l) .le. t_building_bef(l)) then - hcv_roofi(l) = hcv_roof_enhanced - else - hcv_roofi(l) = hcv_roof - end if - if (t_floor_bef(l) .ge. t_building_bef(l)) then - hcv_floori(l) = hcv_floor_enhanced - else - hcv_floori(l) = hcv_floor - end if - hcv_sunwi(l) = hcv_sunw - hcv_shdwi(l) = hcv_shdw - em_roofi(l) = em_roof_int - em_sunwi(l) = em_sunw_int - em_shdwi(l) = em_shdw_int - em_floori(l) = em_floor_int - ! Concrete floor thickness (m) - dz_floori(l) = dz_floor - ! Concrete floor volumetric heat capacity (J m-3 K-1) - cp_floori(l) = cp_floor - ! Intermediate calculation for concrete floor (W m-2 K-1) - cv_floori(l) = (dz_floori(l) * cp_floori(l)) / dtime - ! Density of dry air at standard pressure and t_building (kg m-3) - rho_dair(l) = pstd / (rair*t_building_bef(l)) - end if - end do - - ! Get terms from soil temperature equations to compute conduction flux - ! Negative is toward surface - heat added - ! Note that the conduction flux here is in W m-2 wall area but for purposes of solving the set of - ! simultaneous equations this must be converted to W m-2 ground area. This is done below when - ! setting up the equation coefficients. - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = clandunit(c) - if (urbpoi(l)) then - if (ctype(c) == icol_roof) then - zi_roof_innerl(l) = zi(c,nlevurb) - z_roof_innerl(l) = z(c,nlevurb) - t_roof_innerl_bef(l) = tssbef(c,nlevurb) - t_roof_innerl(l) = t_soisno(c,nlevurb) - tk_roof_innerl(l) = tk(c,nlevurb) - else if (ctype(c) == icol_sunwall) then - zi_sunw_innerl(l) = zi(c,nlevurb) - z_sunw_innerl(l) = z(c,nlevurb) - t_sunw_innerl_bef(l) = tssbef(c,nlevurb) - t_sunw_innerl(l) = t_soisno(c,nlevurb) - tk_sunw_innerl(l) = tk(c,nlevurb) - else if (ctype(c) == icol_shadewall) then - zi_shdw_innerl(l) = zi(c,nlevurb) - z_shdw_innerl(l) = z(c,nlevurb) - t_shdw_innerl_bef(l) = tssbef(c,nlevurb) - t_shdw_innerl(l) = t_soisno(c,nlevurb) - tk_shdw_innerl(l) = tk(c,nlevurb) - end if - end if - end do - - ! Calculate view factors - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (urbpoi(l)) then - - vf_rf(l) = sqrt(1._r8 + canyon_hwr(l)**2._r8) - canyon_hwr(l) - vf_fr(l) = vf_rf(l) - - ! This view factor implicitly converts from per unit wall area to per unit floor area - vf_wf(l) = 0.5_r8*(1._r8 - vf_rf(l)) - - ! This view factor implicitly converts from per unit floor area to per unit wall area - vf_fw(l) = vf_wf(l) / canyon_hwr(l) - - ! This view factor implicitly converts from per unit roof area to per unit wall area - vf_rw(l) = vf_fw(l) - - ! This view factor implicitly converts from per unit wall area to per unit roof area - vf_wr(l) = vf_wf(l) - - vf_ww(l) = 1._r8 - vf_rw(l) - vf_fw(l) - - end if - end do - - ! error check -- make sure view factor sums to one for floor, wall, and roof - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (urbpoi(l)) then - - sum = vf_rf(l) + 2._r8*vf_wf(l) - if (abs(sum-1._r8) > 1.e-06_r8 ) then - write (iulog,*) 'urban floor view factor error',sum - write (iulog,*) 'clm model is stopping' - call endrun() - endif - sum = vf_rw(l) + vf_fw(l) + vf_ww(l) - if (abs(sum-1._r8) > 1.e-06_r8 ) then - write (iulog,*) 'urban wall view factor error',sum - write (iulog,*) 'clm model is stopping' - call endrun() - endif - sum = vf_fr(l) + vf_wr(l) + vf_wr(l) - if (abs(sum-1._r8) > 1.e-06_r8 ) then - write (iulog,*) 'urban roof view factor error',sum - write (iulog,*) 'clm model is stopping' - call endrun() - endif - - endif - end do - - n = neq - nrhs = 1 - lda = neq - ldb = neq - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (urbpoi(l)) then - - ! ROOF - a(1,1) = 0.5_r8*hcv_roofi(l) & - + 0.5_r8*tk_roof_innerl(l)/(zi_roof_innerl(l) - z_roof_innerl(l)) & - + 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8 & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(1._r8-em_sunwi(l))*vf_wr(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(1._r8-em_shdwi(l))*vf_wr(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fr(l) - - a(1,2) = - 4._r8*em_roofi(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wr(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_shdwi(l))*vf_wr(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fr(l) - - a(1,3) = - 4._r8*em_roofi(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wr(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_sunwi(l))*vf_wr(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fr(l) - - a(1,4) = - 4._r8*em_roofi(l)*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fr(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_sunwi(l))*vf_wr(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_shdwi(l))*vf_wr(l) - - a(1,5) = - 0.5_r8*hcv_roofi(l) - - result(1) = 0.5_r8*tk_roof_innerl(l)*t_roof_innerl(l)/(zi_roof_innerl(l) - z_roof_innerl(l)) & - - 0.5_r8*tk_roof_innerl(l)*(t_roof_inner_bef(l)-t_roof_innerl_bef(l))/(zi_roof_innerl(l) & - - z_roof_innerl(l)) & - - 3._r8*em_roofi(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wr(l) & - - 3._r8*em_roofi(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wr(l) & - - 3._r8*em_roofi(l)*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fr(l) & - + 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8 & - - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l)*(1._r8-em_sunwi(l))*vf_wr(l) & - - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l)*(1._r8-em_shdwi(l))*vf_wr(l) & - - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fr(l) & - - 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_ww(l)*(1._r8-em_shdwi(l))*vf_wr(l) & - - 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fr(l) & - - 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_ww(l)*(1._r8-em_sunwi(l))*vf_wr(l) & - - 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fr(l) & - - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l)*(1._r8-em_sunwi(l))*vf_wr(l) & - - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l)*(1._r8-em_shdwi(l))*vf_wr(l) & - - 0.5_r8*hcv_roofi(l)*(t_roof_inner_bef(l) - t_building_bef(l)) - - ! SUNWALL - a(2,1) = - 4._r8*em_sunwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(1._r8-em_shdwi(l))*vf_ww(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l) - - a(2,2) = 0.5_r8*hcv_sunwi(l)*canyon_hwr(l) & - + 0.5_r8*tk_sunw_innerl(l)/(zi_sunw_innerl(l) - z_sunw_innerl(l))*canyon_hwr(l) & - + 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8 & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_shdwi(l))*vf_ww(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) - - a(2,3) = - 4._r8*em_sunwi(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_ww(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) - - a(2,4) = - 4._r8*em_sunwi(l)*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_shdwi(l))*vf_ww(l) - a(2,5) = - 0.5_r8*hcv_sunwi(l)*canyon_hwr(l) - - result(2) = 0.5_r8*tk_sunw_innerl(l)*t_sunw_innerl(l)/(zi_sunw_innerl(l) - z_sunw_innerl(l))*canyon_hwr(l) & - - 0.5_r8*tk_sunw_innerl(l)*(t_sunw_inner_bef(l)-t_sunw_innerl_bef(l))/(zi_sunw_innerl(l) & - - z_sunw_innerl(l))*canyon_hwr(l) & - - 3._r8*em_sunwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l) & - - 3._r8*em_sunwi(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_ww(l) & - - 3._r8*em_sunwi(l)*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l) & - + 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8 & - - 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_ww(l)*(1._r8-em_shdwi(l))*vf_ww(l) & - - 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l)*(1._r8-em_shdwi(l))*vf_ww(l) & - - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l)*(1._r8-em_shdwi(l))*vf_ww(l) & - - 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) - - ! SHADEWALL - a(3,1) = - 4._r8*em_shdwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(1._r8-em_sunwi(l))*vf_ww(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l) - - a(3,2) = - 4._r8*em_shdwi(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_ww(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) - - a(3,3) = 0.5_r8*hcv_shdwi(l)*canyon_hwr(l) & - + 0.5_r8*tk_shdw_innerl(l)/(zi_shdw_innerl(l) - z_shdw_innerl(l))*canyon_hwr(l) & - + 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8 & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_sunwi(l))*vf_ww(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) - - a(3,4) = - 4._r8*em_shdwi(l)*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_sunwi(l))*vf_ww(l) - - a(3,5) = - 0.5_r8*hcv_shdwi(l)*canyon_hwr(l) - - result(3) = 0.5_r8*tk_shdw_innerl(l)*t_shdw_innerl(l)/(zi_shdw_innerl(l) - z_shdw_innerl(l))*canyon_hwr(l) & - - 0.5_r8*tk_shdw_innerl(l)*(t_shdw_inner_bef(l)-t_shdw_innerl_bef(l))/(zi_shdw_innerl(l) & - - z_shdw_innerl(l))*canyon_hwr(l) & - - 3._r8*em_shdwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l) & - - 3._r8*em_shdwi(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_ww(l) & - - 3._r8*em_shdwi(l)*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l) & - + 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8 & - - 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_ww(l)*(1._r8-em_sunwi(l))*vf_ww(l) & - - 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l)*(1._r8-em_sunwi(l))*vf_ww(l) & - - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l)*(1._r8-em_sunwi(l))*vf_ww(l) & - - 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) - - ! FLOOR - a(4,1) = - 4._r8*em_floori(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rf(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(1._r8-em_sunwi(l))*vf_wf(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(1._r8-em_shdwi(l))*vf_wf(l) - - a(4,2) = - 4._r8*em_floori(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wf(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_shdwi(l))*vf_wf(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rf(l) - - a(4,3) = - 4._r8*em_floori(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wf(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rf(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_sunwi(l))*vf_wf(l) - - a(4,4) = (cv_floori(l) + 0.5_r8*hcv_floori(l)) & - + 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8 & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rf(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_sunwi(l))*vf_wf(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_shdwi(l))*vf_wf(l) - - a(4,5) = - 0.5_r8*hcv_floori(l) - - result(4) = cv_floori(l)*t_floor_bef(l) & - - 3._r8*em_floori(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rf(l) & - - 3._r8*em_floori(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wf(l) & - - 3._r8*em_floori(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wf(l) & - + 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8 & - - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rf(l) & - - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l)*(1._r8-em_sunwi(l))*vf_wf(l) & - - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l)*(1._r8-em_shdwi(l))*vf_wf(l) & - - 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_ww(l)*(1._r8-em_shdwi(l))*vf_wf(l) & - - 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rf(l) & - - 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rf(l) & - - 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_ww(l)*(1._r8-em_sunwi(l))*vf_wf(l) & - - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l)*(1._r8-em_sunwi(l))*vf_wf(l) & - - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l)*(1._r8-em_shdwi(l))*vf_wf(l) & - - 0.5_r8*hcv_floori(l)*(t_floor_bef(l) - t_building_bef(l)) - - ! Building air temperature - a(5,1) = - 0.5_r8*hcv_roofi(l) - a(5,2) = - 0.5_r8*hcv_sunwi(l)*canyon_hwr(l) - - a(5,3) = - 0.5_r8*hcv_shdwi(l)*canyon_hwr(l) - - a(5,4) = - 0.5_r8*hcv_floori(l) - - a(5,5) = ((ht_roof(l)*rho_dair(l)*cpair)/dtime) + & - ((ht_roof(l)*vent_ach)/3600._r8)*rho_dair(l)*cpair + & - 0.5_r8*hcv_roofi(l) + & - 0.5_r8*hcv_sunwi(l)*canyon_hwr(l) + & - 0.5_r8*hcv_shdwi(l)*canyon_hwr(l) + & - 0.5_r8*hcv_floori(l) - - result(5) = (ht_roof(l)*rho_dair(l)*cpair/dtime)*t_building_bef(l) & - + ((ht_roof(l)*vent_ach)/3600._r8)*rho_dair(l)*cpair*taf(l) & - + 0.5_r8*hcv_roofi(l)*(t_roof_inner_bef(l) - t_building_bef(l)) & - + 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) & - + 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) & - + 0.5_r8*hcv_floori(l)*(t_floor_bef(l) - t_building_bef(l)) - - ! Solve equations - call dgesv(n, nrhs, a, lda, ipiv, result, ldb, info) - - ! If dgesv fails, abort - if (info /= 0) then - write(iulog,*)'fl: ',fl - write(iulog,*)'l: ',l - write(iulog,*)'dgesv info: ',info - write (iulog,*) 'dgesv error' - write (iulog,*) 'clm model is stopping' - call endrun() - end if - ! Assign new temperatures - t_roof_inner(l) = result(1) - t_sunw_inner(l) = result(2) - t_shdw_inner(l) = result(3) - t_floor(l) = result(4) - t_building(l) = result(5) - end if - end do - - ! Energy balance checks - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (urbpoi(l)) then - qrd_roof(l) = - em_roofi(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wr(l) & - - 4._r8*em_roofi(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wr(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - em_roofi(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wr(l) & - - 4._r8*em_roofi(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wr(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - em_roofi(l)*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fr(l) & - - 4._r8*em_roofi(l)*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fr(l)*(t_floor(l) - t_floor_bef(l)) & - - (em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8)*vf_rw(l)*(1._r8-em_sunwi(l))*vf_wr(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(1._r8-em_sunwi(l))*vf_wr(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - (em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8)*vf_rw(l)*(1._r8-em_shdwi(l))*vf_wr(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(1._r8-em_shdwi(l))*vf_wr(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - (em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8)*vf_rf(l)*(1._r8-em_floori(l))*vf_fr(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fr(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - (em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8)*vf_ww(l)*(1._r8-em_shdwi(l))*vf_wr(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_shdwi(l))*vf_wr(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - (em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8)*vf_wf(l)*(1._r8-em_floori(l))*vf_fr(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fr(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - (em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8)*vf_ww(l)*(1._r8-em_sunwi(l))*vf_wr(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_sunwi(l))*vf_wr(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8)*vf_wf(l)*(1._r8-em_floori(l))*vf_fr(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fr(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_floori(l)*sb*t_floor_bef(l)**4._r8)*vf_fw(l)*(1._r8-em_sunwi(l))*vf_wr(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_sunwi(l))*vf_wr(l)*(t_floor(l) & - - t_floor_bef(l)) & - - (em_floori(l)*sb*t_floor_bef(l)**4._r8)*vf_fw(l)*(1._r8-em_shdwi(l))*vf_wr(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_shdwi(l))*vf_wr(l)*(t_floor(l) & - - t_floor_bef(l)) & - + em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8 & - + 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*(t_roof_inner(l) - t_roof_inner_bef(l)) - - qrd_sunw(l) = - em_sunwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l) & - - 4._r8*em_sunwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - em_sunwi(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_ww(l) & - - 4._r8*em_sunwi(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_ww(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - em_sunwi(l)*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l) & - - 4._r8*em_sunwi(l)*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(t_floor(l) - t_floor_bef(l)) & - - (em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8)*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3.*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - (em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8)*vf_ww(l)*(1._r8-em_shdwi(l))*vf_ww(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3.*vf_ww(l)*(1._r8-em_shdwi(l))*vf_ww(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - (em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8)*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3.*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - (em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8)*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3.*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8)*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3.*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8)*vf_rw(l)*(1._r8-em_shdwi(l))*vf_ww(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3.*vf_rw(l)*(1._r8-em_shdwi(l))*vf_ww(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - (em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8)*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3.*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - (em_floori(l)*sb*t_floor_bef(l)**4._r8)*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3.*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l)*(t_floor(l) & - - t_floor_bef(l)) & - - (em_floori(l)*sb*t_floor_bef(l)**4._r8)*vf_fw(l)*(1._r8-em_shdwi(l))*vf_ww(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3.*vf_fw(l)*(1._r8-em_shdwi(l))*vf_ww(l)*(t_floor(l) & - - t_floor_bef(l)) & - + em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8 & - + 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*(t_sunw_inner(l) - t_sunw_inner_bef(l)) - - qrd_shdw(l) = - em_shdwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l) & - - 4._r8*em_shdwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - em_shdwi(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_ww(l) & - - 4._r8*em_shdwi(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_ww(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - em_shdwi(l)*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l) & - - 4._r8*em_shdwi(l)*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(t_floor(l) - t_floor_bef(l)) & - - (em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8)*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3.*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8)*vf_ww(l)*(1._r8-em_sunwi(l))*vf_ww(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3.*vf_ww(l)*(1._r8-em_sunwi(l))*vf_ww(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8)*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3.*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8)*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3.*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - (em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8)*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3.*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - (em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8)*vf_rw(l)*(1._r8-em_sunwi(l))*vf_ww(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3.*vf_rw(l)*(1._r8-em_sunwi(l))*vf_ww(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - (em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8)*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3.*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - (em_floori(l)*sb*t_floor_bef(l)**4._r8)*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3.*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l)*(t_floor(l) & - - t_floor_bef(l)) & - - (em_floori(l)*sb*t_floor_bef(l)**4._r8)*vf_fw(l)*(1._r8-em_sunwi(l))*vf_ww(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3.*vf_fw(l)*(1._r8-em_sunwi(l))*vf_ww(l)*(t_floor(l) & - - t_floor_bef(l)) & - + em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8 & - + 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*(t_shdw_inner(l) - t_shdw_inner_bef(l)) - - qrd_floor(l) = - em_floori(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rf(l) & - - 4._r8*em_floori(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rf(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - em_floori(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wf(l) & - - 4._r8*em_floori(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wf(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - em_floori(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wf(l) & - - 4._r8*em_floori(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wf(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_floori(l)*sb*t_floor_bef(l)**4._r8)*vf_fr(l)*(1._r8-em_roofi(l))*vf_rf(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3.*vf_fr(l)*(1._r8-em_roofi(l))*vf_rf(l)*(t_floor(l) & - - t_floor_bef(l)) & - - (em_floori(l)*sb*t_floor_bef(l)**4._r8)*vf_fw(l)*(1._r8-em_sunwi(l))*vf_wf(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3.*vf_fw(l)*(1._r8-em_sunwi(l))*vf_wf(l)*(t_floor(l) & - - t_floor_bef(l)) & - - (em_floori(l)*sb*t_floor_bef(l)**4._r8)*vf_fw(l)*(1._r8-em_shdwi(l))*vf_wf(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3.*vf_fw(l)*(1._r8-em_shdwi(l))*vf_wf(l)*(t_floor(l) & - - t_floor_bef(l)) & - - (em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8)*vf_ww(l)*(1._r8-em_shdwi(l))*vf_wf(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3.*vf_ww(l)*(1._r8-em_shdwi(l))*vf_wf(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - (em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8)*vf_wr(l)*(1._r8-em_roofi(l))*vf_rf(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3.*vf_wr(l)*(1._r8-em_roofi(l))*vf_rf(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - (em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8)*vf_wr(l)*(1._r8-em_roofi(l))*vf_rf(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3.*vf_wr(l)*(1._r8-em_roofi(l))*vf_rf(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8)*vf_ww(l)*(1._r8-em_sunwi(l))*vf_wf(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3.*vf_ww(l)*(1._r8-em_sunwi(l))*vf_wf(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8)*vf_rw(l)*(1._r8-em_sunwi(l))*vf_wf(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3.*vf_rw(l)*(1._r8-em_sunwi(l))*vf_wf(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - (em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8)*vf_rw(l)*(1._r8-em_shdwi(l))*vf_wf(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3.*vf_rw(l)*(1._r8-em_shdwi(l))*vf_wf(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - + em_floori(l)*sb*t_floor_bef(l)**4._r8 & - + 4._r8*em_floori(l)*sb*t_floor_bef(l)**3.*(t_floor(l) - t_floor_bef(l)) - - qrd_building(l) = qrd_roof(l) + canyon_hwr(l)*(qrd_sunw(l) + qrd_shdw(l)) + qrd_floor(l) - - if (abs(qrd_building(l)) > .10_r8 ) then - write (iulog,*) 'urban inside building net longwave radiation balance error ',qrd_building(l) - write (iulog,*) 'clm model is stopping' - call endrun() - end if - - qcv_roof(l) = 0.5_r8*hcv_roofi(l)*(t_roof_inner(l) - t_building(l)) + 0.5_r8*hcv_roofi(l)*(t_roof_inner_bef(l) & - - t_building_bef(l)) - qcd_roof(l) = 0.5_r8*tk_roof_innerl(l)*(t_roof_inner(l) - t_roof_innerl(l))/(zi_roof_innerl(l) - z_roof_innerl(l)) & - + 0.5_r8*tk_roof_innerl(l)*(t_roof_inner_bef(l) - t_roof_innerl_bef(l))/(zi_roof_innerl(l) & - - z_roof_innerl(l)) - enrgy_bal_roof(l) = qrd_roof(l) + qcv_roof(l) + qcd_roof(l) - if (abs(enrgy_bal_roof(l)) > .10_r8 ) then - write (iulog,*) 'urban inside roof energy balance error ',enrgy_bal_roof(l) - write (iulog,*) 'clm model is stopping' - call endrun() - end if - - qcv_sunw(l) = 0.5_r8*hcv_sunwi(l)*(t_sunw_inner(l) - t_building(l)) + 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) & - - t_building_bef(l)) - qcd_sunw(l) = 0.5_r8*tk_sunw_innerl(l)*(t_sunw_inner(l) - t_sunw_innerl(l))/(zi_sunw_innerl(l) - z_sunw_innerl(l)) & - + 0.5_r8*tk_sunw_innerl(l)*(t_sunw_inner_bef(l) - t_sunw_innerl_bef(l))/(zi_sunw_innerl(l) & - - z_sunw_innerl(l)) - enrgy_bal_sunw(l) = qrd_sunw(l) + qcv_sunw(l)*canyon_hwr(l) + qcd_sunw(l)*canyon_hwr(l) - if (abs(enrgy_bal_sunw(l)) > .10_r8 ) then - write (iulog,*) 'urban inside sunwall energy balance error ',enrgy_bal_sunw(l) - write (iulog,*) 'clm model is stopping' - call endrun() - end if - - qcv_shdw(l) = 0.5_r8*hcv_shdwi(l)*(t_shdw_inner(l) - t_building(l)) + 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) & - - t_building_bef(l)) - qcd_shdw(l) = 0.5_r8*tk_shdw_innerl(l)*(t_shdw_inner(l) - t_shdw_innerl(l))/(zi_shdw_innerl(l) - z_shdw_innerl(l)) & - + 0.5_r8*tk_shdw_innerl(l)*(t_shdw_inner_bef(l) - t_shdw_innerl_bef(l))/(zi_shdw_innerl(l) & - - z_shdw_innerl(l)) - enrgy_bal_shdw(l) = qrd_shdw(l) + qcv_shdw(l)*canyon_hwr(l) + qcd_shdw(l)*canyon_hwr(l) - if (abs(enrgy_bal_shdw(l)) > .10_r8 ) then - write (iulog,*) 'urban inside shadewall energy balance error ',enrgy_bal_shdw(l) - write (iulog,*) 'clm model is stopping' - call endrun() - end if - - qcv_floor(l) = 0.5_r8*hcv_floori(l)*(t_floor(l) - t_building(l)) + 0.5_r8*hcv_floori(l)*(t_floor_bef(l) & - - t_building_bef(l)) - qcd_floor(l) = cv_floori(l)*(t_floor(l) - t_floor_bef(l)) - enrgy_bal_floor(l) = qrd_floor(l) + qcv_floor(l) + qcd_floor(l) - if (abs(enrgy_bal_floor(l)) > .10_r8 ) then - write (iulog,*) 'urban inside floor energy balance error ',enrgy_bal_floor(l) - write (iulog,*) 'clm model is stopping' - call endrun() - end if - - enrgy_bal_buildair(l) = (ht_roof(l)*rho_dair(l)*cpair/dtime)*(t_building(l) - t_building_bef(l)) & - - ht_roof(l)*(vent_ach/3600._r8)*rho_dair(l)*cpair*(taf(l) - t_building(l)) & - - 0.5_r8*hcv_roofi(l)*(t_roof_inner(l) - t_building(l)) & - - 0.5_r8*hcv_roofi(l)*(t_roof_inner_bef(l) - t_building_bef(l)) & - - 0.5_r8*hcv_sunwi(l)*(t_sunw_inner(l) - t_building(l))*canyon_hwr(l) & - - 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) & - - 0.5_r8*hcv_shdwi(l)*(t_shdw_inner(l) - t_building(l))*canyon_hwr(l) & - - 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) & - - 0.5_r8*hcv_floori(l)*(t_floor(l) - t_building(l)) & - - 0.5_r8*hcv_floori(l)*(t_floor_bef(l) - t_building_bef(l)) - if (abs(enrgy_bal_buildair(l)) > .10_r8 ) then - write (iulog,*) 'urban building air energy balance error ',enrgy_bal_buildair(l) - write (iulog,*) 'clm model is stopping' - call endrun() - end if - end if - end do - - ! Restrict internal building air temperature to between min and max - ! Calculate heating or air conditioning flux from energy required to change - ! internal building air temperature to t_building_min or t_building_max. - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (urbpoi(l)) then - if (trim(urban_hac) == urban_hac_on .or. trim(urban_hac) == urban_wasteheat_on) then - t_building_bef_hac(l) = t_building(l) -! rho_dair(l) = pstd / (rair*t_building(l)) - - if (t_building_bef_hac(l) > t_building_max(l)) then - t_building(l) = t_building_max(l) - eflx_urban_ac(l) = wtlunit_roof(l) * abs( (ht_roof(l) * rho_dair(l) * cpair / dtime) * t_building(l) & - - (ht_roof(l) * rho_dair(l) * cpair / dtime) * t_building_bef_hac(l) ) - else if (t_building_bef_hac(l) < t_building_min(l)) then - t_building(l) = t_building_min(l) - eflx_urban_heat(l) = wtlunit_roof(l) * abs( (ht_roof(l) * rho_dair(l) * cpair / dtime) * t_building(l) & - - (ht_roof(l) * rho_dair(l) * cpair / dtime) * t_building_bef_hac(l) ) - else - eflx_urban_ac(l) = 0._r8 - eflx_urban_heat(l) = 0._r8 - end if - else - eflx_urban_ac(l) = 0._r8 - eflx_urban_heat(l) = 0._r8 - end if - eflx_building(l) = wtlunit_roof(l) * (ht_roof(l) * rho_dair(l)*cpair/dtime) * (t_building(l) - t_building_bef(l)) - end if - end do - - end associate - end subroutine BuildingTemperature - - !----------------------------------------------------------------------- - -end module UrbBuildTempOleson2015Mod diff --git a/src/biogeophys/UrbanParamsType.F90 b/src/biogeophys/UrbanParamsType.F90 index 4b4187c3af..858becc368 100644 --- a/src/biogeophys/UrbanParamsType.F90 +++ b/src/biogeophys/UrbanParamsType.F90 @@ -10,7 +10,7 @@ module UrbanParamsType use abortutils , only : endrun use decompMod , only : bounds_type use clm_varctl , only : iulog, fsurdat - use clm_varcon , only : namel, grlnd, spval + use clm_varcon , only : grlnd use LandunitType , only : lun ! implicit none @@ -18,78 +18,24 @@ module UrbanParamsType private ! ! !PUBLIC MEMBER FUNCTIONS: - public :: UrbanReadNML ! Read in the urban namelist items public :: UrbanInput ! Read in urban input data - public :: CheckUrban ! Check validity of urban points - public :: IsSimpleBuildTemp ! If using the simple building temperature method - public :: IsProgBuildTemp ! If using the prognostic building temperature method ! ! !PRIVATE TYPE type urbinp_type real(r8), pointer :: canyon_hwr (:,:) real(r8), pointer :: wtlunit_roof (:,:) real(r8), pointer :: wtroad_perv (:,:) - real(r8), pointer :: em_roof (:,:) - real(r8), pointer :: em_improad (:,:) - real(r8), pointer :: em_perroad (:,:) - real(r8), pointer :: em_wall (:,:) - real(r8), pointer :: alb_roof_dir (:,:,:) - real(r8), pointer :: alb_roof_dif (:,:,:) - real(r8), pointer :: alb_improad_dir (:,:,:) - real(r8), pointer :: alb_improad_dif (:,:,:) - real(r8), pointer :: alb_perroad_dir (:,:,:) - real(r8), pointer :: alb_perroad_dif (:,:,:) - real(r8), pointer :: alb_wall_dir (:,:,:) - real(r8), pointer :: alb_wall_dif (:,:,:) - real(r8), pointer :: ht_roof (:,:) - real(r8), pointer :: wind_hgt_canyon (:,:) - real(r8), pointer :: tk_wall (:,:,:) - real(r8), pointer :: tk_roof (:,:,:) - real(r8), pointer :: tk_improad (:,:,:) - real(r8), pointer :: cv_wall (:,:,:) - real(r8), pointer :: cv_roof (:,:,:) - real(r8), pointer :: cv_improad (:,:,:) real(r8), pointer :: thick_wall (:,:) real(r8), pointer :: thick_roof (:,:) - integer, pointer :: nlev_improad (:,:) - real(r8), pointer :: t_building_min (:,:) end type urbinp_type type (urbinp_type), public :: urbinp ! urban input derived type ! !PUBLIC TYPE type, public :: urbanparams_type - real(r8), allocatable :: wind_hgt_canyon (:) ! lun height above road at which wind in canyon is to be computed (m) - real(r8), allocatable :: em_roof (:) ! lun roof emissivity - real(r8), allocatable :: em_improad (:) ! lun impervious road emissivity - real(r8), allocatable :: em_perroad (:) ! lun pervious road emissivity - real(r8), allocatable :: em_wall (:) ! lun wall emissivity - real(r8), allocatable :: alb_roof_dir (:,:) ! lun direct roof albedo - real(r8), allocatable :: alb_roof_dif (:,:) ! lun diffuse roof albedo - real(r8), allocatable :: alb_improad_dir (:,:) ! lun direct impervious road albedo - real(r8), allocatable :: alb_improad_dif (:,:) ! lun diffuse impervious road albedo - real(r8), allocatable :: alb_perroad_dir (:,:) ! lun direct pervious road albedo - real(r8), allocatable :: alb_perroad_dif (:,:) ! lun diffuse pervious road albedo - real(r8), allocatable :: alb_wall_dir (:,:) ! lun direct wall albedo - real(r8), allocatable :: alb_wall_dif (:,:) ! lun diffuse wall albedo - - integer , pointer :: nlev_improad (:) ! lun number of impervious road layers (-) - real(r8), pointer :: tk_wall (:,:) ! lun thermal conductivity of urban wall (W/m/K) - real(r8), pointer :: tk_roof (:,:) ! lun thermal conductivity of urban roof (W/m/K) - real(r8), pointer :: tk_improad (:,:) ! lun thermal conductivity of urban impervious road (W/m/K) - real(r8), pointer :: cv_wall (:,:) ! lun heat capacity of urban wall (J/m^3/K) - real(r8), pointer :: cv_roof (:,:) ! lun heat capacity of urban roof (J/m^3/K) - real(r8), pointer :: cv_improad (:,:) ! lun heat capacity of urban impervious road (J/m^3/K) + real(r8), pointer :: thick_wall (:) ! lun total thickness of urban wall (m) real(r8), pointer :: thick_roof (:) ! lun total thickness of urban roof (m) - real(r8), pointer :: vf_sr (:) ! lun view factor of sky for road - real(r8), pointer :: vf_wr (:) ! lun view factor of one wall for road - real(r8), pointer :: vf_sw (:) ! lun view factor of sky for one wall - real(r8), pointer :: vf_rw (:) ! lun view factor of road for one wall - real(r8), pointer :: vf_ww (:) ! lun view factor of opposing wall for one wall - - real(r8), pointer :: t_building_min (:) ! lun minimum internal building air temperature (K) - real(r8), pointer :: eflx_traffic_factor (:) ! lun multiplicative traffic factor for sensible heat flux from urban traffic (-) contains procedure, public :: Init @@ -97,17 +43,9 @@ module UrbanParamsType end type urbanparams_type ! ! !Urban control variables - character(len= *), parameter, public :: urban_hac_off = 'OFF' - character(len= *), parameter, public :: urban_hac_on = 'ON' character(len= *), parameter, public :: urban_wasteheat_on = 'ON_WASTEHEAT' - character(len= 16), public :: urban_hac = urban_hac_off - logical, public :: urban_traffic = .false. ! urban traffic fluxes ! !PRIVATE MEMBER DATA: - logical, private :: ReadNamelist = .false. ! If namelist was read yet or not - integer, parameter, private :: BUILDING_TEMP_METHOD_SIMPLE = 0 ! Simple method introduced in CLM4.5 - integer, parameter, private :: BUILDING_TEMP_METHOD_PROG = 1 ! Prognostic method introduced in CLM5.0 - integer, private :: building_temp_method = BUILDING_TEMP_METHOD_PROG ! Method to calculate the building temperature character(len=*), parameter, private :: sourcefile = & __FILE__ @@ -122,12 +60,6 @@ subroutine Init(this, bounds) ! ! !USES: use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : nlevcan, nlevcan, numrad, nlevgrnd, nlevurb - use clm_varpar , only : nlevsoi, nlevgrnd - use clm_varctl , only : use_vancouver, use_mexicocity - use clm_varcon , only : vkc - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use column_varcon , only : icol_road_perv, icol_road_imperv, icol_road_perv use landunit_varcon , only : isturb_MIN ! ! !ARGUMENTS: @@ -135,65 +67,22 @@ subroutine Init(this, bounds) type(bounds_type) , intent(in) :: bounds ! ! !LOCAL VARIABLES: - integer :: j,l,c,p,g ! indices - integer :: nc,fl,ib ! indices - integer :: dindx ! urban density type index - integer :: ier ! error status - real(r8) :: sumvf ! sum of view factors for wall or road - real(r8), parameter :: alpha = 4.43_r8 ! coefficient used to calculate z_d_town - real(r8), parameter :: beta = 1.0_r8 ! coefficient used to calculate z_d_town - real(r8), parameter :: C_d = 1.2_r8 ! drag coefficient as used in Grimmond and Oke (1999) - real(r8) :: plan_ai ! plan area index - ratio building area to plan area (-) - real(r8) :: frontal_ai ! frontal area index of buildings (-) - real(r8) :: build_lw_ratio ! building short/long side ratio (-) - integer :: begl, endl - integer :: begc, endc - integer :: begp, endp - integer :: begg, endg + integer :: l,c,g ! indices + integer :: dindx ! urban density type index + integer :: begl, endl + integer :: begg, endg !--------------------------------------------------------------------- - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc begl = bounds%begl; endl = bounds%endl begg = bounds%begg; endg = bounds%endg ! Allocate urbanparams data structure - - if ( nlevurb > 0 )then - allocate(this%tk_wall (begl:endl,nlevurb)) ; this%tk_wall (:,:) = nan - allocate(this%tk_roof (begl:endl,nlevurb)) ; this%tk_roof (:,:) = nan - allocate(this%cv_wall (begl:endl,nlevurb)) ; this%cv_wall (:,:) = nan - allocate(this%cv_roof (begl:endl,nlevurb)) ; this%cv_roof (:,:) = nan - end if - allocate(this%t_building_min (begl:endl)) ; this%t_building_min (:) = nan - allocate(this%tk_improad (begl:endl,nlevurb)) ; this%tk_improad (:,:) = nan - allocate(this%cv_improad (begl:endl,nlevurb)) ; this%cv_improad (:,:) = nan allocate(this%thick_wall (begl:endl)) ; this%thick_wall (:) = nan allocate(this%thick_roof (begl:endl)) ; this%thick_roof (:) = nan - allocate(this%nlev_improad (begl:endl)) ; this%nlev_improad (:) = huge(1) - allocate(this%vf_sr (begl:endl)) ; this%vf_sr (:) = nan - allocate(this%vf_wr (begl:endl)) ; this%vf_wr (:) = nan - allocate(this%vf_sw (begl:endl)) ; this%vf_sw (:) = nan - allocate(this%vf_rw (begl:endl)) ; this%vf_rw (:) = nan - allocate(this%vf_ww (begl:endl)) ; this%vf_ww (:) = nan - allocate(this%wind_hgt_canyon (begl:endl)) ; this%wind_hgt_canyon (:) = nan - allocate(this%em_roof (begl:endl)) ; this%em_roof (:) = nan - allocate(this%em_improad (begl:endl)) ; this%em_improad (:) = nan - allocate(this%em_perroad (begl:endl)) ; this%em_perroad (:) = nan - allocate(this%em_wall (begl:endl)) ; this%em_wall (:) = nan - allocate(this%alb_roof_dir (begl:endl,numrad)) ; this%alb_roof_dir (:,:) = nan - allocate(this%alb_roof_dif (begl:endl,numrad)) ; this%alb_roof_dif (:,:) = nan - allocate(this%alb_improad_dir (begl:endl,numrad)) ; this%alb_improad_dir (:,:) = nan - allocate(this%alb_perroad_dir (begl:endl,numrad)) ; this%alb_perroad_dir (:,:) = nan - allocate(this%alb_improad_dif (begl:endl,numrad)) ; this%alb_improad_dif (:,:) = nan - allocate(this%alb_perroad_dif (begl:endl,numrad)) ; this%alb_perroad_dif (:,:) = nan - allocate(this%alb_wall_dir (begl:endl,numrad)) ; this%alb_wall_dir (:,:) = nan - allocate(this%alb_wall_dif (begl:endl,numrad)) ; this%alb_wall_dif (:,:) = nan - allocate(this%eflx_traffic_factor (begl:endl)) ; this%eflx_traffic_factor (:) = nan ! Initialize time constant urban variables - do l = bounds%begl,bounds%endl + do l = begl,endl ! "0" refers to urban wall/roof surface and "nlevsoi" refers to urban wall/roof bottom if (lun%urbpoi(l)) then @@ -201,166 +90,18 @@ subroutine Init(this, bounds) g = lun%gridcell(l) dindx = lun%itype(l) - isturb_MIN + 1 - this%wind_hgt_canyon(l) = urbinp%wind_hgt_canyon(g,dindx) - do ib = 1,numrad - this%alb_roof_dir (l,ib) = urbinp%alb_roof_dir (g,dindx,ib) - this%alb_roof_dif (l,ib) = urbinp%alb_roof_dif (g,dindx,ib) - this%alb_improad_dir(l,ib) = urbinp%alb_improad_dir(g,dindx,ib) - this%alb_perroad_dir(l,ib) = urbinp%alb_perroad_dir(g,dindx,ib) - this%alb_improad_dif(l,ib) = urbinp%alb_improad_dif(g,dindx,ib) - this%alb_perroad_dif(l,ib) = urbinp%alb_perroad_dif(g,dindx,ib) - this%alb_wall_dir (l,ib) = urbinp%alb_wall_dir (g,dindx,ib) - this%alb_wall_dif (l,ib) = urbinp%alb_wall_dif (g,dindx,ib) - end do - this%em_roof (l) = urbinp%em_roof (g,dindx) - this%em_improad(l) = urbinp%em_improad(g,dindx) - this%em_perroad(l) = urbinp%em_perroad(g,dindx) - this%em_wall (l) = urbinp%em_wall (g,dindx) - ! Landunit level initialization for urban wall and roof layers and interfaces lun%canyon_hwr(l) = urbinp%canyon_hwr(g,dindx) lun%wtroad_perv(l) = urbinp%wtroad_perv(g,dindx) - lun%ht_roof(l) = urbinp%ht_roof(g,dindx) lun%wtlunit_roof(l) = urbinp%wtlunit_roof(g,dindx) - this%tk_wall(l,:) = urbinp%tk_wall(g,dindx,:) - this%tk_roof(l,:) = urbinp%tk_roof(g,dindx,:) - this%tk_improad(l,:) = urbinp%tk_improad(g,dindx,:) - this%cv_wall(l,:) = urbinp%cv_wall(g,dindx,:) - this%cv_roof(l,:) = urbinp%cv_roof(g,dindx,:) - this%cv_improad(l,:) = urbinp%cv_improad(g,dindx,:) this%thick_wall(l) = urbinp%thick_wall(g,dindx) this%thick_roof(l) = urbinp%thick_roof(g,dindx) - this%nlev_improad(l) = urbinp%nlev_improad(g,dindx) - this%t_building_min(l) = urbinp%t_building_min(g,dindx) - - ! Inferred from Sailor and Lu 2004 - if (urban_traffic) then - this%eflx_traffic_factor(l) = 3.6_r8 * (lun%canyon_hwr(l)-0.5_r8) + 1.0_r8 - else - this%eflx_traffic_factor(l) = 0.0_r8 - end if - - if (use_vancouver .or. use_mexicocity) then - ! Freely evolving - this%t_building_min(l) = 200.00_r8 - else - if (urban_hac == urban_hac_off) then - ! Overwrite values read in from urbinp by freely evolving values - this%t_building_min(l) = 200.00_r8 - end if - end if - - !---------------------------------------------------------------------------------- - ! View factors for road and one wall in urban canyon (depends only on canyon_hwr) - ! --------------------------------------------------------------------------------------- - ! WALL | - ! ROAD | - ! wall | - ! -----\ /----- - - |\----------/ - ! | \ vsr / | | r | | \ vww / s - ! | \ / | h o w | \ / k - ! wall | \ / | wall | a | | \ / y - ! |vwr \ / vwr| | d | |vrw \ / vsw - ! ------\/------ - - |-----\/----- - ! road wall | - ! <----- w ----> | - ! <---- h --->| - ! - ! vsr = view factor of sky for road vrw = view factor of road for wall - ! vwr = view factor of one wall for road vww = view factor of opposing wall for wall - ! vsw = view factor of sky for wall - ! vsr + vwr + vwr = 1 vrw + vww + vsw = 1 - ! - ! Source: Masson, V. (2000) A physically-based scheme for the urban energy budget in - ! atmospheric models. Boundary-Layer Meteorology 94:357-397 - ! - ! - Calculate urban land unit aerodynamic constants using Macdonald (1998) as used in - ! Grimmond and Oke (1999) - ! --------------------------------------------------------------------------------------- - - ! road -- sky view factor -> 1 as building height -> 0 - ! and -> 0 as building height -> infinity - - this%vf_sr(l) = sqrt(lun%canyon_hwr(l)**2 + 1._r8) - lun%canyon_hwr(l) - this%vf_wr(l) = 0.5_r8 * (1._r8 - this%vf_sr(l)) - - ! one wall -- sky view factor -> 0.5 as building height -> 0 - ! and -> 0 as building height -> infinity - - this%vf_sw(l) = 0.5_r8 * (lun%canyon_hwr(l) + 1._r8 - sqrt(lun%canyon_hwr(l)**2+1._r8)) / lun%canyon_hwr(l) - this%vf_rw(l) = this%vf_sw(l) - this%vf_ww(l) = 1._r8 - this%vf_sw(l) - this%vf_rw(l) - - ! error check -- make sure view factor sums to one for road and wall - sumvf = this%vf_sr(l) + 2._r8*this%vf_wr(l) - if (abs(sumvf-1._r8) > 1.e-06_r8 ) then - write (iulog,*) 'urban road view factor error',sumvf - write (iulog,*) 'clm model is stopping' - call endrun(decomp_index=l, clmlevel=namel, msg=errmsg(sourcefile, __LINE__)) - endif - sumvf = this%vf_sw(l) + this%vf_rw(l) + this%vf_ww(l) - if (abs(sumvf-1._r8) > 1.e-06_r8 ) then - write (iulog,*) 'urban wall view factor error',sumvf - write (iulog,*) 'clm model is stopping' - call endrun(decomp_index=l, clmlevel=namel, msg=errmsg(sourcefile, __LINE__)) - endif - - !---------------------------------------------------------------------------------- - ! Calculate urban land unit aerodynamic constants using Macdonald (1998) as used in - ! Grimmond and Oke (1999) - !---------------------------------------------------------------------------------- - - ! Calculate plan area index - plan_ai = lun%canyon_hwr(l)/(lun%canyon_hwr(l) + 1._r8) - - ! Building shape shortside/longside ratio (e.g. 1 = square ) - ! This assumes the building occupies the entire canyon length - build_lw_ratio = plan_ai - - ! Calculate frontal area index - frontal_ai = (1._r8 - plan_ai) * lun%canyon_hwr(l) - - ! Adjust frontal area index for different building configuration - frontal_ai = frontal_ai * sqrt(1/build_lw_ratio) * sqrt(plan_ai) - - ! Calculate displacement height - if (use_vancouver) then - lun%z_d_town(l) = 3.5_r8 - else if (use_mexicocity) then - lun%z_d_town(l) = 10.9_r8 - else - lun%z_d_town(l) = (1._r8 + alpha**(-plan_ai) * (plan_ai - 1._r8)) * lun%ht_roof(l) - end if - - ! Calculate the roughness length - if (use_vancouver) then - lun%z_0_town(l) = 0.35_r8 - else if (use_mexicocity) then - lun%z_0_town(l) = 2.2_r8 - else - lun%z_0_town(l) = lun%ht_roof(l) * (1._r8 - lun%z_d_town(l) / lun%ht_roof(l)) * & - exp(-1.0_r8 * (0.5_r8 * beta * C_d / vkc**2 * & - (1 - lun%z_d_town(l) / lun%ht_roof(l)) * frontal_ai)**(-0.5_r8)) - end if - - else ! Not urban point - - this%eflx_traffic_factor(l) = spval - this%t_building_min(l) = spval - - this%vf_sr(l) = spval - this%vf_wr(l) = spval - this%vf_sw(l) = spval - this%vf_rw(l) = spval - this%vf_ww(l) = spval end if end do - ! Deallocate memory for urbinp datatype - call UrbanInput(bounds%begg, bounds%endg, mode='finalize') end subroutine Init @@ -433,30 +174,8 @@ subroutine UrbanInput(begg, endg, mode) allocate(urbinp%canyon_hwr(begg:endg, numurbl), & urbinp%wtlunit_roof(begg:endg, numurbl), & urbinp%wtroad_perv(begg:endg, numurbl), & - urbinp%em_roof(begg:endg, numurbl), & - urbinp%em_improad(begg:endg, numurbl), & - urbinp%em_perroad(begg:endg, numurbl), & - urbinp%em_wall(begg:endg, numurbl), & - urbinp%alb_roof_dir(begg:endg, numurbl, numrad), & - urbinp%alb_roof_dif(begg:endg, numurbl, numrad), & - urbinp%alb_improad_dir(begg:endg, numurbl, numrad), & - urbinp%alb_perroad_dir(begg:endg, numurbl, numrad), & - urbinp%alb_improad_dif(begg:endg, numurbl, numrad), & - urbinp%alb_perroad_dif(begg:endg, numurbl, numrad), & - urbinp%alb_wall_dir(begg:endg, numurbl, numrad), & - urbinp%alb_wall_dif(begg:endg, numurbl, numrad), & - urbinp%ht_roof(begg:endg, numurbl), & - urbinp%wind_hgt_canyon(begg:endg, numurbl), & - urbinp%tk_wall(begg:endg, numurbl,nlevurb), & - urbinp%tk_roof(begg:endg, numurbl,nlevurb), & - urbinp%tk_improad(begg:endg, numurbl,nlevurb), & - urbinp%cv_wall(begg:endg, numurbl,nlevurb), & - urbinp%cv_roof(begg:endg, numurbl,nlevurb), & - urbinp%cv_improad(begg:endg, numurbl,nlevurb), & urbinp%thick_wall(begg:endg, numurbl), & urbinp%thick_roof(begg:endg, numurbl), & - urbinp%nlev_improad(begg:endg, numurbl), & - urbinp%t_building_min(begg:endg, numurbl), & stat=ier) if (ier /= 0) then call endrun(msg="Allocation error "//errmsg(sourcefile, __LINE__)) @@ -511,42 +230,6 @@ subroutine UrbanInput(begg, endg, mode) call endrun( msg=' ERROR: WTROAD_PERV NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) end if - call ncd_io(ncid=ncid, varname='EM_ROOF', flag='read', data=urbinp%em_roof, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: EM_ROOF NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='EM_IMPROAD', flag='read', data=urbinp%em_improad, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: EM_IMPROAD NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='EM_PERROAD', flag='read', data=urbinp%em_perroad, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: EM_PERROAD NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='EM_WALL', flag='read', data=urbinp%em_wall, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: EM_WALL NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='HT_ROOF', flag='read', data=urbinp%ht_roof, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: HT_ROOF NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='WIND_HGT_CANYON', flag='read', data=urbinp%wind_hgt_canyon, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: WIND_HGT_CANYON NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - call ncd_io(ncid=ncid, varname='THICK_WALL', flag='read', data=urbinp%thick_wall, & dim1name=grlnd, readvar=readvar) if (.not. readvar) then @@ -559,102 +242,6 @@ subroutine UrbanInput(begg, endg, mode) call endrun( msg=' ERROR: THICK_ROOF NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) end if - call ncd_io(ncid=ncid, varname='NLEV_IMPROAD', flag='read', data=urbinp%nlev_improad, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: NLEV_IMPROAD NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='T_BUILDING_MIN', flag='read', data=urbinp%t_building_min, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: T_BUILDING_MIN NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='ALB_IMPROAD_DIR', flag='read', data=urbinp%alb_improad_dir, & - dim1name=grlnd, readvar=readvar) - if (.not.readvar) then - call endrun( msg=' ERROR: ALB_IMPROAD_DIR NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='ALB_IMPROAD_DIF', flag='read', data=urbinp%alb_improad_dif, & - dim1name=grlnd, readvar=readvar) - if (.not.readvar) then - call endrun( msg=' ERROR: ALB_IMPROAD_DIF NOT on fsurdat file'//errmsg(sourcefile, __LINE__) ) - end if - - call ncd_io(ncid=ncid, varname='ALB_PERROAD_DIR', flag='read',data=urbinp%alb_perroad_dir, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: ALB_PERROAD_DIR NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='ALB_PERROAD_DIF', flag='read',data=urbinp%alb_perroad_dif, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: ALB_PERROAD_DIF NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='ALB_ROOF_DIR', flag='read', data=urbinp%alb_roof_dir, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: ALB_ROOF_DIR NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='ALB_ROOF_DIF', flag='read', data=urbinp%alb_roof_dif, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: ALB_ROOF_DIF NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='ALB_WALL_DIR', flag='read', data=urbinp%alb_wall_dir, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: ALB_WALL_DIR NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='ALB_WALL_DIF', flag='read', data=urbinp%alb_wall_dif, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: ALB_WALL_DIF NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='TK_IMPROAD', flag='read', data=urbinp%tk_improad, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: TK_IMPROAD NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='TK_ROOF', flag='read', data=urbinp%tk_roof, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: TK_ROOF NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='TK_WALL', flag='read', data=urbinp%tk_wall, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: TK_WALL NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='CV_IMPROAD', flag='read', data=urbinp%cv_improad, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: CV_IMPROAD NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='CV_ROOF', flag='read', data=urbinp%cv_roof, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: CV_ROOF NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='CV_WALL', flag='read', data=urbinp%cv_wall, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: CV_WALL NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - call ncd_pio_closefile(ncid) if (masterproc) then write(iulog,*)' Sucessfully read urban input data' @@ -668,30 +255,8 @@ subroutine UrbanInput(begg, endg, mode) deallocate(urbinp%canyon_hwr, & urbinp%wtlunit_roof, & urbinp%wtroad_perv, & - urbinp%em_roof, & - urbinp%em_improad, & - urbinp%em_perroad, & - urbinp%em_wall, & - urbinp%alb_roof_dir, & - urbinp%alb_roof_dif, & - urbinp%alb_improad_dir, & - urbinp%alb_perroad_dir, & - urbinp%alb_improad_dif, & - urbinp%alb_perroad_dif, & - urbinp%alb_wall_dir, & - urbinp%alb_wall_dif, & - urbinp%ht_roof, & - urbinp%wind_hgt_canyon, & - urbinp%tk_wall, & - urbinp%tk_roof, & - urbinp%tk_improad, & - urbinp%cv_wall, & - urbinp%cv_roof, & - urbinp%cv_improad, & urbinp%thick_wall, & urbinp%thick_roof, & - urbinp%nlev_improad, & - urbinp%t_building_min, & stat=ier) if (ier /= 0) then call endrun(msg='initUrbanInput: deallocation error '//errmsg(sourcefile, __LINE__)) @@ -703,257 +268,6 @@ subroutine UrbanInput(begg, endg, mode) end subroutine UrbanInput - !----------------------------------------------------------------------- - subroutine CheckUrban(begg, endg, pcturb, caller) - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Confirm that we have valid urban data for all points with pct urban > 0. If this isn't - ! true, abort with a message. - ! - ! !USES: - use clm_instur , only : urban_valid - use landunit_varcon , only : numurbl - ! - ! !ARGUMENTS: - implicit none - integer , intent(in) :: begg, endg ! beg & end grid cell indices - real(r8) , intent(in) :: pcturb(begg:,:) ! % urban - character(len=*), intent(in) :: caller ! identifier of caller, for more meaningful error messages - ! - ! !REVISION HISTORY: - ! Created by Bill Sacks 7/2013, mostly by moving code from surfrd_special - ! - ! !LOCAL VARIABLES: - logical :: found - integer :: nl, n - integer :: nindx, dindx - integer :: nlev - !----------------------------------------------------------------------- - - found = .false. - do nl = begg,endg - do n = 1, numurbl - if ( pcturb(nl,n) > 0.0_r8 ) then - if ( .not. urban_valid(nl) .or. & - urbinp%canyon_hwr(nl,n) <= 0._r8 .or. & - urbinp%em_improad(nl,n) <= 0._r8 .or. & - urbinp%em_perroad(nl,n) <= 0._r8 .or. & - urbinp%em_roof(nl,n) <= 0._r8 .or. & - urbinp%em_wall(nl,n) <= 0._r8 .or. & - urbinp%ht_roof(nl,n) <= 0._r8 .or. & - urbinp%thick_roof(nl,n) <= 0._r8 .or. & - urbinp%thick_wall(nl,n) <= 0._r8 .or. & - urbinp%t_building_min(nl,n) <= 0._r8 .or. & - urbinp%wind_hgt_canyon(nl,n) <= 0._r8 .or. & - urbinp%wtlunit_roof(nl,n) <= 0._r8 .or. & - urbinp%wtroad_perv(nl,n) <= 0._r8 .or. & - any(urbinp%alb_improad_dir(nl,n,:) <= 0._r8) .or. & - any(urbinp%alb_improad_dif(nl,n,:) <= 0._r8) .or. & - any(urbinp%alb_perroad_dir(nl,n,:) <= 0._r8) .or. & - any(urbinp%alb_perroad_dif(nl,n,:) <= 0._r8) .or. & - any(urbinp%alb_roof_dir(nl,n,:) <= 0._r8) .or. & - any(urbinp%alb_roof_dif(nl,n,:) <= 0._r8) .or. & - any(urbinp%alb_wall_dir(nl,n,:) <= 0._r8) .or. & - any(urbinp%alb_wall_dif(nl,n,:) <= 0._r8) .or. & - any(urbinp%tk_roof(nl,n,:) <= 0._r8) .or. & - any(urbinp%tk_wall(nl,n,:) <= 0._r8) .or. & - any(urbinp%cv_roof(nl,n,:) <= 0._r8) .or. & - any(urbinp%cv_wall(nl,n,:) <= 0._r8)) then - found = .true. - nindx = nl - dindx = n - exit - else - if (urbinp%nlev_improad(nl,n) > 0) then - nlev = urbinp%nlev_improad(nl,n) - if ( any(urbinp%tk_improad(nl,n,1:nlev) <= 0._r8) .or. & - any(urbinp%cv_improad(nl,n,1:nlev) <= 0._r8)) then - found = .true. - nindx = nl - dindx = n - exit - end if - end if - end if - if (found) exit - end if - end do - end do - if ( found ) then - write(iulog,*) trim(caller), ' ERROR: no valid urban data for nl=',nindx - write(iulog,*)'density type: ',dindx - write(iulog,*)'urban_valid: ',urban_valid(nindx) - write(iulog,*)'canyon_hwr: ',urbinp%canyon_hwr(nindx,dindx) - write(iulog,*)'em_improad: ',urbinp%em_improad(nindx,dindx) - write(iulog,*)'em_perroad: ',urbinp%em_perroad(nindx,dindx) - write(iulog,*)'em_roof: ',urbinp%em_roof(nindx,dindx) - write(iulog,*)'em_wall: ',urbinp%em_wall(nindx,dindx) - write(iulog,*)'ht_roof: ',urbinp%ht_roof(nindx,dindx) - write(iulog,*)'thick_roof: ',urbinp%thick_roof(nindx,dindx) - write(iulog,*)'thick_wall: ',urbinp%thick_wall(nindx,dindx) - write(iulog,*)'t_building_min: ',urbinp%t_building_min(nindx,dindx) - write(iulog,*)'wind_hgt_canyon: ',urbinp%wind_hgt_canyon(nindx,dindx) - write(iulog,*)'wtlunit_roof: ',urbinp%wtlunit_roof(nindx,dindx) - write(iulog,*)'wtroad_perv: ',urbinp%wtroad_perv(nindx,dindx) - write(iulog,*)'alb_improad_dir: ',urbinp%alb_improad_dir(nindx,dindx,:) - write(iulog,*)'alb_improad_dif: ',urbinp%alb_improad_dif(nindx,dindx,:) - write(iulog,*)'alb_perroad_dir: ',urbinp%alb_perroad_dir(nindx,dindx,:) - write(iulog,*)'alb_perroad_dif: ',urbinp%alb_perroad_dif(nindx,dindx,:) - write(iulog,*)'alb_roof_dir: ',urbinp%alb_roof_dir(nindx,dindx,:) - write(iulog,*)'alb_roof_dif: ',urbinp%alb_roof_dif(nindx,dindx,:) - write(iulog,*)'alb_wall_dir: ',urbinp%alb_wall_dir(nindx,dindx,:) - write(iulog,*)'alb_wall_dif: ',urbinp%alb_wall_dif(nindx,dindx,:) - write(iulog,*)'tk_roof: ',urbinp%tk_roof(nindx,dindx,:) - write(iulog,*)'tk_wall: ',urbinp%tk_wall(nindx,dindx,:) - write(iulog,*)'cv_roof: ',urbinp%cv_roof(nindx,dindx,:) - write(iulog,*)'cv_wall: ',urbinp%cv_wall(nindx,dindx,:) - if (urbinp%nlev_improad(nindx,dindx) > 0) then - nlev = urbinp%nlev_improad(nindx,dindx) - write(iulog,*)'tk_improad: ',urbinp%tk_improad(nindx,dindx,1:nlev) - write(iulog,*)'cv_improad: ',urbinp%cv_improad(nindx,dindx,1:nlev) - end if - call endrun(msg=errmsg(sourcefile, __LINE__)) - end if - - end subroutine CheckUrban - - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - !BOP - ! - ! !IROUTINE: UrbanReadNML - ! - ! !INTERFACE: - ! - subroutine UrbanReadNML ( NLFilename ) - ! - ! !DESCRIPTION: - ! - ! Read in the urban namelist - ! - ! !USES: - use shr_mpi_mod , only : shr_mpi_bcast - use abortutils , only : endrun - use spmdMod , only : masterproc, mpicom - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use shr_mpi_mod , only : shr_mpi_bcast - implicit none - ! - ! !ARGUMENTS: - character(len=*), intent(IN) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - character(len=32) :: subname = 'UrbanReadNML' ! subroutine name - - namelist / clmu_inparm / urban_hac, urban_traffic, building_temp_method - !EOP - !----------------------------------------------------------------------- - - ! ---------------------------------------------------------------------- - ! Read namelist from input namelist filename - ! ---------------------------------------------------------------------- - - if ( masterproc )then - - unitn = getavu() - write(iulog,*) 'Read in clmu_inparm namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, 'clmu_inparm', status=ierr) - if (ierr == 0) then - read(unitn, clmu_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading clmu_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR finding clmu_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - - end if - - ! Broadcast namelist variables read in - call shr_mpi_bcast(urban_hac, mpicom) - call shr_mpi_bcast(urban_traffic, mpicom) - call shr_mpi_bcast(building_temp_method, mpicom) - - ! - if (urban_traffic) then - write(iulog,*)'Urban traffic fluxes are not implemented currently' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - ! - if ( masterproc )then - write(iulog,*) ' urban air conditioning/heating and wasteheat = ', urban_hac - write(iulog,*) ' urban traffic flux = ', urban_traffic - end if - - ReadNamelist = .true. - - end subroutine UrbanReadNML - - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - !BOP - ! - ! !IROUTINE: IsSimpleBuildTemp - ! - ! !INTERFACE: - ! - logical function IsSimpleBuildTemp( ) - ! - ! !DESCRIPTION: - ! - ! If the simple building temperature method is being used - ! - ! !USES: - implicit none - !EOP - !----------------------------------------------------------------------- - - if ( .not. ReadNamelist )then - write(iulog,*)'Testing on building_temp_method before urban namelist was read in' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - IsSimpleBuildTemp = building_temp_method == BUILDING_TEMP_METHOD_SIMPLE - - end function IsSimpleBuildTemp - - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - !BOP - ! - ! !IROUTINE: IsProgBuildTemp - ! - ! !INTERFACE: - ! - logical function IsProgBuildTemp( ) - ! - ! !DESCRIPTION: - ! - ! If the prognostic building temperature method is being used - ! - ! !USES: - implicit none - !EOP - !----------------------------------------------------------------------- - - if ( .not. ReadNamelist )then - write(iulog,*)'Testing on building_temp_method before urban namelist was read in' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - IsProgBuildTemp = building_temp_method == BUILDING_TEMP_METHOD_PROG - - end function IsProgBuildTemp - - !----------------------------------------------------------------------- - end module UrbanParamsType diff --git a/src/biogeophys/UrbanTimeVarType.F90 b/src/biogeophys/UrbanTimeVarType.F90 deleted file mode 100644 index 600f506f26..0000000000 --- a/src/biogeophys/UrbanTimeVarType.F90 +++ /dev/null @@ -1,168 +0,0 @@ -module UrbanTimeVarType - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Urban Time Varying Data - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_CL - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use decompMod , only : bounds_type - use clm_varctl , only : iulog - use landunit_varcon , only : isturb_MIN, isturb_MAX - use clm_varcon , only : spval - use LandunitType , only : lun - use GridcellType , only : grc - use mct_mod - use shr_strdata_mod , only : shr_strdata_type - ! - implicit none - save - private - ! - ! - - ! !PUBLIC TYPE - type, public :: urbantv_type - - real(r8), public, pointer :: t_building_max(:) ! lun maximum internal building air temperature (K) - type(shr_strdata_type) :: sdat_urbantv ! urban time varying input data stream - contains - - ! !PUBLIC MEMBER FUNCTIONS: - procedure, public :: Init ! Allocate and initialize urbantv - procedure, public :: urbantv_interp ! Interpolate urban time varying stream - - end type urbantv_type - - !----------------------------------------------------------------------- - character(15), private :: stream_var_name(isturb_MIN:isturb_MAX) - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - subroutine Init(this, bounds, NLFilename) - ! - ! Allocate module variables and data structures - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use histFileMod , only : hist_addfld1d - ! - ! !ARGUMENTS: - class(urbantv_type) :: this - type(bounds_type) , intent(in) :: bounds - character(len=*) , intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: begl, endl - !--------------------------------------------------------------------- - - begl = bounds%begl; endl = bounds%endl - - ! Allocate urbantv data structure - - allocate(this%t_building_max (begl:endl)) ; this%t_building_max (:) = nan - - call this%urbantv_interp(bounds) - - ! Add history fields - call hist_addfld1d (fname='TBUILD_MAX', units='K', & - avgflag='A', long_name='prescribed maximum interior building temperature', & - ptr_lunit=this%t_building_max, default='inactive', set_nourb=spval, & - l2g_scale_type='unity') - - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine urbantv_interp(this, bounds) - ! - ! !DESCRIPTION: - ! Interpolate data stream information for urban time varying data. - ! - ! !USES: - use clm_time_manager, only : get_curr_date - use spmdMod , only : mpicom - use shr_strdata_mod , only : shr_strdata_advance - use clm_instur , only : urban_valid - ! - ! !ARGUMENTS: - class(urbantv_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - logical :: found - integer :: l, glun, ig, g, ip - integer :: year ! year (0, ...) for nstep+1 - integer :: mon ! month (1, ..., 12) for nstep+1 - integer :: day ! day of month (1, ..., 31) for nstep+1 - integer :: sec ! seconds into current date for nstep+1 - integer :: mcdate ! Current model date (yyyymmdd) - integer :: lindx ! landunit index - integer :: gindx ! gridcell index - !----------------------------------------------------------------------- - - call get_curr_date(year, mon, day, sec) - mcdate = year*10000 + mon*100 + day - - call shr_strdata_advance(this%sdat_urbantv, mcdate, sec, mpicom, 'urbantvdyn') - - do l = bounds%begl,bounds%endl - if (lun%urbpoi(l)) then - glun = lun%gridcell(l) - ip = mct_aVect_indexRA(this%sdat_urbantv%avs(1),trim(stream_var_name(lun%itype(l)))) - ! - ! Determine vector index corresponding to glun - ! - ig = 0 - do g = bounds%begg,bounds%endg - ig = ig+1 - if (g == glun) exit - end do - - this%t_building_max(l) = this%sdat_urbantv%avs(1)%rAttr(ip,ig) - else - this%t_building_max(l) = spval - end if - end do - - found = .false. - do l = bounds%begl,bounds%endl - if (lun%urbpoi(l)) then - glun = lun%gridcell(l) - ! - ! Determine vector index corresponding to glun - ! - ig = 0 - do g = bounds%begg,bounds%endg - ig = ig+1 - if (g == glun) exit - end do - - if ( .not. urban_valid(g) .or. (this%t_building_max(l) <= 0._r8)) then - found = .true. - gindx = g - lindx = l - exit - end if - end if - end do - if ( found ) then - write(iulog,*)'ERROR: no valid urban data for g= ',gindx - write(iulog,*)'landunit type: ',lun%itype(l) - write(iulog,*)'urban_valid: ',urban_valid(gindx) - write(iulog,*)'t_building_max: ',this%t_building_max(lindx) - call endrun(msg=errmsg(sourcefile, __LINE__)) - end if - - - end subroutine urbantv_interp - - !----------------------------------------------------------------------- - -end module UrbanTimeVarType diff --git a/src/biogeophys/WaterStateType.F90 b/src/biogeophys/WaterStateType.F90 index 4615e22f4d..bb2b0ea7b1 100644 --- a/src/biogeophys/WaterStateType.F90 +++ b/src/biogeophys/WaterStateType.F90 @@ -8,13 +8,7 @@ module WaterstateType ! ! !USES: use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg use decompMod , only : bounds_type - use clm_varctl , only : use_vancouver, use_mexicocity, use_cn, iulog, use_luna - use clm_varpar , only : nlevgrnd, nlevurb, nlevsno - use clm_varcon , only : spval - use LandunitType , only : lun - use ColumnType , only : col ! implicit none save @@ -22,96 +16,17 @@ module WaterstateType ! ! !PUBLIC TYPES: type, public :: waterstate_type - - real(r8), pointer :: snow_depth_col (:) ! col snow height of snow covered area (m) - real(r8), pointer :: snow_persistence_col (:) ! col length of time that ground has had non-zero snow thickness (sec) - real(r8), pointer :: snowdp_col (:) ! col area-averaged snow height (m) - real(r8), pointer :: snowice_col (:) ! col average snow ice lens - real(r8), pointer :: snowliq_col (:) ! col average snow liquid water - real(r8), pointer :: int_snow_col (:) ! col integrated snowfall (mm H2O) - real(r8), pointer :: snow_layer_unity_col (:,:) ! value 1 for each snow layer, used for history diagnostics - real(r8), pointer :: bw_col (:,:) ! col partial density of water in the snow pack (ice + liquid) [kg/m3] - real(r8), pointer :: h2osno_col (:) ! col snow water (mm H2O) - real(r8), pointer :: h2osno_old_col (:) ! col snow mass for previous time step (kg/m2) (new) - real(r8), pointer :: h2osoi_liq_col (:,:) ! col liquid water (kg/m2) (new) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: h2osoi_ice_col (:,:) ! col ice lens (kg/m2) (new) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: h2osoi_liq_tot_col (:) ! vertically summed col liquid water (kg/m2) (new) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: h2osoi_ice_tot_col (:) ! vertically summed col ice lens (kg/m2) (new) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: h2osoi_liqice_10cm_col (:) ! col liquid water + ice lens in top 10cm of soil (kg/m2) - real(r8), pointer :: h2osoi_vol_col (:,:) ! col volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (nlevgrnd) - real(r8), pointer :: air_vol_col (:,:) ! col air filled porosity - real(r8), pointer :: h2osoi_liqvol_col (:,:) ! col volumetric liquid water content (v/v) - real(r8), pointer :: h2ocan_patch (:) ! patch canopy water (mm H2O) - real(r8), pointer :: h2osfc_col (:) ! col surface water (mm H2O) - real(r8), pointer :: snocan_patch (:) ! patch canopy snow water (mm H2O) - real(r8), pointer :: liqcan_patch (:) ! patch canopy liquid water (mm H2O) - real(r8), pointer :: snounload_patch (:) ! Canopy snow unloading (mm H2O) - real(r8), pointer :: swe_old_col (:,:) ! col initial snow water - real(r8), pointer :: liq1_grc (:) ! grc initial gridcell total h2o liq content - real(r8), pointer :: liq2_grc (:) ! grc post land cover change total liq content - real(r8), pointer :: ice1_grc (:) ! grc initial gridcell total h2o ice content - real(r8), pointer :: ice2_grc (:) ! grc post land cover change total ice content - real(r8), pointer :: tws_grc (:) ! grc total water storage (mm H2O) - - real(r8), pointer :: total_plant_stored_h2o_col(:) ! col water that is bound in plants, including roots, sapwood, leaves, etc - ! in most cases, the vegetation scheme does not have a dynamic - ! water storage in plants, and thus 0.0 is a suitable for the trivial case. - ! When FATES is coupled in with plant hydraulics turned on, this storage - ! term is set to non-zero. (kg/m2 H2O) - - real(r8), pointer :: snw_rds_col (:,:) ! col snow grain radius (col,lyr) [m^-6, microns] - real(r8), pointer :: snw_rds_top_col (:) ! col snow grain radius (top layer) [m^-6, microns] - real(r8), pointer :: h2osno_top_col (:) ! col top-layer mass of snow [kg] - real(r8), pointer :: sno_liq_top_col (:) ! col snow liquid water fraction (mass), top layer [fraction] - - real(r8), pointer :: q_ref2m_patch (:) ! patch 2 m height surface specific humidity (kg/kg) - real(r8), pointer :: rh_ref2m_patch (:) ! patch 2 m height surface relative humidity (%) - real(r8), pointer :: rh_ref2m_r_patch (:) ! patch 2 m height surface relative humidity - rural (%) - real(r8), pointer :: rh_ref2m_u_patch (:) ! patch 2 m height surface relative humidity - urban (%) - real(r8), pointer :: rh_af_patch (:) ! patch fractional humidity of canopy air (dimensionless) ! private - real(r8), pointer :: rh10_af_patch (:) ! 10-day mean patch fractional humidity of canopy air (dimensionless) - real(r8), pointer :: qg_snow_col (:) ! col ground specific humidity [kg/kg] - real(r8), pointer :: qg_soil_col (:) ! col ground specific humidity [kg/kg] - real(r8), pointer :: qg_h2osfc_col (:) ! col ground specific humidity [kg/kg] - real(r8), pointer :: qg_col (:) ! col ground specific humidity [kg/kg] - real(r8), pointer :: dqgdT_col (:) ! col d(qg)/dT - real(r8), pointer :: qaf_lun (:) ! lun urban canopy air specific humidity (kg/kg) - - ! Fractions - real(r8), pointer :: frac_sno_col (:) ! col fraction of ground covered by snow (0 to 1) - real(r8), pointer :: frac_sno_eff_col (:) ! col fraction of ground covered by snow (0 to 1) - real(r8), pointer :: frac_iceold_col (:,:) ! col fraction of ice relative to the tot water (new) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: frac_h2osfc_col (:) ! col fractional area with surface water greater than zero - real(r8), pointer :: frac_h2osfc_nosnow_col (:) ! col fractional area with surface water greater than zero (if no snow present) - real(r8), pointer :: wf_col (:) ! col soil water as frac. of whc for top 0.05 m (0-1) - real(r8), pointer :: wf2_col (:) ! col soil water as frac. of whc for top 0.17 m (0-1) - real(r8), pointer :: fwet_patch (:) ! patch canopy fraction that is wet (0 to 1) - real(r8), pointer :: fcansno_patch (:) ! patch canopy fraction that is snow covered (0 to 1) - real(r8), pointer :: fdry_patch (:) ! patch canopy fraction of foliage that is green and dry [-] (new) - - ! Balance Checks - - real(r8), pointer :: begwb_col (:) ! water mass begining of the time step - real(r8), pointer :: endwb_col (:) ! water mass end of the time step - real(r8), pointer :: errh2o_patch (:) ! water conservation error (mm H2O) - real(r8), pointer :: errh2o_col (:) ! water conservation error (mm H2O) - real(r8), pointer :: errh2osno_col (:) ! snow water conservation error(mm H2O) contains procedure :: Init procedure :: Restart - procedure, public :: Reset procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold + procedure, private :: InitCold end type waterstate_type - ! minimum allowed snow effective radius (also "fresh snow" value) [microns] - real(r8), public, parameter :: snw_rds_min = 54.526_r8 - character(len=*), parameter, private :: sourcefile = & __FILE__ !------------------------------------------------------------------------ @@ -119,31 +34,14 @@ module WaterstateType contains !------------------------------------------------------------------------ - subroutine Init(this, bounds, & - h2osno_input_col, snow_depth_input_col, watsat_col, t_soisno_col) + subroutine Init(this, bounds, h2osno_input_col) class(waterstate_type) :: this type(bounds_type) , intent(in) :: bounds real(r8) , intent(inout) :: h2osno_input_col(bounds%begc:) - real(r8) , intent(inout) :: snow_depth_input_col(bounds%begc:) - real(r8) , intent(inout) :: watsat_col(bounds%begc:, 1:) ! volumetric soil water at saturation (porosity) - real(r8) , intent(inout) :: t_soisno_col(bounds%begc:, -nlevsno+1:) ! col soil temperature (Kelvin) - -#ifdef __PGI -# if __PGIC__ == 14 && __PGIC_MINOR__ == 7 - ! COMPILER_BUG(bja, 2015-04, pgi 14.7-?) occurs at: call this%InitCold(...) - ! PGF90-F-0000-Internal compiler error. normalize_forall_array: non-conformable - ! not sure why this fixes things.... - real(r8), allocatable :: workaround_for_pgi_internal_compiler_error(:) -# endif -#endif call this%InitAllocate(bounds) - - call this%InitHistory(bounds) - - call this%InitCold(bounds, & - h2osno_input_col, snow_depth_input_col, watsat_col, t_soisno_col) + call this%InitCold(bounds, h2osno_input_col) end subroutine Init @@ -161,708 +59,50 @@ subroutine InitAllocate(this, bounds) type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: - integer :: begp, endp integer :: begc, endc - integer :: begl, endl - integer :: begg, endg !------------------------------------------------------------------------ - begp = bounds%begp; endp= bounds%endp begc = bounds%begc; endc= bounds%endc - begl = bounds%begl; endl= bounds%endl - begg = bounds%begg; endg= bounds%endg - - allocate(this%snow_depth_col (begc:endc)) ; this%snow_depth_col (:) = nan - allocate(this%snow_persistence_col (begc:endc)) ; this%snow_persistence_col (:) = nan - allocate(this%snowdp_col (begc:endc)) ; this%snowdp_col (:) = nan - allocate(this%snowice_col (begc:endc)) ; this%snowice_col (:) = nan - allocate(this%snowliq_col (begc:endc)) ; this%snowliq_col (:) = nan - allocate(this%int_snow_col (begc:endc)) ; this%int_snow_col (:) = nan - allocate(this%snow_layer_unity_col (begc:endc,-nlevsno+1:0)) ; this%snow_layer_unity_col (:,:) = nan - allocate(this%bw_col (begc:endc,-nlevsno+1:0)) ; this%bw_col (:,:) = nan - allocate(this%h2osno_col (begc:endc)) ; this%h2osno_col (:) = nan - allocate(this%h2osno_old_col (begc:endc)) ; this%h2osno_old_col (:) = nan - allocate(this%h2osoi_liqice_10cm_col (begc:endc)) ; this%h2osoi_liqice_10cm_col (:) = nan - allocate(this%h2osoi_vol_col (begc:endc, 1:nlevgrnd)) ; this%h2osoi_vol_col (:,:) = nan - allocate(this%air_vol_col (begc:endc, 1:nlevgrnd)) ; this%air_vol_col (:,:) = nan - allocate(this%h2osoi_liqvol_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%h2osoi_liqvol_col (:,:) = nan - allocate(this%h2osoi_ice_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%h2osoi_ice_col (:,:) = nan - allocate(this%h2osoi_liq_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%h2osoi_liq_col (:,:) = nan - allocate(this%h2osoi_ice_tot_col (begc:endc)) ; this%h2osoi_ice_tot_col (:) = nan - allocate(this%h2osoi_liq_tot_col (begc:endc)) ; this%h2osoi_liq_tot_col (:) = nan - allocate(this%h2ocan_patch (begp:endp)) ; this%h2ocan_patch (:) = nan - allocate(this%snocan_patch (begp:endp)) ; this%snocan_patch (:) = nan - allocate(this%liqcan_patch (begp:endp)) ; this%liqcan_patch (:) = nan - allocate(this%snounload_patch (begp:endp)) ; this%snounload_patch (:) = nan - allocate(this%h2osfc_col (begc:endc)) ; this%h2osfc_col (:) = nan - allocate(this%swe_old_col (begc:endc,-nlevsno+1:0)) ; this%swe_old_col (:,:) = nan - allocate(this%liq1_grc (begg:endg)) ; this%liq1_grc (:) = nan - allocate(this%liq2_grc (begg:endg)) ; this%liq2_grc (:) = nan - allocate(this%ice1_grc (begg:endg)) ; this%ice1_grc (:) = nan - allocate(this%ice2_grc (begg:endg)) ; this%ice2_grc (:) = nan - allocate(this%tws_grc (begg:endg)) ; this%tws_grc (:) = nan - - allocate(this%total_plant_stored_h2o_col(begc:endc)) ; this%total_plant_stored_h2o_col(:) = nan - - allocate(this%snw_rds_col (begc:endc,-nlevsno+1:0)) ; this%snw_rds_col (:,:) = nan - allocate(this%snw_rds_top_col (begc:endc)) ; this%snw_rds_top_col (:) = nan - allocate(this%h2osno_top_col (begc:endc)) ; this%h2osno_top_col (:) = nan - allocate(this%sno_liq_top_col (begc:endc)) ; this%sno_liq_top_col (:) = nan - - allocate(this%qg_snow_col (begc:endc)) ; this%qg_snow_col (:) = nan - allocate(this%qg_soil_col (begc:endc)) ; this%qg_soil_col (:) = nan - allocate(this%qg_h2osfc_col (begc:endc)) ; this%qg_h2osfc_col (:) = nan - allocate(this%qg_col (begc:endc)) ; this%qg_col (:) = nan - allocate(this%dqgdT_col (begc:endc)) ; this%dqgdT_col (:) = nan - allocate(this%qaf_lun (begl:endl)) ; this%qaf_lun (:) = nan - allocate(this%q_ref2m_patch (begp:endp)) ; this%q_ref2m_patch (:) = nan - allocate(this%rh_ref2m_patch (begp:endp)) ; this%rh_ref2m_patch (:) = nan - allocate(this%rh_ref2m_u_patch (begp:endp)) ; this%rh_ref2m_u_patch (:) = nan - allocate(this%rh_ref2m_r_patch (begp:endp)) ; this%rh_ref2m_r_patch (:) = nan - allocate(this%rh_af_patch (begp:endp)) ; this%rh_af_patch (:) = nan - allocate(this%rh10_af_patch (begp:endp)) ; this%rh10_af_patch (:) = spval + allocate(this%h2osno_col(begc:endc)); this%h2osno_col(:) = nan - allocate(this%frac_sno_col (begc:endc)) ; this%frac_sno_col (:) = nan - allocate(this%frac_sno_eff_col (begc:endc)) ; this%frac_sno_eff_col (:) = nan - allocate(this%frac_iceold_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%frac_iceold_col (:,:) = nan - allocate(this%frac_h2osfc_col (begc:endc)) ; this%frac_h2osfc_col (:) = nan - allocate(this%frac_h2osfc_nosnow_col (begc:endc)) ; this%frac_h2osfc_nosnow_col (:) = nan - allocate(this%wf_col (begc:endc)) ; this%wf_col (:) = nan - allocate(this%wf2_col (begc:endc)) ; - allocate(this%fwet_patch (begp:endp)) ; this%fwet_patch (:) = nan - allocate(this%fcansno_patch (begp:endp)) ; this%fcansno_patch (:) = nan - allocate(this%fdry_patch (begp:endp)) ; this%fdry_patch (:) = nan - - allocate(this%begwb_col (begc:endc)) ; this%begwb_col (:) = nan - allocate(this%endwb_col (begc:endc)) ; this%endwb_col (:) = nan - allocate(this%errh2o_patch (begp:endp)) ; this%errh2o_patch (:) = nan - allocate(this%errh2o_col (begc:endc)) ; this%errh2o_col (:) = nan - allocate(this%errh2osno_col (begc:endc)) ; this%errh2osno_col (:) = nan end subroutine InitAllocate - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varctl , only : use_cn - use clm_varctl , only : hist_wrtch4diag - use clm_varpar , only : nlevsno, nlevsoi - use histFileMod , only : hist_addfld1d, hist_addfld2d, no_snow_normal, no_snow_zero - ! - ! !ARGUMENTS: - class(waterstate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begg, endg - character(10) :: active - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - ! h2osno also includes snow that is part of the soil column (an - ! initial snow layer is only created if h2osno > 10mm). - - data2dptr => this%h2osoi_liq_col(:,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_LIQH2O', units='kg/m2', type2d='levsno', & - avgflag='A', long_name='Snow liquid water content', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, default='inactive') - - data2dptr => this%h2osoi_ice_col(:,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_ICE', units='kg/m2', type2d='levsno', & - avgflag='A', long_name='Snow ice content', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, default='inactive') - - data2dptr => this%h2osoi_vol_col(begc:endc,1:nlevsoi) - call hist_addfld2d (fname='H2OSOI', units='mm3/mm3', type2d='levsoi', & - avgflag='A', long_name='volumetric soil water (vegetated landunits only)', & - ptr_col=this%h2osoi_vol_col, l2g_scale_type='veg', default='inactive') - -! this%h2osoi_liq_col(begc:endc,:) = spval -! call hist_addfld2d (fname='SOILLIQ', units='kg/m2', type2d='levgrnd', & -! avgflag='A', long_name='soil liquid water (vegetated landunits only)', & -! ptr_col=this%h2osoi_liq_col, l2g_scale_type='veg') - - data2dptr => this%h2osoi_liq_col(begc:endc,1:nlevsoi) - call hist_addfld2d (fname='SOILLIQ', units='kg/m2', type2d='levsoi', & - avgflag='A', long_name='soil liquid water (vegetated landunits only)', & - ptr_col=data2dptr, l2g_scale_type='veg', default='inactive') - - data2dptr => this%h2osoi_ice_col(begc:endc,1:nlevsoi) - call hist_addfld2d (fname='SOILICE', units='kg/m2', type2d='levsoi', & - avgflag='A', long_name='soil ice (vegetated landunits only)', & - ptr_col=data2dptr, l2g_scale_type='veg', default='inactive') - - this%h2osoi_liqice_10cm_col(begc:endc) = spval - call hist_addfld1d (fname='SOILWATER_10CM', units='kg/m2', & - avgflag='A', long_name='soil liquid water + ice in top 10cm of soil (veg landunits only)', & - ptr_col=this%h2osoi_liqice_10cm_col, set_urb=spval, set_lake=spval, l2g_scale_type='veg', default='inactive') - - this%h2osoi_liq_tot_col(begc:endc) = spval - call hist_addfld1d (fname='TOTSOILLIQ', units='kg/m2', & - avgflag='A', long_name='vertically summed soil liquid water (veg landunits only)', & - ptr_col=this%h2osoi_liq_tot_col, set_urb=spval, set_lake=spval, l2g_scale_type='veg', default='inactive') - - this%h2osoi_ice_tot_col(begc:endc) = spval - call hist_addfld1d (fname='TOTSOILICE', units='kg/m2', & - avgflag='A', long_name='vertically summed soil cie (veg landunits only)', & - ptr_col=this%h2osoi_ice_tot_col, set_urb=spval, set_lake=spval, l2g_scale_type='veg', default='inactive') - - this%h2ocan_patch(begp:endp) = spval - call hist_addfld1d (fname='H2OCAN', units='mm', & - avgflag='A', long_name='intercepted water', & - ptr_patch=this%h2ocan_patch, set_lake=0._r8, default='inactive') - - this%snocan_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOCAN', units='mm', & - avgflag='A', long_name='intercepted snow', & - ptr_patch=this%snocan_patch, set_lake=0._r8, default='inactive') - - this%liqcan_patch(begp:endp) = spval - call hist_addfld1d (fname='LIQCAN', units='mm', & - avgflag='A', long_name='intercepted liquid water', & - ptr_patch=this%liqcan_patch, set_lake=0._r8, default='inactive') - - this%snounload_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOUNLOAD', units='mm', & - avgflag='A', long_name='Canopy snow unloading', & - ptr_patch=this%snounload_patch, set_lake=0._r8, default='inactive') - - call hist_addfld1d (fname='H2OSNO', units='mm', & - avgflag='A', long_name='snow depth (liquid water)', & - ptr_col=this%h2osno_col, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='H2OSNO_ICE', units='mm', & - avgflag='A', long_name='snow depth (liquid water, ice landunits only)', & - ptr_col=this%h2osno_col, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%liq1_grc(begg:endg) = spval - call hist_addfld1d (fname='LIQUID_CONTENT1', units='mm', & - avgflag='A', long_name='initial gridcell total liq content', & - ptr_lnd=this%liq1_grc, default='inactive') - - this%liq2_grc(begg:endg) = spval - call hist_addfld1d (fname='LIQUID_CONTENT2', units='mm', & - avgflag='A', long_name='post landuse change gridcell total liq content', & - ptr_lnd=this%liq2_grc, default='inactive') - - this%ice1_grc(begg:endg) = spval - call hist_addfld1d (fname='ICE_CONTENT1', units='mm', & - avgflag='A', long_name='initial gridcell total ice content', & - ptr_lnd=this%ice1_grc, default='inactive') - - this%ice2_grc(begg:endg) = spval - call hist_addfld1d (fname='ICE_CONTENT2', units='mm', & - avgflag='A', long_name='post land cover change total ice content', & - ptr_lnd=this%ice2_grc, default='inactive') - - this%h2osfc_col(begc:endc) = spval - call hist_addfld1d (fname='H2OSFC', units='mm', & - avgflag='A', long_name='surface water depth', & - ptr_col=this%h2osfc_col, default='inactive') - - this%tws_grc(begg:endg) = spval - call hist_addfld1d (fname='TWS', units='mm', & - avgflag='A', long_name='total water storage', & - ptr_lnd=this%tws_grc, default='inactive') - - ! (rgk 02-02-2017) There is intentionally no entry here for stored plant water - ! I think that since the value is zero in all cases except - ! for FATES plant hydraulics, it will be confusing for users - ! when they see their plants have no water in output files. - ! So it is not useful diagnostic information. The information - ! can be provided through FATES specific history diagnostics - ! if need be. - - ! Humidity - - this%q_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='Q2M', units='kg/kg', & - avgflag='A', long_name='2m specific humidity', & - ptr_patch=this%q_ref2m_patch, default='inactive') - - this%rh_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='RH2M', units='%', & - avgflag='A', long_name='2m relative humidity', & - ptr_patch=this%rh_ref2m_patch, default='inactive') - - this%rh_ref2m_r_patch(begp:endp) = spval - call hist_addfld1d (fname='RH2M_R', units='%', & - avgflag='A', long_name='Rural 2m specific humidity', & - ptr_patch=this%rh_ref2m_r_patch, set_spec=spval, default='inactive') - - this%rh_ref2m_u_patch(begp:endp) = spval - call hist_addfld1d (fname='RH2M_U', units='%', & - avgflag='A', long_name='Urban 2m relative humidity', & - ptr_patch=this%rh_ref2m_u_patch, set_nourb=spval, default='inactive') - - this%rh_af_patch(begp:endp) = spval - call hist_addfld1d (fname='RHAF', units='fraction', & - avgflag='A', long_name='fractional humidity of canopy air', & - ptr_patch=this%rh_af_patch, set_spec=spval, default='inactive') - - if(use_luna)then - call hist_addfld1d (fname='RHAF10', units='fraction', & - avgflag='A', long_name='10 day running mean of fractional humidity of canopy air', & - ptr_patch=this%rh10_af_patch, set_spec=spval, default='inactive') - endif - - ! Fractions - - this%frac_h2osfc_col(begc:endc) = spval - call hist_addfld1d (fname='FH2OSFC', units='unitless', & - avgflag='A', long_name='fraction of ground covered by surface water', & - ptr_col=this%frac_h2osfc_col, default='inactive') - - this%frac_h2osfc_nosnow_col(begc:endc) = spval - call hist_addfld1d (fname='FH2OSFC_NOSNOW', units='unitless', & - avgflag='A', & - long_name='fraction of ground covered by surface water (if no snow present)', & - ptr_col=this%frac_h2osfc_nosnow_col, default='inactive') - - this%frac_sno_col(begc:endc) = spval - call hist_addfld1d (fname='FSNO', units='unitless', & - avgflag='A', long_name='fraction of ground covered by snow', & - ptr_col=this%frac_sno_col, c2l_scale_type='urbanf', default='inactive') - - this%frac_sno_eff_col(begc:endc) = spval - call hist_addfld1d (fname='FSNO_EFF', units='unitless', & - avgflag='A', long_name='effective fraction of ground covered by snow', & - ptr_col=this%frac_sno_eff_col, c2l_scale_type='urbanf', default='inactive') - - if (use_cn) then - this%fwet_patch(begp:endp) = spval - call hist_addfld1d (fname='FWET', units='proportion', & - avgflag='A', long_name='fraction of canopy that is wet', & - ptr_patch=this%fwet_patch, default='inactive') - end if - - if (use_cn) then - this%fcansno_patch(begp:endp) = spval - call hist_addfld1d (fname='FCANSNO', units='proportion', & - avgflag='A', long_name='fraction of canopy that is wet', & - ptr_patch=this%fcansno_patch, default='inactive') - end if - - if (use_cn) then - this%fdry_patch(begp:endp) = spval - call hist_addfld1d (fname='FDRY', units='proportion', & - avgflag='A', long_name='fraction of foliage that is green and dry', & - ptr_patch=this%fdry_patch, default='inactive') - end if - - if (use_cn)then - this%frac_iceold_col(begc:endc,:) = spval - call hist_addfld2d (fname='FRAC_ICEOLD', units='proportion', type2d='levgrnd', & - avgflag='A', long_name='fraction of ice relative to the tot water', & - ptr_col=this%frac_iceold_col, default='inactive') - end if - - ! Snow properties - these will be vertically averaged over the snow profile - - this%snow_depth_col(begc:endc) = spval - call hist_addfld1d (fname='SNOW_DEPTH', units='m', & - avgflag='A', long_name='snow height of snow covered area', & - ptr_col=this%snow_depth_col, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='SNOW_DEPTH_ICE', units='m', & - avgflag='A', long_name='snow height of snow covered area (ice landunits only)', & - ptr_col=this%snow_depth_col, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%snowdp_col(begc:endc) = spval - call hist_addfld1d (fname='SNOWDP', units='m', & - avgflag='A', long_name='gridcell mean snow height', & - ptr_col=this%snowdp_col, c2l_scale_type='urbanf', default='inactive') - - this%snowliq_col(begc:endc) = spval - call hist_addfld1d (fname='SNOWLIQ', units='kg/m2', & - avgflag='A', long_name='snow liquid water', & - ptr_col=this%snowliq_col, default='inactive') - - this%snowice_col(begc:endc) = spval - call hist_addfld1d (fname='SNOWICE', units='kg/m2', & - avgflag='A', long_name='snow ice', & - ptr_col=this%snowice_col, default='inactive') - - this%int_snow_col(begc:endc) = spval - call hist_addfld1d (fname='INT_SNOW', units='mm', & - avgflag='A', long_name='accumulated swe (vegetated landunits only)', & - ptr_col=this%int_snow_col, l2g_scale_type='veg', & - default='inactive') - - call hist_addfld1d (fname='INT_SNOW_ICE', units='mm', & - avgflag='A', long_name='accumulated swe (ice landunits only)', & - ptr_col=this%int_snow_col, l2g_scale_type='ice', & - default='inactive') - - this%snow_persistence_col(begc:endc) = spval - call hist_addfld1d (fname='SNOW_PERSISTENCE', units='seconds', & - avgflag='I', long_name='Length of time of continuous snow cover (nat. veg. landunits only)', & - ptr_col=this%snow_persistence_col, l2g_scale_type='natveg', default='inactive') - - if (use_cn) then - this%wf_col(begc:endc) = spval - call hist_addfld1d (fname='WF', units='proportion', & - avgflag='A', long_name='soil water as frac. of whc for top 0.05 m', & - ptr_col=this%wf_col, default='inactive') - end if - - this%h2osno_top_col(begc:endc) = spval - call hist_addfld1d (fname='H2OSNO_TOP', units='kg/m2', & - avgflag='A', long_name='mass of snow in top snow layer', & - ptr_col=this%h2osno_top_col, set_urb=spval, default='inactive') - - this%snw_rds_top_col(begc:endc) = spval - call hist_addfld1d (fname='SNORDSL', units='m^-6', & - avgflag='A', long_name='top snow layer effective grain radius', & - ptr_col=this%snw_rds_top_col, set_urb=spval, default='inactive') - - this%sno_liq_top_col(begc:endc) = spval - call hist_addfld1d (fname='SNOLIQFL', units='fraction', & - avgflag='A', long_name='top snow layer liquid water fraction (land)', & - ptr_col=this%sno_liq_top_col, set_urb=spval, default='inactive') - - ! We determine the fractional time (and fraction of the grid cell) over which each - ! snow layer existed by running the snow averaging routine on a field whose value is 1 - ! everywhere - data2dptr => this%snow_layer_unity_col(:,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_EXISTENCE', units='unitless', type2d='levsno', & - avgflag='A', long_name='Fraction of averaging period for which each snow layer existed', & - ptr_col=data2dptr, no_snow_behavior=no_snow_zero, default='inactive') - - this%bw_col(begc:endc,-nlevsno+1:0) = spval - data2dptr => this%bw_col(:,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_BW', units='kg/m3', type2d='levsno', & - avgflag='A', long_name='Partial density of water in the snow pack (ice + liquid)', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, default='inactive') - - call hist_addfld2d (fname='SNO_BW_ICE', units='kg/m3', type2d='levsno', & - avgflag='A', long_name='Partial density of water in the snow pack (ice + liquid, ice landunits only)', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, & - l2g_scale_type='ice', default='inactive') - - this%snw_rds_col(begc:endc,-nlevsno+1:0) = spval - data2dptr => this%snw_rds_col(:,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_GS', units='Microns', type2d='levsno', & - avgflag='A', long_name='Mean snow grain size', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, default='inactive') - - call hist_addfld2d (fname='SNO_GS_ICE', units='Microns', type2d='levsno', & - avgflag='A', long_name='Mean snow grain size (ice landunits only)', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, & - l2g_scale_type='ice', default='inactive') - - this%errh2o_col(begc:endc) = spval - call hist_addfld1d (fname='ERRH2O', units='mm', & - avgflag='A', long_name='total water conservation error', & - ptr_col=this%errh2o_col, default='inactive') - - this%errh2osno_col(begc:endc) = spval - call hist_addfld1d (fname='ERRH2OSNO', units='mm', & - avgflag='A', long_name='imbalance in snow depth (liquid water)', & - ptr_col=this%errh2osno_col, c2l_scale_type='urbanf', default='inactive') - - end subroutine InitHistory - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds, & - h2osno_input_col, snow_depth_input_col, watsat_col, t_soisno_col) + subroutine InitCold(this, bounds, h2osno_input_col) ! ! !DESCRIPTION: - ! Initialize time constant variables and cold start conditions + ! Initialize time constant variables and cold start conditions ! ! !USES: - use shr_const_mod , only : shr_const_pi use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_spfn_mod , only : shr_spfn_erf use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ - use clm_varpar , only : nlevsoi, nlevgrnd, nlevsno, nlevlak, nlevurb - use landunit_varcon , only : istwet, istsoil, istdlak, istcrop, istice_mec - use column_varcon , only : icol_shadewall, icol_road_perv - use column_varcon , only : icol_road_imperv, icol_roof, icol_sunwall - use clm_varcon , only : denice, denh2o, spval, sb, bdsno - use clm_varcon , only : zlnd, tfrz, spval, pc - use clm_varctl , only : fsurdat, iulog - use clm_varctl , only : use_bedrock - use spmdMod , only : masterproc - use abortutils , only : endrun - use fileutils , only : getfil - use ncdio_pio , only : file_desc_t, ncd_io ! ! !ARGUMENTS: class(waterstate_type) :: this type(bounds_type) , intent(in) :: bounds real(r8) , intent(in) :: h2osno_input_col(bounds%begc:) - real(r8) , intent(in) :: snow_depth_input_col(bounds%begc:) - real(r8) , intent(in) :: watsat_col(bounds%begc:, 1:) ! volumetric soil water at saturation (porosity) - real(r8) , intent(in) :: t_soisno_col(bounds%begc:, -nlevsno+1:) ! col soil temperature (Kelvin) ! ! !LOCAL VARIABLES: - integer :: p,c,j,l,g,lev,nlevs - real(r8) :: maxslope, slopemax, minslope - real(r8) :: d, fd, dfdd, slope0,slopebeta - real(r8) ,pointer :: std (:) - logical :: readvar - type(file_desc_t) :: ncid - character(len=256) :: locfn - real(r8) :: snowbd ! temporary calculation of snow bulk density (kg/m3) - real(r8) :: fmelt ! snowbd/100 - integer :: nbedrock + integer :: c !----------------------------------------------------------------------- SHR_ASSERT_ALL((ubound(h2osno_input_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(snow_depth_input_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc,nlevgrnd/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno_col) == (/bounds%endc,nlevgrnd/)) , errMsg(sourcefile, __LINE__)) ! The first three arrays are initialized from the input argument do c = bounds%begc,bounds%endc - this%h2osno_col(c) = h2osno_input_col(c) - this%int_snow_col(c) = h2osno_input_col(c) - this%snow_depth_col(c) = snow_depth_input_col(c) - this%snow_persistence_col(c) = 0._r8 - this%snow_layer_unity_col(c,:) = 1._r8 - end do - - do c = bounds%begc,bounds%endc - this%wf_col(c) = spval - this%wf2_col(c) = spval - end do - - do l = bounds%begl, bounds%endl - if (lun%urbpoi(l)) then - if (use_vancouver) then - this%qaf_lun(l) = 0.0111_r8 - else if (use_mexicocity) then - this%qaf_lun(l) = 0.00248_r8 - else - this%qaf_lun(l) = 1.e-4_r8 ! Arbitrary set since forc_q is not yet available - end if - end if + this%h2osno_col(c) = h2osno_input_col(c) end do - ! Water Stored in plants is almost always a static entity, with the exception - ! of when FATES-hydraulics is used. As such, this is trivially set to 0.0 (rgk 03-2017) - this%total_plant_stored_h2o_col(bounds%begc:bounds%endc) = 0.0_r8 - - - associate(snl => col%snl) - - this%h2osfc_col(bounds%begc:bounds%endc) = 0._r8 - this%h2ocan_patch(bounds%begp:bounds%endp) = 0._r8 - this%snocan_patch(bounds%begp:bounds%endp) = 0._r8 - this%liqcan_patch(bounds%begp:bounds%endp) = 0._r8 - this%snounload_patch(bounds%begp:bounds%endp) = 0._r8 - this%frac_h2osfc_col(bounds%begc:bounds%endc) = 0._r8 - - this%fwet_patch(bounds%begp:bounds%endp) = 0._r8 - this%fdry_patch(bounds%begp:bounds%endp) = 0._r8 - this%fcansno_patch(bounds%begp:bounds%endp) = 0._r8 - !-------------------------------------------- - ! Set snow water - !-------------------------------------------- - - ! Note: Glacier_mec columns are initialized with half the maximum snow cover. - ! This gives more realistic values of qflx_glcice sooner in the simulation - ! for columns with net ablation, at the cost of delaying ice formation - ! in columns with net accumulation. - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - ! From Bonan 1996 (LSM technical note) - this%frac_sno_col(c) = min( this%snow_depth_col(c)/0.05_r8, 1._r8) - else - this%frac_sno_col(c) = 0._r8 - ! snow cover fraction as in Niu and Yang 2007 - if(this%snow_depth_col(c) > 0.0) then - snowbd = min(400._r8, this%h2osno_col(c)/this%snow_depth_col(c)) !bulk density of snow (kg/m3) - fmelt = (snowbd/100.)**1. - ! 100 is the assumed fresh snow density; 1 is a melting factor that could be - ! reconsidered, optimal value of 1.5 in Niu et al., 2007 - this%frac_sno_col(c) = tanh( this%snow_depth_col(c) /(2.5 * zlnd * fmelt) ) - endif - end if - end do - - do c = bounds%begc,bounds%endc - if (snl(c) < 0) then - this%snw_rds_col(c,snl(c)+1:0) = snw_rds_min - this%snw_rds_col(c,-nlevsno+1:snl(c)) = 0._r8 - this%snw_rds_top_col(c) = snw_rds_min - elseif (this%h2osno_col(c) > 0._r8) then - this%snw_rds_col(c,0) = snw_rds_min - this%snw_rds_col(c,-nlevsno+1:-1) = 0._r8 - this%snw_rds_top_col(c) = spval - this%sno_liq_top_col(c) = spval - else - this%snw_rds_col(c,:) = 0._r8 - this%snw_rds_top_col(c) = spval - this%sno_liq_top_col(c) = spval - endif - end do - - !-------------------------------------------- - ! Set soil water - !-------------------------------------------- - - ! volumetric water is set first and liquid content and ice lens are obtained - ! NOTE: h2osoi_vol, h2osoi_liq and h2osoi_ice only have valid values over soil - ! and urban pervious road (other urban columns have zero soil water) - - this%h2osoi_vol_col(bounds%begc:bounds%endc, 1:) = spval - this%h2osoi_liq_col(bounds%begc:bounds%endc,-nlevsno+1:) = spval - this%h2osoi_ice_col(bounds%begc:bounds%endc,-nlevsno+1:) = spval - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (.not. lun%lakpoi(l)) then !not lake - - ! volumetric water - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - nlevs = nlevgrnd - do j = 1, nlevs - if (use_bedrock) then - nbedrock = col%nbedrock(c) - else - nbedrock = nlevsoi - endif - if (j > nbedrock) then - this%h2osoi_vol_col(c,j) = 0.0_r8 - else - this%h2osoi_vol_col(c,j) = 0.15_r8 - endif - end do - else if (lun%urbpoi(l)) then - if (col%itype(c) == icol_road_perv) then - nlevs = nlevgrnd - do j = 1, nlevs - if (j <= nlevsoi) then - this%h2osoi_vol_col(c,j) = 0.3_r8 - else - this%h2osoi_vol_col(c,j) = 0.0_r8 - end if - end do - else if (col%itype(c) == icol_road_imperv) then - nlevs = nlevgrnd - do j = 1, nlevs - this%h2osoi_vol_col(c,j) = 0.0_r8 - end do - else - nlevs = nlevurb - do j = 1, nlevs - this%h2osoi_vol_col(c,j) = 0.0_r8 - end do - end if - else if (lun%itype(l) == istwet) then - nlevs = nlevgrnd - do j = 1, nlevs - if (j > nlevsoi) then - this%h2osoi_vol_col(c,j) = 0.0_r8 - else - this%h2osoi_vol_col(c,j) = 1.0_r8 - endif - end do - else if (lun%itype(l) == istice_mec) then - nlevs = nlevgrnd - do j = 1, nlevs - this%h2osoi_vol_col(c,j) = 1.0_r8 - end do - endif - do j = 1, nlevs - this%h2osoi_vol_col(c,j) = min(this%h2osoi_vol_col(c,j), watsat_col(c,j)) - if (t_soisno_col(c,j) <= SHR_CONST_TKFRZ) then - this%h2osoi_ice_col(c,j) = col%dz(c,j)*denice*this%h2osoi_vol_col(c,j) - this%h2osoi_liq_col(c,j) = 0._r8 - else - this%h2osoi_ice_col(c,j) = 0._r8 - this%h2osoi_liq_col(c,j) = col%dz(c,j)*denh2o*this%h2osoi_vol_col(c,j) - endif - end do - do j = -nlevsno+1, 0 - if (j > snl(c)) then - this%h2osoi_ice_col(c,j) = col%dz(c,j)*250._r8 - this%h2osoi_liq_col(c,j) = 0._r8 - end if - end do - end if - end do - - - !-------------------------------------------- - ! Set Lake water - !-------------------------------------------- - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - - if (lun%lakpoi(l)) then - do j = -nlevsno+1, 0 - if (j > snl(c)) then - this%h2osoi_ice_col(c,j) = col%dz(c,j)*bdsno - this%h2osoi_liq_col(c,j) = 0._r8 - end if - end do - do j = 1,nlevgrnd - if (j <= nlevsoi) then ! soil - this%h2osoi_vol_col(c,j) = watsat_col(c,j) - this%h2osoi_liq_col(c,j) = spval - this%h2osoi_ice_col(c,j) = spval - else ! bedrock - this%h2osoi_vol_col(c,j) = 0._r8 - end if - end do - end if - end do - - !-------------------------------------------- - ! For frozen layers !TODO - does the following make sense ???? it seems to overwrite everything - !-------------------------------------------- - - do c = bounds%begc, bounds%endc - do j = 1,nlevgrnd - if (this%h2osoi_vol_col(c,j) /= spval) then - if (t_soisno_col(c,j) <= tfrz) then - this%h2osoi_ice_col(c,j) = col%dz(c,j)*denice*this%h2osoi_vol_col(c,j) - this%h2osoi_liq_col(c,j) = 0._r8 - else - this%h2osoi_ice_col(c,j) = 0._r8 - this%h2osoi_liq_col(c,j) = col%dz(c,j)*denh2o*this%h2osoi_vol_col(c,j) - endif - end if - end do - end do - - end associate - end subroutine InitCold !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag, & - watsat_col) + subroutine Restart(this, bounds, ncid, flag) ! ! !DESCRIPTION: ! Read/Write module information to/from restart file. ! ! !USES: - use spmdMod , only : masterproc - use clm_varcon , only : denice, denh2o, pondmx, watmin, spval, nameg - use landunit_varcon , only : istcrop, istdlak, istsoil - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_time_manager , only : is_first_step - use clm_varctl , only : bound_h2osoi - use ncdio_pio , only : file_desc_t, ncd_io, ncd_double + use ncdio_pio , only : file_desc_t, ncd_double use restUtilMod ! ! !ARGUMENTS: @@ -870,253 +110,16 @@ subroutine Restart(this, bounds, ncid, flag, & type(bounds_type), intent(in) :: bounds type(file_desc_t), intent(inout) :: ncid ! netcdf id character(len=*) , intent(in) :: flag ! 'read' or 'write' - real(r8) , intent(in) :: watsat_col (bounds%begc:, 1:) ! volumetric soil water at saturation (porosity) ! ! !LOCAL VARIABLES: - integer :: c,l,j,nlevs logical :: readvar - real(r8) :: maxwatsat ! maximum porosity - real(r8) :: excess ! excess volumetric soil water - real(r8) :: totwat ! total soil water (mm) !------------------------------------------------------------------------ - SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc,nlevgrnd/)) , errMsg(sourcefile, __LINE__)) - - call restartvar(ncid=ncid, flag=flag, varname='INT_SNOW', xtype=ncd_double, & - dim1name='column', & - long_name='accuumulated snow', units='mm', & - interpinic_flag='interp', readvar=readvar, data=this%int_snow_col) - if (flag=='read' .and. .not. readvar) then - this%int_snow_col(:) = 0.0_r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='H2OSFC', xtype=ncd_double, & - dim1name='column', & - long_name='surface water', units='kg/m2', & - interpinic_flag='interp', readvar=readvar, data=this%h2osfc_col) - if (flag=='read' .and. .not. readvar) then - this%h2osfc_col(bounds%begc:bounds%endc) = 0.0_r8 - end if - call restartvar(ncid=ncid, flag=flag, varname='H2OSNO', xtype=ncd_double, & dim1name='column', & long_name='snow water', units='kg/m2', & interpinic_flag='interp', readvar=readvar, data=this%h2osno_col) - call restartvar(ncid=ncid, flag=flag, varname='H2OSOI_LIQ', xtype=ncd_double, & - dim1name='column', dim2name='levtot', switchdim=.true., & - long_name='liquid water', units='kg/m2', & - interpinic_flag='interp', readvar=readvar, data=this%h2osoi_liq_col) - - call restartvar(ncid=ncid, flag=flag, varname='H2OSOI_ICE', xtype=ncd_double, & - dim1name='column', dim2name='levtot', switchdim=.true., & - long_name='ice lens', units='kg/m2', & - interpinic_flag='interp', readvar=readvar, data=this%h2osoi_ice_col) - - call restartvar(ncid=ncid, flag=flag, varname='H2OCAN', xtype=ncd_double, & - dim1name='pft', & - long_name='canopy water', units='kg/m2', & - interpinic_flag='interp', readvar=readvar, data=this%h2ocan_patch) - - call restartvar(ncid=ncid, flag=flag, varname='SNOCAN', xtype=ncd_double, & - dim1name='pft', & - long_name='canopy snow water', units='kg/m2', & - interpinic_flag='interp', readvar=readvar, data=this%snocan_patch) - - ! NOTE(wjs, 2015-07-01) In old restart files, there was no LIQCAN variable. However, - ! H2OCAN had similar meaning. So if we can't find LIQCAN, use H2OCAN to initialize - ! liqcan_patch. - call restartvar(ncid=ncid, flag=flag, varname='LIQCAN:H2OCAN', xtype=ncd_double, & - dim1name='pft', & - long_name='canopy liquid water', units='kg/m2', & - interpinic_flag='interp', readvar=readvar, data=this%liqcan_patch) - - call restartvar(ncid=ncid, flag=flag, varname='SNOUNLOAD', xtype=ncd_double, & - dim1name='pft', & - long_name='Canopy snow unloading', units='kg/m2', & - interpinic_flag='interp', readvar=readvar, data=this%snounload_patch) - - ! TWS is needed when methane is on and the TWS_inversion is used to get exact - ! restart. - call restartvar(ncid=ncid, flag=flag, varname='TWS', xtype=ncd_double, & - dim1name=nameg, & - long_name='Total Water Storage', units='mm', & - interpinic_flag='interp', readvar=readvar, data=this%tws_grc) - - if(use_luna)then - call restartvar(ncid=ncid, flag=flag, varname='rh10', xtype=ncd_double, & - dim1name='pft', long_name='10-day mean boundary layer relatie humidity', units='unitless', & - interpinic_flag='interp', readvar=readvar, data=this%rh10_af_patch) - endif - - ! Determine volumetric soil water (for read only) - if (flag == 'read' ) then - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if ( col%itype(c) == icol_sunwall .or. & - col%itype(c) == icol_shadewall .or. & - col%itype(c) == icol_roof )then - nlevs = nlevurb - else - nlevs = nlevgrnd - end if - if ( lun%itype(l) /= istdlak ) then ! This calculation is now done for lakes in initLake. - do j = 1,nlevs - this%h2osoi_vol_col(c,j) = this%h2osoi_liq_col(c,j)/(col%dz(c,j)*denh2o) & - + this%h2osoi_ice_col(c,j)/(col%dz(c,j)*denice) - end do - end if - end do - end if - - ! If initial run -- ensure that water is properly bounded (read only) - if (flag == 'read' ) then - if ( is_first_step() .and. bound_h2osoi) then - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if ( col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall .or. & - col%itype(c) == icol_roof )then - nlevs = nlevurb - else - nlevs = nlevgrnd - end if - do j = 1,nlevs - l = col%landunit(c) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%h2osoi_liq_col(c,j) = max(0._r8,this%h2osoi_liq_col(c,j)) - this%h2osoi_ice_col(c,j) = max(0._r8,this%h2osoi_ice_col(c,j)) - this%h2osoi_vol_col(c,j) = this%h2osoi_liq_col(c,j)/(col%dz(c,j)*denh2o) & - + this%h2osoi_ice_col(c,j)/(col%dz(c,j)*denice) - if (j == 1) then - maxwatsat = (watsat_col(c,j)*col%dz(c,j)*1000.0_r8 + pondmx) / (col%dz(c,j)*1000.0_r8) - else - maxwatsat = watsat_col(c,j) - end if - if (this%h2osoi_vol_col(c,j) > maxwatsat) then - excess = (this%h2osoi_vol_col(c,j) - maxwatsat)*col%dz(c,j)*1000.0_r8 - totwat = this%h2osoi_liq_col(c,j) + this%h2osoi_ice_col(c,j) - this%h2osoi_liq_col(c,j) = this%h2osoi_liq_col(c,j) - & - (this%h2osoi_liq_col(c,j)/totwat) * excess - this%h2osoi_ice_col(c,j) = this%h2osoi_ice_col(c,j) - & - (this%h2osoi_ice_col(c,j)/totwat) * excess - end if - this%h2osoi_liq_col(c,j) = max(watmin,this%h2osoi_liq_col(c,j)) - this%h2osoi_ice_col(c,j) = max(watmin,this%h2osoi_ice_col(c,j)) - this%h2osoi_vol_col(c,j) = this%h2osoi_liq_col(c,j)/(col%dz(c,j)*denh2o) & - + this%h2osoi_ice_col(c,j)/(col%dz(c,j)*denice) - end if - end do - end do - end if - - endif ! end if if-read flag - - call restartvar(ncid=ncid, flag=flag, varname='FH2OSFC', xtype=ncd_double, & - dim1name='column',& - long_name='fraction of ground covered by h2osfc (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frac_h2osfc_col) - if (flag == 'read' .and. .not. readvar) then - this%frac_h2osfc_col(bounds%begc:bounds%endc) = 0.0_r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='SNOW_DEPTH', xtype=ncd_double, & - dim1name='column', & - long_name='snow depth', units='m', & - interpinic_flag='interp', readvar=readvar, data=this%snow_depth_col) - - call restartvar(ncid=ncid, flag=flag, varname='SNOW_PERS', xtype=ncd_double, & - dim1name='column', & - long_name='continuous snow cover time', units='sec', & - interpinic_flag='interp', readvar=readvar, data=this%snow_persistence_col) - if (flag=='read' .and. .not. readvar) then - this%snow_persistence_col(:) = 0.0_r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='frac_sno_eff', xtype=ncd_double, & - dim1name='column', & - long_name='fraction of ground covered by snow (0 to 1)',units='unitless', & - interpinic_flag='interp', readvar=readvar, data=this%frac_sno_eff_col) - if (flag == 'read' .and. .not. readvar) then - this%frac_sno_eff_col(bounds%begc:bounds%endc) = 0.0_r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='frac_sno', xtype=ncd_double, & - dim1name='column', & - long_name='fraction of ground covered by snow (0 to 1)',units='unitless',& - interpinic_flag='interp', readvar=readvar, data=this%frac_sno_col) - - call restartvar(ncid=ncid, flag=flag, varname='FWET', xtype=ncd_double, & - dim1name='pft', & - long_name='fraction of canopy that is wet (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fwet_patch) - - call restartvar(ncid=ncid, flag=flag, varname='FCANSNO', xtype=ncd_double, & - dim1name='pft', & - long_name='fraction of canopy that is snow covered (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fcansno_patch) - - ! column type physical state variable - snw_rds - call restartvar(ncid=ncid, flag=flag, varname='snw_rds', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno+1, upperb2=0, & - long_name='snow layer effective radius', units='um', & - interpinic_flag='interp', readvar=readvar, data=this%snw_rds_col) - if (flag == 'read' .and. .not. readvar) then - - ! initial run, not restart: initialize snw_rds - if (masterproc) then - write(iulog,*) "SNICAR: This is an initial run (not a restart), and grain size/aerosol " // & - "mass data are not defined in initial condition file. Initialize snow " // & - "effective radius to fresh snow value, and snow/aerosol masses to zero." - endif - - do c= bounds%begc, bounds%endc - if (col%snl(c) < 0) then - this%snw_rds_col(c,col%snl(c)+1:0) = snw_rds_min - this%snw_rds_col(c,-nlevsno+1:col%snl(c)) = 0._r8 - this%snw_rds_top_col(c) = snw_rds_min - this%sno_liq_top_col(c) = this%h2osoi_liq_col(c,col%snl(c)+1) / & - (this%h2osoi_liq_col(c,col%snl(c)+1)+this%h2osoi_ice_col(c,col%snl(c)+1)) - elseif (this%h2osno_col(c) > 0._r8) then - this%snw_rds_col(c,0) = snw_rds_min - this%snw_rds_col(c,-nlevsno+1:-1) = 0._r8 - this%snw_rds_top_col(c) = spval - this%sno_liq_top_col(c) = spval - else - this%snw_rds_col(c,:) = 0._r8 - this%snw_rds_top_col(c) = spval - this%sno_liq_top_col(c) = spval - endif - enddo - endif - - call restartvar(ncid=ncid, flag=flag, varname='qaf', xtype=ncd_double, dim1name='landunit', & - long_name='urban canopy specific humidity', units='kg/kg', & - interpinic_flag='interp', readvar=readvar, data=this%qaf_lun) - - if (use_cn) then - call restartvar(ncid=ncid, flag=flag, varname='wf', xtype=ncd_double, & - dim1name='column', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%wf_col) - end if - - - end subroutine Restart - !----------------------------------------------------------------------- - subroutine Reset(this, column) - ! - ! !DESCRIPTION: - ! Intitialize SNICAR variables for fresh snow column - ! - ! !ARGUMENTS: - class(waterstate_type) :: this - integer , intent(in) :: column ! column index - !----------------------------------------------------------------------- - - this%snw_rds_col(column,0) = snw_rds_min - - end subroutine Reset - end module WaterstateType diff --git a/src/biogeophys/WaterfluxType.F90 b/src/biogeophys/WaterfluxType.F90 deleted file mode 100644 index 5541ab39ad..0000000000 --- a/src/biogeophys/WaterfluxType.F90 +++ /dev/null @@ -1,721 +0,0 @@ -module WaterfluxType - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : nlevsno, nlevsoi - use clm_varcon , only : spval - use decompMod , only : bounds_type - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use CNSharedParamsMod , only : use_fun - ! - implicit none - private - ! - ! !PUBLIC TYPES: - type, public :: waterflux_type - - ! water fluxes are in units or mm/s - - real(r8), pointer :: qflx_prec_grnd_patch (:) ! patch water onto ground including canopy runoff [kg/(m2 s)] - real(r8), pointer :: qflx_prec_grnd_col (:) ! col water onto ground including canopy runoff [kg/(m2 s)] - real(r8), pointer :: qflx_rain_grnd_patch (:) ! patch rain on ground after interception (mm H2O/s) [+] - real(r8), pointer :: qflx_rain_grnd_col (:) ! col rain on ground after interception (mm H2O/s) [+] - real(r8), pointer :: qflx_snow_grnd_patch (:) ! patch snow on ground after interception (mm H2O/s) [+] - real(r8), pointer :: qflx_snow_grnd_col (:) ! col snow on ground after interception (mm H2O/s) [+] - real(r8), pointer :: qflx_sub_snow_patch (:) ! patch sublimation rate from snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_sub_snow_col (:) ! col sublimation rate from snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_evap_soi_patch (:) ! patch soil evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_soi_col (:) ! col soil evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_veg_patch (:) ! patch vegetation evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_veg_col (:) ! col vegetation evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_can_patch (:) ! patch evaporation from leaves and stems (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_can_col (:) ! col evaporation from leaves and stems (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_tot_patch (:) ! patch pft_qflx_evap_soi + pft_qflx_evap_veg + qflx_tran_veg - real(r8), pointer :: qflx_evap_tot_col (:) ! col col_qflx_evap_soi + col_qflx_evap_veg + qflx_tran_veg - real(r8), pointer :: qflx_evap_grnd_patch (:) ! patch ground surface evaporation rate (mm H2O/s) [+] - real(r8), pointer :: qflx_evap_grnd_col (:) ! col ground surface evaporation rate (mm H2O/s) [+] - real(r8), pointer :: qflx_phs_neg_col (:) ! col sum of negative hydraulic redistribution fluxes (mm H2O/s) [+] - - ! In the snow capping parametrization excess mass above h2osno_max is removed. A breakdown of mass into liquid - ! and solid fluxes is done, these are represented by qflx_snwcp_liq_col and qflx_snwcp_ice_col. - real(r8), pointer :: qflx_snwcp_liq_col (:) ! col excess liquid h2o due to snow capping (outgoing) (mm H2O /s) - real(r8), pointer :: qflx_snwcp_ice_col (:) ! col excess solid h2o due to snow capping (outgoing) (mm H2O /s) - real(r8), pointer :: qflx_snwcp_discarded_liq_col(:) ! col excess liquid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) - real(r8), pointer :: qflx_snwcp_discarded_ice_col(:) ! col excess solid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) - - real(r8), pointer :: qflx_tran_veg_patch (:) ! patch vegetation transpiration (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_tran_veg_col (:) ! col vegetation transpiration (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_dew_snow_patch (:) ! patch surface dew added to snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_dew_snow_col (:) ! col surface dew added to snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_dew_grnd_patch (:) ! patch ground surface dew formation (mm H2O /s) [+] - real(r8), pointer :: qflx_dew_grnd_col (:) ! col ground surface dew formation (mm H2O /s) [+] (+ = to atm); usually eflx_bot >= 0) - real(r8), pointer :: qflx_prec_intr_patch (:) ! patch interception of precipitation [mm/s] - real(r8), pointer :: qflx_prec_intr_col (:) ! col interception of precipitation [mm/s] - real(r8), pointer :: qflx_snowindunload_patch (:) ! patch canopy snow wind unloading (mm H2O /s) - real(r8), pointer :: qflx_snowindunload_col (:) ! col canopy snow wind unloading (mm H2O /s) - real(r8), pointer :: qflx_snotempunload_patch (:) ! patch canopy snow temp unloading (mm H2O /s) - real(r8), pointer :: qflx_snotempunload_col (:) ! col canopy snow temp unloading (mm H2O /s) - - real(r8), pointer :: qflx_ev_snow_patch (:) ! patch evaporation heat flux from snow (mm H2O/s) [+ to atm] - real(r8), pointer :: qflx_ev_snow_col (:) ! col evaporation heat flux from snow (mm H2O/s) [+ to atm] - real(r8), pointer :: qflx_ev_soil_patch (:) ! patch evaporation heat flux from soil (mm H2O/s) [+ to atm] - real(r8), pointer :: qflx_ev_soil_col (:) ! col evaporation heat flux from soil (mm H2O/s) [+ to atm] - real(r8), pointer :: qflx_ev_h2osfc_patch (:) ! patch evaporation heat flux from soil (mm H2O/s) [+ to atm] - real(r8), pointer :: qflx_ev_h2osfc_col (:) ! col evaporation heat flux from soil (mm H2O/s) [+ to atm] - - real(r8), pointer :: qflx_adv_col (:,:) ! col advective flux across different soil layer interfaces [mm H2O/s] [+ downward] - real(r8), pointer :: qflx_rootsoi_col (:,:) ! col root and soil water exchange [mm H2O/s] [+ into root] - real(r8), pointer :: qflx_infl_col (:) ! col infiltration (mm H2O /s) - real(r8), pointer :: qflx_surf_col (:) ! col surface runoff (mm H2O /s) - real(r8), pointer :: qflx_drain_col (:) ! col sub-surface runoff (mm H2O /s) - real(r8), pointer :: qflx_top_soil_col (:) ! col net water input into soil from top (mm/s) - real(r8), pointer :: qflx_h2osfc_to_ice_col (:) ! col conversion of h2osfc to ice - real(r8), pointer :: qflx_h2osfc_surf_col (:) ! col surface water runoff - real(r8), pointer :: qflx_snow_h2osfc_col (:) ! col snow falling on surface water - real(r8), pointer :: qflx_drain_perched_col (:) ! col sub-surface runoff from perched wt (mm H2O /s) - real(r8), pointer :: qflx_deficit_col (:) ! col water deficit to keep non-negative liquid water content (mm H2O) - real(r8), pointer :: qflx_floodc_col (:) ! col flood water flux at column level - real(r8), pointer :: qflx_sl_top_soil_col (:) ! col liquid water + ice from layer above soil to top soil layer or sent to qflx_qrgwl (mm H2O/s) - real(r8), pointer :: qflx_snomelt_col (:) ! col snow melt (mm H2O /s) - real(r8), pointer :: qflx_snomelt_lyr_col (:,:) ! col snow melt in each layer (mm H2O /s) - real(r8), pointer :: qflx_snow_drain_col (:) ! col drainage from snow pack - real(r8), pointer :: qflx_qrgwl_col (:) ! col qflx_surf at glaciers, wetlands, lakes - real(r8), pointer :: qflx_runoff_col (:) ! col total runoff (qflx_drain+qflx_surf+qflx_qrgwl) (mm H2O /s) - real(r8), pointer :: qflx_runoff_r_col (:) ! col Rural total runoff (qflx_drain+qflx_surf+qflx_qrgwl) (mm H2O /s) - real(r8), pointer :: qflx_runoff_u_col (:) ! col urban total runoff (qflx_drain+qflx_surf) (mm H2O /s) - real(r8), pointer :: qflx_ice_runoff_snwcp_col(:) ! col solid runoff from snow capping (mm H2O /s) - real(r8), pointer :: qflx_ice_runoff_xs_col (:) ! col solid runoff from excess ice in soil (mm H2O /s) - real(r8), pointer :: qflx_rsub_sat_col (:) ! col soil saturation excess [mm/s] - real(r8), pointer :: qflx_snofrz_lyr_col (:,:) ! col snow freezing rate (positive definite) (col,lyr) [kg m-2 s-1] - real(r8), pointer :: qflx_snofrz_col (:) ! col column-integrated snow freezing rate (positive definite) (col) [kg m-2 s-1] - real(r8), pointer :: qflx_drain_vr_col (:,:) ! col liquid water losted as drainage (m /time step) - real(r8), pointer :: snow_sources_col (:) ! col snow sources (mm H2O/s) - real(r8), pointer :: snow_sinks_col (:) ! col snow sinks (mm H2O/s) - - ! Dynamic land cover change - real(r8), pointer :: qflx_liq_dynbal_grc (:) ! grc liq dynamic land cover change conversion runoff flux - real(r8), pointer :: qflx_ice_dynbal_grc (:) ! grc ice dynamic land cover change conversion runoff flux - - ! ET accumulation - real(r8), pointer :: AnnEt (:) ! Annual average ET flux mmH20/s - - - contains - - - - procedure, public :: Init - procedure, public :: Restart - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - procedure, public :: InitAccBuffer - procedure, public :: InitAccVars - procedure, public :: UpdateAccVars - - end type waterflux_type - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(waterflux_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate(bounds) ! same as "call initAllocate_type(hydro, bounds)" - call this%InitHistory(bounds) - call this%InitCold(bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - ! - ! !ARGUMENTS: - class(waterflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begg, endg - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - allocate(this%qflx_prec_intr_patch (begp:endp)) ; this%qflx_prec_intr_patch (:) = nan - allocate(this%qflx_prec_grnd_patch (begp:endp)) ; this%qflx_prec_grnd_patch (:) = nan - allocate(this%qflx_rain_grnd_patch (begp:endp)) ; this%qflx_rain_grnd_patch (:) = nan - allocate(this%qflx_snow_grnd_patch (begp:endp)) ; this%qflx_snow_grnd_patch (:) = nan - allocate(this%qflx_sub_snow_patch (begp:endp)) ; this%qflx_sub_snow_patch (:) = 0.0_r8 - allocate(this%qflx_tran_veg_patch (begp:endp)) ; this%qflx_tran_veg_patch (:) = nan - - allocate(this%qflx_snowindunload_patch (begp:endp)) ; this%qflx_snowindunload_patch (:) = nan - allocate(this%qflx_snowindunload_col (begp:endp)) ; this%qflx_snowindunload_col (:) = nan - allocate(this%qflx_snotempunload_patch (begp:endp)) ; this%qflx_snotempunload_patch (:) = nan - allocate(this%qflx_snotempunload_col (begp:endp)) ; this%qflx_snotempunload_col (:) = nan - - allocate(this%qflx_dew_grnd_patch (begp:endp)) ; this%qflx_dew_grnd_patch (:) = nan - allocate(this%qflx_dew_snow_patch (begp:endp)) ; this%qflx_dew_snow_patch (:) = nan - - allocate(this%qflx_prec_intr_col (begc:endc)) ; this%qflx_prec_intr_col (:) = nan - allocate(this%qflx_prec_grnd_col (begc:endc)) ; this%qflx_prec_grnd_col (:) = nan - allocate(this%qflx_rain_grnd_col (begc:endc)) ; this%qflx_rain_grnd_col (:) = nan - allocate(this%qflx_snow_grnd_col (begc:endc)) ; this%qflx_snow_grnd_col (:) = nan - allocate(this%qflx_sub_snow_col (begc:endc)) ; this%qflx_sub_snow_col (:) = 0.0_r8 - allocate(this%qflx_snwcp_liq_col (begc:endc)) ; this%qflx_snwcp_liq_col (:) = nan - allocate(this%qflx_snwcp_ice_col (begc:endc)) ; this%qflx_snwcp_ice_col (:) = nan - allocate(this%qflx_snwcp_discarded_liq_col(begc:endc)) ; this%qflx_snwcp_discarded_liq_col(:) = nan - allocate(this%qflx_snwcp_discarded_ice_col(begc:endc)) ; this%qflx_snwcp_discarded_ice_col(:) = nan - allocate(this%qflx_tran_veg_col (begc:endc)) ; this%qflx_tran_veg_col (:) = nan - allocate(this%qflx_evap_veg_col (begc:endc)) ; this%qflx_evap_veg_col (:) = nan - allocate(this%qflx_evap_can_col (begc:endc)) ; this%qflx_evap_can_col (:) = nan - allocate(this%qflx_evap_soi_col (begc:endc)) ; this%qflx_evap_soi_col (:) = nan - allocate(this%qflx_evap_tot_col (begc:endc)) ; this%qflx_evap_tot_col (:) = nan - allocate(this%qflx_evap_grnd_col (begc:endc)) ; this%qflx_evap_grnd_col (:) = nan - allocate(this%qflx_dew_grnd_col (begc:endc)) ; this%qflx_dew_grnd_col (:) = nan - allocate(this%qflx_dew_snow_col (begc:endc)) ; this%qflx_dew_snow_col (:) = nan - allocate(this%qflx_evap_veg_patch (begp:endp)) ; this%qflx_evap_veg_patch (:) = nan - allocate(this%qflx_evap_can_patch (begp:endp)) ; this%qflx_evap_can_patch (:) = nan - allocate(this%qflx_evap_soi_patch (begp:endp)) ; this%qflx_evap_soi_patch (:) = nan - allocate(this%qflx_evap_tot_patch (begp:endp)) ; this%qflx_evap_tot_patch (:) = nan - allocate(this%qflx_evap_grnd_patch (begp:endp)) ; this%qflx_evap_grnd_patch (:) = nan - allocate(this%qflx_phs_neg_col (begc:endc)) ; this%qflx_phs_neg_col (:) = nan - - allocate( this%qflx_ev_snow_patch (begp:endp)) ; this%qflx_ev_snow_patch (:) = nan - allocate( this%qflx_ev_snow_col (begc:endc)) ; this%qflx_ev_snow_col (:) = nan - allocate( this%qflx_ev_soil_patch (begp:endp)) ; this%qflx_ev_soil_patch (:) = nan - allocate( this%qflx_ev_soil_col (begc:endc)) ; this%qflx_ev_soil_col (:) = nan - allocate( this%qflx_ev_h2osfc_patch (begp:endp)) ; this%qflx_ev_h2osfc_patch (:) = nan - allocate( this%qflx_ev_h2osfc_col (begc:endc)) ; this%qflx_ev_h2osfc_col (:) = nan - - allocate(this%qflx_drain_vr_col (begc:endc,1:nlevsoi)) ; this%qflx_drain_vr_col (:,:) = nan - allocate(this%qflx_adv_col (begc:endc,0:nlevsoi)) ; this%qflx_adv_col (:,:) = nan - allocate(this%qflx_rootsoi_col (begc:endc,1:nlevsoi)) ; this%qflx_rootsoi_col (:,:) = nan - allocate(this%qflx_infl_col (begc:endc)) ; this%qflx_infl_col (:) = nan - allocate(this%qflx_surf_col (begc:endc)) ; this%qflx_surf_col (:) = nan - allocate(this%qflx_drain_col (begc:endc)) ; this%qflx_drain_col (:) = nan - allocate(this%qflx_top_soil_col (begc:endc)) ; this%qflx_top_soil_col (:) = nan - allocate(this%qflx_h2osfc_to_ice_col (begc:endc)) ; this%qflx_h2osfc_to_ice_col (:) = nan - allocate(this%qflx_h2osfc_surf_col (begc:endc)) ; this%qflx_h2osfc_surf_col (:) = nan - allocate(this%qflx_snow_h2osfc_col (begc:endc)) ; this%qflx_snow_h2osfc_col (:) = nan - allocate(this%qflx_snomelt_col (begc:endc)) ; this%qflx_snomelt_col (:) = nan - allocate(this%qflx_snomelt_lyr_col (begc:endc,-nlevsno+1:0)) ; this%qflx_snomelt_lyr_col (:,:) = nan - allocate(this%qflx_snow_drain_col (begc:endc)) ; this%qflx_snow_drain_col (:) = nan - allocate(this%qflx_snofrz_col (begc:endc)) ; this%qflx_snofrz_col (:) = nan - allocate(this%qflx_snofrz_lyr_col (begc:endc,-nlevsno+1:0)) ; this%qflx_snofrz_lyr_col (:,:) = nan - allocate(this%qflx_qrgwl_col (begc:endc)) ; this%qflx_qrgwl_col (:) = nan - allocate(this%qflx_drain_perched_col (begc:endc)) ; this%qflx_drain_perched_col (:) = nan - allocate(this%qflx_deficit_col (begc:endc)) ; this%qflx_deficit_col (:) = nan - allocate(this%qflx_floodc_col (begc:endc)) ; this%qflx_floodc_col (:) = nan - allocate(this%qflx_sl_top_soil_col (begc:endc)) ; this%qflx_sl_top_soil_col (:) = nan - allocate(this%qflx_runoff_col (begc:endc)) ; this%qflx_runoff_col (:) = nan - allocate(this%qflx_runoff_r_col (begc:endc)) ; this%qflx_runoff_r_col (:) = nan - allocate(this%qflx_runoff_u_col (begc:endc)) ; this%qflx_runoff_u_col (:) = nan - allocate(this%qflx_ice_runoff_snwcp_col(begc:endc)) ; this%qflx_ice_runoff_snwcp_col(:) = nan - allocate(this%qflx_ice_runoff_xs_col (begc:endc)) ; this%qflx_ice_runoff_xs_col (:) = nan - allocate(this%qflx_rsub_sat_col (begc:endc)) ; this%qflx_rsub_sat_col (:) = nan - allocate(this%snow_sources_col (begc:endc)) ; this%snow_sources_col (:) = nan - allocate(this%snow_sinks_col (begc:endc)) ; this%snow_sinks_col (:) = nan - - allocate(this%qflx_liq_dynbal_grc (begg:endg)) ; this%qflx_liq_dynbal_grc (:) = nan - allocate(this%qflx_ice_dynbal_grc (begg:endg)) ; this%qflx_ice_dynbal_grc (:) = nan - allocate(this%AnnET (begc:endc)) ; this%AnnET (:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !USES: - use clm_varctl , only : use_cn - use histFileMod , only : hist_addfld1d, hist_addfld2d, no_snow_normal - ! - ! !ARGUMENTS: - class(waterflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begg, endg - character(10) :: active - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - this%qflx_top_soil_col(begc:endc) = spval - call hist_addfld1d (fname='QTOPSOIL', units='mm/s', & - avgflag='A', long_name='water input to surface', & - ptr_col=this%qflx_top_soil_col, c2l_scale_type='urbanf', default='inactive') - - this%qflx_infl_col(begc:endc) = spval - call hist_addfld1d (fname='QINFL', units='mm/s', & - avgflag='A', long_name='infiltration', & - ptr_col=this%qflx_infl_col, c2l_scale_type='urbanf', default='inactive') - - this%qflx_surf_col(begc:endc) = spval - call hist_addfld1d (fname='QOVER', units='mm/s', & - avgflag='A', long_name='surface runoff', & - ptr_col=this%qflx_surf_col, c2l_scale_type='urbanf', default='inactive') - - this%qflx_qrgwl_col(begc:endc) = spval - call hist_addfld1d (fname='QRGWL', units='mm/s', & - avgflag='A', & - long_name='surface runoff at glaciers (liquid only), wetlands, lakes; also includes melted ice runoff from QSNWCPICE', & - ptr_col=this%qflx_qrgwl_col, c2l_scale_type='urbanf', default='inactive') - - this%qflx_drain_col(begc:endc) = spval - call hist_addfld1d (fname='QDRAI', units='mm/s', & - avgflag='A', long_name='sub-surface drainage', & - ptr_col=this%qflx_drain_col, c2l_scale_type='urbanf', default='inactive') - - this%qflx_liq_dynbal_grc(begg:endg) = spval - call hist_addfld1d (fname='QFLX_LIQ_DYNBAL', units='mm/s', & - avgflag='A', long_name='liq dynamic land cover change conversion runoff flux', & - ptr_lnd=this%qflx_liq_dynbal_grc, default='inactive') - - this%qflx_ice_dynbal_grc(begg:endg) = spval - call hist_addfld1d (fname='QFLX_ICE_DYNBAL', units='mm/s', & - avgflag='A', long_name='ice dynamic land cover change conversion runoff flux', & - ptr_lnd=this%qflx_ice_dynbal_grc, default='inactive') - - this%qflx_runoff_col(begc:endc) = spval - call hist_addfld1d (fname='QRUNOFF', units='mm/s', & - avgflag='A', & - long_name='total liquid runoff not including correction for land use change', & - ptr_col=this%qflx_runoff_col, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='QRUNOFF_ICE', units='mm/s', avgflag='A', & - long_name='total liquid runoff not incl corret for LULCC (ice landunits only)', & - ptr_col=this%qflx_runoff_col, c2l_scale_type='urbanf', l2g_scale_type='ice', default='inactive') - - this%qflx_runoff_u_col(begc:endc) = spval - call hist_addfld1d (fname='QRUNOFF_U', units='mm/s', & - avgflag='A', long_name='Urban total runoff', & - ptr_col=this%qflx_runoff_u_col, set_nourb=spval, c2l_scale_type='urbanf', default='inactive') - - this%qflx_runoff_r_col(begc:endc) = spval - call hist_addfld1d (fname='QRUNOFF_R', units='mm/s', & - avgflag='A', long_name='Rural total runoff', & - ptr_col=this%qflx_runoff_r_col, set_spec=spval, default='inactive') - - this%qflx_snow_drain_col(begc:endc) = spval - call hist_addfld1d (fname='QFLX_SNOW_DRAIN', units='mm/s', & - avgflag='A', long_name='drainage from snow pack', & - ptr_col=this%qflx_snow_drain_col, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='QFLX_SNOW_DRAIN_ICE', units='mm/s', & - avgflag='A', long_name='drainage from snow pack melt (ice landunits only)', & - ptr_col=this%qflx_snow_drain_col, c2l_scale_type='urbanf', l2g_scale_type='ice', default='inactive') - - this%qflx_snomelt_col(begc:endc) = spval - call hist_addfld1d (fname='QSNOMELT', units='mm/s', & - avgflag='A', long_name='snow melt rate', & - ptr_col=this%qflx_snomelt_col, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='QSNOMELT_ICE', units='mm/s', & - avgflag='A', long_name='snow melt (ice landunits only)', & - ptr_col=this%qflx_snomelt_col, c2l_scale_type='urbanf', l2g_scale_type='ice', default='inactive') - - this%qflx_snomelt_lyr_col(begc:endc,-nlevsno+1:0) = spval - data2dptr => this%qflx_snomelt_lyr_col(begc:endc,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_MELT', units='mm/s', type2d='levsno', & - avgflag='A', long_name='snow melt rate in each snow layer', & - ptr_col=data2dptr, c2l_scale_type='urbanf',no_snow_behavior=no_snow_normal, default='inactive') - - call hist_addfld2d (fname='SNO_MELT_ICE', units='mm/s', type2d='levsno', & - avgflag='A', long_name='snow melt rate in each snow layer (ice landunits only)', & - ptr_col=data2dptr, c2l_scale_type='urbanf',no_snow_behavior=no_snow_normal, & - l2g_scale_type='ice', default='inactive') - - this%qflx_snofrz_col(begc:endc) = spval - call hist_addfld1d (fname='QSNOFRZ', units='kg/m2/s', & - avgflag='A', long_name='column-integrated snow freezing rate', & - ptr_col=this%qflx_snofrz_col, set_lake=spval, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='QSNOFRZ_ICE', units='mm/s', & - avgflag='A', long_name='column-integrated snow freezing rate (ice landunits only)', & - ptr_col=this%qflx_snofrz_col, c2l_scale_type='urbanf', l2g_scale_type='ice', default='inactive') - - this%qflx_snofrz_lyr_col(begc:endc,-nlevsno+1:0) = spval - data2dptr => this%qflx_snofrz_lyr_col(begc:endc,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_FRZ', units='kg/m2/s', type2d='levsno', & - avgflag='A', long_name='snow freezing rate in each snow layer', & - ptr_col=data2dptr, c2l_scale_type='urbanf',no_snow_behavior=no_snow_normal, default='inactive') - - call hist_addfld2d (fname='SNO_FRZ_ICE', units='mm/s', type2d='levsno', & - avgflag='A', long_name='snow freezing rate in each snow layer (ice landunits only)', & - ptr_col=data2dptr, c2l_scale_type='urbanf',no_snow_behavior=no_snow_normal, & - l2g_scale_type='ice', default='inactive') - - this%qflx_h2osfc_to_ice_col(begc:endc) = spval - call hist_addfld1d (fname='QH2OSFC_TO_ICE', units='mm/s', & - avgflag='A', long_name='surface water converted to ice', & - ptr_col=this%qflx_h2osfc_to_ice_col, default='inactive') - - this%qflx_prec_intr_patch(begp:endp) = spval - call hist_addfld1d (fname='QINTR', units='mm/s', & - avgflag='A', long_name='interception', & - ptr_patch=this%qflx_prec_intr_patch, set_lake=0._r8, default='inactive') - - this%qflx_prec_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='QDRIP', units='mm/s', & - avgflag='A', long_name='throughfall', & - ptr_patch=this%qflx_prec_grnd_patch, c2l_scale_type='urbanf', default='inactive') - - this%qflx_evap_soi_patch(begp:endp) = spval - call hist_addfld1d (fname='QSOIL', units='mm/s', & - avgflag='A', long_name= 'Ground evaporation (soil/snow evaporation + soil/snow sublimation - dew)', & - ptr_patch=this%qflx_evap_soi_patch, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='QSOIL_ICE', units='mm/s', & - avgflag='A', long_name='Ground evaporation (ice landunits only)', & - ptr_patch=this%qflx_evap_soi_patch, c2l_scale_type='urbanf', l2g_scale_type='ice', default='inactive') - - call hist_addfld2d (fname='QROOTSINK', units='mm/s', type2d='levsoi', & - avgflag='A', long_name='water flux from soil to root in each soil-layer', & - ptr_col=this%qflx_rootsoi_col, set_spec=spval, l2g_scale_type='veg', default='inactive') - - this%qflx_evap_can_patch(begp:endp) = spval - call hist_addfld1d (fname='QVEGE', units='mm/s', & - avgflag='A', long_name='canopy evaporation', & - ptr_patch=this%qflx_evap_can_patch, set_lake=0._r8, c2l_scale_type='urbanf', default='inactive') - - this%qflx_tran_veg_patch(begp:endp) = spval - call hist_addfld1d (fname='QVEGT', units='mm/s', & - avgflag='A', long_name='canopy transpiration', & - ptr_patch=this%qflx_tran_veg_patch, set_lake=0._r8, c2l_scale_type='urbanf', default='inactive') - - this%qflx_ev_snow_patch(begp:endp) = spval - call hist_addfld1d (fname='QSNOEVAP', units='mm/s', & - avgflag='A', long_name='evaporation from snow', & - ptr_patch=this%qflx_tran_veg_patch, set_lake=0._r8, c2l_scale_type='urbanf', default='inactive') - - this%qflx_snowindunload_patch(begp:endp) = spval - call hist_addfld1d (fname='QSNO_WINDUNLOAD', units='mm/s', & - avgflag='A', long_name='canopy snow wind unloading', & - ptr_patch=this%qflx_snowindunload_patch, set_lake=0._r8, c2l_scale_type='urbanf', default='inactive') - - this%qflx_snotempunload_patch(begp:endp) = spval - call hist_addfld1d (fname='QSNO_TEMPUNLOAD', units='mm/s', & - avgflag='A', long_name='canopy snow temp unloading', & - ptr_patch=this%qflx_snotempunload_patch, set_lake=0._r8, c2l_scale_type='urbanf', default='inactive') - - this%qflx_snwcp_liq_col(begc:endc) = spval - call hist_addfld1d (fname='QSNOCPLIQ', units='mm H2O/s', & - avgflag='A', long_name='excess liquid h2o due to snow capping not including correction for land use change', & - ptr_col=this%qflx_snwcp_liq_col, c2l_scale_type='urbanf', default='inactive') - - this%qflx_snwcp_ice_col(begc:endc) = spval - call hist_addfld1d (fname='QSNWCPICE', units='mm H2O/s', & - avgflag='A', long_name='excess solid h2o due to snow capping not including correction for land use change', & - ptr_col=this%qflx_snwcp_ice_col, c2l_scale_type='urbanf', default='inactive') - - this%qflx_rain_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='QFLX_RAIN_GRND', units='mm H2O/s', & - avgflag='A', long_name='rain on ground after interception', & - ptr_patch=this%qflx_rain_grnd_patch, default='inactive', c2l_scale_type='urbanf') - - this%qflx_snow_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='QFLX_SNOW_GRND', units='mm H2O/s', & - avgflag='A', long_name='snow on ground after interception', & - ptr_patch=this%qflx_snow_grnd_patch, default='inactive', c2l_scale_type='urbanf') - - this%qflx_evap_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='QFLX_EVAP_GRND', units='mm H2O/s', & - avgflag='A', long_name='ground surface evaporation', & - ptr_patch=this%qflx_evap_grnd_patch, default='inactive', c2l_scale_type='urbanf') - - this%qflx_evap_veg_patch(begp:endp) = spval - call hist_addfld1d (fname='QFLX_EVAP_VEG', units='mm H2O/s', & - avgflag='A', long_name='vegetation evaporation', & - ptr_patch=this%qflx_evap_veg_patch, default='inactive', c2l_scale_type='urbanf') - - this%qflx_evap_tot_patch(begp:endp) = spval - call hist_addfld1d (fname='QFLX_EVAP_TOT', units='mm H2O/s', & - avgflag='A', long_name='qflx_evap_soi + qflx_evap_can + qflx_tran_veg', & - ptr_patch=this%qflx_evap_tot_patch, c2l_scale_type='urbanf', default='inactive') - - this%qflx_dew_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='QFLX_DEW_GRND', units='mm H2O/s', & - avgflag='A', long_name='ground surface dew formation', & - ptr_patch=this%qflx_dew_grnd_patch, c2l_scale_type='urbanf', default='inactive') - - this%qflx_sub_snow_patch(begp:endp) = spval - call hist_addfld1d (fname='QFLX_SUB_SNOW', units='mm H2O/s', & - avgflag='A', long_name='sublimation rate from snow pack', & - ptr_patch=this%qflx_sub_snow_patch, c2l_scale_type='urbanf', default='inactive') - - this%qflx_dew_snow_patch(begp:endp) = spval - call hist_addfld1d (fname='QFLX_DEW_SNOW', units='mm H2O/s', & - avgflag='A', long_name='surface dew added to snow pacK', & - ptr_patch=this%qflx_dew_snow_patch, c2l_scale_type='urbanf', default='inactive') - - this%qflx_h2osfc_surf_col(begc:endc) = spval - call hist_addfld1d (fname='QH2OSFC', units='mm/s', & - avgflag='A', long_name='surface water runoff', & - ptr_col=this%qflx_h2osfc_surf_col, default='inactive') - - this%qflx_drain_perched_col(begc:endc) = spval - call hist_addfld1d (fname='QDRAI_PERCH', units='mm/s', & - avgflag='A', long_name='perched wt drainage', & - ptr_col=this%qflx_drain_perched_col, c2l_scale_type='urbanf', default='inactive') - - this%qflx_rsub_sat_col(begc:endc) = spval - call hist_addfld1d (fname='QDRAI_XS', units='mm/s', & - avgflag='A', long_name='saturation excess drainage', & - ptr_col=this%qflx_rsub_sat_col, c2l_scale_type='urbanf', default='inactive') - - this%qflx_phs_neg_col(begc:endc) = spval - call hist_addfld1d (fname='QPHSNEG', units='mm/s', & - avgflag='A', long_name='net negative hydraulic redistribution flux', & - ptr_col=this%qflx_phs_neg_col, default='inactive') - - ! As defined here, snow_sources - snow_sinks will equal the change in h2osno at any - ! given time step but only if there is at least one snow layer (for all landunits - ! except lakes). Also note that monthly average files of snow_sources and snow_sinks - ! sinks must be weighted by number of days in the month to diagnose, for example, an - ! annual value of the change in h2osno. - - this%snow_sources_col(begc:endc) = spval - call hist_addfld1d (fname='SNOW_SOURCES', units='mm/s', & - avgflag='A', long_name='snow sources (liquid water)', & - ptr_col=this%snow_sources_col, c2l_scale_type='urbanf', default='inactive') - - this%snow_sinks_col(begc:endc) = spval - call hist_addfld1d (fname='SNOW_SINKS', units='mm/s', & - avgflag='A', long_name='snow sinks (liquid water)', & - ptr_col=this%snow_sinks_col, c2l_scale_type='urbanf', default='inactive') - - this%AnnET(begc:endc) = spval - call hist_addfld1d (fname='AnnET', units='mm/s', & - avgflag='A', long_name='Annual ET', & - ptr_col=this%AnnET, c2l_scale_type='urbanf', default='inactive') - - end subroutine InitHistory - - - - !----------------------------------------------------------------------- - subroutine InitAccBuffer (this, bounds) - ! - ! !DESCRIPTION: - ! Initialize accumulation buffer for all required module accumulated fields - ! This routine set defaults values that are then overwritten by the - ! restart file for restart or branch runs - ! - ! !USES - use clm_varcon , only : spval - use accumulMod , only : init_accum_field - ! - ! !ARGUMENTS: - class(waterflux_type) :: this - type(bounds_type), intent(in) :: bounds - !--------------------------------------------------------------------- - - if (use_fun) then - - call init_accum_field (name='AnnET', units='MM H2O/S', & - desc='365-day running mean of total ET', accum_type='runmean', accum_period=-365, & - subgrid_type='column', numlev=1, init_value=0._r8) - - end if - - end subroutine InitAccBuffer - - !----------------------------------------------------------------------- - ! - subroutine InitAccVars (this, bounds) - ! !DESCRIPTION: - ! Initialize module variables that are associated with - ! time accumulated fields. This routine is called for both an initial run - ! and a restart run (and must therefore must be called after the restart file - ! is read in and the accumulation buffer is obtained) - ! - ! !USES - use accumulMod , only : extract_accum_field - use clm_time_manager , only : get_nstep - ! - ! !ARGUMENTS: - class(waterflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - integer :: nstep - integer :: ier - real(r8), pointer :: rbufslp(:) ! temporary - !--------------------------------------------------------------------- - begc = bounds%begc; endc = bounds%endc - - ! Allocate needed dynamic memory for single level patch field - allocate(rbufslp(begc:endc), stat=ier) - - ! Determine time step - nstep = get_nstep() - - if (use_fun) then - call extract_accum_field ('AnnET', rbufslp, nstep) - this%qflx_evap_tot_col(begc:endc) = rbufslp(begc:endc) - end if - - deallocate(rbufslp) - - end subroutine InitAccVars - - - !----------------------------------------------------------------------- - subroutine UpdateAccVars (this, bounds) - ! - ! USES - use clm_time_manager, only : get_nstep - use accumulMod , only : update_accum_field, extract_accum_field - ! - ! !ARGUMENTS: - class(waterflux_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g,c,p ! indices - integer :: dtime ! timestep size [seconds] - integer :: nstep ! timestep number - integer :: ier ! error status - integer :: begc, endc - real(r8), pointer :: rbufslp(:) ! temporary single level - patch level - !--------------------------------------------------------------------- - - begc = bounds%begc; endc = bounds%endc - - nstep = get_nstep() - - ! Allocate needed dynamic memory for single level patch field - - allocate(rbufslp(begc:endc), stat=ier) - - do c = begc,endc - rbufslp(c) = this%qflx_evap_tot_col(c) - end do - if (use_fun) then - ! Accumulate and extract AnnET (accumulates total ET as 365-day running mean) - call update_accum_field ('AnnET', rbufslp, nstep) - call extract_accum_field ('AnnET', this%AnnET, nstep) - - end if - - deallocate(rbufslp) - - end subroutine UpdateAccVars - - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !USES: - use landunit_varcon, only : istsoil, istcrop - ! - ! !ARGUMENTS: - class(waterflux_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p,c,l - !----------------------------------------------------------------------- - - this%qflx_evap_grnd_patch(bounds%begp:bounds%endp) = 0.0_r8 - this%qflx_dew_grnd_patch (bounds%begp:bounds%endp) = 0.0_r8 - this%qflx_dew_snow_patch (bounds%begp:bounds%endp) = 0.0_r8 - - this%qflx_evap_grnd_col(bounds%begc:bounds%endc) = 0.0_r8 - this%qflx_dew_grnd_col (bounds%begc:bounds%endc) = 0.0_r8 - this%qflx_dew_snow_col (bounds%begc:bounds%endc) = 0.0_r8 - - this%qflx_phs_neg_col(bounds%begc:bounds%endc) = 0.0_r8 - - this%qflx_h2osfc_surf_col(bounds%begc:bounds%endc) = 0._r8 - this%qflx_snow_drain_col(bounds%begc:bounds%endc) = 0._r8 - - ! This variable only gets set in the hydrology filter; need to initialize it to 0 for - ! the sake of columns outside this filter - this%qflx_ice_runoff_xs_col(bounds%begc:bounds%endc) = 0._r8 - - this%AnnEt(bounds%begc:bounds%endc) = 0._r8 - - ! needed for CNNLeaching - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%qflx_drain_col(c) = 0._r8 - this%qflx_surf_col(c) = 0._r8 - end if - end do - - end subroutine InitCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag) - ! - ! !USES: - use ncdio_pio, only : file_desc_t, ncd_double - use restUtilMod - ! - ! !ARGUMENTS: - class(waterflux_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - logical :: readvar ! determine if variable is on initial file - !----------------------------------------------------------------------- - - ! needed for SNICAR - call restartvar(ncid=ncid, flag=flag, varname='qflx_snofrz_lyr', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno+1, upperb2=0, & - long_name='snow layer ice freezing rate', units='kg m-2 s-1', & - interpinic_flag='interp', readvar=readvar, data=this%qflx_snofrz_lyr_col) - if (flag == 'read' .and. .not. readvar) then - ! initial run, not restart: initialize qflx_snofrz_lyr to zero - this%qflx_snofrz_lyr_col(bounds%begc:bounds%endc,-nlevsno+1:0) = 0._r8 - endif - - call restartvar(ncid=ncid, flag=flag, varname='qflx_snow_drain:qflx_snow_melt', xtype=ncd_double, & - dim1name='column', & - long_name='drainage from snow column', units='mm/s', & - interpinic_flag='interp', readvar=readvar, data=this%qflx_snow_drain_col) - if (flag == 'read' .and. .not. readvar) then - ! initial run, not restart: initialize qflx_snow_drain to zero - this%qflx_snow_drain_col(bounds%begc:bounds%endc) = 0._r8 - endif - - - call restartvar(ncid=ncid, flag=flag, varname='AnnET', xtype=ncd_double, & - dim1name='column', & - long_name='Annual ET ', units='mm/s', & - interpinic_flag='interp', readvar=readvar, data=this%AnnET) - if (flag == 'read' .and. .not. readvar) then - ! initial run, not restart: initialize qflx_snow_drain to zero - this%AnnET(bounds%begc:bounds%endc) = 0._r8 - endif - - end subroutine Restart - -end module WaterfluxType diff --git a/src/cpl/clm_cpl_indices.F90 b/src/cpl/clm_cpl_indices.F90 index 525b709cc6..89283ee26d 100644 --- a/src/cpl/clm_cpl_indices.F90 +++ b/src/cpl/clm_cpl_indices.F90 @@ -18,16 +18,12 @@ module clm_cpl_indices ! ! !PUBLIC DATA MEMBERS: ! - integer , public :: glc_nec ! number of elevation classes for glacier_mec landunits - ! (from coupler) - must equal maxpatch_glcmec from namelist - ! lnd -> drv (required) integer, public ::index_l2x_Flrl_rofsur ! lnd->rtm input liquid surface fluxes integer, public ::index_l2x_Flrl_rofgwl ! lnd->rtm input liquid gwl fluxes integer, public ::index_l2x_Flrl_rofsub ! lnd->rtm input liquid subsurface fluxes integer, public ::index_l2x_Flrl_rofi ! lnd->rtm input frozen fluxes - integer, public ::index_l2x_Flrl_irrig ! irrigation withdrawal integer, public ::index_l2x_Sl_t ! temperature integer, public ::index_l2x_Sl_tref ! 2m reference temperature @@ -54,16 +50,7 @@ module clm_cpl_indices integer, public ::index_l2x_Fall_flxdst2 ! dust flux size bin 2 integer, public ::index_l2x_Fall_flxdst3 ! dust flux size bin 3 integer, public ::index_l2x_Fall_flxdst4 ! dust flux size bin 4 - integer, public ::index_l2x_Fall_flxvoc ! MEGAN fluxes - integer, public ::index_l2x_Fall_flxfire ! Fire fluxes - integer, public ::index_l2x_Sl_ztopfire ! Top of fire emissions (m) - - ! In the following, index 0 is bare land, other indices are glc elevation classes - integer, allocatable, public ::index_l2x_Sl_tsrf(:) ! glc MEC temperature - integer, allocatable, public ::index_l2x_Sl_topo(:) ! glc MEC topo height - integer, allocatable, public ::index_l2x_Flgl_qice(:) ! glc MEC ice flux - integer, public ::index_x2l_Sa_methane integer, public ::index_l2x_Fall_methane integer, public :: nflds_l2x = 0 @@ -104,9 +91,6 @@ module clm_cpl_indices integer, public ::index_x2l_Faxa_dstdry3 ! flux: Size 3 dust -- dry deposition integer, public ::index_x2l_Faxa_dstdry4 ! flux: Size 4 dust -- dry deposition - integer, public ::index_x2l_Faxa_nhx ! flux nhx from atm - integer, public ::index_x2l_Faxa_noy ! flux noy from atm - integer, public ::index_x2l_Flrr_flood ! rtm->lnd rof flood flux integer, public ::index_x2l_Flrr_volr ! rtm->lnd rof volr total volume integer, public ::index_x2l_Flrr_volrmch ! rtm->lnd rof volr main channel volume @@ -136,10 +120,6 @@ subroutine clm_cpl_indices_set( ) use seq_flds_mod , only: seq_flds_x2l_fields, seq_flds_l2x_fields use mct_mod , only: mct_aVect, mct_aVect_init, mct_avect_indexra use mct_mod , only: mct_aVect_clean, mct_avect_nRattr - use seq_drydep_mod , only: drydep_fields_token, lnd_drydep - use shr_megan_mod , only: shr_megan_fields_token, shr_megan_mechcomps_n - use shr_fire_emis_mod,only: shr_fire_emis_fields_token, shr_fire_emis_ztop_token, shr_fire_emis_mechcomps_n - use clm_varctl , only: ndep_from_cpl use glc_elevclass_mod, only: glc_get_num_elevation_classes, glc_elevclass_as_string ! ! !ARGUMENTS: @@ -175,7 +155,6 @@ subroutine clm_cpl_indices_set( ) index_l2x_Flrl_rofgwl = mct_avect_indexra(l2x,'Flrl_rofgwl') index_l2x_Flrl_rofsub = mct_avect_indexra(l2x,'Flrl_rofsub') index_l2x_Flrl_rofi = mct_avect_indexra(l2x,'Flrl_rofi') - index_l2x_Flrl_irrig = mct_avect_indexra(l2x,'Flrl_irrig') index_l2x_Sl_t = mct_avect_indexra(l2x,'Sl_t') index_l2x_Sl_snowh = mct_avect_indexra(l2x,'Sl_snowh') @@ -190,12 +169,6 @@ subroutine clm_cpl_indices_set( ) index_l2x_Sl_fv = mct_avect_indexra(l2x,'Sl_fv') index_l2x_Sl_soilw = mct_avect_indexra(l2x,'Sl_soilw',perrwith='quiet') - if ( lnd_drydep )then - index_l2x_Sl_ddvel = mct_avect_indexra(l2x, trim(drydep_fields_token)) - else - index_l2x_Sl_ddvel = 0 - end if - index_l2x_Fall_taux = mct_avect_indexra(l2x,'Fall_taux') index_l2x_Fall_tauy = mct_avect_indexra(l2x,'Fall_tauy') index_l2x_Fall_lat = mct_avect_indexra(l2x,'Fall_lat') @@ -212,22 +185,6 @@ subroutine clm_cpl_indices_set( ) index_l2x_Fall_methane = mct_avect_indexra(l2x,'Fall_methane',perrWith='quiet') - ! MEGAN fluxes - if (shr_megan_mechcomps_n>0) then - index_l2x_Fall_flxvoc = mct_avect_indexra(l2x,trim(shr_megan_fields_token)) - else - index_l2x_Fall_flxvoc = 0 - endif - - ! Fire fluxes - if (shr_fire_emis_mechcomps_n>0) then - index_l2x_Fall_flxfire = mct_avect_indexra(l2x,trim(shr_fire_emis_fields_token)) - index_l2x_Sl_ztopfire = mct_avect_indexra(l2x,trim(shr_fire_emis_ztop_token)) - else - index_l2x_Fall_flxfire = 0 - index_l2x_Sl_ztopfire = 0 - endif - !------------------------------------------------------------- ! drv -> clm !------------------------------------------------------------- @@ -243,8 +200,6 @@ subroutine clm_cpl_indices_set( ) index_x2l_Sa_co2prog = mct_avect_indexra(x2l,'Sa_co2prog',perrwith='quiet') index_x2l_Sa_co2diag = mct_avect_indexra(x2l,'Sa_co2diag',perrwith='quiet') - index_x2l_Sa_methane = mct_avect_indexra(x2l,'Sa_methane',perrWith='quiet') - index_x2l_Flrr_volr = mct_avect_indexra(x2l,'Flrr_volr') index_x2l_Flrr_volrmch = mct_avect_indexra(x2l,'Flrr_volrmch') @@ -272,13 +227,6 @@ subroutine clm_cpl_indices_set( ) index_x2l_Faxa_dstwet3 = mct_avect_indexra(x2l,'Faxa_dstwet3') index_x2l_Faxa_dstwet4 = mct_avect_indexra(x2l,'Faxa_dstwet4') - index_x2l_Faxa_nhx = mct_avect_indexra(x2l,'Faxa_nhx', perrWith='quiet') - index_x2l_Faxa_noy = mct_avect_indexra(x2l,'Faxa_noy', perrWith='quiet') - - if (index_x2l_Faxa_nhx > 0 .and. index_x2l_Faxa_noy > 0) then - ndep_from_cpl = .true. - end if - index_x2l_Flrr_flood = mct_avect_indexra(x2l,'Flrr_flood') !------------------------------------------------------------- @@ -288,21 +236,13 @@ subroutine clm_cpl_indices_set( ) index_x2l_Sg_icemask = mct_avect_indexra(x2l,'Sg_icemask') index_x2l_Sg_icemask_coupled_fluxes = mct_avect_indexra(x2l,'Sg_icemask_coupled_fluxes') - glc_nec = glc_get_num_elevation_classes() - if (glc_nec < 1) then - call shr_sys_abort('ERROR: In CLM4.5 and later, glc_nec must be at least 1.') - end if - ! Create coupling fields for all glc elevation classes (1:glc_nec) plus bare land ! (index 0). - allocate(index_l2x_Sl_tsrf(0:glc_nec)) - allocate(index_l2x_Sl_topo(0:glc_nec)) - allocate(index_l2x_Flgl_qice(0:glc_nec)) - allocate(index_x2l_Sg_ice_covered(0:glc_nec)) - allocate(index_x2l_Sg_topo(0:glc_nec)) - allocate(index_x2l_Flgg_hflx(0:glc_nec)) - - do num = 0,glc_nec + allocate(index_x2l_Sg_ice_covered(0:10)) + allocate(index_x2l_Sg_topo(0:10)) + allocate(index_x2l_Flgg_hflx(0:10)) + + do num = 0,10 nec_str = glc_elevclass_as_string(num) name = 'Sg_ice_covered' // nec_str @@ -311,13 +251,6 @@ subroutine clm_cpl_indices_set( ) index_x2l_Sg_topo(num) = mct_avect_indexra(x2l,trim(name)) name = 'Flgg_hflx' // nec_str index_x2l_Flgg_hflx(num) = mct_avect_indexra(x2l,trim(name)) - - name = 'Sl_tsrf' // nec_str - index_l2x_Sl_tsrf(num) = mct_avect_indexra(l2x,trim(name)) - name = 'Sl_topo' // nec_str - index_l2x_Sl_topo(num) = mct_avect_indexra(l2x,trim(name)) - name = 'Flgl_qice' // nec_str - index_l2x_Flgl_qice(num) = mct_avect_indexra(l2x,trim(name)) end do call mct_aVect_clean(x2l) diff --git a/src/cpl/lnd_comp_mct.F90 b/src/cpl/lnd_comp_mct.F90 index 394ea63e56..577d0f274b 100644 --- a/src/cpl/lnd_comp_mct.F90 +++ b/src/cpl/lnd_comp_mct.F90 @@ -42,10 +42,9 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) use shr_kind_mod , only : shr_kind_cl use abortutils , only : endrun use clm_time_manager , only : get_nstep, get_step_size, set_timemgr_init, set_nextsw_cday - use clm_initializeMod, only : initialize1, initialize2, lnd2atm_inst, lnd2glc_inst + use clm_initializeMod, only : initialize1, initialize2, lnd2atm_inst use clm_varctl , only : finidat,single_column, clm_varctl_set, iulog, noland use clm_varctl , only : inst_index, inst_suffix, inst_name - use clm_varorb , only : eccen, obliqr, lambm0, mvelpp use controlMod , only : control_setNL use decompMod , only : get_proc_bounds use domainMod , only : ldomain @@ -151,11 +150,6 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) call shr_file_getLogLevel(shrloglev) call shr_file_setLogUnit (iulog) - ! Use infodata to set orbital values - - call seq_infodata_GetData( infodata, orb_eccen=eccen, orb_mvelpp=mvelpp, & - orb_lambm0=lambm0, orb_obliqr=obliqr ) - ! Consistency check on namelist filename call control_setNL("lnd_in"//trim(inst_suffix)) @@ -252,7 +246,7 @@ subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) ! Create land export state - call lnd_export(bounds, lnd2atm_inst, lnd2glc_inst, l2x_l%rattr) + call lnd_export(bounds, lnd2atm_inst, l2x_l%rattr) !write(iulog,*)'MML back from lnd_export' ! Fill in infodata settings @@ -295,14 +289,13 @@ subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) ! ! !USES: use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_initializeMod, only : lnd2atm_inst, atm2lnd_inst, lnd2glc_inst, glc2lnd_inst + use clm_initializeMod, only : lnd2atm_inst, atm2lnd_inst use clm_driver , only : clm_drv use clm_time_manager, only : get_curr_date, get_nstep, get_curr_calday, get_step_size use clm_time_manager, only : advance_timestep, set_nextsw_cday,update_rad_dtime use decompMod , only : get_proc_bounds use abortutils , only : endrun use clm_varctl , only : iulog - use clm_varorb , only : eccen, obliqr, lambm0, mvelpp use shr_file_mod , only : shr_file_setLogUnit, shr_file_setLogLevel use shr_file_mod , only : shr_file_getLogUnit, shr_file_getLogLevel use seq_cdata_mod , only : seq_cdata, seq_cdata_setptrs @@ -340,16 +333,13 @@ subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) logical :: dosend ! true => send data back to driver logical :: doalb ! .true. ==> do albedo calculation on this time step logical :: rof_prognostic ! .true. => running with a prognostic ROF model - logical :: glc_present ! .true. => running with a non-stub GLC model real(r8) :: nextsw_cday ! calday from clock of next radiation computation real(r8) :: caldayp1 ! clm calday plus dtime offset integer :: shrlogunit,shrloglev ! old values for share log unit and log level integer :: lbnum ! input to memory diagnostic integer :: g,i,lsize ! counters - real(r8) :: calday ! calendar day for nstep real(r8) :: declin ! solar declination angle in radians for nstep real(r8) :: declinp1 ! solar declination angle in radians for nstep+1 - real(r8) :: eccf ! earth orbit eccentricity factor real(r8) :: recip ! reciprical logical,save :: first_call = .true. ! first call work type(seq_infodata_type),pointer :: infodata ! CESM information from the driver @@ -398,8 +388,7 @@ subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) ! their being set in initialization, so need to get them in the run method. call seq_infodata_GetData( infodata, & - rof_prognostic=rof_prognostic, & - glc_present=glc_present) + rof_prognostic=rof_prognostic) ! Map MCT to land data type ! Perform downscaling if appropriate @@ -411,18 +400,9 @@ subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) call t_startf ('lc_lnd_import') call lnd_import( bounds, & x2l = x2l_l%rattr, & - glc_present = glc_present, & - atm2lnd_inst = atm2lnd_inst, & - glc2lnd_inst = glc2lnd_inst) + atm2lnd_inst = atm2lnd_inst) call t_stopf ('lc_lnd_import') - !write(*,*)'MML just after lc_lnd_impoft' - - ! Use infodata to set orbital values if updated mid-run - - call seq_infodata_GetData( infodata, orb_eccen=eccen, orb_mvelpp=mvelpp, & - orb_lambm0=lambm0, orb_obliqr=obliqr ) - !write(*,*)'MML just after se_infodata_GetData' ! Loop over time steps in coupling interval dosend = .false. @@ -468,18 +448,13 @@ subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) call t_barrierf('sync_clm_run1', mpicom) call t_startf ('clm_run') - call t_startf ('shr_orb_decl') - calday = get_curr_calday() - call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, declin , eccf ) - call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, declinp1, eccf ) - call t_stopf ('shr_orb_decl') call clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic) call t_stopf ('clm_run') ! Create l2x_l export state - add river runoff input to l2x_l if appropriate !write(*,*)'MML export l2x_l' call t_startf ('lc_lnd_export') - call lnd_export(bounds, lnd2atm_inst, lnd2glc_inst, l2x_l%rattr) + call lnd_export(bounds, lnd2atm_inst, l2x_l%rattr) call t_stopf ('lc_lnd_export') ! Advance clm time step diff --git a/src/cpl/lnd_import_export.F90 b/src/cpl/lnd_import_export.F90 index 0232c0aa61..2e8662c4ed 100644 --- a/src/cpl/lnd_import_export.F90 +++ b/src/cpl/lnd_import_export.F90 @@ -4,9 +4,7 @@ module lnd_import_export use abortutils , only: endrun use decompmod , only: bounds_type use lnd2atmType , only: lnd2atm_type - use lnd2glcMod , only: lnd2glc_type use atm2lndType , only: atm2lnd_type - use glc2lndMod , only: glc2lnd_type use clm_cpl_indices ! implicit none @@ -15,7 +13,7 @@ module lnd_import_export contains !=============================================================================== - subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst) + subroutine lnd_import( bounds, x2l, atm2lnd_inst) !--------------------------------------------------------------------------- ! !DESCRIPTION: @@ -24,8 +22,7 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst) ! !USES: use seq_flds_mod , only: seq_flds_x2l_fields use clm_varctl , only: co2_type, co2_ppmv, iulog - use clm_varctl , only: ndep_from_cpl - use clm_varcon , only: rair, o2_molar_const, c13ratio + use clm_varcon , only: rair, o2_molar_const use shr_const_mod , only: SHR_CONST_TKFRZ use shr_string_mod , only: shr_string_listGetName use domainMod , only: ldomain @@ -34,9 +31,7 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst) ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds ! bounds real(r8) , intent(in) :: x2l(:,:) ! driver import state to land model - logical , intent(in) :: glc_present ! .true. => running with a non-stub GLC model type(atm2lnd_type) , intent(inout) :: atm2lnd_inst ! clm internal input data type - type(glc2lnd_type) , intent(inout) :: glc2lnd_inst ! clm internal input data type ! ! !LOCAL VARIABLES: integer :: g,i,k,nstep,ier ! indices, number of steps, and error code @@ -162,10 +157,6 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst) co2_ppmv_diag = co2_ppmv end if - if (index_x2l_Sa_methane /= 0) then - atm2lnd_inst%forc_pch4_grc(g) = x2l(index_x2l_Sa_methane,i) - endif - ! Determine derived quantities for required fields forc_t = atm2lnd_inst%forc_t_not_downscaled_grc(g) @@ -249,33 +240,13 @@ subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst) end if atm2lnd_inst%forc_pco2_grc(g) = co2_ppmv_val * 1.e-6_r8 * forc_pbot - if (ndep_from_cpl) then - ! The coupler is sending ndep in units if kgN/m2/s - and clm uses units of gN/m2/sec - so the - ! following conversion needs to happen - atm2lnd_inst%forc_ndep_grc(g) = (x2l(index_x2l_Faxa_nhx, i) + x2l(index_x2l_faxa_noy, i))*1000._r8 - end if - end do - call glc2lnd_inst%set_glc2lnd_fields( & - bounds = bounds, & - glc_present = glc_present, & - ! NOTE(wjs, 2017-12-13) the x2l argument doesn't have the typical bounds - ! subsetting (bounds%begg:bounds%endg). This mirrors the lack of these bounds in - ! the call to lnd_import from lnd_run_mct. This is okay as long as this code is - ! outside a clump loop. - x2l = x2l, & - index_x2l_Sg_ice_covered = index_x2l_Sg_ice_covered, & - index_x2l_Sg_topo = index_x2l_Sg_topo, & - index_x2l_Flgg_hflx = index_x2l_Flgg_hflx, & - index_x2l_Sg_icemask = index_x2l_Sg_icemask, & - index_x2l_Sg_icemask_coupled_fluxes = index_x2l_Sg_icemask_coupled_fluxes) - end subroutine lnd_import !=============================================================================== - subroutine lnd_export( bounds, lnd2atm_inst, lnd2glc_inst, l2x) + subroutine lnd_export( bounds, lnd2atm_inst, l2x) !--------------------------------------------------------------------------- ! !DESCRIPTION: @@ -286,9 +257,6 @@ subroutine lnd_export( bounds, lnd2atm_inst, lnd2glc_inst, l2x) use seq_flds_mod , only : seq_flds_l2x_fields use clm_varctl , only : iulog use clm_time_manager , only : get_nstep, get_step_size - use seq_drydep_mod , only : n_drydep - use shr_megan_mod , only : shr_megan_mechcomps_n - use shr_fire_emis_mod , only : shr_fire_emis_mechcomps_n use domainMod , only : ldomain use shr_string_mod , only : shr_string_listGetName use shr_infnan_mod , only : isnan => shr_infnan_isnan @@ -297,7 +265,6 @@ subroutine lnd_export( bounds, lnd2atm_inst, lnd2glc_inst, l2x) implicit none type(bounds_type) , intent(in) :: bounds ! bounds type(lnd2atm_type), intent(inout) :: lnd2atm_inst ! clm land to atmosphere exchange data type - type(lnd2glc_type), intent(inout) :: lnd2glc_inst ! clm land to atmosphere exchange data type real(r8) , intent(out) :: l2x(:,:)! land to coupler export state on land grid ! ! !LOCAL VARIABLES: @@ -336,41 +303,16 @@ subroutine lnd_export( bounds, lnd2atm_inst, lnd2glc_inst, l2x) l2x(index_l2x_Fall_fco2_lnd,i) = -lnd2atm_inst%net_carbon_exchange_grc(g) end if - ! Additional fields for DUST, PROGSSLT, dry-deposition and VOC + ! Additional fields for DUST, PROGSSLT, dry-deposition ! These are now standard fields, but the check on the index makes sure the driver handles them if (index_l2x_Sl_ram1 /= 0 ) l2x(index_l2x_Sl_ram1,i) = lnd2atm_inst%ram1_grc(g) if (index_l2x_Sl_fv /= 0 ) l2x(index_l2x_Sl_fv,i) = lnd2atm_inst%fv_grc(g) - if (index_l2x_Sl_soilw /= 0 ) l2x(index_l2x_Sl_soilw,i) = lnd2atm_inst%h2osoi_vol_grc(g,1) + if (index_l2x_Sl_soilw /= 0 ) l2x(index_l2x_Sl_soilw,i) = 0.5_r8 if (index_l2x_Fall_flxdst1 /= 0 ) l2x(index_l2x_Fall_flxdst1,i)= -lnd2atm_inst%flxdst_grc(g,1) if (index_l2x_Fall_flxdst2 /= 0 ) l2x(index_l2x_Fall_flxdst2,i)= -lnd2atm_inst%flxdst_grc(g,2) if (index_l2x_Fall_flxdst3 /= 0 ) l2x(index_l2x_Fall_flxdst3,i)= -lnd2atm_inst%flxdst_grc(g,3) if (index_l2x_Fall_flxdst4 /= 0 ) l2x(index_l2x_Fall_flxdst4,i)= -lnd2atm_inst%flxdst_grc(g,4) - - ! for dry dep velocities - if (index_l2x_Sl_ddvel /= 0 ) then - l2x(index_l2x_Sl_ddvel:index_l2x_Sl_ddvel+n_drydep-1,i) = & - lnd2atm_inst%ddvel_grc(g,:n_drydep) - end if - - ! for MEGAN VOC emis fluxes - if (index_l2x_Fall_flxvoc /= 0 ) then - l2x(index_l2x_Fall_flxvoc:index_l2x_Fall_flxvoc+shr_megan_mechcomps_n-1,i) = & - -lnd2atm_inst%flxvoc_grc(g,:shr_megan_mechcomps_n) - end if - - - ! for fire emis fluxes - if (index_l2x_Fall_flxfire /= 0 ) then - l2x(index_l2x_Fall_flxfire:index_l2x_Fall_flxfire+shr_fire_emis_mechcomps_n-1,i) = & - -lnd2atm_inst%fireflx_grc(g,:shr_fire_emis_mechcomps_n) - l2x(index_l2x_Sl_ztopfire,i) = lnd2atm_inst%fireztop_grc(g) - end if - - if (index_l2x_Fall_methane /= 0) then - l2x(index_l2x_Fall_methane,i) = -lnd2atm_inst%flux_ch4_grc(g) - endif - ! sign convention is positive downward with ! hierarchy of atm/glc/lnd/rof/ice/ocn. ! I.e. water sent from land to rof is positive @@ -389,19 +331,6 @@ subroutine lnd_export( bounds, lnd2atm_inst, lnd2glc_inst, l2x) ! ice sent individually to coupler l2x(index_l2x_Flrl_rofi,i) = lnd2atm_inst%qflx_rofice_grc(g) - ! irrigation flux to be removed from main channel storage (negative) - l2x(index_l2x_Flrl_irrig,i) = - lnd2atm_inst%qirrig_grc(g) - - ! glc coupling - ! We could avoid setting these fields if glc_present is .false., if that would - ! help with performance. (The downside would be that we wouldn't have these fields - ! available for diagnostic purposes or to force a later T compset with dlnd.) - do num = 0,glc_nec - l2x(index_l2x_Sl_tsrf(num),i) = lnd2glc_inst%tsrf_grc(g,num) - l2x(index_l2x_Sl_topo(num),i) = lnd2glc_inst%topo_grc(g,num) - l2x(index_l2x_Flgl_qice(num),i) = lnd2glc_inst%qice_grc(g,num) - end do - ! Check if any output sent to the coupler is NaN if ( any(isnan(l2x(:,i))) )then write(iulog,*) '# of NaNs = ', count(isnan(l2x(:,i))) diff --git a/src/init_interp/initInterp.F90 b/src/init_interp/initInterp.F90 index 07d93178cd..b2c6bcbafc 100644 --- a/src/init_interp/initInterp.F90 +++ b/src/init_interp/initInterp.F90 @@ -208,7 +208,6 @@ subroutine initInterp (filei, fileo, bounds) ! maintenance problem - or maybe even remove check_dim_level entirely. call check_dim_level(ncidi, ncido, dimname='levsno' , must_be_same=.false.) call check_dim_level(ncidi, ncido, dimname='levsno1', must_be_same=.false.) - call check_dim_level(ncidi, ncido, dimname='levcan' , must_be_same=.true.) call check_dim_level(ncidi, ncido, dimname='levlak' , must_be_same=.true.) call check_dim_level(ncidi, ncido, dimname='levtot' , must_be_same=.false.) call check_dim_level(ncidi, ncido, dimname='levgrnd', must_be_same=.false.) diff --git a/src/main/ColumnType.F90 b/src/main/ColumnType.F90 index 7043bfa159..eacab7335c 100644 --- a/src/main/ColumnType.F90 +++ b/src/main/ColumnType.F90 @@ -47,13 +47,6 @@ module ColumnType logical , pointer :: active (:) ! true=>do computations on this column logical , pointer :: type_is_dynamic (:) ! true=>itype can change throughout the run - ! topography - ! TODO(wjs, 2016-04-05) Probably move these things into topoMod - real(r8), pointer :: micro_sigma (:) ! microtopography pdf sigma (m) - real(r8), pointer :: n_melt (:) ! SCA shape parameter - real(r8), pointer :: topo_slope (:) ! gridcell topographic slope - real(r8), pointer :: topo_std (:) ! gridcell elevation standard deviation - ! vertical levels integer , pointer :: snl (:) ! number of snow layers real(r8), pointer :: dz (:,:) ! layer thickness (m) (-nlevsno+1:nlevgrnd) @@ -63,20 +56,9 @@ module ColumnType real(r8), pointer :: dz_lake (:,:) ! lake layer thickness (m) (1:nlevlak) real(r8), pointer :: z_lake (:,:) ! layer depth for lake (m) real(r8), pointer :: lakedepth (:) ! variable lake depth (m) - integer , pointer :: nbedrock (:) ! variable depth to bedrock index - ! other column characteristics logical , pointer :: hydrologically_active(:) ! true if this column is a hydrologically active type - ! levgrnd_class gives the class in which each layer falls. This is relevant for - ! columns where there are 2 or more fundamentally different layer types. For - ! example, this distinguishes between soil and bedrock layers. The particular value - ! assigned to each class is irrelevant; the important thing is that different - ! classes (e.g., soil vs. bedrock) have different values of levgrnd_class. - ! - ! levgrnd_class = ispval indicates that the given layer is completely unused for - ! this column (i.e., this column doesn't use the full nlevgrnd layers). - integer , pointer :: levgrnd_class (:,:) ! class in which each layer falls (1:nlevgrnd) contains procedure, public :: Init @@ -124,13 +106,6 @@ subroutine Init(this, begc, endc) allocate(this%dz_lake (begc:endc,nlevlak)) ; this%dz_lake (:,:) = nan allocate(this%z_lake (begc:endc,nlevlak)) ; this%z_lake (:,:) = nan - allocate(this%nbedrock (begc:endc)) ; this%nbedrock (:) = ispval - allocate(this%levgrnd_class(begc:endc,nlevgrnd)) ; this%levgrnd_class(:,:) = ispval - allocate(this%micro_sigma (begc:endc)) ; this%micro_sigma (:) = nan - allocate(this%n_melt (begc:endc)) ; this%n_melt (:) = nan - allocate(this%topo_slope (begc:endc)) ; this%topo_slope (:) = nan - allocate(this%topo_std (begc:endc)) ; this%topo_std (:) = nan - allocate(this%hydrologically_active(begc:endc)) ; this%hydrologically_active(:) = .false. end subroutine Init @@ -160,12 +135,6 @@ subroutine Clean(this) deallocate(this%lakedepth ) deallocate(this%dz_lake ) deallocate(this%z_lake ) - deallocate(this%micro_sigma) - deallocate(this%n_melt ) - deallocate(this%topo_slope ) - deallocate(this%topo_std ) - deallocate(this%nbedrock ) - deallocate(this%levgrnd_class) deallocate(this%hydrologically_active) end subroutine Clean diff --git a/src/main/FuncPedotransferMod.F90 b/src/main/FuncPedotransferMod.F90 deleted file mode 100644 index 41e751344e..0000000000 --- a/src/main/FuncPedotransferMod.F90 +++ /dev/null @@ -1,141 +0,0 @@ -module FuncPedotransferMod -! -!DESCRIPTIONS: -!module contains different pedotransfer functions to -!compute the mineral soil hydraulic properties. -!currenty, only the Clapp-Hornberg formulation is used. -!HISTORY: -!created by Jinyun Tang, Mar.1st, 2014 -implicit none - private - public :: pedotransf - public :: get_ipedof - public :: init_pedof - - integer, parameter :: cosby_1984_table5 = 0 !by default uses this form - integer, parameter :: cosby_1984_table4 = 1 - integer, parameter :: noilhan_lacarrere_1995 = 2 - integer :: ipedof0 -contains - - subroutine init_pedof() - ! - !DESCRIPTIONS - !initialize the default pedotransfer function - implicit none - - - ipedof0 = cosby_1984_table5 !the default pedotransfer function - end subroutine init_pedof - - subroutine pedotransf(ipedof, sand, clay, watsat, bsw, sucsat, xksat) - !pedotransfer function to compute hydraulic properties of mineral soil - !based on input soil texture - - use shr_kind_mod , only : r8 => shr_kind_r8 - use abortutils , only : endrun - implicit none - integer, intent(in) :: ipedof !type of pedotransfer function, use the default pedotransfer function - real(r8), intent(in) :: sand !% sand - real(r8), intent(in) :: clay !% clay - real(r8), intent(out):: watsat !v/v saturate moisture - real(r8), intent(out):: bsw !b shape parameter - real(r8), intent(out):: sucsat !mm, soil matric potential - real(r8), intent(out):: xksat !mm/s, saturated hydraulic conductivity - - character(len=32) :: subname = 'pedotransf' ! subroutine name - select case (ipedof) - case (cosby_1984_table4) - call pedotransf_cosby1984_table4(sand, clay, watsat, bsw, sucsat, xksat) - case (noilhan_lacarrere_1995) - call pedotransf_noilhan_lacarrere1995(sand, clay, watsat, bsw, sucsat, xksat) - case (cosby_1984_table5) - call pedotransf_cosby1984_table5(sand, clay, watsat, bsw, sucsat, xksat) - case default - call endrun(subname // ':: a pedotransfer function must be specified!') - end select - - end subroutine pedotransf - -!------------------------------------------------------------------------------------------ - subroutine pedotransf_cosby1984_table4(sand, clay, watsat, bsw, sucsat, xksat) - ! - !DESCRIPTIONS - !compute hydraulic properties based on functions derived from Table 4 in cosby et al, 1984 - use shr_kind_mod , only : r8 => shr_kind_r8 - implicit none - real(r8), intent(in) :: sand !% sand - real(r8), intent(in) :: clay !% clay - real(r8), intent(out):: watsat !v/v saturate moisture - real(r8), intent(out):: bsw !b shape parameter - real(r8), intent(out):: sucsat !mm, soil matric potential - real(r8), intent(out):: xksat !mm/s, saturated hydraulic conductivity - - !Cosby et al. Table 4 - watsat = 0.505_r8-0.00142_r8*sand-0.00037*clay - bsw = 3.10+0.157*clay-0.003*sand - sucsat = 10._r8 * ( 10._r8**(1.54_r8-0.0095_r8*sand+0.0063*(100._r8-sand-clay))) - xksat = 0.0070556 *(10.**(-0.60+0.0126*sand-0.0064*clay) ) !mm/s now use table 4. - - end subroutine pedotransf_cosby1984_table4 - -!------------------------------------------------------------------------------------------ - subroutine pedotransf_cosby1984_table5(sand, clay, watsat, bsw, sucsat, xksat) - ! - !DESCRIPTIONS - !compute hydraulic properties based on functions derived from Table 5 in cosby et al, 1984 - - use shr_kind_mod , only : r8 => shr_kind_r8 - implicit none - real(r8), intent(in) :: sand !% sand - real(r8), intent(in) :: clay !% clay - real(r8), intent(out):: watsat !v/v saturate moisture - real(r8), intent(out):: bsw !b shape parameter - real(r8), intent(out):: sucsat !mm, soil matric potential - real(r8), intent(out):: xksat !mm/s, saturated hydraulic conductivity - - !Cosby et al. Table 5 - watsat = 0.489_r8 - 0.00126_r8*sand - bsw = 2.91 + 0.159*clay - sucsat = 10._r8 * ( 10._r8**(1.88_r8-0.0131_r8*sand) ) - xksat = 0.0070556 *( 10.**(-0.884+0.0153*sand) ) ! mm/s, from table 5 - - end subroutine pedotransf_cosby1984_table5 - -!------------------------------------------------------------------------------------------ - subroutine pedotransf_noilhan_lacarrere1995(sand, clay, watsat, bsw, sucsat, xksat) - ! - !DESCRIPTIONS - !compute hydraulic properties based on functions derived from Noilhan and Lacarrere, 1995 - - use shr_kind_mod , only : r8 => shr_kind_r8 - implicit none - real(r8), intent(in) :: sand !% sand - real(r8), intent(in) :: clay !% clay - real(r8), intent(out):: watsat !v/v saturate moisture - real(r8), intent(out):: bsw !b shape parameter - real(r8), intent(out):: sucsat !mm, soil matric potential - real(r8), intent(out):: xksat !mm/s, saturated hydraulic conductivity - - !Noilhan and Lacarrere, 1995 - watsat = -0.00108*sand+0.494305 - bsw = 0.137*clay + 3.501 - sucsat = 10._r8**(-0.0088*sand+2.85) - xksat = 10._r8**(-0.0582*clay-0.00091*sand+0.000529*clay**2._r8-0.0001203*sand**2._r8-1.38) - end subroutine pedotransf_noilhan_lacarrere1995 -!------------------------------------------------------------------------------------------ - function get_ipedof(soil_order)result(ipedof) - ! - ! DESCRIPTION - ! select the pedotransfer function to be used - implicit none - integer, intent(in) :: soil_order - - integer :: ipedof - - if(soil_order==0)then - ipedof=ipedof0 - endif - - end function get_ipedof -end module FuncpedotransferMod diff --git a/src/main/GridcellType.F90 b/src/main/GridcellType.F90 index 30fe988eff..209d59a5e6 100644 --- a/src/main/GridcellType.F90 +++ b/src/main/GridcellType.F90 @@ -29,8 +29,6 @@ module GridcellType real(r8), pointer :: londeg (:) ! longitude (degrees) logical , pointer :: active (:) ! just needed for symmetry with other subgrid types - integer, pointer :: nbedrock (:) ! index of uppermost bedrock layer - ! Daylength real(r8) , pointer :: max_dayl (:) ! maximum daylength for this grid cell (s) real(r8) , pointer :: dayl (:) ! daylength (seconds) @@ -70,7 +68,6 @@ subroutine Init(this, begg, endg) allocate(this%latdeg (begg:endg)) ; this%latdeg (:) = nan allocate(this%londeg (begg:endg)) ; this%londeg (:) = nan allocate(this%active (begg:endg)) ; this%active (:) = .true. - allocate(this%nbedrock (begg:endg)) ; this%nbedrock (:) = ispval ! This is initiailized in module DayLength allocate(this%max_dayl (begg:endg)) ; this%max_dayl (:) = nan @@ -95,7 +92,6 @@ subroutine Clean(this) deallocate(this%latdeg ) deallocate(this%londeg ) deallocate(this%active ) - deallocate(this%nbedrock ) deallocate(this%max_dayl ) deallocate(this%dayl ) deallocate(this%prev_dayl ) diff --git a/src/main/LandunitType.F90 b/src/main/LandunitType.F90 index 2236ca2780..a9ca17ce53 100644 --- a/src/main/LandunitType.F90 +++ b/src/main/LandunitType.F90 @@ -48,9 +48,6 @@ module LandunitType real(r8), pointer :: canyon_hwr (:) ! urban landunit canyon height to width ratio (-) real(r8), pointer :: wtroad_perv (:) ! urban landunit weight of pervious road column to total road (-) real(r8), pointer :: wtlunit_roof (:) ! weight of roof with respect to urban landunit (-) - real(r8), pointer :: ht_roof (:) ! height of urban roof (m) - real(r8), pointer :: z_0_town (:) ! urban landunit momentum roughness length (m) - real(r8), pointer :: z_d_town (:) ! urban landunit displacement height (m) contains @@ -97,10 +94,7 @@ subroutine Init(this, begl, endl) ! The following is set in routine urbanparams_inst%Init in module UrbanParamsType allocate(this%canyon_hwr (begl:endl)); this%canyon_hwr (:) = nan allocate(this%wtroad_perv (begl:endl)); this%wtroad_perv (:) = nan - allocate(this%ht_roof (begl:endl)); this%ht_roof (:) = nan allocate(this%wtlunit_roof (begl:endl)); this%wtlunit_roof (:) = nan - allocate(this%z_0_town (begl:endl)); this%z_0_town (:) = nan - allocate(this%z_d_town (begl:endl)); this%z_d_town (:) = nan end subroutine Init @@ -130,10 +124,7 @@ subroutine Clean(this) deallocate(this%active ) deallocate(this%canyon_hwr ) deallocate(this%wtroad_perv ) - deallocate(this%ht_roof ) deallocate(this%wtlunit_roof ) - deallocate(this%z_0_town ) - deallocate(this%z_d_town ) end subroutine Clean diff --git a/src/main/PatchType.F90 b/src/main/PatchType.F90 index d00f5588b0..9d99ea83f6 100644 --- a/src/main/PatchType.F90 +++ b/src/main/PatchType.F90 @@ -23,74 +23,11 @@ module PatchType ! 14 => c4_grass ! 15 => c3_crop ! 16 => c3_irrigated - ! 17 => temperate_corn - ! 18 => irrigated_temperate_corn - ! 19 => spring_wheat - ! 20 => irrigated_spring_wheat - ! 21 => winter_wheat - ! 22 => irrigated_winter_wheat - ! 23 => temperate_soybean - ! 24 => irrigated_temperate_soybean - ! 25 => barley - ! 26 => irrigated_barley - ! 27 => winter_barley - ! 28 => irrigated_winter_barley - ! 29 => rye - ! 30 => irrigated_rye - ! 31 => winter_rye - ! 32 => irrigated_winter_rye - ! 33 => cassava - ! 34 => irrigated_cassava - ! 35 => citrus - ! 36 => irrigated_citrus - ! 37 => cocoa - ! 38 => irrigated_cocoa - ! 39 => coffee - ! 40 => irrigated_coffee - ! 41 => cotton - ! 42 => irrigated_cotton - ! 43 => datepalm - ! 44 => irrigated_datepalm - ! 45 => foddergrass - ! 46 => irrigated_foddergrass - ! 47 => grapes - ! 48 => irrigated_grapes - ! 49 => groundnuts - ! 50 => irrigated_groundnuts - ! 51 => millet - ! 52 => irrigated_millet - ! 53 => oilpalm - ! 54 => irrigated_oilpalm - ! 55 => potatoes - ! 56 => irrigated_potatoes - ! 57 => pulses - ! 58 => irrigated_pulses - ! 59 => rapeseed - ! 60 => irrigated_rapeseed - ! 61 => rice - ! 62 => irrigated_rice - ! 63 => sorghum - ! 64 => irrigated_sorghum - ! 65 => sugarbeet - ! 66 => irrigated_sugarbeet - ! 67 => sugarcane - ! 68 => irrigated_sugarcane - ! 69 => sunflower - ! 70 => irrigated_sunflower - ! 71 => miscanthus - ! 72 => irrigated_miscanthus - ! 73 => switchgrass - ! 74 => irrigated_switchgrass - ! 75 => tropical_corn - ! 76 => irrigated_tropical_corn - ! 77 => tropical_soybean - ! 78 => irrigated_tropical_soybean ! -------------------------------------------------------- ! use shr_kind_mod , only : r8 => shr_kind_r8 use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) use clm_varcon , only : ispval - use clm_varctl , only : use_fates ! ! !PUBLIC TYPES: implicit none @@ -112,20 +49,6 @@ module PatchType integer , pointer :: mxy (:) ! m index for laixy(i,j,m),etc. (undefined for special landunits) logical , pointer :: active (:) ! true=>do computations on this patch - ! fates only - logical , pointer :: is_veg (:) ! This is an ACTIVE fates patch - logical , pointer :: is_bareground (:) - real(r8), pointer :: wt_ed (:) !TODO mv ? can this be removed - - - logical, pointer :: is_fates (:) ! true for patch vector space reserved - ! for FATES. - ! this is static and is true for all - ! patches within fates jurisdiction - ! including patches which are not currently - ! associated with a FATES linked-list patch - - contains procedure, public :: Init @@ -168,14 +91,6 @@ subroutine Init(this, begp, endp) allocate(this%itype (begp:endp)); this%itype (:) = ispval - allocate(this%is_fates (begp:endp)); this%is_fates (:) = .false. - - if (use_fates) then - allocate(this%is_veg (begp:endp)); this%is_veg (:) = .false. - allocate(this%is_bareground (begp:endp)); this%is_bareground (:) = .false. - allocate(this%wt_ed (begp:endp)); this%wt_ed (:) = nan - end if - end subroutine Init !------------------------------------------------------------------------ @@ -194,13 +109,6 @@ subroutine Clean(this) deallocate(this%itype ) deallocate(this%mxy ) deallocate(this%active ) - deallocate(this%is_fates) - - if (use_fates) then - deallocate(this%is_veg) - deallocate(this%is_bareground) - deallocate(this%wt_ed) - end if end subroutine Clean diff --git a/src/main/TopoMod.F90 b/src/main/TopoMod.F90 index 9841f59b92..6420adcae9 100644 --- a/src/main/TopoMod.F90 +++ b/src/main/TopoMod.F90 @@ -11,7 +11,6 @@ module TopoMod use PatchType , only : patch use ColumnType , only : col use LandunitType , only : lun - use glc2lndMod , only : glc2lnd_type use glcBehaviorMod , only : glc_behavior_type use landunit_varcon, only : istice_mec use filterColMod , only : filter_col_type, col_filter_from_logical_array_active_only @@ -31,15 +30,13 @@ module TopoMod ! Private member data logical, pointer :: needs_downscaling_col(:) ! whether a column needs to be downscaled + contains procedure, public :: Init procedure, public :: Restart procedure, public :: Clean - procedure, public :: UpdateTopo ! Update topographic height each time step - procedure, public :: DownscaleFilterc ! Returns column-level filter: which columns need downscaling procedure, private :: InitAllocate - procedure, private :: InitHistory procedure, private :: InitCold end type topo_type @@ -57,7 +54,6 @@ subroutine Init(this, bounds) !----------------------------------------------------------------------- call this%InitAllocate(bounds) - call this%InitHistory(bounds) call this%InitCold(bounds) end subroutine Init @@ -85,26 +81,6 @@ subroutine InitAllocate(this, bounds) end subroutine InitAllocate - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! !USES: - use histFileMod , only : hist_addfld1d - ! - ! !ARGUMENTS: - class(topo_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'InitHistory' - !----------------------------------------------------------------------- - - call hist_addfld1d(fname='TOPO_COL', units='m', & - avgflag='A', long_name='column-level topographic height', & - ptr_col=this%topo_col, default='inactive') - - end subroutine InitHistory - !----------------------------------------------------------------------- subroutine InitCold(this, bounds) ! !USES: @@ -164,9 +140,6 @@ subroutine Restart(this, bounds, ncid, flag) allocate(rparr(bounds%begp:bounds%endp)) - ! TODO(wjs, 2016-04-05) Rename these restart variables to get rid of 'glc' in their - ! names. However, this will require some changes to init_interp, too. - call restartvar(ncid=ncid, flag=flag, varname='cols1d_topoglc', xtype=ncd_double, & dim1name='column', & long_name='mean elevation on glacier elevation classes', units='m', & @@ -187,115 +160,6 @@ subroutine Restart(this, bounds, ncid, flag) end subroutine Restart - - !----------------------------------------------------------------------- - subroutine UpdateTopo(this, bounds, num_icemecc, filter_icemecc, & - glc2lnd_inst, glc_behavior, atm_topo) - ! - ! !DESCRIPTION: - ! Update topographic heights - ! - ! Should be called each time step. - ! - ! Should be called after glc2lndMod:update_glc2lnd_fracs, and before - ! atm2lndMod:downscale_forcings - ! - ! !ARGUMENTS: - class(topo_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_icemecc ! number of points in filter_icemecc - integer , intent(in) :: filter_icemecc(:) ! col filter for ice_mec - type(glc2lnd_type) , intent(in) :: glc2lnd_inst - type(glc_behavior_type) , intent(in) :: glc_behavior - real(r8) , intent(in) :: atm_topo( bounds%begg: ) ! atmosphere topographic height [m] - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - integer :: c, g - - character(len=*), parameter :: subname = 'UpdateTopo' - !----------------------------------------------------------------------- - - begc = bounds%begc - endc = bounds%endc - - ! Reset needs_downscaling_col each time step, because this is potentially - ! time-varying for some columns. It's simplest just to reset it everywhere, rather - ! than trying to figure out where it does and does not need to be reset. - this%needs_downscaling_col(begc:endc) = .false. - - call glc_behavior%icemec_cols_need_downscaling(bounds, num_icemecc, filter_icemecc, & - this%needs_downscaling_col(begc:endc)) - - ! In addition to updating topo_col, this also sets some additional elements of - ! needs_downscaling_col to .true. (but leaves the already-.true. values as is.) - call glc2lnd_inst%update_glc2lnd_topo(bounds, & - this%topo_col(begc:endc), & - this%needs_downscaling_col(begc:endc)) - - ! For any point that isn't downscaled, set its topo value to the atmosphere's - ! topographic height. This shouldn't matter, but is useful if topo_col is written to - ! the history file. - ! - ! This could operate over a filter like 'allc' in order to just operate over active - ! points, but I'm not sure that would speed things up much, and would require passing - ! in this additional filter. - do c = bounds%begc, bounds%endc - if (.not. this%needs_downscaling_col(c)) then - g = col%gridcell(c) - this%topo_col(c) = atm_topo(g) - end if - end do - - call glc_behavior%update_glc_classes(bounds, this%topo_col(begc:endc)) - - end subroutine UpdateTopo - - !----------------------------------------------------------------------- - function DownscaleFilterc(this, bounds) result(filter) - ! - ! !DESCRIPTION: - ! Returns a column-level filter: which columns need downscaling. - ! - ! This filter only contains active points. - ! - ! The main reason it's important to have this filter (as opposed to just doing the - ! downscaling for all columns) is because of downscaled fields that are normalized - ! (like longwave radiation): Consider a gridcell with a glc_mec column and a - ! vegetated column (outside of the icemask, so the vegetated column doesn't have its - ! topographic height explicitly set). If we called the downscaling code for all - ! columns, the longwave radiation would get adjusted over the vegetated column. This - ! is undesirable, because it means that adding a downscaled column in a gridcell can - ! change answers for all other columns in that gridcell. - ! - ! !USES: - ! - ! !ARGUMENTS: - type(filter_col_type) :: filter ! function result - class(topo_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'DownscaleFilterc' - !----------------------------------------------------------------------- - - ! Currently this creates the filter on the fly, recreating it every time this function - ! is called. In principle, we should be able to compute and save this filter when - ! UpdateTopo is called, returning the already-computed filter when this function is - ! called. However, the problem with that is the need to have a different filter for - ! each clump (and potentially another filter for calls from outside a clump - ! loop). This will become easier to handle if we rework CLM's threading so that there - ! is a separate instance of each object for each clump: in that case, we'll have - ! multiple instances of topo_type, each corresponding to one clump, each with its own - ! filter. - - filter = col_filter_from_logical_array_active_only(bounds, & - this%needs_downscaling_col(bounds%begc:bounds%endc)) - - end function DownscaleFilterc - - !----------------------------------------------------------------------- subroutine Clean(this) ! !ARGUMENTS: diff --git a/src/main/atm2lndMod.F90 b/src/main/atm2lndMod.F90 deleted file mode 100644 index bfa868b2f2..0000000000 --- a/src/main/atm2lndMod.F90 +++ /dev/null @@ -1,682 +0,0 @@ -module atm2lndMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Handle atm2lnd forcing - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : numrad, ndst, nlevgrnd !ndst = number of dust bins. - use clm_varcon , only : rair, grav, cpair, hfus, tfrz, denh2o, spval - use clm_varcon , only : wv_to_dair_weight_ratio - use clm_varctl , only : iulog, use_cn, iulog - use abortutils , only : endrun - use decompMod , only : bounds_type - use atm2lndType , only : atm2lnd_type - use TopoMod , only : topo_type - use filterColMod , only : filter_col_type - use LandunitType , only : lun - use ColumnType , only : col - use landunit_varcon, only : istice_mec - ! - ! !PUBLIC TYPES: - implicit none - private - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: downscale_forcings ! Downscale atm forcing fields from gridcell to column - - ! The following routines are public for the sake of unit testing; they should not be - ! called by production code outside this module - public :: partition_precip ! Partition precipitation into rain/snow - public :: sens_heat_from_precip_conversion ! Compute sensible heat flux needed to compensate for rain-snow conversion - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: rhos ! calculate atmospheric density - private :: repartition_rain_snow_one_col ! Re-partition precipitation for a single column - private :: downscale_longwave ! Downscale longwave radiation from gridcell to column - private :: build_normalization ! Compute normalization factors so that downscaled fields are conservative - private :: check_downscale_consistency ! Check consistency of downscaling - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine downscale_forcings(bounds, & - topo_inst, atm2lnd_inst, eflx_sh_precip_conversion) - ! - ! !DESCRIPTION: - ! Downscale atmospheric forcing fields from gridcell to column. - ! - ! Downscaling is done based on the difference between each CLM column's elevation and - ! the atmosphere's surface elevation (which is the elevation at which the atmospheric - ! forcings are valid). - ! - ! Note that the downscaling procedure can result in changes in grid cell mean values - ! compared to what was provided by the atmosphere. We conserve fluxes of mass and - ! energy, but allow states such as temperature to differ. - ! - ! For most variables, downscaling is done over columns defined by - ! topo_inst%DownscaleFilterc. But we also do direct copies of gridcell-level forcings - ! into column-level forcings over all other active columns. In addition, precipitation - ! (rain vs. snow partitioning) is adjusted everywhere. - ! - ! !USES: - use clm_varcon , only : rair, cpair, grav - use QsatMod , only : Qsat - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - class(topo_type) , intent(in) :: topo_inst - type(atm2lnd_type) , intent(inout) :: atm2lnd_inst - real(r8) , intent(out) :: eflx_sh_precip_conversion(bounds%begc:) ! sensible heat flux from precipitation conversion (W/m**2) [+ to atm] - ! - ! !LOCAL VARIABLES: - integer :: g, l, c, fc ! indices - integer :: clo, cc - type(filter_col_type) :: downscale_filter_c - - ! temporaries for topo downscaling - real(r8) :: hsurf_g,hsurf_c - real(r8) :: Hbot, zbot - real(r8) :: tbot_g, pbot_g, thbot_g, qbot_g, qs_g, es_g, rhos_g - real(r8) :: tbot_c, pbot_c, thbot_c, qbot_c, qs_c, es_c, rhos_c - real(r8) :: rhos_c_estimate, rhos_g_estimate - real(r8) :: dum1, dum2 - - character(len=*), parameter :: subname = 'downscale_forcings' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(eflx_sh_precip_conversion) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate(& - ! Parameters: - lapse_rate => atm2lnd_inst%params%lapse_rate , & ! Input: [real(r8)] Surface temperature lapse rate (K m-1) - - ! Gridcell-level metadata: - forc_topo_g => atm2lnd_inst%forc_topo_grc , & ! Input: [real(r8) (:)] atmospheric surface height (m) - - ! Column-level metadata: - topo_c => topo_inst%topo_col , & ! Input: [real(r8) (:)] column surface height (m) - - ! Gridcell-level non-downscaled fields: - forc_t_g => atm2lnd_inst%forc_t_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric temperature (Kelvin) - forc_th_g => atm2lnd_inst%forc_th_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric potential temperature (Kelvin) - forc_q_g => atm2lnd_inst%forc_q_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric specific humidity (kg/kg) - forc_pbot_g => atm2lnd_inst%forc_pbot_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric pressure (Pa) - forc_rho_g => atm2lnd_inst%forc_rho_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric density (kg/m**3) - - ! Column-level downscaled fields: - forc_t_c => atm2lnd_inst%forc_t_downscaled_col , & ! Output: [real(r8) (:)] atmospheric temperature (Kelvin) - forc_th_c => atm2lnd_inst%forc_th_downscaled_col , & ! Output: [real(r8) (:)] atmospheric potential temperature (Kelvin) - forc_q_c => atm2lnd_inst%forc_q_downscaled_col , & ! Output: [real(r8) (:)] atmospheric specific humidity (kg/kg) - forc_pbot_c => atm2lnd_inst%forc_pbot_downscaled_col , & ! Output: [real(r8) (:)] atmospheric pressure (Pa) - forc_rho_c => atm2lnd_inst%forc_rho_downscaled_col & ! Output: [real(r8) (:)] atmospheric density (kg/m**3) - ) - - ! Initialize column forcing (needs to be done for ALL active columns) - do c = bounds%begc,bounds%endc - if (col%active(c)) then - g = col%gridcell(c) - - forc_t_c(c) = forc_t_g(g) - forc_th_c(c) = forc_th_g(g) - forc_q_c(c) = forc_q_g(g) - forc_pbot_c(c) = forc_pbot_g(g) - forc_rho_c(c) = forc_rho_g(g) - end if - end do - - downscale_filter_c = topo_inst%DownscaleFilterc(bounds) - - ! Downscale forc_t, forc_th, forc_q, forc_pbot, and forc_rho to columns. - ! For glacier_mec columns the downscaling is based on surface elevation. - ! For other columns the downscaling is a simple copy (above). - do fc = 1, downscale_filter_c%num - c = downscale_filter_c%indices(fc) - l = col%landunit(c) - g = col%gridcell(c) - - ! This is a simple downscaling procedure - ! Note that forc_hgt, forc_u, and forc_v are not downscaled. - - hsurf_g = forc_topo_g(g) ! gridcell sfc elevation - hsurf_c = topo_c(c) ! column sfc elevation - tbot_g = forc_t_g(g) ! atm sfc temp - thbot_g = forc_th_g(g) ! atm sfc pot temp - qbot_g = forc_q_g(g) ! atm sfc spec humid - pbot_g = forc_pbot_g(g) ! atm sfc pressure - rhos_g = forc_rho_g(g) ! atm density - zbot = atm2lnd_inst%forc_hgt_grc(g) ! atm ref height - tbot_c = tbot_g-lapse_rate*(hsurf_c-hsurf_g) ! sfc temp for column - Hbot = rair*0.5_r8*(tbot_g+tbot_c)/grav ! scale ht at avg temp - pbot_c = pbot_g*exp(-(hsurf_c-hsurf_g)/Hbot) ! column sfc press - - ! Derivation of potential temperature calculation: - ! - ! The textbook definition would be: - ! thbot_c = tbot_c * (p0/pbot_c)^(rair/cpair) - ! - ! Note that pressure is related to scale height as: - ! pbot_c = p0 * exp(-zbot/H) - ! - ! Using Hbot in place of H, we get: - ! pbot_c = p0 * exp(-zbot/Hbot) - ! - ! Plugging this in to the textbook definition, then manipulating, we get: - ! thbot_c = tbot_c * (p0/(p0*exp(-zbot/Hbot)))^(rair/cpair) - ! = tbot_c * (1/exp(-zbot/Hbot))^(rair/cpair) - ! = tbot_c * (exp(zbot/Hbot))^(rair/cpair) - ! = tbot_c * exp((zbot/Hbot) * (rair/cpair)) - ! - ! But we want everything expressed in delta form, resulting in: - ! thbot_c = thbot_g + (tbot_c - tbot_g)*exp((zbot/Hbot)*(rair/cpair)) - - thbot_c= thbot_g + (tbot_c - tbot_g)*exp((zbot/Hbot)*(rair/cpair)) ! pot temp calc - - call Qsat(tbot_g,pbot_g,es_g,dum1,qs_g,dum2) - call Qsat(tbot_c,pbot_c,es_c,dum1,qs_c,dum2) - - qbot_c = qbot_g*(qs_c/qs_g) - - ! For forc_rho_c: We could simply set: - ! - ! rhos_c = rhos(pbot_c, egcm_c, tbot_c) - ! - ! However, we want forc_rho_c to be identical to forc_rho_g when topo_c equals - ! forc_topo_g. So we compute our own version of forc_rho_g using the rhos - ! function, and then multiply forc_rho_g by the ratio of (computed column-level - ! rho) to (computed gridcell-level rho). - rhos_c_estimate = rhos(qbot=qbot_c, pbot=pbot_c, tbot=tbot_c) - rhos_g_estimate = rhos(qbot=qbot_g, pbot=pbot_g, tbot=tbot_g) - rhos_c = rhos_g * (rhos_c_estimate / rhos_g_estimate) - - forc_t_c(c) = tbot_c - forc_th_c(c) = thbot_c - forc_q_c(c) = qbot_c - forc_pbot_c(c) = pbot_c - forc_rho_c(c) = rhos_c - - end do - - call partition_precip(bounds, atm2lnd_inst, & - eflx_sh_precip_conversion(bounds%begc:bounds%endc)) - - call downscale_longwave(bounds, downscale_filter_c, topo_inst, atm2lnd_inst) - - call check_downscale_consistency(bounds, atm2lnd_inst) - - end associate - - end subroutine downscale_forcings - - !----------------------------------------------------------------------- - pure function rhos(qbot, pbot, tbot) - ! - ! !DESCRIPTION: - ! Compute atmospheric density (kg/m**3) - ! - ! !USES: - ! - ! !ARGUMENTS: - real(r8) :: rhos ! function result: atmospheric density (kg/m**3) - real(r8), intent(in) :: qbot ! atmospheric specific humidity (kg/kg) - real(r8), intent(in) :: pbot ! atmospheric pressure (Pa) - real(r8), intent(in) :: tbot ! atmospheric temperature (K) - ! - ! !LOCAL VARIABLES: - real(r8) :: egcm - - character(len=*), parameter :: subname = 'rhos' - !----------------------------------------------------------------------- - - egcm = qbot*pbot / & - (wv_to_dair_weight_ratio + (1._r8 - wv_to_dair_weight_ratio)*qbot) - rhos = (pbot - (1._r8 - wv_to_dair_weight_ratio)*egcm) / (rair*tbot) - - end function rhos - - !----------------------------------------------------------------------- - subroutine partition_precip(bounds, atm2lnd_inst, eflx_sh_precip_conversion) - ! - ! !DESCRIPTION: - ! Partition precipitation into rain/snow based on temperature. - ! - ! Note that, unlike the other downscalings done here, this is currently applied over - ! all points - not just those within the downscale filter. - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(atm2lnd_type) , intent(inout) :: atm2lnd_inst - real(r8), intent(inout) :: eflx_sh_precip_conversion(bounds%begc:) ! sensible heat flux from precipitation conversion (W/m**2) [+ to atm] - ! - ! !LOCAL VARIABLES: - integer :: c,l,g ! indices - real(r8) :: rain_old ! rain before conversion - real(r8) :: snow_old ! snow before conversion - real(r8) :: all_snow_t ! temperature at which all precip falls as snow (K) - real(r8) :: frac_rain_slope ! slope of the frac_rain vs. temperature relationship - - character(len=*), parameter :: subname = 'partition_precip' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(eflx_sh_precip_conversion) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate(& - ! Gridcell-level non-downscaled fields: - forc_rain_g => atm2lnd_inst%forc_rain_not_downscaled_grc , & ! Input: [real(r8) (:)] rain rate [mm/s] - forc_snow_g => atm2lnd_inst%forc_snow_not_downscaled_grc , & ! Input: [real(r8) (:)] snow rate [mm/s] - - ! Column-level downscaled fields: - forc_t_c => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:)] atmospheric temperature (Kelvin) - forc_rain_c => atm2lnd_inst%forc_rain_downscaled_col , & ! Output: [real(r8) (:)] rain rate [mm/s] - forc_snow_c => atm2lnd_inst%forc_snow_downscaled_col & ! Output: [real(r8) (:)] snow rate [mm/s] - ) - - ! Initialize column forcing - do c = bounds%begc,bounds%endc - if (col%active(c)) then - g = col%gridcell(c) - forc_rain_c(c) = forc_rain_g(g) - forc_snow_c(c) = forc_snow_g(g) - eflx_sh_precip_conversion(c) = 0._r8 - end if - end do - - ! Optionally, convert rain to snow or vice versa based on forc_t_c - if (atm2lnd_inst%params%repartition_rain_snow) then - do c = bounds%begc, bounds%endc - if (col%active(c)) then - l = col%landunit(c) - rain_old = forc_rain_c(c) - snow_old = forc_snow_c(c) - if (lun%itype(l) == istice_mec) then - all_snow_t = atm2lnd_inst%params%precip_repartition_glc_all_snow_t - frac_rain_slope = atm2lnd_inst%params%precip_repartition_glc_frac_rain_slope - else - all_snow_t = atm2lnd_inst%params%precip_repartition_nonglc_all_snow_t - frac_rain_slope = atm2lnd_inst%params%precip_repartition_nonglc_frac_rain_slope - end if - call repartition_rain_snow_one_col(& - temperature = forc_t_c(c), & - all_snow_t = all_snow_t, & - frac_rain_slope = frac_rain_slope, & - rain = forc_rain_c(c), & - snow = forc_snow_c(c)) - call sens_heat_from_precip_conversion(& - rain_old = rain_old, & - snow_old = snow_old, & - rain_new = forc_rain_c(c), & - snow_new = forc_snow_c(c), & - sens_heat_flux = eflx_sh_precip_conversion(c)) - end if - end do - end if - - end associate - - end subroutine partition_precip - - !----------------------------------------------------------------------- - subroutine repartition_rain_snow_one_col(temperature, all_snow_t, frac_rain_slope, & - rain, snow) - ! - ! !DESCRIPTION: - ! Re-partition precipitation into rain/snow for a single column. - ! - ! Rain and snow variables should be set initially, and are updated here - ! - ! !ARGUMENTS: - real(r8) , intent(in) :: temperature ! near-surface temperature (K) - real(r8) , intent(in) :: all_snow_t ! temperature at which precip falls entirely as snow (K) - real(r8) , intent(in) :: frac_rain_slope ! slope of the frac_rain vs. T relationship - real(r8) , intent(inout) :: rain ! atm rain rate [mm/s] - real(r8) , intent(inout) :: snow ! atm snow rate [(mm water equivalent)/s] - ! - ! !LOCAL VARIABLES: - real(r8) :: frac_rain ! fraction of precipitation that should become rain - real(r8) :: total_precip - - character(len=*), parameter :: subname = 'repartition_rain_snow_one_col' - !----------------------------------------------------------------------- - - frac_rain = (temperature - all_snow_t) * frac_rain_slope - - ! bound in [0,1] - frac_rain = min(1.0_r8,max(0.0_r8,frac_rain)) - - total_precip = rain + snow - rain = total_precip * frac_rain - snow = total_precip - rain - - end subroutine repartition_rain_snow_one_col - - !----------------------------------------------------------------------- - subroutine sens_heat_from_precip_conversion(rain_old, snow_old, rain_new, snow_new, & - sens_heat_flux) - ! - ! !DESCRIPTION: - ! Given old and new rain and snow amounts, compute the sensible heat flux needed to - ! compensate for the rain-snow conversion. - ! - ! !USES: - ! - ! !ARGUMENTS: - real(r8), intent(in) :: rain_old ! [mm/s] - real(r8), intent(in) :: snow_old ! [(mm water equivalent)/s] - real(r8), intent(in) :: rain_new ! [mm/s] - real(r8), intent(in) :: snow_new ! [(mm water equivalent)/s] - real(r8), intent(out) :: sens_heat_flux ! [W/m^2] - ! - ! !LOCAL VARIABLES: - real(r8) :: total_old - real(r8) :: total_new - real(r8) :: rain_to_snow ! net conversion of rain to snow - - real(r8), parameter :: mm_to_m = 1.e-3_r8 ! multiply by this to convert from mm to m - real(r8), parameter :: tol = 1.e-13_r8 ! relative tolerance for error checks - - character(len=*), parameter :: subname = 'sens_heat_from_precip_conversion' - !----------------------------------------------------------------------- - - total_old = rain_old + snow_old - total_new = rain_new + snow_new - SHR_ASSERT(abs(total_new - total_old) <= (tol * total_old), subname//' ERROR: mismatch between old and new totals') - - ! rain to snow releases energy, so results in a positive heat flux to atm - rain_to_snow = snow_new - snow_old - sens_heat_flux = rain_to_snow * mm_to_m * denh2o * hfus - - end subroutine sens_heat_from_precip_conversion - - - !----------------------------------------------------------------------- - subroutine downscale_longwave(bounds, downscale_filter_c, & - topo_inst, atm2lnd_inst) - ! - ! !DESCRIPTION: - ! Downscale longwave radiation from gridcell to column - ! Must be done AFTER temperature downscaling - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(filter_col_type) , intent(in) :: downscale_filter_c - class(topo_type) , intent(in) :: topo_inst - type(atm2lnd_type) , intent(inout) :: atm2lnd_inst - ! - ! !LOCAL VARIABLES: - integer :: c,l,g,fc ! indices - real(r8) :: hsurf_c ! column-level elevation (m) - real(r8) :: hsurf_g ! gridcell-level elevation (m) - - real(r8), dimension(bounds%begg : bounds%endg) :: sum_lwrad_g ! weighted sum of column-level lwrad - real(r8), dimension(bounds%begg : bounds%endg) :: sum_wts_g ! sum of weights that contribute to sum_lwrad_g - real(r8), dimension(bounds%begg : bounds%endg) :: lwrad_norm_g ! normalization factors - real(r8), dimension(bounds%begg : bounds%endg) :: newsum_lwrad_g ! weighted sum of column-level lwrad after normalization - - character(len=*), parameter :: subname = 'downscale_longwave' - !----------------------------------------------------------------------- - - associate(& - ! Parameters: - lapse_rate_longwave => atm2lnd_inst%params%lapse_rate_longwave , & ! Input: [real(r8)] longwave radiation lapse rate (W m-2 m-1) - longwave_downscaling_limit => atm2lnd_inst%params%longwave_downscaling_limit, & ! Input: [real(r8)] Relative limit for how much longwave downscaling can be done (unitless) - - ! Gridcell-level metadata: - forc_topo_g => atm2lnd_inst%forc_topo_grc , & ! Input: [real(r8) (:)] atmospheric surface height (m) - - ! Column-level metadata: - topo_c => topo_inst%topo_col , & ! Input: [real(r8) (:)] column surface height (m) - - ! Gridcell-level fields: - forc_lwrad_g => atm2lnd_inst%forc_lwrad_not_downscaled_grc, & ! Input: [real(r8) (:)] downward longwave (W/m**2) - - ! Column-level (downscaled) fields: - forc_lwrad_c => atm2lnd_inst%forc_lwrad_downscaled_col & ! Output: [real(r8) (:)] downward longwave (W/m**2) - ) - - ! Initialize column forcing (needs to be done for ALL active columns) - do c = bounds%begc, bounds%endc - if (col%active(c)) then - g = col%gridcell(c) - forc_lwrad_c(c) = forc_lwrad_g(g) - end if - end do - - ! Optionally, downscale the longwave radiation, conserving energy - if (atm2lnd_inst%params%glcmec_downscale_longwave) then - - ! Initialize variables related to normalization - do g = bounds%begg, bounds%endg - sum_lwrad_g(g) = 0._r8 - sum_wts_g(g) = 0._r8 - newsum_lwrad_g(g) = 0._r8 - end do - - ! Do the downscaling - do fc = 1, downscale_filter_c%num - c = downscale_filter_c%indices(fc) - l = col%landunit(c) - g = col%gridcell(c) - - hsurf_g = forc_topo_g(g) - hsurf_c = topo_c(c) - - ! Assume a linear decrease in downwelling longwave radiation with increasing - ! elevation, based on Van Tricht et al. (2016, TC) Figure 6, - ! doi:10.5194/tc-10-2379-2016 - forc_lwrad_c(c) = forc_lwrad_g(g) - lapse_rate_longwave * (hsurf_c-hsurf_g) - ! But ensure that we don't depart too far from the atmospheric forcing value: - ! negative values of lwrad are certainly bad, but small positive values might - ! also be bad. We can especially run into trouble due to the normalization: a - ! small lwrad value in one column can lead to a big normalization factor, - ! leading to huge lwrad values in other columns. - forc_lwrad_c(c) = min(forc_lwrad_c(c), & - forc_lwrad_g(g) * (1._r8 + longwave_downscaling_limit)) - forc_lwrad_c(c) = max(forc_lwrad_c(c), & - forc_lwrad_g(g) * (1._r8 - longwave_downscaling_limit)) - - ! Keep track of the gridcell-level weighted sum for later normalization. - ! - ! This gridcell-level weighted sum just includes points for which we do the - ! downscaling (e.g., glc_mec points). Thus the contributing weights - ! generally do not add to 1. So to do the normalization properly, we also - ! need to keep track of the weights that have contributed to this sum. - sum_lwrad_g(g) = sum_lwrad_g(g) + col%wtgcell(c)*forc_lwrad_c(c) - sum_wts_g(g) = sum_wts_g(g) + col%wtgcell(c) - end do - - - ! Normalize forc_lwrad_c(c) to conserve energy - - call build_normalization(orig_field=forc_lwrad_g(bounds%begg:bounds%endg), & - sum_field=sum_lwrad_g(bounds%begg:bounds%endg), & - sum_wts=sum_wts_g(bounds%begg:bounds%endg), & - norms=lwrad_norm_g(bounds%begg:bounds%endg)) - - do fc = 1, downscale_filter_c%num - c = downscale_filter_c%indices(fc) - l = col%landunit(c) - g = col%gridcell(c) - - forc_lwrad_c(c) = forc_lwrad_c(c) * lwrad_norm_g(g) - newsum_lwrad_g(g) = newsum_lwrad_g(g) + col%wtgcell(c)*forc_lwrad_c(c) - end do - - - ! Make sure that, after normalization, the grid cell mean is conserved - - do g = bounds%begg, bounds%endg - if (sum_wts_g(g) > 0._r8) then - if (abs((newsum_lwrad_g(g) / sum_wts_g(g)) - forc_lwrad_g(g)) > 1.e-8_r8) then - write(iulog,*) 'g, newsum_lwrad_g, sum_wts_g, forc_lwrad_g: ', & - g, newsum_lwrad_g(g), sum_wts_g(g), forc_lwrad_g(g) - call endrun(msg=' ERROR: Energy conservation error downscaling longwave'//& - errMsg(sourcefile, __LINE__)) - end if - end if - end do - - end if ! glcmec_downscale_longwave - - end associate - - end subroutine downscale_longwave - - !----------------------------------------------------------------------- - subroutine build_normalization(orig_field, sum_field, sum_wts, norms) - ! - ! !DESCRIPTION: - ! Build an array of normalization factors that can be applied to a downscaled forcing - ! field, in order to force the mean of the new field to be the same as the mean of - ! the old field (for conservation). - ! - ! This allows for the possibility that only a subset of columns are downscaled. Only - ! the columns that are adjusted should be included in the weighted sum, sum_field; - ! sum_wts gives the sum of contributing weights on the grid cell level. - - ! For example, if a grid cell has an original forcing value of 1.0, and contains 4 - ! columns with the following weights on the gridcell, and the following values after - ! normalization: - ! - ! col #: 1 2 3 4 - ! weight: 0.1 0.2 0.3 0.4 - ! downscaled?: yes yes no no - ! value: 0.9 1.1 1.0 1.0 - ! - ! Then we would have: - ! orig_field(g) = 1.0 - ! sum_field(g) = 0.1*0.9 + 0.2*1.1 = 0.31 - ! sum_wts(g) = 0.1 + 0.2 = 0.3 - ! norms(g) = 1.0 / (0.31 / 0.3) = 0.9677 - ! - ! The field can then be normalized as: - ! forc_lwrad_c(c) = forc_lwrad_c(c) * lwrad_norm_g(g) - ! where lwrad_norm_g is the array of norms computed by this routine - - ! - ! !ARGUMENTS: - real(r8), intent(in) :: orig_field(:) ! the original field, at the grid cell level - real(r8), intent(in) :: sum_field(:) ! the new weighted sum across columns (dimensioned by grid cell) - real(r8), intent(in) :: sum_wts(:) ! sum of the weights used to create sum_field (dimensioned by grid cell) - real(r8), intent(out) :: norms(:) ! computed normalization factors - !----------------------------------------------------------------------- - - SHR_ASSERT((size(orig_field) == size(norms)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT((size(sum_field) == size(norms)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT((size(sum_wts) == size(norms)), errMsg(sourcefile, __LINE__)) - - where (sum_wts == 0._r8) - ! Avoid divide by zero; if sum_wts is 0, then the normalization doesn't matter, - ! because the adjusted values won't affect the grid cell mean. - norms = 1.0_r8 - - elsewhere (sum_field == 0._r8) - ! Avoid divide by zero. If this is because both sum_field and orig_field are 0, - ! then the normalization doesn't matter. If sum_field == 0 while orig_field /= 0, - ! then we have a problem: no normalization will allow us to recover the original - ! gridcell mean. We should probably catch this and abort, but for now we're - ! relying on error checking in the caller (checking for conservation) to catch - ! this potential problem. - norms = 1.0_r8 - - elsewhere - ! The standard case - norms = orig_field / (sum_field / sum_wts) - - end where - - end subroutine build_normalization - - - !----------------------------------------------------------------------- - subroutine check_downscale_consistency(bounds, atm2lnd_inst) - ! - ! !DESCRIPTION: - ! Check consistency of downscaling - ! - ! Note that this operates over more than just the filter used for the downscaling, - ! because it checks some things outside that filter. - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds - type(atm2lnd_type), intent(in) :: atm2lnd_inst - ! - ! !LOCAL VARIABLES: - integer :: g, l, c ! indices - character(len=*), parameter :: subname = 'check_downscale_consistency' - !----------------------------------------------------------------------- - - associate(& - ! Gridcell-level fields: - forc_t_g => atm2lnd_inst%forc_t_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric temperature (Kelvin) - forc_th_g => atm2lnd_inst%forc_th_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric potential temperature (Kelvin) - forc_q_g => atm2lnd_inst%forc_q_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric specific humidity (kg/kg) - forc_pbot_g => atm2lnd_inst%forc_pbot_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric pressure (Pa) - forc_rho_g => atm2lnd_inst%forc_rho_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric density (kg/m**3) - forc_rain_g => atm2lnd_inst%forc_rain_not_downscaled_grc , & ! Input: [real(r8) (:)] rain rate [mm/s] - forc_snow_g => atm2lnd_inst%forc_snow_not_downscaled_grc , & ! Input: [real(r8) (:)] snow rate [mm/s] - forc_lwrad_g => atm2lnd_inst%forc_lwrad_not_downscaled_grc , & ! Input: [real(r8) (:)] downward longwave (W/m**2) - - ! Column-level (downscaled) fields: - forc_t_c => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:)] atmospheric temperature (Kelvin) - forc_th_c => atm2lnd_inst%forc_th_downscaled_col , & ! Input: [real(r8) (:)] atmospheric potential temperature (Kelvin) - forc_q_c => atm2lnd_inst%forc_q_downscaled_col , & ! Input: [real(r8) (:)] atmospheric specific humidity (kg/kg) - forc_pbot_c => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:)] atmospheric pressure (Pa) - forc_rho_c => atm2lnd_inst%forc_rho_downscaled_col , & ! Input: [real(r8) (:)] atmospheric density (kg/m**3) - forc_rain_c => atm2lnd_inst%forc_rain_downscaled_col , & ! Input: [real(r8) (:)] rain rate [mm/s] - forc_snow_c => atm2lnd_inst%forc_snow_downscaled_col , & ! Input: [real(r8) (:)] snow rate [mm/s] - forc_lwrad_c => atm2lnd_inst%forc_lwrad_downscaled_col & ! Input: [real(r8) (:)] downward longwave (W/m**2) - ) - - ! BUG(wjs, 2016-11-15, bugz 2377) - ! - ! Make sure that, for urban points, the column-level forcing fields are identical to - ! the gridcell-level forcing fields. This is needed because the urban-specific code - ! sometimes uses the gridcell-level forcing fields (and it would take a large - ! refactor to change this to use column-level fields). - ! - ! However, do NOT check rain & snow: these ARE downscaled for urban points (as for - ! all other points), and the urban code does not refer to the gridcell-level versions - ! of these fields. - - do c = bounds%begc, bounds%endc - if (col%active(c)) then - l = col%landunit(c) - g = col%gridcell(c) - - if (lun%urbpoi(l)) then - if (forc_t_c(c) /= forc_t_g(g) .or. & - forc_th_c(c) /= forc_th_g(g) .or. & - forc_q_c(c) /= forc_q_g(g) .or. & - forc_pbot_c(c) /= forc_pbot_g(g) .or. & - forc_rho_c(c) /= forc_rho_g(g) .or. & - forc_lwrad_c(c) /= forc_lwrad_g(g)) then - write(iulog,*) subname//' ERROR: column-level forcing differs from gridcell-level forcing for urban point' - write(iulog,*) 'c, g = ', c, g - write(iulog,*) 'forc_t_c, forc_t_g = ', forc_t_c(c), forc_t_g(g) - write(iulog,*) 'forc_th_c, forc_th_g = ', forc_th_c(c), forc_th_g(g) - write(iulog,*) 'forc_q_c, forc_q_g = ', forc_q_c(c), forc_q_g(g) - write(iulog,*) 'forc_pbot_c, forc_pbot_g = ', forc_pbot_c(c), forc_pbot_g(g) - write(iulog,*) 'forc_rho_c, forc_rho_g = ', forc_rho_c(c), forc_rho_g(g) - write(iulog,*) 'forc_lwrad_c, forc_lwrad_g = ', forc_lwrad_c(c), forc_lwrad_g(g) - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if ! inequal - end if ! urbpoi - end if ! active - end do - - end associate - - end subroutine check_downscale_consistency - -end module atm2lndMod diff --git a/src/main/atm2lndType.F90 b/src/main/atm2lndType.F90 index f0d58fe158..80e3dd93cd 100644 --- a/src/main/atm2lndType.F90 +++ b/src/main/atm2lndType.F90 @@ -10,7 +10,7 @@ module atm2lndType use shr_log_mod , only : errMsg => shr_log_errMsg use clm_varpar , only : numrad, ndst, nlevgrnd !ndst = number of dust bins. ! MML: numrad = 2, 1=vis, 2=nir use clm_varcon , only : rair, grav, cpair, hfus, tfrz, spval - use clm_varctl , only : iulog, use_cn, use_cndv, use_fates, use_luna + use clm_varctl , only : iulog use decompMod , only : bounds_type use abortutils , only : endrun use PatchType , only : patch @@ -21,38 +21,6 @@ module atm2lndType save ! ! !PUBLIC DATA TYPES: - - type, public :: atm2lnd_params_type - ! true => repartition rain/snow from atm based on temperature - logical :: repartition_rain_snow - - ! true => downscale longwave radiation - logical :: glcmec_downscale_longwave - - ! Surface temperature lapse rate (K m-1) - real(r8) :: lapse_rate - - ! longwave radiation lapse rate (W m-2 m-1) - real(r8) :: lapse_rate_longwave - - ! Relative limit for how much longwave downscaling can be done (unitless) - ! The pre-normalized, downscaled longwave is restricted to be in the range - ! [lwrad*(1-longwave_downscaling_limit), lwrad*(1+longwave_downscaling_limit)] - real(r8) :: longwave_downscaling_limit - - ! Rain-snow ramp for glacier landunits - ! frac_rain = (temp - all_snow_t) * frac_rain_slope - ! (all_snow_t is in K) - real(r8) :: precip_repartition_glc_all_snow_t - real(r8) :: precip_repartition_glc_frac_rain_slope - - ! Rain-snow ramp for non-glacier landunits - ! frac_rain = (temp - all_snow_t) * frac_rain_slope - ! (all_snow_t is in K) - real(r8) :: precip_repartition_nonglc_all_snow_t - real(r8) :: precip_repartition_nonglc_frac_rain_slope - end type atm2lnd_params_type - !---------------------------------------------------- ! atmosphere -> land variables structure ! @@ -68,7 +36,6 @@ module atm2lndType ! MML: I don't think this applies to me... I'm working at the grc level, not the col level... !---------------------------------------------------- type, public :: atm2lnd_type - type(atm2lnd_params_type) :: params ! atm->lnd not downscaled real(r8), pointer :: forc_u_grc (:) => null() ! atm wind speed, east direction (m/s) @@ -84,23 +51,17 @@ module atm2lndType real(r8), pointer :: forc_rh_grc (:) => null() ! atmospheric relative humidity (%) real(r8), pointer :: forc_psrf_grc (:) => null() ! surface pressure (Pa) real(r8), pointer :: forc_pco2_grc (:) => null() ! CO2 partial pressure (Pa) - real(r8), pointer :: forc_pco2_240_patch (:) => null() ! 10-day mean CO2 partial pressure (Pa) real(r8), pointer :: forc_solad_grc (:,:) => null() ! direct beam radiation (numrad) (vis=forc_sols , nir=forc_soll ) real(r8), pointer :: forc_solai_grc (:,:) => null() ! diffuse radiation (numrad) (vis=forc_solsd, nir=forc_solld) real(r8), pointer :: forc_solar_grc (:) => null() ! incident solar radiation - real(r8), pointer :: forc_ndep_grc (:) => null() ! nitrogen deposition rate (gN/m2/s) - real(r8), pointer :: forc_pc13o2_grc (:) => null() ! C13O2 partial pressure (Pa) real(r8), pointer :: forc_po2_grc (:) => null() ! O2 partial pressure (Pa) - real(r8), pointer :: forc_po2_240_patch (:) => null() ! 10-day mean O2 partial pressure (Pa) real(r8), pointer :: forc_aer_grc (:,:) => null() ! aerosol deposition array - real(r8), pointer :: forc_pch4_grc (:) => null() ! CH4 partial pressure (Pa) real(r8), pointer :: forc_t_not_downscaled_grc (:) => null() ! not downscaled atm temperature (Kelvin) real(r8), pointer :: forc_th_not_downscaled_grc (:) => null() ! not downscaled atm potential temperature (Kelvin) real(r8), pointer :: forc_q_not_downscaled_grc (:) => null() ! not downscaled atm specific humidity (kg/kg) ! MML: I think this is the q I need to check if the negative LH is too big. real(r8), pointer :: forc_pbot_not_downscaled_grc (:) => null() ! not downscaled atm pressure (Pa) - real(r8), pointer :: forc_pbot240_downscaled_patch (:) => null() ! 10-day mean downscaled atm pressure (Pa) real(r8), pointer :: forc_rho_not_downscaled_grc (:) => null() ! not downscaled atm density (kg/m**3) real(r8), pointer :: forc_rain_not_downscaled_grc (:) => null() ! not downscaled atm rain rate [mm/s] real(r8), pointer :: forc_snow_not_downscaled_grc (:) => null() ! not downscaled atm snow rate [mm/s] @@ -276,54 +237,18 @@ module atm2lndType ! ------------------------------------------------------------------------------------ - - - ! atm->lnd downscaled - real(r8), pointer :: forc_t_downscaled_col (:) => null() ! downscaled atm temperature (Kelvin) - real(r8), pointer :: forc_th_downscaled_col (:) => null() ! downscaled atm potential temperature (Kelvin) - real(r8), pointer :: forc_q_downscaled_col (:) => null() ! downscaled atm specific humidity (kg/kg) - real(r8), pointer :: forc_pbot_downscaled_col (:) => null() ! downscaled atm pressure (Pa) - real(r8), pointer :: forc_rho_downscaled_col (:) => null() ! downscaled atm density (kg/m**3) - real(r8), pointer :: forc_rain_downscaled_col (:) => null() ! downscaled atm rain rate [mm/s] - real(r8), pointer :: forc_snow_downscaled_col (:) => null() ! downscaled atm snow rate [mm/s] - real(r8), pointer :: forc_lwrad_downscaled_col (:) => null() ! downscaled atm downwrd IR longwave radiation (W/m**2) ! rof->lnd real(r8), pointer :: forc_flood_grc (:) => null() ! rof flood (mm/s) real(r8), pointer :: volr_grc (:) => null() ! rof volr total volume (m3) real(r8), pointer :: volrmch_grc (:) => null() ! rof volr main channel (m3) - ! anomaly forcing - real(r8), pointer :: af_precip_grc (:) => null() ! anomaly forcing - real(r8), pointer :: af_uwind_grc (:) => null() ! anomaly forcing - real(r8), pointer :: af_vwind_grc (:) => null() ! anomaly forcing - real(r8), pointer :: af_tbot_grc (:) => null() ! anomaly forcing - real(r8), pointer :: af_pbot_grc (:) => null() ! anomaly forcing - real(r8), pointer :: af_shum_grc (:) => null() ! anomaly forcing - real(r8), pointer :: af_swdn_grc (:) => null() ! anomaly forcing - real(r8), pointer :: af_lwdn_grc (:) => null() ! anomaly forcing - real(r8), pointer :: bc_precip_grc (:) => null() ! anomaly forcing - add bias correction - ! time averaged quantities - real(r8) , pointer :: fsd24_patch (:) => null() ! patch 24hr average of direct beam radiation real(r8) , pointer :: fsd240_patch (:) => null() ! patch 240hr average of direct beam radiation - real(r8) , pointer :: fsi24_patch (:) => null() ! patch 24hr average of diffuse beam radiation - real(r8) , pointer :: fsi240_patch (:) => null() ! patch 240hr average of diffuse beam radiation - real(r8) , pointer :: prec365_col (:) => null() ! col 365-day running mean of tot. precipitation (see comment in UpdateAccVars regarding why this is col-level despite other prec accumulators being patch-level) - real(r8) , pointer :: prec60_patch (:) => null() ! patch 60-day running mean of tot. precipitation (mm/s) - real(r8) , pointer :: prec10_patch (:) => null() ! patch 10-day running mean of tot. precipitation (mm/s) - real(r8) , pointer :: rh30_patch (:) => null() ! patch 30-day running mean of relative humidity - real(r8) , pointer :: prec24_patch (:) => null() ! patch 24-hour running mean of tot. precipitation (mm/s) - real(r8) , pointer :: rh24_patch (:) => null() ! patch 24-hour running mean of relative humidity - real(r8) , pointer :: wind24_patch (:) => null() ! patch 24-hour running mean of wind - real(r8) , pointer :: t_mo_patch (:) => null() ! patch 30-day average temperature (Kelvin) - real(r8) , pointer :: t_mo_min_patch (:) => null() ! patch annual min of t_mo (Kelvin) contains procedure, public :: Init - procedure, public :: InitForTesting ! version of Init meant for unit testing - procedure, private :: ReadNamelist procedure, private :: InitAllocate procedure, private :: InitHistory procedure, private :: InitCold ! MML 2016.01.15 adding InitCold to give accumulating variables a starting point @@ -335,165 +260,19 @@ module atm2lndType end type atm2lnd_type - interface atm2lnd_params_type - module procedure atm2lnd_params_constructor - end interface atm2lnd_params_type - character(len=*), parameter, private :: sourcefile = & __FILE__ !---------------------------------------------------- contains - !----------------------------------------------------------------------- - function atm2lnd_params_constructor(repartition_rain_snow, glcmec_downscale_longwave, & - lapse_rate, lapse_rate_longwave, longwave_downscaling_limit, & - precip_repartition_glc_all_snow_t, precip_repartition_glc_all_rain_t, & - precip_repartition_nonglc_all_snow_t, precip_repartition_nonglc_all_rain_t) & - result(params) - ! - ! !DESCRIPTION: - ! Creates a new instance of atm2lnd_params_type - ! - ! !USES: - ! - ! !ARGUMENTS: - type(atm2lnd_params_type) :: params ! function result - logical, intent(in) :: repartition_rain_snow - logical, intent(in) :: glcmec_downscale_longwave - - ! Surface temperature lapse rate (K m-1) - real(r8), intent(in) :: lapse_rate - - ! Longwave radiation lapse rate (W m-2 m-1) - ! Must be present if glcmec_downscale_longwave is true; ignored otherwise - real(r8), intent(in), optional :: lapse_rate_longwave - - ! Relative limit for how much longwave downscaling can be done (unitless) - ! Must be present if glcmec_downscale_longwave is true; ignored otherwise - real(r8), intent(in), optional :: longwave_downscaling_limit - - ! End-points of the rain-snow ramp for glacier landunits (degrees C) - ! Must be present if repartition_rain_snow is true; ignored otherwise - real(r8), intent(in), optional :: precip_repartition_glc_all_snow_t - real(r8), intent(in), optional :: precip_repartition_glc_all_rain_t - - ! End-points of the rain-snow ramp for non-glacier landunits (degrees C) - ! Must be present if repartition_rain_snow is true; ignored otherwise - real(r8), intent(in), optional :: precip_repartition_nonglc_all_snow_t - real(r8), intent(in), optional :: precip_repartition_nonglc_all_rain_t - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'atm2lnd_params_constructor' - !----------------------------------------------------------------------- - - params%repartition_rain_snow = repartition_rain_snow - params%glcmec_downscale_longwave = glcmec_downscale_longwave - - params%lapse_rate = lapse_rate - - if (glcmec_downscale_longwave) then - if (.not. present(lapse_rate_longwave)) then - call endrun(subname // & - ' ERROR: For glcmec_downscale_longwave true, lapse_rate_longwave must be provided') - end if - if (.not. present(longwave_downscaling_limit)) then - call endrun(subname // & - ' ERROR: For glcmec_downscale_longwave true, longwave_downscaling_limit must be provided') - end if - - if (longwave_downscaling_limit < 0._r8 .or. & - longwave_downscaling_limit > 1._r8) then - call endrun(subname // & - ' ERROR: longwave_downscaling_limit must be between 0 and 1') - end if - - params%lapse_rate_longwave = lapse_rate_longwave - params%longwave_downscaling_limit = longwave_downscaling_limit - else - params%lapse_rate_longwave = nan - params%longwave_downscaling_limit = nan - end if - - if (repartition_rain_snow) then - - ! Make sure all of the repartitioning-related parameters are present - - if (.not. present(precip_repartition_glc_all_snow_t)) then - call endrun(subname // & - ' ERROR: For repartition_rain_snow true, precip_repartition_glc_all_snow_t must be provided') - end if - if (.not. present(precip_repartition_glc_all_rain_t)) then - call endrun(subname // & - ' ERROR: For repartition_rain_snow true, precip_repartition_glc_all_rain_t must be provided') - end if - if (.not. present(precip_repartition_nonglc_all_snow_t)) then - call endrun(subname // & - ' ERROR: For repartition_rain_snow true, precip_repartition_nonglc_all_snow_t must be provided') - end if - if (.not. present(precip_repartition_nonglc_all_rain_t)) then - call endrun(subname // & - ' ERROR: For repartition_rain_snow true, precip_repartition_nonglc_all_rain_t must be provided') - end if - - ! Do some other error checking - - if (precip_repartition_glc_all_rain_t <= precip_repartition_glc_all_snow_t) then - call endrun(subname // & - ' ERROR: Must have precip_repartition_glc_all_snow_t < precip_repartition_glc_all_rain_t') - end if - - if (precip_repartition_nonglc_all_rain_t <= precip_repartition_nonglc_all_snow_t) then - call endrun(subname // & - ' ERROR: Must have precip_repartition_nonglc_all_snow_t < precip_repartition_nonglc_all_rain_t') - end if - - ! Convert to the form of the parameters we want for the main code - - call compute_ramp_params( & - all_snow_t_c = precip_repartition_glc_all_snow_t, & - all_rain_t_c = precip_repartition_glc_all_rain_t, & - all_snow_t_k = params%precip_repartition_glc_all_snow_t, & - frac_rain_slope = params%precip_repartition_glc_frac_rain_slope) - - call compute_ramp_params( & - all_snow_t_c = precip_repartition_nonglc_all_snow_t, & - all_rain_t_c = precip_repartition_nonglc_all_rain_t, & - all_snow_t_k = params%precip_repartition_nonglc_all_snow_t, & - frac_rain_slope = params%precip_repartition_nonglc_frac_rain_slope) - - else ! .not. repartition_rain_snow - params%precip_repartition_glc_all_snow_t = nan - params%precip_repartition_glc_frac_rain_slope = nan - params%precip_repartition_nonglc_all_snow_t = nan - params%precip_repartition_nonglc_frac_rain_slope = nan - end if - - contains - subroutine compute_ramp_params(all_snow_t_c, all_rain_t_c, & - all_snow_t_k, frac_rain_slope) - real(r8), intent(in) :: all_snow_t_c ! Temperature at which precip falls entirely as rain (deg C) - real(r8), intent(in) :: all_rain_t_c ! Temperature at which precip falls entirely as snow (deg C) - real(r8), intent(out) :: all_snow_t_k ! Temperature at which precip falls entirely as snow (K) - real(r8), intent(out) :: frac_rain_slope ! Slope of the frac_rain vs. T relationship - - frac_rain_slope = 1._r8 / (all_rain_t_c - all_snow_t_c) - all_snow_t_k = all_snow_t_c + tfrz - end subroutine compute_ramp_params - - end function atm2lnd_params_constructor - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, NLFilename) + subroutine Init(this, bounds) class(atm2lnd_type) :: this type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename ! namelist filename call this%InitAllocate(bounds) - call this%ReadNamelist(NLFilename) call this%InitHistory(bounds) ! MML 2016.01.15 adding call to InitCold (make sure it doesn't keep using the @@ -502,156 +281,6 @@ subroutine Init(this, bounds, NLFilename) end subroutine Init - !----------------------------------------------------------------------- - subroutine InitForTesting(this, bounds, params) - ! - ! !DESCRIPTION: - ! Does initialization needed for unit testing. Allows caller to prescribe parameter - ! values (bypassing the namelist read) - ! - ! !USES: - ! - ! !ARGUMENTS: - class(atm2lnd_type) :: this - type(bounds_type), intent(in) :: bounds - - ! If params isn't provided, we use default values - type(atm2lnd_params_type), intent(in), optional :: params - ! - ! !LOCAL VARIABLES: - type(atm2lnd_params_type) :: l_params - - character(len=*), parameter :: subname = 'InitForTesting' - !----------------------------------------------------------------------- - - if (present(params)) then - l_params = params - else - ! Use arbitrary values - l_params = atm2lnd_params_type( & - repartition_rain_snow = .false., & - glcmec_downscale_longwave = .false., & - lapse_rate = 0.01_r8) - end if - - call this%InitAllocate(bounds) - this%params = l_params - - end subroutine InitForTesting - - - !----------------------------------------------------------------------- - subroutine ReadNamelist(this, NLFilename) - ! - ! !DESCRIPTION: - ! Read the atm2lnd namelist - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - class(atm2lnd_type), intent(inout) :: this - ! - ! !LOCAL VARIABLES: - - ! temporary variables corresponding to the components of atm2lnd_params_type - logical :: repartition_rain_snow - logical :: glcmec_downscale_longwave - real(r8) :: lapse_rate - real(r8) :: lapse_rate_longwave - real(r8) :: longwave_downscaling_limit - real(r8) :: precip_repartition_glc_all_snow_t - real(r8) :: precip_repartition_glc_all_rain_t - real(r8) :: precip_repartition_nonglc_all_snow_t - real(r8) :: precip_repartition_nonglc_all_rain_t - - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - character(len=*), parameter :: nmlname = 'atm2lnd_inparm' - - character(len=*), parameter :: subname = 'ReadNamelist' - !----------------------------------------------------------------------- - - namelist /atm2lnd_inparm/ repartition_rain_snow, glcmec_downscale_longwave, & - lapse_rate, lapse_rate_longwave, longwave_downscaling_limit, & - precip_repartition_glc_all_snow_t, precip_repartition_glc_all_rain_t, & - precip_repartition_nonglc_all_snow_t, precip_repartition_nonglc_all_rain_t - - ! Initialize namelist variables to defaults - repartition_rain_snow = .false. - glcmec_downscale_longwave = .false. - lapse_rate = nan - lapse_rate_longwave = nan - longwave_downscaling_limit = nan - precip_repartition_glc_all_snow_t = nan - precip_repartition_glc_all_rain_t = nan - precip_repartition_nonglc_all_snow_t = nan - precip_repartition_nonglc_all_rain_t = nan - - if (masterproc) then - unitn = getavu() - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=atm2lnd_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast(repartition_rain_snow, mpicom) - call shr_mpi_bcast(glcmec_downscale_longwave, mpicom) - call shr_mpi_bcast(lapse_rate, mpicom) - call shr_mpi_bcast(lapse_rate_longwave, mpicom) - call shr_mpi_bcast(longwave_downscaling_limit, mpicom) - call shr_mpi_bcast(precip_repartition_glc_all_snow_t, mpicom) - call shr_mpi_bcast(precip_repartition_glc_all_rain_t, mpicom) - call shr_mpi_bcast(precip_repartition_nonglc_all_snow_t, mpicom) - call shr_mpi_bcast(precip_repartition_nonglc_all_rain_t, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - ! Write settings one-by-one rather than with a nml write because some settings may - ! be NaN if certain options are turned off. - write(iulog,*) 'repartition_rain_snow = ', repartition_rain_snow - write(iulog,*) 'glcmec_downscale_longwave = ', glcmec_downscale_longwave - write(iulog,*) 'lapse_rate = ', lapse_rate - if (glcmec_downscale_longwave) then - write(iulog,*) 'lapse_rate_longwave = ', lapse_rate_longwave - write(iulog,*) 'longwave_downscaling_limit = ', longwave_downscaling_limit - end if - if (repartition_rain_snow) then - write(iulog,*) 'precip_repartition_glc_all_snow_t = ', precip_repartition_glc_all_snow_t - write(iulog,*) 'precip_repartition_glc_all_rain_t = ', precip_repartition_glc_all_rain_t - write(iulog,*) 'precip_repartition_nonglc_all_snow_t = ', precip_repartition_nonglc_all_snow_t - write(iulog,*) 'precip_repartition_nonglc_all_rain_t = ', precip_repartition_nonglc_all_rain_t - end if - write(iulog,*) ' ' - end if - - this%params = atm2lnd_params_type( & - repartition_rain_snow = repartition_rain_snow, & - glcmec_downscale_longwave = glcmec_downscale_longwave, & - lapse_rate = lapse_rate, & - lapse_rate_longwave = lapse_rate_longwave, & - longwave_downscaling_limit = longwave_downscaling_limit, & - precip_repartition_glc_all_snow_t = precip_repartition_glc_all_snow_t, & - precip_repartition_glc_all_rain_t = precip_repartition_glc_all_rain_t, & - precip_repartition_nonglc_all_snow_t = precip_repartition_nonglc_all_snow_t, & - precip_repartition_nonglc_all_rain_t = precip_repartition_nonglc_all_rain_t) - - end subroutine ReadNamelist - - !------------------------------------------------------------------------ subroutine InitAllocate(this, bounds) ! @@ -689,16 +318,8 @@ subroutine InitAllocate(this, bounds) allocate(this%forc_solad_grc (begg:endg,numrad)) ; this%forc_solad_grc (:,:) = ival allocate(this%forc_solai_grc (begg:endg,numrad)) ; this%forc_solai_grc (:,:) = ival allocate(this%forc_solar_grc (begg:endg)) ; this%forc_solar_grc (:) = ival - allocate(this%forc_ndep_grc (begg:endg)) ; this%forc_ndep_grc (:) = ival - allocate(this%forc_pc13o2_grc (begg:endg)) ; this%forc_pc13o2_grc (:) = ival allocate(this%forc_po2_grc (begg:endg)) ; this%forc_po2_grc (:) = ival allocate(this%forc_aer_grc (begg:endg,14)) ; this%forc_aer_grc (:,:) = ival - allocate(this%forc_pch4_grc (begg:endg)) ; this%forc_pch4_grc (:) = ival - if(use_luna)then - allocate(this%forc_pco2_240_patch (begp:endp)) ; this%forc_pco2_240_patch (:) = ival - allocate(this%forc_po2_240_patch (begp:endp)) ; this%forc_po2_240_patch (:) = ival - allocate(this%forc_pbot240_downscaled_patch(begp:endp)) ; this%forc_pbot240_downscaled_patch (:) = ival - endif ! atm->lnd not downscaled allocate(this%forc_t_not_downscaled_grc (begg:endg)) ; this%forc_t_not_downscaled_grc (:) = ival @@ -847,48 +468,12 @@ subroutine InitAllocate(this, bounds) ! --------------------------------------- - - ! atm->lnd downscaled - allocate(this%forc_t_downscaled_col (begc:endc)) ; this%forc_t_downscaled_col (:) = ival - allocate(this%forc_q_downscaled_col (begc:endc)) ; this%forc_q_downscaled_col (:) = ival - allocate(this%forc_pbot_downscaled_col (begc:endc)) ; this%forc_pbot_downscaled_col (:) = ival - allocate(this%forc_th_downscaled_col (begc:endc)) ; this%forc_th_downscaled_col (:) = ival - allocate(this%forc_rho_downscaled_col (begc:endc)) ; this%forc_rho_downscaled_col (:) = ival - allocate(this%forc_lwrad_downscaled_col (begc:endc)) ; this%forc_lwrad_downscaled_col (:) = ival - allocate(this%forc_rain_downscaled_col (begc:endc)) ; this%forc_rain_downscaled_col (:) = ival - allocate(this%forc_snow_downscaled_col (begc:endc)) ; this%forc_snow_downscaled_col (:) = ival - ! rof->lnd allocate(this%forc_flood_grc (begg:endg)) ; this%forc_flood_grc (:) = ival allocate(this%volr_grc (begg:endg)) ; this%volr_grc (:) = ival allocate(this%volrmch_grc (begg:endg)) ; this%volrmch_grc (:) = ival - ! anomaly forcing - allocate(this%bc_precip_grc (begg:endg)) ; this%bc_precip_grc (:) = ival - allocate(this%af_precip_grc (begg:endg)) ; this%af_precip_grc (:) = ival - allocate(this%af_uwind_grc (begg:endg)) ; this%af_uwind_grc (:) = ival - allocate(this%af_vwind_grc (begg:endg)) ; this%af_vwind_grc (:) = ival - allocate(this%af_tbot_grc (begg:endg)) ; this%af_tbot_grc (:) = ival - allocate(this%af_pbot_grc (begg:endg)) ; this%af_pbot_grc (:) = ival - allocate(this%af_shum_grc (begg:endg)) ; this%af_shum_grc (:) = ival - allocate(this%af_swdn_grc (begg:endg)) ; this%af_swdn_grc (:) = ival - allocate(this%af_lwdn_grc (begg:endg)) ; this%af_lwdn_grc (:) = ival - - allocate(this%fsd24_patch (begp:endp)) ; this%fsd24_patch (:) = nan allocate(this%fsd240_patch (begp:endp)) ; this%fsd240_patch (:) = nan - allocate(this%fsi24_patch (begp:endp)) ; this%fsi24_patch (:) = nan - allocate(this%fsi240_patch (begp:endp)) ; this%fsi240_patch (:) = nan - allocate(this%prec10_patch (begp:endp)) ; this%prec10_patch (:) = nan - allocate(this%prec60_patch (begp:endp)) ; this%prec60_patch (:) = nan - allocate(this%rh30_patch (begp:endp)) ; this%rh30_patch (:) = nan - allocate(this%prec365_col (begc:endc)) ; this%prec365_col (:) = nan - if (use_fates) then - allocate(this%prec24_patch (begp:endp)) ; this%prec24_patch (:) = nan - allocate(this%rh24_patch (begp:endp)) ; this%rh24_patch (:) = nan - allocate(this%wind24_patch (begp:endp)) ; this%wind24_patch (:) = nan - end if - allocate(this%t_mo_patch (begp:endp)) ; this%t_mo_patch (:) = nan - allocate(this%t_mo_min_patch (begp:endp)) ; this%t_mo_min_patch (:) = spval ! TODO - initialize this elsewhere end subroutine InitAllocate @@ -898,7 +483,7 @@ subroutine InitHistory(this, bounds) ! !USES: ! use histFileMod, only : hist_addfld1d ! MML: - use histFileMod, only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp + use histFileMod, only : hist_addfld1d, hist_addfld2d ! ! !ARGUMENTS: class(atm2lnd_type) :: this @@ -920,29 +505,10 @@ subroutine InitHistory(this, bounds) !write(iulog,*) 'MML trying write h0 - start' - this%forc_flood_grc(begg:endg) = spval - call hist_addfld1d (fname='QFLOOD', units='mm/s', & - avgflag='A', long_name='runoff from river flooding', & - ptr_lnd=this%forc_flood_grc) - - this%volr_grc(begg:endg) = spval - call hist_addfld1d (fname='VOLR', units='m3', & - avgflag='A', long_name='river channel total water storage', & - ptr_lnd=this%volr_grc) - - this%volrmch_grc(begg:endg) = spval - call hist_addfld1d (fname='VOLRMCH', units='m3', & - avgflag='A', long_name='river channel main channel water storage', & - ptr_lnd=this%volrmch_grc) - this%forc_wind_grc(begg:endg) = spval call hist_addfld1d (fname='WIND', units='m/s', & avgflag='A', long_name='atmospheric wind velocity magnitude', & ptr_lnd=this%forc_wind_grc) - ! Rename of WIND for Urban intercomparision project - call hist_addfld1d (fname='Wind', units='m/s', & - avgflag='A', long_name='atmospheric wind velocity magnitude', & - ptr_gcell=this%forc_wind_grc, default = 'inactive') this%forc_hgt_grc(begg:endg) = spval call hist_addfld1d (fname='ZBOT', units='m', & @@ -979,30 +545,6 @@ subroutine InitHistory(this, bounds) avgflag='A', long_name='atmospheric air temperature received from atmosphere (pre-downscaling)', & ptr_gcell=this%forc_t_not_downscaled_grc, default='inactive') - this%forc_t_downscaled_col(begc:endc) = spval - call hist_addfld1d (fname='TBOT', units='K', & - avgflag='A', long_name='atmospheric air temperature (downscaled to columns in glacier regions)', & - ptr_col=this%forc_t_downscaled_col) - call hist_addfld1d (fname='Tair', units='K', & - avgflag='A', long_name='atmospheric air temperature (downscaled to columns in glacier regions)', & - ptr_col=this%forc_t_downscaled_col, default='inactive') - - this%forc_pbot_downscaled_col(begc:endc) = spval - call hist_addfld1d (fname='PBOT', units='Pa', & - avgflag='A', long_name='atmospheric pressure at surface (downscaled to columns in glacier regions)', & - ptr_col=this%forc_pbot_downscaled_col) - call hist_addfld1d (fname='PSurf', units='Pa', & - avgflag='A', long_name='atmospheric pressure at surface (downscaled to columns in glacier regions)', & - ptr_col=this%forc_pbot_downscaled_col, default='inactive') - - this%forc_lwrad_downscaled_col(begc:endc) = spval - call hist_addfld1d (fname='FLDS', units='W/m^2', & - avgflag='A', long_name='atmospheric longwave radiation (downscaled to columns in glacier regions)', & - ptr_col=this%forc_lwrad_downscaled_col) - call hist_addfld1d (fname='LWdown', units='W/m^2', & - avgflag='A', long_name='atmospheric longwave radiation (downscaled to columns in glacier regions)', & - ptr_col=this%forc_lwrad_downscaled_col, default='inactive') - this%forc_rain_not_downscaled_grc(begg:endg) = spval call hist_addfld1d (fname='RAIN_FROM_ATM', units='mm/s', & avgflag='A', long_name='atmospheric rain received from atmosphere (pre-repartitioning)', & @@ -1013,41 +555,6 @@ subroutine InitHistory(this, bounds) avgflag='A', long_name='atmospheric snow received from atmosphere (pre-repartitioning)', & ptr_lnd=this%forc_snow_not_downscaled_grc) - this%forc_rain_downscaled_col(begc:endc) = spval - call hist_addfld1d (fname='RAIN', units='mm/s', & - avgflag='A', long_name='atmospheric rain, after rain/snow repartitioning based on temperature', & - ptr_col=this%forc_rain_downscaled_col) - call hist_addfld1d (fname='Rainf', units='mm/s', & - avgflag='A', long_name='atmospheric rain, after rain/snow repartitioning based on temperature', & - ptr_col=this%forc_rain_downscaled_col, default='inactive') - - this%forc_snow_downscaled_col(begc:endc) = spval - call hist_addfld1d (fname='SNOW', units='mm/s', & - avgflag='A', long_name='atmospheric snow, after rain/snow repartitioning based on temperature', & - ptr_col=this%forc_snow_downscaled_col) - - this%forc_th_downscaled_col(begc:endc) = spval - call hist_addfld1d (fname='THBOT', units='K', & - avgflag='A', long_name='atmospheric air potential temperature (downscaled to columns in glacier regions)', & - ptr_col=this%forc_th_downscaled_col) - -! ! MML: 2016.01.14 Try and add a new history field variable equal to 2TBOT -! ! (just to see if it will print) -! this%forc_2t_not_downscaled_grc(begg:endg) = spval -! call hist_addfld1d (fname='T2BOT', units='K', & -! avgflag='A', long_name='2x atmospheric air temperature MML Test', & -! ptr_lnd=this%forc_2t_not_downscaled_grc) - - this%forc_q_downscaled_col(begc:endc) = spval - call hist_addfld1d (fname='QBOT', units='kg/kg', & - avgflag='A', long_name='atmospheric specific humidity (downscaled to columns in glacier regions)', & - ptr_col=this%forc_q_downscaled_col) - ! Rename of QBOT for Urban intercomparison project - call hist_addfld1d (fname='Qair', units='kg/kg', & - avgflag='A', long_name='atmospheric specific humidity (downscaled to columns in glacier regions)', & - ptr_col=this%forc_q_downscaled_col, default='inactive') - - !----------------------------------------------------------------------- ! MML: 2016.01.14 Simple Land Energy and Hydrology variables (gridscale) @@ -1376,11 +883,6 @@ subroutine InitHistory(this, bounds) ! Soil variables ! start 2d - ! 2d example from SoilBiogeochemCarbonStateType.F90 - !call hist_addfld2d (fname=fieldname, units='gC/m^3', type2d='levdcmp', & - ! avgflag='A', long_name=longname, & - ! ptr_col=data2dptr) - ! I wanted to add an mml case to the type2d, but for now change it back, since its crashing !write(iulog,*) 'MML write to h0: 2d soil vars ' @@ -1601,66 +1103,6 @@ subroutine InitHistory(this, bounds) ! End MML simple land model added variables !----------------------------------------------------------------------- - - ! Time averaged quantities - this%fsi24_patch(begp:endp) = spval - call hist_addfld1d (fname='FSI24', units='K', & - avgflag='A', long_name='indirect radiation (last 24hrs)', & - ptr_patch=this%fsi24_patch, default='inactive') - - this%fsi240_patch(begp:endp) = spval - call hist_addfld1d (fname='FSI240', units='K', & - avgflag='A', long_name='indirect radiation (last 240hrs)', & - ptr_patch=this%fsi240_patch, default='inactive') - - this%fsd24_patch(begp:endp) = spval - call hist_addfld1d (fname='FSD24', units='K', & - avgflag='A', long_name='direct radiation (last 24hrs)', & - ptr_patch=this%fsd24_patch, default='inactive') - - this%fsd240_patch(begp:endp) = spval - call hist_addfld1d (fname='FSD240', units='K', & - avgflag='A', long_name='direct radiation (last 240hrs)', & - ptr_patch=this%fsd240_patch, default='inactive') - - if (use_cn) then - this%rh30_patch(begp:endp) = spval - call hist_addfld1d (fname='RH30', units='%', & - avgflag='A', long_name='30-day running mean of relative humidity', & - ptr_patch=this%rh30_patch, default='inactive') - - this%prec10_patch(begp:endp) = spval - call hist_addfld1d (fname='PREC10', units='MM H2O/S', & - avgflag='A', long_name='10-day running mean of PREC', & - ptr_patch=this%prec10_patch, default='inactive') - - this%prec60_patch(begp:endp) = spval - call hist_addfld1d (fname='PREC60', units='MM H2O/S', & - avgflag='A', long_name='60-day running mean of PREC', & - ptr_patch=this%prec60_patch, default='inactive') - end if - - if (use_cndv) then - call hist_addfld1d (fname='TDA', units='K', & - avgflag='A', long_name='daily average 2-m temperature', & - ptr_patch=this%t_mo_patch) - end if - - if(use_luna)then - this%forc_pco2_240_patch = spval - call hist_addfld1d (fname='PCO2_240', units='Pa', & - avgflag='A', long_name='10 day running mean of CO2 pressure', & - ptr_patch=this%forc_pco2_240_patch, default='inactive') - this%forc_po2_240_patch = spval - call hist_addfld1d (fname='PO2_240', units='Pa', & - avgflag='A', long_name='10 day running mean of O2 pressure', & - ptr_patch=this%forc_po2_240_patch, default='inactive') - this%forc_pbot240_downscaled_patch = spval - call hist_addfld1d (fname='PBOT_240', units='Pa', & - avgflag='A', long_name='10 day running mean of air pressure', & - ptr_patch=this%forc_pbot240_downscaled_patch, default='inactive') - endif - end subroutine InitHistory !----------------------------------------------------------------------- @@ -1869,80 +1311,11 @@ subroutine InitAccBuffer (this, bounds) type(bounds_type), intent(in) :: bounds !--------------------------------------------------------------------- - this%fsd24_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='FSD24', units='W/m2', & - desc='24hr average of direct solar radiation', accum_type='runmean', accum_period=-1, & - subgrid_type='pft', numlev=1, init_value=0._r8) - this%fsd240_patch(bounds%begp:bounds%endp) = spval call init_accum_field (name='FSD240', units='W/m2', & desc='240hr average of direct solar radiation', accum_type='runmean', accum_period=-10, & subgrid_type='pft', numlev=1, init_value=0._r8) - this%fsi24_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='FSI24', units='W/m2', & - desc='24hr average of diffuse solar radiation', accum_type='runmean', accum_period=-1, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - this%fsi240_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='FSI240', units='W/m2', & - desc='240hr average of diffuse solar radiation', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - if (use_cn) then - call init_accum_field (name='PREC10', units='MM H2O/S', & - desc='10-day running mean of total precipitation', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field (name='PREC60', units='MM H2O/S', & - desc='60-day running mean of total precipitation', accum_type='runmean', accum_period=-60, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field (name='RH30', units='%', & - desc='30-day running mean of relative humidity', accum_type='runmean', accum_period=-30, & - subgrid_type='pft', numlev=1, init_value=100._r8) - end if - - if (use_cndv) then - ! The following is a running mean with the accumulation period is set to -365 for a 365-day running mean. - call init_accum_field (name='PREC365', units='MM H2O/S', & - desc='365-day running mean of total precipitation', accum_type='runmean', accum_period=-365, & - subgrid_type='column', numlev=1, init_value=0._r8) - end if - - if ( use_fates ) then - call init_accum_field (name='PREC24', units='m', & - desc='24hr sum of precipitation', accum_type='runmean', accum_period=-1, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - ! Fudge - this neds to be initialized from the restat file eventually. - call init_accum_field (name='RH24', units='m', & - desc='24hr average of RH', accum_type='runmean', accum_period=-1, & - subgrid_type='pft', numlev=1, init_value=100._r8) - - call init_accum_field (name='WIND24', units='m', & - desc='24hr average of wind', accum_type='runmean', accum_period=-1, & - subgrid_type='pft', numlev=1, init_value=0._r8) - end if - - if(use_luna) then - this%forc_po2_240_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='po2_240', units='Pa', & - desc='10-day running mean of parial O2 pressure', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=21223._r8) - - this%forc_pco2_240_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='pco2_240', units='Pa', & - desc='10-day running mean of parial CO2 pressure', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=28._r8) - - this%forc_pbot240_downscaled_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='pbot240', units='Pa', & - desc='10-day running mean of air pressure', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=101325._r8) - - endif - end subroutine InitAccBuffer !----------------------------------------------------------------------- @@ -1964,15 +1337,12 @@ subroutine InitAccVars(this, bounds) ! ! !LOCAL VARIABLES: integer :: begp, endp - integer :: begc, endc integer :: nstep integer :: ier real(r8), pointer :: rbufslp(:) ! temporary - real(r8), pointer :: rbufslc(:) ! temporary !--------------------------------------------------------------------- begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc ! Allocate needed dynamic memory for single level patch field allocate(rbufslp(begp:endp), stat=ier) @@ -1981,73 +1351,14 @@ subroutine InitAccVars(this, bounds) call endrun(msg="InitAccVars allocation error for rbufslp"//& errMsg(sourcefile, __LINE__)) endif - ! Allocate needed dynamic memory for single level col field - allocate(rbufslc(begc:endc), stat=ier) - if (ier/=0) then - write(iulog,*)' in ' - call endrun(msg="InitAccVars allocation error for rbufslc"//& - errMsg(sourcefile, __LINE__)) - endif ! Determine time step nstep = get_nstep() - call extract_accum_field ('FSD24', rbufslp, nstep) - this%fsd24_patch(begp:endp) = rbufslp(begp:endp) - call extract_accum_field ('FSD240', rbufslp, nstep) this%fsd240_patch(begp:endp) = rbufslp(begp:endp) - call extract_accum_field ('FSI24', rbufslp, nstep) - this%fsi24_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('FSI240', rbufslp, nstep) - this%fsi240_patch(begp:endp) = rbufslp(begp:endp) - - if (use_cn) then - call extract_accum_field ('PREC10', rbufslp, nstep) - this%prec10_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('PREC60', rbufslp, nstep) - this%prec60_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('RH30', rbufslp, nstep) - this%rh30_patch(begp:endp) = rbufslp(begp:endp) - end if - - if (use_cndv) then - call extract_accum_field ('PREC365' , rbufslc, nstep) - this%prec365_col(begc:endc) = rbufslc(begc:endc) - - call extract_accum_field ('TDA', rbufslp, nstep) - this%t_mo_patch(begp:endp) = rbufslp(begp:endp) - end if - - if (use_fates) then - call extract_accum_field ('PREC24', rbufslp, nstep) - this%prec24_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('RH24', rbufslp, nstep) - this%rh24_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('WIND24', rbufslp, nstep) - this%wind24_patch(begp:endp) = rbufslp(begp:endp) - end if - - if(use_luna) then - call extract_accum_field ('po2_240', rbufslp, nstep) - this%forc_po2_240_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('pco2_240', rbufslp, nstep) - this%forc_pco2_240_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('pbot240', rbufslp, nstep) - this%forc_pbot240_downscaled_patch(begp:endp) = rbufslp(begp:endp) - - endif - deallocate(rbufslp) - deallocate(rbufslc) end subroutine InitAccVars @@ -2064,17 +1375,13 @@ subroutine UpdateAccVars (this, bounds) ! ! !LOCAL VARIABLES: integer :: g,c,p ! indices - integer :: dtime ! timestep size [seconds] integer :: nstep ! timestep number integer :: ier ! error status integer :: begp, endp - integer :: begc, endc real(r8), pointer :: rbufslp(:) ! temporary single level - patch level - real(r8), pointer :: rbufslc(:) ! temporary single level - column level !--------------------------------------------------------------------- begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc nstep = get_nstep() @@ -2084,12 +1391,6 @@ subroutine UpdateAccVars (this, bounds) write(iulog,*)'UpdateAccVars allocation error for rbufslp' call endrun(msg=errMsg(sourcefile, __LINE__)) endif - ! Allocate needed dynamic memory for single level col field - allocate(rbufslc(begc:endc), stat=ier) - if (ier/=0) then - write(iulog,*)'UpdateAccVars allocation error for rbufslc' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif ! Accumulate and extract forc_solad24 & forc_solad240 do p = begp,endp @@ -2098,121 +1399,8 @@ subroutine UpdateAccVars (this, bounds) end do call update_accum_field ('FSD240', rbufslp , nstep) call extract_accum_field ('FSD240', this%fsd240_patch , nstep) - call update_accum_field ('FSD24' , rbufslp , nstep) - call extract_accum_field ('FSD24' , this%fsd24_patch , nstep) - - ! Accumulate and extract forc_solai24 & forc_solai240 - do p = begp,endp - g = patch%gridcell(p) - rbufslp(p) = this%forc_solai_grc(g,1) - end do - call update_accum_field ('FSI24' , rbufslp , nstep) - call extract_accum_field ('FSI24' , this%fsi24_patch , nstep) - call update_accum_field ('FSI240', rbufslp , nstep) - call extract_accum_field ('FSI240', this%fsi240_patch , nstep) - - ! Precipitation accumulators - ! - ! For CNDV, we use a column-level accumulator. We cannot use a patch-level - ! accumulator for CNDV because this is used for establishment, so must be available - ! for inactive patches. In principle, we could/should switch to column-level for the - ! other precip accumulators, too; we'd just need to be careful about backwards - ! compatibility with old restart files. - - do p = begp,endp - c = patch%column(p) - rbufslp(p) = this%forc_rain_downscaled_col(c) + this%forc_snow_downscaled_col(c) - rbufslc(c) = this%forc_rain_downscaled_col(c) + this%forc_snow_downscaled_col(c) - end do - - if (use_cn) then - ! Accumulate and extract PREC60 (accumulates total precipitation as 60-day running mean) - call update_accum_field ('PREC60', rbufslp, nstep) - call extract_accum_field ('PREC60', this%prec60_patch, nstep) - - ! Accumulate and extract PREC10 (accumulates total precipitation as 10-day running mean) - call update_accum_field ('PREC10', rbufslp, nstep) - call extract_accum_field ('PREC10', this%prec10_patch, nstep) - end if - - if (use_cndv) then - ! Accumulate and extract PREC365 (accumulates total precipitation as 365-day running mean) - ! See above comment regarding why this is at the column-level despite other prec - ! accumulators being at the patch level. - call update_accum_field ('PREC365', rbufslc, nstep) - call extract_accum_field ('PREC365', this%prec365_col, nstep) - - ! Accumulate and extract TDA (accumulates TBOT as 30-day average) and - ! also determines t_mo_min - - do p = begp,endp - c = patch%column(p) - rbufslp(p) = this%forc_t_downscaled_col(c) - end do - call update_accum_field ('TDA', rbufslp, nstep) - call extract_accum_field ('TDA', rbufslp, nstep) - do p = begp,endp - this%t_mo_patch(p) = rbufslp(p) - this%t_mo_min_patch(p) = min(this%t_mo_min_patch(p), rbufslp(p)) - end do - - end if - - if (use_fates) then - call update_accum_field ('PREC24', rbufslp, nstep) - call extract_accum_field ('PREC24', this%prec24_patch, nstep) - - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - rbufslp(p) = this%forc_wind_grc(g) - end do - call update_accum_field ('WIND24', rbufslp, nstep) - call extract_accum_field ('WIND24', this%wind24_patch, nstep) - - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - rbufslp(p) = this%forc_rh_grc(g) - end do - call update_accum_field ('RH24', rbufslp, nstep) - call extract_accum_field ('RH24', this%rh24_patch, nstep) - end if - - if(use_luna) then - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - rbufslp(p) = this%forc_pco2_grc(g) - enddo - call update_accum_field ('pco2_240', rbufslp, nstep) - call extract_accum_field ('pco2_240', this%forc_pco2_240_patch, nstep) - - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - rbufslp(p) = this%forc_po2_grc(g) - enddo - call update_accum_field ('po2_240', rbufslp, nstep) - call extract_accum_field ('po2_240', this%forc_po2_240_patch, nstep) - - do p = bounds%begp,bounds%endp - c = patch%column(p) - rbufslp(p) = this%forc_pbot_downscaled_col(c) - enddo - call update_accum_field ('pbot240', rbufslp, nstep) - call extract_accum_field ('pbot240', this%forc_pbot240_downscaled_patch, nstep) - - endif - - if (use_cn) then - do p = begp,endp - g = patch%gridcell(p) - rbufslp(p) = this%forc_rh_grc(g) - end do - ! Accumulate and extract RH30 (accumulates RH as 30-day running mean) - call update_accum_field ('RH30', rbufslp, nstep) - call extract_accum_field ('RH30', this%rh30_patch, nstep) - endif deallocate(rbufslp) - deallocate(rbufslc) end subroutine UpdateAccVars @@ -2242,24 +1430,6 @@ subroutine Restart(this, bounds, ncid, flag) this%forc_flood_grc = 0._r8 endif - if (use_cndv) then - call restartvar(ncid=ncid, flag=flag, varname='T_MO_MIN', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%t_mo_min_patch) - end if - - if(use_luna)then - call restartvar(ncid=ncid, flag=flag, varname='pco2_240', xtype=ncd_double, & - dim1name='pft', long_name='10-day mean CO2 partial pressure', units='Pa', & - interpinic_flag='interp', readvar=readvar, data=this%forc_pco2_240_patch ) - call restartvar(ncid=ncid, flag=flag, varname='po2_240', xtype=ncd_double, & - dim1name='pft', long_name='10-day mean O2 partial pressure', units='Pa', & - interpinic_flag='interp', readvar=readvar, data=this%forc_po2_240_patch ) - call restartvar(ncid=ncid, flag=flag, varname='pbot240', xtype=ncd_double, & - dim1name='pft', long_name='10 day mean atmospheric pressure(Pa)', units='Pa', & - interpinic_flag='interp', readvar=readvar, data=this%forc_pbot240_downscaled_patch ) - endif - ! ----------------------------------------------------------------------- ! Start MML simple land model restart variables section ! MML 2016.01.15 @@ -2437,11 +1607,8 @@ subroutine Clean(this) deallocate(this%forc_solad_grc) deallocate(this%forc_solai_grc) deallocate(this%forc_solar_grc) - deallocate(this%forc_ndep_grc) - deallocate(this%forc_pc13o2_grc) deallocate(this%forc_po2_grc) deallocate(this%forc_aer_grc) - deallocate(this%forc_pch4_grc) ! atm->lnd not downscaled deallocate(this%forc_t_not_downscaled_grc) @@ -2453,46 +1620,12 @@ subroutine Clean(this) deallocate(this%forc_rain_not_downscaled_grc) deallocate(this%forc_snow_not_downscaled_grc) - ! atm->lnd downscaled - deallocate(this%forc_t_downscaled_col) - deallocate(this%forc_q_downscaled_col) - deallocate(this%forc_pbot_downscaled_col) - deallocate(this%forc_th_downscaled_col) - deallocate(this%forc_rho_downscaled_col) - deallocate(this%forc_lwrad_downscaled_col) - deallocate(this%forc_rain_downscaled_col) - deallocate(this%forc_snow_downscaled_col) - ! rof->lnd deallocate(this%forc_flood_grc) deallocate(this%volr_grc) deallocate(this%volrmch_grc) - ! anomaly forcing - deallocate(this%bc_precip_grc) - deallocate(this%af_precip_grc) - deallocate(this%af_uwind_grc) - deallocate(this%af_vwind_grc) - deallocate(this%af_tbot_grc) - deallocate(this%af_pbot_grc) - deallocate(this%af_shum_grc) - deallocate(this%af_swdn_grc) - deallocate(this%af_lwdn_grc) - - deallocate(this%fsd24_patch) deallocate(this%fsd240_patch) - deallocate(this%fsi24_patch) - deallocate(this%fsi240_patch) - deallocate(this%prec10_patch) - deallocate(this%prec60_patch) - deallocate(this%prec365_col) - if (use_fates) then - deallocate(this%prec24_patch) - deallocate(this%rh24_patch) - deallocate(this%wind24_patch) - end if - deallocate(this%t_mo_patch) - deallocate(this%t_mo_min_patch) ! MML: deallocate mml vars: diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 index 5a36c237a8..432a09085f 100644 --- a/src/main/clm_driver.F90 +++ b/src/main/clm_driver.F90 @@ -10,25 +10,17 @@ module clm_driver ! !USES: use shr_kind_mod , only : r8 => shr_kind_r8 use clm_varctl , only : wrtdia, iulog - use clm_varctl , only : use_cn, use_noio + use clm_varctl , only : use_noio use clm_time_manager , only : get_nstep use spmdMod , only : masterproc, mpicom use decompMod , only : get_proc_clumps, get_clump_bounds, get_proc_bounds, bounds_type - use filterMod , only : filter_inactive_and_active use histFileMod , only : hist_update_hbuf, hist_htapes_wrapup use restFileMod , only : restFile_write, restFile_filename use abortutils , only : endrun ! - use SoilBiogeochemVerticalProfileMod , only : SoilBiogeochemVerticalProfile - use ActiveLayerMod , only : alt_calc - ! use perf_mod ! MML: this is where t_startf and t_stopf are ! - use clm_instMod , only : temperature_inst, canopystate_inst - use clm_instMod , only : soilstate_inst, soilbiogeochem_state_inst - use clm_instMod , only : bgc_vegetation_inst use clm_instMod , only : atm2lnd_inst, lnd2atm_inst - use clm_instMod , only : soilstate_inst ! MML: add use simple land model module use mml_mainMod , only : mml_main ! MML if I don't say "only", it'll be fine, yes? @@ -98,32 +90,9 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro call get_proc_bounds(bounds_proc) nclumps = get_proc_clumps() -! MML: I think I need this bit !$OMP PARALLEL DO PRIVATE (nc,bounds_clump) do nc = 1,nclumps call get_clump_bounds(nc, bounds_clump) - - ! BUG(wjs, 2014-12-15, bugz 2107) Because of the placement of the following - ! routines (alt_calc and SoilBiogeochemVerticalProfile) in the driver sequence - - ! they are called very early in each timestep, before weights are adjusted and - ! filters are updated - it may be necessary for these routines to compute values - ! over inactive as well as active points (since some inactive points may soon - ! become active) - so that's what is done now. Currently, it seems to be okay to do - ! this, because the variables computed here seem to only depend on quantities that - ! are valid over inactive as well as active points. - - call t_startf("decomp_vert") - call alt_calc(filter_inactive_and_active(nc)%num_soilc, filter_inactive_and_active(nc)%soilc, & - temperature_inst, canopystate_inst) - - if (use_cn) then - call SoilBiogeochemVerticalProfile(bounds_clump , & - filter_inactive_and_active(nc)%num_soilc, filter_inactive_and_active(nc)%soilc , & - filter_inactive_and_active(nc)%num_soilp, filter_inactive_and_active(nc)%soilp , & - canopystate_inst, soilstate_inst, soilbiogeochem_state_inst) - end if - - call t_stopf("decomp_vert") end do !$OMP END PARALLEL DO @@ -177,56 +146,22 @@ subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, ro ! Create history and write history tapes if appropriate call t_startf('clm_drv_io_htapes') - !write(iulog,*)'MML: about to call htapes_wrapup, prepare to die, my name is inigio montoya... also wtf does it want the soilstate for? ' - - ! MML workaround to try and avoid the soilstate leading to crashing - this is CLM's soil state, not SLIM's, so the values shouldn't be meaningful anyhow - !soilstate_inst%watsat_col(bounds_proc%begc:bounds_proc%endc, :) = 0.0_r8 - !soilstate_inst%sucsat_col(bounds_proc%begc:bounds_proc%endc, :) = 0.0_r8 - !soilstate_inst%bsw_col(bounds_proc%begc:bounds_proc%endc, :) = 0.0_r8 - !soilstate_inst%hksat_col(bounds_proc%begc:bounds_proc%endc, :) = 0.0_r8 - - !write(iulog,*)'MML: clobbered the soilstate_inst values, call hist_htapes_wrapup now' - - !write(iulog,*)'MML: rstwr = ',rstwr,', nlend = ',nlend - - call hist_htapes_wrapup( rstwr, nlend, bounds_proc, & - soilstate_inst%watsat_col(bounds_proc%begc:bounds_proc%endc, 1:), & - soilstate_inst%sucsat_col(bounds_proc%begc:bounds_proc%endc, 1:), & - soilstate_inst%bsw_col(bounds_proc%begc:bounds_proc%endc, 1:), & - soilstate_inst%hksat_col(bounds_proc%begc:bounds_proc%endc, 1:)) - - !write(iulog,*)'MML: back from wrapup, yet we are still running' + call hist_htapes_wrapup( rstwr, nlend, bounds_proc ) call t_stopf('clm_drv_io_htapes') - if (use_cn) then - call bgc_vegetation_inst%WriteHistory(bounds_proc) - end if - ! Write restart/initial files if appropriate if (rstwr) then - !write(iulog,*)'MML: write restart file' call t_startf('clm_drv_io_wrest') filer = restFile_filename(rdate=rdate) call restFile_write( bounds_proc, filer, rdate=rdate ) call t_stopf('clm_drv_io_wrest') - - ! MML: - ! write(iulog,*) 'MML: end of restart if statment ' - end if call t_stopf('clm_drv_io') - - ! MML: - !write(iulog,*) 'MML: after restart call ' - end if - ! MML: - !write(iulog,*) 'MML: end clm_drv routine ' - end subroutine clm_drv !------------------------------------------------------------------------ diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 57a915042b..75682fbc89 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -12,10 +12,8 @@ module clm_initializeMod use clm_varctl , only : nsrest, nsrStartup, nsrContinue, nsrBranch use clm_varctl , only : is_cold_start, is_interpolated_start use clm_varctl , only : iulog - use clm_varctl , only : use_cn, use_cndv - use clm_instur , only : wt_lunit, urban_valid, wt_nat_patch, wt_cft, fert_cft, wt_glc_mec, topo_glc_mec + use clm_instur , only : wt_lunit, urban_valid, wt_nat_patch, wt_cft, wt_glc_mec, topo_glc_mec use perf_mod , only : t_startf, t_stopf - use readParamsMod , only : readParameters use ncdio_pio , only : file_desc_t use GridcellType , only : grc ! instance use LandunitType , only : lun ! instance @@ -42,18 +40,17 @@ subroutine initialize1( ) ! CLM initialization first phase ! ! !USES: - use clm_varpar , only: clm_varpar_init, natpft_lb, natpft_ub, cft_lb, cft_ub, maxpatch_glcmec + use clm_varpar , only: clm_varpar_init, natpft_lb, natpft_ub, cft_lb, cft_ub use clm_varcon , only: clm_varcon_init use landunit_varcon , only: landunit_varcon_init, max_lunit use clm_varctl , only: fsurdat, fatmlndfrc, noland, version, mml_surdat - use pftconMod , only: pftcon use decompInitMod , only: decompInit_lnd, decompInit_clumps, decompInit_glcp use domainMod , only: domain_check, ldomain, domain_init use surfrdMod , only: surfrd_get_globmask, surfrd_get_grid, surfrd_get_data use controlMod , only: control_init, control_print, NLFilename use ncdio_pio , only: ncd_pio_init use initGridCellsMod , only: initGridCells - use UrbanParamsType , only: UrbanInput, IsSimpleBuildTemp + use UrbanParamsType , only: UrbanInput ! ! !LOCAL VARIABLES: integer :: ier ! error status @@ -85,7 +82,7 @@ subroutine initialize1( ) call control_init() call clm_varpar_init() - call clm_varcon_init( IsSimpleBuildTemp() ) + call clm_varcon_init() call landunit_varcon_init() call ncd_pio_init() @@ -153,14 +150,8 @@ subroutine initialize1( ) allocate (urban_valid (begg:endg )) allocate (wt_nat_patch (begg:endg, natpft_lb:natpft_ub )) allocate (wt_cft (begg:endg, cft_lb:cft_ub )) - allocate (fert_cft (begg:endg, cft_lb:cft_ub )) - allocate (wt_glc_mec (begg:endg, maxpatch_glcmec)) - allocate (topo_glc_mec(begg:endg, maxpatch_glcmec)) - - ! Read list of Patches and their corresponding parameter values - ! Independent of model resolution, Needs to stay before surfrd_get_data - - call pftcon%Init() + allocate (wt_glc_mec (begg:endg, 10)) + allocate (topo_glc_mec(begg:endg, 10)) ! Read surface dataset and set up subgrid weight arrays @@ -203,7 +194,7 @@ subroutine initialize1( ) !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) do nc = 1, nclumps call get_clump_bounds(nc, bounds_clump) - call reweight_wrapup(bounds_clump, glc_behavior) + call reweight_wrapup(bounds_clump) end do !$OMP END PARALLEL DO @@ -225,20 +216,13 @@ subroutine initialize2( ) ! CLM initialization - second phase ! ! !USES: - use shr_orb_mod , only : shr_orb_decl use shr_scam_mod , only : shr_scam_getCloseLatLon - use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND - use accumulMod , only : print_accum_fields use clm_varpar , only : nlevsno use clm_varcon , only : spval use clm_varctl , only : finidat, finidat_interp_source, finidat_interp_dest, fsurdat, mml_surdat - use clm_varctl , only : use_century_decomp, single_column, scmlat, scmlon, use_cn - use clm_varorb , only : eccen, mvelpp, lambm0, obliqr - use clm_time_manager , only : get_step_size, get_curr_calday + use clm_varctl , only : single_column, scmlat, scmlon use clm_time_manager , only : get_curr_date, get_nstep, advance_timestep use clm_time_manager , only : timemgr_init, timemgr_restart_io, timemgr_restart - !use DaylengthMod , only : InitDaylength, daylength -! use dynSubgridDriverMod , only : dynSubgrid_init use fileutils , only : getfil use initInterpMod , only : initInterp use subgridWeightsMod , only : init_subgrid_weights_mod @@ -246,10 +230,6 @@ subroutine initialize2( ) use histFileMod , only : hist_addfld1d, hist_addfld2d, no_snow_normal use restFileMod , only : restFile_getfile, restFile_open, restFile_close use restFileMod , only : restFile_read, restFile_write - !use ndepStreamMod , only : ndep_init, ndep_interp - use LakeCon , only : LakeConInit - use SatellitePhenologyMod , only : SatellitePhenologyInit, readAnnualVegetation, interpMonthlyVeg - use SnowSnicarMod , only : SnowAge_init, SnowOptics_init use lnd2atmMod , only : lnd2atm_minimal use controlMod , only : NLFilename ! @@ -267,19 +247,12 @@ subroutine initialize2( ) character(len=256) :: pnamer ! full pathname of netcdf restart file character(len=256) :: locfn ! local file name type(file_desc_t) :: ncid ! netcdf id - real(r8) :: dtime ! time step increment (sec) integer :: nstep ! model time step - real(r8) :: calday ! calendar day for nstep - real(r8) :: caldaym1 ! calendar day for nstep-1 - real(r8) :: declin ! solar declination angle in radians for nstep - real(r8) :: declinm1 ! solar declination angle in radians for nstep-1 - real(r8) :: eccf ! earth orbit eccentricity factor type(bounds_type) :: bounds_proc ! processor bounds type(bounds_type) :: bounds_clump ! clump bounds logical :: lexist integer :: closelatidx,closelonidx real(r8) :: closelat,closelon - real(r8) :: max_decl ! temporary, for calculation of max_dayl integer :: begp, endp integer :: begc, endc integer :: begl, endl @@ -296,13 +269,6 @@ subroutine initialize2( ) call get_proc_bounds(bounds_proc) nclumps = get_proc_clumps() - ! ------------------------------------------------------------------------ - ! Read in parameters files - ! ------------------------------------------------------------------------ - - call clm_instReadNML( NLFilename ) - call readParameters(photosyns_inst) - ! ------------------------------------------------------------------------ ! Initialize time manager ! ------------------------------------------------------------------------ @@ -317,44 +283,6 @@ subroutine initialize2( ) call timemgr_restart() end if - ! ------------------------------------------------------------------------ - ! Initialize daylength from the previous time step (needed so prev_dayl can be set correctly) - ! ------------------------------------------------------------------------ - - call t_startf('init_orbd') - - calday = get_curr_calday() - call shr_orb_decl( calday, eccen, mvelpp, lambm0, obliqr, declin, eccf ) - - dtime = get_step_size() - caldaym1 = get_curr_calday(offset=-int(dtime)) - call shr_orb_decl( caldaym1, eccen, mvelpp, lambm0, obliqr, declinm1, eccf ) - - call t_stopf('init_orbd') - - !call InitDaylength(bounds_proc, declin=declin, declinm1=declinm1) - - ! Initialize maximum daylength, based on latitude and maximum declination - ! given by the obliquity use negative value for S. Hem - - do g = bounds_proc%begg,bounds_proc%endg - max_decl = obliqr - if (grc%lat(g) < 0._r8) max_decl = -max_decl - !grc%max_dayl(g) = daylength(grc%lat(g), max_decl) - end do - - ! History file variables - - if (use_cn) then - !call hist_addfld1d (fname='DAYL', units='s', & - !avgflag='A', long_name='daylength', & - !ptr_gcell=grc%dayl, default='inactive') - - !call hist_addfld1d (fname='PREV_DAYL', units='s', & - !avgflag='A', long_name='daylength from previous timestep', & - !ptr_gcell=grc%prev_dayl, default='inactive') - end if - ! ------------------------------------------------------------------------ ! Initialize component data structures ! ------------------------------------------------------------------------ @@ -393,15 +321,10 @@ subroutine initialize2( ) call clm_instInit(bounds_proc) - ! Initialize SNICAR optical and aging parameters - - call SnowOptics_init( ) ! SNICAR optical parameters: - call SnowAge_init( ) ! SNICAR aging parameters: - call hist_printflds() ! ------------------------------------------------------------------------ - ! Initializate dynamic subgrid weights (for prescribed transient Patches, CNDV + ! Initializate dynamic subgrid weights (for prescribed transient Patches ! and/or dynamic landunits); note that these will be overwritten in a ! restart run ! ------------------------------------------------------------------------ @@ -414,25 +337,6 @@ subroutine initialize2( ) ! Initialize modules (after time-manager initialization in most cases) ! ------------------------------------------------------------------------ - if (use_cn) then - call bgc_vegetation_inst%Init2(bounds_proc, NLFilename) - - ! NOTE(wjs, 2016-02-23) Maybe the rest of the body of this conditional should also - ! be moved into bgc_vegetation_inst%Init2 - - if (n_drydep > 0 .and. drydep_method == DD_XLND) then - ! Must do this also when drydeposition is used so that estimates of monthly - ! differences in LAI can be computed - call SatellitePhenologyInit(bounds_proc) - end if - - else - call SatellitePhenologyInit(bounds_proc) - end if - - - - ! ------------------------------------------------------------------------ ! On restart only - process the history namelist. ! ------------------------------------------------------------------------ @@ -531,30 +435,7 @@ subroutine initialize2( ) ! The following is called for both initial and restart runs and must ! must be called after the restart file is read - call atm2lnd_inst%initAccVars(bounds_proc) - call temperature_inst%initAccVars(bounds_proc) - call waterflux_inst%initAccVars(bounds_proc) - call energyflux_inst%initAccVars(bounds_proc) - call canopystate_inst%initAccVars(bounds_proc) - - call bgc_vegetation_inst%initAccVars(bounds_proc) - - !------------------------------------------------------------ - ! Read monthly vegetation - !------------------------------------------------------------ - - ! Even if CN is on, and dry-deposition is active, read CLMSP annual vegetation - ! to get estimates of monthly LAI - - if ( n_drydep > 0 .and. drydep_method == DD_XLND )then - call readAnnualVegetation(bounds_proc, canopystate_inst) - if (nsrest == nsrStartup .and. finidat /= ' ') then - ! Call interpMonthlyVeg for dry-deposition so that mlaidiff will be calculated - ! This needs to be done even if CN or CNDV is on! - call interpMonthlyVeg(bounds_proc, canopystate_inst) - end if - end if !------------------------------------------------------------ ! Determine gridcell averaged properties to send to atm @@ -567,23 +448,6 @@ subroutine initialize2( ) call t_stopf('init_map2gc') end if - !------------------------------------------------------------ - ! Initialize sno export state to send to glc - !------------------------------------------------------------ - - !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) - do nc = 1,nclumps - call get_clump_bounds(nc, bounds_clump) - - call t_startf('init_lnd2glc') - call lnd2glc_inst%update_lnd2glc(bounds_clump, & - filter(nc)%num_do_smb_c, filter(nc)%do_smb_c, & - temperature_inst, glacier_smb_inst, topo_inst, & - init=.true.) - call t_stopf('init_lnd2glc') - end do - !$OMP END PARALLEL DO - !------------------------------------------------------------ ! Deallocate wt_nat_patch !------------------------------------------------------------ @@ -597,7 +461,7 @@ subroutine initialize2( ) ! initialize2 because it is used to initialize other variables; now it can be ! deallocated - deallocate(topo_glc_mec, fert_cft) + deallocate(topo_glc_mec) !------------------------------------------------------------ ! Write log output for end of initialization diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 index 6be25eb402..35eba2a879 100644 --- a/src/main/clm_instMod.F90 +++ b/src/main/clm_instMod.F90 @@ -7,73 +7,33 @@ module clm_instMod ! !USES: use shr_kind_mod , only : r8 => shr_kind_r8 use decompMod , only : bounds_type - use clm_varpar , only : ndecomp_pools, nlevdecomp_full - use clm_varctl , only : use_cn, use_cndv - use clm_varctl , only : use_century_decomp, use_crop - use clm_varcon , only : bdsno, c13ratio, c14ratio + use clm_varcon , only : bdsno + use clm_varctl , only : iulog use landunit_varcon , only : istice_mec, istsoil use perf_mod , only : t_startf, t_stopf - use controlMod , only : NLFilename !----------------------------------------- ! Constants !----------------------------------------- use UrbanParamsType , only : urbanparams_type ! Constants - use UrbanParamsType , only : IsSimpleBuildTemp, IsProgBuildTemp - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - !use CNDVType , only : dgv_ecophyscon ! Constants - !----------------------------------------- ! Definition of component types !----------------------------------------- - use AerosolMod , only : aerosol_type - use CanopyStateType , only : canopystate_type - use ch4Mod , only : ch4_type - use CNVegetationFacade , only : cn_vegetation_type - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use CropType , only : crop_type - use DryDepVelocity , only : drydepvel_type - use DUSTMod , only : dust_type use EnergyFluxType , only : energyflux_type - use FrictionVelocityMod , only : frictionvel_type - use GlacierSurfaceMassBalanceMod , only : glacier_smb_type - use LakeStateType , only : lakestate_type - use OzoneBaseMod , only : ozone_base_type - use OzoneFactoryMod , only : create_and_init_ozone_type - use PhotosynthesisMod , only : photosyns_type - use SoilHydrologyType , only : soilhydrology_type - use SoilStateType , only : soilstate_type - use SolarAbsorbedType , only : solarabs_type - use SurfaceRadiationMod , only : surfrad_type use SurfaceAlbedoType , only : surfalb_type use TemperatureType , only : temperature_type - use WaterFluxType , only : waterflux_type use WaterStateType , only : waterstate_type use UrbanParamsType , only : urbanparams_type - use VOCEmissionMod , only : vocemis_type use atm2lndType , only : atm2lnd_type use lnd2atmType , only : lnd2atm_type - use lnd2glcMod , only : lnd2glc_type - use glc2lndMod , only : glc2lnd_type use glcBehaviorMod , only : glc_behavior_type use TopoMod , only : topo_type use GridcellType , only : grc use LandunitType , only : lun use ColumnType , only : col use PatchType , only : patch - use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type - ! - use SoilStateInitTimeConstMod , only : SoilStateInitTimeConst - use SoilHydrologyInitTimeConstMod , only : SoilHydrologyInitTimeConst - use SurfaceAlbedoMod , only : SurfaceAlbedoInitTimeConst - use LakeCon , only : LakeConInit - use SoilBiogeochemPrecisionControlMod, only: SoilBiogeochemPrecisionControlInit ! implicit none public ! By default everything is public @@ -83,119 +43,48 @@ module clm_instMod !----------------------------------------- ! Physics types - type(aerosol_type) :: aerosol_inst - type(canopystate_type) :: canopystate_inst type(energyflux_type) :: energyflux_inst - type(frictionvel_type) :: frictionvel_inst - type(glacier_smb_type) :: glacier_smb_inst - type(lakestate_type) :: lakestate_inst - class(ozone_base_type), allocatable :: ozone_inst - type(photosyns_type) :: photosyns_inst - type(soilstate_type) :: soilstate_inst - type(soilhydrology_type) :: soilhydrology_inst - type(solarabs_type) :: solarabs_inst type(surfalb_type) :: surfalb_inst - type(surfrad_type) :: surfrad_inst type(temperature_type) :: temperature_inst type(urbanparams_type) :: urbanparams_inst - type(waterflux_type) :: waterflux_inst type(waterstate_type) :: waterstate_inst type(atm2lnd_type) :: atm2lnd_inst - type(glc2lnd_type) :: glc2lnd_inst type(lnd2atm_type) :: lnd2atm_inst - type(lnd2glc_type) :: lnd2glc_inst type(glc_behavior_type), target :: glc_behavior type(topo_type) :: topo_inst - class(soil_water_retention_curve_type) , allocatable :: soil_water_retention_curve - - ! CN vegetation types - ! Eventually bgc_vegetation_inst will be an allocatable instance of an abstract - ! interface - type(cn_vegetation_type) :: bgc_vegetation_inst - - ! Soil biogeochem types - type(soilbiogeochem_state_type) :: soilbiogeochem_state_inst - type(soilbiogeochem_carbonstate_type) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) :: c13_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) :: c14_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonflux_type) :: c13_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonflux_type) :: c14_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_nitrogenstate_type) :: soilbiogeochem_nitrogenstate_inst - type(soilbiogeochem_nitrogenflux_type) :: soilbiogeochem_nitrogenflux_inst - - ! General biogeochem types - type(ch4_type) :: ch4_inst - type(crop_type) :: crop_inst - type(dust_type) :: dust_inst - !type(vocemis_type) :: vocemis_inst - type(drydepvel_type) :: drydepvel_inst - - ! FATES - ! public :: clm_instInit ! Initialize - public :: clm_instReadNML ! Read in namelist public :: clm_instRest ! Setup restart !----------------------------------------------------------------------- contains - !----------------------------------------------------------------------- - subroutine clm_instReadNML( NLFilename ) - ! - ! !ARGUMENTS - implicit none - character(len=*), intent(IN) :: NLFilename ! Namelist filename - ! Read in any namelists that must be read for any clm object instances that need it - call canopystate_inst%ReadNML( NLFilename ) - !call photosyns_inst%ReadNML( NLFilename ) - !if (use_cn) then - !call crop_inst%ReadNML( NLFilename ) - !end if - - end subroutine clm_instReadNML - !----------------------------------------------------------------------- subroutine clm_instInit(bounds) ! ! !USES: - use clm_varpar , only : nlevsno, numpft - use controlMod , only : nlfilename, fsurdat - use domainMod , only : ldomain - use SoilBiogeochemDecompCascadeBGCMod , only : init_decompcascade_bgc - use SoilBiogeochemDecompCascadeCNMod , only : init_decompcascade_cn - use SoilBiogeochemDecompCascadeContype , only : init_decomp_cascade_constants + use clm_varpar , only : nlevsno use initVerticalMod , only : initVertical - use accumulMod , only : print_accum_fields - use SoilWaterRetentionCurveFactoryMod , only : create_soil_water_retention_curve - use decompMod , only : get_proc_bounds ! ! !ARGUMENTS type(bounds_type), intent(in) :: bounds ! processor bounds ! ! !LOCAL VARIABLES: integer :: c,l,g - integer :: nclumps,nc integer :: begp, endp integer :: begc, endc integer :: begl, endl - type(bounds_type) :: bounds_clump real(r8), allocatable :: h2osno_col(:) - real(r8), allocatable :: snow_depth_col(:) - - integer :: dummy_to_make_pgi_happy !---------------------------------------------------------------------- - ! Note: h2osno_col and snow_depth_col are initialized as local variable - ! since they are needed to initialize vertical data structures + ! Note: h2osno_col initialized as local variable + ! since needed to initialize vertical data structures begp = bounds%begp; endp = bounds%endp begc = bounds%begc; endc = bounds%endc begl = bounds%begl; endl = bounds%endl allocate (h2osno_col(begc:endc)) - allocate (snow_depth_col(begc:endc)) ! snow water do c = begc,endc @@ -216,7 +105,6 @@ subroutine clm_instInit(bounds) else h2osno_col(c) = 0._r8 endif - snow_depth_col(c) = h2osno_col(c) / bdsno end do ! Initialize urban constants @@ -227,132 +115,27 @@ subroutine clm_instInit(bounds) call initVertical(bounds, & glc_behavior, & - snow_depth_col(begc:endc), & urbanparams_inst%thick_wall(begl:endl), & urbanparams_inst%thick_roof(begl:endl)) ! Initialize clm->drv and drv->clm data structures - call atm2lnd_inst%Init( bounds, NLFilename ) - call lnd2atm_inst%Init( bounds, NLFilename ) - - call glc2lnd_inst%Init( bounds, glc_behavior ) - call lnd2glc_inst%Init( bounds ) + call atm2lnd_inst%Init(bounds) + call lnd2atm_inst%Init(bounds) ! Initialization of public data types - call temperature_inst%Init(bounds, & - urbanparams_inst%em_roof(begl:endl), & - urbanparams_inst%em_wall(begl:endl), & - urbanparams_inst%em_improad(begl:endl), & - urbanparams_inst%em_perroad(begl:endl), & - IsSimpleBuildTemp(), IsProgBuildTemp() ) - - call canopystate_inst%Init(bounds) - - call soilstate_inst%Init(bounds) - call SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) ! sets hydraulic and thermal soil properties - - call waterstate_inst%Init(bounds, & - h2osno_col(begc:endc), & - snow_depth_col(begc:endc), & - soilstate_inst%watsat_col(begc:endc, 1:), & - temperature_inst%t_soisno_col(begc:endc, -nlevsno+1:) ) - - call waterflux_inst%Init(bounds) - - call glacier_smb_inst%Init(bounds) - - ! COMPILER_BUG(wjs, 2014-11-29, pgi 14.7) Without the following assignment, the - ! assertion in energyflux_inst%Init fails with pgi 14.7 on yellowstone, presumably due - ! to a compiler bug. - dummy_to_make_pgi_happy = ubound(temperature_inst%t_grnd_col, 1) - call energyflux_inst%Init(bounds, temperature_inst%t_grnd_col(begc:endc), & - IsSimpleBuildTemp(), IsProgBuildTemp() ) - - !call aerosol_inst%Init(bounds, NLFilename) - - call frictionvel_inst%Init(bounds) + call temperature_inst%Init(bounds) - call lakestate_inst%Init(bounds) - call LakeConInit() + call waterstate_inst%Init(bounds, h2osno_col(begc:endc)) - allocate(ozone_inst, source = create_and_init_ozone_type(bounds)) - - call photosyns_inst%Init(bounds) - - call soilhydrology_inst%Init(bounds, nlfilename) - call SoilHydrologyInitTimeConst(bounds, soilhydrology_inst) ! sets time constant properties - - call solarabs_inst%Init(bounds) + call energyflux_inst%Init(bounds, temperature_inst%t_grnd_col(begc:endc)) call surfalb_inst%Init(bounds) - call SurfaceAlbedoInitTimeConst(bounds) - - call surfrad_inst%Init(bounds) - - call dust_inst%Init(bounds) call topo_inst%Init(bounds) - ! Note - always initialize the memory for ch4_inst - !call ch4_inst%Init(bounds, soilstate_inst%cellorg_col(begc:endc, 1:), fsurdat, nlfilename) - - !call vocemis_inst%Init(bounds) - - !call drydepvel_inst%Init(bounds) - - if (use_cn ) then - - ! Initialize soilbiogeochem_state_inst - - call soilbiogeochem_state_inst%Init(bounds) - - ! Initialize decompcascade constants - ! Note that init_decompcascade_bgc and init_decompcascade_cn need - ! soilbiogeochem_state_inst to be initialized - - call init_decomp_cascade_constants() - if (use_century_decomp) then - call init_decompcascade_bgc(bounds, soilbiogeochem_state_inst, & - soilstate_inst ) - else - call init_decompcascade_cn(bounds, soilbiogeochem_state_inst) - end if - - ! Initalize soilbiogeochem carbon types - - call soilbiogeochem_carbonstate_inst%Init(bounds, carbon_type='c12', ratio=1._r8) - - end if - - if ( use_cn ) then - - ! Initalize soilbiogeochem nitrogen types - - call soilbiogeochem_nitrogenstate_inst%Init(bounds, & - soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools), & - soilbiogeochem_carbonstate_inst%decomp_cpools_col(begc:endc,1:ndecomp_pools), & - soilbiogeochem_carbonstate_inst%decomp_cpools_1m_col(begc:endc, 1:ndecomp_pools)) - - call soilbiogeochem_nitrogenflux_inst%Init(bounds) - - ! Initialize precision control for soil biogeochemistry - call SoilBiogeochemPrecisionControlInit( soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonstate_inst, soilbiogeochem_nitrogenstate_inst) - - end if ! end of if use_cn - - ! Note - always call Init for bgc_vegetation_inst: some pieces need to be initialized always - call bgc_vegetation_inst%Init(bounds, nlfilename) - - if (use_cn ) then - call crop_inst%Init(bounds) - end if - - deallocate (h2osno_col) - deallocate (snow_depth_col) ! ------------------------------------------------------------------------ ! Initialize accumulated fields @@ -362,25 +145,7 @@ subroutine clm_instInit(bounds) ! the step size is needed. call t_startf('init_accflds') - call atm2lnd_inst%InitAccBuffer(bounds) - - call temperature_inst%InitAccBuffer(bounds) - - call waterflux_inst%InitAccBuffer(bounds) - - call energyflux_inst%InitAccBuffer(bounds) - - call canopystate_inst%InitAccBuffer(bounds) - - call bgc_vegetation_inst%InitAccBuffer(bounds) - - if (use_crop) then - call crop_inst%InitAccBuffer(bounds) - end if - - call print_accum_fields() - call t_stopf('init_accflds') end subroutine clm_instInit @@ -390,85 +155,28 @@ subroutine clm_instRest(bounds, ncid, flag) ! ! !USES: use ncdio_pio , only : file_desc_t - use UrbanParamsType , only : IsSimpleBuildTemp, IsProgBuildTemp - use decompMod , only : get_proc_bounds, get_proc_clumps, get_clump_bounds - ! ! !DESCRIPTION: ! Define/write/read CLM restart file. ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id character(len=*) , intent(in) :: flag ! 'define', 'write', 'read' - - ! Local variables - integer :: nc, nclumps - type(bounds_type) :: bounds_clump - !----------------------------------------------------------------------- call atm2lnd_inst%restart (bounds, ncid, flag=flag) - call canopystate_inst%restart (bounds, ncid, flag=flag) - - call energyflux_inst%restart (bounds, ncid, flag=flag, & - is_simple_buildtemp=IsSimpleBuildTemp(), is_prog_buildtemp=IsProgBuildTemp()) - - call frictionvel_inst% restart (bounds, ncid, flag=flag) - - call lakestate_inst%restart (bounds, ncid, flag=flag) - - call ozone_inst%restart (bounds, ncid, flag=flag) - - call photosyns_inst%restart (bounds, ncid, flag=flag) - - call soilhydrology_inst%restart (bounds, ncid, flag=flag) - - call solarabs_inst%restart (bounds, ncid, flag=flag) - - call temperature_inst%restart (bounds, ncid, flag=flag, & - is_simple_buildtemp=IsSimpleBuildTemp(), is_prog_buildtemp=IsProgBuildTemp()) + call energyflux_inst%restart (bounds, ncid, flag=flag) - call soilstate_inst%restart (bounds, ncid, flag=flag) + call temperature_inst%restart (bounds, ncid, flag=flag) - call waterflux_inst%restart (bounds, ncid, flag=flag) + call waterstate_inst%restart (bounds, ncid, flag=flag) - call waterstate_inst%restart (bounds, ncid, flag=flag, & - watsat_col=soilstate_inst%watsat_col(bounds%begc:bounds%endc,:)) - - !call aerosol_inst%restart (bounds, ncid, flag=flag, & - !h2osoi_ice_col=waterstate_inst%h2osoi_ice_col(bounds%begc:bounds%endc,:), & - !h2osoi_liq_col=waterstate_inst%h2osoi_liq_col(bounds%begc:bounds%endc,:)) - - call surfalb_inst%restart (bounds, ncid, flag=flag, & - tlai_patch=canopystate_inst%tlai_patch(bounds%begp:bounds%endp), & - tsai_patch=canopystate_inst%tsai_patch(bounds%begp:bounds%endp)) + call surfalb_inst%restart (bounds, ncid, flag=flag) call topo_inst%restart (bounds, ncid, flag=flag) - if ( use_cn ) then - ! Need to do vegetation restart before soil bgc restart to get totvegc_col for purpose - ! of resetting soil carbon at exit spinup when no vegetation is growing. - call bgc_vegetation_inst%restart(bounds, ncid, flag=flag) - - call soilbiogeochem_nitrogenstate_inst%restart(bounds, ncid, flag=flag, & - totvegc_col=bgc_vegetation_inst%get_totvegc_col(bounds)) - call soilbiogeochem_nitrogenflux_inst%restart(bounds, ncid, flag=flag) - - call crop_inst%restart(bounds, ncid, flag=flag) - end if - - if (use_cn ) then - - call soilbiogeochem_state_inst%restart(bounds, ncid, flag=flag) - call soilbiogeochem_carbonstate_inst%restart(bounds, ncid, flag=flag, carbon_type='c12', & - totvegc_col=bgc_vegetation_inst%get_totvegc_col(bounds)) - - call soilbiogeochem_carbonflux_inst%restart(bounds, ncid, flag=flag) - endif - end subroutine clm_instRest end module clm_instMod diff --git a/src/main/clm_varcon.F90 b/src/main/clm_varcon.F90 index d0a2053568..1559100d26 100644 --- a/src/main/clm_varcon.F90 +++ b/src/main/clm_varcon.F90 @@ -14,10 +14,6 @@ module clm_varcon SHR_CONST_PDB, SHR_CONST_PI, SHR_CONST_CDAY, & SHR_CONST_RGAS, SHR_CONST_PSTD, & SHR_CONST_MWDAIR, SHR_CONST_MWWV - use clm_varpar , only: numrad, nlevgrnd, nlevlak, nlevdecomp_full - use clm_varpar , only: ngases - use clm_varpar , only: nlayer - ! ! !PUBLIC TYPES: implicit none @@ -42,10 +38,7 @@ module clm_varcon ! Initialize physical constants !------------------------------------------------------------------ - real(r8), parameter :: n_melt=0.7 ! fsca shape parameter - real(r8), parameter :: e_ice=6.0 ! soil ice impedance factor real(r8), parameter :: pc = 0.4 ! threshold probability - real(r8), parameter :: mu = 0.13889 ! connectivity exponent real(r8), parameter :: secsphr = 3600._r8 ! Seconds in an hour integer, parameter :: isecsphr = int(secsphr) ! Integer seconds in an hour integer, parameter :: isecspmin= 60 ! Integer seconds in a minute @@ -88,9 +81,6 @@ module clm_varcon real(r8), public, parameter :: secspday= SHR_CONST_CDAY ! Seconds per day integer, public, parameter :: isecspday= secspday ! Integer seconds per day - integer, public, parameter :: fun_period = 1 ! A FUN parameter, and probably needs to be changed for testing - real(r8),public, parameter :: smallValue = 1.e-12_r8 ! A small values used by FUN - ! ------------------------------------------------------------------------ ! Special value flags ! ------------------------------------------------------------------------ @@ -106,111 +96,17 @@ module clm_varcon ! Keep this negative to avoid conflicts with possible valid values integer , public, parameter :: ispval = -9999 ! special value for int data - ! ------------------------------------------------------------------------ - ! These are tunable constants from clm2_3 - ! ------------------------------------------------------------------------ - - real(r8) :: zlnd = 0.01_r8 ! Roughness length for soil [m] - real(r8) :: zsno = 0.0024_r8 ! Roughness length for snow [m] - real(r8) :: csoilc = 0.004_r8 ! Drag coefficient for soil under canopy [-] - real(r8) :: capr = 0.34_r8 ! Tuning factor to turn first layer T into surface T - real(r8) :: cnfac = 0.5_r8 ! Crank Nicholson factor between 0 and 1 - real(r8) :: ssi = 0.033_r8 ! Irreducible water saturation of snow - real(r8) :: wimp = 0.05_r8 ! Water impremeable if porosity less than wimp - real(r8) :: pondmx = 0.0_r8 ! Ponding depth (mm) - real(r8) :: pondmx_urban = 1.0_r8 ! Ponding depth for urban roof and impervious road (mm) - - real(r8) :: thk_bedrock = 3.0_r8 ! thermal conductivity of 'typical' saturated granitic rock - ! (Clauser and Huenges, 1995)(W/m/K) - real(r8) :: csol_bedrock = 2.0e6_r8 ! vol. heat capacity of granite/sandstone J/(m3 K)(Shabbir, 2000) !scs - real(r8), parameter :: zmin_bedrock = 0.4_r8 ! minimum soil depth [m] - - real(r8), parameter :: aquifer_water_baseline = 5000._r8 ! baseline value for water in the unconfined aquifer [mm] - - !!! C13 - real(r8), parameter :: preind_atm_del13c = -6.0 ! preindustrial value for atmospheric del13C - real(r8), parameter :: preind_atm_ratio = SHR_CONST_PDB + (preind_atm_del13c * SHR_CONST_PDB)/1000.0 ! 13C/12C - real(r8) :: c13ratio = preind_atm_ratio/(1.0+preind_atm_ratio) ! 13C/(12+13)C preind atmosphere - - ! typical del13C for C3 photosynthesis (permil, relative to PDB) - real(r8), parameter :: c3_del13c = -28._r8 - - ! typical del13C for C4 photosynthesis (permil, relative to PDB) - real(r8), parameter :: c4_del13c = -13._r8 - - ! isotope ratio (13c/12c) for C3 photosynthesis - real(r8), parameter :: c3_r1 = SHR_CONST_PDB + ((c3_del13c*SHR_CONST_PDB)/1000._r8) - - ! isotope ratio (13c/[12c+13c]) for C3 photosynthesis - real(r8), parameter :: c3_r2 = c3_r1/(1._r8 + c3_r1) - - ! isotope ratio (13c/12c) for C4 photosynthesis - real(r8), parameter :: c4_r1 = SHR_CONST_PDB + ((c4_del13c*SHR_CONST_PDB)/1000._r8) - - ! isotope ratio (13c/[12c+13c]) for C4 photosynthesis - real(r8), parameter :: c4_r2 = c4_r1/(1._r8 + c4_r1) - - !!! C14 - real(r8) :: c14ratio = 1.e-12_r8 - ! real(r8) :: c14ratio = 1._r8 ! debug lets set to 1 to try to avoid numerical errors - - !------------------------------------------------------------------ - ! Urban building temperature constants - !------------------------------------------------------------------ - real(r8) :: ht_wasteheat_factor = 0.2_r8 ! wasteheat factor for urban heating (-) - real(r8) :: ac_wasteheat_factor = 0.6_r8 ! wasteheat factor for urban air conditioning (-) - real(r8) :: em_roof_int = 0.9_r8 ! emissivity of interior surface of roof (Bueno et al. 2012, GMD) - real(r8) :: em_sunw_int = 0.9_r8 ! emissivity of interior surface of sunwall (Bueno et al. 2012, GMD) - real(r8) :: em_shdw_int = 0.9_r8 ! emissivity of interior surface of shadewall Bueno et al. 2012, GMD) - real(r8) :: em_floor_int = 0.9_r8 ! emissivity of interior surface of floor (Bueno et al. 2012, GMD) - real(r8) :: hcv_roof = 0.948_r8 ! interior convective heat transfer coefficient for roof (Bueno et al. 2012, GMD) (W m-2 K-1) - real(r8) :: hcv_roof_enhanced = 4.040_r8 ! enhanced (t_roof_int <= t_room) interior convective heat transfer coefficient for roof (Bueno et al. 2012, GMD) !(W m-2 K-1) - real(r8) :: hcv_floor = 0.948_r8 ! interior convective heat transfer coefficient for floor (Bueno et al. 2012, GMD) (W m-2 K-1) - real(r8) :: hcv_floor_enhanced = 4.040_r8 ! enhanced (t_floor_int >= t_room) interior convective heat transfer coefficient for floor (Bueno et al. !2012, GMD) (W m-2 K-1) - real(r8) :: hcv_sunw = 3.076_r8 ! interior convective heat transfer coefficient for sunwall (Bueno et al. 2012, GMD) (W m-2 K-1) - real(r8) :: hcv_shdw = 3.076_r8 ! interior convective heat transfer coefficient for shadewall (Bueno et al. 2012, GMD) (W m-2 K-1) - real(r8) :: dz_floor = 0.1_r8 ! floor thickness - concrete (Salmanca et al. 2010, TAC) (m) - real(r8), parameter :: dens_floor = 2.35e3_r8 ! density of floor - concrete (Salmanca et al. 2010, TAC) (kg m-3) - real(r8), parameter :: sh_floor = 880._r8 ! specific heat of floor - concrete (Salmanca et al. 2010, TAC) (J kg-1 K-1) - real(r8) :: cp_floor = dens_floor*sh_floor ! volumetric heat capacity of floor - concrete (Salmanca et al. 2010, TAC) (J m-3 K-1) - real(r8) :: vent_ach = 0.3 ! ventilation rate (air exchanges per hour) - - real(r8) :: wasteheat_limit = 100._r8 ! limit on wasteheat (W/m2) - - !------------------------------------------------------------------ - - real(r8) :: h2osno_max = -999.0_r8 ! max allowed snow thickness (mm H2O) - real(r8) :: int_snow_max = -999.0_r8 ! limit applied to integrated snowfall when determining changes in snow-covered fraction during melt (mm H2O) - real(r8) :: n_melt_glcmec = -999.0_r8 ! SCA shape parameter for glc_mec columns - integer, private :: i ! loop index - !real(r8), parameter :: nitrif_n2o_loss_frac = 0.02_r8 ! fraction of N lost as N2O in nitrification (Parton et al., 2001) - real(r8), parameter :: nitrif_n2o_loss_frac = 6.e-4_r8 ! fraction of N lost as N2O in nitrification (Li et al., 2000) - real(r8), parameter :: frac_minrlztn_to_no3 = 0.2_r8 ! fraction of N mineralized that is dieverted to the nitrification stream (Parton et al., 2001) - !------------------------------------------------------------------ ! Set subgrid names !------------------------------------------------------------------ character(len=16), parameter :: grlnd = 'lndgrid' ! name of lndgrid - character(len=16), parameter :: namea = 'gridcellatm' ! name of atmgrid character(len=16), parameter :: nameg = 'gridcell' ! name of gridcells character(len=16), parameter :: namel = 'landunit' ! name of landunits character(len=16), parameter :: namec = 'column' ! name of columns character(len=16), parameter :: namep = 'pft' ! name of patches - character(len=16), parameter :: nameCohort = 'cohort' ! name of cohorts (ED specific) - - !------------------------------------------------------------------ - ! Initialize miscellaneous radiation constants - !------------------------------------------------------------------ - - real(r8) :: betads = 0.5_r8 ! two-stream parameter betad for snow - real(r8) :: betais = 0.5_r8 ! two-stream parameter betai for snow - real(r8) :: omegas(numrad) ! two-stream parameter omega for snow by band - data (omegas(i),i=1,numrad) /0.8_r8, 0.4_r8/ - - ! Lake Model Constants will be defined in LakeCon. !------------------------------------------------------------------ ! Soil depths are constants for now; lake depths can vary by gridcell @@ -223,59 +119,24 @@ module clm_varcon real(r8), allocatable :: zsoi(:) !soil z (layers) real(r8), allocatable :: dzsoi(:) !soil dz (thickness) real(r8), allocatable :: zisoi(:) !soil zi (interfaces) - real(r8), allocatable :: dzsoi_decomp(:) !soil dz (thickness) - integer , allocatable :: nlvic(:) !number of CLM layers in each VIC layer (#) - real(r8), allocatable :: dzvic(:) !soil dz (thickness) of each VIC layer real(r8) ,allocatable :: zsoifl(:) !original soil midpoint (used in interpolation of sand and clay) real(r8) ,allocatable :: zisoifl(:) !original soil interface depth (used in interpolation of sand and clay) real(r8) ,allocatable :: dzsoifl(:) !original soil thickness (used in interpolation of sand and clay) - !------------------------------------------------------------------ - ! (Non-tunable) Constants for the CH4 submodel (Tuneable constants in ch4varcon) - !------------------------------------------------------------------ - ! Note some of these constants are also used in CNNitrifDenitrifMod - - real(r8), parameter :: catomw = 12.011_r8 ! molar mass of C atoms (g/mol) - - real(r8) :: s_con(ngases,4) ! Schmidt # calculation constants (spp, #) - data (s_con(1,i),i=1,4) /1898_r8, -110.1_r8, 2.834_r8, -0.02791_r8/ ! CH4 - data (s_con(2,i),i=1,4) /1801_r8, -120.1_r8, 3.7818_r8, -0.047608_r8/ ! O2 - data (s_con(3,i),i=1,4) /1911_r8, -113.7_r8, 2.967_r8, -0.02943_r8/ ! CO2 - - real(r8) :: d_con_w(ngases,3) ! water diffusivity constants (spp, #) (mult. by 10^-4) - data (d_con_w(1,i),i=1,3) /0.9798_r8, 0.02986_r8, 0.0004381_r8/ ! CH4 - data (d_con_w(2,i),i=1,3) /1.172_r8, 0.03443_r8, 0.0005048_r8/ ! O2 - data (d_con_w(3,i),i=1,3) /0.939_r8, 0.02671_r8, 0.0004095_r8/ ! CO2 - - real(r8) :: d_con_g(ngases,2) ! gas diffusivity constants (spp, #) (cm^2/s) (mult. by 10^-9) - data (d_con_g(1,i),i=1,2) /0.1875_r8, 0.0013_r8/ ! CH4 - data (d_con_g(2,i),i=1,2) /0.1759_r8, 0.00117_r8/ ! O2 - data (d_con_g(3,i),i=1,2) /0.1325_r8, 0.0009_r8/ ! CO2 - - real(r8) :: c_h_inv(ngases) ! constant (K) for Henry's law (4.12, Wania) - data c_h_inv(1:3) /1600._r8, 1500._r8, 2400._r8/ ! CH4, O2, CO2 - - real(r8) :: kh_theta(ngases) ! Henry's constant (L.atm/mol) at standard temperature (298K) - data kh_theta(1:3) /714.29_r8, 769.23_r8, 29.4_r8/ ! CH4, O2, CO2 - - real(r8) :: kh_tbase = 298._r8 ! base temperature for calculation of Henry's constant (K) - !----------------------------------------------------------------------- - contains !------------------------------------------------------------------------------ - subroutine clm_varcon_init( is_simple_buildtemp ) + subroutine clm_varcon_init() ! ! !DESCRIPTION: ! This subroutine initializes constant arrays in clm_varcon. ! MUST be called after clm_varpar_init. ! ! !USES: - use clm_varpar, only: nlevgrnd, nlevlak, nlevdecomp_full, nlevsoifl, nlayer + use clm_varpar, only: nlevgrnd, nlevlak, nlevsoifl ! ! !ARGUMENTS: implicit none - logical, intent(in) :: is_simple_buildtemp ! If simple building temp method is being used ! ! !REVISION HISTORY: ! Created by E. Kluzek @@ -286,19 +147,10 @@ subroutine clm_varcon_init( is_simple_buildtemp ) allocate( zsoi(1:nlevgrnd )) allocate( dzsoi(1:nlevgrnd )) allocate( zisoi(0:nlevgrnd )) - allocate( dzsoi_decomp(1:nlevdecomp_full )) - allocate( nlvic(1:nlayer )) - allocate( dzvic(1:nlayer )) allocate( zsoifl(1:nlevsoifl )) allocate( zisoifl(0:nlevsoifl )) allocate( dzsoifl(1:nlevsoifl )) - ! Zero out wastheat factors for simpler building temperature method (introduced in CLM4.5) - if ( is_simple_buildtemp )then - ht_wasteheat_factor = 0.0_r8 - ac_wasteheat_factor = 0.0_r8 - end if - end subroutine clm_varcon_init end module clm_varcon diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index a60aa1f68a..b19b981337 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -11,8 +11,6 @@ module clm_varctl ! !PUBLIC MEMBER FUNCTIONS: implicit none public :: clm_varctl_set ! Set variables - public :: cnallocate_carbon_only_set - public :: cnallocate_carbon_only ! private save @@ -88,28 +86,18 @@ module clm_varctl character(len=fname_len), public :: fsurdat = ' ' ! surface data file name character(len=fname_len), public :: fatmgrid = ' ' ! atm grid file name character(len=fname_len), public :: fatmlndfrc = ' ' ! lnd frac file on atm grid - character(len=fname_len), public :: paramfile = ' ' ! ASCII data file with PFT physiological constants character(len=fname_len), public :: nrevsn = ' ' ! restart data file name for branch run - character(len=fname_len), public :: fsnowoptics = ' ' ! snow optical properties file name - character(len=fname_len), public :: fsnowaging = ' ' ! snow aging parameters file name !---------------------------------------------------------- ! MML input files !---------------------------------------------------------- character(len=fname_len), public :: mml_surdat = ' ' ! MML surface data file for simple model - !---------------------------------------------------------- - ! Flag to read ndep rather than obtain it from coupler - !---------------------------------------------------------- - - logical, public :: ndep_from_cpl = .false. !---------------------------------------------------------- ! Interpolation of finidat if requested !---------------------------------------------------------- - logical, public :: bound_h2osoi = .true. ! for debugging - ! If finidat_interp_source is non-blank and finidat is blank then interpolation will be ! done from finidat_interp_source to finidat_interp_dest. Note that ! finidat_interp_source is not read in directly from the namelist - rather, it is set @@ -118,26 +106,6 @@ module clm_varctl character(len=fname_len), public :: finidat_interp_source = ' ' character(len=fname_len), public :: finidat_interp_dest = 'finidat_interp_dest.nc' - !---------------------------------------------------------- - ! Crop & Irrigation logic - !---------------------------------------------------------- - - ! If prognostic crops are turned on - logical, public :: use_crop = .false. - - ! true => separate crop landunit is not created by default - logical, public :: create_crop_landunit = .false. - - ! do not irrigate by default - logical, public :: irrigate = .false. - - !---------------------------------------------------------- - ! Other subgrid logic - !---------------------------------------------------------- - - ! true => make ALL patches, cols & landunits active (even if weight is 0) - logical, public :: all_active = .false. - !---------------------------------------------------------- ! BGC logic and datasets !---------------------------------------------------------- @@ -145,130 +113,16 @@ module clm_varctl ! values of 'prognostic','diagnostic','constant' character(len=16), public :: co2_type = 'constant' - ! State of the model for the accelerated decomposition (AD) spinup. - ! 0 (default) = normal model; 1 = AD SPINUP - integer, public :: spinup_state = 0 - - ! true => anoxia is applied to heterotrophic respiration also considered in CH4 model - ! default value reset in controlMod - logical, public :: anoxia = .true. - - ! used to override an error check on reading in restart files - logical, public :: override_bgc_restart_mismatch_dump = .false. - - ! Set in CNAllocationInit (TODO - had to move it here to avoid circular dependency) - logical, private:: carbon_only - - ! Set in CNNDynamicsInit - ! NOTE (mvertens, 2014-9 had to move it here to avoid confusion when carbon data types - ! wehre split - TODO - should move it our of this module) - ! NOTE(bandre, 2013-10) according to Charlie Koven, nfix_timeconst - ! is currently used as a flag and rate constant. - ! Rate constant: time over which to exponentially relax the npp flux for N fixation term - ! (days) time over which to exponentially relax the npp flux for N fixation term - ! flag: (if <= 0. or >= 365; use old annual method). - ! Default value is junk that should always be overwritten by the namelist or init function! - ! - real(r8), public :: nfix_timeconst = -1.2345_r8 - !---------------------------------------------------------- ! Physics !---------------------------------------------------------- - ! use subgrid fluxes - integer, public :: subgridflag = 1 - ! true => write global average diagnostics to std out logical, public :: wrtdia = .false. ! atmospheric CO2 molar ratio (by volume) (umol/mol) real(r8), public :: co2_ppmv = 355._r8 ! - !---------------------------------------------------------- - ! C isotopes - !---------------------------------------------------------- - - logical, public :: use_c13 = .false. ! true => use C-13 model - logical, public :: use_c14 = .false. ! true => use C-14 model - - !---------------------------------------------------------- - ! FATES switches - !---------------------------------------------------------- - - logical, public :: use_fates = .false. ! true => use fates - - ! These are INTERNAL to the FATES module - logical, public :: use_fates_spitfire = .false. ! true => use spitfire model - logical, public :: use_fates_logging = .false. ! true => turn on logging module - logical, public :: use_fates_planthydro = .false. ! true => turn on fates hydro - logical, public :: use_fates_ed_st3 = .false. ! true => static stand structure - logical, public :: use_fates_ed_prescribed_phys = .false. ! true => prescribed physiology - logical, public :: use_fates_inventory_init = .false. ! true => initialize fates from inventory - character(len=256), public :: fates_inventory_ctrl_filename = '' ! filename for inventory control - - !---------------------------------------------------------- - ! LUNA switches - !---------------------------------------------------------- - - logical, public :: use_luna = .false. ! true => use LUNA - - !---------------------------------------------------------- - ! flexibleCN - !---------------------------------------------------------- - ! TODO(bja, 2015-08) some of these need to be moved into the - ! appropriate module. - logical, public :: use_flexibleCN = .false. - logical, public :: MM_Nuptake_opt = .false. - logical, public :: downreg_opt = .true. - integer, public :: plant_ndemand_opt = 0 - logical, public :: substrate_term_opt = .true. - logical, public :: nscalar_opt = .true. - logical, public :: temp_scalar_opt = .true. - logical, public :: CNratio_floating = .false. - logical, public :: lnc_opt = .false. - logical, public :: reduce_dayl_factor = .false. - integer, public :: vcmax_opt = 0 - integer, public :: CN_residual_opt = 0 - integer, public :: CN_partition_opt = 0 - integer, public :: CN_evergreen_phenology_opt = 0 - integer, public :: carbon_resp_opt = 0 - - !---------------------------------------------------------- - ! lai streams switch for Sat. Phenology - !---------------------------------------------------------- - - logical, public :: use_lai_streams = .false. ! true => use lai streams in SatellitePhenologyMod.F90 - - !---------------------------------------------------------- - ! bedrock / soil depth switch - !---------------------------------------------------------- - - logical, public :: use_bedrock = .false. ! true => use spatially variable soil depth - character(len=16), public :: soil_layerstruct = '10SL_3.5m' - - !---------------------------------------------------------- - ! plant hydraulic stress switch - !---------------------------------------------------------- - - logical, public :: use_hydrstress = .false. ! true => use plant hydraulic stress calculation - - !---------------------------------------------------------- - ! dynamic root switch - !---------------------------------------------------------- - - logical, public :: use_dynroot = .false. ! true => use dynamic root module - - !---------------------------------------------------------- - ! glacier_mec control variables: default values (may be overwritten by namelist) - !---------------------------------------------------------- - - ! true => CLM glacier area & topography changes dynamically - logical , public :: glc_do_dynglacier = .false. - - ! number of days before one considers the perennially snow-covered point 'land ice' - integer , public :: glc_snow_persistence_max_days = 7300 - - ! !---------------------------------------------------------- ! single column control variables !---------------------------------------------------------- @@ -302,37 +156,11 @@ module clm_varctl ! file name for local restart pointer file character(len=256), public :: rpntfil = 'rpointer.lnd' - ! moved hist_wrtch4diag from histFileMod.F90 to here - caused compiler error with intel - ! namelist: write CH4 extra diagnostic output - logical, public :: hist_wrtch4diag = .false. - - !---------------------------------------------------------- - ! FATES - !---------------------------------------------------------- - character(len=fname_len), public :: fates_paramfile = ' ' - !---------------------------------------------------------- ! Migration of CPP variables !---------------------------------------------------------- - - logical, public :: use_lch4 = .false. - logical, public :: use_nitrif_denitrif = .false. - logical, public :: use_vertsoilc = .false. - logical, public :: use_extralakelayers = .false. - logical, public :: use_vichydro = .false. - logical, public :: use_century_decomp = .false. - logical, public :: use_cn = .false. - logical, public :: use_cndv = .false. - logical, public :: use_grainproduct = .false. - logical, public :: use_fertilizer = .false. - logical, public :: use_ozone = .false. - logical, public :: use_snicar_frc = .false. - logical, public :: use_vancouver = .false. - logical, public :: use_mexicocity = .false. logical, public :: use_noio = .false. - logical, public :: use_nguardrail = .false. - !---------------------------------------------------------- ! To retrieve namelist !---------------------------------------------------------- @@ -382,15 +210,4 @@ subroutine clm_varctl_set( caseid_in, ctitle_in, brnch_retain_casename_in, & end subroutine clm_varctl_set - ! Set module carbon_only flag - subroutine cnallocate_carbon_only_set(carbon_only_in) - logical, intent(in) :: carbon_only_in - carbon_only = carbon_only_in - end subroutine cnallocate_carbon_only_set - - ! Get module carbon_only flag - logical function CNAllocate_Carbon_only() - cnallocate_carbon_only = carbon_only - end function CNAllocate_Carbon_only - end module clm_varctl diff --git a/src/main/clm_varpar.F90 b/src/main/clm_varpar.F90 index d2011dcae4..da5ca3c59a 100644 --- a/src/main/clm_varpar.F90 +++ b/src/main/clm_varpar.F90 @@ -7,66 +7,33 @@ module clm_varpar ! !USES: use shr_kind_mod , only: r8 => shr_kind_r8 use spmdMod , only: masterproc - use clm_varctl , only: use_extralakelayers, use_vertsoilc - use clm_varctl , only: use_century_decomp, use_c13, use_c14 - use clm_varctl , only: iulog, use_crop, create_crop_landunit, irrigate - use clm_varctl , only: use_vichydro, soil_layerstruct - use clm_varctl , only: use_fates + use clm_varctl , only: iulog - ! ! !PUBLIC TYPES: implicit none save ! Note - model resolution is read in from the surface dataset - integer, parameter :: nlev_equalspace = 15 - integer, parameter :: toplev_equalspace = 6 integer :: nlevsoi ! number of hydrologically active soil layers integer :: nlevsoifl ! number of soil layers on input file integer :: nlevgrnd ! number of ground layers ! (includes lower layers that are hydrologically inactive) integer :: nlevurb ! number of urban layers integer :: nlevlak ! number of lake layers - integer :: nlevdecomp ! number of biogeochemically active soil layers - integer :: nlevdecomp_full ! number of biogeochemical layers ! (includes lower layers that are biogeochemically inactive) integer :: nlevsno = -1 ! maximum number of snow layers - integer, parameter :: ngases = 3 ! CH4, O2, & CO2 - integer, parameter :: nlevcan = 1 ! number of leaf layers in canopy layer - integer, parameter :: nvegwcs = 4 ! number of vegetation water conductance segments !ED variables - integer, parameter :: numwat = 5 ! number of water types (soil, ice, 2 lakes, wetland) integer, parameter :: numrad = 2 ! number of solar radiation bands: vis, nir - integer, parameter :: ivis = 1 ! index for visible band - integer, parameter :: inir = 2 ! index for near-infrared band - integer, parameter :: numsolar = 2 ! number of solar type bands: direct, diffuse integer, parameter :: ndst = 4 ! number of dust size classes (BGC only) - integer, parameter :: dst_src_nbr = 3 ! number of size distns in src soil (BGC only) - integer, parameter :: sz_nbr = 200 ! number of sub-grid bins in large bin of dust size distribution (BGC only) integer, parameter :: mxpft = 78 ! maximum number of PFT's for any mode; ! FIX(RF,032414) might we set some of these automatically from reading pft-physiology? integer, parameter :: numveg = 16 ! number of veg types (without specific crop) - integer, parameter :: nlayer = 3 ! number of VIC soil layer --Added by AWang - integer :: nlayert ! number of VIC soil layer + 3 lower thermal layers - integer, parameter :: nvariants = 2 ! number of variants of PFT constants integer :: numpft = mxpft ! actual # of pfts (without bare) integer :: numcft = 64 ! actual # of crops (includes unused CFTs that are merged into other CFTs) integer :: maxpatch_urb= 5 ! max number of urban patches (columns) in urban landunit - integer :: maxpatch_pft ! max number of plant functional types in naturally vegetated landunit (namelist setting) - - ! constants for decomposition cascade - - integer, parameter :: i_met_lit = 1 - integer, parameter :: i_cel_lit = i_met_lit + 1 - integer, parameter :: i_lig_lit = i_cel_lit + 1 - integer :: i_cwd - - integer :: ndecomp_pools - integer :: ndecomp_cascade_transitions - ! Indices used in surface file read and set in clm_varpar_init integer :: natpft_lb ! In PATCH arrays, lower bound of Patches on the natural veg landunit (i.e., bare ground index) @@ -82,7 +49,6 @@ module clm_varpar integer :: cft_ub ! In arrays of PFTs, upper bound of PFTs on the crop landunit integer :: cft_size ! Number of PFTs on crop landunit in arrays of PFTs - integer :: maxpatch_glcmec ! max number of elevation classes integer :: max_patch_per_col ! ! !PUBLIC MEMBER FUNCTIONS: @@ -108,108 +74,39 @@ subroutine clm_varpar_init() ! Crop settings and consistency checks - if (use_crop) then - numpft = mxpft ! actual # of patches (without bare) - numcft = 64 ! actual # of crops - else - numpft = numveg ! actual # of patches (without bare) - numcft = 2 ! actual # of crops - end if + numpft = numveg ! actual # of patches (without bare) + numcft = 2 ! actual # of crops ! For arrays containing all Patches (natural veg & crop), determine lower and upper bounds ! for (1) Patches on the natural vegetation landunit (includes bare ground, and includes ! crops if create_crop_landunit=false), and (2) CFTs on the crop landunit (no elements ! if create_crop_landunit=false) - if (create_crop_landunit) then - natpft_size = (numpft + 1) - numcft ! note that numpft doesn't include bare ground -- thus we add 1 - cft_size = numcft - else - natpft_size = numpft + 1 ! note that numpft doesn't include bare ground -- thus we add 1 - cft_size = 0 - end if + natpft_size = (numpft + 1) - numcft ! note that numpft doesn't include bare ground -- thus we add 1 + cft_size = numcft natpft_lb = 0 natpft_ub = natpft_lb + natpft_size - 1 cft_lb = natpft_ub + 1 cft_ub = cft_lb + cft_size - 1 - ! TODO(wjs, 2015-10-04, bugz 2227) Using numcft in this 'max' gives a significant - ! overestimate of max_patch_per_col when use_crop is true. This should be reworked - - ! or, better, removed from the code entirely (because it is a maintenance problem, and - ! I can't imagine that looping idioms that use it help performance that much, and - ! likely they hurt performance.) max_patch_per_col= max(numpft+1, numcft, maxpatch_urb) nlevsoifl = 10 nlevurb = 5 - if ( masterproc ) write(iulog, *) 'soil_layerstruct varpar ',soil_layerstruct - if ( soil_layerstruct == '10SL_3.5m' ) then - nlevsoi = nlevsoifl - nlevgrnd = 15 - else if ( soil_layerstruct == '23SL_3.5m' ) then - nlevsoi = 8 + nlev_equalspace - nlevgrnd = 15 + nlev_equalspace - else if ( soil_layerstruct == '49SL_10m' ) then - nlevsoi = 49 ! 10x10 + 9x100 + 30x300 = 1e4mm = 10m -! nlevsoi = 29 ! 10x10 + 9x100 + 10x300 = 4e3mm = 4m - nlevgrnd = nlevsoi+5 - else if ( soil_layerstruct == '20SL_8.5m' ) then - nlevsoi = 20 - nlevgrnd = nlevsoi+5 - endif - if ( masterproc ) write(iulog, *) 'soil_layerstruct varpar ',soil_layerstruct,nlevsoi,nlevgrnd - - if (use_vichydro) then - nlayert = nlayer + (nlevgrnd -nlevsoi) - endif - - ! here is a switch to set the number of soil levels for the biogeochemistry calculations. - ! currently it works on either a single level or on nlevsoi and nlevgrnd levels - if (use_vertsoilc) then - nlevdecomp = nlevsoi - nlevdecomp_full = nlevgrnd - else - nlevdecomp = 1 - nlevdecomp_full = 1 - end if + nlevsoi = nlevsoifl + nlevgrnd = 15 - if (.not. use_extralakelayers) then - nlevlak = 10 ! number of lake layers - else - nlevlak = 25 ! number of lake layers (Yields better results for site simulations) - end if + nlevlak = 10 ! number of lake layers if ( masterproc )then write(iulog, *) 'CLM varpar subsurface discretization levels ' write(iulog, '(a, i3)') ' nlevsoi = ', nlevsoi write(iulog, '(a, i3)') ' nlevgrnd = ', nlevgrnd - write(iulog, '(a, i3)') ' nlevdecomp = ', nlevdecomp - write(iulog, '(a, i3)') ' nlevdecomp_full = ', nlevdecomp_full write(iulog, '(a, i3)') ' nlevlak = ', nlevlak write(iulog, *) end if - if ( use_fates ) then - i_cwd = 0 - if (use_century_decomp) then - ndecomp_pools = 6 - ndecomp_cascade_transitions = 8 - else - ndecomp_pools = 7 - ndecomp_cascade_transitions = 7 - end if - else - i_cwd = 4 - if (use_century_decomp) then - ndecomp_pools = 7 - ndecomp_cascade_transitions = 10 - else - ndecomp_pools = 8 - ndecomp_cascade_transitions = 9 - end if - endif - end subroutine clm_varpar_init end module clm_varpar diff --git a/src/main/clm_varsur.F90 b/src/main/clm_varsur.F90 index a86fe08c64..41e2618576 100644 --- a/src/main/clm_varsur.F90 +++ b/src/main/clm_varsur.F90 @@ -29,11 +29,6 @@ module clm_instur ! (second dimension goes cft_lb:cft_ub) real(r8), pointer :: wt_cft(:,:) - ! for each cft on the crop landunit prescribe annual fertilizer - ! landunit for all all grid cells, even those without any crop) - ! (second dimension goes cft_lb:cft_ub) - real(r8), pointer :: fert_cft(:,:) - ! for glc_mec landunits, weight of glacier in each elevation class (adds to 1.0 on the ! landunit for all grid cells, even those without any glacier) real(r8), pointer :: wt_glc_mec(:,:) diff --git a/src/main/column_varcon.F90 b/src/main/column_varcon.F90 index 287df93b72..073e1bf79b 100644 --- a/src/main/column_varcon.F90 +++ b/src/main/column_varcon.F90 @@ -84,7 +84,6 @@ function icemec_class_to_col_itype(icemec_class) result(col_itype) ! Convert an icemec class (1..maxpatch_glcmec) into col%itype ! ! !USES: - use clm_varpar, only : maxpatch_glcmec use landunit_varcon, only : istice_mec ! ! !ARGUMENTS: @@ -96,8 +95,6 @@ function icemec_class_to_col_itype(icemec_class) result(col_itype) character(len=*), parameter :: subname = 'icemec_class_to_col_itype' !----------------------------------------------------------------------- - SHR_ASSERT((1 <= icemec_class .and. icemec_class <= maxpatch_glcmec), errMsg(sourcefile, __LINE__)) - col_itype = istice_mec*100 + icemec_class end function icemec_class_to_col_itype @@ -109,7 +106,6 @@ function col_itype_to_icemec_class(col_itype) result(icemec_class) ! Convert a col%itype value (for an icemec landunit) into an icemec class (1..maxpatch_glcmec) ! ! !USES: - use clm_varpar, only : maxpatch_glcmec use landunit_varcon, only : istice_mec ! ! !ARGUMENTS: @@ -123,10 +119,6 @@ function col_itype_to_icemec_class(col_itype) result(icemec_class) icemec_class = col_itype - istice_mec*100 - ! The following assertion is here to ensure that col_itype is really from an - ! istice_mec landunit - SHR_ASSERT((1 <= icemec_class .and. icemec_class <= maxpatch_glcmec), errMsg(sourcefile, __LINE__)) - end function col_itype_to_icemec_class !----------------------------------------------------------------------- diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index aef6715a1e..6eba5e4090 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -17,28 +17,20 @@ module controlMod use abortutils , only: endrun use spmdMod , only: masterproc use decompMod , only: clump_pproc - use clm_varcon , only: h2osno_max, int_snow_max, n_melt_glcmec - use clm_varpar , only: maxpatch_pft, maxpatch_glcmec, numrad, nlevsno + use clm_varpar , only: numrad, nlevsno use histFileMod , only: max_tapes, max_namlen use histFileMod , only: hist_empty_htapes, hist_dov2xy, hist_avgflag_pertape, hist_type1d_pertape use histFileMod , only: hist_nhtfrq, hist_ndens, hist_mfilt, hist_fincl1, hist_fincl2, hist_fincl3 use histFileMod , only: hist_fincl4, hist_fincl5, hist_fincl6, hist_fexcl1, hist_fexcl2, hist_fexcl3 use histFileMod , only: hist_fexcl4, hist_fexcl5, hist_fexcl6 use initInterpMod , only: initInterp_readnl - use UrbanParamsType , only: UrbanReadNML - use SurfaceAlbedoMod , only: albice - use CNSharedParamsMod , only: use_fun use clm_varctl , only: iundef, rundef, nsrest, caseid, ctitle, nsrStartup, nsrContinue use clm_varctl , only: nsrBranch, brnch_retain_casename, hostname, username, source, version, conventions - use clm_varctl , only: iulog, outnc_large_files, finidat, fsurdat, fatmgrid, fatmlndfrc, paramfile, nrevsn - use clm_varctl , only: mml_surdat, finidat_interp_source, finidat_interp_dest, all_active, co2_type - use clm_varctl , only: wrtdia, co2_ppmv, use_bedrock, soil_layerstruct, nsegspc, rpntdir, rpntfil - use clm_varctl , only: use_cn, use_noio, NLFilename_in, use_century_decomp - use clm_varctl , only: use_nitrif_denitrif, create_crop_landunit, glc_snow_persistence_max_days - use clm_varctl , only: subgridflag, use_nguardrail, nfix_timeconst, use_vertsoilc + use clm_varctl , only: iulog, outnc_large_files, finidat, fsurdat, fatmgrid, fatmlndfrc, nrevsn + use clm_varctl , only: mml_surdat, finidat_interp_source, finidat_interp_dest, co2_type + use clm_varctl , only: wrtdia, co2_ppmv, nsegspc, rpntdir, rpntfil + use clm_varctl , only: use_noio, NLFilename_in use clm_varctl , only: clm_varctl_set - use clm_varctl , only: use_lch4, irrigate, create_crop_landunit, use_crop, use_dynroot - use clm_varctl , only: use_fates, use_flexiblecn, use_hydrstress, use_luna, spinup_state use clm_varctl , only: single_column ! ! !PUBLIC TYPES: @@ -134,9 +126,7 @@ subroutine control_init( ) ! Input datasets - namelist /clm_inparm/ & - fsurdat, & - paramfile + namelist /clm_inparm/ fsurdat ! MML Input datasets for simple model namelist /clm_inparm/ & @@ -162,55 +152,20 @@ subroutine control_init( ) namelist /clm_inparm / & co2_type - namelist /clm_inparm / use_fun - ! Glacier_mec info - namelist /clm_inparm/ & - maxpatch_glcmec, & - glc_snow_persistence_max_days, & - nlevsno, h2osno_max, int_snow_max, n_melt_glcmec + namelist /clm_inparm/ nlevsno ! Other options namelist /clm_inparm/ & clump_pproc, wrtdia, & - create_crop_landunit, nsegspc, co2_ppmv, override_nsrest, & - albice, soil_layerstruct, subgridflag, & - all_active - - namelist /clm_inparm/ use_bedrock + nsegspc, co2_ppmv, override_nsrest ! All old cpp-ifdefs are below and have been converted to namelist variables - - ! max number of plant functional types in naturally vegetated landunit - namelist /clm_inparm/ maxpatch_pft - - namelist /clm_inparm/ & - use_vertsoilc, & - use_century_decomp, use_cn, use_noio, & - use_nguardrail, use_nitrif_denitrif + namelist /clm_inparm/ use_noio ! Items not really needed, but do need to be properly set as they are used - namelist / clm_inparm/ & - use_lch4, & - irrigate, & - create_crop_landunit, & - use_crop, & - use_dynroot, & - use_fates, & - use_flexiblecn, & - use_hydrstress, & - use_luna, & - spinup_state, & - single_column - - logical :: use_fertilizer = .false. - logical :: use_grainproduct = .false. - logical :: use_lai_streams = .false. - character(len=256) :: fsnowaging, fsnowoptics - namelist /clm_inparm/ use_fertilizer, use_grainproduct, use_lai_streams, & - fsnowaging, fsnowoptics - + namelist / clm_inparm/ single_column ! ---------------------------------------------------------------------- ! Default values @@ -271,15 +226,6 @@ subroutine control_init( ) call set_timemgr_init( dtime_in=dtime ) ! Check for namelist variables that SLIM can NOT use - if ( use_fates )then - call endrun(msg='ERROR SLIM can NOT run with use_fates on'//errMsg(sourcefile, __LINE__)) - end if - if ( use_lai_streams )then - call endrun(msg='ERROR SLIM can NOT run with use_lai_streams on'//errMsg(sourcefile, __LINE__)) - end if - if ( use_dynroot )then - call endrun(msg='ERROR SLIM can NOT run with use_dynroot on'//errMsg(sourcefile, __LINE__)) - end if if ( single_column )then call endrun(msg='ERROR SLIM can NOT run with single_column on'//errMsg(sourcefile, __LINE__)) end if @@ -309,24 +255,7 @@ subroutine control_init( ) call clm_varctl_set( nsrest_in=override_nsrest ) end if - if (maxpatch_glcmec <= 0) then - call endrun(msg=' ERROR: maxpatch_glcmec must be at least 1 ' // & - errMsg(sourcefile, __LINE__)) - end if - - ! If nfix_timeconst is equal to the junk default value, then it was not specified - ! by the user namelist and we need to assign it the correct default value. If the - ! user specified it in the namelist, we leave it alone. - - if (nfix_timeconst == -1.2345_r8) then - if (use_nitrif_denitrif) then - nfix_timeconst = 10._r8 - else - nfix_timeconst = 0._r8 - end if - end if - - ! If nlevsno, h2osno_max, int_snow_max or n_melt_glcmec are equal to their junk + ! If nlevsno are equal to their junk ! default value, then they were not specified by the user namelist and we generate ! an error message. Also check nlevsno for bounds. if (nlevsno < 3 .or. nlevsno > 12) then @@ -334,22 +263,6 @@ subroutine control_init( ) call endrun(msg=' ERROR: invalid value for nlevsno in CLM namelist. '//& errMsg(sourcefile, __LINE__)) endif - if (h2osno_max <= 0.0_r8) then - write(iulog,*)'ERROR: h2osno_max = ',h2osno_max,' is not supported, must be greater than 0.0.' - call endrun(msg=' ERROR: invalid value for h2osno_max in CLM namelist. '//& - errMsg(sourcefile, __LINE__)) - endif - if (int_snow_max <= 0.0_r8) then - write(iulog,*)'ERROR: int_snow_max = ',int_snow_max,' is not supported, must be greater than 0.0.' - call endrun(msg=' ERROR: invalid value for int_snow_max in CLM namelist. '//& - errMsg(sourcefile, __LINE__)) - endif - if (n_melt_glcmec <= 0.0_r8) then - write(iulog,*)'ERROR: n_melt_glcmec = ',n_melt_glcmec,' is not supported, must be greater than 0.0.' - call endrun(msg=' ERROR: invalid value for n_melt_glcmec in CLM namelist. '//& - errMsg(sourcefile, __LINE__)) - endif - endif ! end of if-masterproc if-block ! ---------------------------------------------------------------------- @@ -357,7 +270,6 @@ subroutine control_init( ) ! ---------------------------------------------------------------------- call initInterp_readnl( NLFilename ) - call UrbanReadNML ( NLFilename ) ! ---------------------------------------------------------------------- ! Broadcast all control information if appropriate @@ -435,13 +347,6 @@ subroutine control_spmd() call mpi_bcast (username, len(username), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (nsrest, 1, MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (use_lch4, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_nitrif_denitrif, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_vertsoilc, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_century_decomp, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_cn, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_nguardrail, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_crop, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_noio, 1, MPI_LOGICAL, 0, mpicom, ier) ! initial file variables @@ -451,64 +356,20 @@ subroutine control_spmd() call mpi_bcast (finidat_interp_dest, len(finidat_interp_dest), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (fsurdat, len(fsurdat), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (fatmlndfrc,len(fatmlndfrc),MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (paramfile, len(paramfile) , MPI_CHARACTER, 0, mpicom, ier) ! mml input file vars for simple model call mpi_bcast (mml_surdat, len(mml_surdat), MPI_CHARACTER, 0, mpicom, ier) - ! Irrigation - call mpi_bcast(irrigate, 1, MPI_LOGICAL, 0, mpicom, ier) - - ! Landunit generation - call mpi_bcast(create_crop_landunit, 1, MPI_LOGICAL, 0, mpicom, ier) - - ! Other subgrid logic - call mpi_bcast(all_active, 1, MPI_LOGICAL, 0, mpicom, ier) - - ! max number of plant functional types in naturally vegetated landunit - call mpi_bcast(maxpatch_pft, 1, MPI_LOGICAL, 0, mpicom, ier) - - ! BGC call mpi_bcast (co2_type, len(co2_type), MPI_CHARACTER, 0, mpicom, ier) - if (use_cn) then - call mpi_bcast (nfix_timeconst, 1, MPI_REAL8, 0, mpicom, ier) - call mpi_bcast (spinup_state, 1, MPI_INTEGER, 0, mpicom, ier) - end if - - call mpi_bcast (use_fates, 1, MPI_LOGICAL, 0, mpicom, ier) - ! flexibleCN nitrogen model - call mpi_bcast (use_flexibleCN, 1, MPI_LOGICAL, 0, mpicom, ier) - - call mpi_bcast (use_luna, 1, MPI_LOGICAL, 0, mpicom, ier) - - call mpi_bcast (use_bedrock, 1, MPI_LOGICAL, 0, mpicom, ier) - - call mpi_bcast (use_hydrstress, 1, MPI_LOGICAL, 0, mpicom, ier) - - call mpi_bcast (use_dynroot, 1, MPI_LOGICAL, 0, mpicom, ier) - - if (use_cn) then - call mpi_bcast (use_fun, 1, MPI_LOGICAL, 0, mpicom, ier) - end if ! physics variables call mpi_bcast (nsegspc, 1, MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (subgridflag , 1, MPI_INTEGER, 0, mpicom, ier) call mpi_bcast (wrtdia, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (single_column,1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (co2_ppmv, 1, MPI_REAL8,0, mpicom, ier) - call mpi_bcast (albice, 2, MPI_REAL8,0, mpicom, ier) - call mpi_bcast (soil_layerstruct,len(soil_layerstruct), MPI_CHARACTER, 0, mpicom, ier) ! snow pack variables call mpi_bcast (nlevsno, 1, MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (h2osno_max, 1, MPI_REAL8, 0, mpicom, ier) - call mpi_bcast (int_snow_max, 1, MPI_REAL8, 0, mpicom, ier) - call mpi_bcast (n_melt_glcmec, 1, MPI_REAL8, 0, mpicom, ier) - - ! glacier_mec variables - call mpi_bcast (maxpatch_glcmec, 1, MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (glc_snow_persistence_max_days, 1, MPI_INTEGER, 0, mpicom, ier) ! history file variables call mpi_bcast (hist_empty_htapes, 1, MPI_LOGICAL, 0, mpicom, ier) @@ -563,14 +424,9 @@ subroutine control_print () write(iulog,*) ' username = ',trim(username) write(iulog,*) ' hostname = ',trim(hostname) write(iulog,*) 'process control parameters:' - write(iulog,*) ' use_nitrif_denitrif = ', use_nitrif_denitrif - write(iulog,*) ' use_vertsoilc = ', use_vertsoilc - write(iulog,*) ' use_century_decomp = ', use_century_decomp - write(iulog,*) ' use_cn = ', use_cn write(iulog,*) ' use_noio = ', use_noio write(iulog,*) 'input data files:' - write(iulog,*) ' PFT physiology and parameters file = ',trim(paramfile) if (fsurdat == ' ') then write(iulog,*) ' fsurdat, surface dataset not set' else @@ -586,23 +442,7 @@ subroutine control_print () else write(iulog,*) ' mml_surdat IS set, and = ',trim(mml_surdat) end if - if (use_cn) then - if (nfix_timeconst /= 0._r8) then - write(iulog,*) ' nfix_timeconst, timescale for smoothing npp in N fixation term: ', nfix_timeconst - else - write(iulog,*) ' nfix_timeconst == zero, use standard N fixation scheme. ' - end if - - end if - write(iulog,*) ' Number of snow layers =', nlevsno - write(iulog,*) ' Max snow depth (mm) =', h2osno_max - write(iulog,*) ' Limit applied to integrated snowfall when determining changes in' - write(iulog,*) ' snow-covered fraction during melt (mm) =', int_snow_max - write(iulog,*) ' SCA shape parameter for glc_mec columns (n_melt_glcmec) =', n_melt_glcmec - - write(iulog,*) ' glc number of elevation classes =', maxpatch_glcmec - write(iulog,*) ' glc snow persistence max days = ', glc_snow_persistence_max_days if (nsrest == nsrStartup) then if (finidat /= ' ') then @@ -628,8 +468,6 @@ subroutine control_print () write(iulog,*) ' CO2 volume mixing ratio = ', co2_type end if - write(iulog,*) ' land-ice albedos (unitless 0-1) = ', albice - write(iulog,*) ' soil layer structure = ', soil_layerstruct if (nsrest == nsrContinue) then write(iulog,*) 'restart warning:' write(iulog,*) ' Namelist not checked for agreement with initial run.' @@ -640,7 +478,6 @@ subroutine control_print () write(iulog,*) ' Namelist not checked for agreement with initial run.' write(iulog,*) ' Surface data set and reference date should not differ from initial run' end if - write(iulog,*) ' maxpatch_pft = ',maxpatch_pft write(iulog,*) ' nsegspc = ',nsegspc end subroutine control_print diff --git a/src/main/decompMod.F90 b/src/main/decompMod.F90 index 13204fabca..90b4028fe0 100644 --- a/src/main/decompMod.F90 +++ b/src/main/decompMod.F90 @@ -10,7 +10,7 @@ module decompMod ! Must use shr_sys_abort rather than endrun here to avoid circular dependency use shr_sys_mod , only : shr_sys_abort use clm_varctl , only : iulog - use clm_varcon , only : grlnd, nameg, namel, namec, namep, nameCohort + use clm_varcon , only : grlnd, nameg, namel, namec, namep use mct_mod , only : mct_gsMap ! ! !PUBLIC TYPES: @@ -231,10 +231,6 @@ subroutine get_clump_bounds_new (n, bounds) !------------------------------------------------------------------------------ ! Make sure this IS being called from a threaded region #ifdef _OPENMP - ! FIX(SPM, 090314) - for debugging fates and openMP - !write(iulog,*) 'SPM omp debug decompMod 1 ', & - !OMP_GET_NUM_THREADS(),OMP_GET_MAX_THREADS(),OMP_GET_THREAD_NUM() - if ( OMP_GET_NUM_THREADS() == 1 .and. OMP_GET_MAX_THREADS() > 1 )then call shr_sys_abort( trim(subname)//' ERROR: Calling from inside a non-threaded region)') end if @@ -301,10 +297,6 @@ subroutine get_proc_bounds_new (bounds) !------------------------------------------------------------------------------ ! Make sure this is NOT being called from a threaded region #ifdef _OPENMP - ! FIX(SPM, 090314) - for debugging fates and openMP - !write(*,*) 'SPM omp debug decompMod 2 ', & - !OMP_GET_NUM_THREADS(),OMP_GET_MAX_THREADS(),OMP_GET_THREAD_NUM() - if ( OMP_GET_NUM_THREADS() > 1 )then call shr_sys_abort( trim(subname)//' ERROR: Calling from inside a threaded region') end if @@ -440,8 +432,6 @@ integer function get_clmlevel_gsize (clmlevel) get_clmlevel_gsize = numc case(namep) get_clmlevel_gsize = nump - case(nameCohort) - get_clmlevel_gsize = numCohort case default write(iulog,*) 'get_clmlevel_gsize does not match clmlevel type: ', trim(clmlevel) call shr_sys_abort() @@ -471,8 +461,6 @@ subroutine get_clmlevel_gsmap (clmlevel, gsmap) gsmap => gsmap_col_gdc2glo case(namep) gsmap => gsmap_patch_gdc2glo - case(nameCohort) - gsmap => gsMap_cohort_gdc2glo case default write(iulog,*) 'get_clmlevel_gsmap: Invalid expansion character: ',trim(clmlevel) call shr_sys_abort() diff --git a/src/main/filterMod.F90 b/src/main/filterMod.F90 index 1201582af7..4e58bb707c 100644 --- a/src/main/filterMod.F90 +++ b/src/main/filterMod.F90 @@ -18,7 +18,6 @@ module filterMod use LandunitType , only : lun use ColumnType , only : col use PatchType , only : patch - use glcBehaviorMod , only : glc_behavior_type ! ! !PUBLIC TYPES: implicit none @@ -90,9 +89,6 @@ module filterMod integer, pointer :: icemecc(:) ! glacier mec filter (cols) integer :: num_icemecc ! number of columns in glacier mec filter - integer, pointer :: do_smb_c(:) ! glacier+bareland SMB calculations-on filter (cols) - integer :: num_do_smb_c ! number of columns in glacier+bareland SMB mec filter - end type clumpfilter public clumpfilter @@ -228,7 +224,6 @@ subroutine allocFiltersOneGroup(this_filter) allocate(this_filter(nc)%soilnopcropp(bounds%endp-bounds%begp+1)) allocate(this_filter(nc)%icemecc(bounds%endc-bounds%begc+1)) - allocate(this_filter(nc)%do_smb_c(bounds%endc-bounds%begc+1)) end do !$OMP END PARALLEL DO @@ -236,7 +231,7 @@ subroutine allocFiltersOneGroup(this_filter) end subroutine allocFiltersOneGroup !------------------------------------------------------------------------ - subroutine setFilters(bounds, glc_behavior) + subroutine setFilters(bounds) ! ! !DESCRIPTION: ! Set CLM filters. @@ -244,14 +239,11 @@ subroutine setFilters(bounds, glc_behavior) ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds - type(glc_behavior_type) , intent(in) :: glc_behavior !------------------------------------------------------------------------ SHR_ASSERT(bounds%level == BOUNDS_LEVEL_CLUMP, errMsg(sourcefile, __LINE__)) - call setFiltersOneGroup(bounds, & - filter, include_inactive = .false., & - glc_behavior = glc_behavior) + call setFiltersOneGroup(bounds, filter, include_inactive = .false.) ! At least as of June, 2013, the 'inactive_and_active' version of the filters is ! static in time. Thus, we could have some logic saying whether we're in @@ -265,14 +257,13 @@ subroutine setFilters(bounds, glc_behavior) ! call. call setFiltersOneGroup(bounds, & - filter_inactive_and_active, include_inactive = .true., & - glc_behavior = glc_behavior) + filter_inactive_and_active, include_inactive = .true.) end subroutine setFilters !------------------------------------------------------------------------ - subroutine setFiltersOneGroup(bounds, this_filter, include_inactive, glc_behavior) + subroutine setFiltersOneGroup(bounds, this_filter, include_inactive) ! ! !DESCRIPTION: ! Set CLM filters for one group of filters. @@ -288,14 +279,12 @@ subroutine setFiltersOneGroup(bounds, this_filter, include_inactive, glc_behavio ! ! !USES: use decompMod , only : BOUNDS_LEVEL_CLUMP - use pftconMod , only : npcropmin use landunit_varcon , only : istsoil, istcrop, istice_mec ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds type(clumpfilter) , intent(inout) :: this_filter(:) ! the group of filters to set logical , intent(in) :: include_inactive ! whether inactive points should be included in the filters - type(glc_behavior_type) , intent(in) :: glc_behavior ! ! LOCAL VARAIBLES: integer :: nc ! clump index @@ -413,15 +402,10 @@ subroutine setFiltersOneGroup(bounds, this_filter, include_inactive, glc_behavio fnl = 0 do p = bounds%begp,bounds%endp if (patch%active(p) .or. include_inactive) then - if (patch%itype(p) >= npcropmin) then !skips 2 generic crop types - fl = fl + 1 - this_filter(nc)%pcropp(fl) = p - else - l =patch%landunit(p) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - fnl = fnl + 1 - this_filter(nc)%soilnopcropp(fnl) = p - end if + l =patch%landunit(p) + if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then + fnl = fnl + 1 + this_filter(nc)%soilnopcropp(fnl) = p end if end if end do @@ -496,28 +480,6 @@ subroutine setFiltersOneGroup(bounds, this_filter, include_inactive, glc_behavio end do this_filter(nc)%num_icemecc = f - f = 0 - do c = bounds%begc,bounds%endc - if (col%active(c) .or. include_inactive) then - l = col%landunit(c) - g = col%gridcell(c) - - ! Only compute SMB in regions where we replace ice melt with new ice: - ! Elsewhere (where ice melt remains in place), we cannot compute a sensible - ! negative SMB. - ! - ! In addition to istice_mec columns, we also compute SMB for any soil column in - ! this region, in order to provide SMB forcing for the bare ground elevation - ! class (elevation class 0). - if ( glc_behavior%melt_replaced_by_ice_grc(g) .and. & - (lun%itype(l) == istice_mec .or. lun%itype(l) == istsoil)) then - f = f + 1 - this_filter(nc)%do_smb_c(f) = c - end if - end if - end do - this_filter(nc)%num_do_smb_c = f - ! Note: snow filters are reconstructed each time step in ! LakeHydrology and SnowHydrology ! Note: CNDV "pft present" filter is reconstructed each time CNDV is run diff --git a/src/main/glc2lndMod.F90 b/src/main/glc2lndMod.F90 deleted file mode 100644 index d27d2e53af..0000000000 --- a/src/main/glc2lndMod.F90 +++ /dev/null @@ -1,579 +0,0 @@ -module glc2lndMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Handle arrays used for exchanging data from glc to clm. - ! - ! !USES: -#include "shr_assert.h" - use decompMod , only : bounds_type - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : maxpatch_glcmec - use clm_varctl , only : iulog, glc_do_dynglacier - use clm_varcon , only : nameg, spval, ispval - use abortutils , only : endrun - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use landunit_varcon, only : istice_mec - use glcBehaviorMod , only : glc_behavior_type - ! - ! !REVISION HISTORY: - ! Created by William Lipscomb, Dec. 2007, based on clm_atmlnd.F90. - ! - ! !PUBLIC TYPES: - implicit none - private - save - - ! glc -> land variables structure - type, public :: glc2lnd_type - - ! ------------------------------------------------------------------------ - ! Public data - ! ------------------------------------------------------------------------ - - ! Where we should do runoff routing that is appropriate for having a dynamic icesheet underneath. - real(r8), pointer :: glc_dyn_runoff_routing_grc (:) => null() - - ! ------------------------------------------------------------------------ - ! Private data - ! ------------------------------------------------------------------------ - - type(glc_behavior_type), pointer, private :: glc_behavior ! reference to the glc_behavior instance - - real(r8), pointer, private :: frac_grc (:,:) => null() - real(r8), pointer, private :: topo_grc (:,:) => null() - real(r8), pointer, private :: hflx_grc (:,:) => null() - - ! Area in which GLC model can accept surface mass balance, received from glc (0-1) - real(r8), pointer, private :: icemask_grc (:) => null() - - ! icemask_coupled_fluxes_grc is like icemask_grc, but the mask only contains icesheet - ! points that potentially send non-zero fluxes to the coupler. i.e., it does not - ! contain icesheets that are diagnostic only, because for those diagnostic ice sheets - ! (which do not send calving fluxes to the coupler), we need to use the non-dynamic - ! form of runoff routing in CLM in order to conserve water properly. - ! - ! (However, note that this measure of "diagnostic-only" does not necessarily - ! correspond to whether CLM is updating its glacier areas there - for example, we - ! could theoretically have an icesheet whose areas are evolving, and CLM is updating - ! its glacier areas to match, but where we're zeroing out the fluxes sent to the - ! coupler, and so we're using the non-dynamic form of runoff routing in CLM.) - real(r8), pointer, private :: icemask_coupled_fluxes_grc (:) => null() - - contains - - ! ------------------------------------------------------------------------ - ! Public routines - ! ------------------------------------------------------------------------ - - procedure, public :: Init - procedure, public :: Clean - - ! In each timestep, these routines should be called in order (though they don't need - ! to be called all at once): - ! - set_glc2lnd_fields - ! - update_glc2lnd_topo - procedure, public :: set_glc2lnd_fields ! set coupling fields sent from glc to lnd - procedure, public :: update_glc2lnd_topo ! update topographic heights - - ! For unit testing only: - procedure, public :: for_test_set_glc2lnd_fields_directly ! set glc2lnd fields directly in a unit testing context - - ! ------------------------------------------------------------------------ - ! Private routines - ! ------------------------------------------------------------------------ - - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - ! sanity-check icemask from GLC - procedure, private :: check_glc2lnd_icemask - - ! sanity-check icemask_coupled_fluxes from GLC - procedure, private :: check_glc2lnd_icemask_coupled_fluxes - - ! update glc_dyn_runoff_routing field based on input from GLC - procedure, private :: update_glc2lnd_dyn_runoff_routing - - end type glc2lnd_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, glc_behavior) - - class(glc2lnd_type) :: this - type(bounds_type), intent(in) :: bounds - type(glc_behavior_type), intent(in), target :: glc_behavior - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds, glc_behavior) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize glc variables required by the land - ! - ! !ARGUMENTS: - class (glc2lnd_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begg,endg - !------------------------------------------------------------------------ - - begg = bounds%begg; endg = bounds%endg - - allocate(this%frac_grc (begg:endg,0:maxpatch_glcmec)) ; this%frac_grc (:,:) = nan - allocate(this%topo_grc (begg:endg,0:maxpatch_glcmec)) ; this%topo_grc (:,:) = nan - allocate(this%hflx_grc (begg:endg,0:maxpatch_glcmec)) ; this%hflx_grc (:,:) = nan - allocate(this%icemask_grc (begg:endg)) ; this%icemask_grc (:) = nan - allocate(this%icemask_coupled_fluxes_grc (begg:endg)) ; this%icemask_coupled_fluxes_grc (:) = nan - allocate(this%glc_dyn_runoff_routing_grc (begg:endg)) ; this%glc_dyn_runoff_routing_grc (:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !USES: - use histFileMod, only : hist_addfld1d - ! - ! !ARGUMENTS: - class(glc2lnd_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begg, endg - - character(len=*), parameter :: subname = 'InitHistory' - !----------------------------------------------------------------------- - - begg = bounds%begg - endg = bounds%endg - - this%icemask_grc(begg:endg) = spval - call hist_addfld1d (fname='ICE_MODEL_FRACTION', units='unitless', & - avgflag='I', long_name='Ice sheet model fractional coverage', & - ptr_gcell=this%icemask_grc, default='inactive') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds, glc_behavior) - ! - ! !USES: - use domainMod , only : ldomain - ! - ! !ARGUMENTS: - class(glc2lnd_type) :: this - type(bounds_type), intent(in) :: bounds - type(glc_behavior_type), intent(in), target :: glc_behavior - ! - ! !LOCAL VARIABLES: - integer :: begg, endg - - character(len=*), parameter :: subname = 'InitCold' - !----------------------------------------------------------------------- - - begg = bounds%begg - endg = bounds%endg - - this%glc_behavior => glc_behavior - - this%frac_grc(begg:endg, :) = 0.0_r8 - this%topo_grc(begg:endg, :) = 0.0_r8 - this%hflx_grc(begg:endg, :) = 0.0_r8 - - ! When running with a stub glc model, it's important that icemask_grc be initialized - ! to 0 everywhere. With an active glc model, icemask_grc will be updated in the first - ! time step, and it isn't needed before then, so it's safe to initialize it to 0. - ! Since icemask is 0, icemask_coupled_fluxes needs to be 0, too (and the latter is - ! safest in case we aren't coupled to CISM, to ensure that we use the uncoupled form - ! of runoff routing). - this%icemask_grc(begg:endg) = 0.0_r8 - this%icemask_coupled_fluxes_grc(begg:endg) = 0.0_r8 - - call this%update_glc2lnd_dyn_runoff_routing(bounds) - - end subroutine InitCold - - - !----------------------------------------------------------------------- - subroutine Clean(this) - ! - ! !DESCRIPTION: - ! Deallocate memory in this object - ! - ! !ARGUMENTS: - class(glc2lnd_type), intent(inout) :: this - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'Clean' - !----------------------------------------------------------------------- - - deallocate(this%frac_grc) - deallocate(this%topo_grc) - deallocate(this%hflx_grc) - deallocate(this%icemask_grc) - deallocate(this%icemask_coupled_fluxes_grc) - deallocate(this%glc_dyn_runoff_routing_grc) - - end subroutine Clean - - !----------------------------------------------------------------------- - subroutine set_glc2lnd_fields(this, bounds, glc_present, x2l, & - index_x2l_Sg_ice_covered, index_x2l_Sg_topo, index_x2l_Flgg_hflx, & - index_x2l_Sg_icemask, index_x2l_Sg_icemask_coupled_fluxes) - ! - ! !DESCRIPTION: - ! Set coupling fields sent from glc to lnd - ! - ! If glc_present is true, then the given fields are all assumed to be valid; if - ! glc_present is false, then these fields are ignored. - ! - ! !ARGUMENTS: - class(glc2lnd_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - logical , intent(in) :: glc_present ! true if running with a non-stub glc model - real(r8) , intent(in) :: x2l(:, bounds%begg: ) ! driver import state to land model [field, gridcell] - integer , intent(in) :: index_x2l_Sg_ice_covered( 0: ) ! indices of ice-covered field in x2l, for each elevation class - integer , intent(in) :: index_x2l_Sg_topo( 0: ) ! indices of topo field in x2l, for each elevation class - integer , intent(in) :: index_x2l_Flgg_hflx( 0: ) ! indices of heat flux field in x2l, for each elevation class - integer , intent(in) :: index_x2l_Sg_icemask ! index of icemask field in x2l - integer , intent(in) :: index_x2l_Sg_icemask_coupled_fluxes ! index of icemask_coupled_fluxes field in x2l - ! - ! !LOCAL VARIABLES: - integer :: g - integer :: icemec_class - - character(len=*), parameter :: subname = 'set_glc2lnd_fields' - !----------------------------------------------------------------------- - - SHR_ASSERT((ubound(x2l, 2) == bounds%endg), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(index_x2l_Sg_ice_covered) == (/maxpatch_glcmec/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(index_x2l_Sg_topo) == (/maxpatch_glcmec/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(index_x2l_Flgg_hflx) == (/maxpatch_glcmec/)), errMsg(sourcefile, __LINE__)) - - if (glc_present) then - call endrun(' ERROR: SLIM can NOT run with an active ice sheet model' ) - end if - if (glc_do_dynglacier) then - call endrun(' ERROR: With glc_present false (e.g., a stub glc model), glc_do_dynglacier must be false '// & - errMsg(sourcefile, __LINE__)) - end if - - end subroutine set_glc2lnd_fields - - !----------------------------------------------------------------------- - subroutine for_test_set_glc2lnd_fields_directly(this, bounds, & - topo, icemask) - ! - ! !DESCRIPTION: - ! Set glc2lnd fields directly in a unit testing context - ! - ! This currently only provides a mechanism to set fields that are actually needed in - ! our unit tests. More could be added later. - ! - ! Also: In contrast to the production version (set_glc2lnd_fields), this does NOT - ! currently update glc2lnd_dyn_runoff_routing (because doing so would require having a - ! sensible glc_behavior, which we may not have; and also, we currently don't need this - ! field in a unit testing context). (Note: If we eventually want/need to update - ! glc2lnd_dyn_runoff_routing, and thus need a fully sensible glc_behavior, then we - ! should extract the self-calls at the end of set_glc2lnd_fields - ! (check_glc2lnd_icemask, check_glc2lnd_icemask_coupled_fluxes, - ! update_glc2lnd_dyn_runoff_routing) into a private routine like - ! set_glc2lnd_fields_wrapup, which could be called by both set_glc2lnd_fields and this - ! routine.) - ! - ! !ARGUMENTS: - class(glc2lnd_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - real(r8), intent(in), optional :: topo( bounds%begg: , 0: ) ! topographic height [gridcell, elevclass] - real(r8), intent(in), optional :: icemask( bounds%begg: ) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'for_test_set_glc2lnd_fields_directly' - !----------------------------------------------------------------------- - - if (present(topo)) then - SHR_ASSERT_ALL((ubound(topo) == (/bounds%endg, maxpatch_glcmec/)), errMsg(sourcefile, __LINE__)) - this%topo_grc(bounds%begg:bounds%endg, 0:maxpatch_glcmec) = topo(bounds%begg:bounds%endg, 0:maxpatch_glcmec) - end if - - if (present(icemask)) then - SHR_ASSERT_ALL((ubound(icemask) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - this%icemask_grc(bounds%begg:bounds%endg) = icemask(bounds%begg:bounds%endg) - end if - - end subroutine for_test_set_glc2lnd_fields_directly - - !----------------------------------------------------------------------- - subroutine check_glc2lnd_icemask(this, bounds) - ! - ! !DESCRIPTION: - ! Do a sanity check on the icemask received from CISM via coupler. - ! - ! !USES: - use domainMod , only : ldomain - ! - ! !ARGUMENTS: - class(glc2lnd_type), intent(in) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g ! grid cell index - - character(len=*), parameter :: subname = 'check_glc2lnd_icemask' - !----------------------------------------------------------------------- - - do g = bounds%begg, bounds%endg - - if (this%icemask_grc(g) > 0._r8) then - - ! Ensure that icemask is a subset of has_virtual_columns. This is needed because - ! we allocated memory based on has_virtual_columns, so it is a problem if the - ! ice sheet tries to expand beyond the area defined by has_virtual_columns. - if (.not. this%glc_behavior%has_virtual_columns_grc(g)) then - write(iulog,'(a)') subname//' ERROR: icemask must be a subset of has_virtual_columns.' - write(iulog,'(a)') 'Ensure that the glacier_region_behavior namelist item is set correctly.' - write(iulog,'(a)') '(It should specify "virtual" for the region corresponding to the GLC domain.)' - write(iulog,'(a)') 'If glacier_region_behavior is set correctly, then you can fix this problem' - write(iulog,'(a)') 'by modifying GLACIER_REGION on the surface dataset.' - write(iulog,'(a)') '(Expand the region that corresponds to the GLC domain' - write(iulog,'(a)') '- i.e., the region specified as "virtual" in glacier_region_behavior.)' - call endrun(decomp_index=g, clmlevel=nameg, msg=errMsg(sourcefile, __LINE__)) - end if - - ! Ensure that icemask is a subset of melt_replaced_by_ice. This is needed - ! because we only compute SMB in the region given by melt_replaced_by_ice - ! (according to the logic for building the do_smb filter), and we need SMB - ! everywhere inside the icemask. - if (.not. this%glc_behavior%melt_replaced_by_ice_grc(g)) then - write(iulog,'(a)') subname//' ERROR: icemask must be a subset of melt_replaced_by_ice.' - write(iulog,'(a)') 'Ensure that the glacier_region_melt_behavior namelist item is set correctly.' - write(iulog,'(a)') '(It should specify "replaced_by_ice" for the region corresponding to the GLC domain.)' - write(iulog,'(a)') 'If glacier_region_behavior is set correctly, then you can fix this problem' - write(iulog,'(a)') 'by modifying GLACIER_REGION on the surface dataset.' - write(iulog,'(a)') '(Expand the region that corresponds to the GLC domain' - write(iulog,'(a)') '- i.e., the region specified as "replaced_by_ice" in glacier_region_melt_behavior.)' - call endrun(decomp_index=g, clmlevel=nameg, msg=errMsg(sourcefile, __LINE__)) - end if - - end if - end do - - end subroutine check_glc2lnd_icemask - - !----------------------------------------------------------------------- - subroutine check_glc2lnd_icemask_coupled_fluxes(this, bounds) - ! - ! !DESCRIPTION: - ! Do a sanity check on the icemask_coupled_fluxes field received from CISM via coupler. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(glc2lnd_type), intent(in) :: this - type(bounds_type) , intent(in) :: bounds ! bounds - ! - ! !LOCAL VARIABLES: - integer :: g ! grid cell index - - character(len=*), parameter :: subname = 'check_glc2lnd_icemask_coupled_fluxes' - !----------------------------------------------------------------------- - - do g = bounds%begg, bounds%endg - - ! Ensure that icemask_coupled_fluxes is a subset of icemask. Although there - ! currently is no code in CLM that depends on this relationship, it seems helpful - ! to ensure that this intuitive relationship holds, so that code developed in the - ! future can rely on it. - if (this%icemask_coupled_fluxes_grc(g) > 0._r8 .and. this%icemask_grc(g) == 0._r8) then - write(iulog,*) subname//' ERROR: icemask_coupled_fluxes must be a subset of icemask.' - call endrun(decomp_index=g, clmlevel=nameg, msg=errMsg(sourcefile, __LINE__)) - end if - - end do - - end subroutine check_glc2lnd_icemask_coupled_fluxes - - !----------------------------------------------------------------------- - subroutine update_glc2lnd_dyn_runoff_routing(this, bounds) - ! - ! !DESCRIPTION: - ! Update glc_dyn_runoff_routing field based on updated icemask_coupled_fluxes field - ! - ! !USES: - use domainMod , only : ldomain - ! - ! !ARGUMENTS: - class(glc2lnd_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds ! bounds - ! - ! !LOCAL VARIABLES: - integer :: g ! grid cell index - - character(len=*), parameter :: subname = 'update_glc2lnd_dyn_runoff_routing' - !----------------------------------------------------------------------- - - ! Wherever we have an icesheet that is computing and sending fluxes to the coupler - - ! which particularly means it is computing a calving flux - we will use the - ! "glc_dyn_runoff_routing" scheme, with 0 < glc_dyn_runoff_routing <= 1. - ! In these places, all or part of the snowcap flux goes to CISM rather than the runoff model. - ! In other places - including places where CISM is not running at all, as well as places - ! where CISM is running in diagnostic-only mode and therefore is not sending a calving flux - - ! we have glc_dyn_runoff_routing = 0, and the snowcap flux goes to the runoff model. - ! This is needed to conserve water correctly in the absence of a calving flux. - - do g = bounds%begg, bounds%endg - - ! Set glc_dyn_runoff_routing_grc(g) to a value in the range [0,1]. - ! - ! This value gives the grid cell fraction that is deemed to be coupled to the - ! dynamic ice sheet model. For this fraction of the grid cell, snowcap fluxes are - ! sent to the ice sheet model. The remainder of the grid cell sends snowcap fluxes - ! to the runoff model. - ! - ! Note: The coupler (in prep_glc_mod.F90) assumes that the fraction coupled to the - ! dynamic ice sheet model is min(lfrac, Sg_icemask_l), where lfrac is the - ! "frac" component of fraction_lx, and Sg_icemask_l is obtained by mapping - ! Sg_icemask_g from the glc to the land grid. Here, ldomain%frac is - ! equivalent to lfrac, and this%icemask_grc is equivalent to Sg_icemask_l. - ! However, here we use icemask_coupled_fluxes_grc, so that we route all snow - ! capping to runoff in areas where the ice sheet is not generating calving - ! fluxes. In addition, here we need to divide by lfrac, because the coupler - ! multiplies by it later (and, for example, if lfrac = 0.1 and - ! icemask_coupled_fluxes = 1, we want all snow capping to go to the ice - ! sheet model, not to the runoff model). - ! - ! Note: In regions where CLM overlaps the CISM domain, this%icemask_grc(g) typically - ! is nearly equal to ldomain%frac(g). So an alternative would be to simply set - ! glc_dyn_runoff_routing_grc(g) = icemask_grc(g). - ! The reason to cap glc_dyn_runoff_routing at lfrac is to avoid sending the - ! ice sheet model a greater mass of water (in the form of snowcap fluxes) - ! than is allowed to fall on a CLM grid cell that is part ocean. - - ! TODO(wjs, 2017-05-08) Ideally, we wouldn't have this duplication in logic - ! between the coupler and CLM. The best solution would be to have the coupler - ! itself do the partitioning of the snow capping flux between the ice sheet model - ! and the runoff model. A next-best solution would be to have the coupler send a - ! field to CLM telling it what fraction of snow capping should go to the runoff - ! model in each grid cell. - - if (ldomain%frac(g) == 0._r8) then - ! Avoid divide by 0; note that, in this case, the amount going to runoff isn't - ! important for system-wide conservation, so we could really choose anything we - ! want. - this%glc_dyn_runoff_routing_grc(g) = this%icemask_coupled_fluxes_grc(g) - else - this%glc_dyn_runoff_routing_grc(g) = & - min(ldomain%frac(g), this%icemask_coupled_fluxes_grc(g)) / & - ldomain%frac(g) - end if - - if (this%glc_dyn_runoff_routing_grc(g) > 0.0_r8) then - - ! Ensure that glc_dyn_runoff_routing is a subset of melt_replaced_by_ice. This - ! is needed because glacial melt is only sent to the runoff stream in the region - ! given by melt_replaced_by_ice (because the latter is used to create the do_smb - ! filter, and the do_smb filter controls where glacial melt is computed). - if (.not. this%glc_behavior%melt_replaced_by_ice_grc(g)) then - write(iulog,'(a)') subname//' ERROR: icemask_coupled_fluxes must be a subset of melt_replaced_by_ice.' - write(iulog,'(a)') 'Ensure that the glacier_region_melt_behavior namelist item is set correctly.' - write(iulog,'(a)') '(It should specify "replaced_by_ice" for the region corresponding to the GLC domain.)' - write(iulog,'(a)') 'If glacier_region_behavior is set correctly, then you can fix this problem' - write(iulog,'(a)') 'by modifying GLACIER_REGION on the surface dataset.' - write(iulog,'(a)') '(Expand the region that corresponds to the GLC domain' - write(iulog,'(a)') '- i.e., the region specified as "replaced_by_ice" in glacier_region_melt_behavior.)' - call endrun(decomp_index=g, clmlevel=nameg, msg=errMsg(sourcefile, __LINE__)) - end if - end if - end do - - end subroutine update_glc2lnd_dyn_runoff_routing - - - - !----------------------------------------------------------------------- - subroutine update_glc2lnd_topo(this, bounds, topo_col, needs_downscaling_col) - ! - ! !DESCRIPTION: - ! Update column-level topographic heights based on input from GLC (via the coupler). - ! - ! Also updates the logical array, needs_downscaling_col: Sets this array to true - ! anywhere where topo_col is updated, because these points will need downscaling. - ! (Leaves other array elements in needs_downscaling_col untouched.) - ! - ! If glc_do_dynglacier is false, then both topographic heights and - ! needs_downscaling_col are left unchanged. - ! - ! !USES: - use landunit_varcon , only : istice_mec - use column_varcon , only : col_itype_to_icemec_class - ! - ! !ARGUMENTS: - class(glc2lnd_type) , intent(in) :: this - type(bounds_type) , intent(in) :: bounds ! bounds - real(r8) , intent(inout) :: topo_col( bounds%begc: ) ! topographic height (m) - logical , intent(inout) :: needs_downscaling_col( bounds%begc: ) - ! - ! !LOCAL VARIABLES: - integer :: c, l, g ! indices - integer :: icemec_class ! current icemec class (1..maxpatch_glcmec) - - character(len=*), parameter :: subname = 'update_glc2lnd_topo' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(topo_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(needs_downscaling_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - if (glc_do_dynglacier) then - do c = bounds%begc, bounds%endc - l = col%landunit(c) - g = col%gridcell(c) - - ! Values from GLC are only valid within the icemask, so we only update CLM's topo values there - if (this%icemask_grc(g) > 0._r8) then - if (lun%itype(l) == istice_mec) then - icemec_class = col_itype_to_icemec_class(col%itype(c)) - else - ! If not on a glaciated column, assign topography to the bare-land value determined by GLC. - icemec_class = 0 - end if - - ! Note that we do downscaling over all column types. This is for consistency: - ! interpretation of results would be difficult if some non-glacier column types - ! were downscaled but others were not. - ! - ! BUG(wjs, 2016-11-15, bugz 2377) Actually, do not downscale over urban points: - ! this currently isn't allowed because the urban code references some - ! non-downscaled, gridcell-level atmospheric forcings - if (.not. lun%urbpoi(l)) then - topo_col(c) = this%topo_grc(g, icemec_class) - needs_downscaling_col(c) = .true. - end if - end if - end do - end if - - end subroutine update_glc2lnd_topo - -end module glc2lndMod - diff --git a/src/main/glcBehaviorMod.F90 b/src/main/glcBehaviorMod.F90 index 2fa47857ea..a1f15f8c36 100644 --- a/src/main/glcBehaviorMod.F90 +++ b/src/main/glcBehaviorMod.F90 @@ -25,63 +25,12 @@ module glcBehaviorMod type, public :: glc_behavior_type private - ! ------------------------------------------------------------------------ - ! Public data - ! ------------------------------------------------------------------------ - - ! If has_virtual_columns_grc(g) is true, then grid cell g has virtual columns for - ! all possible glc_mec columns. - ! - ! For the sake of coupling with CISM, this should only be needed within the icemask, - ! where we need virtual columns for the sake of coupling with CISM. This is needed in - ! order to (1) provide SMB in all elevation classes, in case it is being used with - ! 1-way coupling (or to force a later TG run); (2) even with two-way coupling, - ! provide SMB in the elevation classes above and below existing elevation classes, - ! for the sake of vertical interpolation; (3) provide place-holder columns (which are - ! already spun-up) for dynamic landunits; (4) ensure that all glacier columns are - ! given spun-up initial conditions by init_interp. - ! - ! More details on (4) (echoing the similar comment in subgridWeightsMod): We need all - ! glacier and vegetated points to be active in the icemask region for the sake of - ! init_interp - since we only interpolate onto active points, and we don't know which - ! points will have non-zero area until after initialization (as long as we can't send - ! information from glc to clm in initialization). (If we had an inactive glacier - ! point in the icemask region, according to the weights on the surface dataset, and - ! ran init_interp, this point would keep its cold start initialization values. Then, - ! in the first time step of the run loop, it's possible that this point would become - ! active because, according to glc, there is actually > 0% glacier in that grid - ! cell. We don't do any state / flux adjustments in the first time step after - ! init_interp due to glacier area changes, so this glacier column would remain at its - ! cold start initialization values, which would be a Bad Thing. Ensuring that all - ! glacier points within the icemask are active gets around this problem - as well as - ! having other benefits, as noted above.) - ! - ! However, by making this part of the user-modifiable "glc behavior", we make it easy - ! for the user to add virtual columns, if this is desired for diagnostic - ! purposes. One important reason why this may be desired is to produce coupler - ! history forcings to force a later TG run, with SMB forcings outside the original - ! CISM area. (Also, we cannot use icemask for all purposes, because it isn't known at - ! initialization.) - logical, allocatable, public :: has_virtual_columns_grc(:) - ! If allow_multiple_columns_grc(g) is true, then grid cell g may have multiple ! glacier columns, for the different elevation classes. If ! allow_multiple_columns_grc(g) is false, then grid cell g is guaranteed to have at ! most one glacier column. logical, allocatable, public :: allow_multiple_columns_grc(:) - ! If melt_replaced_by_ice_grc(g) is true, then any glacier ice melt in gridcell g - ! runs off and is replaced by ice. Note that SMB cannot be computed in gridcell g if - ! melt_replaced_by_ice_grc(g) is false, since we can't compute a sensible negative - ! smb in that case. - logical, allocatable, public :: melt_replaced_by_ice_grc(:) - - ! If ice_runoff_melted_grc(g) is true, then ice runoff generated by the - ! CLM physics over glacier columns in gridcell g is melted (generating a negative - ! sensible heat flux) and runs off as liquid. If it is false, then ice runoff is - ! sent to the river model as ice (a crude parameterization of iceberg calving). - logical, allocatable, public :: ice_runoff_melted_grc(:) - ! ------------------------------------------------------------------------ ! Private data ! ------------------------------------------------------------------------ @@ -154,8 +103,7 @@ module glcBehaviorMod ! !PRIVATE MEMBER DATA: - ! Longest name allowed for glacier_region_behavior, glacier_region_melt_behavior and - ! glacier_region_ice_runoff_behavior + ! Longest name allowed for glacier_region_behavior integer, parameter :: max_behavior_name_len = 32 ! Smallest and largest allowed values for a glacier region ID @@ -190,27 +138,22 @@ subroutine Init(this, begg, endg, NLFilename) ! !LOCAL VARIABLES: integer, allocatable :: glacier_region_map(:) character(len=max_behavior_name_len) :: glacier_region_behavior(min_glacier_region_id:max_glacier_region_id) - character(len=max_behavior_name_len) :: glacier_region_melt_behavior(min_glacier_region_id:max_glacier_region_id) - character(len=max_behavior_name_len) :: glacier_region_ice_runoff_behavior(min_glacier_region_id:max_glacier_region_id) character(len=*), parameter :: subname = 'Init' !----------------------------------------------------------------------- allocate(glacier_region_map(begg:endg)) call this%read_surface_dataset(begg, endg, glacier_region_map(begg:endg)) - call this%read_namelist(NLFilename, glacier_region_behavior, & - glacier_region_melt_behavior, glacier_region_ice_runoff_behavior) + call this%read_namelist(NLFilename, glacier_region_behavior) call this%InitFromInputs(begg, endg, & - glacier_region_map(begg:endg), glacier_region_behavior, & - glacier_region_melt_behavior, glacier_region_ice_runoff_behavior) + glacier_region_map(begg:endg), glacier_region_behavior) end subroutine Init !----------------------------------------------------------------------- subroutine InitFromInputs(this, begg, endg, & - glacier_region_map, glacier_region_behavior_str, glacier_region_melt_behavior_str, & - glacier_region_ice_runoff_behavior_str) + glacier_region_map, glacier_region_behavior_str) ! ! !DESCRIPTION: ! Initialize a glc_behavior_type object given a map of glacier region IDs and an @@ -233,26 +176,11 @@ subroutine InitFromInputs(this, begg, endg, & ! allowed values are: ! - 'multiple': grid cells can potentially have multiple glacier elevation classes, ! but no virtual columns - ! - 'virtual': grid cells have virtual columns: values are computed for every glacier - ! elevation class, even those with 0 area ! - 'single_at_atm_topo': glacier landunits in these grid cells have a single column, ! whose elevation matches the atmosphere's topographic height (so that there is no ! adjustment due to downscaling) character(len=*), intent(in) :: glacier_region_behavior_str(min_glacier_region_id:) - ! string giving treatment of ice melt for each glacier region ID - ! allowed values are: - ! - 'replaced_by_ice' - ! - 'remains_in_place' - character(len=*), intent(in) :: glacier_region_melt_behavior_str(min_glacier_region_id:) - - ! string giving treatment of ice runoff for each glacier region ID - ! allowed values are: - ! - 'remains_ice' - ! - 'melted' - character(len=*), intent(in) :: glacier_region_ice_runoff_behavior_str(min_glacier_region_id:) - - ! ! !LOCAL VARIABLES: ! whether each glacier region ID is present in the glacier_region_map logical :: glacier_region_present(min_glacier_region_id:max_glacier_region_id) @@ -260,33 +188,15 @@ subroutine InitFromInputs(this, begg, endg, & ! integer codes corresponding to glacier_region_behavior_str integer :: glacier_region_behavior(min_glacier_region_id:max_glacier_region_id) - ! integer codes corresponding to glacier_region_melt_behavior_str - integer :: glacier_region_melt_behavior(min_glacier_region_id:max_glacier_region_id) - - ! integer codes corresponding to glacier_region_ice_runoff_behavior_str - integer :: glacier_region_ice_runoff_behavior(min_glacier_region_id:max_glacier_region_id) - integer :: g integer :: my_id integer :: my_behavior - integer :: my_melt_behavior - integer :: my_ice_runoff_behavior ! possible glacier_region_behavior codes integer, parameter :: BEHAVIOR_MULTIPLE = 1 - integer, parameter :: BEHAVIOR_VIRTUAL = 2 integer, parameter :: BEHAVIOR_SINGLE_AT_ATM_TOPO = 3 - ! possible glacier_region_melt_behavior codes - integer, parameter :: MELT_BEHAVIOR_REPLACED_BY_ICE = 1 - integer, parameter :: MELT_BEHAVIOR_REMAINS_IN_PLACE = 2 - - ! possible glacier_region_ice_runoff_behavior codes - integer, parameter :: ICE_RUNOFF_BEHAVIOR_REMAINS_ICE = 1 - integer, parameter :: ICE_RUNOFF_BEHAVIOR_MELTED = 2 - - ! value indicating that a behavior code has not been set (for glacier_region_behavior, - ! glacier_region_melt_behavior or glacier_region_ice_runoff_behavior) + ! value indicating that a behavior code has not been set (for glacier_region_behavior) integer, parameter :: BEHAVIOR_UNSET = -1 character(len=*), parameter :: subname = 'InitFromInputs' @@ -299,39 +209,12 @@ subroutine InitFromInputs(this, begg, endg, & call determine_region_presence call translate_glacier_region_behavior - call translate_glacier_region_melt_behavior - call translate_glacier_region_ice_runoff_behavior call this%InitAllocate(begg, endg) do g = begg, endg my_id = glacier_region_map(g) my_behavior = glacier_region_behavior(my_id) - my_melt_behavior = glacier_region_melt_behavior(my_id) - my_ice_runoff_behavior = glacier_region_ice_runoff_behavior(my_id) - - ! This should only happen due to a programming error, not due to a user input error - SHR_ASSERT(my_behavior /= BEHAVIOR_UNSET, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(my_melt_behavior /= BEHAVIOR_UNSET, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(my_ice_runoff_behavior /= BEHAVIOR_UNSET, errMsg(sourcefile, __LINE__)) - - if (my_behavior == BEHAVIOR_VIRTUAL) then - this%has_virtual_columns_grc(g) = .true. - else - this%has_virtual_columns_grc(g) = .false. - end if - - if (my_melt_behavior == MELT_BEHAVIOR_REMAINS_IN_PLACE) then - this%melt_replaced_by_ice_grc(g) = .false. - else - this%melt_replaced_by_ice_grc(g) = .true. - end if - - if (my_ice_runoff_behavior == ICE_RUNOFF_BEHAVIOR_MELTED) then - this%ice_runoff_melted_grc(g) = .true. - else - this%ice_runoff_melted_grc(g) = .false. - end if ! For now, allow_multiple_columns_grc is simply the opposite of ! collapse_to_atm_topo_grc. However, we maintain the separate @@ -390,8 +273,6 @@ subroutine translate_glacier_region_behavior select case (glacier_region_behavior_str(i)) case ('multiple') glacier_region_behavior(i) = BEHAVIOR_MULTIPLE - case ('virtual') - glacier_region_behavior(i) = BEHAVIOR_VIRTUAL case ('single_at_atm_topo') glacier_region_behavior(i) = BEHAVIOR_SINGLE_AT_ATM_TOPO case (behavior_str_unset) @@ -400,87 +281,19 @@ subroutine translate_glacier_region_behavior call endrun(msg=' ERROR: glacier_region_behavior not specified for ID '// & errMsg(sourcefile, __LINE__)) case default - write(iulog,*) ' ERROR: Unknown glacier_region_behavior for ID ', i - write(iulog,*) glacier_region_behavior_str(i) - write(iulog,*) 'Allowable values are: multiple, virtual, single_at_atm_topo' - call endrun(msg=' ERROR: Unknown glacier_region_behavior'// & - errMsg(sourcefile, __LINE__)) end select end if end do end subroutine translate_glacier_region_behavior - subroutine translate_glacier_region_melt_behavior - integer :: i - - do i = min_glacier_region_id, max_glacier_region_id - glacier_region_melt_behavior(i) = BEHAVIOR_UNSET - - if (glacier_region_present(i)) then - SHR_ASSERT_ALL((ubound(glacier_region_melt_behavior_str) >= (/i/)), errMsg(sourcefile, __LINE__)) - - select case (glacier_region_melt_behavior_str(i)) - case ('replaced_by_ice') - glacier_region_melt_behavior(i) = MELT_BEHAVIOR_REPLACED_BY_ICE - case ('remains_in_place') - glacier_region_melt_behavior(i) = MELT_BEHAVIOR_REMAINS_IN_PLACE - case (behavior_str_unset) - write(iulog,*) ' ERROR: glacier_region_melt_behavior not specified for ID ', i - write(iulog,*) 'You probably need to extend the glacier_region_melt_behavior namelist array' - call endrun(msg=' ERROR: glacier_region_melt_behavior not specified for ID '// & - errMsg(sourcefile, __LINE__)) - case default - write(iulog,*) ' ERROR: Unknown glacier_region_melt_behavior for ID ', i - write(iulog,*) glacier_region_melt_behavior_str(i) - write(iulog,*) 'Allowable values are: replaced_by_ice, remains_in_place' - call endrun(msg=' ERROR: Unknown glacier_region_melt_behavior'// & - errMsg(sourcefile, __LINE__)) - end select - - end if - end do - end subroutine translate_glacier_region_melt_behavior - - subroutine translate_glacier_region_ice_runoff_behavior - integer :: i - - do i = min_glacier_region_id, max_glacier_region_id - glacier_region_ice_runoff_behavior(i) = BEHAVIOR_UNSET - - if (glacier_region_present(i)) then - SHR_ASSERT_ALL((ubound(glacier_region_ice_runoff_behavior_str) >= (/i/)), errMsg(sourcefile, __LINE__)) - - select case (glacier_region_ice_runoff_behavior_str(i)) - case ('remains_ice') - glacier_region_ice_runoff_behavior(i) = ICE_RUNOFF_BEHAVIOR_REMAINS_ICE - case('melted') - glacier_region_ice_runoff_behavior(i) = ICE_RUNOFF_BEHAVIOR_MELTED - case (behavior_str_unset) - write(iulog,*) ' ERROR: glacier_region_ice_runoff_behavior not specified for ID ', i - write(iulog,*) 'You probably need to extend the glacier_region_ice_runoff_behavior namelist array' - call endrun(msg=' ERROR: glacier_region_ice_runoff_behavior not specified for ID '// & - errMsg(sourcefile, __LINE__)) - case default - write(iulog,*) ' ERROR: Unknown glacier_region_ice_runoff_behavior for ID ', i - write(iulog,*) glacier_region_ice_runoff_behavior_str(i) - write(iulog,*) 'Allowable values are: remains_ice, melted' - call endrun(msg=' ERROR: Unknown glacier_region_ice_runoff_behavior'// & - errMsg(sourcefile, __LINE__)) - end select - end if - end do - end subroutine translate_glacier_region_ice_runoff_behavior - end subroutine InitFromInputs - !----------------------------------------------------------------------- - subroutine InitSetDirectly(this, begg, endg, & - has_virtual_columns, collapse_to_atm_topo) + subroutine InitSetDirectly(this, begg, endg, collapse_to_atm_topo) ! ! !DESCRIPTION: - ! Initialize a glc_behavior_type object by directly setting has_virtual_columns and + ! Initialize a glc_behavior_type object by directly setting ! collapse_to_atm_topo ! ! This version is meant for testing @@ -491,19 +304,16 @@ subroutine InitSetDirectly(this, begg, endg, & class(glc_behavior_type), intent(inout) :: this integer, intent(in) :: begg ! beginning gridcell index integer, intent(in) :: endg ! ending gridcell index - logical, intent(in) :: has_virtual_columns(begg:) logical, intent(in) :: collapse_to_atm_topo(begg:) ! ! !LOCAL VARIABLES: - character(len=*), parameter :: subname = 'InitForTesting' + character(len=*), parameter :: subname = 'InitSetDirectly' !----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(has_virtual_columns) == (/endg/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(collapse_to_atm_topo) == (/endg/)), errMsg(sourcefile, __LINE__)) call this%InitAllocate(begg, endg) - this%has_virtual_columns_grc(:) = has_virtual_columns(:) this%collapse_to_atm_topo_grc(:) = collapse_to_atm_topo(:) end subroutine InitSetDirectly @@ -525,11 +335,8 @@ subroutine InitAllocate(this, begg, endg) character(len=*), parameter :: subname = 'InitAllocate' !----------------------------------------------------------------------- - allocate(this%has_virtual_columns_grc (begg:endg)); this%has_virtual_columns_grc (:) = .false. allocate(this%allow_multiple_columns_grc(begg:endg)); this%allow_multiple_columns_grc(:) = .false. - allocate(this%melt_replaced_by_ice_grc(begg:endg)); this%melt_replaced_by_ice_grc(:) = .false. allocate(this%collapse_to_atm_topo_grc(begg:endg)); this%collapse_to_atm_topo_grc(:) = .false. - allocate(this%ice_runoff_melted_grc(begg:endg)); this%ice_runoff_melted_grc(:) = .false. end subroutine InitAllocate @@ -580,8 +387,7 @@ subroutine read_surface_dataset(begg, endg, glacier_region_map) end subroutine read_surface_dataset !----------------------------------------------------------------------- - subroutine read_namelist(NLFilename, glacier_region_behavior, & - glacier_region_melt_behavior, glacier_region_ice_runoff_behavior) + subroutine read_namelist(NLFilename, glacier_region_behavior) ! ! !DESCRIPTION: ! Read local namelist items @@ -597,10 +403,6 @@ subroutine read_namelist(NLFilename, glacier_region_behavior, & character(len=*), intent(in) :: NLFilename ! Namelist filename character(len=max_behavior_name_len), intent(out) :: & glacier_region_behavior(min_glacier_region_id:max_glacier_region_id) - character(len=max_behavior_name_len), intent(out) :: & - glacier_region_melt_behavior(min_glacier_region_id:max_glacier_region_id) - character(len=max_behavior_name_len), intent(out) :: & - glacier_region_ice_runoff_behavior(min_glacier_region_id:max_glacier_region_id) ! ! !LOCAL VARIABLES: integer :: unitn ! unit for namelist file @@ -609,14 +411,10 @@ subroutine read_namelist(NLFilename, glacier_region_behavior, & character(len=*), parameter :: subname = 'read_namelist' !----------------------------------------------------------------------- - namelist /clm_glacier_behavior/ & - glacier_region_behavior, glacier_region_melt_behavior, & - glacier_region_ice_runoff_behavior + namelist /clm_glacier_behavior/ glacier_region_behavior ! Initialize options to default values glacier_region_behavior(:) = behavior_str_unset - glacier_region_melt_behavior(:) = behavior_str_unset - glacier_region_ice_runoff_behavior(:) = behavior_str_unset if (masterproc) then unitn = getavu() @@ -636,8 +434,6 @@ subroutine read_namelist(NLFilename, glacier_region_behavior, & endif call shr_mpi_bcast(glacier_region_behavior, mpicom) - call shr_mpi_bcast(glacier_region_melt_behavior, mpicom) - call shr_mpi_bcast(glacier_region_ice_runoff_behavior, mpicom) if (masterproc) then write(iulog,*) ' ' @@ -656,7 +452,6 @@ subroutine get_num_glc_mec_subgrid(this, gi, atm_topo, npatches, ncols, nlunits) ! Get number of subgrid units in glc_mec landunit on one grid cell ! ! !USES: - use clm_varpar , only : maxpatch_glcmec ! ! !ARGUMENTS: class(glc_behavior_type), intent(in) :: this @@ -676,7 +471,7 @@ subroutine get_num_glc_mec_subgrid(this, gi, atm_topo, npatches, ncols, nlunits) ncols = 0 - do m = 1, maxpatch_glcmec + do m = 1, 10 call this%glc_mec_col_exists(gi = gi, elev_class = m, atm_topo = atm_topo, & exists = col_exists, col_wt_lunit = col_wt_lunit) if (col_exists) then @@ -762,9 +557,7 @@ subroutine glc_mec_col_exists(this, gi, elev_class, atm_topo, exists, col_wt_lun end if else ! collapse_to_atm_topo_grc .false. - if (this%has_virtual_columns_grc(gi)) then - exists = .true. - else if (wt_lunit(gi, istice_mec) > 0.0_r8 .and. & + if (wt_lunit(gi, istice_mec) > 0.0_r8 .and. & wt_glc_mec(gi, elev_class) > 0.0_r8) then ! If the landunit has non-zero weight on the grid cell, and this column has ! non-zero weight on the landunit... diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 918b025940..0cfc010c96 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -12,9 +12,9 @@ module histFileMod use shr_sys_mod , only : shr_sys_flush use spmdMod , only : masterproc use abortutils , only : endrun - use clm_varctl , only : iulog, use_vertsoilc - use clm_varcon , only : spval, ispval, dzsoi_decomp - use clm_varcon , only : grlnd, nameg, namel, namec, namep, nameCohort + use clm_varctl , only : iulog + use clm_varcon , only : spval, ispval + use clm_varcon , only : grlnd, nameg, namel, namec, namep use decompMod , only : get_proc_bounds, get_proc_global, bounds_type use GridcellType , only : grc use LandunitType , only : lun @@ -107,7 +107,6 @@ module histFileMod ! !PUBLIC MEMBER FUNCTIONS: public :: hist_addfld1d ! Add a 1d single-level field to the master field list public :: hist_addfld2d ! Add a 2d multi-level field to the master field list - public :: hist_addfld_decomp ! Add a 2d multi-level field to the master field list public :: hist_add_subscript ! Add a 2d subscript dimension public :: hist_printflds ! Print summary of master field list public :: hist_htapes_build ! Initialize history file handler for initial or continue run @@ -125,8 +124,6 @@ module histFileMod private :: htape_create ! Define contents of history file t private :: htape_add_ltype_metadata ! Add global metadata defining landunit types private :: htape_add_ctype_metadata ! Add global metadata defining column types - private :: htape_add_natpft_metadata ! Add global metadata defining natpft types - private :: htape_add_cft_metadata ! Add global metadata defining cft types private :: htape_timeconst ! Write time constant values to history tape private :: htape_timeconst3D ! Write time constant 3D values to primary history tape private :: hfields_normalize ! Normalize history file fields by number of accumulations @@ -162,7 +159,7 @@ module histFileMod character(len=max_chars) :: units ! units character(len=hist_dim_name_length) :: type1d ! pointer to first dimension type from data type (nameg, etc) character(len=hist_dim_name_length) :: type1d_out ! hbuf first dimension type from data type (nameg, etc) - character(len=hist_dim_name_length) :: type2d ! hbuf second dimension type ["levgrnd","levlak","numrad","ltype","natpft","cft","glc_nec","elevclas","subname(n)"] + character(len=hist_dim_name_length) :: type2d ! hbuf second dimension type ["levgrnd","levlak","numrad","ltype","natpft","cft","elevclas","subname(n)"] integer :: beg1d ! on-node 1d clm pointer start index integer :: end1d ! on-node 1d clm pointer end index integer :: num1d ! size of clm pointer first dimension (all nodes) @@ -1025,7 +1022,7 @@ subroutine hist_update_hbuf(bounds) integer :: f ! field index integer :: num2d ! size of second dimension (e.g. number of vertical levels) character(len=*),parameter :: subname = 'hist_update_hbuf' - character(len=hist_dim_name_length) :: type2d ! hbuf second dimension type ["levgrnd","levlak","numrad","ltype","natpft","cft","glc_nec","elevclas","subname(n)"] + character(len=hist_dim_name_length) :: type2d ! hbuf second dimension type ["levgrnd","levlak","numrad","ltype","natpft","cft","elevclas","subname(n)"] !----------------------------------------------------------------------- do t = 1,ntapes @@ -1852,10 +1849,10 @@ subroutine htape_create (t, histrest) ! wrapper calls to define the history file contents. ! ! !USES: - use clm_varpar , only : nlevgrnd, nlevsno, nlevlak, nlevurb, numrad, nlevcan, nvegwcs,nlevsoi - use clm_varpar , only : natpft_size, cft_size, maxpatch_glcmec, nlevdecomp_full + use clm_varpar , only : nlevgrnd, nlevsno, nlevlak, nlevurb, numrad, nlevsoi + use clm_varpar , only : natpft_size use landunit_varcon , only : max_lunit - use clm_varctl , only : caseid, ctitle, fsurdat, finidat, paramfile + use clm_varctl , only : caseid, ctitle, fsurdat, finidat use clm_varctl , only : version, hostname, username, conventions, source use domainMod , only : ldomain use fileutils , only : get_filename @@ -1973,8 +1970,6 @@ subroutine htape_create (t, histrest) str = get_filename(finidat) endif call ncd_putatt(lnfid, ncd_global, 'Initial_conditions_dataset', trim(str)) - str = get_filename(paramfile) - call ncd_putatt(lnfid, ncd_global, 'PFT_physiological_constants_dataset', trim(str)) ! Define dimensions. ! Time is an unlimited dimension. Character string is treated as an array of characters. @@ -2003,26 +1998,18 @@ subroutine htape_create (t, histrest) call ncd_defdim(lnfid, 'numrad' , numrad , dimid) call ncd_defdim(lnfid, 'levsno' , nlevsno , dimid) call ncd_defdim(lnfid, 'ltype', max_lunit, dimid) - call ncd_defdim(lnfid, 'nlevcan',nlevcan, dimid) - call ncd_defdim(lnfid, 'nvegwcs',nvegwcs, dimid) call htape_add_ltype_metadata(lnfid) call htape_add_ctype_metadata(lnfid) call ncd_defdim(lnfid, 'natpft', natpft_size, dimid) - if (cft_size > 0) then - call ncd_defdim(lnfid, 'cft', cft_size, dimid) - call htape_add_cft_metadata(lnfid) - end if - call ncd_defdim(lnfid, 'glc_nec' , maxpatch_glcmec , dimid) - ! elevclas (in contrast to glc_nec) includes elevation class 0 (bare land) + ! elevclas includes elevation class 0 (bare land) ! (although on the history file it will go 1:(nec+1) rather than 0:nec) - call ncd_defdim(lnfid, 'elevclas' , maxpatch_glcmec + 1, dimid) + call ncd_defdim(lnfid, 'elevclas' , 11, dimid) do n = 1,num_subs call ncd_defdim(lnfid, subs_name(n), subs_dim(n), dimid) end do call ncd_defdim(lnfid, 'string_length', hist_dim_name_length, strlen_dimid) call ncd_defdim(lnfid, 'scale_type_string_length', scale_type_strlen, dimid) - call ncd_defdim( lnfid, 'levdcmp', nlevdecomp_full, dimid) ! MML: adding a mml soiz dimension: call ncd_defdim(lnfid, 'mml_lev', 10, dimid); ! hard-coded for 10 soil layers; make more clever. call ncd_defdim(lnfid, 'mml_dust', 4, dimid); ! hard-coded for 4 dust bins @@ -2096,68 +2083,7 @@ subroutine htape_add_ctype_metadata(lnfid) end subroutine htape_add_ctype_metadata !----------------------------------------------------------------------- - subroutine htape_add_natpft_metadata(lnfid) - ! - ! !DESCRIPTION: - ! Add global metadata defining natpft types - ! - ! !USES: - use clm_varpar, only : natpft_lb, natpft_ub - use pftconMod , only : pftname_len, pftname - ! - ! !ARGUMENTS: - type(file_desc_t), intent(inout) :: lnfid ! local file id - ! - ! !LOCAL VARIABLES: - integer :: ptype ! patch type - integer :: ptype_1_indexing ! patch type, translated to 1 indexing - character(len=*), parameter :: att_prefix = 'natpft_' ! prefix for attributes - character(len=len(att_prefix)+pftname_len) :: attname ! attribute name - - character(len=*), parameter :: subname = 'htape_add_natpft_metadata' - !----------------------------------------------------------------------- - - do ptype = natpft_lb, natpft_ub - ptype_1_indexing = ptype + (1 - natpft_lb) - attname = att_prefix // pftname(ptype) - call ncd_putatt(lnfid, ncd_global, attname, ptype_1_indexing) - end do - - end subroutine htape_add_natpft_metadata - - !----------------------------------------------------------------------- - subroutine htape_add_cft_metadata(lnfid) - ! - ! !DESCRIPTION: - ! Add global metadata defining natpft types - ! - ! !USES: - use clm_varpar, only : cft_lb, cft_ub - use pftconMod , only : pftname_len, pftname - ! - ! !ARGUMENTS: - type(file_desc_t), intent(inout) :: lnfid ! local file id - ! - ! !LOCAL VARIABLES: - integer :: ptype ! patch type - integer :: ptype_1_indexing ! patch type, translated to 1 indexing - character(len=*), parameter :: att_prefix = 'cft_' ! prefix for attributes - character(len=len(att_prefix)+pftname_len) :: attname ! attribute name - - character(len=*), parameter :: subname = 'htape_add_cft_metadata' - !----------------------------------------------------------------------- - - do ptype = cft_lb, cft_ub - ptype_1_indexing = ptype + (1 - cft_lb) - attname = att_prefix // pftname(ptype) - call ncd_putatt(lnfid, ncd_global, attname, ptype_1_indexing) - end do - - end subroutine htape_add_cft_metadata - - !----------------------------------------------------------------------- - subroutine htape_timeconst3D(t, & - bounds, watsat_col, sucsat_col, bsw_col, hksat_col, mode) + subroutine htape_timeconst3D(t, bounds, mode) ! ! !DESCRIPTION: ! Write time constant 3D variables to history tapes. @@ -2175,10 +2101,7 @@ subroutine htape_timeconst3D(t, & ! !ARGUMENTS: integer , intent(in) :: t ! tape index type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) - real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) +! real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) character(len=*) , intent(in) :: mode ! 'define' or 'write' ! ! !LOCAL VARIABLES: @@ -2191,15 +2114,11 @@ subroutine htape_timeconst3D(t, & ! real(r8), pointer :: histi(:,:) ! temporary real(r8), pointer :: histo(:,:) ! temporary - integer, parameter :: nflds = 6 ! Number of 3D time-constant fields + integer, parameter :: nflds = 2 ! Number of 3D time-constant fields character(len=*),parameter :: subname = 'htape_timeconst3D' character(len=*),parameter :: varnames(nflds) = (/ & 'ZSOI ', & - 'DZSOI ', & - 'WATSAT', & - 'SUCSAT', & - 'BSW ', & - 'HKSAT ' & + 'DZSOI ' & /) real(r8), pointer :: histil(:,:) ! temporary real(r8), pointer :: histol(:,:) @@ -2210,10 +2129,7 @@ subroutine htape_timeconst3D(t, & /) !----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sucsat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bsw_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hksat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) +! SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) !------------------------------------------------------------------------------- !*** Non-time varying 3D fields *** @@ -2229,14 +2145,6 @@ subroutine htape_timeconst3D(t, & long_name='soil depth'; units = 'm' else if (ifld == 2) then long_name='soil thickness'; units = 'm' - else if (ifld == 3) then - long_name='saturated soil water content (porosity)'; units = 'mm3/mm3' - else if (ifld == 4) then - long_name='saturated soil matric potential'; units = 'mm' - else if (ifld == 5) then - long_name='slope of soil water retention curve'; units = 'unitless' - else if (ifld == 6) then - long_name='saturated hydraulic conductivity'; units = 'mm s-1' else call endrun(msg=' ERROR: bad 3D time-constant field index'//errMsg(sourcefile, __LINE__)) end if @@ -2292,14 +2200,6 @@ subroutine htape_timeconst3D(t, & l2g_scale_type = 'nonurb' else if (ifld == 2) then ! DZSOI l2g_scale_type = 'nonurb' - else if (ifld == 3) then ! WATSAT - l2g_scale_type = 'veg' - else if (ifld == 4) then ! SUCSAT - l2g_scale_type = 'veg' - else if (ifld == 5) then ! BSW - l2g_scale_type = 'veg' - else if (ifld == 6) then ! HKSAT - l2g_scale_type = 'veg' end if histi(:,:) = spval @@ -2309,10 +2209,6 @@ subroutine htape_timeconst3D(t, & ! Field indices MUST match varnames array order above! if (ifld ==1) histi(c,lev) = col%z(c,lev) if (ifld ==2) histi(c,lev) = col%dz(c,lev) - if (ifld ==3) histi(c,lev) = watsat_col(c,lev) - if (ifld ==4) histi(c,lev) = sucsat_col(c,lev) - if (ifld ==5) histi(c,lev) = bsw_col(c,lev) - if (ifld ==6) histi(c,lev) = hksat_col(c,lev) end do end do if (tape(t)%dov2xy) then @@ -2517,8 +2413,6 @@ subroutine htape_timeconst(t, mode) call ncd_defvar(varname='levlak', xtype=tape(t)%ncprec, & dim1name='levlak', & long_name='coordinate lake levels', units='m', ncid=nfid(t)) - call ncd_defvar(varname='levdcmp', xtype=tape(t)%ncprec, dim1name='levdcmp', & - long_name='coordinate soil levels', units='m', ncid=nfid(t)) ! Add MML soil layers call ncd_defvar(varname='mml_lev', xtype=tape(t)%ncprec, dim1name='mml_lev', & @@ -2531,12 +2425,7 @@ subroutine htape_timeconst(t, mode) if ( masterproc ) write(iulog, *) ' zsoi:',zsoi call ncd_io(varname='levgrnd', data=zsoi, ncid=nfid(t), flag='write') call ncd_io(varname='levlak' , data=zlak, ncid=nfid(t), flag='write') - if (use_vertsoilc) then - call ncd_io(varname='levdcmp', data=zsoi, ncid=nfid(t), flag='write') - else - zsoi_1d(1) = 1._r8 - call ncd_io(varname='levdcmp', data=zsoi_1d, ncid=nfid(t), flag='write') - end if + zsoi_1d(1) = 1._r8 ! Add MML soil layers call ncd_io(varname='mml_lev', data=mml_zsoi, ncid=nfid(t), flag='write') @@ -2713,28 +2602,6 @@ subroutine htape_timeconst(t, mode) long_name='land/ocean mask (0.=ocean and 1.=land)', ncid=nfid(t), & imissing_value=ispval, ifill_value=ispval) end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='pftmask' , xtype=ncd_int, & - dim1name='lon', dim2name='lat', & - long_name='pft real/fake mask (0.=fake and 1.=real)', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - else - call ncd_defvar(varname='pftmask' , xtype=ncd_int, & - dim1name=grlnd, & - long_name='pft real/fake mask (0.=fake and 1.=real)', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='nbedrock' , xtype=ncd_int, & - dim1name='lon', dim2name='lat', & - long_name='index of shallowest bedrock layer', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - else - call ncd_defvar(varname='nbedrock' , xtype=ncd_int, & - dim1name=grlnd, & - long_name='index of shallowest bedrock layer', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - end if else if (mode == 'write') then @@ -2751,8 +2618,6 @@ subroutine htape_timeconst(t, mode) call ncd_io(varname='area' , data=ldomain%area, dim1name=grlnd, ncid=nfid(t), flag='write') call ncd_io(varname='landfrac', data=ldomain%frac, dim1name=grlnd, ncid=nfid(t), flag='write') call ncd_io(varname='landmask', data=ldomain%mask, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='pftmask' , data=ldomain%pftm, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='nbedrock' , data=grc%nbedrock, dim1name=grlnd, ncid=nfid(t), flag='write') end if ! (define/write mode @@ -3233,8 +3098,7 @@ subroutine hfields_1dinfo(t, mode) end subroutine hfields_1dinfo !----------------------------------------------------------------------- - subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & - watsat_col, sucsat_col, bsw_col, hksat_col) + subroutine hist_htapes_wrapup( rstwr, nlend, bounds) ! ! !DESCRIPTION: ! Write history tape(s) @@ -3266,10 +3130,7 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & logical, intent(in) :: rstwr ! true => write restart file this step logical, intent(in) :: nlend ! true => end of run on this step type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) - real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) +! real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) ! ! !LOCAL VARIABLES: integer :: t ! tape index @@ -3293,10 +3154,7 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & character(len=*),parameter :: subname = 'hist_htapes_wrapup' !----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sucsat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bsw_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hksat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) +! SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) ! get current step @@ -3366,36 +3224,29 @@ subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & ! Define time-constant field variables call htape_timeconst(t, mode='define') - !write(iulog,*)'MML define 3D' - ! Define 3D time-constant field variables only to first primary tape - if ( do_3Dtconst .and. t == 1 ) then - call htape_timeconst3D(t, & - bounds, watsat_col, sucsat_col, bsw_col, hksat_col, mode='define') - TimeConst3DVars_Filename = trim(locfnh(t)) - end if +! ! Define 3D time-constant field variables only to first primary tape +! if ( do_3Dtconst .and. t == 1 ) then +! call htape_timeconst3D(t, bounds, watsat_col, mode='define') +! TimeConst3DVars_Filename = trim(locfnh(t)) +! end if - !write(iulog,*)'MML define model field vars' ! Define model field variables call hfields_write(t, mode='define') - !write(iulog,*)'MML run away' ! Exit define model call ncd_enddef(nfid(t)) call t_stopf('hist_htapes_wrapup_define') endif - !write(iulog,*)'MML before htape_teimconst' call t_startf('hist_htapes_wrapup_tconst') ! Write time constant history variables call htape_timeconst(t, mode='write') - !write(iulog,*)'MML write 3D time const' - ! Write 3D time constant history variables only to first primary tape - if ( do_3Dtconst .and. t == 1 .and. tape(t)%ntimes == 1 )then - call htape_timeconst3D(t, & - bounds, watsat_col, sucsat_col, bsw_col, hksat_col, mode='write') - do_3Dtconst = .false. - end if +! ! Write 3D time constant history variables only to first primary tape +! if ( do_3Dtconst .and. t == 1 .and. tape(t)%ntimes == 1 )then +! call htape_timeconst3D(t, bounds, watsat_col, mode='write') +! do_3Dtconst = .false. +! end if if (masterproc) then write(iulog,*) @@ -3486,7 +3337,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) use clm_varctl , only : nsrest, caseid, inst_suffix, nsrStartup, nsrBranch use fileutils , only : getfil use domainMod , only : ldomain - use clm_varpar , only : nlevgrnd, nlevlak, numrad, nlevdecomp_full + use clm_varpar , only : nlevgrnd, nlevlak, numrad use clm_time_manager, only : is_restart use restUtilMod , only : iflag_skip use pio @@ -4612,8 +4463,8 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, ! initial or branch run to initialize the actual history tapes. ! ! !USES: - use clm_varpar , only : nlevgrnd, nlevsno, nlevlak, numrad, nlevdecomp_full, nlevcan, nvegwcs,nlevsoi - use clm_varpar , only : natpft_size, cft_size, maxpatch_glcmec + use clm_varpar , only : nlevgrnd, nlevsno, nlevlak, numrad, nlevsoi + use clm_varpar , only : natpft_size, cft_size use landunit_varcon , only : max_lunit ! ! !ARGUMENTS: @@ -4692,8 +4543,6 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, num2d = nlevlak case ('numrad') num2d = numrad - case ('levdcmp') - num2d = nlevdecomp_full case ('ltype') num2d = max_lunit case ('natpft') @@ -4706,27 +4555,21 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, ' only valid for cft_size > 0' call endrun() end if - case ('glc_nec') - num2d = maxpatch_glcmec case ('elevclas') - ! add one because indexing starts at 0 (elevclas, unlike glc_nec, includes the + ! add one because indexing starts at 0 (elevclas includes the ! bare ground "elevation class") - num2d = maxpatch_glcmec + 1 + num2d = 11 case ('levsno') num2d = nlevsno - case ('nlevcan') - num2d = nlevcan ! MML: adding my own case ('mml_lev') num2d = 10 !mml_nsoi ! mml_dim ! mml_nsoi not defined in this subroutine, so hard coding until I get more clever... case ('mml_dust') num2d = 4 - case ('nvegwcs') - num2d = nvegwcs case default write(iulog,*) trim(subname),' ERROR: unsupported 2d type ',type2d, & ' currently supported types for multi level fields are: ', & - '[levgrnd,levsoi,levlak,numrad,levdcmp,levtrc,ltype,natpft,cft,glc_nec,elevclas,levsno,nvegwcs]' + '[levgrnd,levsoi,levlak,numrad,levtrc,ltype,natpft,cft,elevclas,levsno]' call endrun(msg=errMsg(sourcefile, __LINE__)) end select @@ -4882,94 +4725,6 @@ subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, end subroutine hist_addfld2d - !----------------------------------------------------------------------- - subroutine hist_addfld_decomp (fname, type2d, units, avgflag, long_name, ptr_col, & - ptr_patch, l2g_scale_type, default) - - ! - ! !USES: - use clm_varpar , only : nlevdecomp_full - use clm_varctl , only : iulog - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: fname ! field name - character(len=*), intent(in) :: type2d ! 2d output type - character(len=*), intent(in) :: units ! units of field - character(len=*), intent(in) :: avgflag ! time averaging flag - character(len=*), intent(in) :: long_name ! long name of field - real(r8) , optional, pointer :: ptr_col(:,:) ! pointer to column array - real(r8) , optional, pointer :: ptr_patch(:,:) ! pointer to patch array - character(len=*), optional, intent(in) :: l2g_scale_type ! scale type for subgrid averaging of landunits to gridcells - character(len=*), optional, intent(in) :: default ! if set to 'inactive, field will not appear on primary tape - ! - ! !LOCAL VARIABLES: - real(r8), pointer :: ptr_1d(:) - !----------------------------------------------------------------------- - - if (present(ptr_col)) then - - ! column-level data - if (present(default)) then - if ( nlevdecomp_full > 1 ) then - call hist_addfld2d (fname=trim(fname), units=units, type2d=type2d, & - avgflag=avgflag, long_name=long_name, & - ptr_col=ptr_col, l2g_scale_type=l2g_scale_type, default=default) - else - ptr_1d => ptr_col(:,1) - call hist_addfld1d (fname=trim(fname), units=units, & - avgflag=avgflag, long_name=long_name, & - ptr_col=ptr_1d, l2g_scale_type=l2g_scale_type, default=default) - endif - else - if ( nlevdecomp_full > 1 ) then - call hist_addfld2d (fname=trim(fname), units=units, type2d=type2d, & - avgflag=avgflag, long_name=long_name, & - ptr_col=ptr_col, l2g_scale_type=l2g_scale_type) - else - ptr_1d => ptr_col(:,1) - call hist_addfld1d (fname=trim(fname), units=units, & - avgflag=avgflag, long_name=long_name, & - ptr_col=ptr_1d, l2g_scale_type=l2g_scale_type) - endif - endif - - else if (present(ptr_patch)) then - - ! patch-level data - if (present(default)) then - if ( nlevdecomp_full > 1 ) then - call hist_addfld2d (fname=trim(fname), units=units, type2d=type2d, & - avgflag=avgflag, long_name=long_name, & - ptr_patch=ptr_patch, l2g_scale_type=l2g_scale_type, default=default) - else - ptr_1d => ptr_patch(:,1) - call hist_addfld1d (fname=trim(fname), units=units, & - avgflag=avgflag, long_name=long_name, & - ptr_patch=ptr_1d, l2g_scale_type=l2g_scale_type, default=default) - endif - else - if ( nlevdecomp_full > 1 ) then - call hist_addfld2d (fname=trim(fname), units=units, type2d=type2d, & - avgflag=avgflag, long_name=long_name, & - ptr_patch=ptr_patch, l2g_scale_type=l2g_scale_type) - else - ptr_1d => ptr_patch(:,1) - call hist_addfld1d (fname=trim(fname), units=units, & - avgflag=avgflag, long_name=long_name, & - ptr_patch=ptr_1d, l2g_scale_type=l2g_scale_type) - endif - endif - - else - write(iulog, *) ' error: hist_addfld_decomp needs either patch or column level pointer' - write(iulog, *) fname - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - - end subroutine hist_addfld_decomp - !----------------------------------------------------------------------- integer function pointer_index () ! diff --git a/src/main/initGridCellsMod.F90 b/src/main/initGridCellsMod.F90 index def9631a8a..238762fdb9 100644 --- a/src/main/initGridCellsMod.F90 +++ b/src/main/initGridCellsMod.F90 @@ -62,7 +62,6 @@ subroutine initGridcells(glc_behavior) use subgridWeightsMod , only : compute_higher_order_weights use landunit_varcon , only : istsoil, istwet, istdlak, istice_mec use landunit_varcon , only : isturb_tbd, isturb_hd, isturb_md, istcrop - use clm_varctl , only : use_fates use shr_const_mod , only : SHR_CONST_PI ! ! !ARGUMENTS: @@ -223,7 +222,7 @@ subroutine set_landunit_veg_compete (ltype, gi, li, ci, pi) ! !USES use clm_instur, only : wt_lunit, wt_nat_patch use subgridMod, only : subgrid_get_info_natveg - use clm_varpar, only : numpft, maxpatch_pft, natpft_lb, natpft_ub + use clm_varpar, only : natpft_lb, natpft_ub ! ! !ARGUMENTS: integer , intent(in) :: ltype ! landunit type @@ -270,7 +269,6 @@ subroutine set_landunit_wet_lake (ltype, gi, li, ci, pi) use clm_instur , only : wt_lunit use landunit_varcon , only : istwet, istdlak use subgridMod , only : subgrid_get_info_wetland, subgrid_get_info_lake - use pftconMod , only : noveg ! ! !ARGUMENTS: @@ -317,7 +315,7 @@ subroutine set_landunit_wet_lake (ltype, gi, li, ci, pi) call add_landunit(li=li, gi=gi, ltype=ltype, wtgcell=wtlunit2gcell) call add_column(ci=ci, li=li, ctype=ltype, wtlunit=1.0_r8) - call add_patch(pi=pi, ci=ci, ptype=noveg, wtcol=1.0_r8) + call add_patch(pi=pi, ci=ci, ptype=0, wtcol=1.0_r8) endif ! npatches > 0 @@ -330,12 +328,10 @@ subroutine set_landunit_ice_mec(glc_behavior, ltype, gi, li, ci, pi) ! Initialize glacier_mec landunits ! ! !USES: - use clm_varpar , only : maxpatch_glcmec use clm_instur , only : wt_lunit, wt_glc_mec use landunit_varcon , only : istice_mec use column_varcon , only : icemec_class_to_col_itype use subgridMod , only : subgrid_get_info_glacier_mec - use pftconMod , only : noveg ! ! !ARGUMENTS: type(glc_behavior_type), intent(in) :: glc_behavior @@ -383,13 +379,13 @@ subroutine set_landunit_ice_mec(glc_behavior, ltype, gi, li, ci, pi) ! balance in each elevation class wherever the SMB is needed. type_is_dynamic = glc_behavior%cols_have_dynamic_type(gi) - do m = 1, maxpatch_glcmec + do m = 1, 10 call glc_behavior%glc_mec_col_exists(gi = gi, elev_class = m, atm_topo = atm_topo, & exists = col_exists, col_wt_lunit = wtcol2lunit) if (col_exists) then call add_column(ci=ci, li=li, ctype=icemec_class_to_col_itype(m), & wtlunit=wtcol2lunit, type_is_dynamic=type_is_dynamic) - call add_patch(pi=pi, ci=ci, ptype=noveg, wtcol=1.0_r8) + call add_patch(pi=pi, ci=ci, ptype=0, wtcol=1.0_r8) endif enddo @@ -415,8 +411,7 @@ subroutine set_landunit_crop_noncompete (ltype, gi, li, ci, pi) use clm_instur , only : wt_lunit, wt_cft use landunit_varcon , only : istcrop, istsoil use subgridMod , only : subgrid_get_info_crop, crop_patch_exists - use clm_varpar , only : maxpatch_pft, cft_lb, cft_ub - use clm_varctl , only : create_crop_landunit + use clm_varpar , only : cft_lb, cft_ub ! ! !ARGUMENTS: integer , intent(in) :: ltype ! landunit type @@ -444,16 +439,7 @@ subroutine set_landunit_crop_noncompete (ltype, gi, li, ci, pi) ! Note that we cannot simply use the 'ltype' argument to set itype here, ! because ltype will always indicate istcrop - if ( create_crop_landunit )then - my_ltype = ltype ! Will always be istcrop - if ( ltype /= istcrop )then - write(iulog,*)' create_crop_landunit on and ltype is not istcrop: ', ltype - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - else - my_ltype = istsoil - end if - + my_ltype = ltype ! Will always be istcrop call add_landunit(li=li, gi=gi, ltype=my_ltype, wtgcell=wtlunit2gcell) ! Set column and patch properties for this landunit @@ -487,7 +473,6 @@ subroutine set_landunit_urban (ltype, gi, li, ci, pi) use subgridMod , only : subgrid_get_info_urban_md use UrbanParamsType , only : urbinp use decompMod , only : ldecomp - use pftconMod , only : noveg ! ! !ARGUMENTS: integer , intent(in) :: ltype ! landunit type @@ -561,7 +546,7 @@ subroutine set_landunit_urban (ltype, gi, li, ci, pi) call add_column(ci=ci, li=li, ctype=ctype, wtlunit=wtcol2lunit) - call add_patch(pi=pi, ci=ci, ptype=noveg, wtcol=1.0_r8) + call add_patch(pi=pi, ci=ci, ptype=0, wtcol=1.0_r8) end do ! end of loop through urban columns-pfts end if diff --git a/src/main/initSubgridMod.F90 b/src/main/initSubgridMod.F90 index 57384dc461..187d164123 100644 --- a/src/main/initSubgridMod.F90 +++ b/src/main/initSubgridMod.F90 @@ -10,7 +10,7 @@ module initSubgridMod use shr_log_mod , only : errMsg => shr_log_errMsg use spmdMod , only : masterproc use abortutils , only : endrun - use clm_varctl , only : iulog, use_fates + use clm_varctl , only : iulog use clm_varcon , only : namep, namec, namel use decompMod , only : bounds_type use GridcellType , only : grc @@ -455,11 +455,9 @@ subroutine add_patch(pi, ci, ptype, wtcol) ! TODO (MV, 10-17-14): The following must be commented out because ! currently patch%itype is used in CanopyTemperatureMod to calculate - ! z0m(p) and displa(p) - and is still called even when fates is on + ! z0m(p) and displa(p) - !if (.not. use_fates) then patch%itype(pi) = ptype - !end if if (lun%itype(li) == istsoil .or. lun%itype(li) == istcrop) then lb_offset = 1 - natpft_lb diff --git a/src/main/initVerticalMod.F90 b/src/main/initVerticalMod.F90 index c4f3f9a8cb..d444e6cc37 100644 --- a/src/main/initVerticalMod.F90 +++ b/src/main/initVerticalMod.F90 @@ -13,18 +13,13 @@ module initVerticalMod use decompMod , only : bounds_type use spmdMod , only : masterproc use clm_varpar , only : nlevsno, nlevgrnd, nlevlak - use clm_varpar , only : toplev_equalspace, nlev_equalspace use clm_varpar , only : nlevsoi, nlevsoifl, nlevurb use clm_varctl , only : fsurdat, iulog - use clm_varctl , only : use_vancouver, use_mexicocity, use_vertsoilc, use_extralakelayers - use clm_varctl , only : use_bedrock, soil_layerstruct - use clm_varctl , only : use_fates - use clm_varcon , only : zlak, dzlak, zsoi, dzsoi, zisoi, dzsoi_decomp, spval, ispval, grlnd - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall, is_hydrologically_active - use landunit_varcon , only : istdlak, istice_mec + use clm_varcon , only : zlak, dzlak, zsoi, dzsoi, zisoi, spval, ispval, grlnd + use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall + use landunit_varcon , only : istdlak use fileutils , only : getfil use LandunitType , only : lun - use GridcellType , only : grc use ColumnType , only : col use glcBehaviorMod , only : glc_behavior_type use abortUtils , only : endrun @@ -38,9 +33,6 @@ module initVerticalMod ! !PUBLIC MEMBER FUNCTIONS: public :: initVertical ! !PRIVATE MEMBER FUNCTIONS: - private :: ReadNL - private :: hasBedrock ! true if the given column type includes bedrock layers - ! character(len=*), parameter, private :: sourcefile = & __FILE__ @@ -51,67 +43,11 @@ module initVerticalMod contains !------------------------------------------------------------------------ - subroutine ReadNL( ) - ! - ! !DESCRIPTION: - ! Read namelist for SoilStateType - ! - ! !USES: - use shr_mpi_mod , only : shr_mpi_bcast - use shr_log_mod , only : errMsg => shr_log_errMsg - use fileutils , only : getavu, relavu, opnfil - use clm_nlUtilsMod , only : find_nlgroup_name - use clm_varctl , only : iulog - use spmdMod , only : mpicom, masterproc - use controlMod , only : NLFilename - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - character(len=32) :: subname = 'InitVertical_readnl' ! subroutine name - !----------------------------------------------------------------------- - - character(len=*), parameter :: nl_name = 'clm_inparm' ! Namelist name - - ! MUST agree with name in namelist and read - namelist /clm_inparm/ use_bedrock - - ! preset values - - use_bedrock = .false. - - if ( masterproc )then - - unitn = getavu() - write(iulog,*) 'Read in '//nl_name//' namelist' - call opnfil (NLFilename, unitn, 'F') - call find_nlgroup_name(unitn, nl_name, status=ierr) - if (ierr == 0) then - read(unit=unitn, nml=clm_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading '//nl_name//' namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR finding '//nl_name//' namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - - end if - - call shr_mpi_bcast(use_bedrock, mpicom) - - end subroutine ReadNL - - !------------------------------------------------------------------------ - subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof) - use clm_varcon, only : zmin_bedrock, n_melt_glcmec + subroutine initVertical(bounds, glc_behavior, thick_wall, thick_roof) ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds type(glc_behavior_type), intent(in) :: glc_behavior - real(r8) , intent(in) :: snow_depth(bounds%begc:) real(r8) , intent(in) :: thick_wall(bounds%begl:) real(r8) , intent(in) :: thick_roof(bounds%begl:) ! @@ -121,15 +57,11 @@ subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof logical :: readvar integer :: dimid ! dimension id character(len=256) :: locfn ! local filename - real(r8) ,pointer :: std (:) ! read in - topo_std - real(r8) ,pointer :: tslope (:) ! read in - topo_slope real(r8) :: slope0 ! temporary real(r8) :: slopebeta ! temporary real(r8) :: slopemax ! temporary integer :: ier ! error status real(r8) :: scalez = 0.025_r8 ! Soil layer thickness discretization (m) - real(r8) :: thick_equal = 0.2 - real(r8) ,pointer :: zbedrock_in(:) ! read in - z_bedrock real(r8) ,pointer :: lakedepth_in(:) ! read in - lakedepth real(r8), allocatable :: zurb_wall(:,:) ! wall (layer node depth) real(r8), allocatable :: zurb_roof(:,:) ! roof (layer node depth) @@ -140,33 +72,12 @@ subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof real(r8) :: depthratio ! ratio of lake depth to standard deep lake depth integer :: begc, endc integer :: begl, endl - integer :: jmin_bedrock - ! Possible values for levgrnd_class. The important thing is that, for a given column, - ! layers that are fundamentally different (e.g., soil vs bedrock) have different - ! values. This information is used in the vertical interpolation in init_interp. - ! - ! IMPORTANT: These values should not be changed lightly. e.g., try to avoid changing - ! the values assigned to LEVGRND_CLASS_STANDARD, LEVGRND_CLASS_DEEP_BEDROCK, etc. The - ! problem with changing these is that init_interp expects that layers with a value of - ! (e.g.) 1 on the source file correspond to layers with a value of 1 on the - ! destination file. So if you change the values of these constants, you either need to - ! adequately inform users of this change, or build in some translation mechanism in - ! init_interp (such as via adding more metadata to the restart file on the meaning of - ! these different values). - ! - ! The distinction between "shallow" and "deep" bedrock is not made explicitly - ! elsewhere. But, since these classes have somewhat different behavior, they are - ! distinguished explicitly here. - integer, parameter :: LEVGRND_CLASS_STANDARD = 1 - integer, parameter :: LEVGRND_CLASS_DEEP_BEDROCK = 2 - integer, parameter :: LEVGRND_CLASS_SHALLOW_BEDROCK = 3 !------------------------------------------------------------------------ begc = bounds%begc; endc= bounds%endc begl = bounds%begl; endl= bounds%endl - SHR_ASSERT_ALL((ubound(snow_depth) == (/endc/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(thick_wall) == (/endl/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(thick_roof) == (/endl/)), errMsg(sourcefile, __LINE__)) @@ -183,7 +94,6 @@ subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof ! Soil layers and interfaces (assumed same for all non-lake patches) ! "0" refers to soil surface and "nlevsoi" refers to the bottom of model soil - if ( soil_layerstruct == '10SL_3.5m' ) then do j = 1, nlevgrnd zsoi(j) = scalez*(exp(0.5_r8*(j-0.5_r8))-1._r8) !node depths enddo @@ -200,98 +110,10 @@ subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof enddo zisoi(nlevgrnd) = zsoi(nlevgrnd) + 0.5_r8*dzsoi(nlevgrnd) - else if ( soil_layerstruct == '23SL_3.5m' )then - ! Soil layer structure that starts with standard exponential - ! and then has several evenly spaced layers, then finishes off exponential. - ! this allows the upper soil to behave as standard, but then continues - ! with higher resolution to a deeper depth, so that, for example, permafrost - ! dynamics are not lost due to an inability to resolve temperature, moisture, - ! and biogeochemical dynamics at the base of the active layer - do j = 1, toplev_equalspace - zsoi(j) = scalez*(exp(0.5_r8*(j-0.5_r8))-1._r8) !node depths - enddo - - do j = toplev_equalspace+1,toplev_equalspace + nlev_equalspace - zsoi(j) = zsoi(j-1) + thick_equal - enddo - - do j = toplev_equalspace + nlev_equalspace +1, nlevgrnd - zsoi(j) = scalez*(exp(0.5_r8*((j - nlev_equalspace)-0.5_r8))-1._r8) + nlev_equalspace * thick_equal - enddo - - dzsoi(1) = 0.5_r8*(zsoi(1)+zsoi(2)) !thickness b/n two interfaces - do j = 2,nlevgrnd-1 - dzsoi(j)= 0.5_r8*(zsoi(j+1)-zsoi(j-1)) - enddo - dzsoi(nlevgrnd) = zsoi(nlevgrnd)-zsoi(nlevgrnd-1) - - zisoi(0) = 0._r8 - do j = 1, nlevgrnd-1 - zisoi(j) = 0.5_r8*(zsoi(j)+zsoi(j+1)) !interface depths - enddo - zisoi(nlevgrnd) = zsoi(nlevgrnd) + 0.5_r8*dzsoi(nlevgrnd) - - else if ( soil_layerstruct == '49SL_10m' ) then - !scs: 10 meter soil column, nlevsoi set to 49 in clm_varpar - do j = 1,10 - dzsoi(j)= 1.e-2_r8 !10mm layers - enddo - do j = 11,19 - dzsoi(j)= 1.e-1_r8 !100 mm layers - enddo - do j = 20,nlevsoi+1 !300 mm layers - dzsoi(j)= 3.e-1_r8 - enddo - do j = nlevsoi+2,nlevgrnd !10 meter bedrock layers - dzsoi(j)= 10._r8 - enddo - - zisoi(0) = 0._r8 - do j = 1,nlevgrnd - zisoi(j)= sum(dzsoi(1:j)) - enddo - - do j = 1, nlevgrnd - zsoi(j) = 0.5*(zisoi(j-1) + zisoi(j)) - enddo - - else if ( soil_layerstruct == '20SL_8.5m' ) then - do j = 1,4 - dzsoi(j)= j*0.02_r8 ! linear increase in layer thickness of 2cm each layer - enddo - do j = 5,13 - dzsoi(j)= dzsoi(4)+(j-4)*0.04_r8 ! linear increase in layer thickness of 2cm each layer - enddo - do j = 14,nlevsoi - dzsoi(j)= dzsoi(13)+(j-13)*0.10_r8 ! linear increase in layer thickness of 2cm each layer - enddo - do j = nlevsoi+1,nlevgrnd !bedrock layers - dzsoi(j)= dzsoi(nlevsoi)+(((j-nlevsoi)*25._r8)**1.5_r8)/100._r8 ! bedrock layers - enddo - - zisoi(0) = 0._r8 - do j = 1,nlevgrnd - zisoi(j)= sum(dzsoi(1:j)) - enddo - - do j = 1, nlevgrnd - zsoi(j) = 0.5*(zisoi(j-1) + zisoi(j)) - enddo - end if - - ! define a vertical grid spacing such that it is the normal dzsoi if - ! nlevdecomp =nlevgrnd, or else 1 meter - if (use_vertsoilc) then - dzsoi_decomp = dzsoi !thickness b/n two interfaces - else - dzsoi_decomp(1) = 1. - end if - if (masterproc) then write(iulog, *) 'zsoi', zsoi(:) write(iulog, *) 'zisoi: ', zisoi(:) write(iulog, *) 'dzsoi: ', dzsoi(:) - write(iulog, *) 'dzsoi_decomp: ',dzsoi_decomp end if if (nlevurb > 0) then @@ -314,91 +136,6 @@ subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof ! "0" refers to urban wall/roof surface and "nlevsoi" refers to urban wall/roof bottom if (lun%urbpoi(l)) then - if (use_vancouver) then - zurb_wall(l,1) = 0.010_r8/2._r8 - zurb_wall(l,2) = zurb_wall(l,1) + 0.010_r8/2._r8 + 0.020_r8/2._r8 - zurb_wall(l,3) = zurb_wall(l,2) + 0.020_r8/2._r8 + 0.070_r8/2._r8 - zurb_wall(l,4) = zurb_wall(l,3) + 0.070_r8/2._r8 + 0.070_r8/2._r8 - zurb_wall(l,5) = zurb_wall(l,4) + 0.070_r8/2._r8 + 0.030_r8/2._r8 - - zurb_roof(l,1) = 0.010_r8/2._r8 - zurb_roof(l,2) = zurb_roof(l,1) + 0.010_r8/2._r8 + 0.010_r8/2._r8 - zurb_roof(l,3) = zurb_roof(l,2) + 0.010_r8/2._r8 + 0.010_r8/2._r8 - zurb_roof(l,4) = zurb_roof(l,3) + 0.010_r8/2._r8 + 0.010_r8/2._r8 - zurb_roof(l,5) = zurb_roof(l,4) + 0.010_r8/2._r8 + 0.030_r8/2._r8 - - dzurb_wall(l,1) = 0.010_r8 - dzurb_wall(l,2) = 0.020_r8 - dzurb_wall(l,3) = 0.070_r8 - dzurb_wall(l,4) = 0.070_r8 - dzurb_wall(l,5) = 0.030_r8 - write(iulog,*)'Total thickness of wall: ',sum(dzurb_wall(l,:)) - write(iulog,*)'Wall layer thicknesses: ',dzurb_wall(l,:) - - dzurb_roof(l,1) = 0.010_r8 - dzurb_roof(l,2) = 0.010_r8 - dzurb_roof(l,3) = 0.010_r8 - dzurb_roof(l,4) = 0.010_r8 - dzurb_roof(l,5) = 0.030_r8 - write(iulog,*)'Total thickness of roof: ',sum(dzurb_roof(l,:)) - write(iulog,*)'Roof layer thicknesses: ',dzurb_roof(l,:) - - ziurb_wall(l,0) = 0. - ziurb_wall(l,1) = dzurb_wall(l,1) - do j = 2,nlevurb - ziurb_wall(l,j) = sum(dzurb_wall(l,1:j)) - end do - write(iulog,*)'Wall layer interface depths: ',ziurb_wall(l,:) - - ziurb_roof(l,0) = 0. - ziurb_roof(l,1) = dzurb_roof(l,1) - do j = 2,nlevurb - ziurb_roof(l,j) = sum(dzurb_roof(l,1:j)) - end do - write(iulog,*)'Roof layer interface depths: ',ziurb_roof(l,:) - else if (use_mexicocity) then - zurb_wall(l,1) = 0.015_r8/2._r8 - zurb_wall(l,2) = zurb_wall(l,1) + 0.015_r8/2._r8 + 0.120_r8/2._r8 - zurb_wall(l,3) = zurb_wall(l,2) + 0.120_r8/2._r8 + 0.150_r8/2._r8 - zurb_wall(l,4) = zurb_wall(l,3) + 0.150_r8/2._r8 + 0.150_r8/2._r8 - zurb_wall(l,5) = zurb_wall(l,4) + 0.150_r8/2._r8 + 0.015_r8/2._r8 - - zurb_roof(l,1) = 0.010_r8/2._r8 - zurb_roof(l,2) = zurb_roof(l,1) + 0.010_r8/2._r8 + 0.050_r8/2._r8 - zurb_roof(l,3) = zurb_roof(l,2) + 0.050_r8/2._r8 + 0.050_r8/2._r8 - zurb_roof(l,4) = zurb_roof(l,3) + 0.050_r8/2._r8 + 0.050_r8/2._r8 - zurb_roof(l,5) = zurb_roof(l,4) + 0.050_r8/2._r8 + 0.025_r8/2._r8 - - dzurb_wall(l,1) = 0.015_r8 - dzurb_wall(l,2) = 0.120_r8 - dzurb_wall(l,3) = 0.150_r8 - dzurb_wall(l,4) = 0.150_r8 - dzurb_wall(l,5) = 0.015_r8 - write(iulog,*)'Total thickness of wall: ',sum(dzurb_wall(l,:)) - write(iulog,*)'Wall layer thicknesses: ',dzurb_wall(l,:) - - dzurb_roof(l,1) = 0.010_r8 - dzurb_roof(l,2) = 0.050_r8 - dzurb_roof(l,3) = 0.050_r8 - dzurb_roof(l,4) = 0.050_r8 - dzurb_roof(l,5) = 0.025_r8 - write(iulog,*)'Total thickness of roof: ',sum(dzurb_roof(l,:)) - write(iulog,*)'Roof layer thicknesses: ',dzurb_roof(l,:) - - ziurb_wall(l,0) = 0. - ziurb_wall(l,1) = dzurb_wall(l,1) - do j = 2,nlevurb - ziurb_wall(l,j) = sum(dzurb_wall(l,1:j)) - end do - write(iulog,*)'Wall layer interface depths: ',ziurb_wall(l,:) - - ziurb_roof(l,0) = 0. - ziurb_roof(l,1) = dzurb_roof(l,1) - do j = 2,nlevurb - ziurb_roof(l,j) = sum(dzurb_roof(l,1:j)) - end do - write(iulog,*)'Roof layer interface depths: ',ziurb_roof(l,:) - else do j = 1, nlevurb zurb_wall(l,j) = (j-0.5)*(thick_wall(l)/float(nlevurb)) !node depths end do @@ -429,7 +166,6 @@ subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof ziurb_roof(l,j) = 0.5*(zurb_roof(l,j)+zurb_roof(l,j+1)) !interface depths enddo ziurb_roof(l,nlevurb) = zurb_roof(l,nlevurb) + 0.5*dzurb_roof(l,nlevurb) - end if end if end do @@ -471,53 +207,6 @@ subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof deallocate(zurb_wall, zurb_roof, dzurb_wall, dzurb_roof, ziurb_wall, ziurb_roof) end if - !----------------------------------------------- - ! Set index defining depth to bedrock - !----------------------------------------------- - - allocate(zbedrock_in(bounds%begg:bounds%endg)) - if (use_bedrock) then - call ncd_io(ncid=ncid, varname='zbedrock', flag='read', data=zbedrock_in, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - if (masterproc) then - call endrun( 'ERROR:: zbedrock not found on surface data set, and use_bedrock is true.'//errmsg(sourcefile, __LINE__) ) - end if - end if - - ! if use_bedrock = false, set zbedrock to lowest layer bottom interface - else - if (masterproc) write(iulog,*) 'not using use_bedrock!!' - zbedrock_in(:) = zisoi(nlevsoi) - endif - - ! determine minimum index of minimum soil depth - jmin_bedrock = 3 - do j = 3,nlevsoi - if (zisoi(j-1) < zmin_bedrock .and. zisoi(j) >= zmin_bedrock) then - jmin_bedrock = j - endif - enddo - - if (masterproc) write(iulog,*) 'jmin_bedrock: ', jmin_bedrock - - ! Determine gridcell bedrock index - do g = bounds%begg,bounds%endg - grc%nbedrock(g) = nlevsoi - do j = jmin_bedrock,nlevsoi - if (zisoi(j-1) < zbedrock_in(g) .and. zisoi(j) >= zbedrock_in(g)) then - grc%nbedrock(g) = j - end if - end do - end do - - ! Set column bedrock index - do c = begc, endc - g = col%gridcell(c) - col%nbedrock(c) = grc%nbedrock(g) - end do - - deallocate(zbedrock_in) - !----------------------------------------------- ! Set lake levels and layers (no interfaces) !----------------------------------------------- @@ -538,60 +227,27 @@ subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof deallocate(lakedepth_in) ! Lake layers - if (.not. use_extralakelayers) then - dzlak(1) = 0.1_r8 - dzlak(2) = 1._r8 - dzlak(3) = 2._r8 - dzlak(4) = 3._r8 - dzlak(5) = 4._r8 - dzlak(6) = 5._r8 - dzlak(7) = 7._r8 - dzlak(8) = 7._r8 - dzlak(9) = 10.45_r8 - dzlak(10)= 10.45_r8 - - zlak(1) = 0.05_r8 - zlak(2) = 0.6_r8 - zlak(3) = 2.1_r8 - zlak(4) = 4.6_r8 - zlak(5) = 8.1_r8 - zlak(6) = 12.6_r8 - zlak(7) = 18.6_r8 - zlak(8) = 25.6_r8 - zlak(9) = 34.325_r8 - zlak(10)= 44.775_r8 - else - dzlak(1) =0.1_r8 - dzlak(2) =0.25_r8 - dzlak(3) =0.25_r8 - dzlak(4) =0.25_r8 - dzlak(5) =0.25_r8 - dzlak(6) =0.5_r8 - dzlak(7) =0.5_r8 - dzlak(8) =0.5_r8 - dzlak(9) =0.5_r8 - dzlak(10) =0.75_r8 - dzlak(11) =0.75_r8 - dzlak(12) =0.75_r8 - dzlak(13) =0.75_r8 - dzlak(14) =2_r8 - dzlak(15) =2_r8 - dzlak(16) =2.5_r8 - dzlak(17) =2.5_r8 - dzlak(18) =3.5_r8 - dzlak(19) =3.5_r8 - dzlak(20) =3.5_r8 - dzlak(21) =3.5_r8 - dzlak(22) =5.225_r8 - dzlak(23) =5.225_r8 - dzlak(24) =5.225_r8 - dzlak(25) =5.225_r8 - - zlak(1) = dzlak(1)/2._r8 - do i=2,nlevlak - zlak(i) = zlak(i-1) + (dzlak(i-1)+dzlak(i))/2._r8 - end do - end if + dzlak(1) = 0.1_r8 + dzlak(2) = 1._r8 + dzlak(3) = 2._r8 + dzlak(4) = 3._r8 + dzlak(5) = 4._r8 + dzlak(6) = 5._r8 + dzlak(7) = 7._r8 + dzlak(8) = 7._r8 + dzlak(9) = 10.45_r8 + dzlak(10)= 10.45_r8 + + zlak(1) = 0.05_r8 + zlak(2) = 0.6_r8 + zlak(3) = 2.1_r8 + zlak(4) = 4.6_r8 + zlak(5) = 8.1_r8 + zlak(6) = 12.6_r8 + zlak(7) = 18.6_r8 + zlak(8) = 25.6_r8 + zlak(9) = 34.325_r8 + zlak(10)= 44.775_r8 do c = bounds%begc,bounds%endc l = col%landunit(c) @@ -635,160 +291,8 @@ subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof end if end do - ! ------------------------------------------------------------------------ - ! Set classes of layers - ! ------------------------------------------------------------------------ - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (hasBedrock(col_itype=col%itype(c), lun_itype=lun%itype(l))) then - ! NOTE(wjs, 2015-10-17) We are assuming that points with bedrock have both - ! "shallow" and "deep" bedrock. Currently, this is not true for lake columns: - ! lakes do not distinguish between "shallow" bedrock and "normal" soil. - ! However, that was just due to an oversight that is supposed to be corrected - ! soon; so to keep things simple we assume that any point with bedrock - ! potentially has both shallow and deep bedrock. - col%levgrnd_class(c, 1:col%nbedrock(c)) = LEVGRND_CLASS_STANDARD - if (col%nbedrock(c) < nlevsoi) then - col%levgrnd_class(c, (col%nbedrock(c) + 1) : nlevsoi) = LEVGRND_CLASS_SHALLOW_BEDROCK - end if - col%levgrnd_class(c, (nlevsoi + 1) : nlevgrnd) = LEVGRND_CLASS_DEEP_BEDROCK - else - col%levgrnd_class(c, 1:nlevgrnd) = LEVGRND_CLASS_STANDARD - end if - end do - - do j = 1, nlevgrnd - do c = bounds%begc, bounds%endc - if (col%z(c,j) == spval) then - col%levgrnd_class(c,j) = ispval - end if - end do - end do - - !----------------------------------------------- - ! Set cold-start values for snow levels, snow layers and snow interfaces - !----------------------------------------------- - - !call InitSnowLayers(bounds, snow_depth(bounds%begc:bounds%endc)) - - !----------------------------------------------- - ! Read in topographic index and slope - !----------------------------------------------- - - allocate(tslope(bounds%begg:bounds%endg)) - call ncd_io(ncid=ncid, varname='SLOPE', flag='read', data=tslope, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call shr_sys_abort(' ERROR: TOPOGRAPHIC SLOPE NOT on surfdata file'//& - errMsg(sourcefile, __LINE__)) - end if - do c = begc,endc - g = col%gridcell(c) - ! check for near zero slopes, set minimum value - col%topo_slope(c) = max(tslope(g), 0.2_r8) - end do - deallocate(tslope) - - allocate(std(bounds%begg:bounds%endg)) - call ncd_io(ncid=ncid, varname='STD_ELEV', flag='read', data=std, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call shr_sys_abort(' ERROR: TOPOGRAPHIC STDdev (STD_ELEV) NOT on surfdata file'//& - errMsg(sourcefile, __LINE__)) - end if - do c = begc,endc - g = col%gridcell(c) - ! Topographic variables - col%topo_std(c) = std(g) - end do - deallocate(std) - - !----------------------------------------------- - ! SCA shape function defined - !----------------------------------------------- - - do c = begc,endc - l = col%landunit(c) - g = col%gridcell(c) - - if (lun%itype(l)==istice_mec .and. glc_behavior%allow_multiple_columns_grc(g)) then - ! ice_mec columns already account for subgrid topographic variability through - ! their use of multiple elevation classes; thus, to avoid double-accounting for - ! topographic variability in these columns, we ignore topo_std and use a fixed - ! value of n_melt. - col%n_melt(c) = n_melt_glcmec - else - col%n_melt(c) = 200.0/max(10.0_r8, col%topo_std(c)) - end if - - ! microtopographic parameter, units are meters (try smooth function of slope) - - slopebeta = 3._r8 - slopemax = 0.4_r8 - slope0 = slopemax**(-1._r8/slopebeta) - col%micro_sigma(c) = (col%topo_slope(c) + slope0)**(-slopebeta) - end do - call ncd_pio_closefile(ncid) end subroutine initVertical - !----------------------------------------------------------------------- - logical function hasBedrock(col_itype, lun_itype) - ! - ! !DESCRIPTION: - ! Returns true if the given column type has a representation of bedrock - i.e., a set - ! of layers at the bottom of the column that are treated fundamentally differently - ! from the upper layers. - ! - ! !USES: - use landunit_varcon, only : istice_mec, isturb_MIN, isturb_MAX - use column_varcon , only : icol_road_perv - ! - ! !ARGUMENTS: - integer, intent(in) :: col_itype ! col%itype value - integer, intent(in) :: lun_itype ! lun%itype value for the landunit on which this column sits - ! If we had an easy way to figure out which landunit a column was on based on - ! col_itype (which would be very helpful!), then we wouldn't need lun_itype. - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'hasBedrock' - !----------------------------------------------------------------------- - - ! TODO(wjs, 2015-10-17) I don't like that the logic here implicitly duplicates logic - ! elsewhere in the code. For example, if there were a change in the lake code so that - ! it no longer treated the bottom layers as bedrock, then that change would need to be - ! reflected here. One solution would be to set some has_bedrock flag in one central - ! place, and then have the science code use that. But that could get messy in the - ! science code. Another solution would be to decentralize the definition of - ! hasBedrock, so that (for example) the lake code itself sets the value for lun_itype - ! == istdlak - that way, hasBedrock(lake) would be more likely to get updated - ! correctly if the lake logic changes. - - if (lun_itype == istice_mec) then - hasBedrock = .false. - else if (lun_itype >= isturb_MIN .and. lun_itype <= isturb_MAX) then - if (col_itype == icol_road_perv) then - hasBedrock = .true. - else - hasBedrock = .false. - end if - else - hasBedrock = .true. - end if - - ! As an independent check of the above logic, assert that, at the very least, any - ! hydrologically-active column is given hasBedrock = .true. This is to try to catch - ! problems with new column types being added that aren't handled properly by the - ! above logic, since (as noted in the todo note above) there is some implicit - ! duplication of logic between this routine and other parts of the code, which is - ! dangerous. For example, if a new "urban lawn" type is added, then it should have - ! hasBedrock = .true. - and this omission will hopefully be caught by this assertion. - if (is_hydrologically_active(col_itype=col_itype, lun_itype=lun_itype)) then - SHR_ASSERT(hasBedrock, "hasBedrock should be true for all hydrologically-active columns") - end if - - end function hasBedrock - - end module initVerticalMod diff --git a/src/main/lnd2atmMod.F90 b/src/main/lnd2atmMod.F90 index ebe7eea1f1..b1c68d38d7 100644 --- a/src/main/lnd2atmMod.F90 +++ b/src/main/lnd2atmMod.F90 @@ -9,28 +9,18 @@ module lnd2atmMod use shr_kind_mod , only : r8 => shr_kind_r8 use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_megan_mod , only : shr_megan_mechcomps_n use clm_varpar , only : numrad, ndst, nlevgrnd !ndst = number of dust bins. use clm_varcon , only : rair, grav, cpair, hfus, tfrz, spval use clm_varctl , only : iulog - use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND use decompMod , only : bounds_type use subgridAveMod , only : p2g, c2g use lnd2atmType , only : lnd2atm_type use atm2lndType , only : atm2lnd_type - use ch4Mod , only : ch4_type - use DUSTMod , only : dust_type - use DryDepVelocity , only : drydepvel_type - use VocEmissionMod , only : vocemis_type use EnergyFluxType , only : energyflux_type - use FrictionVelocityMod , only : frictionvel_type - use SolarAbsorbedType , only : solarabs_type use SurfaceAlbedoType , only : surfalb_type use TemperatureType , only : temperature_type - use WaterFluxType , only : waterflux_type use WaterstateType , only : waterstate_type use glcBehaviorMod , only : glc_behavior_type - use glc2lndMod , only : glc2lnd_type use ColumnType , only : col use LandunitType , only : lun use GridcellType , only : grc @@ -41,12 +31,9 @@ module lnd2atmMod private ! ! !PUBLIC MEMBER FUNCTIONS: - public :: lnd2atm public :: lnd2atm_minimal - ! ! !PRIVATE MEMBER FUNCTIONS: - private :: handle_ice_runoff character(len=*), parameter, private :: sourcefile = & __FILE__ @@ -91,11 +78,6 @@ subroutine lnd2atm_minimal(bounds, & lnd2atm_inst%h2osno_grc(g) = lnd2atm_inst%h2osno_grc(g)/1000._r8 end do - call c2g(bounds, nlevgrnd, & - waterstate_inst%h2osoi_vol_col (bounds%begc:bounds%endc, :), & - lnd2atm_inst%h2osoi_vol_grc (bounds%begg:bounds%endg, :), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity') - call p2g(bounds, numrad, & surfalb_inst%albd_patch (bounds%begp:bounds%endp, :), & lnd2atm_inst%albd_grc (bounds%begg:bounds%endg, :), & @@ -111,340 +93,15 @@ subroutine lnd2atm_minimal(bounds, & lnd2atm_inst%eflx_lwrad_out_grc (bounds%begg:bounds%endg), & p2c_scale_type='unity', c2l_scale_type= 'urbanf', l2g_scale_type='unity') + ! TODO slevis SLIM: Eliminating next assignment returns error: + ! Longwave down is <= 0, while eliminating and then changing the + ! initialization of t_rad_grc to tfrz in lnd2atmType works but changes + ! answers throughout, including in MML variables. See + ! /glade/scratch/slevis/ERS_D_Ld60.f19_g16.H_MML_2000_CAM5.cheyenne_gnu.clm-global_uniform_g16_SOM.C.20221207_111523_9gqwvp/ERS_D_Ld60.f19_g16.H_MML_2000_CAM5.cheyenne_gnu.clm-global_uniform_g16_SOM.C.20221207_111523_9gqwvp.clm2.h0.0001-03-02-00000.nc.cprnc.out do g = bounds%begg,bounds%endg lnd2atm_inst%t_rad_grc(g) = sqrt(sqrt(lnd2atm_inst%eflx_lwrad_out_grc(g)/sb)) end do end subroutine lnd2atm_minimal - !------------------------------------------------------------------------ - subroutine lnd2atm(bounds, & - atm2lnd_inst, surfalb_inst, temperature_inst, frictionvel_inst, & - waterstate_inst, waterflux_inst, energyflux_inst, & - solarabs_inst, drydepvel_inst, & - vocemis_inst, dust_inst, ch4_inst, glc_behavior, & - lnd2atm_inst, & - net_carbon_exchange_grc) - ! - ! !DESCRIPTION: - ! Compute lnd2atm_inst component of gridcell derived type - ! - ! !USES: - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(surfalb_type) , intent(in) :: surfalb_inst - type(temperature_type) , intent(in) :: temperature_inst - type(frictionvel_type) , intent(in) :: frictionvel_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(energyflux_type) , intent(in) :: energyflux_inst - type(solarabs_type) , intent(in) :: solarabs_inst - type(drydepvel_type) , intent(in) :: drydepvel_inst - type(vocemis_type) , intent(in) :: vocemis_inst - type(dust_type) , intent(in) :: dust_inst - type(ch4_type) , intent(in) :: ch4_inst - type(glc_behavior_type) , intent(in) :: glc_behavior - type(lnd2atm_type) , intent(inout) :: lnd2atm_inst - real(r8) , intent(in) :: net_carbon_exchange_grc( bounds%begg: ) ! net carbon exchange between land and atmosphere, positive for source (gC/m2/s) - ! - ! !LOCAL VARIABLES: - integer :: c, g ! indices - real(r8) :: qflx_ice_runoff_col(bounds%begc:bounds%endc) ! total column-level ice runoff - real(r8) :: eflx_sh_ice_to_liq_grc(bounds%begg:bounds%endg) ! sensible heat flux generated from the ice to liquid conversion, averaged to gridcell - real(r8), parameter :: amC = 12.0_r8 ! Atomic mass number for Carbon - real(r8), parameter :: amO = 16.0_r8 ! Atomic mass number for Oxygen - real(r8), parameter :: amCO2 = amC + 2.0_r8*amO ! Atomic mass number for CO2 - ! The following converts g of C to kg of CO2 - real(r8), parameter :: convertgC2kgCO2 = 1.0e-3_r8 * (amCO2/amC) - !------------------------------------------------------------------------ - - SHR_ASSERT_ALL((ubound(net_carbon_exchange_grc) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - - call handle_ice_runoff(bounds, waterflux_inst, glc_behavior, & - melt_non_icesheet_ice_runoff = lnd2atm_inst%params%melt_non_icesheet_ice_runoff, & - qflx_ice_runoff_col = qflx_ice_runoff_col(bounds%begc:bounds%endc), & - qflx_liq_from_ice_col = lnd2atm_inst%qflx_liq_from_ice_col(bounds%begc:bounds%endc), & - eflx_sh_ice_to_liq_col = lnd2atm_inst%eflx_sh_ice_to_liq_col(bounds%begc:bounds%endc)) - - !---------------------------------------------------- - ! lnd -> atm - !---------------------------------------------------- - - ! First, compute the "minimal" set of fields. - call lnd2atm_minimal(bounds, & - waterstate_inst, surfalb_inst, energyflux_inst, lnd2atm_inst) - - call p2g(bounds, & - temperature_inst%t_ref2m_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%t_ref2m_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g(bounds, & - waterstate_inst%q_ref2m_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%q_ref2m_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g(bounds, & - frictionvel_inst%u10_clm_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%u_ref10m_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g(bounds, & - energyflux_inst%taux_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%taux_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g(bounds, & - energyflux_inst%tauy_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%tauy_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g(bounds, & - waterflux_inst%qflx_evap_tot_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%qflx_evap_tot_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'urbanf', l2g_scale_type='unity') - - call p2g(bounds, & - solarabs_inst%fsa_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%fsa_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'urbanf', l2g_scale_type='unity') - - call p2g(bounds, & - frictionvel_inst%fv_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%fv_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g(bounds, & - frictionvel_inst%ram1_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%ram1_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g( bounds, & - energyflux_inst%eflx_sh_tot_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%eflx_sh_tot_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity',c2l_scale_type='urbanf',l2g_scale_type='unity') - call c2g( bounds, & - energyflux_inst%eflx_sh_precip_conversion_col (bounds%begc:bounds%endc), & - lnd2atm_inst%eflx_sh_precip_conversion_grc (bounds%begg:bounds%endg), & - c2l_scale_type='urbanf', l2g_scale_type='unity') - call c2g( bounds, & - lnd2atm_inst%eflx_sh_ice_to_liq_col(bounds%begc:bounds%endc), & - eflx_sh_ice_to_liq_grc(bounds%begg:bounds%endg), & - c2l_scale_type='urbanf', l2g_scale_type='unity') - do g = bounds%begg, bounds%endg - lnd2atm_inst%eflx_sh_tot_grc(g) = lnd2atm_inst%eflx_sh_tot_grc(g) + & - lnd2atm_inst%eflx_sh_precip_conversion_grc(g) + & - eflx_sh_ice_to_liq_grc(g) - & - energyflux_inst%eflx_dynbal_grc(g) - enddo - - call p2g(bounds, & - energyflux_inst%eflx_lh_tot_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%eflx_lh_tot_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'urbanf', l2g_scale_type='unity') - - do g = bounds%begg, bounds%endg - lnd2atm_inst%net_carbon_exchange_grc(g) = & - net_carbon_exchange_grc(g) - end do - ! Convert from gC/m2/s to kgCO2/m2/s - do g = bounds%begg,bounds%endg - lnd2atm_inst%net_carbon_exchange_grc(g) = & - lnd2atm_inst%net_carbon_exchange_grc(g)*convertgC2kgCO2 - end do - - ! drydepvel - if ( n_drydep > 0 .and. drydep_method == DD_XLND ) then - call p2g(bounds, n_drydep, & - drydepvel_inst%velocity_patch (bounds%begp:bounds%endp, :), & - lnd2atm_inst%ddvel_grc (bounds%begg:bounds%endg, :), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - endif - - ! voc emission flux - if (shr_megan_mechcomps_n>0) then - !call p2g(bounds, shr_megan_mechcomps_n, & - !vocemis_inst%vocflx_patch(bounds%begp:bounds%endp,:), & - !lnd2atm_inst%flxvoc_grc (bounds%begg:bounds%endg,:), & - !p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - end if - - ! dust emission flux - call p2g(bounds, ndst, & - dust_inst%flx_mss_vrt_dst_patch(bounds%begp:bounds%endp, :), & - lnd2atm_inst%flxdst_grc (bounds%begg:bounds%endg, :), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - - !---------------------------------------------------- - ! lnd -> rof - !---------------------------------------------------- - - call c2g( bounds, & - waterflux_inst%qflx_surf_col (bounds%begc:bounds%endc), & - lnd2atm_inst%qflx_rofliq_qsur_grc (bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - - call c2g( bounds, & - waterflux_inst%qflx_drain_col (bounds%begc:bounds%endc), & - lnd2atm_inst%qflx_rofliq_qsub_grc (bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - - do c = bounds%begc, bounds%endc - if (col%active(c)) then - ! It's not entirely appropriate to put qflx_liq_from_ice_col into - ! qflx_qrgwl_col, since this isn't necessarily just glaciers, wetlands and - ! lakes. But since we put the liquid portion of snow capping into - ! qflx_qrgwl_col, it seems reasonable to put qflx_liq_from_ice_col there as - ! well. - waterflux_inst%qflx_qrgwl_col(c) = waterflux_inst%qflx_qrgwl_col(c) + & - lnd2atm_inst%qflx_liq_from_ice_col(c) - - ! qflx_runoff is the sum of a number of terms, including qflx_qrgwl. Since we - ! are adjusting qflx_qrgwl above, we need to adjust qflx_runoff analogously. - waterflux_inst%qflx_runoff_col(c) = waterflux_inst%qflx_runoff_col(c) + & - lnd2atm_inst%qflx_liq_from_ice_col(c) - end if - end do - - call c2g( bounds, & - waterflux_inst%qflx_qrgwl_col (bounds%begc:bounds%endc), & - lnd2atm_inst%qflx_rofliq_qgwl_grc (bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - - call c2g( bounds, & - waterflux_inst%qflx_runoff_col (bounds%begc:bounds%endc), & - lnd2atm_inst%qflx_rofliq_grc (bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - - do g = bounds%begg, bounds%endg - lnd2atm_inst%qflx_rofliq_qgwl_grc(g) = lnd2atm_inst%qflx_rofliq_qgwl_grc(g) - waterflux_inst%qflx_liq_dynbal_grc(g) - lnd2atm_inst%qflx_rofliq_grc(g) = lnd2atm_inst%qflx_rofliq_grc(g) - waterflux_inst%qflx_liq_dynbal_grc(g) - enddo - - call c2g( bounds, & - waterflux_inst%qflx_h2osfc_surf_col (bounds%begc:bounds%endc), & - lnd2atm_inst%qflx_rofliq_h2osfc_grc(bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - - call c2g( bounds, & - waterflux_inst%qflx_drain_perched_col (bounds%begc:bounds%endc), & - lnd2atm_inst%qflx_rofliq_drain_perched_grc(bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - - call c2g( bounds, & - qflx_ice_runoff_col(bounds%begc:bounds%endc), & - lnd2atm_inst%qflx_rofice_grc(bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - do g = bounds%begg, bounds%endg - lnd2atm_inst%qflx_rofice_grc(g) = lnd2atm_inst%qflx_rofice_grc(g) - waterflux_inst%qflx_ice_dynbal_grc(g) - enddo - - ! calculate total water storage for history files - ! first set tws to gridcell total endwb - ! second add river storage as gridcell average depth (1.e-3 converts [m3/km2] to [mm]) - ! TODO - this was in BalanceCheckMod - not sure where it belongs? - - call c2g( bounds, & - waterstate_inst%endwb_col(bounds%begc:bounds%endc), & - waterstate_inst%tws_grc (bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - do g = bounds%begg, bounds%endg - waterstate_inst%tws_grc(g) = waterstate_inst%tws_grc(g) + atm2lnd_inst%volr_grc(g) / grc%area(g) * 1.e-3_r8 - enddo - - end subroutine lnd2atm - - !----------------------------------------------------------------------- - subroutine handle_ice_runoff(bounds, waterflux_inst, glc_behavior, & - melt_non_icesheet_ice_runoff, & - qflx_ice_runoff_col, qflx_liq_from_ice_col, eflx_sh_ice_to_liq_col) - ! - ! !DESCRIPTION: - ! Take column-level ice runoff and divide it between (a) ice runoff, and (b) liquid - ! runoff with a compensating negative sensible heat flux. - ! - ! The rationale here is: Ice runoff is largely meant to represent a crude - ! parameterization of iceberg calving. Iceberg calving is mainly appropriate in - ! regions where an ice sheet terminates at the land-ocean boundary. Elsewhere, in - ! reality, we expect most ice runoff to flow downstream and melt before it reaches the - ! ocean. Furthermore, sending ice runoff directly to the ocean can lead to runaway sea - ! ice growth in some regions (around the Canadian archipelago, and possibly in more - ! wide-spread regions of the Arctic Ocean); melting this ice before it reaches the - ! ocean avoids this problem. - ! - ! If the river model were able to melt ice, then we might not need this routine. - ! - ! Note that this routine does NOT handle ice runoff generated via the dynamic - ! landunits adjustment fluxes (i.e., the fluxes that compensate for a difference in - ! ice content between the pre- and post-dynamic landunit areas). This is partly - ! because those gridcell-level dynamic landunits adjustment fluxes do not fit well - ! with this column-based infrastructure, and partly because either method of handling - ! these fluxes (i.e., sending an ice runoff or sending a liquid runoff with a - ! negative sensible heat flux) seems equally justifiable. - ! - ! !USES: - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - type(waterflux_type), intent(in) :: waterflux_inst - type(glc_behavior_type), intent(in) :: glc_behavior - logical, intent(in) :: melt_non_icesheet_ice_runoff - real(r8), intent(out) :: qflx_ice_runoff_col( bounds%begc: ) ! total column-level ice runoff (mm H2O /s) - real(r8), intent(out) :: qflx_liq_from_ice_col( bounds%begc: ) ! liquid runoff from converted ice runoff (mm H2O /s) - real(r8), intent(out) :: eflx_sh_ice_to_liq_col( bounds%begc: ) ! sensible heat flux generated from the ice to liquid conversion (W/m2) (+ to atm) - - ! - ! !LOCAL VARIABLES: - integer :: c, l, g - logical :: do_conversion - - character(len=*), parameter :: subname = 'handle_ice_runoff' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(qflx_ice_runoff_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(qflx_liq_from_ice_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(eflx_sh_ice_to_liq_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - do c = bounds%begc, bounds%endc - if (col%active(c)) then - qflx_ice_runoff_col(c) = waterflux_inst%qflx_ice_runoff_snwcp_col(c) + & - waterflux_inst%qflx_ice_runoff_xs_col(c) - qflx_liq_from_ice_col(c) = 0._r8 - eflx_sh_ice_to_liq_col(c) = 0._r8 - end if - end do - - if (melt_non_icesheet_ice_runoff) then - do c = bounds%begc, bounds%endc - if (col%active(c)) then - l = col%landunit(c) - g = col%gridcell(c) - do_conversion = .false. - if (lun%itype(l) /= istice_mec) then - do_conversion = .true. - else ! istice_mec - if (glc_behavior%ice_runoff_melted_grc(g)) then - do_conversion = .true. - else - do_conversion = .false. - end if - end if - if (do_conversion) then - ! ice to liquid absorbs energy, so results in a negative heat flux to atm - ! Note that qflx_ice_runoff_col is in mm H2O/s, which is the same as kg - ! m-2 s-1, so we can simply multiply by hfus. - eflx_sh_ice_to_liq_col(c) = -qflx_ice_runoff_col(c) * hfus - qflx_liq_from_ice_col(c) = qflx_ice_runoff_col(c) - qflx_ice_runoff_col(c) = 0._r8 - end if - end if - end do - end if - - end subroutine handle_ice_runoff - - end module lnd2atmMod diff --git a/src/main/lnd2atmType.F90 b/src/main/lnd2atmType.F90 index fbfab7b862..6cefaed1ee 100644 --- a/src/main/lnd2atmType.F90 +++ b/src/main/lnd2atmType.F90 @@ -13,26 +13,15 @@ module lnd2atmType use clm_varpar , only : numrad, ndst, nlevgrnd !ndst = number of dust bins. ! MML: ndst = 4 from clm varpar use clm_varcon , only : spval use clm_varctl , only : iulog - use shr_megan_mod , only : shr_megan_mechcomps_n - use shr_fire_emis_mod,only : shr_fire_emis_mechcomps_n - use seq_drydep_mod, only : n_drydep, drydep_method, DD_XLND ! ! !PUBLIC TYPES: implicit none private - type, public :: lnd2atm_params_type - ! true => ice runoff generated from non-glacier columns and glacier columns outside - ! icesheet regions is converted to liquid, with an appropriate sensible heat flux - logical, public :: melt_non_icesheet_ice_runoff - end type lnd2atm_params_type - ! ---------------------------------------------------- ! land -> atmosphere variables structure !---------------------------------------------------- type, public :: lnd2atm_type - type(lnd2atm_params_type) :: params - ! lnd->atm real(r8), pointer :: t_rad_grc (:) => null() ! radiative temperature (Kelvin) ! MML check tech note for examples on how to calculate this; use MO theory @@ -50,7 +39,6 @@ module lnd2atmType real(r8), pointer :: tauy_grc (:) => null() ! wind stress: n-s (kg/m/s**2) real(r8), pointer :: eflx_lh_tot_grc (:) => null() ! total latent HF (W/m**2) [+ to atm] real(r8), pointer :: eflx_sh_tot_grc (:) => null() ! total sensible HF (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_precip_conversion_grc(:) => null() ! sensible HF from precipitation conversion (W/m**2) [+ to atm] real(r8), pointer :: eflx_sh_ice_to_liq_col(:) => null() ! sensible HF generated from conversion of ice runoff to liquid (W/m**2) [+ to atm] real(r8), pointer :: eflx_lwrad_out_grc (:) => null() ! IR (longwave) radiation (W/m**2) real(r8), pointer :: qflx_evap_tot_grc (:) => null() ! qflx_evap_soi + qflx_evap_can + qflx_tran_veg @@ -61,10 +49,6 @@ module lnd2atmType real(r8), pointer :: fv_grc (:) => null() ! friction velocity (m/s) (for dust model) real(r8), pointer :: flxdst_grc (:,:) => null() ! dust flux (size bins) real(r8), pointer :: ddvel_grc (:,:) => null() ! dry deposition velocities - real(r8), pointer :: flxvoc_grc (:,:) => null() ! VOC flux (size bins) - real(r8), pointer :: fireflx_grc (:,:) => null() ! Wild Fire Emissions - real(r8), pointer :: fireztop_grc (:) => null() ! Wild Fire Emissions vertical distribution top - real(r8), pointer :: flux_ch4_grc (:) => null() ! net CH4 flux (kg C/m**2/s) [+ to atm] ! lnd->rof real(r8), pointer :: qflx_rofliq_grc (:) => null() ! rof liq forcing real(r8), pointer :: qflx_rofliq_qsur_grc (:) => null() ! rof liq -- surface runoff component @@ -74,58 +58,29 @@ module lnd2atmType real(r8), pointer :: qflx_rofliq_drain_perched_grc (:) => null() ! rof liq -- perched water table runoff component real(r8), pointer :: qflx_rofice_grc (:) => null() ! rof ice forcing real(r8), pointer :: qflx_liq_from_ice_col(:) => null() ! liquid runoff from converted ice runoff - real(r8), pointer :: qirrig_grc (:) => null() ! irrigation flux contains procedure, public :: Init - procedure, private :: ReadNamelist procedure, private :: InitAllocate procedure, private :: InitHistory end type lnd2atm_type !------------------------------------------------------------------------ - interface lnd2atm_params_type - module procedure lnd2atm_params_constructor - end interface lnd2atm_params_type - character(len=*), parameter, private :: sourcefile = & __FILE__ !------------------------------------------------------------------------ contains - !----------------------------------------------------------------------- - function lnd2atm_params_constructor(melt_non_icesheet_ice_runoff) & - result(params) - ! - ! !DESCRIPTION: - ! Creates a new instance of lnd2atm_params_type - ! - ! !ARGUMENTS: - type(lnd2atm_params_type) :: params ! function result - logical, intent(in) :: melt_non_icesheet_ice_runoff - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'lnd2atm_params_type' - !----------------------------------------------------------------------- - - params%melt_non_icesheet_ice_runoff = melt_non_icesheet_ice_runoff - - end function lnd2atm_params_constructor - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, NLFilename) + subroutine Init(this, bounds) class(lnd2atm_type) :: this type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename ! Namelist filename call this%InitAllocate(bounds) - call this%ReadNamelist(NLFilename) call this%InitHistory(bounds) end subroutine Init @@ -161,7 +116,6 @@ subroutine InitAllocate(this, bounds) allocate(this%tauy_grc (begg:endg)) ; this%tauy_grc (:) =ival allocate(this%eflx_lwrad_out_grc (begg:endg)) ; this%eflx_lwrad_out_grc (:) =ival allocate(this%eflx_sh_tot_grc (begg:endg)) ; this%eflx_sh_tot_grc (:) =ival - allocate(this%eflx_sh_precip_conversion_grc(begg:endg)) ; this%eflx_sh_precip_conversion_grc(:) = ival allocate(this%eflx_sh_ice_to_liq_col(begc:endc)) ; this%eflx_sh_ice_to_liq_col(:) = ival allocate(this%eflx_lh_tot_grc (begg:endg)) ; this%eflx_lh_tot_grc (:) =ival allocate(this%qflx_evap_tot_grc (begg:endg)) ; this%qflx_evap_tot_grc (:) =ival @@ -171,7 +125,6 @@ subroutine InitAllocate(this, bounds) allocate(this%ram1_grc (begg:endg)) ; this%ram1_grc (:) =ival allocate(this%fv_grc (begg:endg)) ; this%fv_grc (:) =ival allocate(this%flxdst_grc (begg:endg,1:ndst)) ; this%flxdst_grc (:,:) =ival - allocate(this%flux_ch4_grc (begg:endg)) ; this%flux_ch4_grc (:) =ival allocate(this%qflx_rofliq_grc (begg:endg)) ; this%qflx_rofliq_grc (:) =ival allocate(this%qflx_rofliq_qsur_grc (begg:endg)) ; this%qflx_rofliq_qsur_grc (:) =ival allocate(this%qflx_rofliq_qsub_grc (begg:endg)) ; this%qflx_rofliq_qsub_grc (:) =ival @@ -180,86 +133,9 @@ subroutine InitAllocate(this, bounds) allocate(this%qflx_rofliq_drain_perched_grc (begg:endg)) ; this%qflx_rofliq_drain_perched_grc (:) =ival allocate(this%qflx_rofice_grc (begg:endg)) ; this%qflx_rofice_grc (:) =ival allocate(this%qflx_liq_from_ice_col(begc:endc)) ; this%qflx_liq_from_ice_col(:) = ival - allocate(this%qirrig_grc (begg:endg)) ; this%qirrig_grc (:) =ival - - if (shr_megan_mechcomps_n>0) then - allocate(this%flxvoc_grc(begg:endg,1:shr_megan_mechcomps_n)); this%flxvoc_grc(:,:)=ival - endif - if (shr_fire_emis_mechcomps_n>0) then - allocate(this%fireflx_grc(begg:endg,1:shr_fire_emis_mechcomps_n)) - this%fireflx_grc = ival - allocate(this%fireztop_grc(begg:endg)) - this%fireztop_grc = ival - endif - if ( n_drydep > 0 .and. drydep_method == DD_XLND )then - allocate(this%ddvel_grc(begg:endg,1:n_drydep)); this%ddvel_grc(:,:)=ival - end if end subroutine InitAllocate - !----------------------------------------------------------------------- - subroutine ReadNamelist(this, NLFilename) - ! - ! !DESCRIPTION: - ! Read the lnd2atm namelist - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - class(lnd2atm_type), intent(inout) :: this - ! - ! !LOCAL VARIABLES: - - ! temporary variables corresponding to the components of lnd2atm_params_type - logical :: melt_non_icesheet_ice_runoff - - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - character(len=*), parameter :: nmlname = 'lnd2atm_inparm' - - character(len=*), parameter :: subname = 'ReadNamelist' - !----------------------------------------------------------------------- - - namelist /lnd2atm_inparm/ melt_non_icesheet_ice_runoff - - ! Initialize namelist variables to defaults - melt_non_icesheet_ice_runoff = .false. - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=lnd2atm_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast(melt_non_icesheet_ice_runoff, mpicom) - - if (masterproc) then - write(iulog,*) - write(iulog,*) nmlname, ' settings:' - write(iulog,nml=lnd2atm_inparm) - write(iulog,*) ' ' - end if - - this%params = lnd2atm_params_type( & - melt_non_icesheet_ice_runoff = melt_non_icesheet_ice_runoff) - - end subroutine ReadNamelist - !----------------------------------------------------------------------- subroutine InitHistory(this, bounds) ! @@ -271,11 +147,9 @@ subroutine InitHistory(this, bounds) type(bounds_type), intent(in) :: bounds ! ! !LOCAL VARIABLES: - integer :: begc, endc integer :: begg, endg !--------------------------------------------------------------------- - begc = bounds%begc; endc = bounds%endc begg = bounds%begg; endg = bounds%endg this%eflx_sh_tot_grc(begg:endg) = 0._r8 @@ -285,37 +159,6 @@ subroutine InitHistory(this, bounds) &(includes corrections for land use change, rain/snow conversion and conversion of ice runoff to liquid)', & ptr_lnd=this%eflx_sh_tot_grc) - this%eflx_sh_ice_to_liq_col(begc:endc) = 0._r8 - call hist_addfld1d (fname='FSH_RUNOFF_ICE_TO_LIQ', units='W/m^2', & - avgflag='A', & - long_name='sensible heat flux generated from conversion of ice runoff to liquid', & - ptr_col=this%eflx_sh_ice_to_liq_col) - - this%qflx_rofliq_grc(begg:endg) = 0._r8 - call hist_addfld1d (fname='QRUNOFF_TO_COUPLER', units='mm/s', & - avgflag='A', & - long_name='total liquid runoff sent to coupler (includes corrections for land use change)', & - ptr_lnd=this%qflx_rofliq_grc) - - this%qflx_rofice_grc(begg:endg) = 0._r8 - call hist_addfld1d (fname='QRUNOFF_ICE_TO_COUPLER', units='mm/s', & - avgflag='A', & - long_name='total ice runoff sent to coupler (includes corrections for land use change)', & - ptr_lnd=this%qflx_rofice_grc) - - this%qflx_liq_from_ice_col(begc:endc) = 0._r8 - call hist_addfld1d (fname='QRUNOFF_ICE_TO_LIQ', units='mm/s', & - avgflag='A', & - long_name='liquid runoff from converted ice runoff', & - ptr_col=this%qflx_liq_from_ice_col, default='inactive') - - this%net_carbon_exchange_grc(begg:endg) = spval - call hist_addfld1d(fname='FCO2', units='kgCO2/m2/s', & - avgflag='A', & - long_name='CO2 flux to atmosphere (+ to atm)', & - ptr_lnd=this%net_carbon_exchange_grc, & - default='inactive') - end subroutine InitHistory end module lnd2atmType diff --git a/src/main/lnd2glcMod.F90 b/src/main/lnd2glcMod.F90 deleted file mode 100644 index 9de7eba3f3..0000000000 --- a/src/main/lnd2glcMod.F90 +++ /dev/null @@ -1,304 +0,0 @@ -module lnd2glcMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Handle arrays used for exchanging data from land model to glc - ! For now glc datais send and received on the lnd grid and decomposition. - ! - ! The fields sent from the lnd component to the glc component via - ! the coupler are labeled 's2x', or sno to coupler. - ! The fields received by the lnd component from the glc component - ! via the coupler are labeled 'x2s', or coupler to sno. - ! 'Sno' is a misnomer in that the exchanged data are related to - ! the ice beneath the snow, not the snow itself. But by CESM convention, - ! 'ice' refers to sea ice, not land ice. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : get_proc_bounds, bounds_type - use domainMod , only : ldomain - use clm_varpar , only : maxpatch_glcmec - use clm_varctl , only : iulog - use clm_varcon , only : spval, tfrz, namec - use column_varcon , only : col_itype_to_icemec_class - use landunit_varcon , only : istice_mec, istsoil - use abortutils , only : endrun - use GlacierSurfaceMassBalanceMod, only : glacier_smb_type - use TemperatureType , only : temperature_type - use LandunitType , only : lun - use ColumnType , only : col - use TopoMod , only : topo_type - ! - ! !PUBLIC TYPES: - implicit none - private - save - - ! land -> glc variables structure - type, public :: lnd2glc_type - real(r8), pointer :: tsrf_grc(:,:) => null() - real(r8), pointer :: topo_grc(:,:) => null() - real(r8), pointer :: qice_grc(:,:) => null() - - contains - - procedure, public :: Init - procedure, public :: update_lnd2glc - procedure, private :: InitAllocate - procedure, private :: InitHistory - - end type lnd2glc_type - - ! !PUBLIC MEMBER FUNCTIONS: - - ! The following is public simply to support unit testing, and should not generally be - ! called from outside this module. - ! - ! Note that it is not a type-bound procedure, because it doesn't actually involve the - ! lnd2glc_type. This suggests that perhaps it belongs in some other module. - public :: bareland_normalization ! compute normalization factor for fluxes from the bare land portion of the grid cell - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(lnd2glc_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize land variables required by glc - ! - ! !USES: - use clm_varcon , only : spval - use histFileMod, only : hist_addfld1d - ! - ! !ARGUMENTS: - class(lnd2glc_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begg,endg - !------------------------------------------------------------------------ - - begg = bounds%begg; endg = bounds%endg - - allocate(this%tsrf_grc(begg:endg,0:maxpatch_glcmec)) ; this%tsrf_grc(:,:)=0.0_r8 - allocate(this%topo_grc(begg:endg,0:maxpatch_glcmec)) ; this%topo_grc(:,:)=0.0_r8 - allocate(this%qice_grc(begg:endg,0:maxpatch_glcmec)) ; this%qice_grc(:,:)=0.0_r8 - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !USES: - use histFileMod, only : hist_addfld1d,hist_addfld2d - ! - ! !ARGUMENTS: - class(lnd2glc_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - real(r8), pointer :: data2dptr(:,:) - integer :: begg, endg - !--------------------------------------------------------------------- - - begg = bounds%begg; endg = bounds%endg - - this%qice_grc(begg:endg,0:maxpatch_glcmec) = spval - ! For this and the following fields, set up a pointer to the field simply for the - ! sake of changing the indexing, so that levels start with an index of 1, as is - ! assumed by histFileMod - so levels go 1:(nec+1) rather than 0:nec - data2dptr => this%qice_grc(:,0:maxpatch_glcmec) - call hist_addfld2d (fname='QICE_FORC', units='mm/s', type2d='elevclas', & - avgflag='A', long_name='qice forcing sent to GLC', & - ptr_lnd=data2dptr, default='inactive') - - this%tsrf_grc(begg:endg,0:maxpatch_glcmec) = spval - data2dptr => this%tsrf_grc(:,0:maxpatch_glcmec) - call hist_addfld2d (fname='TSRF_FORC', units='K', type2d='elevclas', & - avgflag='A', long_name='surface temperature sent to GLC', & - ptr_lnd=data2dptr, default='inactive') - - this%topo_grc(begg:endg,0:maxpatch_glcmec) = spval - data2dptr => this%topo_grc(:,0:maxpatch_glcmec) - call hist_addfld2d (fname='TOPO_FORC', units='m', type2d='elevclas', & - avgflag='A', long_name='topograephic height sent to GLC', & - ptr_lnd=data2dptr, default='inactive') - - end subroutine InitHistory - - - !------------------------------------------------------------------------------ - subroutine update_lnd2glc(this, bounds, num_do_smb_c, filter_do_smb_c, & - temperature_inst, glacier_smb_inst, topo_inst, init) - ! - ! !DESCRIPTION: - ! Assign values to lnd2glc+ - ! - ! !ARGUMENTS: - class(lnd2glc_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_do_smb_c ! number of columns in filter_do_smb_c - integer , intent(in) :: filter_do_smb_c(:) ! column filter: columns where smb calculations are performed - type(temperature_type) , intent(in) :: temperature_inst - type(glacier_smb_type) , intent(in) :: glacier_smb_inst - type(topo_type) , intent(in) :: topo_inst - logical , intent(in) :: init ! if true=>only set a subset of fields - ! - ! !LOCAL VARIABLES: - integer :: c, l, g, n, fc ! indices - logical, allocatable :: fields_assigned(:,:) ! tracks whether fields have already been assigned for each index [begg:endg, 0:maxpatch_glcmec] - real(r8) :: flux_normalization ! factor by which fluxes should be normalized - - character(len=*), parameter :: subname = 'update_lnd2glc' - !------------------------------------------------------------------------------ - - ! Initialize to reasonable defaults - - this%qice_grc(bounds%begg : bounds%endg, :) = 0._r8 - this%tsrf_grc(bounds%begg : bounds%endg, :) = tfrz - this%topo_grc(bounds%begg : bounds%endg, :) = 0._r8 - - ! Fill the lnd->glc data on the clm grid - - allocate(fields_assigned(bounds%begg:bounds%endg, 0:maxpatch_glcmec)) - fields_assigned(:,:) = .false. - - do fc = 1, num_do_smb_c - c = filter_do_smb_c(fc) - l = col%landunit(c) - g = col%gridcell(c) - - ! Set vertical index and a flux normalization, based on whether the column in question is glacier or vegetated. - if (lun%itype(l) == istice_mec) then - n = col_itype_to_icemec_class(col%itype(c)) - flux_normalization = 1.0_r8 - else if (lun%itype(l) == istsoil) then - n = 0 !0-level index (bareland information) - flux_normalization = bareland_normalization(c) - else - ! Other landunit types do not pass information in the lnd2glc fields. - ! Note: for this to be acceptable, we need virtual vegetated columns in any grid - ! cell that is made up solely of glacier plus some other special landunit (e.g., - ! glacier + lake) -- otherwise CISM wouldn't have any information for the non- - ! glaciated portion of the grid cell. - cycle - end if - - ! Make sure we haven't already assigned the coupling fields for this point - ! (this could happen, for example, if there were multiple columns in the - ! istsoil landunit, which we aren't prepared to handle) - if (fields_assigned(g,n)) then - write(iulog,*) subname//' ERROR: attempt to assign coupling fields twice for the same index.' - write(iulog,*) 'One possible cause is having multiple columns in the istsoil landunit,' - write(iulog,*) 'which this routine cannot handle.' - write(iulog,*) 'g, n = ', g, n - call endrun(decomp_index=c, clmlevel=namec, msg=errMsg(sourcefile, __LINE__)) - end if - - ! Send surface temperature, topography, and SMB flux (qice) to coupler. - ! t_soisno and topo_col are valid even in initialization, so tsrf and topo - ! are set here regardless of the value of init. But qflx_glcice is not valid - ! until the run loop; thus, in initialization, we will use the default value - ! for qice, as set above. - fields_assigned(g,n) = .true. - this%tsrf_grc(g,n) = temperature_inst%t_soisno_col(c,1) - this%topo_grc(g,n) = topo_inst%topo_col(c) - if (.not. init) then - this%qice_grc(g,n) = glacier_smb_inst%qflx_glcice_col(c) * flux_normalization - - ! Check for bad values of qice - if ( abs(this%qice_grc(g,n)) > 1.0_r8) then - write(iulog,*) 'WARNING: qice out of bounds: g, n, qice =', g, n, this%qice_grc(g,n) - end if - end if - - end do - - deallocate(fields_assigned) - - end subroutine update_lnd2glc - - !----------------------------------------------------------------------- - real(r8) function bareland_normalization(c) - ! - ! !DESCRIPTION: - ! Compute normalization factor for fluxes from the bare land portion of the grid - ! cell. Fluxes should be multiplied by this factor before being sent to CISM. - ! - ! The point of this is: CISM effectively has two land cover types: glaciated and - ! bare. CLM, on the other hand, subdivides the bare land portion of the grid cell into - ! multiple landunits. However, we currently don't do any sort of averaging of - ! quantities computed in the different "bare land" landunits - instead, we simply send - ! the values computed in the natural vegetated landunit - these fluxes (like SMB) are - ! 0 in the other landunits. To achieve conservation, we need to normalize these - ! natural veg. fluxes by the fraction of the "bare land" area accounted for by the - ! natural veg. landunit. - ! - ! For example, consider a grid cell that is: - ! 60% glacier_mec - ! 30% natural veg - ! 10% lake - ! - ! According to CISM, this grid cell is 60% icesheet, 40% "bare land". Now suppose CLM - ! has an SMB flux of 1m in the natural veg landunit. If we simply sent 1m of ice to - ! CISM, conservation would be broken, since it would also apply 1m of ice to the 10% - ! of the grid cell that CLM says is lake. So, instead, we must multiply the 1m of ice - ! by (0.3/0.4), thus "spreading out" the SMB from the natural veg. landunit, so that - ! 0.75m of ice is grown throughout the bare land portion of CISM. - ! - ! Note: If the non-glaciated area of the grid cell is 0, then we arbitrarily return a - ! normalization factor of 1.0, in order to avoid divide-by-zero errors. - ! - ! Note: We currently aren't careful about how we would handle things if there are - ! multiple columns within the vegetated landunit. If that possibility were introduced, - ! this code - as well as the code in update_clm_s2x - may need to be reworked somewhat. - ! - ! !USES: - use subgridWeightsMod , only : get_landunit_weight - ! - ! !ARGUMENTS: - integer, intent(in) :: c ! column index - ! - ! !LOCAL VARIABLES: - integer :: g ! grid cell index - real(r8) :: area_glacier ! fractional area of the glacier_mec landunit in this grid cell - real(r8) :: area_this_col ! fractional area of column c in the grid cell - - real(r8), parameter :: tol = 1.e-13_r8 ! tolerance for checking subgrid weight equality - character(len=*), parameter :: subname = 'bareland_normalization' - !----------------------------------------------------------------------- - - g = col%gridcell(c) - - area_glacier = get_landunit_weight(g, istice_mec) - - if (abs(area_glacier - 1.0_r8) < tol) then - ! If the whole grid cell is glacier, then the normalization factor is arbitrary; - ! set it to 1 so we don't do any normalization in this case - bareland_normalization = 1.0_r8 - else - area_this_col = col%wtgcell(c) - bareland_normalization = area_this_col / (1.0_r8 - area_glacier) - end if - - end function bareland_normalization - -end module lnd2glcMod - diff --git a/src/main/ndepStreamMod.F90 b/src/main/ndepStreamMod.F90 deleted file mode 100644 index c6147255eb..0000000000 --- a/src/main/ndepStreamMod.F90 +++ /dev/null @@ -1,126 +0,0 @@ -module ndepStreamMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Contains methods for reading in nitrogen deposition data file - ! Also includes functions for dynamic ndep file handling and - ! interpolation. - ! - ! !USES - use shr_kind_mod, only: r8 => shr_kind_r8, CL => shr_kind_cl - use mct_mod , only: mct_ggrid - use spmdMod , only: mpicom, iam - use clm_varctl , only: iulog - use abortutils , only: endrun - use decompMod , only: bounds_type, gsmap_lnd_gdc2glo - use domainMod , only: ldomain - - ! !PUBLIC TYPES: - implicit none - private - save - - public :: clm_domain_mct ! Sets up MCT domain for this resolution - - ! ! PRIVATE TYPES - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !============================================================================== - -contains - - !============================================================================== - subroutine clm_domain_mct(bounds, dom_clm) - - !------------------------------------------------------------------- - ! Set domain data type for internal clm grid - use clm_varcon , only : re - use domainMod , only : ldomain - use seq_flds_mod - use mct_mod , only : mct_ggrid, mct_gsMap_lsize, mct_gGrid_init - use mct_mod , only : mct_gsMap_orderedPoints, mct_gGrid_importIAttr - use mct_mod , only : mct_gGrid_importRAttr - implicit none - ! - ! arguments - type(bounds_type), intent(in) :: bounds - type(mct_ggrid), intent(out) :: dom_clm ! Output domain information for land model - ! - ! local variables - integer :: g,i,j ! index - integer :: lsize ! land model domain data size - real(r8), pointer :: data(:) ! temporary - integer , pointer :: idata(:) ! temporary - !------------------------------------------------------------------- - ! - ! Initialize mct domain type - ! lat/lon in degrees, area in radians^2, mask is 1 (land), 0 (non-land) - ! Note that in addition land carries around landfrac for the purposes of domain checking - ! - lsize = mct_gsMap_lsize(gsmap_lnd_gdc2glo, mpicom) - call mct_gGrid_init( GGrid=dom_clm, CoordChars=trim(seq_flds_dom_coord), & - OtherChars=trim(seq_flds_dom_other), lsize=lsize ) - ! - ! Allocate memory - ! - allocate(data(lsize)) - ! - ! Determine global gridpoint number attribute, GlobGridNum, which is set automatically by MCT - ! - call mct_gsMap_orderedPoints(gsmap_lnd_gdc2glo, iam, idata) - call mct_gGrid_importIAttr(dom_clm,'GlobGridNum',idata,lsize) - ! - ! Determine domain (numbering scheme is: West to East and South to North to South pole) - ! Initialize attribute vector with special value - ! - data(:) = -9999.0_R8 - call mct_gGrid_importRAttr(dom_clm,"lat" ,data,lsize) - call mct_gGrid_importRAttr(dom_clm,"lon" ,data,lsize) - call mct_gGrid_importRAttr(dom_clm,"area" ,data,lsize) - call mct_gGrid_importRAttr(dom_clm,"aream",data,lsize) - data(:) = 0.0_R8 - call mct_gGrid_importRAttr(dom_clm,"mask" ,data,lsize) - ! - ! Determine bounds - ! - ! Fill in correct values for domain components - ! Note aream will be filled in in the atm-lnd mapper - ! - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = ldomain%lonc(g) - end do - call mct_gGrid_importRattr(dom_clm,"lon",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = ldomain%latc(g) - end do - call mct_gGrid_importRattr(dom_clm,"lat",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = ldomain%area(g)/(re*re) - end do - call mct_gGrid_importRattr(dom_clm,"area",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = real(ldomain%mask(g), r8) - end do - call mct_gGrid_importRattr(dom_clm,"mask",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = real(ldomain%frac(g), r8) - end do - call mct_gGrid_importRattr(dom_clm,"frac",data,lsize) - - deallocate(data) - deallocate(idata) - - end subroutine clm_domain_mct - -end module ndepStreamMod - diff --git a/src/main/organicFileMod.F90 b/src/main/organicFileMod.F90 deleted file mode 100644 index 3adbd5b6f1..0000000000 --- a/src/main/organicFileMod.F90 +++ /dev/null @@ -1,113 +0,0 @@ -module organicFileMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: organicFileMod -! -! !DESCRIPTION: -! Contains methods for reading in organic matter data file which has -! organic matter density for each grid point and soil level -! -! !USES - use abortutils , only : endrun - use clm_varctl , only : iulog - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varcon , only : grlnd -! -! !PUBLIC TYPES: - implicit none - private - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: organicrd ! Read organic matter dataset -! -! !REVISION HISTORY: -! Created by David Lawrence, 4 May 2006 -! Revised by David Lawrence, 21 September 2007 -! Revised by David Lawrence, 14 October 2008 -! -!EOP -! -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: organicrd -! -! !INTERFACE: - subroutine organicrd(organic) -! -! !DESCRIPTION: -! Read the organic matter dataset. -! -! !USES: - use clm_varctl , only : fsurdat, single_column - use fileutils , only : getfil - use spmdMod , only : masterproc - use domainMod , only : ldomain - use ncdio_pio -! -! !ARGUMENTS: - implicit none - real(r8), pointer :: organic(:,:) ! organic matter density (kg/m3) -! -! !CALLED FROM: -! subroutine initialize in module initializeMod -! -! !REVISION HISTORY: -! Created by David Lawrence, 4 May 2006 -! Revised by David Lawrence, 21 September 2007 -! -! -! !LOCAL VARIABLES: -!EOP - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! netcdf id - integer :: ni,nj,ns ! dimension sizes - logical :: isgrid2d ! true => file is 2d - logical :: readvar ! true => variable is on dataset - character(len=32) :: subname = 'organicrd' ! subroutine name -!----------------------------------------------------------------------- - - ! Initialize data to zero - no organic matter dataset - - organic(:,:) = 0._r8 - - ! Read data if file was specified in namelist - - if (fsurdat /= ' ') then - if (masterproc) then - write(iulog,*) 'Attempting to read organic matter data .....' - write(iulog,*) subname,trim(fsurdat) - end if - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - - call ncd_inqfdims (ncid, isgrid2d, ni, nj, ns) - if (ldomain%ns /= ns .or. ldomain%ni /= ni .or. ldomain%nj /= nj) then - write(iulog,*)trim(subname), 'ldomain and input file do not match dims ' - write(iulog,*)trim(subname), 'ldomain%ni,ni,= ',ldomain%ni,ni - write(iulog,*)trim(subname), 'ldomain%nj,nj,= ',ldomain%nj,nj - write(iulog,*)trim(subname), 'ldomain%ns,ns,= ',ldomain%ns,ns - call endrun() - end if - - call ncd_io(ncid=ncid, varname='ORGANIC', flag='read', data=organic, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun('organicrd: errror reading ORGANIC') - - if ( masterproc )then - write(iulog,*) 'Successfully read organic matter data' - write(iulog,*) - end if - endif - - end subroutine organicrd - -end module organicFileMod diff --git a/src/main/paramUtilMod.F90 b/src/main/paramUtilMod.F90 deleted file mode 100644 index 96c95440e7..0000000000 --- a/src/main/paramUtilMod.F90 +++ /dev/null @@ -1,291 +0,0 @@ -module paramUtilMod - ! - ! module that deals with reading parameter files - ! - use shr_kind_mod , only: r8 => shr_kind_r8 - implicit none - save - private - - interface readNcdio - module procedure readNcdioScalar - module procedure readNcdioArray1d - module procedure readNcdioArray2d - module procedure readNcdioScalarCheckDimensions - module procedure readNcdioArray1dCheckDimensions - module procedure readNcdioArray2dCheckDimensions - end interface - - public :: readNcdioScalar - public :: readNcdioArray1d - public :: readNcdioArray2d - public :: readNcdioScalarCheckDimensions - public :: readNcdioArray1dCheckDimensions - public :: readNcdioArray2dCheckDimensions - - public :: readNcdio - - private :: checkDimensions - -contains - !----------------------------------------------------------------------- - ! - !----------------------------------------------------------------------- - subroutine readNcdioScalar(ncid, varName, callingName, retVal) - ! - ! read the netcdf file...generic, could be used for any parameter read - ! - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t,ncd_io - - implicit none - - ! arguments - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - character(len=*), intent(in) :: varName ! variable we are reading - character(len=*), intent(in) :: callingName ! calling routine - real(r8), intent(inout) :: retVal - - ! local vars - character(len=32) :: subname = 'readNcdio::' - character(len=100) :: errCode = ' - Error reading. Var: ' - logical :: readv ! has variable been read in or not - - ! - ! netcdf read here - ! - - call ncd_io(varname=trim(varName),data=retVal, flag='read', ncid=ncid, readvar=readv) - - if ( .not. readv ) then - call endrun(trim(callingName)//trim(subname)//trim(errCode)//trim(varName)) - endif - - end subroutine readNcdioScalar - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - ! - !----------------------------------------------------------------------- - subroutine readNcdioArray1d(ncid, varName, callingName, retVal) - ! - ! read the netcdf file...generic, could be used for any parameter read - ! - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t,ncd_io - - implicit none - - ! arguments - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - character(len=*), intent(in) :: varName ! variable we are reading - character(len=*), intent(in) :: callingName ! calling routine - real(r8), intent(inout) :: retVal( 1: ) - - ! local vars - character(len=32) :: subname = 'readNcdio::' - character(len=100) :: errCode = ' - Error reading. Var: ' - logical :: readv ! has variable been read in or not - - ! - ! netcdf read here - ! - - call ncd_io(varname=trim(varName),data=retVal, flag='read', ncid=ncid, readvar=readv) - - if ( .not. readv ) then - call endrun(trim(callingName)//trim(subname)//trim(errCode)//trim(varName)) - endif - - end subroutine readNcdioArray1d - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - ! - !----------------------------------------------------------------------- - subroutine readNcdioArray2d(ncid, varName, callingName, retVal) - ! - ! read the netcdf file...generic, could be used for any parameter read - ! - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t,ncd_io - - implicit none - - ! arguments - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - character(len=*), intent(in) :: varName ! variable we are reading - character(len=*), intent(in) :: callingName ! calling routine - real(r8), intent(inout) :: retVal( 1: , :) - - ! local vars - character(len=32) :: subname = 'readNcdio::' - character(len=100) :: errCode = ' - Error reading. Var: ' - logical :: readv ! has variable been read in or not - - ! - ! netcdf read here - ! - - call ncd_io(varname=trim(varName),data=retVal, flag='read', ncid=ncid, readvar=readv) - - if ( .not. readv ) then - call endrun(trim(callingName)//trim(subname)//trim(errCode)//trim(varName)) - endif - - end subroutine readNcdioArray2d - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - ! - !----------------------------------------------------------------------- - subroutine readNcdioScalarCheckDimensions(ncid, varName, expected_numDims, expected_dimNames, & - callingName, retVal) - ! - ! read the netcdf file...generic, could be used for any parameter read - ! - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t - - implicit none - - ! arguments - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - character(len=*), intent(in) :: varName ! variable we are reading - integer, intent(in) :: expected_numDims - character(len=*), intent(in) :: expected_dimNames(:) ! expected dimension name - character(len=*), intent(in) :: callingName ! calling routine - real(r8), intent(inout) :: retVal - - ! local vars - character(len=32) :: subname = 'readNcdio::' - character(len=100) :: errCode = ' - Error reading. Var: ' - - ! - ! netcdf read here - ! - call checkDimensions(ncid, varName, expected_numDims, expected_dimNames, subname) - call readNcdio(ncid, varName, callingName, retVal) - - end subroutine readNcdioScalarCheckDimensions - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - ! - !----------------------------------------------------------------------- - subroutine readNcdioArray1dCheckDimensions(ncid, varName, expected_numDims, expected_dimNames, & - callingName, retVal) - ! - ! read the netcdf file...generic, could be used for any parameter read - ! - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t - - implicit none - - ! arguments - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - character(len=*), intent(in) :: varName ! variable we are reading - integer, intent(in) :: expected_numDims - character(len=*), intent(in) :: expected_dimNames(:) ! expected dimension name - character(len=*), intent(in) :: callingName ! calling routine - real(r8), intent(inout) :: retVal( 1: ) - - ! local vars - character(len=32) :: subname = 'readNcdio::' - character(len=100) :: errCode = ' - Error reading. Var: ' - ! - ! netcdf read here - ! - call checkDimensions(ncid, varName, expected_numDims, expected_dimNames, subname) - call readNcdio(ncid, varName, callingName, retVal) - - end subroutine readNcdioArray1dCheckDimensions - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - ! - !----------------------------------------------------------------------- - subroutine readNcdioArray2dCheckDimensions(ncid, varName, expected_numDims, expected_dimNames, & - callingName, retVal) - ! - ! read the netcdf file...generic, could be used for any parameter read - ! - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t - - implicit none - - ! arguments - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - character(len=*), intent(in) :: varName ! variable we are reading - integer, intent(in) :: expected_numDims - character(len=*), intent(in) :: expected_dimNames(:) ! expected dimension name - character(len=*), intent(in) :: callingName ! calling routine - real(r8), intent(inout) :: retVal(1:, : ) - - ! local vars - character(len=32) :: subname = 'readNcdio::' - character(len=100) :: errCode = ' - Error reading. Var: ' - ! - ! netcdf read here - ! - call checkDimensions(ncid, varName, expected_numDims, expected_dimNames, subname) - call readNcdio(ncid, varName, callingName, retVal) - - end subroutine readNcdioArray2dCheckDimensions - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - ! - !----------------------------------------------------------------------- - subroutine checkDimensions(ncid, varName, expected_numDims, expected_dimNames, callingName) - ! - ! Assert that the expected number of dimensions and dimension - ! names for a variable match the actual names on the file. - ! - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t, var_desc_t, check_var, ncd_inqvdname, ncd_inqvdims - - implicit none - - ! arguments - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - character(len=*), intent(in) :: varName ! variable we are reading - integer, intent(in) :: expected_numDims ! number of expected dimensions on the variable - character(len=*), intent(in) :: expected_dimNames(:) ! expected dimension names - character(len=*), intent(in) :: callingName ! calling routine - integer :: error_num - - ! local vars - character(len=32) :: subname = 'checkDimensions::' - type(Var_desc_t) :: var_desc ! variable descriptor - logical :: readvar ! whether the variable was found - character(len=100) :: received_dimName - integer :: d, num_dims - character(len=256) :: msg - - call check_var(ncid, varName, var_desc, readvar) - if (readvar) then - call ncd_inqvdims(ncid, num_dims, var_desc) - if (num_dims /= expected_numDims) then - write(msg, *) trim(callingName)//trim(subname)//trim(varname)//":: expected number of dimensions = ", & - expected_numDims, " num dimensions received from file = ", num_dims - call endrun(msg) - end if - do d = 1, num_dims - received_dimName = '' - call ncd_inqvdname(ncid, varname=trim(varName), dimnum=d, dname=received_dimName, err_code=error_num) - if (trim(expected_dimNames(d)) /= trim(received_dimName)) then - write(msg, *) trim(callingName)//trim(subname)//trim(varname)//":: dimension ", d, & - " expected dimension name '"//trim(expected_dimNames(d))//& - "' dimension name received from file '"//trim(received_dimName)//"'." - call endrun(msg) - end if - end do - end if - - end subroutine checkDimensions - !----------------------------------------------------------------------- - -end module paramUtilMod diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 deleted file mode 100644 index 4714fca0f9..0000000000 --- a/src/main/pftconMod.F90 +++ /dev/null @@ -1,1374 +0,0 @@ -module pftconMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing vegetation constants and method to - ! read and initialize vegetation (PFT) constants. - ! - ! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use abortutils , only : endrun - use clm_varpar , only : mxpft, numrad, ivis, inir, cft_lb, cft_ub - use clm_varctl , only : iulog, use_cndv, use_vertsoilc, use_crop - ! - ! !PUBLIC TYPES: - implicit none - ! - ! Vegetation type constants - ! - integer :: noveg ! value for not vegetated - integer :: ndllf_evr_tmp_tree ! value for Needleleaf evergreen temperate tree - integer :: ndllf_evr_brl_tree ! value for Needleleaf evergreen boreal tree - integer :: ndllf_dcd_brl_tree ! value for Needleleaf deciduous boreal tree - integer :: nbrdlf_evr_trp_tree ! value for Broadleaf evergreen tropical tree - integer :: nbrdlf_evr_tmp_tree ! value for Broadleaf evergreen temperate tree - integer :: nbrdlf_dcd_trp_tree ! value for Broadleaf deciduous tropical tree - integer :: nbrdlf_dcd_tmp_tree ! value for Broadleaf deciduous temperate tree - integer :: nbrdlf_dcd_brl_tree ! value for Broadleaf deciduous boreal tree - integer :: ntree ! value for last type of tree - integer :: nbrdlf_evr_shrub ! value for Broadleaf evergreen shrub - integer :: nbrdlf_dcd_tmp_shrub ! value for Broadleaf deciduous temperate shrub - integer :: nbrdlf_dcd_brl_shrub ! value for Broadleaf deciduous boreal shrub - integer :: nc3_arctic_grass ! value for C3 arctic grass - integer :: nc3_nonarctic_grass ! value for C3 non-arctic grass - integer :: nc4_grass ! value for C4 grass - integer :: npcropmin ! value for first crop - integer :: ntmp_corn ! value for temperate corn, rain fed (rf) - integer :: nirrig_tmp_corn ! value for temperate corn, irrigated (ir) - integer :: nswheat ! value for spring temperate cereal (rf) - integer :: nirrig_swheat ! value for spring temperate cereal (ir) - integer :: nwwheat ! value for winter temperate cereal (rf) - integer :: nirrig_wwheat ! value for winter temperate cereal (ir) - integer :: ntmp_soybean ! value for temperate soybean (rf) - integer :: nirrig_tmp_soybean ! value for temperate soybean (ir) - integer :: nbarley ! value for spring barley (rf) - integer :: nirrig_barley ! value for spring barley (ir) - integer :: nwbarley ! value for winter barley (rf) - integer :: nirrig_wbarley ! value for winter barley (ir) - integer :: nrye ! value for spring rye (rf) - integer :: nirrig_rye ! value for spring rye (ir) - integer :: nwrye ! value for winter rye (rf) - integer :: nirrig_wrye ! value for winter rye (ir) - integer :: ncassava ! ...and so on - integer :: nirrig_cassava - integer :: ncitrus - integer :: nirrig_citrus - integer :: ncocoa - integer :: nirrig_cocoa - integer :: ncoffee - integer :: nirrig_coffee - integer :: ncotton - integer :: nirrig_cotton - integer :: ndatepalm - integer :: nirrig_datepalm - integer :: nfoddergrass - integer :: nirrig_foddergrass - integer :: ngrapes - integer :: nirrig_grapes - integer :: ngroundnuts - integer :: nirrig_groundnuts - integer :: nmillet - integer :: nirrig_millet - integer :: noilpalm - integer :: nirrig_oilpalm - integer :: npotatoes - integer :: nirrig_potatoes - integer :: npulses - integer :: nirrig_pulses - integer :: nrapeseed - integer :: nirrig_rapeseed - integer :: nrice - integer :: nirrig_rice - integer :: nsorghum - integer :: nirrig_sorghum - integer :: nsugarbeet - integer :: nirrig_sugarbeet - integer :: nsugarcane - integer :: nirrig_sugarcane - integer :: nsunflower - integer :: nirrig_sunflower - integer :: nmiscanthus - integer :: nirrig_miscanthus - integer :: nswitchgrass - integer :: nirrig_switchgrass - integer :: ntrp_corn !value for tropical corn (rf) - integer :: nirrig_trp_corn !value for tropical corn (ir) - integer :: ntrp_soybean !value for tropical soybean (rf) - integer :: nirrig_trp_soybean !value for tropical soybean (ir) - integer :: npcropmax ! value for last prognostic crop in list - integer :: nc3crop ! value for generic crop (rf) - integer :: nc3irrig ! value for irrigated generic crop (ir) - - ! Number of crop functional types actually used in the model. This includes each CFT for - ! which is_pft_known_to_model is true. Note that this includes irrigated crops even if - ! irrigation is turned off in this run: it just excludes crop types that aren't handled - ! at all, as given by the mergetoclmpft list. - integer :: num_cfts_known_to_model - - ! !PUBLIC TYPES: - type, public :: pftcon_type - - integer , allocatable :: noveg (:) ! value for not vegetated - integer , allocatable :: tree (:) ! tree or not? - - real(r8), allocatable :: dleaf (:) ! characteristic leaf dimension (m) - real(r8), allocatable :: c3psn (:) ! photosynthetic pathway: 0. = c4, 1. = c3 - real(r8), allocatable :: xl (:) ! leaf/stem orientation index - real(r8), allocatable :: rhol (:,:) ! leaf reflectance: 1=vis, 2=nir - real(r8), allocatable :: rhos (:,:) ! stem reflectance: 1=vis, 2=nir - real(r8), allocatable :: taul (:,:) ! leaf transmittance: 1=vis, 2=nir - real(r8), allocatable :: taus (:,:) ! stem transmittance: 1=vis, 2=nir - real(r8), allocatable :: z0mr (:) ! ratio of momentum roughness length to canopy top height (-) - real(r8), allocatable :: displar (:) ! ratio of displacement height to canopy top height (-) - real(r8), allocatable :: roota_par (:) ! CLM rooting distribution parameter [1/m] - real(r8), allocatable :: rootb_par (:) ! CLM rooting distribution parameter [1/m] - real(r8), allocatable :: crop (:) ! crop pft: 0. = not crop, 1. = crop pft - real(r8), allocatable :: irrigated (:) ! irrigated pft: 0. = not, 1. = irrigated - real(r8), allocatable :: smpso (:) ! soil water potential at full stomatal opening (mm) - real(r8), allocatable :: smpsc (:) ! soil water potential at full stomatal closure (mm) - real(r8), allocatable :: fnitr (:) ! foliage nitrogen limitation factor (-) - - ! CN code - real(r8), allocatable :: dwood (:) ! wood density (gC/m3) - real(r8), allocatable :: slatop (:) ! SLA at top of canopy [m^2/gC] - real(r8), allocatable :: dsladlai (:) ! dSLA/dLAI [m^2/gC] - real(r8), allocatable :: leafcn (:) ! leaf C:N [gC/gN] - real(r8), allocatable :: flnr (:) ! fraction of leaf N in Rubisco [no units] - real(r8), allocatable :: woody (:) ! woody lifeform flag (0 or 1) - real(r8), allocatable :: lflitcn (:) ! leaf litter C:N (gC/gN) - real(r8), allocatable :: frootcn (:) ! fine root C:N (gC/gN) - real(r8), allocatable :: livewdcn (:) ! live wood (phloem and ray parenchyma) C:N (gC/gN) - real(r8), allocatable :: deadwdcn (:) ! dead wood (xylem and heartwood) C:N (gC/gN) - real(r8), allocatable :: grperc (:) ! growth respiration parameter - real(r8), allocatable :: grpnow (:) ! growth respiration parameter - real(r8), allocatable :: rootprof_beta (:,:) ! CLM rooting distribution parameter for C and N inputs [unitless] - real(r8), allocatable :: root_radius (:) ! root radius (m) - real(r8), allocatable :: root_density (:) ! root density (gC/m3) - - ! crop - - ! These arrays give information about the merge of unused crop types to the types CLM - ! knows about. mergetoclmpft(m) gives the crop type that CLM uses to simulate input - ! type m (and mergetoclmpft(m) == m implies that CLM simulates crop type m - ! directly). is_pft_known_to_model(m) is true if CLM simulates crop type m, and false - ! otherwise. Note that these do NOT relate to whether irrigation is on or off in a - ! given simulation - that is handled separately. - integer , allocatable :: mergetoclmpft (:) - logical , allocatable :: is_pft_known_to_model (:) - - real(r8), allocatable :: graincn (:) ! grain C:N (gC/gN) - real(r8), allocatable :: mxtmp (:) ! parameter used in accFlds - real(r8), allocatable :: baset (:) ! parameter used in accFlds - real(r8), allocatable :: declfact (:) ! parameter used in CNAllocation - real(r8), allocatable :: bfact (:) ! parameter used in CNAllocation - real(r8), allocatable :: aleaff (:) ! parameter used in CNAllocation - real(r8), allocatable :: arootf (:) ! parameter used in CNAllocation - real(r8), allocatable :: astemf (:) ! parameter used in CNAllocation - real(r8), allocatable :: arooti (:) ! parameter used in CNAllocation - real(r8), allocatable :: fleafi (:) ! parameter used in CNAllocation - real(r8), allocatable :: allconsl (:) ! parameter used in CNAllocation - real(r8), allocatable :: allconss (:) ! parameter used in CNAllocation - real(r8), allocatable :: ztopmx (:) ! parameter used in CNVegStructUpdate - real(r8), allocatable :: laimx (:) ! parameter used in CNVegStructUpdate - real(r8), allocatable :: gddmin (:) ! parameter used in CNPhenology - real(r8), allocatable :: hybgdd (:) ! parameter used in CNPhenology - real(r8), allocatable :: lfemerg (:) ! parameter used in CNPhenology - real(r8), allocatable :: grnfill (:) ! parameter used in CNPhenology - integer , allocatable :: mxmat (:) ! parameter used in CNPhenology - real(r8), allocatable :: mbbopt (:) ! Ball-Berry equation slope used in Photosynthesis - real(r8), allocatable :: medlynslope (:) ! Medlyn equation slope used in Photosynthesis - real(r8), allocatable :: medlynintercept(:) ! Medlyn equation intercept used in Photosynthesis - integer , allocatable :: mnNHplantdate (:) ! minimum planting date for NorthHemisphere (YYYYMMDD) - integer , allocatable :: mxNHplantdate (:) ! maximum planting date for NorthHemisphere (YYYYMMDD) - integer , allocatable :: mnSHplantdate (:) ! minimum planting date for SouthHemisphere (YYYYMMDD) - integer , allocatable :: mxSHplantdate (:) ! maximum planting date for SouthHemisphere (YYYYMMDD) - real(r8), allocatable :: planttemp (:) ! planting temperature used in CNPhenology (K) - real(r8), allocatable :: minplanttemp (:) ! mininum planting temperature used in CNPhenology (K) - real(r8), allocatable :: froot_leaf (:) ! allocation parameter: new fine root C per new leaf C (gC/gC) - real(r8), allocatable :: stem_leaf (:) ! allocation parameter: new stem c per new leaf C (gC/gC) - real(r8), allocatable :: croot_stem (:) ! allocation parameter: new coarse root C per new stem C (gC/gC) - real(r8), allocatable :: flivewd (:) ! allocation parameter: fraction of new wood that is live (phloem and ray parenchyma) (no units) - real(r8), allocatable :: fcur (:) ! allocation parameter: fraction of allocation that goes to currently displayed growth, remainder to storage - real(r8), allocatable :: fcurdv (:) ! alternate fcur for use with cndv - real(r8), allocatable :: lf_flab (:) ! leaf litter labile fraction - real(r8), allocatable :: lf_fcel (:) ! leaf litter cellulose fraction - real(r8), allocatable :: lf_flig (:) ! leaf litter lignin fraction - real(r8), allocatable :: fr_flab (:) ! fine root litter labile fraction - real(r8), allocatable :: fr_fcel (:) ! fine root litter cellulose fraction - real(r8), allocatable :: fr_flig (:) ! fine root litter lignin fraction - real(r8), allocatable :: leaf_long (:) ! leaf longevity (yrs) - real(r8), allocatable :: evergreen (:) ! binary flag for evergreen leaf habit (0 or 1) - real(r8), allocatable :: stress_decid (:) ! binary flag for stress-deciduous leaf habit (0 or 1) - real(r8), allocatable :: season_decid (:) ! binary flag for seasonal-deciduous leaf habit (0 or 1) - real(r8), allocatable :: pconv (:) ! proportion of deadstem to conversion flux - real(r8), allocatable :: pprod10 (:) ! proportion of deadstem to 10-yr product pool - real(r8), allocatable :: pprod100 (:) ! proportion of deadstem to 100-yr product pool - real(r8), allocatable :: pprodharv10 (:) ! harvest mortality proportion of deadstem to 10-yr pool - - ! pft paraemeters for fire code - real(r8), allocatable :: cc_leaf (:) - real(r8), allocatable :: cc_lstem (:) - real(r8), allocatable :: cc_dstem (:) - real(r8), allocatable :: cc_other (:) - real(r8), allocatable :: fm_leaf (:) - real(r8), allocatable :: fm_lstem (:) - real(r8), allocatable :: fm_dstem (:) - real(r8), allocatable :: fm_other (:) - real(r8), allocatable :: fm_root (:) - real(r8), allocatable :: fm_lroot (:) - real(r8), allocatable :: fm_droot (:) - real(r8), allocatable :: fsr_pft (:) - real(r8), allocatable :: fd_pft (:) - - ! pft parameters for crop code - real(r8), allocatable :: manunitro (:) ! manure - real(r8), allocatable :: fleafcn (:) ! C:N during grain fill; leaf - real(r8), allocatable :: ffrootcn (:) ! C:N during grain fill; fine root - real(r8), allocatable :: fstemcn (:) ! C:N during grain fill; stem - - real(r8), allocatable :: i_vcad (:) - real(r8), allocatable :: s_vcad (:) - real(r8), allocatable :: i_flnr (:) - real(r8), allocatable :: s_flnr (:) - - ! pft parameters for CNDV code (from LPJ subroutine pftparameters) - real(r8), allocatable :: pftpar20 (:) ! tree maximum crown area (m2) - real(r8), allocatable :: pftpar28 (:) ! min coldest monthly mean temperature - real(r8), allocatable :: pftpar29 (:) ! max coldest monthly mean temperature - real(r8), allocatable :: pftpar30 (:) ! min growing degree days (>= 5 deg C) - real(r8), allocatable :: pftpar31 (:) ! upper limit of temperature of the warmest month (twmax) - - ! pft parameters for FUN - real(r8), allocatable :: a_fix (:) ! A BNF parameter - real(r8), allocatable :: b_fix (:) ! A BNF parameter - real(r8), allocatable :: c_fix (:) ! A BNF parameter - real(r8), allocatable :: s_fix (:) ! A BNF parameter - real(r8), allocatable :: akc_active (:) ! A mycorrhizal uptake parameter - real(r8), allocatable :: akn_active (:) ! A mycorrhizal uptake parameter - real(r8), allocatable :: ekc_active (:) ! A mycorrhizal uptake parameter - real(r8), allocatable :: ekn_active (:) ! A mycorrhizal uptake parameter - real(r8), allocatable :: kc_nonmyc (:) ! A non-mycorrhizal uptake parameter - real(r8), allocatable :: kn_nonmyc (:) ! A non-mycorrhizal uptake parameter - real(r8), allocatable :: kr_resorb (:) ! A retrasnlcation parameter - real(r8), allocatable :: perecm (:) ! The fraction of ECM-associated PFT - real(r8), allocatable :: fun_cn_flex_a (:) ! Parameter a of FUN-flexcn link code (def 5) - real(r8), allocatable :: fun_cn_flex_b (:) ! Parameter b of FUN-flexcn link code (def 200) - real(r8), allocatable :: fun_cn_flex_c (:) ! Parameter b of FUN-flexcn link code (def 80) - real(r8), allocatable :: FUN_fracfixers(:) ! Fraction of C that can be used for fixation. - - - ! pft parameters for dynamic root code - real(r8), allocatable :: root_dmx(:) !maximum root depth - - contains - - procedure, public :: Init - procedure, public :: InitForTesting ! version of Init meant for unit testing - procedure, public :: Clean - procedure, private :: InitAllocate - procedure, private :: InitRead - procedure, private :: set_is_pft_known_to_model ! Set is_pft_known_to_model based on mergetoclmpft - procedure, private :: set_num_cfts_known_to_model ! Set the module-level variable, num_cfts_known_to_model - - end type pftcon_type - - type(pftcon_type), public :: pftcon ! pft type constants structure - - integer, parameter :: pftname_len = 40 ! max length of pftname - character(len=pftname_len) :: pftname(0:mxpft) ! PFT description - - real(r8), parameter :: reinickerp = 1.6_r8 ! parameter in allometric equation - real(r8), parameter :: dwood = 2.5e5_r8 ! cn wood density (gC/m3); lpj:2.0e5 - real(r8), parameter :: allom1 = 100.0_r8 ! parameters in - real(r8), parameter :: allom2 = 40.0_r8 ! ...allometric - real(r8), parameter :: allom3 = 0.5_r8 ! ...equations - real(r8), parameter :: allom1s = 250.0_r8 ! modified for shrubs by - real(r8), parameter :: allom2s = 8.0_r8 ! X.D.Z -! root radius, density from Bonan, GMD, 2014 - real(r8), parameter :: root_density = 0.31e06_r8 !(g biomass / m3 root) - real(r8), parameter :: root_radius = 0.29e-03_r8 !(m) - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------ - subroutine Init(this) - - class(pftcon_type) :: this - - call this%InitAllocate() - call this%InitRead() - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitForTesting(this) - ! Version of Init meant for unit testing - ! - ! Allocate arrays, but don't try to read from file. - ! - ! Values can then be set by tests as needed - - class(pftcon_type) :: this - - call this%InitAllocate() - - end subroutine InitForTesting - - !----------------------------------------------------------------------- - subroutine InitAllocate (this) - ! - ! !DESCRIPTION: - ! Read and initialize vegetation (PFT) constants - ! - ! !USES: - use clm_varpar , only: nvariants - implicit none - ! - ! !ARGUMENTS: - class(pftcon_type) :: this - !----------------------------------------------------------------------- - - allocate( this%noveg (0:mxpft)); this%noveg (:) =huge(1) - allocate( this%tree (0:mxpft)); this%tree (:) =huge(1) - - allocate( this%dleaf (0:mxpft) ) - allocate( this%c3psn (0:mxpft) ) - allocate( this%xl (0:mxpft) ) - allocate( this%rhol (0:mxpft,numrad) ) - allocate( this%rhos (0:mxpft,numrad) ) - allocate( this%taul (0:mxpft,numrad) ) - allocate( this%taus (0:mxpft,numrad) ) - allocate( this%z0mr (0:mxpft) ) - allocate( this%displar (0:mxpft) ) - allocate( this%roota_par (0:mxpft) ) - allocate( this%rootb_par (0:mxpft) ) - allocate( this%crop (0:mxpft) ) - allocate( this%mergetoclmpft (0:mxpft) ) - allocate( this%is_pft_known_to_model (0:mxpft) ) - allocate( this%irrigated (0:mxpft) ) - allocate( this%smpso (0:mxpft) ) - allocate( this%smpsc (0:mxpft) ) - allocate( this%fnitr (0:mxpft) ) - allocate( this%slatop (0:mxpft) ) - allocate( this%dsladlai (0:mxpft) ) - allocate( this%leafcn (0:mxpft) ) - allocate( this%flnr (0:mxpft) ) - allocate( this%woody (0:mxpft) ) - allocate( this%lflitcn (0:mxpft) ) - allocate( this%frootcn (0:mxpft) ) - allocate( this%livewdcn (0:mxpft) ) - allocate( this%deadwdcn (0:mxpft) ) - allocate( this%grperc (0:mxpft) ) - allocate( this%grpnow (0:mxpft) ) - allocate( this%rootprof_beta (0:mxpft,nvariants) ) - allocate( this%graincn (0:mxpft) ) - allocate( this%mxtmp (0:mxpft) ) - allocate( this%baset (0:mxpft) ) - allocate( this%declfact (0:mxpft) ) - allocate( this%bfact (0:mxpft) ) - allocate( this%aleaff (0:mxpft) ) - allocate( this%arootf (0:mxpft) ) - allocate( this%astemf (0:mxpft) ) - allocate( this%arooti (0:mxpft) ) - allocate( this%fleafi (0:mxpft) ) - allocate( this%allconsl (0:mxpft) ) - allocate( this%allconss (0:mxpft) ) - allocate( this%ztopmx (0:mxpft) ) - allocate( this%laimx (0:mxpft) ) - allocate( this%gddmin (0:mxpft) ) - allocate( this%hybgdd (0:mxpft) ) - allocate( this%lfemerg (0:mxpft) ) - allocate( this%grnfill (0:mxpft) ) - allocate( this%mbbopt (0:mxpft) ) - allocate( this%medlynslope (0:mxpft) ) - allocate( this%medlynintercept(0:mxpft) ) - allocate( this%mxmat (0:mxpft) ) - allocate( this%mnNHplantdate (0:mxpft) ) - allocate( this%mxNHplantdate (0:mxpft) ) - allocate( this%mnSHplantdate (0:mxpft) ) - allocate( this%mxSHplantdate (0:mxpft) ) - allocate( this%planttemp (0:mxpft) ) - allocate( this%minplanttemp (0:mxpft) ) - allocate( this%froot_leaf (0:mxpft) ) - allocate( this%stem_leaf (0:mxpft) ) - allocate( this%croot_stem (0:mxpft) ) - allocate( this%flivewd (0:mxpft) ) - allocate( this%fcur (0:mxpft) ) - allocate( this%fcurdv (0:mxpft) ) - allocate( this%lf_flab (0:mxpft) ) - allocate( this%lf_fcel (0:mxpft) ) - allocate( this%lf_flig (0:mxpft) ) - allocate( this%fr_flab (0:mxpft) ) - allocate( this%fr_fcel (0:mxpft) ) - allocate( this%fr_flig (0:mxpft) ) - allocate( this%leaf_long (0:mxpft) ) - allocate( this%evergreen (0:mxpft) ) - allocate( this%stress_decid (0:mxpft) ) - allocate( this%season_decid (0:mxpft) ) - allocate( this%dwood (0:mxpft) ) - allocate( this%root_density (0:mxpft) ) - allocate( this%root_radius (0:mxpft) ) - allocate( this%pconv (0:mxpft) ) - allocate( this%pprod10 (0:mxpft) ) - allocate( this%pprod100 (0:mxpft) ) - allocate( this%pprodharv10 (0:mxpft) ) - allocate( this%cc_leaf (0:mxpft) ) - allocate( this%cc_lstem (0:mxpft) ) - allocate( this%cc_dstem (0:mxpft) ) - allocate( this%cc_other (0:mxpft) ) - allocate( this%fm_leaf (0:mxpft) ) - allocate( this%fm_lstem (0:mxpft) ) - allocate( this%fm_dstem (0:mxpft) ) - allocate( this%fm_other (0:mxpft) ) - allocate( this%fm_root (0:mxpft) ) - allocate( this%fm_lroot (0:mxpft) ) - allocate( this%fm_droot (0:mxpft) ) - allocate( this%fsr_pft (0:mxpft) ) - allocate( this%fd_pft (0:mxpft) ) - allocate( this%manunitro (0:mxpft) ) - allocate( this%fleafcn (0:mxpft) ) - allocate( this%ffrootcn (0:mxpft) ) - allocate( this%fstemcn (0:mxpft) ) - allocate( this%i_vcad (0:mxpft) ) - allocate( this%s_vcad (0:mxpft) ) - allocate( this%i_flnr (0:mxpft) ) - allocate( this%s_flnr (0:mxpft) ) - allocate( this%pftpar20 (0:mxpft) ) - allocate( this%pftpar28 (0:mxpft) ) - allocate( this%pftpar29 (0:mxpft) ) - allocate( this%pftpar30 (0:mxpft) ) - allocate( this%pftpar31 (0:mxpft) ) - allocate( this%a_fix (0:mxpft) ) - allocate( this%b_fix (0:mxpft) ) - allocate( this%c_fix (0:mxpft) ) - allocate( this%s_fix (0:mxpft) ) - allocate( this%akc_active (0:mxpft) ) - allocate( this%akn_active (0:mxpft) ) - allocate( this%ekc_active (0:mxpft) ) - allocate( this%ekn_active (0:mxpft) ) - allocate( this%kc_nonmyc (0:mxpft) ) - allocate( this%kn_nonmyc (0:mxpft) ) - allocate( this%kr_resorb (0:mxpft) ) - allocate( this%perecm (0:mxpft) ) - allocate( this%root_dmx (0:mxpft) ) - allocate( this%fun_cn_flex_a (0:mxpft) ) - allocate( this%fun_cn_flex_b (0:mxpft) ) - allocate( this%fun_cn_flex_c (0:mxpft) ) - allocate( this%FUN_fracfixers(0:mxpft) ) - - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitRead(this) - ! - ! !DESCRIPTION: - ! Read and initialize vegetation (PFT) constants - ! - ! !USES: - use shr_log_mod , only : errMsg => shr_log_errMsg - use fileutils , only : getfil - use ncdio_pio , only : ncd_io, ncd_pio_closefile, ncd_pio_openfile, file_desc_t - use ncdio_pio , only : ncd_inqdid, ncd_inqdlen - use clm_varctl , only : paramfile, use_flexibleCN, use_dynroot - use spmdMod , only : masterproc - ! - ! !ARGUMENTS: - class(pftcon_type) :: this - ! - ! !LOCAL VARIABLES: - character(len=256) :: locfn ! local file name - integer :: i,n,m ! loop indices - integer :: ier ! error code - type(file_desc_t) :: ncid ! pio netCDF file id - integer :: dimid ! netCDF dimension id - integer :: npft ! number of pfts on pft-physiology file - logical :: readv ! read variable in or not - character(len=32) :: subname = 'InitRead' ! subroutine name - character(len=pftname_len) :: expected_pftnames(0:mxpft) - character(len=512) :: msg - !----------------------------------------------------------------------- - ! - ! Expected PFT names: The names expected on the paramfile file and the order they are expected to be in. - ! NOTE: similar types are assumed to be together, first trees (ending with broadleaf_deciduous_boreal_tree - ! then shrubs, ending with broadleaf_deciduous_boreal_shrub, then grasses starting with c3_arctic_grass - ! and finally crops, ending with irrigated_tropical_soybean - ! DO NOT CHANGE THE ORDER -- WITHOUT MODIFYING OTHER PARTS OF THE CODE WHERE THE ORDER MATTERS! - - expected_pftnames( 0) = 'not_vegetated ' - expected_pftnames( 1) = 'needleleaf_evergreen_temperate_tree' - expected_pftnames( 2) = 'needleleaf_evergreen_boreal_tree ' - expected_pftnames( 3) = 'needleleaf_deciduous_boreal_tree ' - expected_pftnames( 4) = 'broadleaf_evergreen_tropical_tree ' - expected_pftnames( 5) = 'broadleaf_evergreen_temperate_tree ' - expected_pftnames( 6) = 'broadleaf_deciduous_tropical_tree ' - expected_pftnames( 7) = 'broadleaf_deciduous_temperate_tree ' - expected_pftnames( 8) = 'broadleaf_deciduous_boreal_tree ' - expected_pftnames( 9) = 'broadleaf_evergreen_shrub ' - expected_pftnames(10) = 'broadleaf_deciduous_temperate_shrub' - expected_pftnames(11) = 'broadleaf_deciduous_boreal_shrub ' - expected_pftnames(12) = 'c3_arctic_grass ' - expected_pftnames(13) = 'c3_non-arctic_grass ' - expected_pftnames(14) = 'c4_grass ' - expected_pftnames(15) = 'c3_crop ' - expected_pftnames(16) = 'c3_irrigated ' - expected_pftnames(17) = 'temperate_corn ' - expected_pftnames(18) = 'irrigated_temperate_corn ' - expected_pftnames(19) = 'spring_wheat ' - expected_pftnames(20) = 'irrigated_spring_wheat ' - expected_pftnames(21) = 'winter_wheat ' - expected_pftnames(22) = 'irrigated_winter_wheat ' - expected_pftnames(23) = 'temperate_soybean ' - expected_pftnames(24) = 'irrigated_temperate_soybean ' - expected_pftnames(25) = 'barley ' - expected_pftnames(26) = 'irrigated_barley ' - expected_pftnames(27) = 'winter_barley ' - expected_pftnames(28) = 'irrigated_winter_barley ' - expected_pftnames(29) = 'rye ' - expected_pftnames(30) = 'irrigated_rye ' - expected_pftnames(31) = 'winter_rye ' - expected_pftnames(32) = 'irrigated_winter_rye ' - expected_pftnames(33) = 'cassava ' - expected_pftnames(34) = 'irrigated_cassava ' - expected_pftnames(35) = 'citrus ' - expected_pftnames(36) = 'irrigated_citrus ' - expected_pftnames(37) = 'cocoa ' - expected_pftnames(38) = 'irrigated_cocoa ' - expected_pftnames(39) = 'coffee ' - expected_pftnames(40) = 'irrigated_coffee ' - expected_pftnames(41) = 'cotton ' - expected_pftnames(42) = 'irrigated_cotton ' - expected_pftnames(43) = 'datepalm ' - expected_pftnames(44) = 'irrigated_datepalm ' - expected_pftnames(45) = 'foddergrass ' - expected_pftnames(46) = 'irrigated_foddergrass ' - expected_pftnames(47) = 'grapes ' - expected_pftnames(48) = 'irrigated_grapes ' - expected_pftnames(49) = 'groundnuts ' - expected_pftnames(50) = 'irrigated_groundnuts ' - expected_pftnames(51) = 'millet ' - expected_pftnames(52) = 'irrigated_millet ' - expected_pftnames(53) = 'oilpalm ' - expected_pftnames(54) = 'irrigated_oilpalm ' - expected_pftnames(55) = 'potatoes ' - expected_pftnames(56) = 'irrigated_potatoes ' - expected_pftnames(57) = 'pulses ' - expected_pftnames(58) = 'irrigated_pulses ' - expected_pftnames(59) = 'rapeseed ' - expected_pftnames(60) = 'irrigated_rapeseed ' - expected_pftnames(61) = 'rice ' - expected_pftnames(62) = 'irrigated_rice ' - expected_pftnames(63) = 'sorghum ' - expected_pftnames(64) = 'irrigated_sorghum ' - expected_pftnames(65) = 'sugarbeet ' - expected_pftnames(66) = 'irrigated_sugarbeet ' - expected_pftnames(67) = 'sugarcane ' - expected_pftnames(68) = 'irrigated_sugarcane ' - expected_pftnames(69) = 'sunflower ' - expected_pftnames(70) = 'irrigated_sunflower ' - expected_pftnames(71) = 'miscanthus ' - expected_pftnames(72) = 'irrigated_miscanthus ' - expected_pftnames(73) = 'switchgrass ' - expected_pftnames(74) = 'irrigated_switchgrass ' - expected_pftnames(75) = 'tropical_corn ' - expected_pftnames(76) = 'irrigated_tropical_corn ' - expected_pftnames(77) = 'tropical_soybean ' - expected_pftnames(78) = 'irrigated_tropical_soybean ' - - ! Set specific vegetation type values - - if (masterproc) then - write(iulog,*) 'Attempting to read PFT physiological data .....' - end if - call getfil (paramfile, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_inqdid(ncid, 'pft', dimid) - call ncd_inqdlen(ncid, dimid, npft) - - if (npft - 1 /= mxpft) then - ! NOTE(bja, 201503) need to subtract 1 because of indexing. - ! NOTE(bja, 201503) fail early because one of the io libs - ! throws a useless abort error message deep inside the stack - ! instead of returning readv so we can get a useful line - ! number. - write(msg, '(a, i4, a, i4, a)') "ERROR: The number of pfts in the input netcdf file (", & - npft, ") does not equal the expected number of pfts (", mxpft, "). " - call endrun(msg=trim(msg)//errMsg(sourcefile, __LINE__)) - end if - - call ncd_io('pftname',pftname, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('z0mr', this%z0mr, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('displar', this%displar, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('dleaf', this%dleaf, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('c3psn', this%c3psn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('rholvis', this%rhol(:,ivis), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('rholnir', this%rhol(:,inir), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('rhosvis', this%rhos(:,ivis), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('rhosnir', this% rhos(:,inir), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('taulvis', this%taul(:,ivis), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('taulnir', this%taul(:,inir), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('tausvis', this%taus(:,ivis), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('tausnir', this%taus(:,inir), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('xl', this%xl, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('roota_par', this%roota_par, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('rootb_par', this%rootb_par, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('slatop', this%slatop, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('dsladlai', this%dsladlai, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('leafcn', this%leafcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('flnr', this%flnr, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('smpso', this%smpso, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('smpsc', this%smpsc, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fnitr', this%fnitr, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('woody', this%woody, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('lflitcn', this%lflitcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('frootcn', this%frootcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('livewdcn', this%livewdcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('deadwdcn', this%deadwdcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('grperc', this%grperc, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('grpnow', this%grpnow, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('froot_leaf', this%froot_leaf, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('stem_leaf', this%stem_leaf, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('croot_stem', this%croot_stem, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('flivewd', this%flivewd, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fcur', this%fcur, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fcurdv', this%fcurdv, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('lf_flab', this%lf_flab, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('lf_fcel', this%lf_fcel, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('lf_flig', this%lf_flig, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fr_flab', this%fr_flab, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fr_fcel', this%fr_fcel, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fr_flig', this%fr_flig, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('leaf_long', this%leaf_long, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('evergreen', this%evergreen, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('stress_decid', this%stress_decid, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('season_decid', this%season_decid, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('pftpar20', this%pftpar20, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('pftpar28', this%pftpar28, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('pftpar29', this%pftpar29, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('pftpar30', this%pftpar30, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('pftpar31', this%pftpar31, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('a_fix', this%a_fix, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('b_fix', this%b_fix, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('c_fix', this%c_fix, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('s_fix', this%s_fix, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('akc_active', this%akc_active, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('akn_active', this%akn_active, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('ekc_active', this%ekc_active, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('ekn_active', this%ekn_active, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('kc_nonmyc', this%kc_nonmyc, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('kn_nonmyc', this%kn_nonmyc, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('kr_resorb', this%kr_resorb, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('perecm', this%perecm, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fun_cn_flex_a', this%fun_cn_flex_a, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fun_cn_flex_b', this%fun_cn_flex_b, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fun_cn_flex_c', this%fun_cn_flex_c, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('FUN_fracfixers', this%FUN_fracfixers, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('manunitro', this%manunitro, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fleafcn', this%fleafcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('ffrootcn', this%ffrootcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fstemcn', this%fstemcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('rootprof_beta', this%rootprof_beta, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('pconv', this%pconv, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('pprod10', this%pprod10, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('pprodharv10', this%pprodharv10, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('pprod100', this%pprod100, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('graincn', this%graincn, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('mxtmp', this%mxtmp, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('baset', this%baset, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('declfact', this%declfact, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('bfact', this%bfact, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('aleaff', this%aleaff, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('arootf', this%arootf, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('astemf', this%astemf, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('arooti', this%arooti, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fleafi', this%fleafi, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('allconsl', this%allconsl, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('allconss', this%allconss, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('crop', this%crop, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('mergetoclmpft', this%mergetoclmpft, 'read', ncid, readvar=readv) - if ( .not. readv ) then - call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - end if - - call ncd_io('irrigated', this%irrigated, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('ztopmx', this%ztopmx, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('laimx', this%laimx, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('gddmin', this%gddmin, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('hybgdd', this%hybgdd, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('lfemerg', this%lfemerg, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('grnfill', this%grnfill, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('mbbopt', this%mbbopt, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('medlynslope', this%medlynslope, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('medlynintercept', this%medlynintercept, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('mxmat', this%mxmat, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('cc_leaf', this% cc_leaf, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('cc_lstem', this%cc_lstem, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('cc_dstem', this%cc_dstem, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('cc_other', this%cc_other, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fm_leaf', this% fm_leaf, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fm_lstem', this%fm_lstem, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fm_dstem', this%fm_dstem, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fm_other', this%fm_other, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fm_root', this% fm_root, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fm_lroot', this%fm_lroot, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fm_droot', this%fm_droot, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fsr_pft', this% fsr_pft, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fd_pft', this% fd_pft, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('planting_temp', this%planttemp, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('min_planting_temp', this%minplanttemp, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('min_NH_planting_date', this%mnNHplantdate, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('min_SH_planting_date', this%mnSHplantdate, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('max_NH_planting_date', this%mxNHplantdate, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('max_SH_planting_date', this%mxSHplantdate, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - ! - ! Constants - ! - !MV (10-08-14) TODO is this right - used to be numpft - is it okay to set it to mxpft? - do m = 0,mxpft - this%dwood(m) = dwood - this%root_radius(m) = root_radius - this%root_density(m) = root_density - - if (m <= ntree) then - this%tree(m) = 1 - else - this%tree(m) = 0 - end if - end do - ! - ! clm 5 nitrogen variables - ! - if (use_flexibleCN) then - call ncd_io('i_vcad', this%i_vcad, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('s_vcad', this%s_vcad, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('i_flnr', this%i_flnr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('s_flnr', this%s_flnr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - end if - - ! - ! Dynamic Root variables for crops - ! - if ( use_crop .and. use_dynroot )then - call ncd_io('root_dmx', this%root_dmx, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - end if - - call ncd_pio_closefile(ncid) - - do i = 0, mxpft - if ( trim(adjustl(pftname(i))) /= trim(expected_pftnames(i)) )then - write(iulog,*)'pftconrd: pftname is NOT what is expected, name = ', & - trim(pftname(i)), ', expected name = ', trim(expected_pftnames(i)) - call endrun(msg='pftconrd: bad name for pft on paramfile dataset'//errMsg(sourcefile, __LINE__)) - end if - - if ( trim(pftname(i)) == 'not_vegetated' ) noveg = i - if ( trim(pftname(i)) == 'needleleaf_evergreen_temperate_tree' ) ndllf_evr_tmp_tree = i - if ( trim(pftname(i)) == 'needleleaf_evergreen_boreal_tree' ) ndllf_evr_brl_tree = i - if ( trim(pftname(i)) == 'needleleaf_deciduous_boreal_tree' ) ndllf_dcd_brl_tree = i - if ( trim(pftname(i)) == 'broadleaf_evergreen_tropical_tree' ) nbrdlf_evr_trp_tree = i - if ( trim(pftname(i)) == 'broadleaf_evergreen_temperate_tree' ) nbrdlf_evr_tmp_tree = i - if ( trim(pftname(i)) == 'broadleaf_deciduous_tropical_tree' ) nbrdlf_dcd_trp_tree = i - if ( trim(pftname(i)) == 'broadleaf_deciduous_temperate_tree' ) nbrdlf_dcd_tmp_tree = i - if ( trim(pftname(i)) == 'broadleaf_deciduous_boreal_tree' ) nbrdlf_dcd_brl_tree = i - if ( trim(pftname(i)) == 'broadleaf_evergreen_shrub' ) nbrdlf_evr_shrub = i - if ( trim(pftname(i)) == 'broadleaf_deciduous_temperate_shrub' ) nbrdlf_dcd_tmp_shrub = i - if ( trim(pftname(i)) == 'broadleaf_deciduous_boreal_shrub' ) nbrdlf_dcd_brl_shrub = i - if ( trim(pftname(i)) == 'c3_arctic_grass' ) nc3_arctic_grass = i - if ( trim(pftname(i)) == 'c3_non-arctic_grass' ) nc3_nonarctic_grass = i - if ( trim(pftname(i)) == 'c4_grass' ) nc4_grass = i - if ( trim(pftname(i)) == 'c3_crop' ) nc3crop = i - if ( trim(pftname(i)) == 'c3_irrigated' ) nc3irrig = i - if ( trim(pftname(i)) == 'temperate_corn' ) ntmp_corn = i - if ( trim(pftname(i)) == 'irrigated_temperate_corn' ) nirrig_tmp_corn = i - if ( trim(pftname(i)) == 'spring_wheat' ) nswheat = i - if ( trim(pftname(i)) == 'irrigated_spring_wheat' ) nirrig_swheat = i - if ( trim(pftname(i)) == 'winter_wheat' ) nwwheat = i - if ( trim(pftname(i)) == 'irrigated_winter_wheat' ) nirrig_wwheat = i - if ( trim(pftname(i)) == 'temperate_soybean' ) ntmp_soybean = i - if ( trim(pftname(i)) == 'irrigated_temperate_soybean' ) nirrig_tmp_soybean = i - if ( trim(pftname(i)) == 'barley' ) nbarley = i - if ( trim(pftname(i)) == 'irrigated_barley' ) nirrig_barley = i - if ( trim(pftname(i)) == 'winter_barley' ) nwbarley = i - if ( trim(pftname(i)) == 'irrigated_winter_barley' ) nirrig_wbarley = i - if ( trim(pftname(i)) == 'rye' ) nrye = i - if ( trim(pftname(i)) == 'irrigated_rye' ) nirrig_rye = i - if ( trim(pftname(i)) == 'winter_rye' ) nwrye = i - if ( trim(pftname(i)) == 'irrigated_winter_rye' ) nirrig_wrye = i - if ( trim(pftname(i)) == 'cassava' ) ncassava = i - if ( trim(pftname(i)) == 'irrigated_cassava' ) nirrig_cassava = i - if ( trim(pftname(i)) == 'citrus' ) ncitrus = i - if ( trim(pftname(i)) == 'irrigated_citrus' ) nirrig_citrus = i - if ( trim(pftname(i)) == 'cocoa' ) ncocoa = i - if ( trim(pftname(i)) == 'irrigated_cocoa' ) nirrig_cocoa = i - if ( trim(pftname(i)) == 'coffee' ) ncoffee = i - if ( trim(pftname(i)) == 'irrigated_coffee' ) nirrig_coffee = i - if ( trim(pftname(i)) == 'cotton' ) ncotton = i - if ( trim(pftname(i)) == 'irrigated_cotton' ) nirrig_cotton = i - if ( trim(pftname(i)) == 'datepalm' ) ndatepalm = i - if ( trim(pftname(i)) == 'irrigated_datepalm' ) nirrig_datepalm = i - if ( trim(pftname(i)) == 'foddergrass' ) nfoddergrass = i - if ( trim(pftname(i)) == 'irrigated_foddergrass' ) nirrig_foddergrass = i - if ( trim(pftname(i)) == 'grapes' ) ngrapes = i - if ( trim(pftname(i)) == 'irrigated_grapes' ) nirrig_grapes = i - if ( trim(pftname(i)) == 'groundnuts' ) ngroundnuts = i - if ( trim(pftname(i)) == 'irrigated_groundnuts' ) nirrig_groundnuts = i - if ( trim(pftname(i)) == 'millet' ) nmillet = i - if ( trim(pftname(i)) == 'irrigated_millet' ) nirrig_millet = i - if ( trim(pftname(i)) == 'oilpalm' ) noilpalm = i - if ( trim(pftname(i)) == 'irrigated_oilpalm' ) nirrig_oilpalm = i - if ( trim(pftname(i)) == 'potatoes' ) npotatoes = i - if ( trim(pftname(i)) == 'irrigated_potatoes' ) nirrig_potatoes = i - if ( trim(pftname(i)) == 'pulses' ) npulses = i - if ( trim(pftname(i)) == 'irrigated_pulses' ) nirrig_pulses = i - if ( trim(pftname(i)) == 'rapeseed' ) nrapeseed = i - if ( trim(pftname(i)) == 'irrigated_rapeseed' ) nirrig_rapeseed = i - if ( trim(pftname(i)) == 'rice' ) nrice = i - if ( trim(pftname(i)) == 'irrigated_rice' ) nirrig_rice = i - if ( trim(pftname(i)) == 'sorghum' ) nsorghum = i - if ( trim(pftname(i)) == 'irrigated_sorghum' ) nirrig_sorghum = i - if ( trim(pftname(i)) == 'sugarbeet' ) nsugarbeet = i - if ( trim(pftname(i)) == 'irrigated_sugarbeet' ) nirrig_sugarbeet = i - if ( trim(pftname(i)) == 'sugarcane' ) nsugarcane = i - if ( trim(pftname(i)) == 'irrigated_sugarcane' ) nirrig_sugarcane = i - if ( trim(pftname(i)) == 'sunflower' ) nsunflower = i - if ( trim(pftname(i)) == 'irrigated_sunflower' ) nirrig_sunflower = i - if ( trim(pftname(i)) == 'miscanthus' ) nmiscanthus = i - if ( trim(pftname(i)) == 'irrigated_miscanthus' ) nirrig_miscanthus = i - if ( trim(pftname(i)) == 'switchgrass' ) nswitchgrass = i - if ( trim(pftname(i)) == 'irrigated_switchgrass' ) nirrig_switchgrass = i - if ( trim(pftname(i)) == 'tropical_corn' ) ntrp_corn = i - if ( trim(pftname(i)) == 'irrigated_tropical_corn' ) nirrig_trp_corn = i - if ( trim(pftname(i)) == 'tropical_soybean' ) ntrp_soybean = i - if ( trim(pftname(i)) == 'irrigated_tropical_soybean' ) nirrig_trp_soybean = i - end do - - ntree = nbrdlf_dcd_brl_tree ! value for last type of tree - npcropmin = ntmp_corn ! first prognostic crop - npcropmax = mxpft ! last prognostic crop in list - - call this%set_is_pft_known_to_model() - call this%set_num_cfts_known_to_model() - - if (use_cndv) then - this%fcur(:) = this%fcurdv(:) - end if - ! - ! Do some error checking. - ! - ! FIX(SPM,032414) double check if some of these should be on... - - if ( npcropmax /= mxpft )then - call endrun(msg=' ERROR: npcropmax is NOT the last value'//errMsg(sourcefile, __LINE__)) - end if - do i = 0, mxpft - if ( this%irrigated(i) == 1.0_r8 .and. & - (i == nc3irrig .or. & - i == nirrig_tmp_corn .or. & - i == nirrig_swheat .or. i == nirrig_wwheat .or. & - i == nirrig_tmp_soybean .or. & - i == nirrig_barley .or. i == nirrig_wbarley .or. & - i == nirrig_rye .or. i == nirrig_wrye .or. & - i == nirrig_cassava .or. & - i == nirrig_citrus .or. & - i == nirrig_cocoa .or. i == nirrig_coffee .or. & - i == nirrig_cotton .or. & - i == nirrig_datepalm .or. & - i == nirrig_foddergrass .or. & - i == nirrig_grapes .or. i == nirrig_groundnuts .or. & - i == nirrig_millet .or. & - i == nirrig_oilpalm .or. & - i == nirrig_potatoes .or. i == nirrig_pulses .or. & - i == nirrig_rapeseed .or. i == nirrig_rice .or. & - i == nirrig_sorghum .or. & - i == nirrig_sugarbeet .or. i == nirrig_sugarcane .or. & - i == nirrig_sunflower .or. & - i == nirrig_miscanthus .or. i == nirrig_switchgrass .or. & - i == nirrig_trp_corn .or. & - i == nirrig_trp_soybean) )then - ! correct - else if ( this%irrigated(i) == 0.0_r8 )then - ! correct - else - call endrun(msg=' ERROR: irrigated has wrong values'//errMsg(sourcefile, __LINE__)) - end if - if ( this%crop(i) == 1.0_r8 .and. (i >= nc3crop .and. i <= npcropmax) )then - ! correct - else if ( this%crop(i) == 0.0_r8 )then - ! correct - else - call endrun(msg=' ERROR: crop has wrong values'//errMsg(sourcefile, __LINE__)) - end if - if ( (i /= noveg) .and. (i < npcropmin) .and. & - abs(this%pconv(i) + this%pprod10(i) + this%pprod100(i) - 1.0_r8) > 1.e-7_r8 )then - call endrun(msg=' ERROR: pconv+pprod10+pprod100 do NOT sum to one.'//errMsg(sourcefile, __LINE__)) - end if - if ( this%pprodharv10(i) > 1.0_r8 .or. this%pprodharv10(i) < 0.0_r8 )then - call endrun(msg=' ERROR: pprodharv10 outside of range.'//errMsg(sourcefile, __LINE__)) - end if - end do - - if (masterproc) then - write(iulog,*) 'Successfully read PFT physiological data' - write(iulog,*) - end if - - end subroutine InitRead - - !----------------------------------------------------------------------- - subroutine set_is_pft_known_to_model(this) - ! - ! !DESCRIPTION: - ! Set is_pft_known_to_model based on mergetoclmpft - ! - ! !USES: - ! - ! !ARGUMENTS: - class(pftcon_type), intent(inout) :: this - ! - ! !LOCAL VARIABLES: - integer :: m, merge_type - - character(len=*), parameter :: subname = 'set_is_pft_known_to_model' - !----------------------------------------------------------------------- - - this%is_pft_known_to_model(:) = .false. - - ! NOTE(wjs, 2015-10-04) Currently, type 0 has mergetoclmpft = _FillValue in the file, - ! so we can't handle it in the general loop below. But CLM always uses type 0, so - ! handle it specially here. - this%is_pft_known_to_model(0) = .true. - - ! NOTE(wjs, 2015-10-04) Currently, mergetoclmpft is only used for crop types. - ! However, we handle it more generally here (treating ALL pft types), in case its use - ! is ever extended to work with non-crop types as well. - do m = 1, mxpft - merge_type = this%mergetoclmpft(m) - this%is_pft_known_to_model(merge_type) = .true. - end do - - end subroutine set_is_pft_known_to_model - - !----------------------------------------------------------------------- - subroutine set_num_cfts_known_to_model(this) - ! - ! !DESCRIPTION: - ! Set the module-level variable, num_cfts_known_to_model - ! - ! !USES: - ! - ! !ARGUMENTS: - class(pftcon_type), intent(in) :: this - ! - ! !LOCAL VARIABLES: - integer :: m - - character(len=*), parameter :: subname = 'set_num_cfts_known_to_model' - !----------------------------------------------------------------------- - - num_cfts_known_to_model = 0 - do m = cft_lb, cft_ub - if (this%is_pft_known_to_model(m)) then - num_cfts_known_to_model = num_cfts_known_to_model + 1 - end if - end do - - end subroutine set_num_cfts_known_to_model - - !----------------------------------------------------------------------- - subroutine Clean(this) - ! - ! !DESCRIPTION: - ! Deallocate memory - ! - ! !USES: - ! - ! !ARGUMENTS: - class(pftcon_type), intent(inout) :: this - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'Clean' - !----------------------------------------------------------------------- - - deallocate( this%noveg) - deallocate( this%tree) - - deallocate( this%dleaf) - deallocate( this%c3psn) - deallocate( this%xl) - deallocate( this%rhol) - deallocate( this%rhos) - deallocate( this%taul) - deallocate( this%taus) - deallocate( this%z0mr) - deallocate( this%displar) - deallocate( this%roota_par) - deallocate( this%rootb_par) - deallocate( this%crop) - deallocate( this%mergetoclmpft) - deallocate( this%is_pft_known_to_model) - deallocate( this%irrigated) - deallocate( this%smpso) - deallocate( this%smpsc) - deallocate( this%fnitr) - deallocate( this%slatop) - deallocate( this%dsladlai) - deallocate( this%leafcn) - deallocate( this%flnr) - deallocate( this%woody) - deallocate( this%lflitcn) - deallocate( this%frootcn) - deallocate( this%livewdcn) - deallocate( this%deadwdcn) - deallocate( this%grperc) - deallocate( this%grpnow) - deallocate( this%rootprof_beta) - deallocate( this%graincn) - deallocate( this%mxtmp) - deallocate( this%baset) - deallocate( this%declfact) - deallocate( this%bfact) - deallocate( this%aleaff) - deallocate( this%arootf) - deallocate( this%astemf) - deallocate( this%arooti) - deallocate( this%fleafi) - deallocate( this%allconsl) - deallocate( this%allconss) - deallocate( this%ztopmx) - deallocate( this%laimx) - deallocate( this%gddmin) - deallocate( this%hybgdd) - deallocate( this%lfemerg) - deallocate( this%grnfill) - deallocate( this%mbbopt) - deallocate( this%medlynslope) - deallocate( this%medlynintercept) - deallocate( this%mxmat) - deallocate( this%mnNHplantdate) - deallocate( this%mxNHplantdate) - deallocate( this%mnSHplantdate) - deallocate( this%mxSHplantdate) - deallocate( this%planttemp) - deallocate( this%minplanttemp) - deallocate( this%froot_leaf) - deallocate( this%stem_leaf) - deallocate( this%croot_stem) - deallocate( this%flivewd) - deallocate( this%fcur) - deallocate( this%fcurdv) - deallocate( this%lf_flab) - deallocate( this%lf_fcel) - deallocate( this%lf_flig) - deallocate( this%fr_flab) - deallocate( this%fr_fcel) - deallocate( this%fr_flig) - deallocate( this%leaf_long) - deallocate( this%evergreen) - deallocate( this%stress_decid) - deallocate( this%season_decid) - deallocate( this%dwood) - deallocate( this%root_density) - deallocate( this%root_radius) - deallocate( this%pconv) - deallocate( this%pprod10) - deallocate( this%pprod100) - deallocate( this%pprodharv10) - deallocate( this%cc_leaf) - deallocate( this%cc_lstem) - deallocate( this%cc_dstem) - deallocate( this%cc_other) - deallocate( this%fm_leaf) - deallocate( this%fm_lstem) - deallocate( this%fm_dstem) - deallocate( this%fm_other) - deallocate( this%fm_root) - deallocate( this%fm_lroot) - deallocate( this%fm_droot) - deallocate( this%fsr_pft) - deallocate( this%fd_pft) - deallocate( this%manunitro) - deallocate( this%fleafcn) - deallocate( this%ffrootcn) - deallocate( this%fstemcn) - deallocate( this%i_vcad) - deallocate( this%s_vcad) - deallocate( this%i_flnr) - deallocate( this%s_flnr) - deallocate( this%pftpar20) - deallocate( this%pftpar28) - deallocate( this%pftpar29) - deallocate( this%pftpar30) - deallocate( this%pftpar31) - deallocate( this%a_fix) - deallocate( this%b_fix) - deallocate( this%c_fix) - deallocate( this%s_fix) - deallocate( this%akc_active) - deallocate( this%akn_active) - deallocate( this%ekc_active) - deallocate( this%ekn_active) - deallocate( this%kc_nonmyc) - deallocate( this%kn_nonmyc) - deallocate( this%kr_resorb) - deallocate( this%perecm) - deallocate( this%root_dmx) - deallocate( this%fun_cn_flex_a) - deallocate( this%fun_cn_flex_b) - deallocate( this%fun_cn_flex_c) - deallocate( this%FUN_fracfixers) - - end subroutine Clean - -end module pftconMod - diff --git a/src/main/readParamsMod.F90 b/src/main/readParamsMod.F90 deleted file mode 100644 index d2c2393e0f..0000000000 --- a/src/main/readParamsMod.F90 +++ /dev/null @@ -1,100 +0,0 @@ -module readParamsMod - - !----------------------------------------------------------------------- - ! - ! Read parameters - ! module used to read parameters for individual modules and/or for some - ! well defined functionality (eg. ED). - ! - ! ! USES: - use clm_varctl , only : paramfile, iulog, use_fates, use_cn - use spmdMod , only : masterproc - use fileutils , only : getfil - use ncdio_pio , only : ncd_pio_closefile, ncd_pio_openfile - use ncdio_pio , only : file_desc_t , ncd_inqdid, ncd_inqdlen - - implicit none - private - ! - public :: readParameters - - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParameters (photosyns_inst) - ! - ! ! USES: - use CNSharedParamsMod , only : CNParamsReadShared - use CNGapMortalityMod , only : readCNGapMortParams => readParams - use CNMRespMod , only : readCNMRespParams => readParams - use CNPhenologyMod , only : readCNPhenolParams => readParams - use SoilBiogeochemNLeachingMod , only : readSoilBiogeochemNLeachingParams => readParams - use SoilBiogeochemNitrifDenitrifMod , only : readSoilBiogeochemNitrifDenitrifParams => readParams - use SoilBiogeochemLittVertTranspMod , only : readSoilBiogeochemLittVertTranspParams => readParams - use SoilBiogeochemPotentialMod , only : readSoilBiogeochemPotentialParams => readParams - use SoilBiogeochemDecompMod , only : readSoilBiogeochemDecompParams => readParams - use SoilBiogeochemDecompCascadeBGCMod , only : readSoilBiogeochemDecompBgcParams => readParams - use SoilBiogeochemDecompCascadeCNMod , only : readSoilBiogeochemDecompCnParams => readParams - !use ch4Mod , only : readCH4Params => readParams - use clm_varctl, only : NLFilename_in - use PhotosynthesisMod , only : photosyns_type - ! - ! !ARGUMENTS: - type(photosyns_type) , intent(in) :: photosyns_inst - ! - ! !LOCAL VARIABLES: - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! pio netCDF file id - integer :: dimid ! netCDF dimension id - integer :: npft ! number of pfts on pft-physiology file - character(len=32) :: subname = 'readParameters' - !----------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) 'paramMod.F90::'//trim(subname)//' :: reading CLM '//' parameters ' - end if - - call getfil (paramfile, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_inqdid(ncid,'pft',dimid) - call ncd_inqdlen(ncid,dimid,npft) - - ! - ! Above ground biogeochemistry... - ! - if (use_cn) then - call readCNGapMortParams(ncid) - call readCNMRespParams(ncid) - call readCNPhenolParams(ncid) - end if - - ! - ! Soil biogeochemistry... - ! - if (use_cn .or. use_fates) then - call readSoilBiogeochemDecompBgcParams(ncid) - call readSoilBiogeochemDecompCnParams(ncid) - call readSoilBiogeochemDecompParams(ncid) - call readSoilBiogeochemLittVertTranspParams(ncid) - call readSoilBiogeochemNitrifDenitrifParams(ncid) - call readSoilBiogeochemNLeachingParams(ncid) - call readSoilBiogeochemPotentialParams(ncid) - call CNParamsReadShared(ncid, NLFilename_in) ! this is called CN params but really is for the soil biogeochem parameters - - !call readCH4Params (ncid) - end if - - ! - ! Biogeophysics - ! - call photosyns_inst%ReadParams( ncid ) - - - ! - call ncd_pio_closefile(ncid) - - end subroutine readParameters - -end module readParamsMod diff --git a/src/main/restFileMod.F90 b/src/main/restFileMod.F90 index d30d59a853..c5e2610e93 100644 --- a/src/main/restFileMod.F90 +++ b/src/main/restFileMod.F90 @@ -17,9 +17,8 @@ module restFileMod use accumulMod , only : accumulRest use clm_instMod , only : clm_instRest use histFileMod , only : hist_restart_ncd - use clm_varctl , only : iulog, use_fates, use_hydrstress - use clm_varctl , only : create_crop_landunit, irrigate - use clm_varcon , only : nameg, namel, namec, namep, nameCohort + use clm_varctl , only : iulog + use clm_varcon , only : nameg, namel, namec, namep use ncdio_pio , only : file_desc_t, ncd_pio_createfile, ncd_pio_openfile, ncd_global use ncdio_pio , only : ncd_pio_closefile, ncd_defdim, ncd_putatt, ncd_enddef, check_dim use ncdio_pio , only : check_att, ncd_getatt @@ -47,7 +46,6 @@ module restFileMod private :: restFile_add_flag_metadata ! Add global metadata for some logical flag private :: restFile_add_ilun_metadata ! Add global metadata defining landunit types private :: restFile_add_icol_metadata ! Add global metadata defining column types - private :: restFile_add_ipft_metadata ! Add global metadata defining patch types private :: restFile_dimcheck private :: restFile_enddef private :: restFile_check_consistency ! Perform consistency checks on the restart file @@ -185,7 +183,7 @@ subroutine restFile_read( bounds_proc, file, glc_behavior ) !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) do nc = 1, nclumps call get_clump_bounds(nc, bounds_clump) - call reweight_wrapup(bounds_clump, glc_behavior) + call reweight_wrapup(bounds_clump) end do !$OMP END PARALLEL DO @@ -483,8 +481,7 @@ subroutine restFile_dimset( ncid ) use clm_time_manager , only : get_nstep use clm_varctl , only : caseid, ctitle, version, username, hostname, fsurdat use clm_varctl , only : conventions, source - use clm_varpar , only : numrad, nlevlak, nlevsno, nlevgrnd, nlevurb, nlevcan - use clm_varpar , only : maxpatch_glcmec, nvegwcs + use clm_varpar , only : numrad, nlevlak, nlevsno, nlevgrnd, nlevurb use decompMod , only : get_proc_global ! ! !ARGUMENTS: @@ -513,7 +510,6 @@ subroutine restFile_dimset( ncid ) call ncd_defdim(ncid , namel , numl , dimid) call ncd_defdim(ncid , namec , numc , dimid) call ncd_defdim(ncid , namep , nump , dimid) - call ncd_defdim(ncid , nameCohort , numCohort , dimid) call ncd_defdim(ncid , 'levgrnd' , nlevgrnd , dimid) call ncd_defdim(ncid , 'levurb' , nlevurb , dimid) @@ -522,12 +518,7 @@ subroutine restFile_dimset( ncid ) call ncd_defdim(ncid , 'levsno1' , nlevsno+1 , dimid) call ncd_defdim(ncid , 'levtot' , nlevsno+nlevgrnd, dimid) call ncd_defdim(ncid , 'numrad' , numrad , dimid) - call ncd_defdim(ncid , 'levcan' , nlevcan , dimid) - if ( use_hydrstress ) then - call ncd_defdim(ncid , 'vegwcs' , nvegwcs , dimid) - end if call ncd_defdim(ncid , 'string_length', 64 , dimid) - call ncd_defdim(ncid , 'glc_nec', maxpatch_glcmec, dimid) ! mml add my soil dimension call ncd_defdim(ncid , 'mml_lev' , 10 , dimid) ! mml: hard coded for six soil layers @@ -551,8 +542,6 @@ subroutine restFile_dimset( ncid ) call ncd_putatt(ncid, NCD_GLOBAL, 'surface_dataset', trim(fsurdat)) call ncd_putatt(ncid, NCD_GLOBAL, 'title', 'CLM Restart information') - call restFile_add_flag_metadata(ncid, create_crop_landunit, 'create_crop_landunit') - call restFile_add_flag_metadata(ncid, irrigate, 'irrigate') ! BACKWARDS_COMPATIBILITY(wjs, 2017-12-13) created_glacier_mec_landunits is always ! true now. However, we can't remove the read of this field from init_interp until we ! can reliably assume that all initial conditions files that might be used in @@ -560,7 +549,6 @@ subroutine restFile_dimset( ncid ) ! hard-coded .true. value. call restFile_add_flag_metadata(ncid, .true., 'created_glacier_mec_landunits') - call restFile_add_ipft_metadata(ncid) call restFile_add_icol_metadata(ncid) call restFile_add_ilun_metadata(ncid) @@ -642,37 +630,6 @@ subroutine restFile_add_icol_metadata(ncid) end subroutine restFile_add_icol_metadata - !----------------------------------------------------------------------- - subroutine restFile_add_ipft_metadata(ncid) - ! - ! !DESCRIPTION: - ! Add global metadata defining patch types - ! - ! !USES: - use clm_varpar, only : natpft_lb, mxpft, cft_lb, cft_ub - use pftconMod , only : pftname_len, pftname - ! - ! !ARGUMENTS: - type(file_desc_t), intent(inout) :: ncid ! local file id - ! - ! !LOCAL VARIABLES: - integer :: ptype ! patch type - character(len=*), parameter :: att_prefix = 'ipft_' ! prefix for attributes - character(len=len(att_prefix)+pftname_len) :: attname ! attribute name - - character(len=*), parameter :: subname = 'restFile_add_ipft_metadata' - !----------------------------------------------------------------------- - - do ptype = natpft_lb, mxpft - attname = att_prefix // pftname(ptype) - call ncd_putatt(ncid, ncd_global, attname, ptype) - end do - - call ncd_putatt(ncid, ncd_global, 'cft_lb', cft_lb) - call ncd_putatt(ncid, ncd_global, 'cft_ub', cft_ub) - - end subroutine restFile_add_ipft_metadata - !----------------------------------------------------------------------- subroutine restFile_dimcheck( ncid ) ! @@ -714,7 +671,6 @@ subroutine restFile_dimcheck( ncid ) call check_dim(ncid, namel, numl, msg=msg) call check_dim(ncid, namec, numc, msg=msg) call check_dim(ncid, namep, nump, msg=msg) - if ( use_fates ) call check_dim(ncid, nameCohort , numCohort, msg=msg) end if call check_dim(ncid, 'levsno' , nlevsno, & msg = 'You can deal with this mismatch by rerunning with ' // & diff --git a/src/main/reweightMod.F90 b/src/main/reweightMod.F90 index 5816fa1d1b..23ad038de0 100644 --- a/src/main/reweightMod.F90 +++ b/src/main/reweightMod.F90 @@ -29,7 +29,7 @@ module reweightMod contains !----------------------------------------------------------------------- - subroutine reweight_wrapup(bounds, glc_behavior) + subroutine reweight_wrapup(bounds) ! ! !DESCRIPTION: ! Do additional modifications and error-checks that should be done after modifying subgrid @@ -42,19 +42,17 @@ subroutine reweight_wrapup(bounds, glc_behavior) use filterMod , only : setFilters use subgridWeightsMod , only : set_active, check_weights use decompMod , only : bounds_type, BOUNDS_LEVEL_CLUMP - use glcBehaviorMod , only : glc_behavior_type ! ! !ARGUMENTS: type(bounds_type) , intent(in) :: bounds ! clump bounds - type(glc_behavior_type), intent(in) :: glc_behavior !------------------------------------------------------------------------ SHR_ASSERT(bounds%level == BOUNDS_LEVEL_CLUMP, errMsg(sourcefile, __LINE__)) - call set_active(bounds, glc_behavior) + call set_active(bounds) call check_weights(bounds, active_only=.false.) call check_weights(bounds, active_only=.true.) - call setFilters(bounds, glc_behavior) + call setFilters(bounds) end subroutine reweight_wrapup diff --git a/src/main/subgridMod.F90 b/src/main/subgridMod.F90 index f844033aee..efc79616e8 100644 --- a/src/main/subgridMod.F90 +++ b/src/main/subgridMod.F90 @@ -428,13 +428,8 @@ function crop_patch_exists(gi, cft) result(exists) ! Returns true if a patch should be created in memory for the given crop functional ! type in this grid cell. ! - ! This just applies to the crop landunit: it always returns .false. if - ! create_crop_landunit is .false. - ! ! !USES: use clm_varpar , only : cft_lb, cft_ub - use clm_varctl , only : create_crop_landunit - use pftconmod , only : pftcon use landunit_varcon , only : istcrop ! ! !ARGUMENTS: @@ -447,10 +442,6 @@ function crop_patch_exists(gi, cft) result(exists) character(len=*), parameter :: subname = 'crop_patch_exists' !----------------------------------------------------------------------- - if (create_crop_landunit) then - SHR_ASSERT(cft >= cft_lb, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(cft <= cft_ub, errMsg(sourcefile, __LINE__)) - ! For a run without transient crops, only allocate memory for crops that are ! actually present in this run. (This will require running init_interp when ! changing between a transient crop run and a non-transient run.) @@ -460,10 +451,6 @@ function crop_patch_exists(gi, cft) result(exists) exists = .false. end if - else ! create_crop_landunit false - exists = .false. - end if - end function crop_patch_exists diff --git a/src/main/subgridRestMod.F90 b/src/main/subgridRestMod.F90 index 725db50351..6319f1f6eb 100644 --- a/src/main/subgridRestMod.F90 +++ b/src/main/subgridRestMod.F90 @@ -302,11 +302,6 @@ subroutine subgridRest_write_only(bounds, ncid, flag) long_name='column active flag (1=active, 0=inactive)', units=' ', & interpinic_flag='skip', readvar=readvar, data=icarr) - call restartvar(ncid=ncid, flag=flag, varname='LEVGRND_CLASS', xtype=ncd_int, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='class in which each layer falls', units=' ', & - interpinic_flag='skip', readvar=readvar, data=col%levgrnd_class) - allocate(temp2d_r(bounds%begc:bounds%endc, 1:nlevgrnd)) temp2d_r(bounds%begc:bounds%endc, 1:nlevgrnd) = col%z(bounds%begc:bounds%endc, 1:nlevgrnd) call restartvar(ncid=ncid, flag=flag, varname='COL_Z', xtype=ncd_double, & @@ -412,17 +407,6 @@ subroutine subgridRest_write_only(bounds, ncid, flag) long_name='pft active flag (1=active, 0=inactive)', units='', & interpinic_flag='skip', readvar=readvar, data=iparr) - allocate(temp2d_i(bounds%begp:bounds%endp, 1:nlevgrnd)) - do p=bounds%begp,bounds%endp - c = patch%column(p) - temp2d_i(p, 1:nlevgrnd) = col%levgrnd_class(c, 1:nlevgrnd) - end do - call restartvar(ncid=ncid, flag=flag, varname='LEVGRND_CLASS_p', xtype=ncd_int, & - dim1name='pft', dim2name='levgrnd', switchdim=.true., & - long_name='class in which each layer falls, patch-level', units=' ', & - interpinic_flag='skip', readvar=readvar, data=temp2d_i) - deallocate(temp2d_i) - allocate(temp2d_r(bounds%begp:bounds%endp, 1:nlevgrnd)) do p=bounds%begp,bounds%endp c = patch%column(p) @@ -595,7 +579,7 @@ logical function do_check_weights() ! Return true if we should check weights ! ! !USES: - use clm_varctl, only : nsrest, nsrContinue, use_cndv, use_fates + use clm_varctl, only : nsrest, nsrContinue ! ! !ARGUMENTS: ! @@ -611,14 +595,6 @@ logical function do_check_weights() ! maintaining the logic that used to be in BiogeophysRestMod regarding these ! weight checks do_check_weights = .false. - else if (use_cndv) then - ! Don't check weights for a cndv case, because the weights will almost certainly - ! differ from the surface dataset in this case - do_check_weights = .false. - else if (use_fates) then - ! Don't check weights for a fates case, because the weights will almost certainly - ! differ from the surface dataset in this case - do_check_weights = .false. else do_check_weights = .true. end if diff --git a/src/main/subgridWeightsMod.F90 b/src/main/subgridWeightsMod.F90 index d496c620f5..05dead68f0 100644 --- a/src/main/subgridWeightsMod.F90 +++ b/src/main/subgridWeightsMod.F90 @@ -92,14 +92,13 @@ module subgridWeightsMod use shr_kind_mod , only : r8 => shr_kind_r8 use shr_log_mod , only : errMsg => shr_log_errMsg use abortutils , only : endrun - use clm_varctl , only : iulog, all_active, use_fates + use clm_varctl , only : iulog use clm_varcon , only : nameg, namel, namec, namep use decompMod , only : bounds_type use GridcellType , only : grc use LandunitType , only : lun use ColumnType , only : col use PatchType , only : patch - use glcBehaviorMod , only : glc_behavior_type ! ! PUBLIC TYPES: implicit none @@ -155,7 +154,7 @@ subroutine init_subgrid_weights_mod(bounds) ! ! !USES: use landunit_varcon, only : max_lunit - use clm_varpar , only : maxpatch_glcmec, natpft_size, cft_size + use clm_varpar , only : natpft_size, cft_size use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) use decompMod , only : BOUNDS_LEVEL_PROC use histFileMod , only : hist_addfld2d @@ -183,7 +182,7 @@ subroutine init_subgrid_weights_mod(bounds) subgrid_weights_diagnostics%pct_nat_pft(:,:) = nan allocate(subgrid_weights_diagnostics%pct_cft(bounds%begg:bounds%endg, 1:cft_size)) subgrid_weights_diagnostics%pct_cft(:,:) = nan - allocate(subgrid_weights_diagnostics%pct_glc_mec(bounds%begg:bounds%endg, 1:maxpatch_glcmec)) + allocate(subgrid_weights_diagnostics%pct_glc_mec(bounds%begg:bounds%endg, 1:10)) subgrid_weights_diagnostics%pct_glc_mec(:,:) = nan ! ------------------------------------------------------------------------ @@ -194,22 +193,10 @@ subroutine init_subgrid_weights_mod(bounds) avgflag='A', long_name='% of each landunit on grid cell', & ptr_lnd=subgrid_weights_diagnostics%pct_landunit, default='inactive') - if(.not.use_fates) then - call hist_addfld2d (fname='PCT_NAT_PFT', units='%', type2d='natpft', & - avgflag='A', long_name='% of each PFT on the natural vegetation (i.e., soil) landunit', & - ptr_lnd=subgrid_weights_diagnostics%pct_nat_pft, default='inactive') - end if + call hist_addfld2d (fname='PCT_NAT_PFT', units='%', type2d='natpft', & + avgflag='A', long_name='% of each PFT on the natural vegetation (i.e., soil) landunit', & + ptr_lnd=subgrid_weights_diagnostics%pct_nat_pft, default='inactive') - if (cft_size > 0) then - call hist_addfld2d (fname='PCT_CFT', units='%', type2d='cft', & - avgflag='A', long_name='% of each crop on the crop landunit', & - ptr_lnd=subgrid_weights_diagnostics%pct_cft, default='inactive') - end if - - call hist_addfld2d (fname='PCT_GLC_MEC', units='%', type2d='glc_nec', & - avgflag='A', long_name='% of each GLC elevation class on the glc_mec landunit', & - ptr_lnd=subgrid_weights_diagnostics%pct_glc_mec, default='inactive') - end subroutine init_subgrid_weights_mod @@ -243,7 +230,7 @@ subroutine compute_higher_order_weights(bounds) end subroutine compute_higher_order_weights !----------------------------------------------------------------------- - subroutine set_active(bounds, glc_behavior) + subroutine set_active(bounds) ! ! !DESCRIPTION: ! Set 'active' flags at the pft, column and landunit level @@ -260,7 +247,6 @@ subroutine set_active(bounds, glc_behavior) ! !ARGUMENTS: implicit none type(bounds_type), intent(in) :: bounds ! bounds - type(glc_behavior_type), intent(in) :: glc_behavior ! ! !LOCAL VARIABLES: integer :: l,c,p ! loop counters @@ -269,12 +255,12 @@ subroutine set_active(bounds, glc_behavior) !------------------------------------------------------------------------ do l = bounds%begl,bounds%endl - lun%active(l) = is_active_l(l, glc_behavior) + lun%active(l) = is_active_l(l) end do do c = bounds%begc,bounds%endc l = col%landunit(c) - col%active(c) = is_active_c(c, glc_behavior) + col%active(c) = is_active_c(c) if (col%active(c) .and. .not. lun%active(l)) then write(iulog,*) trim(subname),' ERROR: active column found on inactive landunit', & 'at c = ', c, ', l = ', l @@ -295,7 +281,7 @@ subroutine set_active(bounds, glc_behavior) end subroutine set_active !----------------------------------------------------------------------- - logical function is_active_l(l, glc_behavior) + logical function is_active_l(l) ! ! !DESCRIPTION: ! Determine whether the given landunit is active @@ -306,16 +292,11 @@ logical function is_active_l(l, glc_behavior) ! !ARGUMENTS: implicit none integer, intent(in) :: l ! landunit index - type(glc_behavior_type), intent(in) :: glc_behavior ! ! !LOCAL VARIABLES: integer :: g ! grid cell index !------------------------------------------------------------------------ - if (all_active) then - is_active_l = .true. - - else g =lun%gridcell(l) is_active_l = .false. @@ -326,15 +307,6 @@ logical function is_active_l(l, glc_behavior) ! ------------------------------------------------------------------------ if (lun%wtgcell(l) > 0) is_active_l = .true. - ! ------------------------------------------------------------------------ - ! Conditions under which is_active_p is set to true because we want extra virtual landunits: - ! ------------------------------------------------------------------------ - - if (lun%itype(l) == istice_mec .and. & - glc_behavior%has_virtual_columns_grc(g)) then - is_active_l = .true. - end if - ! In general, include a virtual natural vegetation landunit. This aids ! initialization of a new landunit; and for runs that are coupled to CISM, this ! provides bare land SMB forcing even if there is no vegetated area. @@ -357,12 +329,10 @@ logical function is_active_l(l, glc_behavior) is_active_l = .true. end if - end if - end function is_active_l !----------------------------------------------------------------------- - logical function is_active_c(c, glc_behavior) + logical function is_active_c(c) ! ! !DESCRIPTION: ! Determine whether the given column is active @@ -373,17 +343,12 @@ logical function is_active_c(c, glc_behavior) ! !ARGUMENTS: implicit none integer, intent(in) :: c ! column index - type(glc_behavior_type), intent(in) :: glc_behavior ! ! !LOCAL VARIABLES: integer :: l ! landunit index integer :: g ! grid cell index !------------------------------------------------------------------------ - if (all_active) then - is_active_c = .true. - - else l =col%landunit(c) g =col%gridcell(c) @@ -395,15 +360,6 @@ logical function is_active_c(c, glc_behavior) ! ------------------------------------------------------------------------ if (lun%active(l) .and. col%wtlunit(c) > 0._r8) is_active_c = .true. - ! ------------------------------------------------------------------------ - ! Conditions under which is_active_c is set to true because we want extra virtual columns: - ! ------------------------------------------------------------------------ - - if (lun%itype(l) == istice_mec .and. & - glc_behavior%has_virtual_columns_grc(g)) then - is_active_c = .true. - end if - ! We don't really need to run over 0-weight urban columns. But because of some ! messiness in the urban code (many loops are over the landunit filter, then drill ! down to columns - so we would need to add 'col%active(c)' conditionals in many @@ -413,7 +369,6 @@ logical function is_active_c(c, glc_behavior) if (lun%active(l) .and. (lun%itype(l) >= isturb_MIN .and. lun%itype(l) <= isturb_MAX)) then is_active_c = .true. end if - end if end function is_active_c @@ -433,10 +388,6 @@ logical function is_active_p(p) integer :: c ! column index !------------------------------------------------------------------------ - if (all_active) then - is_active_p = .true. - - else c =patch%column(p) is_active_p = .false. @@ -447,8 +398,6 @@ logical function is_active_p(p) ! ------------------------------------------------------------------------ if (col%active(c) .and. patch%wtcol(p) > 0._r8) is_active_p = .true. - end if - end function is_active_p !----------------------------------------------------------------------- @@ -733,8 +682,6 @@ subroutine set_subgrid_diagnostic_fields(bounds) call set_pct_landunit_diagnostics(bounds) - ! Note: (MV, 10-17-14): The following has an use_fates if-block around it since - ! the pct_pft_diagnostics referens to patch%itype(p) which is not used by ED ! Note: (SPM, 10-20-15): If this isn't set then debug mode with intel and ! yellowstone will fail when trying to write pct_nat_pft since it contains ! all NaN's. @@ -845,7 +792,7 @@ subroutine set_pct_pft_diagnostics(bounds) g = patch%gridcell(p) l = patch%landunit(p) ptype = patch%itype(p) - if (lun%itype(l) == istsoil .and. (.not.use_fates) ) then + if (lun%itype(l) == istsoil) then ptype_1indexing = ptype + (1 - natpft_lb) subgrid_weights_diagnostics%pct_nat_pft(g, ptype_1indexing) = patch%wtlunit(p) * 100._r8 else if (lun%itype(l) == istcrop) then diff --git a/src/main/surfrdMod.F90 b/src/main/surfrdMod.F90 index ef593b1a6e..3aac15ea8f 100644 --- a/src/main/surfrdMod.F90 +++ b/src/main/surfrdMod.F90 @@ -14,8 +14,7 @@ module surfrdMod use landunit_varcon , only : numurbl use clm_varcon , only : grlnd use clm_varctl , only : iulog, scmlat, scmlon, single_column - use clm_varctl , only : use_cndv, use_crop - use surfrdUtilsMod , only : check_sums_equal_1, collapse_crop_types + use surfrdUtilsMod , only : check_sums_equal_1 use ncdio_pio , only : file_desc_t, var_desc_t, ncd_pio_openfile, ncd_pio_closefile use ncdio_pio , only : ncd_io, check_var, ncd_inqfdims, check_dim, ncd_inqdid use pio @@ -33,7 +32,6 @@ module surfrdMod ! !PRIVATE MEMBER FUNCTIONS: private :: surfrd_special ! Read the special landunits private :: surfrd_veg_all ! Read all of the vegetated landunits - private :: surfrd_veg_dgvm ! Read vegetated landunits for DGVM mode private :: surfrd_pftformat ! Read crop pfts in file format where they are part of the vegetated land unit private :: surfrd_cftformat ! Read crop pfts in file format where they are on their own landunit ! @@ -305,7 +303,6 @@ subroutine surfrd_get_data (begg, endg, ldomain, lfsurdat) ! o real % abundance PFTs (as a percent of vegetated area) ! ! !USES: - use clm_varctl , only : create_crop_landunit use fileutils , only : getfil use domainMod , only : domain_type, domain_init, domain_clean use clm_instur , only : wt_lunit, topo_glc_mec @@ -418,10 +415,6 @@ subroutine surfrd_get_data (begg, endg, ldomain, lfsurdat) call surfrd_veg_all(begg, endg, ncid, ldomain%ns) - if (use_cndv) then - call surfrd_veg_dgvm(begg, endg) - end if - call ncd_pio_closefile(ncid) call check_sums_equal_1(wt_lunit, begg, 'wt_lunit', subname) @@ -441,10 +434,9 @@ subroutine surfrd_special(begg, endg, ncid, ns) ! as soil color and percent sand and clay ! ! !USES: - use clm_varpar , only : maxpatch_glcmec, nlevurb + use clm_varpar , only : nlevurb use landunit_varcon , only : isturb_MIN, isturb_MAX, istdlak, istwet, istice_mec use clm_instur , only : wt_lunit, urban_valid, wt_glc_mec, topo_glc_mec - use UrbanParamsType , only : CheckUrban ! ! !ARGUMENTS: integer , intent(in) :: begg, endg @@ -472,6 +464,10 @@ subroutine surfrd_special(begg, endg, ncid, ns) integer, parameter :: urban_invalid_region = 0 ! urban_region_id indicating invalid point !----------------------------------------------------------------------- + ! TODO slevis SLIM: Attempted to not read special landunits, leave their + ! wt_lunit = 0, and remove calls to check_sums and check_weights that were + ! triggered. Outcome was an error in the sea-ice model: + ! "ice_therm_mushy solver failure" allocate(pctgla(begg:endg)) allocate(pctlak(begg:endg)) allocate(pctwet(begg:endg)) @@ -531,8 +527,8 @@ subroutine surfrd_special(begg, endg, ncid, ns) ! Read glacier info - call check_dim(ncid, 'nglcec', maxpatch_glcmec ) - call check_dim(ncid, 'nglcecp1', maxpatch_glcmec+1 ) + call check_dim(ncid, 'nglcec', 10) + call check_dim(ncid, 'nglcecp1', 11) call ncd_io(ncid=ncid, varname='PCT_GLC_MEC', flag='read', data=wt_glc_mec, & dim1name=grlnd, readvar=readvar) @@ -582,8 +578,6 @@ subroutine surfrd_special(begg, endg, ncid, ns) end do - call CheckUrban(begg, endg, pcturb(begg:endg,:), subname) - deallocate(pctgla,pctlak,pctwet,pcturb,pcturb_tot,urban_region_id,pctspec) end subroutine surfrd_special @@ -595,7 +589,7 @@ subroutine surfrd_cftformat( ncid, begg, endg, wt_cft, cftsize, natpft_size ) ! Handle generic crop types for file format where they are on their own ! crop landunit and read in as Crop Function Types. ! !USES: - use clm_instur , only : fert_cft, wt_nat_patch + use clm_instur , only : wt_nat_patch use clm_varpar , only : cft_size, cft_lb, natpft_lb ! !ARGUMENTS: implicit none @@ -622,18 +616,6 @@ subroutine surfrd_cftformat( ncid, begg, endg, wt_cft, cftsize, natpft_size ) dim1name=grlnd, readvar=readvar) if (.not. readvar) call endrun( msg=' ERROR: PCT_CFT NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - if ( cft_size > 0 )then - call ncd_io(ncid=ncid, varname='CONST_FERTNITRO_CFT', flag='read', data=fert_cft, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - if ( masterproc ) & - write(iulog,*) ' WARNING: CONST_FERTNITRO_CFT NOT on surfdata file zero out' - fert_cft = 0.0_r8 - end if - else - fert_cft = 0.0_r8 - end if - allocate( array2D(begg:endg,1:natpft_size) ) call ncd_io(ncid=ncid, varname='PCT_NAT_PFT', flag='read', data=array2D, & dim1name=grlnd, readvar=readvar) @@ -650,7 +632,7 @@ subroutine surfrd_pftformat( begg, endg, ncid ) ! Handle generic crop types for file format where they are part of the ! natural vegetation landunit. ! !USES: - use clm_instur , only : fert_cft, wt_nat_patch + use clm_instur , only : wt_nat_patch use clm_varpar , only : natpft_size, cft_size, natpft_lb ! !ARGUMENTS: implicit none @@ -678,15 +660,6 @@ subroutine surfrd_pftformat( begg, endg, ncid ) ' must also have a separate crop landunit, and vice versa)'//& errMsg(sourcefile, __LINE__)) end if - call ncd_io(ncid=ncid, varname='CONST_FERTNITRO_CFT', flag='read', data=fert_cft, & - dim1name=grlnd, readvar=readvar) - if (readvar) then - call endrun( msg= ' ERROR: unexpectedly found CONST_FERTNITRO_CFT on dataset when cft_size=0'// & - ' (if the surface dataset has a separate crop landunit, then the code'// & - ' must also have a separate crop landunit, and vice versa)'//& - errMsg(sourcefile, __LINE__)) - end if - fert_cft = 0.0_r8 call ncd_io(ncid=ncid, varname='PCT_NAT_PFT', flag='read', data=wt_nat_patch, & dim1name=grlnd, readvar=readvar) @@ -701,11 +674,9 @@ subroutine surfrd_veg_all(begg, endg, ncid, ns) ! Determine weight arrays for non-dynamic landuse mode ! ! !USES: - use clm_varctl , only : create_crop_landunit, use_fates use clm_varpar , only : natpft_lb, natpft_ub, natpft_size, cft_size, cft_lb - use clm_instur , only : wt_lunit, wt_nat_patch, wt_cft, fert_cft + use clm_instur , only : wt_lunit, wt_nat_patch, wt_cft use landunit_varcon , only : istsoil, istcrop - use surfrdUtilsMod , only : convert_cft_to_pft ! ! !ARGUMENTS: implicit none @@ -746,25 +717,7 @@ subroutine surfrd_veg_all(begg, endg, ncid, ns) ! Check the file format for CFT's and handle accordingly call ncd_inqdid(ncid, 'cft', dimid, cft_dim_exists) - if ( cft_dim_exists .and. create_crop_landunit )then - call surfrd_cftformat( ncid, begg, endg, wt_cft, cft_size, natpft_size ) ! Format where CFT's is read in a seperate landunit - else if ( (.not. cft_dim_exists) .and. (.not. create_crop_landunit) )then - if ( masterproc ) write(iulog,*) "WARNING: The PFT format is an unsupported format that will be removed in th future!" - call surfrd_pftformat( begg, endg, ncid ) ! Format where crop is part of the natural veg. landunit - else if ( cft_dim_exists .and. .not. create_crop_landunit )then - if ( masterproc ) write(iulog,*) "WARNING: New CFT-based format surface datasets should be run with create_crop_landunit=T" - if ( use_fates ) then - if ( masterproc ) write(iulog,*) "WARNING: When fates is on we allow new CFT based surface datasets ", & - "to be used with create_crop_land FALSE" - cftsize = 2 - allocate(array2D(begg:endg,cft_lb:cftsize-1+cft_lb)) - call surfrd_cftformat( ncid, begg, endg, array2D, cftsize, natpft_size-cftsize ) ! Read crops in as CFT's - call convert_cft_to_pft( begg, endg, cftsize, array2D ) ! Convert from CFT to natural veg. landunit - deallocate(array2D) - else - call endrun( msg=' ERROR: New format surface datasets require create_crop_landunit TRUE'//errMsg(sourcefile, __LINE__)) - end if - end if + call surfrd_cftformat( ncid, begg, endg, wt_cft, cft_size, natpft_size ) ! Format where CFT's is read in a seperate landunit ! Do some checking @@ -784,36 +737,6 @@ subroutine surfrd_veg_all(begg, endg, ncid, ns) wt_nat_patch(begg:endg,:) = wt_nat_patch(begg:endg,:) / 100._r8 call check_sums_equal_1(wt_nat_patch, begg, 'wt_nat_patch', subname) - ! Collapse crop landunits down when prognostic crops are on - if (use_crop) then - call collapse_crop_types(wt_cft(begg:endg, :), fert_cft(begg:endg, :), begg, endg, verbose=.true.) - end if - end subroutine surfrd_veg_all - !----------------------------------------------------------------------- - subroutine surfrd_veg_dgvm(begg, endg) - ! - ! !DESCRIPTION: - ! Determine weights for CNDV mode. - ! - ! !USES: - use pftconMod , only : noveg - use clm_instur, only : wt_nat_patch - ! - ! !ARGUMENTS: - integer, intent(in) :: begg, endg - ! - ! !LOCAL VARIABLES: - character(len=*), parameter :: subname = 'surfrd_veg_dgvm' - !----------------------------------------------------------------------- - - ! Bare ground gets 100% weight; all other natural patches are zeroed out - wt_nat_patch(begg:endg, :) = 0._r8 - wt_nat_patch(begg:endg, noveg) = 1._r8 - - call check_sums_equal_1(wt_nat_patch, begg, 'wt_nat_patch', subname) - - end subroutine surfrd_veg_dgvm - end module surfrdMod diff --git a/src/main/surfrdUtilsMod.F90 b/src/main/surfrdUtilsMod.F90 index 45fbf9ebe1..0ca58f71f7 100644 --- a/src/main/surfrdUtilsMod.F90 +++ b/src/main/surfrdUtilsMod.F90 @@ -20,8 +20,6 @@ module surfrdUtilsMod ! !PUBLIC MEMBER FUNCTIONS: public :: check_sums_equal_1 ! Confirm that sum(arr(n,:)) == 1 for all n public :: renormalize ! Renormalize an array - public :: convert_cft_to_pft ! Conversion of crop CFT to natural veg PFT:w - public :: collapse_crop_types ! Collapse unused crop types into types used in this run character(len=*), parameter, private :: sourcefile = & __FILE__ @@ -100,144 +98,4 @@ subroutine renormalize(arr, lb, normal) end subroutine renormalize -!----------------------------------------------------------------------- - subroutine convert_cft_to_pft( begg, endg, cftsize, wt_cft ) - ! - ! !DESCRIPTION: - ! Convert generic crop types that were read in as seperate CFT's on - ! a crop landunit, and put them on the vegetated landunit. - ! !USES: - use clm_instur , only : wt_lunit, wt_nat_patch, fert_cft - use clm_varpar , only : cft_size, natpft_size - use pftconMod , only : nc3crop - use landunit_varcon , only : istsoil, istcrop - ! !ARGUMENTS: - implicit none - integer , intent(in) :: begg, endg - integer , intent(in) :: cftsize ! CFT size - real(r8) , intent(inout) :: wt_cft(begg:,:) ! CFT weights - ! - ! !LOCAL VARIABLES: - integer :: g ! index -!----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(wt_cft) == (/endg, cftsize/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(wt_nat_patch) == (/endg, nc3crop+cftsize-1/)), errMsg(sourcefile, __LINE__)) - - do g = begg, endg - if ( wt_lunit(g,istcrop) > 0.0_r8 )then - ! Move CFT over to PFT and do weighted average of the crop and soil parts - wt_nat_patch(g,:) = wt_nat_patch(g,:) * wt_lunit(g,istsoil) - wt_cft(g,:) = wt_cft(g,:) * wt_lunit(g,istcrop) - wt_nat_patch(g,nc3crop:) = wt_cft(g,:) ! Add crop CFT's to end of natural veg PFT's - wt_lunit(g,istsoil) = (wt_lunit(g,istsoil) + wt_lunit(g,istcrop)) ! Add crop landunit to soil landunit - wt_nat_patch(g,:) = wt_nat_patch(g,:) / wt_lunit(g,istsoil) - wt_lunit(g,istcrop) = 0.0_r8 ! Zero out crop CFT's - else - wt_nat_patch(g,nc3crop:) = 0.0_r8 ! Make sure generic crops are zeroed out - end if - end do - - end subroutine convert_cft_to_pft - - !----------------------------------------------------------------------- - subroutine collapse_crop_types(wt_cft, fert_cft, begg, endg, verbose) - ! - ! !DESCRIPTION: - ! Collapse unused crop types into types used in this run. - ! - ! Should only be called if using prognostic crops - otherwise, wt_cft is meaningless - ! - ! !USES: - use clm_varctl , only : irrigate - use clm_varpar , only : cft_lb, cft_ub, cft_size - use pftconMod , only : nc3crop, nc3irrig, npcropmax, pftcon - ! - ! !ARGUMENTS: - - ! Note that we use begg and endg rather than 'bounds', because bounds may not be - ! available yet when this is called - integer, intent(in) :: begg ! Beginning grid cell index - integer, intent(in) :: endg ! Ending grid cell index - - ! Weight and fertilizer of each CFT in each grid cell; dimensioned [g, cft_lb:cft_ub] - ! This array is modified in-place - real(r8), intent(inout) :: wt_cft(begg:, cft_lb:) - real(r8), intent(inout) :: fert_cft(begg:, cft_lb:) - - logical, intent(in) :: verbose ! If true, print some extra information - ! - ! !LOCAL VARIABLES: - integer :: g - integer :: m - real(r8) :: wt_cft_to - real(r8) :: wt_cft_from - real(r8) :: wt_cft_merge - - character(len=*), parameter :: subname = 'collapse_crop_types' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(wt_cft) == (/endg, cft_ub/)), errMsg(sourcefile, __LINE__)) - - if (cft_size <= 0) then - call endrun(msg = subname//' can only be called if cft_size > 0' // & - errMsg(sourcefile, __LINE__)) - end if - - ! ------------------------------------------------------------------------ - ! If not using irrigation, merge irrigated CFTs into rainfed CFTs - ! ------------------------------------------------------------------------ - - if (.not. irrigate) then - if (verbose .and. masterproc) then - write(iulog,*) trim(subname)//' crop=.T. and irrigate=.F., so merging irrigated pfts with rainfed' - end if - - do g = begg, endg - ! Left Hand Side: merged rainfed+irrigated crop pfts from nc3crop to - ! npcropmax-1, stride 2 - ! Right Hand Side: rainfed crop pfts from nc3crop to npcropmax-1, - ! stride 2 - ! plus irrigated crop pfts from nc3irrig to npcropmax, - ! stride 2 - ! where stride 2 means "every other" - wt_cft(g, nc3crop:npcropmax-1:2) = & - wt_cft(g, nc3crop:npcropmax-1:2) + wt_cft(g, nc3irrig:npcropmax:2) - wt_cft(g, nc3irrig:npcropmax:2) = 0._r8 - end do - - call check_sums_equal_1(wt_cft, begg, 'wt_cft', subname//': irrigation') - end if - - ! ------------------------------------------------------------------------ - ! Merge CFTs into the list of crops that CLM knows how to model - ! ------------------------------------------------------------------------ - - if (verbose .and. masterproc) then - write(iulog, *) trim(subname) // ' merging wheat, barley, and rye into temperate cereals' - write(iulog, *) trim(subname) // ' clm knows how to model corn, temperate cereals, and soybean' - write(iulog, *) trim(subname) // ' all other crops are lumped with the generic crop pft' - end if - - do g = begg, endg - do m = 1, npcropmax - if (m /= pftcon%mergetoclmpft(m)) then - wt_cft_to = wt_cft(g, pftcon%mergetoclmpft(m)) - wt_cft_from = wt_cft(g, m) - wt_cft_merge = wt_cft_to + wt_cft_from - wt_cft(g, pftcon%mergetoclmpft(m)) = wt_cft_merge - wt_cft(g, m) = 0._r8 - if (wt_cft_merge > 0._r8) then - fert_cft(g,pftcon%mergetoclmpft(m)) = (wt_cft_to * fert_cft(g,pftcon%mergetoclmpft(m)) + & - wt_cft_from * fert_cft(g,m)) / wt_cft_merge - end if - end if - end do - - end do - - call check_sums_equal_1(wt_cft, begg, 'wt_cft', subname//': mergetoclmpft') - - end subroutine collapse_crop_types - - end module surfrdUtilsMod diff --git a/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 b/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 deleted file mode 100644 index d4d296256e..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 +++ /dev/null @@ -1,825 +0,0 @@ -module SoilBiogeochemCarbonFluxType - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools, nlevcan - use clm_varpar , only : nlevdecomp_full, nlevgrnd, nlevdecomp, nlevsoi - use clm_varcon , only : spval, ispval, dzsoi_decomp - use landunit_varcon , only : istsoil, istcrop, istdlak - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use ColumnType , only : col - use LandunitType , only : lun - use clm_varctl , only : use_fates - - ! - ! !PUBLIC TYPES: - implicit none - private - ! - type, public :: soilbiogeochem_carbonflux_type - - ! fire fluxes - real(r8), pointer :: somc_fire_col (:) ! (gC/m2/s) carbon emissions due to peat burning - - ! decomposition fluxes - real(r8), pointer :: decomp_cpools_sourcesink_col (:,:,:) ! change in decomposing c pools. Used to update concentrations concurrently with vertical transport (gC/m3/timestep) - real(r8), pointer :: decomp_cascade_hr_vr_col (:,:,:) ! vertically-resolved het. resp. from decomposing C pools (gC/m3/s) - real(r8), pointer :: decomp_cascade_hr_col (:,:) ! vertically-integrated (diagnostic) het. resp. from decomposing C pools (gC/m2/s) - real(r8), pointer :: decomp_cascade_ctransfer_vr_col (:,:,:) ! vertically-resolved C transferred along deomposition cascade (gC/m3/s) - real(r8), pointer :: decomp_cascade_ctransfer_col (:,:) ! vertically-integrated (diagnostic) C transferred along decomposition cascade (gC/m2/s) - real(r8), pointer :: decomp_k_col (:,:,:) ! rate constant for decomposition (1./sec) - real(r8), pointer :: hr_vr_col (:,:) ! (gC/m3/s) total vertically-resolved het. resp. from decomposing C pools - real(r8), pointer :: o_scalar_col (:,:) ! fraction by which decomposition is limited by anoxia - real(r8), pointer :: w_scalar_col (:,:) ! fraction by which decomposition is limited by moisture availability - real(r8), pointer :: t_scalar_col (:,:) ! fraction by which decomposition is limited by temperature - real(r8), pointer :: som_c_leached_col (:) ! (gC/m^2/s) total SOM C loss from vertical transport - real(r8), pointer :: decomp_cpools_leached_col (:,:) ! (gC/m^2/s) C loss from vertical transport from each decomposing C pool - real(r8), pointer :: decomp_cpools_transport_tendency_col (:,:,:) ! (gC/m^3/s) C tendency due to vertical transport in decomposing C pools - - ! nitrif_denitrif - real(r8), pointer :: phr_vr_col (:,:) ! (gC/m3/s) potential hr (not N-limited) - real(r8), pointer :: fphr_col (:,:) ! fraction of potential heterotrophic respiration - - real(r8), pointer :: hr_col (:) ! (gC/m2/s) total heterotrophic respiration - real(r8), pointer :: lithr_col (:) ! (gC/m2/s) litter heterotrophic respiration - real(r8), pointer :: somhr_col (:) ! (gC/m2/s) soil organic matter heterotrophic res - real(r8), pointer :: soilc_change_col (:) ! (gC/m2/s) FUN used soil C - - ! fluxes to receive carbon inputs from FATES - real(r8), pointer :: FATES_c_to_litr_lab_c_col (:,:) ! total labile litter coming from ED. gC/m3/s - real(r8), pointer :: FATES_c_to_litr_cel_c_col (:,:) ! total cellulose litter coming from ED. gC/m3/s - real(r8), pointer :: FATES_c_to_litr_lig_c_col (:,:) ! total lignin litter coming from ED. gC/m3/s - - contains - - procedure , public :: Init - procedure , private :: InitAllocate - procedure , private :: InitHistory - procedure , private :: InitCold - procedure , public :: Restart - procedure , public :: SetValues - procedure , public :: Summary - - end type soilbiogeochem_carbonflux_type - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, carbon_type) - - class(soilbiogeochem_carbonflux_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=3) , intent(in) :: carbon_type ! one of ['c12', c13','c14'] - - call this%InitAllocate ( bounds) - call this%InitHistory ( bounds, carbon_type ) - call this%InitCold (bounds ) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !ARGUMENTS: - class (soilbiogeochem_carbonflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp,endp - integer :: begc,endc - !------------------------------------------------------------------------ - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - allocate(this%t_scalar_col (begc:endc,1:nlevdecomp_full)); this%t_scalar_col (:,:) =spval - allocate(this%w_scalar_col (begc:endc,1:nlevdecomp_full)); this%w_scalar_col (:,:) =spval - allocate(this%o_scalar_col (begc:endc,1:nlevdecomp_full)); this%o_scalar_col (:,:) =spval - allocate(this%phr_vr_col (begc:endc,1:nlevdecomp_full)); this%phr_vr_col (:,:) =nan - allocate(this%fphr_col (begc:endc,1:nlevgrnd)) ; this%fphr_col (:,:) =nan - allocate(this%som_c_leached_col (begc:endc)) ; this%som_c_leached_col (:) =nan - allocate(this%somc_fire_col (begc:endc)) ; this%somc_fire_col (:) =nan - allocate(this%hr_vr_col (begc:endc,1:nlevdecomp_full)); this%hr_vr_col (:,:) =nan - - allocate(this%decomp_cpools_sourcesink_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools)) - this%decomp_cpools_sourcesink_col(:,:,:)= nan - - allocate(this%decomp_cascade_hr_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions)) - this%decomp_cascade_hr_vr_col(:,:,:)= spval - - allocate(this%decomp_cascade_hr_col(begc:endc,1:ndecomp_cascade_transitions)) - this%decomp_cascade_hr_col(:,:)= nan - - allocate(this%decomp_cascade_ctransfer_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions)) - this%decomp_cascade_ctransfer_vr_col(:,:,:)= nan - - allocate(this%decomp_cascade_ctransfer_col(begc:endc,1:ndecomp_cascade_transitions)) - this%decomp_cascade_ctransfer_col(:,:)= nan - - allocate(this%decomp_k_col(begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions)) - this%decomp_k_col(:,:,:)= spval - - allocate(this%decomp_cpools_leached_col(begc:endc,1:ndecomp_pools)) - this%decomp_cpools_leached_col(:,:)= nan - - allocate(this%decomp_cpools_transport_tendency_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools)) - this%decomp_cpools_transport_tendency_col(:,:,:)= nan - - allocate(this%hr_col (begc:endc)) ; this%hr_col (:) = nan - allocate(this%lithr_col (begc:endc)) ; this%lithr_col (:) = nan - allocate(this%somhr_col (begc:endc)) ; this%somhr_col (:) = nan - allocate(this%soilc_change_col (begc:endc)) ; this%soilc_change_col (:) = nan - - if ( use_fates ) then - ! initialize these variables to be zero rather than a bad number since they are not zeroed every timestep (due to a need for them to persist) - - allocate(this%FATES_c_to_litr_lab_c_col(begc:endc,1:nlevdecomp_full)) - this%FATES_c_to_litr_lab_c_col(begc:endc,1:nlevdecomp_full) = 0._r8 - - allocate(this%FATES_c_to_litr_cel_c_col(begc:endc,1:nlevdecomp_full)) - this%FATES_c_to_litr_cel_c_col(begc:endc,1:nlevdecomp_full) = 0._r8 - - allocate(this%FATES_c_to_litr_lig_c_col(begc:endc,1:nlevdecomp_full)) - this%FATES_c_to_litr_lig_c_col(begc:endc,1:nlevdecomp_full) = 0._r8 - - endif - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds, carbon_type) - ! - ! !DESCRIPTION: - ! add history fields for all CN variables, always set as default='inactive' - ! - ! !USES: - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools - use clm_varpar , only : nlevdecomp, nlevdecomp_full - use clm_varctl , only : hist_wrtch4diag - use histFileMod, only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp - ! - ! !ARGUMENTS: - class(soilbiogeochem_carbonflux_type) :: this - type(bounds_type) , intent(in) :: bounds - character(len=3) , intent(in) :: carbon_type ! one of ['c12', c13','c14'] - ! - ! !LOCAL VARIABLES: - integer :: k,l,ii,jj,c - character(8) :: vr_suffix - character(10) :: active - integer :: begp,endp - integer :: begc,endc - character(24) :: fieldname - character(100) :: longname - real(r8), pointer :: data1dptr(:) ! temp. pointer for slicing larger arrays - real(r8), pointer :: data2dptr(:,:) ! temp. pointer for slicing larger arrays - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - if (nlevdecomp > 1) then - vr_suffix = "_vr" - else - vr_suffix = "" - endif - - !------------------------------- - ! C flux variables - native to column - !------------------------------- - - ! add history fields for all CLAMP CN variables - - if (carbon_type == 'c12') then - - this%hr_col(begc:endc) = spval - call hist_addfld1d (fname='HR', units='gC/m^2/s', & - avgflag='A', long_name='total heterotrophic respiration', & - ptr_col=this%hr_col, default='inactive') - - this%lithr_col(begc:endc) = spval - call hist_addfld1d (fname='LITTERC_HR', units='gC/m^2/s', & - avgflag='A', long_name='litter C heterotrophic respiration', & - ptr_col=this%lithr_col, default='inactive') - - this%somhr_col(begc:endc) = spval - call hist_addfld1d (fname='SOILC_HR', units='gC/m^2/s', & - avgflag='A', long_name='soil C heterotrophic respiration', & - ptr_col=this%somhr_col, default='inactive') - - if (hist_wrtch4diag) then - this%fphr_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld_decomp (fname='FPHR'//trim(vr_suffix), units='unitless', type2d='levdcmp', & - avgflag='A', long_name='fraction of potential HR due to N limitation', & - ptr_col=this%fphr_col, default='inactive') - end if - - this%somc_fire_col(begc:endc) = spval - call hist_addfld1d (fname='SOMC_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='C loss due to peat burning', & - ptr_col=this%somc_fire_col, default='inactive') - - do k = 1, ndecomp_pools - ! decomposition k - data2dptr => this%decomp_k_col(:,:,k) - fieldname = 'K_'//trim(decomp_cascade_con%decomp_pool_name_history(k)) - longname = trim(decomp_cascade_con%decomp_pool_name_long(k))//' potential loss coefficient' - call hist_addfld_decomp (fname=fieldname, units='1/s', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - end do - - this%decomp_cascade_hr_col(begc:endc,:) = spval - this%decomp_cascade_hr_vr_col(begc:endc,:,:) = spval - this%decomp_cascade_ctransfer_col(begc:endc,:) = spval - this%decomp_cascade_ctransfer_vr_col(begc:endc,:,:) = spval - do l = 1, ndecomp_cascade_transitions - - ! output the vertically integrated fluxes only as default - !-- HR fluxes (none from CWD) - if ( .not. decomp_cascade_con%is_cwd(decomp_cascade_con%cascade_donor_pool(l)) ) then - data1dptr => this%decomp_cascade_hr_col(:,l) - ! check to see if there are multiple pathways that include respiration, and if so, note that in the history file - ii = 0 - do jj = 1, ndecomp_cascade_transitions - if ( decomp_cascade_con%cascade_donor_pool(jj) == decomp_cascade_con%cascade_donor_pool(l) ) ii = ii+1 - end do - if ( ii == 1 ) then - fieldname = & - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//'_HR' - else - fieldname = & - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//'_HR_'//& - trim(decomp_cascade_con%decomp_pool_name_short(decomp_cascade_con%cascade_receiver_pool(l))) - endif - longname = 'Het. Resp. from '//& - trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l))) - call hist_addfld1d (fname=fieldname, units='gC/m^2/s', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - endif - - !-- transfer fluxes (none from terminal pool, if present) - if ( decomp_cascade_con%cascade_receiver_pool(l) /= 0 ) then - data1dptr => this%decomp_cascade_ctransfer_col(:,l) - fieldname = & - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//'C_TO_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l)))//'C' - longname = 'decomp. of '//trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l)))//& - ' C to '//trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_receiver_pool(l)))//' C' - call hist_addfld1d (fname=fieldname, units='gC/m^2/s', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - endif - - ! output the vertically resolved fluxes - if ( nlevdecomp_full > 1 ) then - !-- HR fluxes (none from CWD) - if ( .not. decomp_cascade_con%is_cwd(decomp_cascade_con%cascade_donor_pool(l)) ) then - data2dptr => this%decomp_cascade_hr_vr_col(:,:,l) - ! check to see if there are multiple pathways that include respiration, and if so, note that in the history file - ii = 0 - do jj = 1, ndecomp_cascade_transitions - if ( decomp_cascade_con%cascade_donor_pool(jj) == decomp_cascade_con%cascade_donor_pool(l) ) ii = ii+1 - end do - if ( ii == 1 ) then - fieldname = & - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& - //'_HR'//trim(vr_suffix) - else - fieldname = & - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//'_HR_'//& - trim(decomp_cascade_con%decomp_pool_name_short(decomp_cascade_con%cascade_receiver_pool(l)))& - //trim(vr_suffix) - endif - longname = 'Het. Resp. from '//& - trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l))) - call hist_addfld_decomp (fname=fieldname, units='gC/m^3/s', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - - !-- transfer fluxes (none from terminal pool, if present) - if ( decomp_cascade_con%cascade_receiver_pool(l) /= 0 ) then - data2dptr => this%decomp_cascade_ctransfer_vr_col(:,:,l) - fieldname = & - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//'C_TO_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l)))& - //'C'//trim(vr_suffix) - longname = 'decomp. of '//& - trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l)))//& - ' C to '//& - trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_receiver_pool(l)))//' C' - call hist_addfld_decomp (fname=fieldname, units='gC/m^3/s', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - end if - - end do - - if ( nlevdecomp_full > 1 ) then - data2dptr => this%t_scalar_col(begc:endc,1:nlevsoi) - call hist_addfld_decomp (fname='T_SCALAR', units='unitless', type2d='levsoi', & - avgflag='A', long_name='temperature inhibition of decomposition', & - ptr_col=data2dptr, default='inactive') - - data2dptr => this%w_scalar_col(begc:endc,1:nlevsoi) - call hist_addfld_decomp (fname='W_SCALAR', units='unitless', type2d='levsoi', & - avgflag='A', long_name='Moisture (dryness) inhibition of decomposition', & - ptr_col=data2dptr, default='inactive') - - data2dptr => this%o_scalar_col(begc:endc,1:nlevsoi) - call hist_addfld_decomp (fname='O_SCALAR', units='unitless', type2d='levsoi', & - avgflag='A', long_name='fraction by which decomposition is reduced due to anoxia', & - ptr_col=data2dptr, default='inactive') - end if - - this%som_c_leached_col(begc:endc) = spval - call hist_addfld1d (fname='SOM_C_LEACHED', units='gC/m^2/s', & - avgflag='A', long_name='total flux of C from SOM pools due to leaching', & - ptr_col=this%som_c_leached_col, default='inactive') - - this%decomp_cpools_leached_col(begc:endc,:) = spval - this%decomp_cpools_transport_tendency_col(begc:endc,:,:) = spval - do k = 1, ndecomp_pools - if ( .not. decomp_cascade_con%is_cwd(k) ) then - data1dptr => this%decomp_cpools_leached_col(:,k) - fieldname = 'M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'C_TO_LEACHING' - longname = trim(decomp_cascade_con%decomp_pool_name_long(k))//' C leaching loss' - call hist_addfld1d (fname=fieldname, units='gC/m^2/s', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - - data2dptr => this%decomp_cpools_transport_tendency_col(:,:,k) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(k))//'C_TNDNCY_VERT_TRANSPORT' - longname = trim(decomp_cascade_con%decomp_pool_name_long(k))//' C tendency due to vertical transport' - call hist_addfld_decomp (fname=fieldname, units='gC/m^3/s', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - end do - - if ( nlevdecomp_full > 1 ) then - data2dptr => this%hr_vr_col(begc:endc,1:nlevsoi) - call hist_addfld2d (fname='HR_vr', units='gC/m^3/s', type2d='levsoi', & - avgflag='A', long_name='total vertically resolved heterotrophic respiration', & - ptr_col=data2dptr, default='inactive') - endif - - end if - - !------------------------------- - ! C13 flux variables - native to column - !------------------------------- - - if ( carbon_type == 'c13' ) then - - this%hr_col(begc:endc) = spval - call hist_addfld1d (fname='C13_HR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total heterotrophic respiration', & - ptr_col=this%hr_col, default='inactive') - - this%lithr_col(begc:endc) = spval - call hist_addfld1d (fname='C13_LITTERC_HR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C litterfall to litter 3 C', & - ptr_col=this%lithr_col, default='inactive') - - this%somhr_col(begc:endc) = spval - call hist_addfld1d (fname='C13_SOILC_HR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 soil organic matter heterotrophic respiration', & - ptr_col=this%somhr_col, default='inactive') - - - this%decomp_cascade_hr_col(begc:endc,:) = spval - this%decomp_cascade_hr_vr_col(begc:endc,:,:) = spval - this%decomp_cascade_ctransfer_col(begc:endc,:) = spval - this%decomp_cascade_ctransfer_vr_col(begc:endc,:,:) = spval - do l = 1, ndecomp_cascade_transitions - !-- HR fluxes (none from CWD) - if ( .not. decomp_cascade_con%is_cwd(decomp_cascade_con%cascade_donor_pool(l)) ) then - data2dptr => this%decomp_cascade_hr_vr_col(:,:,l) - ! check to see if there are multiple pathways that include respiration, and if so, note that in the history file - ii = 0 - do jj = 1, ndecomp_cascade_transitions - if ( decomp_cascade_con%cascade_donor_pool(jj) == decomp_cascade_con%cascade_donor_pool(l) ) ii = ii+1 - end do - if ( ii == 1 ) then - fieldname = 'C13_'//trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& - //'_HR'//trim(vr_suffix) - else - fieldname = 'C13_'//trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& - //'_HR_'//& - trim(decomp_cascade_con%decomp_pool_name_short(decomp_cascade_con%cascade_receiver_pool(l)))//& - trim(vr_suffix) - endif - longname = 'C13 Het. Resp. from '& - //trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l))) - call hist_addfld_decomp (fname=fieldname, units='gC13/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - !-- transfer fluxes (none from terminal pool, if present) - if ( decomp_cascade_con%cascade_receiver_pool(l) /= 0 ) then - data2dptr => this%decomp_cascade_ctransfer_vr_col(:,:,l) - fieldname = 'C13_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& - //'C_TO_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l)))& - //'C'//trim(vr_suffix) - longname = 'C13 decomp. of '& - //trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l)))& - //' C to '//& - trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_receiver_pool(l)))//' C' - call hist_addfld_decomp (fname=fieldname, units='gC13/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - end do - - end if - - !------------------------------- - ! C14 flux variables - native to column - !------------------------------- - - if (carbon_type == 'c14') then - - this%hr_col(begc:endc) = spval - call hist_addfld1d (fname='C14_HR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 total heterotrophic respiration', & - ptr_col=this%hr_col, default='inactive') - - this%lithr_col(begc:endc) = spval - call hist_addfld1d (fname='C14_LITTERC_HR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 litter carbon heterotrophic respiration', & - ptr_col=this%lithr_col, default='inactive') - - this%somhr_col(begc:endc) = spval - call hist_addfld1d (fname='C14_SOILC_HR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 soil organic matter heterotrophic respiration', & - ptr_col=this%somhr_col, default='inactive') - - this%decomp_cascade_hr_col(begc:endc,:) = spval - this%decomp_cascade_hr_vr_col(begc:endc,:,:) = spval - this%decomp_cascade_ctransfer_col(begc:endc,:) = spval - this%decomp_cascade_ctransfer_vr_col(begc:endc,:,:) = spval - - do l = 1, ndecomp_cascade_transitions - !-- HR fluxes (none from CWD) - if ( .not. decomp_cascade_con%is_cwd(decomp_cascade_con%cascade_donor_pool(l)) ) then - data2dptr => this%decomp_cascade_hr_vr_col(:,:,l) - - ! check to see if there are multiple pathways that include respiration, and if so, note that in the history file - ii = 0 - do jj = 1, ndecomp_cascade_transitions - if ( decomp_cascade_con%cascade_donor_pool(jj) == decomp_cascade_con%cascade_donor_pool(l) ) ii = ii+1 - end do - if ( ii == 1 ) then - fieldname = 'C14_'//trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& - //'_HR'//trim(vr_suffix) - else - fieldname = 'C14_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& - //'_HR_'//& - trim(decomp_cascade_con%decomp_pool_name_short(decomp_cascade_con%cascade_receiver_pool(l)))& - //trim(vr_suffix) - endif - longname = 'C14 Het. Resp. from '& - //trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l))) - call hist_addfld_decomp (fname=fieldname, units='gC14/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - - !-- transfer fluxes (none from terminal pool, if present) - if ( decomp_cascade_con%cascade_receiver_pool(l) /= 0 ) then - data2dptr => this%decomp_cascade_ctransfer_vr_col(:,:,l) - - fieldname = 'C14_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& - //'C_TO_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l)))& - //'C'//trim(vr_suffix) - longname = 'C14 decomp. of '& - //trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l)))//& - ' C to '//trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_receiver_pool(l)))//' C' - call hist_addfld_decomp (fname=fieldname, units='gC14/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - end do - - end if - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - - this%fphr_col(c,nlevdecomp+1:nlevgrnd) = 0._r8 !used to be in ch4Mod - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%fphr_col(c,nlevdecomp+1:nlevgrnd) = 0._r8 - else ! Inactive CH4 columns - this%fphr_col(c,:) = spval - end if - - end do - - if ( use_fates ) then - - call hist_addfld_decomp(fname='FATES_c_to_litr_lab_c', units='gC/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='litter labile carbon flux from FATES to BGC', & - ptr_col=this%FATES_c_to_litr_lab_c_col, default='inactive') - - call hist_addfld_decomp(fname='FATES_c_to_litr_cel_c', units='gC/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='litter celluluse carbon flux from FATES to BGC', & - ptr_col=this%FATES_c_to_litr_cel_c_col, default='inactive') - - call hist_addfld_decomp(fname='FATES_c_to_litr_lig_c', units='gC/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='litter lignin carbon flux from FATES to BGC', & - ptr_col=this%FATES_c_to_litr_lig_c_col, default='inactive') - - endif - - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !ARGUMENTS: - class(soilbiogeochem_carbonflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: c,l - integer :: num_special_col ! number of good values in special_col filter - integer :: special_col(bounds%endc-bounds%begc+1) ! special landunit filter - columns - !----------------------------------------------------------------------- - - ! Set column filters - - num_special_col = 0 - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - num_special_col = num_special_col + 1 - special_col(num_special_col) = c - end if - end do - - ! initialize fields for special filters - - call this%SetValues (num_column=num_special_col, filter_column=special_col, & - value_column=0._r8) - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag) - ! - ! !USES: - use restUtilMod - use ncdio_pio - use clm_varctl, only : use_vertsoilc - ! - ! !ARGUMENTS: - class(soilbiogeochem_carbonflux_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag !'read', 'write', 'define' - ! - ! local vars - real(r8), pointer :: ptr1d(:) ! temp. pointers for slicing larger arrays - real(r8), pointer :: ptr2d(:,:) ! temp. pointers for slicing larger arrays - logical :: readvar - !----------------------------------------------------------------------- - - ! - ! if FATES is enabled, need to restart the variables used to transfer from FATES to CLM as they - ! are persistent between daily FATES dynamics calls and half-hourly CLM timesteps - ! - if ( use_fates ) then - - if (use_vertsoilc) then - ptr2d => this%FATES_c_to_litr_lab_c_col - call restartvar(ncid=ncid, flag=flag, varname='FATES_c_to_litr_lab_c_col', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - - ptr2d => this%FATES_c_to_litr_cel_c_col - call restartvar(ncid=ncid, flag=flag, varname='FATES_c_to_litr_cel_c_col', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - - ptr2d => this%FATES_c_to_litr_lig_c_col - call restartvar(ncid=ncid, flag=flag, varname='FATES_c_to_litr_lig_c_col', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - - else - ptr1d => this%FATES_c_to_litr_lab_c_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname='FATES_c_to_litr_lab_c_col', xtype=ncd_double, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr1d) - - ptr1d => this%FATES_c_to_litr_cel_c_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname='FATES_c_to_litr_cel_c_col', xtype=ncd_double, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr1d) - - ptr1d => this%FATES_c_to_litr_lig_c_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname='FATES_c_to_litr_lig_c_col', xtype=ncd_double, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr1d) - - end if - - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine SetValues ( this, num_column, filter_column, value_column) - ! - ! !DESCRIPTION: - ! Set carbon fluxes - ! - ! !ARGUMENTS: - class (soilbiogeochem_carbonflux_type) :: this - integer , intent(in) :: num_column - integer , intent(in) :: filter_column(:) - real(r8), intent(in) :: value_column - ! - ! !LOCAL VARIABLES: - integer :: fi,i ! loop index - integer :: j,k,l ! indices - !------------------------------------------------------------------------ - - do l = 1, ndecomp_cascade_transitions - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%decomp_cascade_hr_col(i,l) = value_column - this%decomp_cascade_hr_vr_col(i,j,l) = value_column - this%decomp_cascade_ctransfer_col(i,l) = value_column - this%decomp_cascade_ctransfer_vr_col(i,j,l) = value_column - this%decomp_k_col(i,j,l) = value_column - end do - end do - end do - - do k = 1, ndecomp_pools - do fi = 1,num_column - i = filter_column(fi) - this%decomp_cpools_leached_col(i,k) = value_column - end do - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%decomp_cpools_transport_tendency_col(i,j,k) = value_column - this%decomp_cpools_sourcesink_col(i,j,k) = value_column - end do - end do - end do - - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%hr_vr_col(i,j) = value_column - end do - end do - - do fi = 1,num_column - i = filter_column(fi) - this%hr_col(i) = value_column - this%somc_fire_col(i) = value_column - this%som_c_leached_col(i) = value_column - this%somhr_col(i) = value_column - this%lithr_col(i) = value_column - this%soilc_change_col(i) = value_column - end do - - ! NOTE: do not zero the fates to BGC C flux variables since they need to persist from the daily fates timestep s to the half-hourly BGC timesteps. I.e. FATES_c_to_litr_lab_c_col, FATES_c_to_litr_cel_c_col, FATES_c_to_litr_lig_c_col - - end subroutine SetValues - - !----------------------------------------------------------------------- - subroutine Summary(this, bounds, num_soilc, filter_soilc) - ! - ! !DESCRIPTION: - ! On the radiation time step, column-level carbon summary calculations - ! - ! !USES: - ! !ARGUMENTS: - class(soilbiogeochem_carbonflux_type) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - ! - ! !LOCAL VARIABLES: - integer :: c,j,k,l - integer :: fc - !----------------------------------------------------------------------- - - do fc = 1,num_soilc - c = filter_soilc(fc) - this%som_c_leached_col(c) = 0._r8 - end do - - ! vertically integrate HR and decomposition cascade fluxes - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - this%decomp_cascade_hr_col(c,k) = & - this%decomp_cascade_hr_col(c,k) + & - this%decomp_cascade_hr_vr_col(c,j,k) * dzsoi_decomp(j) - - this%decomp_cascade_ctransfer_col(c,k) = & - this%decomp_cascade_ctransfer_col(c,k) + & - this%decomp_cascade_ctransfer_vr_col(c,j,k) * dzsoi_decomp(j) - end do - end do - end do - - ! total heterotrophic respiration, vertically resolved (HR) - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - this%hr_vr_col(c,j) = 0._r8 - end do - end do - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - this%hr_vr_col(c,j) = & - this%hr_vr_col(c,j) + & - this%decomp_cascade_hr_vr_col(c,j,k) - end do - end do - end do - - ! add up all vertical transport tendency terms and calculate total som leaching loss as the sum of these - do l = 1, ndecomp_pools - do fc = 1,num_soilc - c = filter_soilc(fc) - this%decomp_cpools_leached_col(c,l) = 0._r8 - end do - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - this%decomp_cpools_leached_col(c,l) = this%decomp_cpools_leached_col(c,l) + & - this%decomp_cpools_transport_tendency_col(c,j,l) * dzsoi_decomp(j) - end do - end do - do fc = 1,num_soilc - c = filter_soilc(fc) - this%som_c_leached_col(c) = this%som_c_leached_col(c) + this%decomp_cpools_leached_col(c,l) - end do - end do - - ! soil organic matter heterotrophic respiration - associate(is_soil => decomp_cascade_con%is_soil) ! TRUE => pool is a soil pool - do k = 1, ndecomp_cascade_transitions - if ( is_soil(decomp_cascade_con%cascade_donor_pool(k)) ) then - do fc = 1,num_soilc - c = filter_soilc(fc) - this%somhr_col(c) = this%somhr_col(c) + this%decomp_cascade_hr_col(c,k) - end do - end if - end do - end associate - - ! litter heterotrophic respiration (LITHR) - associate(is_litter => decomp_cascade_con%is_litter) ! TRUE => pool is a litter pool - do k = 1, ndecomp_cascade_transitions - if ( is_litter(decomp_cascade_con%cascade_donor_pool(k)) ) then - do fc = 1,num_soilc - c = filter_soilc(fc) - this%lithr_col(c) = this%lithr_col(c) + this%decomp_cascade_hr_col(c,k) - end do - end if - end do - end associate - - ! total heterotrophic respiration (HR) - do fc = 1,num_soilc - c = filter_soilc(fc) - - this%hr_col(c) = & - this%lithr_col(c) + & - this%somhr_col(c) - - end do - - end subroutine Summary - -end module SoilBiogeochemCarbonFluxType - - diff --git a/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 b/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 deleted file mode 100644 index 7d2c814a53..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 +++ /dev/null @@ -1,942 +0,0 @@ -module SoilBiogeochemCarbonStateType - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools, nlevcan - use clm_varpar , only : nlevdecomp_full, nlevdecomp, nlevsoi - use clm_varcon , only : spval, ispval, dzsoi_decomp, zisoi, zsoi, c3_r2 - use clm_varctl , only : iulog, use_vertsoilc, spinup_state, use_fates - use landunit_varcon , only : istcrop, istsoil - use abortutils , only : endrun - use spmdMod , only : masterproc - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use LandunitType , only : lun - use ColumnType , only : col - use GridcellType , only : grc - use SoilBiogeochemStateType , only : get_spinup_latitude_term - ! - ! !PUBLIC TYPES: - implicit none - private - ! - type, public :: soilbiogeochem_carbonstate_type - - ! all c pools involved in decomposition - real(r8), pointer :: decomp_cpools_vr_col (:,:,:) ! (gC/m3) vertically-resolved decomposing (litter, cwd, soil) c pools - real(r8), pointer :: ctrunc_vr_col (:,:) ! (gC/m3) vertically-resolved column-level sink for C truncation - - ! summary (diagnostic) state variables, not involved in mass balance - real(r8), pointer :: ctrunc_col (:) ! (gC/m2) column-level sink for C truncation - real(r8), pointer :: totlitc_col (:) ! (gC/m2) total litter carbon - real(r8), pointer :: totlitc_1m_col (:) ! (gC/m2) total litter carbon to 1 meter - real(r8), pointer :: totsomc_col (:) ! (gC/m2) total soil organic matter carbon - real(r8), pointer :: totsomc_1m_col (:) ! (gC/m2) total soil organic matter carbon to 1 meter - real(r8), pointer :: cwdc_col (:) ! (gC/m2) coarse woody debris C (diagnostic) - real(r8), pointer :: decomp_cpools_1m_col (:,:) ! (gC/m2) Diagnostic: decomposing (litter, cwd, soil) c pools to 1 meter - real(r8), pointer :: decomp_cpools_col (:,:) ! (gC/m2) decomposing (litter, cwd, soil) c pools - real(r8), pointer :: dyn_cbal_adjustments_col (:) ! (gC/m2) adjustments to each column made in this timestep via dynamic column area adjustments (note: this variable only makes sense at the column-level: it is meaningless if averaged to the gridcell-level) - integer :: restart_file_spinup_state ! spinup state as read from restart file, for determining whether to enter or exit spinup mode. - real(r8) :: totvegcthresh ! threshold for total vegetation carbon to zero out decomposition pools - - contains - - procedure , public :: Init - procedure , public :: SetValues - procedure , public :: Restart - procedure , public :: Summary - procedure , public :: SetTotVgCThresh - procedure , private :: InitAllocate - procedure , private :: InitHistory - procedure , private :: InitCold - - - end type soilbiogeochem_carbonstate_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, carbon_type, ratio, c12_soilbiogeochem_carbonstate_inst) - - class(soilbiogeochem_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - character(len=3) , intent(in) :: carbon_type - real(r8) , intent(in) :: ratio - type(soilbiogeochem_carbonstate_type) , intent(in), optional :: c12_soilbiogeochem_carbonstate_inst - - this%totvegcthresh = nan - call this%InitAllocate ( bounds) - call this%InitHistory ( bounds, carbon_type ) - if (present(c12_soilbiogeochem_carbonstate_inst)) then - call this%InitCold ( bounds, ratio, c12_soilbiogeochem_carbonstate_inst ) - else - call this%InitCold ( bounds, ratio) - end if - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !ARGUMENTS: - class (soilbiogeochem_carbonstate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc,endc - !------------------------------------------------------------------------ - - begc = bounds%begc; endc = bounds%endc - - allocate( this%decomp_cpools_col (begc :endc,1:ndecomp_pools)) ; this%decomp_cpools_col (:,:) = nan - allocate( this%decomp_cpools_1m_col (begc :endc,1:ndecomp_pools)) ; this%decomp_cpools_1m_col (:,:) = nan - - allocate( this%ctrunc_vr_col(begc :endc,1:nlevdecomp_full)) ; - this%ctrunc_vr_col (:,:) = nan - - allocate(this%decomp_cpools_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools)) - this%decomp_cpools_vr_col(:,:,:)= nan - - allocate(this%ctrunc_col (begc :endc)) ; this%ctrunc_col (:) = nan - if ( .not. use_fates ) then - allocate(this%cwdc_col (begc :endc)) ; this%cwdc_col (:) = nan - endif - allocate(this%totlitc_col (begc :endc)) ; this%totlitc_col (:) = nan - allocate(this%totsomc_col (begc :endc)) ; this%totsomc_col (:) = nan - allocate(this%totlitc_1m_col (begc :endc)) ; this%totlitc_1m_col (:) = nan - allocate(this%totsomc_1m_col (begc :endc)) ; this%totsomc_1m_col (:) = nan - allocate(this%dyn_cbal_adjustments_col (begc:endc)) ; this%dyn_cbal_adjustments_col (:) = nan - - this%restart_file_spinup_state = huge(1) - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds, carbon_type) - ! - ! !USES: - use histFileMod, only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp - ! - ! !ARGUMENTS: - class (soilbiogeochem_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - character(len=3) , intent(in) :: carbon_type - ! - ! !LOCAL VARIABLES: - integer :: l - integer :: begc ,endc - character(24) :: fieldname - character(100) :: longname - real(r8), pointer :: data1dptr(:) ! temp. pointer for slicing larger arrays - real(r8), pointer :: data2dptr(:,:) ! temp. pointer for slicing larger arrays - !------------------------------------------------------------------------ - - begc = bounds%begc; endc = bounds%endc - - !------------------------------- - ! C12 state variables - column - !------------------------------- - - if (carbon_type == 'c12') then - - this%decomp_cpools_col(begc:endc,:) = spval - do l = 1, ndecomp_pools - if ( nlevdecomp_full > 1 ) then - data2dptr => this%decomp_cpools_vr_col(:,1:nlevsoi,l) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(l))//'C_vr' - longname = trim(decomp_cascade_con%decomp_pool_name_history(l))//' C (vertically resolved)' - call hist_addfld2d (fname=fieldname, units='gC/m^3', type2d='levsoi', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - - data1dptr => this%decomp_cpools_col(:,l) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(l))//'C' - longname = trim(decomp_cascade_con%decomp_pool_name_history(l))//' C' - call hist_addfld1d (fname=fieldname, units='gC/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - - if ( nlevdecomp_full > 1 ) then - data1dptr => this%decomp_cpools_1m_col(:,l) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(l))//'C_1m' - longname = trim(decomp_cascade_con%decomp_pool_name_history(l))//' C to 1 meter' - call hist_addfld1d (fname=fieldname, units='gC/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - endif - end do - - this%totlitc_col(begc:endc) = spval - call hist_addfld1d (fname='TOTLITC', units='gC/m^2', & - avgflag='A', long_name='total litter carbon', & - ptr_col=this%totlitc_col, default='inactive') - - this%totsomc_col(begc:endc) = spval - call hist_addfld1d (fname='TOTSOMC', units='gC/m^2', & - avgflag='A', long_name='total soil organic matter carbon', & - ptr_col=this%totsomc_col, default='inactive') - - if ( nlevdecomp_full > 1 ) then - this%totlitc_1m_col(begc:endc) = spval - call hist_addfld1d (fname='TOTLITC_1m', units='gC/m^2', & - avgflag='A', long_name='total litter carbon to 1 meter depth', & - ptr_col=this%totlitc_1m_col, default='inactive') - end if - - if ( nlevdecomp_full > 1 ) then - this%totsomc_1m_col(begc:endc) = spval - call hist_addfld1d (fname='TOTSOMC_1m', units='gC/m^2', & - avgflag='A', long_name='total soil organic matter carbon to 1 meter depth', & - ptr_col=this%totsomc_1m_col, default='inactive') - end if - - this%ctrunc_col(begc:endc) = spval - call hist_addfld1d (fname='COL_CTRUNC', units='gC/m^2', & - avgflag='A', long_name='column-level sink for C truncation', & - ptr_col=this%ctrunc_col, default='inactive') - - this%dyn_cbal_adjustments_col(begc:endc) = spval - call hist_addfld1d (fname='DYN_COL_SOIL_ADJUSTMENTS_C', units='gC/m^2', & - avgflag='SUM', & - long_name='Adjustments in soil carbon due to dynamic column areas; & - &only makes sense at the column level: should not be averaged to gridcell', & - ptr_col=this%dyn_cbal_adjustments_col, default='inactive') - - end if - - !------------------------------- - ! C13 state variables - column - !------------------------------- - - if ( carbon_type == 'c13' ) then - - this%decomp_cpools_vr_col(begc:endc,:,:) = spval - do l = 1, ndecomp_pools - if ( nlevdecomp_full > 1 ) then - data2dptr => this%decomp_cpools_vr_col(:,1:nlevsoi,l) - fieldname = 'C13_'//trim(decomp_cascade_con%decomp_pool_name_history(l))//'C_vr' - longname = 'C13 '//trim(decomp_cascade_con%decomp_pool_name_history(l))//' C (vertically resolved)' - call hist_addfld2d (fname=fieldname, units='gC13/m^3', type2d='levsoi', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - - data1dptr => this%decomp_cpools_col(:,l) - fieldname = 'C13_'//trim(decomp_cascade_con%decomp_pool_name_history(l))//'C' - longname = 'C13 '//trim(decomp_cascade_con%decomp_pool_name_history(l))//' C' - call hist_addfld1d (fname=fieldname, units='gC13/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - end do - - this%totlitc_col(begc:endc) = spval - call hist_addfld1d (fname='C13_TOTLITC', units='gC13/m^2', & - avgflag='A', long_name='C13 total litter carbon', & - ptr_col=this%totlitc_col, default='inactive') - - this%totsomc_col(begc:endc) = spval - call hist_addfld1d (fname='C13_TOTSOMC', units='gC13/m^2', & - avgflag='A', long_name='C13 total soil organic matter carbon', & - ptr_col=this%totsomc_col, default='inactive') - - if ( nlevdecomp_full > 1 ) then - this%totlitc_1m_col(begc:endc) = spval - call hist_addfld1d (fname='C13_TOTLITC_1m', units='gC13/m^2', & - avgflag='A', long_name='C13 total litter carbon to 1 meter', & - ptr_col=this%totlitc_1m_col, default='inactive') - end if - - if ( nlevdecomp_full > 1 ) then - this%totsomc_1m_col(begc:endc) = spval - call hist_addfld1d (fname='C13_TOTSOMC_1m', units='gC13/m^2', & - avgflag='A', long_name='C13 total soil organic matter carbon to 1 meter', & - ptr_col=this%totsomc_1m_col, default='inactive') - endif - - this%ctrunc_col(begc:endc) = spval - call hist_addfld1d (fname='C13_COL_CTRUNC', units='gC13/m^2', & - avgflag='A', long_name='C13 column-level sink for C truncation', & - ptr_col=this%ctrunc_col, default='inactive') - - this%dyn_cbal_adjustments_col(begc:endc) = spval - call hist_addfld1d (fname='C13_DYN_COL_SOIL_ADJUSTMENTS_C', units='gC13/m^2', & - avgflag='SUM', & - long_name='C13 adjustments in soil carbon due to dynamic column areas; & - &only makes sense at the column level: should not be averaged to gridcell', & - ptr_col=this%dyn_cbal_adjustments_col, default='inactive') - endif - - !------------------------------- - ! C14 state variables - column - !------------------------------- - - if ( carbon_type == 'c14' ) then - - this%decomp_cpools_vr_col(begc:endc,:,:) = spval - do l = 1, ndecomp_pools - if ( nlevdecomp_full > 1 ) then - data2dptr => this%decomp_cpools_vr_col(:,1:nlevsoi,l) - fieldname = 'C14_'//trim(decomp_cascade_con%decomp_pool_name_history(l))//'C_vr' - longname = 'C14 '//trim(decomp_cascade_con%decomp_pool_name_history(l))//' C (vertically resolved)' - call hist_addfld2d (fname=fieldname, units='gC14/m^3', type2d='levsoi', & - avgflag='A', long_name=longname, ptr_col=data2dptr, default='inactive') - endif - - data1dptr => this%decomp_cpools_col(:,l) - fieldname = 'C14_'//trim(decomp_cascade_con%decomp_pool_name_history(l))//'C' - longname = 'C14 '//trim(decomp_cascade_con%decomp_pool_name_history(l))//' C' - call hist_addfld1d (fname=fieldname, units='gC14/m^2', & - avgflag='A', long_name=longname, ptr_col=data1dptr, default='inactive') - - if ( nlevdecomp_full > 1 ) then - data1dptr => this%decomp_cpools_1m_col(:,l) - fieldname = 'C14_'//trim(decomp_cascade_con%decomp_pool_name_history(l))//'C_1m' - longname = 'C14_'//trim(decomp_cascade_con%decomp_pool_name_history(l))//' C to 1 meter' - call hist_addfld1d (fname=fieldname, units='gC/m^2', & - avgflag='A', long_name=longname, ptr_col=data1dptr, default='inactive') - endif - end do - - this%totlitc_col(begc:endc) = spval - call hist_addfld1d (fname='C14_TOTLITC', units='gC14/m^2', & - avgflag='A', long_name='C14 total litter carbon', & - ptr_col=this%totlitc_col, default='inactive') - - this%totsomc_col(begc:endc) = spval - call hist_addfld1d (fname='C14_TOTSOMC', units='gC14/m^2', & - avgflag='A', long_name='C14 total soil organic matter carbon', & - ptr_col=this%totsomc_col, default='inactive') - - if ( nlevdecomp_full > 1 ) then - this%totlitc_1m_col(begc:endc) = spval - call hist_addfld1d (fname='C14_TOTLITC_1m', units='gC14/m^2', & - avgflag='A', long_name='C14 total litter carbon to 1 meter', & - ptr_col=this%totlitc_1m_col, default='inactive') - - this%totsomc_1m_col(begc:endc) = spval - call hist_addfld1d (fname='C14_TOTSOMC_1m', units='gC14/m^2', & - avgflag='A', long_name='C14 total soil organic matter carbon to 1 meter', & - ptr_col=this%totsomc_1m_col, default='inactive') - endif - - this%ctrunc_col(begc:endc) = spval - call hist_addfld1d (fname='C14_COL_CTRUNC', units='gC14/m^2', & - avgflag='A', long_name='C14 column-level sink for C truncation', & - ptr_col=this%ctrunc_col, default='inactive') - - this%dyn_cbal_adjustments_col(begc:endc) = spval - call hist_addfld1d (fname='C14_DYN_COL_SOIL_ADJUSTMENTS_C', units='gC14/m^2', & - avgflag='SUM', & - long_name='C14 adjustments in soil carbon due to dynamic column areas; & - &only makes sense at the column level: should not be averaged to gridcell', & - ptr_col=this%dyn_cbal_adjustments_col, default='inactive') - endif - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds, ratio, c12_soilbiogeochem_carbonstate_inst) - ! - ! !DESCRIPTION: - ! Initializes time varying variables used only in coupled carbon-nitrogen mode (CN): - ! - ! !USES: - ! - ! !ARGUMENTS: - class(soilbiogeochem_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: ratio - type(soilbiogeochem_carbonstate_type), intent(in), optional :: c12_soilbiogeochem_carbonstate_inst - ! - ! !LOCAL VARIABLES: - integer :: p,c,l,j,k - integer :: fc ! filter index - integer :: num_special_col ! number of good values in special_col filter - integer :: special_col(bounds%endc-bounds%begc+1) ! special landunit filter - columns - !----------------------------------------------------------------------- - - ! initialize column-level variables - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - if (.not. present(c12_soilbiogeochem_carbonstate_inst)) then !c12 - - do j = 1, nlevdecomp - do k = 1, ndecomp_pools - if (zsoi(j) < decomp_cascade_con%initial_stock_soildepth ) then !! only initialize upper soil column - this%decomp_cpools_vr_col(c,j,k) = decomp_cascade_con%initial_stock(k) - else - this%decomp_cpools_vr_col(c,j,k) = 0._r8 - endif - end do - this%ctrunc_vr_col(c,j) = 0._r8 - end do - if ( nlevdecomp > 1 ) then - do j = nlevdecomp+1, nlevdecomp_full - do k = 1, ndecomp_pools - this%decomp_cpools_vr_col(c,j,k) = 0._r8 - end do - this%ctrunc_vr_col(c,j) = 0._r8 - end do - end if - this%decomp_cpools_col(c,1:ndecomp_pools) = decomp_cascade_con%initial_stock(1:ndecomp_pools) - this%decomp_cpools_1m_col(c,1:ndecomp_pools) = decomp_cascade_con%initial_stock(1:ndecomp_pools) - - else - - do j = 1, nlevdecomp - do k = 1, ndecomp_pools - this%decomp_cpools_vr_col(c,j,k) = c12_soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col(c,j,k) * ratio - end do - this%ctrunc_vr_col(c,j) = c12_soilbiogeochem_carbonstate_inst%ctrunc_vr_col(c,j) * ratio - end do - if ( nlevdecomp > 1 ) then - do j = nlevdecomp+1, nlevdecomp_full - do k = 1, ndecomp_pools - this%decomp_cpools_vr_col(c,j,k) = 0._r8 - end do - this%ctrunc_vr_col(c,j) = 0._r8 - end do - end if - do k = 1, ndecomp_pools - this%decomp_cpools_col(c,k) = c12_soilbiogeochem_carbonstate_inst%decomp_cpools_col(c,k) * ratio - this%decomp_cpools_1m_col(c,k) = c12_soilbiogeochem_carbonstate_inst%decomp_cpools_1m_col(c,k) * ratio - end do - - endif - end if - - if ( .not. use_fates ) then - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - if (present(c12_soilbiogeochem_carbonstate_inst)) then - this%cwdc_col(c) = c12_soilbiogeochem_carbonstate_inst%cwdc_col(c) * ratio - else - this%cwdc_col(c) = 0._r8 - end if - this%ctrunc_col(c) = 0._r8 - this%totlitc_col(c) = 0._r8 - this%totsomc_col(c) = 0._r8 - this%totlitc_1m_col(c) = 0._r8 - this%totsomc_1m_col(c) = 0._r8 - end if - end if - end do - - ! now loop through special filters and explicitly set the variables that - ! have to be in place for biogeophysics - - ! Set column filters - - num_special_col = 0 - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - num_special_col = num_special_col + 1 - special_col(num_special_col) = c - end if - end do - - ! initialize fields for special filters - - call this%SetValues (num_column=num_special_col, filter_column=special_col, value_column=0._r8) - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart ( this, bounds, ncid, flag, carbon_type, totvegc_col, c12_soilbiogeochem_carbonstate_inst ) - ! - ! !DESCRIPTION: - ! Read/write CN restart data for carbon state - ! - ! !USES: - use shr_infnan_mod , only : isnan => shr_infnan_isnan, nan => shr_infnan_nan, assignment(=) - use clm_time_manager , only : is_restart, get_nstep - use shr_const_mod , only : SHR_CONST_PDB - use clm_varcon , only : c14ratio - use restUtilMod - use ncdio_pio - ! - ! !ARGUMENTS: - class (soilbiogeochem_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag !'read' or 'write' - character(len=3) , intent(in) :: carbon_type ! 'c12' or 'c13' or 'c14' - real(r8) , intent(in) :: totvegc_col(bounds%begc:bounds%endc) ! (gC/m2) total - ! vegetation carbon - type(soilbiogeochem_carbonstate_type) , intent(in), optional :: c12_soilbiogeochem_carbonstate_inst - - ! - ! !LOCAL VARIABLES: - integer :: i,j,k,l,c - real(r8) :: m ! multiplier for the exit_spinup code - real(r8), pointer :: ptr2d(:,:) ! temp. pointers for slicing larger arrays - real(r8), pointer :: ptr1d(:) ! temp. pointers for slicing larger arrays - character(len=128) :: varname ! temporary - logical :: readvar - integer :: idata - logical :: exit_spinup = .false. - logical :: enter_spinup = .false. - ! flags for comparing the model and restart decomposition cascades - integer :: decomp_cascade_state, restart_file_decomp_cascade_state - !------------------------------------------------------------------------ - - if (carbon_type == 'c12') then - - do k = 1, ndecomp_pools - varname=trim(decomp_cascade_con%decomp_pool_name_restart(k))//'c' - if (use_vertsoilc) then - ptr2d => this%decomp_cpools_vr_col(:,:,k) - call restartvar(ncid=ncid, flag=flag, varname=trim(varname)//"_vr", xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%decomp_cpools_vr_col(:,1,k) ! nlevdecomp = 1; so treat as 1D variable - call restartvar(ncid=ncid, flag=flag, varname=varname, xtype=ncd_double, & - dim1name='column', long_name='', units='', fill_value=spval, & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - call endrun(msg='ERROR:: '//trim(varname)//' is required on an initialization dataset'//& - errMsg(sourcefile, __LINE__)) - end if - end do - - if (use_vertsoilc) then - ptr2d => this%ctrunc_vr_col - call restartvar(ncid=ncid, flag=flag, varname='col_ctrunc_vr', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%ctrunc_vr_col(:,1) ! nlevdecomp = 1; so treat as 1D variable - call restartvar(ncid=ncid, flag=flag, varname='col_ctrunc', xtype=ncd_double, & - dim1name='column', long_name='', units='', fill_value=spval, & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - call endrun(msg='ERROR:: '//trim(varname)//' is required on an initialization dataset'//& - errMsg(sourcefile, __LINE__)) - end if - - end if - - !-------------------------------- - ! C13 column carbon state variables - !-------------------------------- - - if ( carbon_type == 'c13' ) then - - do k = 1, ndecomp_pools - varname = trim(decomp_cascade_con%decomp_pool_name_restart(k))//'c_13' - if (use_vertsoilc) then - ptr2d => this%decomp_cpools_vr_col(:,:,k) - call restartvar(ncid=ncid, flag=flag, varname=trim(varname)//"_vr", xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%decomp_cpools_vr_col(:,1,k) ! nlevdecomp = 1; so treat as 1D variable - call restartvar(ncid=ncid, flag=flag, varname=varname, xtype=ncd_double, & - dim1name='column', long_name='', units='', fill_value=spval, & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - write(iulog,*) 'initializing soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col' & - // ' with atmospheric c13 value for: '//trim(varname) - do i = bounds%begc,bounds%endc - do j = 1, nlevdecomp - if (this%decomp_cpools_vr_col(i,j,k) /= spval .and. .not. isnan(this%decomp_cpools_vr_col(i,j,k)) ) then - this%decomp_cpools_vr_col(i,j,k) = c12_soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col(i,j,k) * c3_r2 - endif - end do - end do - end if - end do - - if (use_vertsoilc) then - ptr2d => this%ctrunc_vr_col - call restartvar(ncid=ncid, flag=flag, varname="col_ctrunc_c13_vr", xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%ctrunc_vr_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname="col_ctrunc_c13", xtype=ncd_double, & - dim1name='column', long_name='', units='', fill_value=spval, & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - end if - - !-------------------------------- - ! C14 column carbon state variables - !-------------------------------- - - if ( carbon_type == 'c14' ) then - - do k = 1, ndecomp_pools - varname = trim(decomp_cascade_con%decomp_pool_name_restart(k))//'c_14' - if (use_vertsoilc) then - ptr2d => this%decomp_cpools_vr_col(:,:,k) - call restartvar(ncid=ncid, flag=flag, varname=trim(varname)//"_vr", xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%decomp_cpools_vr_col(:,1,k) ! nlevdecomp = 1; so treat as 1D variable - call restartvar(ncid=ncid, flag=flag, varname=varname, xtype=ncd_double, & - dim1name='column', & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - write(iulog,*) 'initializing soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col with atmospheric c14 value for: '//& - trim(varname) - do i = bounds%begc,bounds%endc - do j = 1, nlevdecomp - if (this%decomp_cpools_vr_col(i,j,k) /= spval .and. .not. isnan(this%decomp_cpools_vr_col(i,j,k)) ) then - this%decomp_cpools_vr_col(i,j,k) = c12_soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col(i,j,k) * c3_r2 - endif - end do - end do - end if - end do - - if (use_vertsoilc) then - ptr2d => this%ctrunc_vr_col - call restartvar(ncid=ncid, flag=flag, varname="col_ctrunc_c14_vr", xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%ctrunc_vr_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname="col_ctrunc_c14", xtype=ncd_double, & - dim1name='column', long_name='', units='', fill_value=spval, & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - - end if - - !-------------------------------- - ! Spinup state - !-------------------------------- - - - if (carbon_type == 'c12') then - if (flag == 'write') idata = spinup_state - call restartvar(ncid=ncid, flag=flag, varname='spinup_state', xtype=ncd_int, & - long_name='Spinup state of the model that wrote this restart file: ' & - // ' 0 = normal model mode, 1 = AD spinup', units='', & - interpinic_flag='copy', readvar=readvar, data=idata) - if (flag == 'read') then - if (readvar) then - this%restart_file_spinup_state = idata - else - call endrun(msg=' CNRest: spinup_state was not on the restart file and is required' // & - errMsg(sourcefile, __LINE__)) - end if - end if - else - this%restart_file_spinup_state = c12_soilbiogeochem_carbonstate_inst%restart_file_spinup_state - endif - - ! now compare the model and restart file spinup states, and either take the - ! model into spinup mode or out of it if they are not identical - ! taking model out of spinup mode requires multiplying each decomposing pool - ! by the associated AD factor. - ! putting model into spinup mode requires dividing each decomposing pool - ! by the associated AD factor. - ! only allow this to occur on first timestep of model run. - - if (flag == 'read' .and. spinup_state /= this%restart_file_spinup_state ) then - if (spinup_state == 0 .and. this%restart_file_spinup_state >= 1 ) then - if ( masterproc ) write(iulog,*) ' CNRest: taking ',carbon_type,' SOM pools out of AD spinup mode' - exit_spinup = .true. - else if (spinup_state >= 1 .and. this%restart_file_spinup_state == 0 ) then - if ( masterproc ) write(iulog,*) ' CNRest: taking ',carbon_type,' SOM pools into AD spinup mode' - enter_spinup = .true. - else - call endrun(msg=' CNRest: error in entering/exiting spinup. spinup_state ' & - // ' != restart_file_spinup_state, but do not know what to do'//& - errMsg(sourcefile, __LINE__)) - end if - if (get_nstep() >= 2) then - call endrun(msg=' CNRest: error in entering/exiting spinup - should occur only when nstep = 1'//& - errMsg(sourcefile, __LINE__)) - endif - if ( exit_spinup .and. isnan(this%totvegcthresh) )then - call endrun(msg=' CNRest: error in exit spinup - totvegcthresh was not set with SetTotVgCThresh'//& - errMsg(sourcefile, __LINE__)) - end if - do k = 1, ndecomp_pools - if ( exit_spinup ) then - m = decomp_cascade_con%spinup_factor(k) - else if ( enter_spinup ) then - m = 1. / decomp_cascade_con%spinup_factor(k) - end if - do c = bounds%begc, bounds%endc - l = col%landunit(c) - do j = 1, nlevdecomp_full - if ( abs(m - 1._r8) .gt. 0.000001_r8 .and. exit_spinup) then - this%decomp_cpools_vr_col(c,j,k) = this%decomp_cpools_vr_col(c,j,k) * m * & - get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) - ! If there is no vegetation carbon, implying that all vegetation has died, then - ! reset decomp pools to near zero during exit_spinup to avoid very - ! large and inert soil carbon stocks; note that only pools with spinup factor > 1 - ! will be affected, which means that total SOMC and LITC pools will not be set to 0. - if (totvegc_col(c) <= this%totvegcthresh .and. lun%itype(l) /= istcrop) then - this%decomp_cpools_vr_col(c,j,k) = 0.0_r8 - endif - elseif ( abs(m - 1._r8) .gt. 0.000001_r8 .and. enter_spinup) then - this%decomp_cpools_vr_col(c,j,k) = this%decomp_cpools_vr_col(c,j,k) * m / & - get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) - else - this%decomp_cpools_vr_col(c,j,k) = this%decomp_cpools_vr_col(c,j,k) * m - endif - end do - end do - end do - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine SetValues ( this, num_column, filter_column, value_column) - ! - ! !DESCRIPTION: - ! Set carbon state variables - ! - ! !ARGUMENTS: - class (soilbiogeochem_carbonstate_type) :: this - integer , intent(in) :: num_column - integer , intent(in) :: filter_column(:) - real(r8), intent(in) :: value_column - ! - ! !LOCAL VARIABLES: - integer :: fi,i,j,k,l ! loop index - !------------------------------------------------------------------------ - - do fi = 1,num_column - i = filter_column(fi) - if ( .not. use_fates ) then - this%cwdc_col(i) = value_column - end if - this%ctrunc_col(i) = value_column - this%totlitc_col(i) = value_column - this%totlitc_1m_col(i) = value_column - this%totsomc_col(i) = value_column - this%totsomc_1m_col(i) = value_column - end do - - do j = 1,nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%ctrunc_vr_col(i,j) = value_column - end do - end do - - do k = 1, ndecomp_pools - do fi = 1,num_column - i = filter_column(fi) - this%decomp_cpools_col(i,k) = value_column - this%decomp_cpools_1m_col(i,k) = value_column - end do - end do - - do j = 1,nlevdecomp_full - do k = 1, ndecomp_pools - do fi = 1,num_column - i = filter_column(fi) - this%decomp_cpools_vr_col(i,j,k) = value_column - end do - end do - end do - - end subroutine SetValues - - !----------------------------------------------------------------------- - subroutine Summary(this, bounds, num_allc, filter_allc) - ! - ! !DESCRIPTION: - ! Perform column-level carbon summary calculations - ! - ! !ARGUMENTS: - class(soilbiogeochem_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_allc ! number of columns in allc filter - integer , intent(in) :: filter_allc(:) ! filter for all active columns - ! - ! !LOCAL VARIABLES: - integer :: c,j,k,l ! indices - integer :: fc ! filter indices - real(r8) :: maxdepth ! depth to integrate soil variables - !----------------------------------------------------------------------- - - ! vertically integrate each of the decomposing C pools - do l = 1, ndecomp_pools - do fc = 1,num_allc - c = filter_allc(fc) - this%decomp_cpools_col(c,l) = 0._r8 - end do - end do - do l = 1, ndecomp_pools - do j = 1, nlevdecomp - do fc = 1,num_allc - c = filter_allc(fc) - this%decomp_cpools_col(c,l) = & - this%decomp_cpools_col(c,l) + & - this%decomp_cpools_vr_col(c,j,l) * dzsoi_decomp(j) - end do - end do - end do - - if ( nlevdecomp > 1) then - - ! vertically integrate each of the decomposing C pools to 1 meter - maxdepth = 1._r8 - do l = 1, ndecomp_pools - do fc = 1,num_allc - c = filter_allc(fc) - this%decomp_cpools_1m_col(c,l) = 0._r8 - end do - end do - do l = 1, ndecomp_pools - do j = 1, nlevdecomp - if ( zisoi(j) <= maxdepth ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%decomp_cpools_1m_col(c,l) = & - this%decomp_cpools_1m_col(c,l) + & - this%decomp_cpools_vr_col(c,j,l) * dzsoi_decomp(j) - end do - elseif ( zisoi(j-1) < maxdepth ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%decomp_cpools_1m_col(c,l) = & - this%decomp_cpools_1m_col(c,l) + & - this%decomp_cpools_vr_col(c,j,l) * (maxdepth - zisoi(j-1)) - end do - endif - end do - end do - - endif - - ! truncation carbon - do fc = 1,num_allc - c = filter_allc(fc) - this%ctrunc_col(c) = 0._r8 - end do - do j = 1, nlevdecomp - do fc = 1,num_allc - c = filter_allc(fc) - this%ctrunc_col(c) = & - this%ctrunc_col(c) + & - this%ctrunc_vr_col(c,j) * dzsoi_decomp(j) - end do - end do - - ! total litter carbon in the top meter (TOTLITC_1m) - if ( nlevdecomp > 1) then - do fc = 1,num_allc - c = filter_allc(fc) - this%totlitc_1m_col(c) = 0._r8 - end do - do l = 1, ndecomp_pools - if ( decomp_cascade_con%is_litter(l) ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%totlitc_1m_col(c) = this%totlitc_1m_col(c) + & - this%decomp_cpools_1m_col(c,l) - end do - endif - end do - end if - - ! total soil organic matter carbon in the top meter (TOTSOMC_1m) - if ( nlevdecomp > 1) then - do fc = 1,num_allc - c = filter_allc(fc) - this%totsomc_1m_col(c) = 0._r8 - end do - do l = 1, ndecomp_pools - if ( decomp_cascade_con%is_soil(l) ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%totsomc_1m_col(c) = this%totsomc_1m_col(c) + this%decomp_cpools_1m_col(c,l) - end do - end if - end do - end if - - ! total litter carbon (TOTLITC) - do fc = 1,num_allc - c = filter_allc(fc) - this%totlitc_col(c) = 0._r8 - end do - do l = 1, ndecomp_pools - if ( decomp_cascade_con%is_litter(l) ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%totlitc_col(c) = this%totlitc_col(c) + this%decomp_cpools_col(c,l) - end do - endif - end do - - ! total soil organic matter carbon (TOTSOMC) - do fc = 1,num_allc - c = filter_allc(fc) - this%totsomc_col(c) = 0._r8 - end do - do l = 1, ndecomp_pools - if ( decomp_cascade_con%is_soil(l) ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%totsomc_col(c) = this%totsomc_col(c) + this%decomp_cpools_col(c,l) - end do - end if - end do - - ! coarse woody debris carbon - if (.not. use_fates ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%cwdc_col(c) = 0._r8 - end do - do l = 1, ndecomp_pools - if ( decomp_cascade_con%is_cwd(l) ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%cwdc_col(c) = this%cwdc_col(c) + this%decomp_cpools_col(c,l) - end do - end if - end do - - end if - - end subroutine Summary - - !------------------------------------------------------------------------ - subroutine SetTotVgCThresh(this, totvegcthresh) - - class(soilbiogeochem_carbonstate_type) :: this - real(r8) , intent(in) :: totvegcthresh - - if ( totvegcthresh <= 0.0_r8 )then - call endrun(msg=' ERROR totvegcthresh is zero or negative and should be > 0'//& - errMsg(sourcefile, __LINE__)) - end if - this%totvegcthresh = totvegcthresh - - end subroutine SetTotVgCThresh - -end module SoilBiogeochemCarbonStateType diff --git a/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 b/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 deleted file mode 100644 index e636fd3085..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 +++ /dev/null @@ -1,578 +0,0 @@ -module SoilBiogeochemDecompCascadeBGCMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Sets the coeffiecients used in the decomposition cascade submodel. - ! This uses the CENTURY/BGC parameters - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : nlevsoi, nlevgrnd, nlevdecomp, ndecomp_cascade_transitions, ndecomp_pools - use clm_varpar , only : i_met_lit, i_cel_lit, i_lig_lit, i_cwd - use clm_varctl , only : iulog, spinup_state, anoxia, use_vertsoilc, use_fates - use clm_varcon , only : zsoi - use decompMod , only : bounds_type - use spmdMod , only : masterproc - use abortutils , only : endrun - use CNSharedParamsMod , only : CNParamsShareInst, anoxia_wtsat, nlev_soildecomp_standard - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilStateType , only : soilstate_type - use CanopyStateType , only : canopystate_type - use TemperatureType , only : temperature_type - use ch4Mod , only : ch4_type - use ColumnType , only : col - use GridcellType , only : grc - use SoilBiogeochemStateType , only : get_spinup_latitude_term - - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: readParams ! Read in parameters from params file - public :: init_decompcascade_bgc ! Initialization - ! - ! !PUBLIC DATA MEMBERS - logical , public :: normalize_q10_to_century_tfunc = .true.! do we normalize the century decomp. rates so that they match the CLM Q10 at a given tep? - logical , public :: use_century_tfunc = .false. - real(r8), public :: normalization_tref = 15._r8 ! reference temperature for normalizaion (degrees C) - ! - ! !PRIVATE DATA MEMBERS - - integer, private :: i_soil1 = -9 ! Soil Organic Matter (SOM) first pool - integer, private :: i_soil2 = -9 ! SOM second pool - integer, private :: i_soil3 = -9 ! SOM third pool - integer, private, parameter :: nsompools = 3 ! Number of SOM pools - integer, private, parameter :: i_litr1 = i_met_lit ! First litter pool, metobolic - integer, private, parameter :: i_litr2 = i_cel_lit ! Second litter pool, cellulose - integer, private, parameter :: i_litr3 = i_lig_lit ! Third litter pool, lignin - - type, private :: params_type - real(r8):: cn_s1_bgc !C:N for SOM 1 - real(r8):: cn_s2_bgc !C:N for SOM 2 - real(r8):: cn_s3_bgc !C:N for SOM 3 - - real(r8):: rf_l1s1_bgc !respiration fraction litter 1 -> SOM 1 - real(r8):: rf_l2s1_bgc - real(r8):: rf_l3s2_bgc - - real(r8):: rf_s2s1_bgc - real(r8):: rf_s2s3_bgc - real(r8):: rf_s3s1_bgc - - real(r8):: rf_cwdl2_bgc - real(r8):: rf_cwdl3_bgc - - real(r8):: tau_l1_bgc ! turnover time of litter 1 (yr) - real(r8):: tau_l2_l3_bgc ! turnover time of litter 2 and litter 3 (yr) - real(r8):: tau_s1_bgc ! turnover time of SOM 1 (yr) - real(r8):: tau_s2_bgc ! turnover time of SOM 2 (yr) - real(r8):: tau_s3_bgc ! turnover time of SOM 3 (yr) - real(r8):: tau_cwd_bgc ! corrected fragmentation rate constant CWD - - real(r8) :: cwd_fcel_bgc !cellulose fraction for CWD - real(r8) :: cwd_flig_bgc ! - - real(r8) :: k_frag_bgc !fragmentation rate for CWD - real(r8) :: minpsi_bgc !minimum soil water potential for heterotrophic resp - real(r8) :: maxpsi_bgc !maximum soil water potential for heterotrophic resp - - real(r8) :: initial_Cstocks(nsompools) ! Initial Carbon stocks for a cold-start - real(r8) :: initial_Cstocks_depth ! Soil depth for initial Carbon stocks for a cold-start - - end type params_type - ! - type(params_type), private :: params_inst - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !DESCRIPTION: - ! - ! !USES: - use ncdio_pio , only: file_desc_t,ncd_io - ! - ! !ARGUMENTS: - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNDecompBgcParamsType' - character(len=100) :: errCode = 'Error reading in CN const file ' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - ! Read off of netcdf file - tString='tau_l1' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%tau_l1_bgc=tempr - - tString='tau_l2_l3' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%tau_l2_l3_bgc=tempr - - tString='tau_s1' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%tau_s1_bgc=tempr - - tString='tau_s2' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%tau_s2_bgc=tempr - - tString='tau_s3' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%tau_s3_bgc=tempr - - tString='tau_cwd' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%tau_cwd_bgc=tempr - - tString='cn_s1_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cn_s1_bgc=tempr - - tString='cn_s2_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cn_s2_bgc=tempr - - tString='cn_s3_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cn_s3_bgc=tempr - - tString='rf_l1s1_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_l1s1_bgc=tempr - - tString='rf_l2s1_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_l2s1_bgc=tempr - - tString='rf_l3s2_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_l3s2_bgc=tempr - - tString='rf_s2s1_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_s2s1_bgc=tempr - - tString='rf_s2s3_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_s2s3_bgc=tempr - - tString='rf_s3s1_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_s3s1_bgc=tempr - - tString='rf_cwdl2_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_cwdl2_bgc=tempr - - tString='rf_cwdl3_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_cwdl3_bgc=tempr - - tString='cwd_fcel' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cwd_fcel_bgc=tempr - - tString='k_frag' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_frag_bgc=tempr - - tString='minpsi_hr' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%minpsi_bgc=tempr - - tString='maxpsi_hr' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%maxpsi_bgc=tempr - - tString='cwd_flig' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cwd_flig_bgc=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine init_decompcascade_bgc(bounds, soilbiogeochem_state_inst, soilstate_inst ) - ! - ! !DESCRIPTION: - ! initialize rate constants and decomposition pathways following the decomposition cascade of the BGC model. - ! written by C. Koven - ! - ! !USES: - use clm_time_manager , only : get_step_size - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(soilbiogeochem_state_type) , intent(inout) :: soilbiogeochem_state_inst - type(soilstate_type) , intent(in) :: soilstate_inst - ! - ! !LOCAL VARIABLES - !-- properties of each decomposing pool - real(r8) :: rf_l1s1 - real(r8) :: rf_l2s1 - real(r8) :: rf_l3s2 - !real(r8) :: rf_s1s2(bounds%begc:bounds%endc,1:nlevdecomp) - !real(r8) :: rf_s1s3(bounds%begc:bounds%endc,1:nlevdecomp) - real(r8), allocatable :: rf_s1s2(:,:) - real(r8), allocatable :: rf_s1s3(:,:) - real(r8) :: rf_s2s1 - real(r8) :: rf_s2s3 - real(r8) :: rf_s3s1 - real(r8) :: rf_cwdl2 - real(r8) :: rf_cwdl3 - real(r8) :: cwd_fcel - real(r8) :: cwd_flig - real(r8) :: cn_s1 - real(r8) :: cn_s2 - real(r8) :: cn_s3 - !real(r8) :: f_s1s2(bounds%begc:bounds%endc,1:nlevdecomp) - !real(r8) :: f_s1s3(bounds%begc:bounds%endc,1:nlevdecomp) - real(r8), allocatable :: f_s1s2(:,:) - real(r8), allocatable :: f_s1s3(:,:) - real(r8) :: f_s2s1 - real(r8) :: f_s2s3 - - integer :: i_l1s1 - integer :: i_l2s1 - integer :: i_l3s2 - integer :: i_s1s2 - integer :: i_s1s3 - integer :: i_s2s1 - integer :: i_s2s3 - integer :: i_s3s1 - integer :: i_cwdl2 - integer :: i_cwdl3 - real(r8):: speedup_fac ! acceleration factor, higher when vertsoilc = .true. - - integer :: c, j ! indices - real(r8) :: t ! temporary variable - !----------------------------------------------------------------------- - - associate( & - rf_decomp_cascade => soilbiogeochem_state_inst%rf_decomp_cascade_col , & ! Input: [real(r8) (:,:,:) ] respired fraction in decomposition step (frac) - pathfrac_decomp_cascade => soilbiogeochem_state_inst%pathfrac_decomp_cascade_col , & ! Input: [real(r8) (:,:,:) ] what fraction of C leaving a given pool passes through a given transition (frac) - - cellsand => soilstate_inst%cellsand_col , & ! Input: [real(r8) (:,:) ] column 3D sand - - cascade_step_name => decomp_cascade_con%cascade_step_name , & ! Output: [character(len=8) (:) ] name of transition - cascade_donor_pool => decomp_cascade_con%cascade_donor_pool , & ! Output: [integer (:) ] which pool is C taken from for a given decomposition step - cascade_receiver_pool => decomp_cascade_con%cascade_receiver_pool , & ! Output: [integer (:) ] which pool is C added to for a given decomposition step - floating_cn_ratio_decomp_pools => decomp_cascade_con%floating_cn_ratio_decomp_pools , & ! Output: [logical (:) ] TRUE => pool has fixed C:N ratio - decomp_pool_name_restart => decomp_cascade_con%decomp_pool_name_restart , & ! Output: [character(len=8) (:) ] name of pool for restart files - decomp_pool_name_history => decomp_cascade_con%decomp_pool_name_history , & ! Output: [character(len=8) (:) ] name of pool for history files - decomp_pool_name_long => decomp_cascade_con%decomp_pool_name_long , & ! Output: [character(len=20) (:) ] name of pool for netcdf long names - decomp_pool_name_short => decomp_cascade_con%decomp_pool_name_short , & ! Output: [character(len=8) (:) ] name of pool for netcdf short names - is_litter => decomp_cascade_con%is_litter , & ! Output: [logical (:) ] TRUE => pool is a litter pool - is_soil => decomp_cascade_con%is_soil , & ! Output: [logical (:) ] TRUE => pool is a soil pool - is_cwd => decomp_cascade_con%is_cwd , & ! Output: [logical (:) ] TRUE => pool is a cwd pool - initial_cn_ratio => decomp_cascade_con%initial_cn_ratio , & ! Output: [real(r8) (:) ] c:n ratio for initialization of pools - initial_stock => decomp_cascade_con%initial_stock , & ! Output: [real(r8) (:) ] initial concentration for seeding at spinup - initial_stock_soildepth => decomp_cascade_con%initial_stock_soildepth , & ! Output: [real(r8) (:) ] soil depth for initial concentration for seeding at spinup - is_metabolic => decomp_cascade_con%is_metabolic , & ! Output: [logical (:) ] TRUE => pool is metabolic material - is_cellulose => decomp_cascade_con%is_cellulose , & ! Output: [logical (:) ] TRUE => pool is cellulose - is_lignin => decomp_cascade_con%is_lignin , & ! Output: [logical (:) ] TRUE => pool is lignin - spinup_factor => decomp_cascade_con%spinup_factor & ! Output: [real(r8) (:) ] factor for AD spinup associated with each pool - - ) - - allocate(rf_s1s2(bounds%begc:bounds%endc,1:nlevdecomp)) - allocate(rf_s1s3(bounds%begc:bounds%endc,1:nlevdecomp)) - allocate(f_s1s2(bounds%begc:bounds%endc,1:nlevdecomp)) - allocate(f_s1s3(bounds%begc:bounds%endc,1:nlevdecomp)) - - !------- time-constant coefficients ---------- ! - ! set soil organic matter compartment C:N ratios - cn_s1 = params_inst%cn_s1_bgc - cn_s2 = params_inst%cn_s2_bgc - cn_s3 = params_inst%cn_s3_bgc - - ! set respiration fractions for fluxes between compartments - rf_l1s1 = params_inst%rf_l1s1_bgc - rf_l2s1 = params_inst%rf_l2s1_bgc - rf_l3s2 = params_inst%rf_l3s2_bgc - rf_s2s1 = params_inst%rf_s2s1_bgc - rf_s2s3 = params_inst%rf_s2s3_bgc - rf_s3s1 = params_inst%rf_s3s1_bgc - - rf_cwdl2 = params_inst%rf_cwdl2_bgc - rf_cwdl3 = params_inst%rf_cwdl3_bgc - - ! set the cellulose and lignin fractions for coarse woody debris - cwd_fcel = params_inst%cwd_fcel_bgc - cwd_flig = params_inst%cwd_flig_bgc - - ! set path fractions - f_s2s1 = 0.42_r8/(0.45_r8) - f_s2s3 = 0.03_r8/(0.45_r8) - - ! some of these are dependent on the soil texture properties - do c = bounds%begc, bounds%endc - do j = 1, nlevdecomp - t = 0.85_r8 - 0.68_r8 * 0.01_r8 * (100._r8 - cellsand(c,j)) - f_s1s2(c,j) = 1._r8 - .004_r8 / (1._r8 - t) - f_s1s3(c,j) = .004_r8 / (1._r8 - t) - rf_s1s2(c,j) = t - rf_s1s3(c,j) = t - end do - end do - initial_stock_soildepth = params_inst%initial_Cstocks_depth - - !------------------- list of pools and their attributes ------------ - floating_cn_ratio_decomp_pools(i_litr1) = .true. - decomp_pool_name_restart(i_litr1) = 'litr1' - decomp_pool_name_history(i_litr1) = 'LITR1' - decomp_pool_name_long(i_litr1) = 'litter 1' - decomp_pool_name_short(i_litr1) = 'L1' - is_litter(i_litr1) = .true. - is_soil(i_litr1) = .false. - is_cwd(i_litr1) = .false. - initial_cn_ratio(i_litr1) = 90._r8 - initial_stock(i_litr1) = 0._r8 - is_metabolic(i_litr1) = .true. - is_cellulose(i_litr1) = .false. - is_lignin(i_litr1) = .false. - - floating_cn_ratio_decomp_pools(i_litr2) = .true. - decomp_pool_name_restart(i_litr2) = 'litr2' - decomp_pool_name_history(i_litr2) = 'LITR2' - decomp_pool_name_long(i_litr2) = 'litter 2' - decomp_pool_name_short(i_litr2) = 'L2' - is_litter(i_litr2) = .true. - is_soil(i_litr2) = .false. - is_cwd(i_litr2) = .false. - initial_cn_ratio(i_litr2) = 90._r8 - initial_stock(i_litr2) = 0._r8 - is_metabolic(i_litr2) = .false. - is_cellulose(i_litr2) = .true. - is_lignin(i_litr2) = .false. - - floating_cn_ratio_decomp_pools(i_litr3) = .true. - decomp_pool_name_restart(i_litr3) = 'litr3' - decomp_pool_name_history(i_litr3) = 'LITR3' - decomp_pool_name_long(i_litr3) = 'litter 3' - decomp_pool_name_short(i_litr3) = 'L3' - is_litter(i_litr3) = .true. - is_soil(i_litr3) = .false. - is_cwd(i_litr3) = .false. - initial_cn_ratio(i_litr3) = 90._r8 - initial_stock(i_litr3) = 0._r8 - is_metabolic(i_litr3) = .false. - is_cellulose(i_litr3) = .false. - is_lignin(i_litr3) = .true. - - if (.not. use_fates) then - ! CWD - floating_cn_ratio_decomp_pools(i_cwd) = .true. - decomp_pool_name_restart(i_cwd) = 'cwd' - decomp_pool_name_history(i_cwd) = 'CWD' - decomp_pool_name_long(i_cwd) = 'coarse woody debris' - decomp_pool_name_short(i_cwd) = 'CWD' - is_litter(i_cwd) = .false. - is_soil(i_cwd) = .false. - is_cwd(i_cwd) = .true. - initial_cn_ratio(i_cwd) = 90._r8 - initial_stock(i_cwd) = 0._r8 - is_metabolic(i_cwd) = .false. - is_cellulose(i_cwd) = .false. - is_lignin(i_cwd) = .false. - endif - - if (.not. use_fates) then - i_soil1 = 5 - else - i_soil1 = 4 - endif - floating_cn_ratio_decomp_pools(i_soil1) = .false. - decomp_pool_name_restart(i_soil1) = 'soil1' - decomp_pool_name_history(i_soil1) = 'SOIL1' - decomp_pool_name_long(i_soil1) = 'soil 1' - decomp_pool_name_short(i_soil1) = 'S1' - is_litter(i_soil1) = .false. - is_soil(i_soil1) = .true. - is_cwd(i_soil1) = .false. - initial_cn_ratio(i_soil1) = cn_s1 - initial_stock(i_soil1) = params_inst%initial_Cstocks(1) - is_metabolic(i_soil1) = .false. - is_cellulose(i_soil1) = .false. - is_lignin(i_soil1) = .false. - - if (.not. use_fates) then - i_soil2 = 6 - else - i_soil2 = 5 - endif - floating_cn_ratio_decomp_pools(i_soil2) = .false. - decomp_pool_name_restart(i_soil2) = 'soil2' - decomp_pool_name_history(i_soil2) = 'SOIL2' - decomp_pool_name_long(i_soil2) = 'soil 2' - decomp_pool_name_short(i_soil2) = 'S2' - is_litter(i_soil2) = .false. - is_soil(i_soil2) = .true. - is_cwd(i_soil2) = .false. - initial_cn_ratio(i_soil2) = cn_s2 - initial_stock(i_soil2) = params_inst%initial_Cstocks(2) - is_metabolic(i_soil2) = .false. - is_cellulose(i_soil2) = .false. - is_lignin(i_soil2) = .false. - - if (.not. use_fates) then - i_soil3 = 7 - else - i_soil3 = 6 - endif - floating_cn_ratio_decomp_pools(i_soil3) = .false. - decomp_pool_name_restart(i_soil3) = 'soil3' - decomp_pool_name_history(i_soil3) = 'SOIL3' - decomp_pool_name_long(i_soil3) = 'soil 3' - decomp_pool_name_short(i_soil3) = 'S3' - is_litter(i_soil3) = .false. - is_soil(i_soil3) = .true. - is_cwd(i_soil3) = .false. - initial_cn_ratio(i_soil3) = cn_s3 - initial_stock(i_soil3) = params_inst%initial_Cstocks(3) - is_metabolic(i_soil3) = .false. - is_cellulose(i_soil3) = .false. - is_lignin(i_soil3) = .false. - - - speedup_fac = 1._r8 - - !lit1 - spinup_factor(i_litr1) = 1._r8 - !lit2,3 - spinup_factor(i_litr2) = 1._r8 - spinup_factor(i_litr3) = 1._r8 - !CWD - if (.not. use_fates) then - spinup_factor(i_cwd) = max(1._r8, (speedup_fac * params_inst%tau_cwd_bgc / 2._r8 )) - end if - !som1 - spinup_factor(i_soil1) = 1._r8 - !som2,3 - spinup_factor(i_soil2) = max(1._r8, (speedup_fac * params_inst%tau_s2_bgc)) - spinup_factor(i_soil3) = max(1._r8, (speedup_fac * params_inst%tau_s3_bgc)) - - if ( masterproc ) then - write(iulog,*) 'Spinup_state ',spinup_state - write(iulog,*) 'Spinup factors ',spinup_factor - end if - - !---------------- list of transitions and their time-independent coefficients ---------------! - i_l1s1 = 1 - cascade_step_name(i_l1s1) = 'L1S1' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l1s1) = rf_l1s1 - cascade_donor_pool(i_l1s1) = i_litr1 - cascade_receiver_pool(i_l1s1) = i_soil1 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l1s1) = 1.0_r8 - - i_l2s1 = 2 - cascade_step_name(i_l2s1) = 'L2S1' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l2s1) = rf_l2s1 - cascade_donor_pool(i_l2s1) = i_litr2 - cascade_receiver_pool(i_l2s1) = i_soil1 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l2s1)= 1.0_r8 - - i_l3s2 = 3 - cascade_step_name(i_l3s2) = 'L3S2' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l3s2) = rf_l3s2 - cascade_donor_pool(i_l3s2) = i_litr3 - cascade_receiver_pool(i_l3s2) = i_soil2 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l3s2) = 1.0_r8 - - i_s1s2 = 4 - cascade_step_name(i_s1s2) = 'S1S2' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s1s2) = rf_s1s2(bounds%begc:bounds%endc,1:nlevdecomp) - cascade_donor_pool(i_s1s2) = i_soil1 - cascade_receiver_pool(i_s1s2) = i_soil2 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s1s2) = f_s1s2(bounds%begc:bounds%endc,1:nlevdecomp) - - i_s1s3 = 5 - cascade_step_name(i_s1s3) = 'S1S3' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s1s3) = rf_s1s3(bounds%begc:bounds%endc,1:nlevdecomp) - cascade_donor_pool(i_s1s3) = i_soil1 - cascade_receiver_pool(i_s1s3) = i_soil3 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s1s3) = f_s1s3(bounds%begc:bounds%endc,1:nlevdecomp) - - i_s2s1 = 6 - cascade_step_name(i_s2s1) = 'S2S1' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s2s1) = rf_s2s1 - cascade_donor_pool(i_s2s1) = i_soil2 - cascade_receiver_pool(i_s2s1) = i_soil1 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s2s1) = f_s2s1 - - i_s2s3 = 7 - cascade_step_name(i_s2s3) = 'S2S3' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s2s3) = rf_s2s3 - cascade_donor_pool(i_s2s3) = i_soil2 - cascade_receiver_pool(i_s2s3) = i_soil3 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s2s3) = f_s2s3 - - i_s3s1 = 8 - cascade_step_name(i_s3s1) = 'S3S1' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s3s1) = rf_s3s1 - cascade_donor_pool(i_s3s1) = i_soil3 - cascade_receiver_pool(i_s3s1) = i_soil1 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s3s1) = 1.0_r8 - - if (.not. use_fates) then - i_cwdl2 = 9 - cascade_step_name(i_cwdl2) = 'CWDL2' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_cwdl2) = rf_cwdl2 - cascade_donor_pool(i_cwdl2) = i_cwd - cascade_receiver_pool(i_cwdl2) = i_litr2 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_cwdl2) = cwd_fcel - - i_cwdl3 = 10 - cascade_step_name(i_cwdl3) = 'CWDL3' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_cwdl3) = rf_cwdl3 - cascade_donor_pool(i_cwdl3) = i_cwd - cascade_receiver_pool(i_cwdl3) = i_litr3 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_cwdl3) = cwd_flig - end if - - deallocate(rf_s1s2) - deallocate(rf_s1s3) - deallocate(f_s1s2) - deallocate(f_s1s3) - - end associate - - end subroutine init_decompcascade_bgc - -end module SoilBiogeochemDecompCascadeBGCMod diff --git a/src/soilbiogeochem/SoilBiogeochemDecompCascadeCNMod.F90 b/src/soilbiogeochem/SoilBiogeochemDecompCascadeCNMod.F90 deleted file mode 100644 index 2c4d3b182c..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemDecompCascadeCNMod.F90 +++ /dev/null @@ -1,894 +0,0 @@ -module SoilBiogeochemDecompCascadeCNMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Sets the coeffiecients used in the decomposition cascade submodel. - ! This uses the CN parameters as in CLMCN 4.0 - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : nlevsoi, nlevgrnd, nlevdecomp, ndecomp_cascade_transitions, ndecomp_pools - use clm_varpar , only : i_met_lit, i_cel_lit, i_lig_lit, i_cwd - use clm_varctl , only : iulog, spinup_state, anoxia, use_vertsoilc, use_fates - use clm_varcon , only : zsoi - use decompMod , only : bounds_type - use abortutils , only : endrun - use CNSharedParamsMod , only : CNParamsShareInst, anoxia_wtsat, nlev_soildecomp_standard - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilStateType , only : soilstate_type - use CanopyStateType , only : canopystate_type - use TemperatureType , only : temperature_type - use ch4Mod , only : ch4_type - use ColumnType , only : col - - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: readParams - public :: init_decompcascade_cn - public :: decomp_rate_constants_cn - - type, private :: params_type - real(r8):: cn_s1_cn !C:N for SOM 1 - real(r8):: cn_s2_cn !C:N for SOM 2 - real(r8):: cn_s3_cn !C:N for SOM 3 - real(r8):: cn_s4_cn !C:N for SOM 4 - - real(r8):: rf_l1s1_cn !respiration fraction litter 1 -> SOM 1 - real(r8):: rf_l2s2_cn !respiration fraction litter 2 -> SOM 2 - real(r8):: rf_l3s3_cn !respiration fraction litter 3 -> SOM 3 - real(r8):: rf_s1s2_cn !respiration fraction SOM 1 -> SOM 2 - real(r8):: rf_s2s3_cn !respiration fraction SOM 2 -> SOM 3 - real(r8):: rf_s3s4_cn !respiration fraction SOM 3 -> SOM 4 - - real(r8) :: cwd_fcel_cn !cellulose fraction for CWD - real(r8) :: cwd_flig_cn ! - - real(r8) :: k_l1_cn !decomposition rate for litter 1 - real(r8) :: k_l2_cn !decomposition rate for litter 2 - real(r8) :: k_l3_cn !decomposition rate for litter 3 - real(r8) :: k_s1_cn !decomposition rate for SOM 1 - real(r8) :: k_s2_cn !decomposition rate for SOM 2 - real(r8) :: k_s3_cn !decomposition rate for SOM 3 - real(r8) :: k_s4_cn !decomposition rate for SOM 4 - - real(r8) :: k_frag_cn !fragmentation rate for CWD - real(r8) :: minpsi_cn !minimum soil water potential for heterotrophic resp - real(r8) :: maxpsi_cn !maximum soil water potential for heterotrophic resp - - integer :: nsompools = 4 - real(r8), allocatable :: spinup_vector(:) ! multipliers for soil decomp during accelerated spinup - - end type params_type - ! - type(params_type), private :: params_inst - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !USES: - use ncdio_pio , only : file_desc_t,ncd_io - ! - ! !ARGUMENTS: - implicit none - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !CALLED FROM: readParamsMod.F90::CNParamsReadFile - ! - ! !REVISION HISTORY: - ! Dec 3 2012 : Created by S. Muszala - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'SoilBiogeochemDecompCnParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - - !EOP - !----------------------------------------------------------------------- - - ! These are not read off of netcdf file - allocate(params_inst%spinup_vector(params_inst%nsompools)) - params_inst%spinup_vector(:) = (/ 1.0_r8, 1.0_r8, 5.0_r8, 70.0_r8 /) - - ! Read off of netcdf file - tString='cn_s1' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cn_s1_cn=tempr - - tString='cn_s2' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cn_s2_cn=tempr - - tString='cn_s3' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cn_s3_cn=tempr - - tString='cn_s4' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cn_s4_cn=tempr - - tString='rf_l1s1' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_l1s1_cn=tempr - - tString='rf_l2s2' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_l2s2_cn=tempr - - tString='rf_l3s3' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_l3s3_cn=tempr - - tString='rf_s1s2' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_s1s2_cn=tempr - - tString='rf_s2s3' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_s2s3_cn=tempr - - tString='rf_s3s4' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_s3s4_cn=tempr - - tString='cwd_fcel' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cwd_fcel_cn=tempr - - tString='k_l1' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_l1_cn=tempr - - tString='k_l2' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_l2_cn=tempr - - tString='k_l3' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_l3_cn=tempr - - tString='k_s1' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_s1_cn=tempr - - tString='k_s2' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_s2_cn=tempr - - tString='k_s3' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_s3_cn=tempr - - tString='k_s4' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_s4_cn=tempr - - tString='k_frag' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_frag_cn=tempr - - tString='minpsi_hr' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%minpsi_cn=tempr - - tString='maxpsi_hr' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%maxpsi_cn=tempr - - tString='cwd_flig' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cwd_flig_cn=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine init_decompcascade_cn(bounds, soilbiogeochem_state_inst) - ! - ! !DESCRIPTION: - ! initialize rate constants and decomposition pathways for the BGC model originally implemented in CLM-CN - ! written by C. Koven based on original CLM4 decomposition cascade by P. Thornton - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(soilbiogeochem_state_type) , intent(inout) :: soilbiogeochem_state_inst - ! - !-- properties of each pathway along decomposition cascade - !-- properties of each decomposing pool - real(r8) :: rf_l1s1 !respiration fraction litter 1 -> SOM 1 - real(r8) :: rf_l2s2 !respiration fraction litter 2 -> SOM 2 - real(r8) :: rf_l3s3 !respiration fraction litter 3 -> SOM 3 - real(r8) :: rf_s1s2 !respiration fraction SOM 1 -> SOM 2 - real(r8) :: rf_s2s3 !respiration fraction SOM 2 -> SOM 3 - real(r8) :: rf_s3s4 !respiration fraction SOM 3 -> SOM 4 - real(r8) :: cwd_fcel - real(r8) :: cwd_flig - real(r8) :: cn_s1 - real(r8) :: cn_s2 - real(r8) :: cn_s3 - real(r8) :: cn_s4 - - integer :: i_litr1 - integer :: i_litr2 - integer :: i_litr3 - integer :: i_soil1 - integer :: i_soil2 - integer :: i_soil3 - integer :: i_soil4 - integer :: i_atm - integer :: i_l1s1 - integer :: i_l2s2 - integer :: i_l3s3 - integer :: i_s1s2 - integer :: i_s2s3 - integer :: i_s3s4 - integer :: i_s4atm - integer :: i_cwdl2 - integer :: i_cwdl3 - !----------------------------------------------------------------------- - - associate( & - rf_decomp_cascade => soilbiogeochem_state_inst%rf_decomp_cascade_col , & ! Output: [real(r8) (:,:,:) ] respired fraction in decomposition step (frac) - pathfrac_decomp_cascade => soilbiogeochem_state_inst%pathfrac_decomp_cascade_col , & ! Output: [real(r8) (:,:,:) ] what fraction of C leaving a given pool passes through a given transition (frac) - - cascade_step_name => decomp_cascade_con%cascade_step_name , & ! Output: [character(len=8) (:) ] name of transition - cascade_donor_pool => decomp_cascade_con%cascade_donor_pool , & ! Output: [integer (:) ] which pool is C taken from for a given decomposition step - cascade_receiver_pool => decomp_cascade_con%cascade_receiver_pool , & ! Output: [integer (:) ] which pool is C added to for a given decomposition step - floating_cn_ratio_decomp_pools => decomp_cascade_con%floating_cn_ratio_decomp_pools , & ! Output: [logical (:) ] TRUE => pool has fixed C:N ratio - decomp_pool_name_restart => decomp_cascade_con%decomp_pool_name_restart , & ! Output: [character(len=8) (:) ] name of pool for restart files - decomp_pool_name_history => decomp_cascade_con%decomp_pool_name_history , & ! Output: [character(len=8) (:) ] name of pool for history files - decomp_pool_name_long => decomp_cascade_con%decomp_pool_name_long , & ! Output: [character(len=20) (:) ] name of pool for netcdf long names - decomp_pool_name_short => decomp_cascade_con%decomp_pool_name_short , & ! Output: [character(len=8) (:) ] name of pool for netcdf short names - is_litter => decomp_cascade_con%is_litter , & ! Output: [logical (:) ] TRUE => pool is a litter pool - is_soil => decomp_cascade_con%is_soil , & ! Output: [logical (:) ] TRUE => pool is a soil pool - is_cwd => decomp_cascade_con%is_cwd , & ! Output: [logical (:) ] TRUE => pool is a cwd pool - initial_cn_ratio => decomp_cascade_con%initial_cn_ratio , & ! Output: [real(r8) (:) ] c:n ratio for initialization of pools - initial_stock => decomp_cascade_con%initial_stock , & ! Output: [real(r8) (:) ] initial concentration for seeding at spinup - is_metabolic => decomp_cascade_con%is_metabolic , & ! Output: [logical (:) ] TRUE => pool is metabolic material - is_cellulose => decomp_cascade_con%is_cellulose , & ! Output: [logical (:) ] TRUE => pool is cellulose - is_lignin => decomp_cascade_con%is_lignin , & ! Output: [logical (:) ] TRUE => pool is lignin - spinup_factor => decomp_cascade_con%spinup_factor & ! Output: [real(r8) (:) ] factor for AD spinup associated with each pool - ) - - !------- time-constant coefficients ---------- ! - ! set soil organic matter compartment C:N ratios (from Biome-BGC v4.2.0) - cn_s1=params_inst%cn_s1_cn - cn_s2=params_inst%cn_s2_cn - cn_s3=params_inst%cn_s3_cn - cn_s4=params_inst%cn_s4_cn - - ! set respiration fractions for fluxes between compartments - ! (from Biome-BGC v4.2.0) - rf_l1s1=params_inst%rf_l1s1_cn - rf_l2s2=params_inst%rf_l2s2_cn - rf_l3s3=params_inst%rf_l3s3_cn - rf_s1s2=params_inst%rf_s1s2_cn - rf_s2s3=params_inst%rf_s2s3_cn - rf_s3s4=params_inst%rf_s3s4_cn - - ! set the cellulose and lignin fractions for coarse woody debris - cwd_fcel=params_inst%cwd_fcel_cn - cwd_flig=params_inst%cwd_flig_cn - - !------------------- list of pools and their attributes ------------ - - i_litr1 = i_met_lit - floating_cn_ratio_decomp_pools(i_litr1) = .true. - decomp_pool_name_restart(i_litr1) = 'litr1' - decomp_pool_name_history(i_litr1) = 'LITR1' - decomp_pool_name_long(i_litr1) = 'litter 1' - decomp_pool_name_short(i_litr1) = 'L1' - is_litter(i_litr1) = .true. - is_soil(i_litr1) = .false. - is_cwd(i_litr1) = .false. - initial_cn_ratio(i_litr1) = 90._r8 - initial_stock(i_litr1) = 0._r8 - is_metabolic(i_litr1) = .true. - is_cellulose(i_litr1) = .false. - is_lignin(i_litr1) = .false. - - i_litr2 = i_cel_lit - floating_cn_ratio_decomp_pools(i_litr2) = .true. - decomp_pool_name_restart(i_litr2) = 'litr2' - decomp_pool_name_history(i_litr2) = 'LITR2' - decomp_pool_name_long(i_litr2) = 'litter 2' - decomp_pool_name_short(i_litr2) = 'L2' - is_litter(i_litr2) = .true. - is_soil(i_litr2) = .false. - is_cwd(i_litr2) = .false. - initial_cn_ratio(i_litr2) = 90._r8 - initial_stock(i_litr2) = 0._r8 - is_metabolic(i_litr2) = .false. - is_cellulose(i_litr2) = .true. - is_lignin(i_litr2) = .false. - - i_litr3 = i_lig_lit - floating_cn_ratio_decomp_pools(i_litr3) = .true. - decomp_pool_name_restart(i_litr3) = 'litr3' - decomp_pool_name_history(i_litr3) = 'LITR3' - decomp_pool_name_long(i_litr3) = 'litter 3' - decomp_pool_name_short(i_litr3) = 'L3' - is_litter(i_litr3) = .true. - is_soil(i_litr3) = .false. - is_cwd(i_litr3) = .false. - initial_cn_ratio(i_litr3) = 90._r8 - initial_stock(i_litr3) = 0._r8 - is_metabolic(i_litr3) = .false. - is_cellulose(i_litr3) = .false. - is_lignin(i_litr3) = .true. - - if (.not. use_fates) then - floating_cn_ratio_decomp_pools(i_cwd) = .true. - decomp_pool_name_restart(i_cwd) = 'cwd' - decomp_pool_name_history(i_cwd) = 'CWD' - decomp_pool_name_long(i_cwd) = 'coarse woody debris' - decomp_pool_name_short(i_cwd) = 'CWD' - is_litter(i_cwd) = .false. - is_soil(i_cwd) = .false. - is_cwd(i_cwd) = .true. - initial_cn_ratio(i_cwd) = 500._r8 - initial_stock(i_cwd) = 0._r8 - is_metabolic(i_cwd) = .false. - is_cellulose(i_cwd) = .false. - is_lignin(i_cwd) = .false. - end if - - if ( .not. use_fates ) then - i_soil1 = 5 - else - i_soil1 = 4 - endif - floating_cn_ratio_decomp_pools(i_soil1) = .false. - decomp_pool_name_restart(i_soil1) = 'soil1' - decomp_pool_name_history(i_soil1) = 'SOIL1' - decomp_pool_name_long(i_soil1) = 'soil 1' - decomp_pool_name_short(i_soil1) = 'S1' - is_litter(i_soil1) = .false. - is_soil(i_soil1) = .true. - is_cwd(i_soil1) = .false. - initial_cn_ratio(i_soil1) = cn_s1 - initial_stock(i_soil1) = 0._r8 - is_metabolic(i_soil1) = .false. - is_cellulose(i_soil1) = .false. - is_lignin(i_soil1) = .false. - - if ( .not. use_fates ) then - i_soil2 = 6 - else - i_soil2 = 5 - endif - floating_cn_ratio_decomp_pools(i_soil2) = .false. - decomp_pool_name_restart(i_soil2) = 'soil2' - decomp_pool_name_history(i_soil2) = 'SOIL2' - decomp_pool_name_long(i_soil2) = 'soil 2' - decomp_pool_name_short(i_soil2) = 'S2' - is_litter(i_soil2) = .false. - is_soil(i_soil2) = .true. - is_cwd(i_soil2) = .false. - initial_cn_ratio(i_soil2) = cn_s2 - initial_stock(i_soil2) = 0._r8 - is_metabolic(i_soil2) = .false. - is_cellulose(i_soil2) = .false. - is_lignin(i_soil2) = .false. - - if ( .not. use_fates ) then - i_soil3 = 7 - else - i_soil3 = 6 - endif - floating_cn_ratio_decomp_pools(i_soil3) = .false. - decomp_pool_name_restart(i_soil3) = 'soil3' - decomp_pool_name_history(i_soil3) = 'SOIL3' - decomp_pool_name_long(i_soil3) = 'soil 3' - decomp_pool_name_short(i_soil3) = 'S3' - is_litter(i_soil3) = .false. - is_soil(i_soil3) = .true. - is_cwd(i_soil3) = .false. - initial_cn_ratio(i_soil3) = cn_s3 - initial_stock(i_soil3) = 0._r8 - is_metabolic(i_soil3) = .false. - is_cellulose(i_soil3) = .false. - is_lignin(i_soil3) = .false. - - if ( .not. use_fates ) then - i_soil4 = 8 - else - i_soil4 = 7 - endif - floating_cn_ratio_decomp_pools(i_soil4) = .false. - decomp_pool_name_restart(i_soil4) = 'soil4' - decomp_pool_name_history(i_soil4) = 'SOIL4' - decomp_pool_name_long(i_soil4) = 'soil 4' - decomp_pool_name_short(i_soil4) = 'S4' - is_litter(i_soil4) = .false. - is_soil(i_soil4) = .true. - is_cwd(i_soil4) = .false. - initial_cn_ratio(i_soil4) = cn_s4 - initial_stock(i_soil4) = 10._r8 - is_metabolic(i_soil4) = .false. - is_cellulose(i_soil4) = .false. - is_lignin(i_soil4) = .false. - - i_atm = 0 !! for terminal pools (i.e. 100% respiration) - floating_cn_ratio_decomp_pools(i_atm) = .false. - decomp_pool_name_restart(i_atm) = 'atmosphere' - decomp_pool_name_history(i_atm) = 'atmosphere' - decomp_pool_name_long(i_atm) = 'atmosphere' - decomp_pool_name_short(i_atm) = '' - is_litter(i_atm) = .true. - is_soil(i_atm) = .false. - is_cwd(i_atm) = .false. - initial_cn_ratio(i_atm) = 0._r8 - initial_stock(i_atm) = 0._r8 - is_metabolic(i_atm) = .false. - is_cellulose(i_atm) = .false. - is_lignin(i_atm) = .false. - - - spinup_factor(i_litr1) = 1._r8 - spinup_factor(i_litr2) = 1._r8 - spinup_factor(i_litr3) = 1._r8 - if (.not. use_fates) then - spinup_factor(i_cwd) = 1._r8 - end if - spinup_factor(i_soil1) = params_inst%spinup_vector(1) - spinup_factor(i_soil2) = params_inst%spinup_vector(2) - spinup_factor(i_soil3) = params_inst%spinup_vector(3) - spinup_factor(i_soil4) = params_inst%spinup_vector(4) - - - !---------------- list of transitions and their time-independent coefficients ---------------! - i_l1s1 = 1 - cascade_step_name(i_l1s1) = 'L1S1' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l1s1) = rf_l1s1 - cascade_donor_pool(i_l1s1) = i_litr1 - cascade_receiver_pool(i_l1s1) = i_soil1 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l1s1) = 1.0_r8 - - i_l2s2 = 2 - cascade_step_name(i_l2s2) = 'L2S2' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l2s2) = rf_l2s2 - cascade_donor_pool(i_l2s2) = i_litr2 - cascade_receiver_pool(i_l2s2) = i_soil2 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l2s2) = 1.0_r8 - - i_l3s3 = 3 - cascade_step_name(i_l3s3) = 'L3S3' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l3s3) = rf_l3s3 - cascade_donor_pool(i_l3s3) = i_litr3 - cascade_receiver_pool(i_l3s3) = i_soil3 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l3s3) = 1.0_r8 - - i_s1s2 = 4 - cascade_step_name(i_s1s2) = 'S1S2' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s1s2) = rf_s1s2 - cascade_donor_pool(i_s1s2) = i_soil1 - cascade_receiver_pool(i_s1s2) = i_soil2 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s1s2) = 1.0_r8 - - i_s2s3 = 5 - cascade_step_name(i_s2s3) = 'S2S3' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s2s3) = rf_s2s3 - cascade_donor_pool(i_s2s3) = i_soil2 - cascade_receiver_pool(i_s2s3) = i_soil3 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s2s3) = 1.0_r8 - - i_s3s4 = 6 - cascade_step_name(i_s3s4) = 'S3S4' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s3s4) = rf_s3s4 - cascade_donor_pool(i_s3s4) = i_soil3 - cascade_receiver_pool(i_s3s4) = i_soil4 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s3s4) = 1.0_r8 - - i_s4atm = 7 - cascade_step_name(i_s4atm) = 'S4' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s4atm) = 1. - cascade_donor_pool(i_s4atm) = i_soil4 - cascade_receiver_pool(i_s4atm) = i_atm - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s4atm) = 1.0_r8 - - if (.not. use_fates) then - i_cwdl2 = 8 - cascade_step_name(i_cwdl2) = 'CWDL2' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_cwdl2) = 0._r8 - cascade_donor_pool(i_cwdl2) = i_cwd - cascade_receiver_pool(i_cwdl2) = i_litr2 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_cwdl2) = cwd_fcel - - i_cwdl3 = 9 - cascade_step_name(i_cwdl3) = 'CWDL3' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_cwdl3) = 0._r8 - cascade_donor_pool(i_cwdl3) = i_cwd - cascade_receiver_pool(i_cwdl3) = i_litr3 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_cwdl3) = cwd_flig - end if - - end associate - - end subroutine init_decompcascade_cn - - !----------------------------------------------------------------------- - subroutine decomp_rate_constants_cn(bounds, & - num_soilc, filter_soilc, & - canopystate_inst, soilstate_inst, temperature_inst, ch4_inst, soilbiogeochem_carbonflux_inst) - ! - ! !DESCRIPTION: - ! calculate rate constants and decomposition pathways for the BGC model - ! originally implemented in CLM-CN - ! written by C. Koven based on original CLM4 decomposition cascade by P. Thornton - ! - ! !USES: - use clm_time_manager, only : get_step_size - use clm_varcon , only : secspday - use clm_varpar , only : i_cwd - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(canopystate_type) , intent(in) :: canopystate_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(ch4_type) , intent(in) :: ch4_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - ! - ! !LOCAL VARIABLES: - real(r8):: dt ! decomp timestep (seconds) - real(r8):: dtd ! decomp timestep (days) - real(r8):: frw(bounds%begc:bounds%endc) ! rooting fraction weight - real(r8), allocatable:: fr(:,:) ! column-level rooting fraction by soil depth - real(r8):: minpsi, maxpsi ! limits for soil water scalar for decomp - real(r8):: psi ! temporary soilpsi for water scalar - real(r8):: rate_scalar ! combined rate scalar for decomp - real(r8):: k_l1 ! decomposition rate constant litter 1 - real(r8):: k_l2 ! decomposition rate constant litter 2 - real(r8):: k_l3 ! decomposition rate constant litter 3 - real(r8):: k_s1 ! decomposition rate constant SOM 1 - real(r8):: k_s2 ! decomposition rate constant SOM 2 - real(r8):: k_s3 ! decomposition rate constant SOM 3 - real(r8):: k_s4 ! decomposition rate constant SOM 4 - real(r8):: k_frag ! fragmentation rate constant CWD - real(r8):: ck_l1 ! corrected decomposition rate constant litter 1 - real(r8):: ck_l2 ! corrected decomposition rate constant litter 2 - real(r8):: ck_l3 ! corrected decomposition rate constant litter 3 - real(r8):: ck_s1 ! corrected decomposition rate constant SOM 1 - real(r8):: ck_s2 ! corrected decomposition rate constant SOM 2 - real(r8):: ck_s3 ! corrected decomposition rate constant SOM 3 - real(r8):: ck_s4 ! corrected decomposition rate constant SOM 4 - real(r8):: ck_frag ! corrected fragmentation rate constant CWD - real(r8):: cwdc_loss ! fragmentation rate for CWD carbon (gC/m2/s) - real(r8):: cwdn_loss ! fragmentation rate for CWD nitrogen (gN/m2/s) - integer :: i_litr1 - integer :: i_litr2 - integer :: i_litr3 - integer :: i_soil1 - integer :: i_soil2 - integer :: i_soil3 - integer :: i_soil4 - integer :: c, fc, j, k, l - real(r8):: Q10 ! temperature dependence - real(r8):: froz_q10 ! separate q10 for frozen soil respiration rates. default to same as above zero rates - real(r8):: decomp_depth_efolding ! (meters) e-folding depth for reduction in decomposition [ - real(r8):: depth_scalar(bounds%begc:bounds%endc,1:nlevdecomp) - real(r8) :: mino2lim ! minimum anaerobic decomposition rate as a - ! fraction of potential aerobic rate - !----------------------------------------------------------------------- - - associate( & - dz => col%dz , & ! Input: [real(r8) (:,:) ] soil layer thickness (m) - - soilpsi => soilstate_inst%soilpsi_col , & ! Input: [real(r8) (:,:) ] soil water potential in each soil layer (MPa) - - alt_indx => canopystate_inst%alt_indx_col , & ! Input: [integer (:) ] current depth of thaw - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - - o2stress_sat => ch4_inst%o2stress_sat_col , & ! Input: [real(r8) (:,:) ] Ratio of oxygen available to that demanded by roots, aerobes, & methanotrophs (nlevsoi) - o2stress_unsat => ch4_inst%o2stress_unsat_col , & ! Input: [real(r8) (:,:) ] Ratio of oxygen available to that demanded by roots, aerobes, & methanotrophs (nlevsoi) - finundated => ch4_inst%finundated_col , & ! Input: [real(r8) (:) ] fractional inundated area (excluding dedicated wetland columns) - - t_scalar => soilbiogeochem_carbonflux_inst%t_scalar_col , & ! Output: [real(r8) (:,:) ] soil temperature scalar for decomp - w_scalar => soilbiogeochem_carbonflux_inst%w_scalar_col , & ! Output: [real(r8) (:,:) ] soil water scalar for decomp - o_scalar => soilbiogeochem_carbonflux_inst%o_scalar_col , & ! Output: [real(r8) (:,:) ] fraction by which decomposition is limited by anoxia - decomp_k => soilbiogeochem_carbonflux_inst%decomp_k_col & ! Output: [real(r8) (:,:,:) ] rate constant for decomposition (1./sec) - ) - - mino2lim = CNParamsShareInst%mino2lim - - ! set time steps - dt = real( get_step_size(), r8 ) - dtd = dt/secspday - - ! set initial base rates for decomposition mass loss (1/day) - ! (from Biome-BGC v4.2.0, using three SOM pools) - ! Value inside log function is the discrete-time values for a - ! daily time step model, and the result of the log function is - ! the corresponding continuous-time decay rate (1/day), following - ! Olson, 1963. - k_l1=params_inst%k_l1_cn - k_l2=params_inst%k_l2_cn - k_l3=params_inst%k_l3_cn - - k_s1=params_inst%k_s1_cn - k_s2=params_inst%k_s2_cn - k_s3=params_inst%k_s3_cn - k_s4=params_inst%k_s4_cn - - k_frag=params_inst%k_frag_cn - - ! calculate the new discrete-time decay rate for model timestep - k_l1 = 1.0_r8-exp(-k_l1*dtd) - k_l2 = 1.0_r8-exp(-k_l2*dtd) - k_l3 = 1.0_r8-exp(-k_l3*dtd) - - k_s1 = 1.0_r8-exp(-k_s1*dtd) - k_s2 = 1.0_r8-exp(-k_s2*dtd) - k_s3 = 1.0_r8-exp(-k_s3*dtd) - k_s4 = 1.0_r8-exp(-k_s4*dtd) - - k_frag = 1.0_r8-exp(-k_frag*dtd) - - minpsi = params_inst%minpsi_cn - maxpsi = params_inst%maxpsi_cn - - Q10 = CNParamsShareInst%Q10 - - ! set "froz_q10" parameter - froz_q10 = CNParamsShareInst%froz_q10 - - if (use_vertsoilc) then - ! Set "decomp_depth_efolding" parameter - decomp_depth_efolding = CNParamsShareInst%decomp_depth_efolding - end if - - ! The following code implements the acceleration part of the AD spinup - ! algorithm, by multiplying all of the SOM decomposition base rates by 10.0. - - if ( spinup_state .eq. 1 ) then - k_s1 = k_s1 * params_inst%spinup_vector(1) - k_s2 = k_s2 * params_inst%spinup_vector(2) - k_s3 = k_s3 * params_inst%spinup_vector(3) - k_s4 = k_s4 * params_inst%spinup_vector(4) - endif - - i_litr1 = 1 - i_litr2 = 2 - i_litr3 = 3 - if (use_fates) then - i_soil1 = 4 - i_soil2 = 5 - i_soil3 = 6 - i_soil4 = 7 - else - i_soil1 = 5 - i_soil2 = 6 - i_soil3 = 7 - i_soil4 = 8 - endif - - !--- time dependent coefficients-----! - if ( nlevdecomp .eq. 1 ) then - - ! calculate function to weight the temperature and water potential scalars - ! for decomposition control. - - - ! the following normalizes values in fr so that they - ! sum to 1.0 across top nlevdecomp levels on a column - frw(bounds%begc:bounds%endc) = 0._r8 - nlev_soildecomp_standard=5 - allocate(fr(bounds%begc:bounds%endc,nlev_soildecomp_standard)) - do j=1,nlev_soildecomp_standard - do fc = 1,num_soilc - c = filter_soilc(fc) - frw(c) = frw(c) + dz(c,j) - end do - end do - do j = 1,nlev_soildecomp_standard - do fc = 1,num_soilc - c = filter_soilc(fc) - if (frw(c) /= 0._r8) then - fr(c,j) = dz(c,j) / frw(c) - else - fr(c,j) = 0._r8 - end if - end do - end do - - ! calculate rate constant scalar for soil temperature - ! assuming that the base rate constants are assigned for non-moisture - ! limiting conditions at 25 C. - ! Peter Thornton: 3/13/09 - ! Replaced the Lloyd and Taylor function with a Q10 formula, with Q10 = 1.5 - ! as part of the modifications made to improve the seasonal cycle of - ! atmospheric CO2 concentration in global simulations. This does not impact - ! the base rates at 25 C, which are calibrated from microcosm studies. - do j = 1,nlev_soildecomp_standard - do fc = 1,num_soilc - c = filter_soilc(fc) - if (j==1) t_scalar(c,:) = 0._r8 - !! use separate (possibly equal) t funcs above and below freezing point - !! t_scalar(c,1)=t_scalar(c,1) + (1.5**((t_soisno(c,j)-(SHR_CONST_TKFRZ+25._r8))/10._r8))*fr(c,j) - if (t_soisno(c,j) >= SHR_CONST_TKFRZ) then - t_scalar(c,1)=t_scalar(c,1) + & - (Q10**((t_soisno(c,j)-(SHR_CONST_TKFRZ+25._r8))/10._r8))*fr(c,j) - else - t_scalar(c,1)=t_scalar(c,1) + & - (Q10**(-25._r8/10._r8))*(froz_q10**((t_soisno(c,j)-SHR_CONST_TKFRZ)/10._r8))*fr(c,j) - endif - end do - end do - - ! calculate the rate constant scalar for soil water content. - ! Uses the log relationship with water potential given in - ! Andren, O., and K. Paustian, 1987. Barley straw decomposition in the field: - ! a comparison of models. Ecology, 68(5):1190-1200. - ! and supported by data in - ! Orchard, V.A., and F.J. Cook, 1983. Relationship between soil respiration - ! and soil moisture. Soil Biol. Biochem., 15(4):447-453. - - do j = 1,nlev_soildecomp_standard - do fc = 1,num_soilc - c = filter_soilc(fc) - if (j==1) w_scalar(c,:) = 0._r8 - psi = min(soilpsi(c,j),maxpsi) - ! decomp only if soilpsi is higher than minpsi - if (psi > minpsi) then - w_scalar(c,1) = w_scalar(c,1) + (log(minpsi/psi)/log(minpsi/maxpsi))*fr(c,j) - end if - end do - end do - - o_scalar(bounds%begc:bounds%endc,1:nlevdecomp) = 1._r8 - - deallocate(fr) - - else - - ! calculate rate constant scalar for soil temperature - ! assuming that the base rate constants are assigned for non-moisture - ! limiting conditions at 25 C. - ! Peter Thornton: 3/13/09 - ! Replaced the Lloyd and Taylor function with a Q10 formula, with Q10 = 1.5 - ! as part of the modifications made to improve the seasonal cycle of - ! atmospheric CO2 concentration in global simulations. This does not impact - ! the base rates at 25 C, which are calibrated from microcosm studies. - - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - !! use separate (possibly equal) t funcs above and below freezing point - !! t_scalar(c,j)= (1.5**((t_soisno(c,j)-(SHR_CONST_TKFRZ+25._r8))/10._r8)) - if (t_soisno(c,j) >= SHR_CONST_TKFRZ) then - t_scalar(c,j)= (Q10**((t_soisno(c,j)-(SHR_CONST_TKFRZ+25._r8))/10._r8)) - else - t_scalar(c,j)= (Q10**(-25._r8/10._r8))*(froz_q10**((t_soisno(c,j)-SHR_CONST_TKFRZ)/10._r8)) - endif - end do - end do - - - ! calculate the rate constant scalar for soil water content. - ! Uses the log relationship with water potential given in - ! Andren, O., and K. Paustian, 1987. Barley straw decomposition in the field: - ! a comparison of models. Ecology, 68(5):1190-1200. - ! and supported by data in - ! Orchard, V.A., and F.J. Cook, 1983. Relationship between soil respiration - ! and soil moisture. Soil Biol. Biochem., 15(4):447-453. - - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - psi = min(soilpsi(c,j),maxpsi) - ! decomp only if soilpsi is higher than minpsi - if (psi > minpsi) then - w_scalar(c,j) = (log(minpsi/psi)/log(minpsi/maxpsi)) - else - w_scalar(c,j) = 0._r8 - end if - end do - end do - - end if - - o_scalar(bounds%begc:bounds%endc,1:nlevdecomp) = 1._r8 - - if (use_vertsoilc) then - ! add a term to reduce decomposition rate at depth - ! for now used a fixed e-folding depth - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - depth_scalar(c,j) = exp(-zsoi(j)/decomp_depth_efolding) - end do - end do - end if - - ! calculate rate constants for all litter and som pools - if (use_vertsoilc) then - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - decomp_k(c,j,i_litr1) = k_l1 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_litr2) = k_l2 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_litr3) = k_l3 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_soil1) = k_s1 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_soil2) = k_s2 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_soil3) = k_s3 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_soil4) = k_s4 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) / dt - end do - end do - else - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - decomp_k(c,j,i_litr1) = k_l1 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_litr2) = k_l2 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_litr3) = k_l3 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_soil1) = k_s1 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_soil2) = k_s2 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_soil3) = k_s3 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_soil4) = k_s4 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) / dt - end do - end do - end if - - ! do the same for cwd, but only if fates is not enabled (because fates handles CWD on its own structure - if (.not. use_fates) then - if (use_vertsoilc) then - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - decomp_k(c,j,i_cwd) = k_frag * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) / dt - end do - end do - else - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - decomp_k(c,j,i_cwd) = k_frag * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) / dt - end do - end do - end if - end if - - end associate - - end subroutine decomp_rate_constants_cn - - end module SoilBiogeochemDecompCascadeCNMod diff --git a/src/soilbiogeochem/SoilBiogeochemDecompCascadeConType.F90 b/src/soilbiogeochem/SoilBiogeochemDecompCascadeConType.F90 deleted file mode 100644 index 8a8e2f8dfa..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemDecompCascadeConType.F90 +++ /dev/null @@ -1,104 +0,0 @@ -module SoilBiogeochemDecompCascadeConType - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Decomposition Cascade Type - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: init_decomp_cascade_constants - ! - type, public :: decomp_cascade_type - !-- properties of each pathway along decomposition cascade - character(len=8) , pointer :: cascade_step_name(:) ! name of transition - integer , pointer :: cascade_donor_pool(:) ! which pool is C taken from for a given decomposition step - integer , pointer :: cascade_receiver_pool(:) ! which pool is C added to for a given decomposition step - - !-- properties of each decomposing pool - logical , pointer :: floating_cn_ratio_decomp_pools(:) ! TRUE => pool has fixed C:N ratio - character(len=8) , pointer :: decomp_pool_name_restart(:) ! name of pool for restart files - character(len=8) , pointer :: decomp_pool_name_history(:) ! name of pool for history files - character(len=20) , pointer :: decomp_pool_name_long(:) ! name of pool for netcdf long names - character(len=8) , pointer :: decomp_pool_name_short(:) ! name of pool for netcdf short names - logical , pointer :: is_litter(:) ! TRUE => pool is a litter pool - logical , pointer :: is_soil(:) ! TRUE => pool is a soil pool - logical , pointer :: is_cwd(:) ! TRUE => pool is a cwd pool - real(r8) , pointer :: initial_cn_ratio(:) ! c:n ratio for initialization of pools - real(r8) , pointer :: initial_stock(:) ! initial concentration for seeding at spinup - real(r8) :: initial_stock_soildepth ! soil depth for initial concentration for seeding at spinup - logical , pointer :: is_metabolic(:) ! TRUE => pool is metabolic material - logical , pointer :: is_cellulose(:) ! TRUE => pool is cellulose - logical , pointer :: is_lignin(:) ! TRUE => pool is lignin - real(r8) , pointer :: spinup_factor(:) ! factor by which to scale AD and relevant processes by - end type decomp_cascade_type - - type(decomp_cascade_type), public :: decomp_cascade_con - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine init_decomp_cascade_constants() - ! - ! !DESCRIPTION: - ! Initialize decomposition cascade state - !------------------------------------------------------------------------ - - !-- properties of each pathway along decomposition cascade - allocate(decomp_cascade_con%cascade_step_name(1:ndecomp_cascade_transitions)) - allocate(decomp_cascade_con%cascade_donor_pool(1:ndecomp_cascade_transitions)) - allocate(decomp_cascade_con%cascade_receiver_pool(1:ndecomp_cascade_transitions)) - - ! NOTE(bja, 2015-10) according to Dave Lawrence and Charlie Koven, - ! the indexing of decomposing pools from 0:ndecomp_pools is a - ! bug. The lower bound should be 1. The index zero data shouldn't - ! be used. - - !-- properties of each decomposing pool - allocate(decomp_cascade_con%floating_cn_ratio_decomp_pools(0:ndecomp_pools)) - allocate(decomp_cascade_con%decomp_pool_name_restart(0:ndecomp_pools)) - allocate(decomp_cascade_con%decomp_pool_name_history(0:ndecomp_pools)) - allocate(decomp_cascade_con%decomp_pool_name_long(0:ndecomp_pools)) - allocate(decomp_cascade_con%decomp_pool_name_short(0:ndecomp_pools)) - allocate(decomp_cascade_con%is_litter(0:ndecomp_pools)) - allocate(decomp_cascade_con%is_soil(0:ndecomp_pools)) - allocate(decomp_cascade_con%is_cwd(0:ndecomp_pools)) - allocate(decomp_cascade_con%initial_cn_ratio(0:ndecomp_pools)) - allocate(decomp_cascade_con%initial_stock(0:ndecomp_pools)) - allocate(decomp_cascade_con%is_metabolic(0:ndecomp_pools)) - allocate(decomp_cascade_con%is_cellulose(0:ndecomp_pools)) - allocate(decomp_cascade_con%is_lignin(0:ndecomp_pools)) - allocate(decomp_cascade_con%spinup_factor(1:ndecomp_pools)) - - !-- properties of each pathway along decomposition cascade - decomp_cascade_con%cascade_step_name(1:ndecomp_cascade_transitions) = '' - decomp_cascade_con%cascade_donor_pool(1:ndecomp_cascade_transitions) = 0 - decomp_cascade_con%cascade_receiver_pool(1:ndecomp_cascade_transitions) = 0 - - !-- first initialization of properties of each decomposing pool - decomp_cascade_con%floating_cn_ratio_decomp_pools(0:ndecomp_pools) = .false. - decomp_cascade_con%decomp_pool_name_history(0:ndecomp_pools) = '' - decomp_cascade_con%decomp_pool_name_restart(0:ndecomp_pools) = '' - decomp_cascade_con%decomp_pool_name_long(0:ndecomp_pools) = '' - decomp_cascade_con%decomp_pool_name_short(0:ndecomp_pools) = '' - decomp_cascade_con%is_litter(0:ndecomp_pools) = .false. - decomp_cascade_con%is_soil(0:ndecomp_pools) = .false. - decomp_cascade_con%is_cwd(0:ndecomp_pools) = .false. - decomp_cascade_con%initial_cn_ratio(0:ndecomp_pools) = nan - decomp_cascade_con%initial_stock(0:ndecomp_pools) = nan - decomp_cascade_con%initial_stock_soildepth = 0.3 - decomp_cascade_con%is_metabolic(0:ndecomp_pools) = .false. - decomp_cascade_con%is_cellulose(0:ndecomp_pools) = .false. - decomp_cascade_con%is_lignin(0:ndecomp_pools) = .false. - decomp_cascade_con%spinup_factor(1:ndecomp_pools) = nan - - end subroutine init_decomp_cascade_constants - -end module SoilBiogeochemDecompCascadeConType diff --git a/src/soilbiogeochem/SoilBiogeochemDecompMod.F90 b/src/soilbiogeochem/SoilBiogeochemDecompMod.F90 deleted file mode 100644 index 7906d8a85c..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemDecompMod.F90 +++ /dev/null @@ -1,245 +0,0 @@ -module SoilBiogeochemDecompMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module holding routines used in litter and soil decomposition model - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use clm_varpar , only : nlevdecomp, ndecomp_cascade_transitions, ndecomp_pools - use clm_varctl , only : use_nitrif_denitrif, use_fates - use clm_varcon , only : dzsoi_decomp - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: readParams - public :: SoilBiogeochemDecomp - ! - type, private :: params_type - real(r8) :: dnp !denitrification proportion - end type params_type - ! - type(params_type), private :: params_inst - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !DESCRIPTION: - ! Read parameters - ! - ! !USES: - use ncdio_pio , only: file_desc_t,ncd_io - use abortutils , only: endrun - ! - ! !ARGUMENTS: - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - tString='dnp' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%dnp=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemDecomp (bounds, num_soilc, filter_soilc, & - soilbiogeochem_state_inst, soilbiogeochem_carbonstate_inst, soilbiogeochem_carbonflux_inst, & - soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst, & - cn_decomp_pools, p_decomp_cpool_loss, pmnf_decomp_cascade) - ! - ! !USES: - ! - ! !ARGUMENT: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(soilbiogeochem_state_type) , intent(inout) :: soilbiogeochem_state_inst - type(soilbiogeochem_carbonstate_type) , intent(in) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - real(r8) , intent(inout) :: cn_decomp_pools(bounds%begc:,1:,1:) ! c:n ratios of applicable pools - real(r8) , intent(inout) :: p_decomp_cpool_loss(bounds%begc:,1:,1:) ! potential C loss from one pool to another - real(r8) , intent(inout) :: pmnf_decomp_cascade(bounds%begc:,1:,1:) ! potential mineral N flux from one pool to another - ! - ! !LOCAL VARIABLES: - integer :: c,j,k,l,m ! indices - integer :: fc ! lake filter column index - integer :: begc,endc ! bounds - integer, parameter :: i_atm = 0 !TODO - this appears in two places - move it to 1 - ! For methane code - real(r8):: hrsum(bounds%begc:bounds%endc,1:nlevdecomp) ! sum of HR (gC/m2/s) - !----------------------------------------------------------------------- - - begc = bounds%begc; endc = bounds%endc - - SHR_ASSERT_ALL((ubound(cn_decomp_pools) == (/endc,nlevdecomp,ndecomp_pools/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(p_decomp_cpool_loss) == (/endc,nlevdecomp,ndecomp_cascade_transitions/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(pmnf_decomp_cascade) == (/endc,nlevdecomp,ndecomp_cascade_transitions/)) , errMsg(sourcefile, __LINE__)) - - associate( & - cascade_donor_pool => decomp_cascade_con%cascade_donor_pool , & ! Input: [integer (:) ] which pool is C taken from for a given decomposition step - cascade_receiver_pool => decomp_cascade_con%cascade_receiver_pool , & ! Input: [integer (:) ] which pool is C added to for a given decomposition step - floating_cn_ratio_decomp_pools => decomp_cascade_con%floating_cn_ratio_decomp_pools , & ! Input: [logical (:) ] TRUE => pool has fixed C:N ratio - initial_cn_ratio => decomp_cascade_con%initial_cn_ratio , & ! Input: [real(r8) (:) ] c:n ratio for initialization of pools - - fpi_vr => soilbiogeochem_state_inst%fpi_vr_col , & ! Input: [real(r8) (:,:) ] fraction of potential immobilization (no units) - rf_decomp_cascade => soilbiogeochem_state_inst%rf_decomp_cascade_col , & ! Input: [real(r8) (:,:,:) ] respired fraction in decomposition step (frac) - pathfrac_decomp_cascade => soilbiogeochem_state_inst%pathfrac_decomp_cascade_col , & ! Input: [real(r8) (:,:,:) ] what fraction of C leaving a given pool passes through a given transition (frac) - - decomp_npools_vr => soilbiogeochem_nitrogenstate_inst%decomp_npools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) vertically-resolved decomposing (litter, cwd, soil) N pools - decomp_cpools_vr => soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) vertically-resolved decomposing (litter, cwd, soil) c pools - - decomp_cascade_ntransfer_vr => soilbiogeochem_nitrogenflux_inst%decomp_cascade_ntransfer_vr_col , & ! Output: [real(r8) (:,:,:) ] vert-res transfer of N from donor to receiver pool along decomp. cascade (gN/m3/s) - decomp_cascade_sminn_flux_vr => soilbiogeochem_nitrogenflux_inst%decomp_cascade_sminn_flux_vr_col , & ! Output: [real(r8) (:,:,:) ] vert-res mineral N flux for transition along decomposition cascade (gN/m3/s) - potential_immob_vr => soilbiogeochem_nitrogenflux_inst%potential_immob_vr_col , & ! Output: [real(r8) (:,:) ] - sminn_to_denit_decomp_cascade_vr => soilbiogeochem_nitrogenflux_inst%sminn_to_denit_decomp_cascade_vr_col , & ! Output: [real(r8) (:,:,:) ] - gross_nmin_vr => soilbiogeochem_nitrogenflux_inst%gross_nmin_vr_col , & ! Output: [real(r8) (:,:) ] - net_nmin_vr => soilbiogeochem_nitrogenflux_inst%net_nmin_vr_col , & ! Output: [real(r8) (:,:) ] - gross_nmin => soilbiogeochem_nitrogenflux_inst%gross_nmin_col , & ! Output: [real(r8) (:) ] gross rate of N mineralization (gN/m2/s) - net_nmin => soilbiogeochem_nitrogenflux_inst%net_nmin_col , & ! Output: [real(r8) (:) ] net rate of N mineralization (gN/m2/s) - - w_scalar => soilbiogeochem_carbonflux_inst%w_scalar_col , & ! Input: [real(r8) (:,:) ] fraction by which decomposition is limited by moisture availability - decomp_cascade_hr_vr => soilbiogeochem_carbonflux_inst%decomp_cascade_hr_vr_col , & ! Output: [real(r8) (:,:,:) ] vertically-resolved het. resp. from decomposing C pools (gC/m3/s) - decomp_cascade_ctransfer_vr => soilbiogeochem_carbonflux_inst%decomp_cascade_ctransfer_vr_col , & ! Output: [real(r8) (:,:,:) ] vertically-resolved het. resp. from decomposing C pools (gC/m3/s) - decomp_k => soilbiogeochem_carbonflux_inst%decomp_k_col , & ! Output: [real(r8) (:,:,:) ] rate constant for decomposition (1./sec) - phr_vr => soilbiogeochem_carbonflux_inst%phr_vr_col , & ! Input: [real(r8) (:,:) ] potential HR (gC/m3/s) - fphr => soilbiogeochem_carbonflux_inst%fphr_col & ! Output: [real(r8) (:,:) ] fraction of potential SOM + LITTER heterotrophic - ) - - ! column loop to calculate actual immobilization and decomp rates, following - ! resolution of plant/heterotroph competition for mineral N - - if ( .not. use_fates) then - ! calculate c:n ratios of applicable pools - do l = 1, ndecomp_pools - if ( floating_cn_ratio_decomp_pools(l) ) then - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - if ( decomp_npools_vr(c,j,l) > 0._r8 ) then - cn_decomp_pools(c,j,l) = decomp_cpools_vr(c,j,l) / decomp_npools_vr(c,j,l) - end if - end do - end do - else - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - cn_decomp_pools(c,j,l) = initial_cn_ratio(l) - end do - end do - end if - end do - - ! column loop to calculate actual immobilization and decomp rates, following - ! resolution of plant/heterotroph competition for mineral N - - ! upon return from SoilBiogeochemCompetition, the fraction of potential immobilization - ! has been set (soilbiogeochem_state_inst%fpi_vr_col). now finish the decomp calculations. - ! Only the immobilization steps are limited by fpi_vr (pmnf > 0) - ! Also calculate denitrification losses as a simple proportion - ! of mineralization flux. - - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (decomp_cpools_vr(c,j,cascade_donor_pool(k)) > 0._r8) then - if ( pmnf_decomp_cascade(c,j,k) > 0._r8 ) then - p_decomp_cpool_loss(c,j,k) = p_decomp_cpool_loss(c,j,k) * fpi_vr(c,j) - pmnf_decomp_cascade(c,j,k) = pmnf_decomp_cascade(c,j,k) * fpi_vr(c,j) - if (.not. use_nitrif_denitrif) then - sminn_to_denit_decomp_cascade_vr(c,j,k) = 0._r8 - end if - else - if (.not. use_nitrif_denitrif) then - sminn_to_denit_decomp_cascade_vr(c,j,k) = -params_inst%dnp * pmnf_decomp_cascade(c,j,k) - end if - end if - decomp_cascade_hr_vr(c,j,k) = rf_decomp_cascade(c,j,k) * p_decomp_cpool_loss(c,j,k) - decomp_cascade_ctransfer_vr(c,j,k) = (1._r8 - rf_decomp_cascade(c,j,k)) * p_decomp_cpool_loss(c,j,k) - if (decomp_npools_vr(c,j,cascade_donor_pool(k)) > 0._r8 .and. cascade_receiver_pool(k) /= i_atm) then - decomp_cascade_ntransfer_vr(c,j,k) = p_decomp_cpool_loss(c,j,k) / cn_decomp_pools(c,j,cascade_donor_pool(k)) - else - decomp_cascade_ntransfer_vr(c,j,k) = 0._r8 - endif - if ( cascade_receiver_pool(k) /= 0 ) then - decomp_cascade_sminn_flux_vr(c,j,k) = pmnf_decomp_cascade(c,j,k) - else ! keep sign convention negative for terminal pools - decomp_cascade_sminn_flux_vr(c,j,k) = - pmnf_decomp_cascade(c,j,k) - endif - net_nmin_vr(c,j) = net_nmin_vr(c,j) - pmnf_decomp_cascade(c,j,k) - else - decomp_cascade_ntransfer_vr(c,j,k) = 0._r8 - if (.not. use_nitrif_denitrif) then - sminn_to_denit_decomp_cascade_vr(c,j,k) = 0._r8 - end if - decomp_cascade_sminn_flux_vr(c,j,k) = 0._r8 - end if - - end do - end do - end do - else - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - ! - decomp_cascade_hr_vr(c,j,k) = rf_decomp_cascade(c,j,k) * p_decomp_cpool_loss(c,j,k) - ! - decomp_cascade_ctransfer_vr(c,j,k) = (1._r8 - rf_decomp_cascade(c,j,k)) * p_decomp_cpool_loss(c,j,k) - ! - end do - end do - end do - end if - - - ! vertically integrate net and gross mineralization fluxes for diagnostic output - - do fc = 1,num_soilc - c = filter_soilc(fc) - do j = 1,nlevdecomp - if(.not.use_fates)then - net_nmin(c) = net_nmin(c) + net_nmin_vr(c,j) * dzsoi_decomp(j) - gross_nmin(c) = gross_nmin(c) + gross_nmin_vr(c,j) * dzsoi_decomp(j) - ! else - ! net_nmin(c) = 0.0_r8 - ! gross_nmin(c) = 0.0_r8 - endif - end do - end do - - end associate - - end subroutine SoilBiogeochemDecomp - -end module SoilBiogeochemDecompMod diff --git a/src/soilbiogeochem/SoilBiogeochemLittVertTranspMod.F90 b/src/soilbiogeochem/SoilBiogeochemLittVertTranspMod.F90 deleted file mode 100644 index c9482667bc..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemLittVertTranspMod.F90 +++ /dev/null @@ -1,494 +0,0 @@ -module SoilBiogeochemLittVertTranspMod - - !----------------------------------------------------------------------- - ! calculate vertical mixing of all decomposing C and N pools - ! - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog, spinup_state, use_vertsoilc, use_fates, use_cn - use clm_varcon , only : secspday - use decompMod , only : bounds_type - use abortutils , only : endrun - use CanopyStateType , only : canopystate_type - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use ColumnType , only : col - use GridcellType , only : grc - use SoilBiogeochemStateType , only : get_spinup_latitude_term - ! - implicit none - private - ! - public :: readParams - public :: SoilBiogeochemLittVertTransp - - type, private :: params_type - real(r8) :: som_diffus ! Soil organic matter diffusion - real(r8) :: cryoturb_diffusion_k ! The cryoturbation diffusive constant cryoturbation to the active layer thickness - real(r8) :: max_altdepth_cryoturbation ! (m) maximum active layer thickness for cryoturbation to occur - end type params_type - - type(params_type), private :: params_inst - ! - real(r8), public :: som_adv_flux = 0._r8 - real(r8), public :: max_depth_cryoturb = 3._r8 ! (m) this is the maximum depth of cryoturbation - real(r8) :: som_diffus ! [m^2/sec] = 1 cm^2 / yr - real(r8) :: cryoturb_diffusion_k ! [m^2/sec] = 5 cm^2 / yr = 1m^2 / 200 yr - real(r8) :: max_altdepth_cryoturbation ! (m) maximum active layer thickness for cryoturbation to occur - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - use ncdio_pio , only : file_desc_t,ncd_io - ! - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - character(len=32) :: subname = 'SoilBiogeochemLittVertTranspType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - ! - ! read in parameters - ! - - tString='som_diffus' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - !soilbiogeochem_litt_verttransp_params_inst%som_diffus=tempr - ! FIX(SPM,032414) - can't be pulled out since division makes things not bfb - params_inst%som_diffus = 1e-4_r8 / (secspday * 365._r8) - - tString='cryoturb_diffusion_k' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - !soilbiogeochem_litt_verttransp_params_inst%cryoturb_diffusion_k=tempr - !FIX(SPM,032414) Todo. This constant cannot be on file since the divide makes things - !SPM Todo. This constant cannot be on file since the divide makes things - !not bfb - params_inst%cryoturb_diffusion_k = 5e-4_r8 / (secspday * 365._r8) ! [m^2/sec] = 5 cm^2 / yr = 1m^2 / 200 yr - - tString='max_altdepth_cryoturbation' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%max_altdepth_cryoturbation=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemLittVertTransp(bounds, num_soilc, filter_soilc, & - canopystate_inst, soilbiogeochem_state_inst, & - soilbiogeochem_carbonstate_inst, soilbiogeochem_carbonflux_inst, & - c13_soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonflux_inst, & - c14_soilbiogeochem_carbonstate_inst, c14_soilbiogeochem_carbonflux_inst, & - soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! Calculate vertical mixing of soil and litter pools. Also reconcile sources and sinks of these pools - ! calculated in the CStateUpdate1 and NStateUpdate1 subroutines. - ! Advection-diffusion code based on algorithm in Patankar (1980) - ! Initial code by C. Koven and W. Riley - ! - ! !USES: - use clm_time_manager , only : get_step_size - use clm_varpar , only : nlevdecomp, ndecomp_pools, nlevdecomp_full - use clm_varcon , only : zsoi, dzsoi_decomp, zisoi - use TridiagonalMod , only : Tridiagonal - use ColumnType , only : col - use clm_varctl , only : use_bedrock - - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(canopystate_type) , intent(in) :: canopystate_inst - type(soilbiogeochem_state_type) , intent(inout) :: soilbiogeochem_state_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c13_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: c13_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c14_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: c14_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - real(r8) :: diffus (bounds%begc:bounds%endc,1:nlevdecomp+1) ! diffusivity (m2/s) (includes spinup correction, if any) - real(r8) :: adv_flux(bounds%begc:bounds%endc,1:nlevdecomp+1) ! advective flux (m/s) (includes spinup correction, if any) - real(r8) :: aaa ! "A" function in Patankar - real(r8) :: pe ! Pe for "A" function in Patankar - real(r8) :: w_m1, w_p1 ! Weights for calculating harmonic mean of diffusivity - real(r8) :: d_m1, d_p1 ! Harmonic mean of diffusivity - real(r8) :: a_tri(bounds%begc:bounds%endc,0:nlevdecomp+1) ! "a" vector for tridiagonal matrix - real(r8) :: b_tri(bounds%begc:bounds%endc,0:nlevdecomp+1) ! "b" vector for tridiagonal matrix - real(r8) :: c_tri(bounds%begc:bounds%endc,0:nlevdecomp+1) ! "c" vector for tridiagonal matrix - real(r8) :: r_tri(bounds%begc:bounds%endc,0:nlevdecomp+1) ! "r" vector for tridiagonal solution - real(r8) :: d_p1_zp1(bounds%begc:bounds%endc,1:nlevdecomp+1) ! diffusivity/delta_z for next j (set to zero for no diffusion) - real(r8) :: d_m1_zm1(bounds%begc:bounds%endc,1:nlevdecomp+1) ! diffusivity/delta_z for previous j (set to zero for no diffusion) - real(r8) :: f_p1(bounds%begc:bounds%endc,1:nlevdecomp+1) ! water flux for next j - real(r8) :: f_m1(bounds%begc:bounds%endc,1:nlevdecomp+1) ! water flux for previous j - real(r8) :: pe_p1(bounds%begc:bounds%endc,1:nlevdecomp+1) ! Peclet # for next j - real(r8) :: pe_m1(bounds%begc:bounds%endc,1:nlevdecomp+1) ! Peclet # for previous j - real(r8) :: dz_node(1:nlevdecomp+1) ! difference between nodes - real(r8) :: epsilon_t (bounds%begc:bounds%endc,1:nlevdecomp+1,1:ndecomp_pools) ! - real(r8) :: conc_trcr(bounds%begc:bounds%endc,0:nlevdecomp+1) ! - real(r8) :: a_p_0 - real(r8) :: deficit - integer :: ntype - integer :: i_type,s,fc,c,j,l ! indices - integer :: jtop(bounds%begc:bounds%endc) ! top level at each column - real(r8) :: dtime ! land model time step (sec) - integer :: zerolev_diffus - real(r8) :: spinup_term ! spinup accelerated decomposition factor, used to accelerate transport as well - real(r8) :: epsilon ! small number - real(r8), pointer :: conc_ptr(:,:,:) ! pointer, concentration state variable being transported - real(r8), pointer :: source(:,:,:) ! pointer, source term - real(r8), pointer :: trcr_tendency_ptr(:,:,:) ! poiner, store the vertical tendency (gain/loss due to vertical transport) - !----------------------------------------------------------------------- - - ! Set statement functions - aaa (pe) = max (0._r8, (1._r8 - 0.1_r8 * abs(pe))**5) ! A function from Patankar, Table 5.2, pg 95 - - associate( & - is_cwd => decomp_cascade_con%is_cwd , & ! Input: [logical (:) ] TRUE => pool is a cwd pool - spinup_factor => decomp_cascade_con%spinup_factor , & ! Input: [real(r8) (:) ] spinup accelerated decomposition factor, used to accelerate transport as well - - altmax => canopystate_inst%altmax_col , & ! Input: [real(r8) (:) ] maximum annual depth of thaw - altmax_lastyear => canopystate_inst%altmax_lastyear_col , & ! Input: [real(r8) (:) ] prior year maximum annual depth of thaw - - som_adv_coef => soilbiogeochem_state_inst%som_adv_coef_col , & ! Output: [real(r8) (:,:) ] SOM advective flux (m/s) - som_diffus_coef => soilbiogeochem_state_inst%som_diffus_coef_col & ! Output: [real(r8) (:,:) ] SOM diffusivity due to bio/cryo-turbation (m2/s) - ) - - !Set parameters of vertical mixing of SOM - som_diffus = params_inst%som_diffus - cryoturb_diffusion_k = params_inst%cryoturb_diffusion_k - max_altdepth_cryoturbation = params_inst%max_altdepth_cryoturbation - - dtime = get_step_size() - - ntype = 2 - if ( use_fates ) then - ntype = 1 - endif - spinup_term = 1._r8 - epsilon = 1.e-30 - - if (use_vertsoilc) then - !------ first get diffusivity / advection terms -------! - ! use different mixing rates for bioturbation and cryoturbation, with fixed bioturbation and cryoturbation set to a maximum depth - do fc = 1, num_soilc - c = filter_soilc (fc) - if (( max(altmax(c), altmax_lastyear(c)) <= max_altdepth_cryoturbation ) .and. & - ( max(altmax(c), altmax_lastyear(c)) > 0._r8) ) then - ! use mixing profile modified slightly from Koven et al. (2009): constant through active layer, linear decrease from base of active layer to zero at a fixed depth - do j = 1,nlevdecomp+1 - if ( j <= col%nbedrock(c)+1 ) then - if ( zisoi(j) < max(altmax(c), altmax_lastyear(c)) ) then - som_diffus_coef(c,j) = cryoturb_diffusion_k - som_adv_coef(c,j) = 0._r8 - else - som_diffus_coef(c,j) = max(cryoturb_diffusion_k * & - ( 1._r8 - ( zisoi(j) - max(altmax(c), altmax_lastyear(c)) ) / & - ( min(max_depth_cryoturb, zisoi(col%nbedrock(c)+1)) - max(altmax(c), altmax_lastyear(c)) ) ), 0._r8) ! go linearly to zero between ALT and max_depth_cryoturb - som_adv_coef(c,j) = 0._r8 - endif - else - som_adv_coef(c,j) = 0._r8 - som_diffus_coef(c,j) = 0._r8 - endif - end do - elseif ( max(altmax(c), altmax_lastyear(c)) > 0._r8 ) then - ! constant advection, constant diffusion - do j = 1,nlevdecomp+1 - if ( j <= col%nbedrock(c)+1 ) then - som_adv_coef(c,j) = som_adv_flux - som_diffus_coef(c,j) = som_diffus - else - som_adv_coef(c,j) = 0._r8 - som_diffus_coef(c,j) = 0._r8 - endif - end do - else - ! completely frozen soils--no mixing - do j = 1,nlevdecomp+1 - som_adv_coef(c,j) = 0._r8 - som_diffus_coef(c,j) = 0._r8 - end do - endif - end do - - ! Set the distance between the node and the one ABOVE it - dz_node(1) = zsoi(1) - do j = 2,nlevdecomp+1 - dz_node(j)= zsoi(j) - zsoi(j-1) - enddo - - endif - - !------ loop over litter/som types - do i_type = 1, ntype - - select case (i_type) - case (1) ! C - conc_ptr => soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col - source => soilbiogeochem_carbonflux_inst%decomp_cpools_sourcesink_col - trcr_tendency_ptr => soilbiogeochem_carbonflux_inst%decomp_cpools_transport_tendency_col - case (2) ! N - if (use_cn ) then - conc_ptr => soilbiogeochem_nitrogenstate_inst%decomp_npools_vr_col - source => soilbiogeochem_nitrogenflux_inst%decomp_npools_sourcesink_col - trcr_tendency_ptr => soilbiogeochem_nitrogenflux_inst%decomp_npools_transport_tendency_col - endif - case (3) - write(iulog,*) 'error. ncase = 4, but c13 and c14 not both enabled.' - call endrun(msg=errMsg(sourcefile, __LINE__)) - case (4) - write(iulog,*) 'error. ncase = 4, but c13 and c14 not both enabled.' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end select - - if (use_vertsoilc) then - - do s = 1, ndecomp_pools - - if ( .not. is_cwd(s) ) then - - do j = 1,nlevdecomp+1 - do fc = 1, num_soilc - c = filter_soilc (fc) - ! - if ( spinup_state >= 1 ) then - ! increase transport (both advection and diffusion) by the same factor as accelerated decomposition for a given pool - spinup_term = spinup_factor(s) - else - spinup_term = 1._r8 - endif - - if (abs(spinup_term - 1._r8) > .000001_r8 ) then - spinup_term = spinup_term * get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) - endif - - if ( abs(som_adv_coef(c,j)) * spinup_term < epsilon ) then - adv_flux(c,j) = epsilon - else - adv_flux(c,j) = som_adv_coef(c,j) * spinup_term - endif - ! - if ( abs(som_diffus_coef(c,j)) * spinup_term < epsilon ) then - diffus(c,j) = epsilon - else - diffus(c,j) = som_diffus_coef(c,j) * spinup_term - endif - ! - end do - end do - - ! Set Pe (Peclet #) and D/dz throughout column - - do fc = 1, num_soilc ! dummy terms here - c = filter_soilc (fc) - conc_trcr(c,0) = 0._r8 - conc_trcr(c,col%nbedrock(c)+1:nlevdecomp+1) = 0._r8 - end do - - - do j = 1,nlevdecomp+1 - do fc = 1, num_soilc - c = filter_soilc (fc) - - conc_trcr(c,j) = conc_ptr(c,j,s) - - ! dz_tracer below is the difference between gridcell edges (dzsoi_decomp) - ! dz_node_tracer is difference between cell centers - - ! Calculate the D and F terms in the Patankar algorithm - if (j == 1) then - d_m1_zm1(c,j) = 0._r8 - w_p1 = (zsoi(j+1) - zisoi(j)) / dz_node(j+1) - if ( diffus(c,j+1) > 0._r8 .and. diffus(c,j) > 0._r8) then - d_p1 = 1._r8 / ((1._r8 - w_p1) / diffus(c,j) + w_p1 / diffus(c,j+1)) ! Harmonic mean of diffus - else - d_p1 = 0._r8 - endif - d_p1_zp1(c,j) = d_p1 / dz_node(j+1) - f_m1(c,j) = adv_flux(c,j) ! Include infiltration here - f_p1(c,j) = adv_flux(c,j+1) - pe_m1(c,j) = 0._r8 - pe_p1(c,j) = f_p1(c,j) / d_p1_zp1(c,j) ! Peclet # - elseif (j >= col%nbedrock(c)+1) then - ! At the bottom, assume no gradient in d_z (i.e., they're the same) - w_m1 = (zisoi(j-1) - zsoi(j-1)) / dz_node(j) - if ( diffus(c,j) > 0._r8 .and. diffus(c,j-1) > 0._r8) then - d_m1 = 1._r8 / ((1._r8 - w_m1) / diffus(c,j) + w_m1 / diffus(c,j-1)) ! Harmonic mean of diffus - else - d_m1 = 0._r8 - endif - d_m1_zm1(c,j) = d_m1 / dz_node(j) - d_p1_zp1(c,j) = d_m1_zm1(c,j) ! Set to be the same - f_m1(c,j) = adv_flux(c,j) - !f_p1(c,j) = adv_flux(c,j+1) - f_p1(c,j) = 0._r8 - pe_m1(c,j) = f_m1(c,j) / d_m1_zm1(c,j) ! Peclet # - pe_p1(c,j) = f_p1(c,j) / d_p1_zp1(c,j) ! Peclet # - else - ! Use distance from j-1 node to interface with j divided by distance between nodes - w_m1 = (zisoi(j-1) - zsoi(j-1)) / dz_node(j) - if ( diffus(c,j-1) > 0._r8 .and. diffus(c,j) > 0._r8) then - d_m1 = 1._r8 / ((1._r8 - w_m1) / diffus(c,j) + w_m1 / diffus(c,j-1)) ! Harmonic mean of diffus - else - d_m1 = 0._r8 - endif - w_p1 = (zsoi(j+1) - zisoi(j)) / dz_node(j+1) - if ( diffus(c,j+1) > 0._r8 .and. diffus(c,j) > 0._r8) then - d_p1 = 1._r8 / ((1._r8 - w_p1) / diffus(c,j) + w_p1 / diffus(c,j+1)) ! Harmonic mean of diffus - else - d_p1 = (1._r8 - w_m1) * diffus(c,j) + w_p1 * diffus(c,j+1) ! Arithmetic mean of diffus - endif - d_m1_zm1(c,j) = d_m1 / dz_node(j) - d_p1_zp1(c,j) = d_p1 / dz_node(j+1) - f_m1(c,j) = adv_flux(c,j) - f_p1(c,j) = adv_flux(c,j+1) - pe_m1(c,j) = f_m1(c,j) / d_m1_zm1(c,j) ! Peclet # - pe_p1(c,j) = f_p1(c,j) / d_p1_zp1(c,j) ! Peclet # - end if - enddo ! fc - enddo ! j; nlevdecomp - - - ! Calculate the tridiagonal coefficients - do j = 0,nlevdecomp +1 - do fc = 1, num_soilc - c = filter_soilc (fc) - ! g = cgridcell(c) - - if (j > 0 .and. j < nlevdecomp+1) then - a_p_0 = dzsoi_decomp(j) / dtime - endif - - if (j == 0) then ! top layer (atmosphere) - a_tri(c,j) = 0._r8 - b_tri(c,j) = 1._r8 - c_tri(c,j) = -1._r8 - r_tri(c,j) = 0._r8 - elseif (j == 1) then - a_tri(c,j) = -(d_m1_zm1(c,j) * aaa(pe_m1(c,j)) + max( f_m1(c,j), 0._r8)) ! Eqn 5.47 Patankar - c_tri(c,j) = -(d_p1_zp1(c,j) * aaa(pe_p1(c,j)) + max(-f_p1(c,j), 0._r8)) - b_tri(c,j) = -a_tri(c,j) - c_tri(c,j) + a_p_0 - r_tri(c,j) = source(c,j,s) * dzsoi_decomp(j) /dtime + (a_p_0 - adv_flux(c,j)) * conc_trcr(c,j) - elseif (j < nlevdecomp+1) then - a_tri(c,j) = -(d_m1_zm1(c,j) * aaa(pe_m1(c,j)) + max( f_m1(c,j), 0._r8)) ! Eqn 5.47 Patankar - c_tri(c,j) = -(d_p1_zp1(c,j) * aaa(pe_p1(c,j)) + max(-f_p1(c,j), 0._r8)) - b_tri(c,j) = -a_tri(c,j) - c_tri(c,j) + a_p_0 - r_tri(c,j) = source(c,j,s) * dzsoi_decomp(j) /dtime + a_p_0 * conc_trcr(c,j) - else ! j==nlevdecomp+1; 0 concentration gradient at bottom - a_tri(c,j) = -1._r8 - b_tri(c,j) = 1._r8 - c_tri(c,j) = 0._r8 - r_tri(c,j) = 0._r8 - endif - enddo ! fc; column - enddo ! j; nlevdecomp - - do fc = 1, num_soilc - c = filter_soilc (fc) - jtop(c) = 0 - enddo - - ! subtract initial concentration and source terms for tendency calculation - do fc = 1, num_soilc - c = filter_soilc (fc) - do j = 1, nlevdecomp - trcr_tendency_ptr(c,j,s) = 0.-(conc_trcr(c,j) + source(c,j,s)) - end do - end do - - ! Solve for the concentration profile for this time step - call Tridiagonal(bounds, 0, nlevdecomp+1, & - jtop(bounds%begc:bounds%endc), & - num_soilc, filter_soilc, & - a_tri(bounds%begc:bounds%endc, :), & - b_tri(bounds%begc:bounds%endc, :), & - c_tri(bounds%begc:bounds%endc, :), & - r_tri(bounds%begc:bounds%endc, :), & - conc_trcr(bounds%begc:bounds%endc,0:nlevdecomp+1)) - - ! add post-transport concentration to calculate tendency term - do fc = 1, num_soilc - c = filter_soilc (fc) - do j = 1, nlevdecomp - trcr_tendency_ptr(c,j,s) = trcr_tendency_ptr(c,j,s) + conc_trcr(c,j) - trcr_tendency_ptr(c,j,s) = trcr_tendency_ptr(c,j,s) / dtime - end do - end do - - else - ! for CWD pools, just add - do j = 1,nlevdecomp - do fc = 1, num_soilc - c = filter_soilc (fc) - conc_trcr(c,j) = conc_ptr(c,j,s) + source(c,j,s) - if (j > col%nbedrock(c) .and. source(c,j,s) > 0._r8) then - write(iulog,*) 'source >0',c,j,s,source(c,j,s) - end if - if (j > col%nbedrock(c) .and. conc_ptr(c,j,s) > 0._r8) then - write(iulog,*) 'conc_ptr >0',c,j,s,conc_ptr(c,j,s) - end if - - end do - end do - - end if ! not CWD - - do j = 1,nlevdecomp - do fc = 1, num_soilc - c = filter_soilc (fc) - conc_ptr(c,j,s) = conc_trcr(c,j) - ! Correct for small amounts of carbon that leak into bedrock - if (j > col%nbedrock(c)) then - conc_ptr(c,col%nbedrock(c),s) = conc_ptr(c,col%nbedrock(c),s) + & - conc_trcr(c,j) * (dzsoi_decomp(j) / dzsoi_decomp(col%nbedrock(c))) - conc_ptr(c,j,s) = 0._r8 - end if - end do - end do - - end do ! s (pool loop) - - else - - !! for single level case, no transport; just update the fluxes calculated in the StateUpdate1 subroutines - do l = 1, ndecomp_pools - do j = 1,nlevdecomp - do fc = 1, num_soilc - c = filter_soilc (fc) - - conc_ptr(c,j,l) = conc_ptr(c,j,l) + source(c,j,l) - - trcr_tendency_ptr(c,j,l) = 0._r8 - - end do - end do - end do - - endif - - end do ! i_type - - end associate - - end subroutine SoilBiogeochemLittVertTransp - -end module SoilBiogeochemLittVertTranspMod diff --git a/src/soilbiogeochem/SoilBiogeochemNLeachingMod.F90 b/src/soilbiogeochem/SoilBiogeochemNLeachingMod.F90 deleted file mode 100644 index 3a0cb0c91b..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemNLeachingMod.F90 +++ /dev/null @@ -1,289 +0,0 @@ -module SoilBiogeochemNLeachingMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module for mineral nitrogen dynamics (deposition, fixation, leaching) - ! for coupled carbon-nitrogen code. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use clm_varcon , only : dzsoi_decomp, zisoi - use clm_varctl , only : use_nitrif_denitrif, use_vertsoilc - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use WaterStateType , only : waterstate_type - use WaterFluxType , only : waterflux_type - use ColumnType , only : col - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: readParams - public :: SoilBiogeochemNLeaching - ! - ! !PRIVATE DATA: - type, private :: params_type - real(r8):: sf ! soluble fraction of mineral N (unitless) - real(r8):: sf_no3 ! soluble fraction of NO3 (unitless) - end type params_type - - type(params_type), private :: params_inst - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !DESCRIPTION: - ! Read in parameters - ! - ! !USES: - use ncdio_pio , only : file_desc_t,ncd_io - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - ! - ! !ARGUMENTS: - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNNDynamicsParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - tString='sf_minn' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%sf=tempr - - tString='sf_no3' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%sf_no3=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemNLeaching(bounds, num_soilc, filter_soilc, & - waterstate_inst, waterflux_inst, & - soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, update the nitrogen leaching rate - ! as a function of soluble mineral N and total soil water outflow. - ! - ! !USES: - use clm_varpar , only : nlevdecomp, nlevsoi - use clm_time_manager , only : get_step_size - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(waterstate_type) , intent(in) :: waterstate_inst - type(waterflux_type) , intent(in) :: waterflux_inst - type(soilbiogeochem_nitrogenstate_type) , intent(in) :: soilbiogeochem_nitrogenstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: j,c,fc ! indices - real(r8) :: dt ! radiation time step (seconds) - real(r8) :: sf ! soluble fraction of mineral N (unitless) - real(r8) :: sf_no3 ! soluble fraction of NO3 (unitless) - real(r8) :: disn_conc ! dissolved mineral N concentration (gN/kg water) - real(r8) :: tot_water(bounds%begc:bounds%endc) ! total column liquid water (kg water/m2) - real(r8) :: surface_water(bounds%begc:bounds%endc) ! liquid water to shallow surface depth (kg water/m2) - real(r8) :: drain_tot(bounds%begc:bounds%endc) ! total drainage flux (mm H2O /s) - real(r8), parameter :: depth_runoff_Nloss = 0.05 ! (m) depth over which runoff mixes with soil water for N loss to runoff - !----------------------------------------------------------------------- - - associate( & - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) (new) (-nlevsno+1:nlevgrnd) - - qflx_drain => waterflux_inst%qflx_drain_col , & ! Input: [real(r8) (:) ] sub-surface runoff (mm H2O /s) - qflx_surf => waterflux_inst%qflx_surf_col , & ! Input: [real(r8) (:) ] surface runoff (mm H2O /s) - - sminn_vr => soilbiogeochem_nitrogenstate_inst%sminn_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3) soil mineral N - smin_no3_vr => soilbiogeochem_nitrogenstate_inst%smin_no3_vr_col , & ! Input: [real(r8) (:,:) ] - - sminn_leached_vr => soilbiogeochem_nitrogenflux_inst%sminn_leached_vr_col , & ! Output: [real(r8) (:,:) ] rate of mineral N leaching (gN/m3/s) - smin_no3_leached_vr => soilbiogeochem_nitrogenflux_inst%smin_no3_leached_vr_col , & ! Output: [real(r8) (:,:) ] rate of mineral NO3 leaching (gN/m3/s) - smin_no3_runoff_vr => soilbiogeochem_nitrogenflux_inst%smin_no3_runoff_vr_col & ! Output: [real(r8) (:,:) ] rate of mineral NO3 loss with runoff (gN/m3/s) - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - if (.not. use_nitrif_denitrif) then - ! set constant sf - sf = params_inst%sf - else - ! Assume that 100% of the soil NO3 is in a soluble form - sf_no3 = params_inst%sf_no3 - end if - - ! calculate the total soil water - tot_water(bounds%begc:bounds%endc) = 0._r8 - do j = 1,nlevsoi - do fc = 1,num_soilc - c = filter_soilc(fc) - tot_water(c) = tot_water(c) + h2osoi_liq(c,j) - end do - end do - - ! for runoff calculation; calculate total water to a given depth - surface_water(bounds%begc:bounds%endc) = 0._r8 - do j = 1,nlevsoi - if ( zisoi(j) <= depth_runoff_Nloss) then - do fc = 1,num_soilc - c = filter_soilc(fc) - surface_water(c) = surface_water(c) + h2osoi_liq(c,j) - end do - elseif ( zisoi(j-1) < depth_runoff_Nloss) then - do fc = 1,num_soilc - c = filter_soilc(fc) - surface_water(c) = surface_water(c) + h2osoi_liq(c,j) * ( (depth_runoff_Nloss - zisoi(j-1)) / col%dz(c,j)) - end do - endif - end do - - ! Loop through columns - do fc = 1,num_soilc - c = filter_soilc(fc) - drain_tot(c) = qflx_drain(c) - end do - - - if (.not. use_nitrif_denitrif) then - - !---------------------------------------- - ! --------- NITRIF_NITRIF OFF------------ - !---------------------------------------- - - do j = 1,nlevdecomp - ! Loop through columns - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (.not. use_vertsoilc) then - ! calculate the dissolved mineral N concentration (gN/kg water) - ! assumes that 10% of mineral nitrogen is soluble - disn_conc = 0._r8 - if (tot_water(c) > 0._r8) then - disn_conc = (sf * sminn_vr(c,j) ) / tot_water(c) - end if - - ! calculate the N leaching flux as a function of the dissolved - ! concentration and the sub-surface drainage flux - sminn_leached_vr(c,j) = disn_conc * drain_tot(c) - else - ! calculate the dissolved mineral N concentration (gN/kg water) - ! assumes that 10% of mineral nitrogen is soluble - disn_conc = 0._r8 - if (h2osoi_liq(c,j) > 0._r8) then - disn_conc = (sf * sminn_vr(c,j) * col%dz(c,j) )/(h2osoi_liq(c,j) ) - end if - - ! calculate the N leaching flux as a function of the dissolved - ! concentration and the sub-surface drainage flux - sminn_leached_vr(c,j) = disn_conc * drain_tot(c) * h2osoi_liq(c,j) / ( tot_water(c) * col%dz(c,j) ) - - end if - - ! limit the flux based on current sminn state - ! only let at most the assumed soluble fraction - ! of sminn be leached on any given timestep - sminn_leached_vr(c,j) = min(sminn_leached_vr(c,j), (sf * sminn_vr(c,j))/dt) - - ! limit the flux to a positive value - sminn_leached_vr(c,j) = max(sminn_leached_vr(c,j), 0._r8) - - end do - end do - - else - - !---------------------------------------- - ! --------- NITRIF_NITRIF ON------------- - !---------------------------------------- - - do j = 1,nlevdecomp - ! Loop through columns - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (.not. use_vertsoilc) then - ! calculate the dissolved mineral N concentration (gN/kg water) - ! assumes that 10% of mineral nitrogen is soluble - disn_conc = 0._r8 - if (tot_water(c) > 0._r8) then - disn_conc = (sf_no3 * smin_no3_vr(c,j) )/tot_water(c) - end if - - ! calculate the N leaching flux as a function of the dissolved - ! concentration and the sub-surface drainage flux - smin_no3_leached_vr(c,j) = disn_conc * drain_tot(c) - else - ! calculate the dissolved mineral N concentration (gN/kg water) - ! assumes that 10% of mineral nitrogen is soluble - disn_conc = 0._r8 - if (h2osoi_liq(c,j) > 0._r8) then - disn_conc = (sf_no3 * smin_no3_vr(c,j) * col%dz(c,j) )/(h2osoi_liq(c,j) ) - end if - ! - ! calculate the N leaching flux as a function of the dissolved - ! concentration and the sub-surface drainage flux - smin_no3_leached_vr(c,j) = disn_conc * drain_tot(c) * h2osoi_liq(c,j) / ( tot_water(c) * col%dz(c,j) ) - ! - ! ensure that leaching rate isn't larger than soil N pool - smin_no3_leached_vr(c,j) = min(smin_no3_leached_vr(c,j), smin_no3_vr(c,j) / dt ) - ! - ! limit the leaching flux to a positive value - smin_no3_leached_vr(c,j) = max(smin_no3_leached_vr(c,j), 0._r8) - ! - ! - ! calculate the N loss from surface runoff, assuming a shallow mixing of surface waters into soil and removal based on runoff - if ( zisoi(j) <= depth_runoff_Nloss ) then - smin_no3_runoff_vr(c,j) = disn_conc * qflx_surf(c) * & - h2osoi_liq(c,j) / ( surface_water(c) * col%dz(c,j) ) - elseif ( zisoi(j-1) < depth_runoff_Nloss ) then - smin_no3_runoff_vr(c,j) = disn_conc * qflx_surf(c) * & - h2osoi_liq(c,j) * ((depth_runoff_Nloss - zisoi(j-1)) / & - col%dz(c,j)) / ( surface_water(c) * (depth_runoff_Nloss-zisoi(j-1) )) - else - smin_no3_runoff_vr(c,j) = 0._r8 - endif - ! - ! ensure that runoff rate isn't larger than soil N pool - smin_no3_runoff_vr(c,j) = min(smin_no3_runoff_vr(c,j), smin_no3_vr(c,j) / dt - smin_no3_leached_vr(c,j)) - ! - ! limit the flux to a positive value - smin_no3_runoff_vr(c,j) = max(smin_no3_runoff_vr(c,j), 0._r8) - - - endif - ! limit the flux based on current smin_no3 state - ! only let at most the assumed soluble fraction - ! of smin_no3 be leached on any given timestep - smin_no3_leached_vr(c,j) = min(smin_no3_leached_vr(c,j), (sf_no3 * smin_no3_vr(c,j))/dt) - - ! limit the flux to a positive value - smin_no3_leached_vr(c,j) = max(smin_no3_leached_vr(c,j), 0._r8) - - end do - end do - endif - - end associate - - end subroutine SoilBiogeochemNLeaching - -end module SoilBiogeochemNLeachingMod diff --git a/src/soilbiogeochem/SoilBiogeochemNitrifDenitrifMod.F90 b/src/soilbiogeochem/SoilBiogeochemNitrifDenitrifMod.F90 deleted file mode 100644 index 08bbac9241..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemNitrifDenitrifMod.F90 +++ /dev/null @@ -1,337 +0,0 @@ -module SoilBiogeochemNitrifDenitrifMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculate nitrification and denitrification rates - ! - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : nlevdecomp - use clm_varcon , only : rpi, grav - use clm_varcon , only : d_con_g, d_con_w, secspday - use abortutils , only : endrun - use decompMod , only : bounds_type - use SoilStatetype , only : soilstate_type - use WaterStateType , only : waterstate_type - use TemperatureType , only : temperature_type - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use ch4Mod , only : ch4_type - use ColumnType , only : col - ! - implicit none - private - ! - public :: readParams ! Read in parameters from params file - public :: SoilBiogeochemNitrifDenitrif ! Calculate nitrification and - ! - type, private :: params_type - real(r8) :: k_nitr_max ! maximum nitrification rate constant (1/s) - real(r8) :: surface_tension_water ! surface tension of water(J/m^2), Arah an and Vinten 1995 - real(r8) :: rij_kro_a ! Arah and Vinten 1995) - real(r8) :: rij_kro_alpha ! parameter to calculate anoxic fraction of soil (Arah and Vinten 1995) - real(r8) :: rij_kro_beta ! (Arah and Vinten 1995) - real(r8) :: rij_kro_gamma ! (Arah and Vinten 1995) - real(r8) :: rij_kro_delta ! (Arah and Vinten 1995) - real(r8) :: denitrif_respiration_coefficient ! Multiplier for heterotrophic respiration for max denitrif rates - real(r8) :: denitrif_respiration_exponent ! Exponents for heterotrophic respiration for max denitrif rates - real(r8) :: denitrif_nitrateconc_coefficient ! Multiplier for nitrate concentration for max denitrif rates - real(r8) :: denitrif_nitrateconc_exponent ! Exponent for nitrate concentration for max denitrif rates - end type params_type - - type(params_type), private :: params_inst - - logical, public :: no_frozen_nitrif_denitrif = .false. ! stop nitrification and denitrification in frozen soils - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - use ncdio_pio, only: file_desc_t,ncd_io - ! - ! !ARGUMENTS: - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNNitrifDenitrifParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - ! - ! read in constants - ! - tString='surface_tension_water' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%surface_tension_water=tempr - - tString='rij_kro_a' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rij_kro_a=tempr - - tString='rij_kro_alpha' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rij_kro_alpha=tempr - - tString='rij_kro_beta' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rij_kro_beta=tempr - - tString='rij_kro_gamma' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rij_kro_gamma=tempr - - tString='rij_kro_delta' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rij_kro_delta=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemNitrifDenitrif(bounds, num_soilc, filter_soilc, & - soilstate_inst, waterstate_inst, temperature_inst, ch4_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! calculate nitrification and denitrification rates - ! - ! !USES: - use clm_time_manager , only : get_curr_date, get_step_size - use CNSharedParamsMod , only : anoxia_wtsat, CNParamsShareInst - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(soilstate_type) , intent(in) :: soilstate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(ch4_type) , intent(in) :: ch4_inst - type(soilbiogeochem_carbonflux_type) , intent(in) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_nitrogenstate_type) , intent(in) :: soilbiogeochem_nitrogenstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: c, fc, reflev, j - real(r8) :: soil_hr_vr(bounds%begc:bounds%endc,1:nlevdecomp) ! total soil respiration rate (g C / m3 / s) - real(r8) :: g_per_m3__to__ug_per_gsoil - real(r8) :: g_per_m3_sec__to__ug_per_gsoil_day - real(r8) :: mu, sigma - real(r8) :: t - real(r8) :: pH(bounds%begc:bounds%endc) - !debug-- put these type structure for outing to hist files - real(r8) :: co2diff_con(2) ! diffusion constants for CO2 - real(r8) :: eps - real(r8) :: f_a - real(r8) :: surface_tension_water ! (J/m^2), Arah and Vinten 1995 - real(r8) :: rij_kro_a ! Arah and Vinten 1995 - real(r8) :: rij_kro_alpha ! Arah and Vinten 1995 - real(r8) :: rij_kro_beta ! Arah and Vinten 1995 - real(r8) :: rij_kro_gamma ! Arah and Vinten 1995 - real(r8) :: rij_kro_delta ! Arah and Vinten 1995 - real(r8) :: rho_w = 1.e3_r8 ! (kg/m3) - real(r8) :: r_max - real(r8) :: r_min(bounds%begc:bounds%endc,1:nlevdecomp) - real(r8) :: ratio_diffusivity_water_gas(bounds%begc:bounds%endc,1:nlevdecomp) - real(r8) :: om_frac - real(r8) :: anaerobic_frac_sat, r_psi_sat, r_min_sat ! scalar values in sat portion for averaging - real(r8) :: organic_max ! organic matter content (kg/m3) where - ! soil is assumed to act like peat - character(len=32) :: subname='nitrif_denitrif' ! subroutine name - !----------------------------------------------------------------------- - - associate( & - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) (nlevgrnd) - watfc => soilstate_inst%watfc_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at field capacity (nlevsoi) - bd => soilstate_inst%bd_col , & ! Input: [real(r8) (:,:) ] bulk density of dry soil material [kg/m3] - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" (nlevgrnd) - cellorg => soilstate_inst%cellorg_col , & ! Input: [real(r8) (:,:) ] column 3D org (kg/m3 organic matter) (nlevgrnd) - sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - soilpsi => soilstate_inst%soilpsi_col , & ! Input: [real(r8) (:,:) ] soil water potential in each soil layer (MPa) - - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (nlevgrnd) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) (new) (-nlevsno+1:nlevgrnd) - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - - o2_decomp_depth_unsat => ch4_inst%o2_decomp_depth_unsat_col , & ! Input: [real(r8) (:,:) ] O2 consumption during decomposition in each soil layer (nlevsoi) (mol/m3/s) - conc_o2_unsat => ch4_inst%conc_o2_unsat_col , & ! Input: [real(r8) (:,:) ] O2 conc in each soil layer (mol/m3) (nlevsoi) - o2_decomp_depth_sat => ch4_inst%o2_decomp_depth_sat_col , & ! Input: [real(r8) (:,:) ] O2 consumption during decomposition in each soil layer (nlevsoi) (mol/m3/s) - conc_o2_sat => ch4_inst%conc_o2_sat_col , & ! Input: [real(r8) (:,:) ] O2 conc in each soil layer (mol/m3) (nlevsoi) - finundated => ch4_inst%finundated_col , & ! Input: [real(r8) (:) ] fractional inundated area in soil column (excluding dedicated wetland columns) - - smin_nh4_vr => soilbiogeochem_nitrogenstate_inst%smin_nh4_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3) soil mineral NH4 pool - smin_no3_vr => soilbiogeochem_nitrogenstate_inst%smin_no3_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3) soil mineral NO3 pool - - phr_vr => soilbiogeochem_carbonflux_inst%phr_vr_col , & ! Input: [real(r8) (:,:) ] potential hr (not N-limited) - w_scalar => soilbiogeochem_carbonflux_inst%w_scalar_col , & ! Input: [real(r8) (:,:) ] soil water scalar for decomp - t_scalar => soilbiogeochem_carbonflux_inst%t_scalar_col , & ! Input: [real(r8) (:,:) ] temperature scalar for decomp - denit_resp_coef => params_inst%denitrif_respiration_coefficient , & ! Input: [real(r8) ] coefficient for max denitrification rate based on respiration - denit_resp_exp => params_inst%denitrif_respiration_exponent , & ! Input: [real(r8) ] exponent for max denitrification rate based on respiration - denit_nitrate_coef => params_inst%denitrif_nitrateconc_coefficient , & ! Input: [real(r8) ] coefficient for max denitrification rate based on nitrate concentration - denit_nitrate_exp => params_inst%denitrif_nitrateconc_exponent , & ! Input: [real(r8) ] exponent for max denitrification rate based on nitrate concentration - k_nitr_max => params_inst%k_nitr_max , & ! Input: - - r_psi => soilbiogeochem_nitrogenflux_inst%r_psi_col , & ! Output: [real(r8) (:,:) ] - anaerobic_frac => soilbiogeochem_nitrogenflux_inst%anaerobic_frac_col , & ! Output: [real(r8) (:,:) ] - ! ! subsets of the n flux calcs (for diagnostic/debugging purposes) - smin_no3_massdens_vr => soilbiogeochem_nitrogenflux_inst%smin_no3_massdens_vr_col , & ! Output: [real(r8) (:,:) ] (ugN / g soil) soil nitrate concentration - k_nitr_t_vr => soilbiogeochem_nitrogenflux_inst%k_nitr_t_vr_col , & ! Output: [real(r8) (:,:) ] - k_nitr_ph_vr => soilbiogeochem_nitrogenflux_inst%k_nitr_ph_vr_col , & ! Output: [real(r8) (:,:) ] - k_nitr_h2o_vr => soilbiogeochem_nitrogenflux_inst%k_nitr_h2o_vr_col , & ! Output: [real(r8) (:,:) ] - k_nitr_vr => soilbiogeochem_nitrogenflux_inst%k_nitr_vr_col , & ! Output: [real(r8) (:,:) ] - wfps_vr => soilbiogeochem_nitrogenflux_inst%wfps_vr_col , & ! Output: [real(r8) (:,:) ] - fmax_denit_carbonsubstrate_vr => soilbiogeochem_nitrogenflux_inst%fmax_denit_carbonsubstrate_vr_col , & ! Output: [real(r8) (:,:) ] - fmax_denit_nitrate_vr => soilbiogeochem_nitrogenflux_inst%fmax_denit_nitrate_vr_col , & ! Output: [real(r8) (:,:) ] - f_denit_base_vr => soilbiogeochem_nitrogenflux_inst%f_denit_base_vr_col , & ! Output: [real(r8) (:,:) ] - diffus => soilbiogeochem_nitrogenflux_inst%diffus_col , & ! Output: [real(r8) (:,:) ] diffusivity (unitless fraction of total diffusivity) - ratio_k1 => soilbiogeochem_nitrogenflux_inst%ratio_k1_col , & ! Output: [real(r8) (:,:) ] - ratio_no3_co2 => soilbiogeochem_nitrogenflux_inst%ratio_no3_co2_col , & ! Output: [real(r8) (:,:) ] - soil_co2_prod => soilbiogeochem_nitrogenflux_inst%soil_co2_prod_col , & ! Output: [real(r8) (:,:) ] (ug C / g soil / day) - fr_WFPS => soilbiogeochem_nitrogenflux_inst%fr_WFPS_col , & ! Output: [real(r8) (:,:) ] - soil_bulkdensity => soilbiogeochem_nitrogenflux_inst%soil_bulkdensity_col , & ! Output: [real(r8) (:,:) ] (kg soil / m3) bulk density of soil (including water) - pot_f_nit_vr => soilbiogeochem_nitrogenflux_inst%pot_f_nit_vr_col , & ! Output: [real(r8) (:,:) ] (gN/m3/s) potential soil nitrification flux - - pot_f_denit_vr => soilbiogeochem_nitrogenflux_inst%pot_f_denit_vr_col , & ! Output: [real(r8) (:,:) ] (gN/m3/s) potential soil denitrification flux - n2_n2o_ratio_denit_vr => soilbiogeochem_nitrogenflux_inst%n2_n2o_ratio_denit_vr_col & ! Output: [real(r8) (:,:) ] ratio of N2 to N2O production by denitrification [gN/gN] - ) - - surface_tension_water = params_inst%surface_tension_water - - ! Set parameters from simple-structure model to calculate anoxic fratction (Arah and Vinten 1995) - rij_kro_a = params_inst%rij_kro_a - rij_kro_alpha = params_inst%rij_kro_alpha - rij_kro_beta = params_inst%rij_kro_beta - rij_kro_gamma = params_inst%rij_kro_gamma - rij_kro_delta = params_inst%rij_kro_delta - - organic_max = CNParamsShareInst%organic_max - - pH(bounds%begc:bounds%endc) = 6.5 !!! set all soils with the same pH as placeholder here - co2diff_con(1) = 0.1325_r8 - co2diff_con(2) = 0.0009_r8 - - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - - !---------------- calculate soil anoxia state - ! calculate gas diffusivity of soil at field capacity here - ! use expression from methane code, but neglect OM for now - f_a = 1._r8 - watfc(c,j) / watsat(c,j) - eps = watsat(c,j)-watfc(c,j) ! Air-filled fraction of total soil volume - - ! NITRIF_DENITRIF requires Methane model to be active, - ! otherwise diffusivity will be zeroed out here. EBK CDK 10/18/2011 - anaerobic_frac(c,j) = 0._r8 - diffus (c,j) = 0._r8 - !call endrun(msg=' ERROR: NITRIF_DENITRIF requires Methane model to be active'//errMsg(sourcefile, __LINE__) ) - - - !---------------- nitrification - ! follows CENTURY nitrification scheme (Parton et al., (2001, 1996)) - - ! assume nitrification temp function equal to the HR scalar - k_nitr_t_vr(c,j) = min(t_scalar(c,j), 1._r8) - - ! ph function from Parton et al., (2001, 1996) - k_nitr_ph_vr(c,j) = 0.56 + atan(rpi * 0.45 * (-5.+ pH(c)))/rpi - - ! moisture function-- assume the same moisture function as limits heterotrophic respiration - ! Parton et al. base their nitrification- soil moisture rate constants based on heterotrophic rates-- can we do the same? - k_nitr_h2o_vr(c,j) = w_scalar(c,j) - - ! nitrification constant is a set scalar * temp, moisture, and ph scalars - k_nitr_vr(c,j) = k_nitr_max * k_nitr_t_vr(c,j) * k_nitr_h2o_vr(c,j) * k_nitr_ph_vr(c,j) - - ! first-order decay of ammonium pool with scalar defined above - pot_f_nit_vr(c,j) = max(smin_nh4_vr(c,j) * k_nitr_vr(c,j), 0._r8) - - ! limit to oxic fraction of soils - pot_f_nit_vr(c,j) = pot_f_nit_vr(c,j) * (1._r8 - anaerobic_frac(c,j)) - - ! limit to non-frozen soil layers - if ( t_soisno(c,j) <= SHR_CONST_TKFRZ .and. no_frozen_nitrif_denitrif) then - pot_f_nit_vr(c,j) = 0._r8 - endif - - - !---------------- denitrification - ! first some input variables an unit conversions - soil_hr_vr(c,j) = phr_vr(c,j) - - ! CENTURY papers give denitrification in units of per gram soil; need to convert from volumetric to mass-based units here - soil_bulkdensity(c,j) = bd(c,j) + h2osoi_liq(c,j)/col%dz(c,j) - - g_per_m3__to__ug_per_gsoil = 1.e3_r8 / soil_bulkdensity(c,j) - - g_per_m3_sec__to__ug_per_gsoil_day = g_per_m3__to__ug_per_gsoil * secspday - - smin_no3_massdens_vr(c,j) = max(smin_no3_vr(c,j), 0._r8) * g_per_m3__to__ug_per_gsoil - - soil_co2_prod(c,j) = (soil_hr_vr(c,j) * (g_per_m3_sec__to__ug_per_gsoil_day)) - - !! maximum potential denitrification rates based on heterotrophic respiration rates or nitrate concentrations, - !! from (del Grosso et al., 2000) - fmax_denit_carbonsubstrate_vr(c,j) = (denit_resp_coef * (soil_co2_prod(c,j)**denit_resp_exp)) & - / g_per_m3_sec__to__ug_per_gsoil_day - ! - fmax_denit_nitrate_vr(c,j) = (denit_nitrate_coef * smin_no3_massdens_vr(c,j)**denit_nitrate_exp) & - / g_per_m3_sec__to__ug_per_gsoil_day - - ! find limiting denitrification rate - f_denit_base_vr(c,j) = max(min(fmax_denit_carbonsubstrate_vr(c,j), fmax_denit_nitrate_vr(c,j)),0._r8) - - ! limit to non-frozen soil layers - if ( t_soisno(c,j) <= SHR_CONST_TKFRZ .and. no_frozen_nitrif_denitrif ) then - f_denit_base_vr(c,j) = 0._r8 - endif - - ! limit to anoxic fraction of soils - pot_f_denit_vr(c,j) = f_denit_base_vr(c,j) * anaerobic_frac(c,j) - - ! now calculate the ratio of N2O to N2 from denitrifictaion, following Del Grosso et al., 2000 - ! diffusivity constant (figure 6b) - ratio_k1(c,j) = max(1.7_r8, 38.4_r8 - 350._r8 * diffus(c,j)) - - ! ratio function (figure 7c) - if ( soil_co2_prod(c,j) > 0 ) then - ratio_no3_co2(c,j) = smin_no3_massdens_vr(c,j) / soil_co2_prod(c,j) - else - ! fucntion saturates at large no3/co2 ratios, so set as some nominally large number - ratio_no3_co2(c,j) = 100._r8 - endif - - ! total water limitation function (Del Grosso et al., 2000, figure 7a) - wfps_vr(c,j) = max(min(h2osoi_vol(c,j)/watsat(c, j), 1._r8), 0._r8) * 100._r8 - fr_WFPS(c,j) = max(0.1_r8, 0.015_r8 * wfps_vr(c,j) - 0.32_r8) - - ! final ratio expression - n2_n2o_ratio_denit_vr(c,j) = max(0.16*ratio_k1(c,j), ratio_k1(c,j)*exp(-0.8 * ratio_no3_co2(c,j))) * fr_WFPS(c,j) - - end do - - end do - - end associate - - end subroutine SoilBiogeochemNitrifDenitrif - -end module SoilBiogeochemNitrifDenitrifMod diff --git a/src/soilbiogeochem/SoilBiogeochemNitrogenFluxType.F90 b/src/soilbiogeochem/SoilBiogeochemNitrogenFluxType.F90 deleted file mode 100644 index cf962de91b..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemNitrogenFluxType.F90 +++ /dev/null @@ -1,1099 +0,0 @@ -module SoilBiogeochemNitrogenFluxType - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools - use clm_varpar , only : nlevdecomp_full, nlevdecomp - use clm_varcon , only : spval, ispval, dzsoi_decomp - use decompMod , only : bounds_type - use clm_varctl , only : use_nitrif_denitrif, use_vertsoilc, use_crop - use CNSharedParamsMod , only : use_fun - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use abortutils , only : endrun - use LandunitType , only : lun - use ColumnType , only : col - ! - ! !PUBLIC TYPES: - implicit none - private - ! - type, public :: SoilBiogeochem_nitrogenflux_type - - ! deposition fluxes - real(r8), pointer :: ndep_to_sminn_col (:) ! col atmospheric N deposition to soil mineral N (gN/m2/s) - real(r8), pointer :: nfix_to_sminn_col (:) ! col symbiotic/asymbiotic N fixation to soil mineral N (gN/m2/s) - real(r8), pointer :: ffix_to_sminn_col (:) ! col free living N fixation to soil mineral N (gN/m2/s) - real(r8), pointer :: fert_to_sminn_col (:) ! col fertilizer N to soil mineral N (gN/m2/s) - real(r8), pointer :: soyfixn_to_sminn_col (:) ! col soybean fixation to soil mineral N (gN/m2/s) - - ! decomposition fluxes - real(r8), pointer :: decomp_cascade_ntransfer_vr_col (:,:,:) ! col vert-res transfer of N from donor to receiver pool along decomp. cascade (gN/m3/s) - real(r8), pointer :: decomp_cascade_ntransfer_col (:,:) ! col vert-int (diagnostic) transfer of N from donor to receiver pool along decomp. cascade (gN/m2/s) - real(r8), pointer :: decomp_cascade_sminn_flux_vr_col (:,:,:) ! col vert-res mineral N flux for transition along decomposition cascade (gN/m3/s) - real(r8), pointer :: decomp_cascade_sminn_flux_col (:,:) ! col vert-int (diagnostic) mineral N flux for transition along decomposition cascade (gN/m2/s) - - ! Used to update concentrations concurrently with vertical transport - ! vertically-resolved immobilization fluxes - real(r8), pointer :: potential_immob_vr_col (:,:) ! col vertically-resolved potential N immobilization (gN/m3/s) at each level - real(r8), pointer :: potential_immob_col (:) ! col vert-int (diagnostic) potential N immobilization (gN/m2/s) - real(r8), pointer :: actual_immob_vr_col (:,:) ! col vertically-resolved actual N immobilization (gN/m3/s) at each level - real(r8), pointer :: actual_immob_col (:) ! col vert-int (diagnostic) actual N immobilization (gN/m2/s) - real(r8), pointer :: sminn_to_plant_vr_col (:,:) ! col vertically-resolved plant uptake of soil mineral N (gN/m3/s) - real(r8), pointer :: sminn_to_plant_col (:) ! col vert-int (diagnostic) plant uptake of soil mineral N (gN/m2/s) - real(r8), pointer :: supplement_to_sminn_vr_col (:,:) ! col vertically-resolved supplemental N supply (gN/m3/s) - real(r8), pointer :: supplement_to_sminn_col (:) ! col vert-int (diagnostic) supplemental N supply (gN/m2/s) - real(r8), pointer :: gross_nmin_vr_col (:,:) ! col vertically-resolved gross rate of N mineralization (gN/m3/s) - real(r8), pointer :: gross_nmin_col (:) ! col vert-int (diagnostic) gross rate of N mineralization (gN/m2/s) - real(r8), pointer :: net_nmin_vr_col (:,:) ! col vertically-resolved net rate of N mineralization (gN/m3/s) - real(r8), pointer :: net_nmin_col (:) ! col vert-int (diagnostic) net rate of N mineralization (gN/m2/s) - real(r8), pointer :: sminn_to_plant_fun_col (:) ! col total soil N uptake of FUN (gN/m2/s) - ! ---------- NITRIF_DENITRIF --------------------- - - ! nitrification / denitrification fluxes - real(r8), pointer :: f_nit_vr_col (:,:) ! col (gN/m3/s) soil nitrification flux - real(r8), pointer :: f_denit_vr_col (:,:) ! col (gN/m3/s) soil denitrification flux - real(r8), pointer :: f_nit_col (:) ! col (gN/m2/s) soil nitrification flux - real(r8), pointer :: f_denit_col (:) ! col (gN/m2/s) soil denitrification flux - - real(r8), pointer :: pot_f_nit_vr_col (:,:) ! col (gN/m3/s) potential soil nitrification flux - real(r8), pointer :: pot_f_denit_vr_col (:,:) ! col (gN/m3/s) potential soil denitrification flux - real(r8), pointer :: pot_f_nit_col (:) ! col (gN/m2/s) potential soil nitrification flux - real(r8), pointer :: pot_f_denit_col (:) ! col (gN/m2/s) potential soil denitrification flux - real(r8), pointer :: n2_n2o_ratio_denit_vr_col (:,:) ! col ratio of N2 to N2O production by denitrification [gN/gN] - real(r8), pointer :: f_n2o_denit_vr_col (:,:) ! col flux of N2o from denitrification [gN/m^3/s] - real(r8), pointer :: f_n2o_denit_col (:) ! col flux of N2o from denitrification [gN/m^2/s] - real(r8), pointer :: f_n2o_nit_vr_col (:,:) ! col flux of N2o from nitrification [gN/m^3/s] - real(r8), pointer :: f_n2o_nit_col (:) ! col flux of N2o from nitrification [gN/m^2/s] - - ! immobilization / uptake fluxes - real(r8), pointer :: actual_immob_no3_vr_col (:,:) ! col vertically-resolved actual immobilization of NO3 (gN/m3/s) - real(r8), pointer :: actual_immob_nh4_vr_col (:,:) ! col vertically-resolved actual immobilization of NH4 (gN/m3/s) - real(r8), pointer :: smin_no3_to_plant_vr_col (:,:) ! col vertically-resolved plant uptake of soil NO3 (gN/m3/s) - real(r8), pointer :: smin_nh4_to_plant_vr_col (:,:) ! col vertically-resolved plant uptake of soil NH4 (gN/m3/s) - real(r8), pointer :: actual_immob_no3_col (:) ! col actual immobilization of NO3 (gN/m2/s) - real(r8), pointer :: actual_immob_nh4_col (:) ! col actual immobilization of NH4 (gN/m2/s) - real(r8), pointer :: smin_no3_to_plant_col (:) ! col plant uptake of soil NO3 (gN/m2/s) - real(r8), pointer :: smin_nh4_to_plant_col (:) ! col plant uptake of soil Nh4 (gN/m2/s) - - ! leaching fluxes - real(r8), pointer :: smin_no3_leached_vr_col (:,:) ! col vertically-resolved soil mineral NO3 loss to leaching (gN/m3/s) - real(r8), pointer :: smin_no3_leached_col (:) ! col soil mineral NO3 pool loss to leaching (gN/m2/s) - real(r8), pointer :: smin_no3_runoff_vr_col (:,:) ! col vertically-resolved rate of mineral NO3 loss with runoff (gN/m3/s) - real(r8), pointer :: smin_no3_runoff_col (:) ! col soil mineral NO3 pool loss to runoff (gN/m2/s) - - ! nitrification /denitrification diagnostic quantities - real(r8), pointer :: smin_no3_massdens_vr_col (:,:) ! col (ugN / g soil) soil nitrate concentration - real(r8), pointer :: soil_bulkdensity_col (:,:) ! col (kg soil / m3) bulk density of soil - real(r8), pointer :: k_nitr_t_vr_col (:,:) - real(r8), pointer :: k_nitr_ph_vr_col (:,:) - real(r8), pointer :: k_nitr_h2o_vr_col (:,:) - real(r8), pointer :: k_nitr_vr_col (:,:) - real(r8), pointer :: wfps_vr_col (:,:) - real(r8), pointer :: fmax_denit_carbonsubstrate_vr_col (:,:) - real(r8), pointer :: fmax_denit_nitrate_vr_col (:,:) - real(r8), pointer :: f_denit_base_vr_col (:,:) ! col nitrification and denitrification fluxes - real(r8), pointer :: diffus_col (:,:) ! col diffusivity (m2/s) - real(r8), pointer :: ratio_k1_col (:,:) - real(r8), pointer :: ratio_no3_co2_col (:,:) - real(r8), pointer :: soil_co2_prod_col (:,:) - real(r8), pointer :: fr_WFPS_col (:,:) - - real(r8), pointer :: r_psi_col (:,:) - real(r8), pointer :: anaerobic_frac_col (:,:) - real(r8), pointer :: sminn_to_plant_fun_no3_vr_col (:,:) ! col total layer no3 uptake of FUN (gN/m2/s) - real(r8), pointer :: sminn_to_plant_fun_nh4_vr_col (:,:) ! col total layer nh4 uptake of FUN (gN/m2/s) - !----------- no NITRIF_DENITRIF-------------- - - ! denitrification fluxes - real(r8), pointer :: sminn_to_denit_decomp_cascade_vr_col (:,:,:) ! col vertically-resolved denitrification along decomp cascade (gN/m3/s) - real(r8), pointer :: sminn_to_denit_decomp_cascade_col (:,:) ! col vertically-integrated (diagnostic) denitrification along decomp cascade (gN/m2/s) - real(r8), pointer :: sminn_to_denit_excess_vr_col (:,:) ! col vertically-resolved denitrification from excess mineral N pool (gN/m3/s) - real(r8), pointer :: sminn_to_denit_excess_col (:) ! col vertically-integrated (diagnostic) denitrification from excess mineral N pool (gN/m2/s) - - ! leaching fluxes - real(r8), pointer :: sminn_leached_vr_col (:,:) ! col vertically-resolved soil mineral N pool loss to leaching (gN/m3/s) - real(r8), pointer :: sminn_leached_col (:) ! col soil mineral N pool loss to leaching (gN/m2/s) - - ! summary (diagnostic) flux variables, not involved in mass balance - real(r8), pointer :: denit_col (:) ! col total rate of denitrification (gN/m2/s) - real(r8), pointer :: ninputs_col (:) ! col column-level N inputs (gN/m2/s) - real(r8), pointer :: noutputs_col (:) ! col column-level N outputs (gN/m2/s) - real(r8), pointer :: som_n_leached_col (:) ! col total SOM N loss from vertical transport (gN/m^2/s) - real(r8), pointer :: decomp_npools_leached_col (:,:) ! col N loss from vertical transport from each decomposing N pool (gN/m^2/s) - real(r8), pointer :: decomp_npools_transport_tendency_col (:,:,:) ! col N tendency due to vertical transport in decomposing N pools (gN/m^3/s) - - ! all n pools involved in decomposition - real(r8), pointer :: decomp_npools_sourcesink_col (:,:,:) ! col (gN/m3) change in decomposing n pools - ! (sum of all additions and subtractions from stateupdate1). - real(r8), pointer :: sminn_to_plant_fun_vr_col (:,:) ! col total layer soil N uptake of FUN (gN/m2/s) - contains - - procedure , public :: Init - procedure , public :: Restart - procedure , public :: SetValues - procedure , private :: InitAllocate - procedure , private :: InitHistory - procedure , private :: InitCold - - end type SoilBiogeochem_nitrogenflux_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(soilbiogeochem_nitrogenflux_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate (bounds) - call this%InitHistory (bounds) - call this%InitCold (bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize nitrogen flux - ! - ! !ARGUMENTS: - class(soilbiogeochem_nitrogenflux_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc,endc -! integer :: begp,endp - !------------------------------------------------------------------------ - - begc = bounds%begc; endc = bounds%endc -! begp = bounds%begp; endp = bounds%endp - allocate(this%ndep_to_sminn_col (begc:endc)) ; this%ndep_to_sminn_col (:) = nan - allocate(this%nfix_to_sminn_col (begc:endc)) ; this%nfix_to_sminn_col (:) = nan - allocate(this%ffix_to_sminn_col (begc:endc)) ; this%ffix_to_sminn_col (:) = nan - allocate(this%fert_to_sminn_col (begc:endc)) ; this%fert_to_sminn_col (:) = nan - allocate(this%soyfixn_to_sminn_col (begc:endc)) ; this%soyfixn_to_sminn_col (:) = nan - allocate(this%sminn_to_plant_col (begc:endc)) ; this%sminn_to_plant_col (:) = nan - allocate(this%potential_immob_col (begc:endc)) ; this%potential_immob_col (:) = nan - allocate(this%actual_immob_col (begc:endc)) ; this%actual_immob_col (:) = nan - allocate(this%gross_nmin_col (begc:endc)) ; this%gross_nmin_col (:) = nan - allocate(this%net_nmin_col (begc:endc)) ; this%net_nmin_col (:) = nan - allocate(this%denit_col (begc:endc)) ; this%denit_col (:) = nan - allocate(this%supplement_to_sminn_col (begc:endc)) ; this%supplement_to_sminn_col (:) = nan - allocate(this%ninputs_col (begc:endc)) ; this%ninputs_col (:) = nan - allocate(this%noutputs_col (begc:endc)) ; this%noutputs_col (:) = nan - allocate(this%som_n_leached_col (begc:endc)) ; this%som_n_leached_col (:) = nan - - allocate(this%r_psi_col (begc:endc,1:nlevdecomp_full)) ; this%r_psi_col (:,:) = spval - allocate(this%anaerobic_frac_col (begc:endc,1:nlevdecomp_full)) ; this%anaerobic_frac_col (:,:) = spval - allocate(this%potential_immob_vr_col (begc:endc,1:nlevdecomp_full)) ; this%potential_immob_vr_col (:,:) = nan - allocate(this%actual_immob_vr_col (begc:endc,1:nlevdecomp_full)) ; this%actual_immob_vr_col (:,:) = nan - allocate(this%sminn_to_plant_vr_col (begc:endc,1:nlevdecomp_full)) ; this%sminn_to_plant_vr_col (:,:) = nan - allocate(this%supplement_to_sminn_vr_col (begc:endc,1:nlevdecomp_full)) ; this%supplement_to_sminn_vr_col (:,:) = nan - allocate(this%gross_nmin_vr_col (begc:endc,1:nlevdecomp_full)) ; this%gross_nmin_vr_col (:,:) = nan - allocate(this%net_nmin_vr_col (begc:endc,1:nlevdecomp_full)) ; this%net_nmin_vr_col (:,:) = nan - allocate(this%sminn_to_plant_fun_col (begc:endc)) ; this%sminn_to_plant_fun_col (:) = nan - allocate(this%sminn_to_plant_fun_vr_col (begc:endc,1:nlevdecomp_full)) ; this%sminn_to_plant_fun_vr_col (:,:) = nan - allocate(this%sminn_to_plant_fun_no3_vr_col (begc:endc,1:nlevdecomp_full)) ; this%sminn_to_plant_fun_no3_vr_col(:,:) = nan - allocate(this%sminn_to_plant_fun_nh4_vr_col (begc:endc,1:nlevdecomp_full)) ; this%sminn_to_plant_fun_nh4_vr_col(:,:) = nan - allocate(this%f_nit_vr_col (begc:endc,1:nlevdecomp_full)) ; this%f_nit_vr_col (:,:) = nan - allocate(this%f_denit_vr_col (begc:endc,1:nlevdecomp_full)) ; this%f_denit_vr_col (:,:) = nan - allocate(this%smin_no3_leached_vr_col (begc:endc,1:nlevdecomp_full)) ; this%smin_no3_leached_vr_col (:,:) = nan - allocate(this%smin_no3_leached_col (begc:endc)) ; this%smin_no3_leached_col (:) = nan - allocate(this%smin_no3_runoff_vr_col (begc:endc,1:nlevdecomp_full)) ; this%smin_no3_runoff_vr_col (:,:) = nan - allocate(this%smin_no3_runoff_col (begc:endc)) ; this%smin_no3_runoff_col (:) = nan - allocate(this%pot_f_nit_vr_col (begc:endc,1:nlevdecomp_full)) ; this%pot_f_nit_vr_col (:,:) = nan - allocate(this%pot_f_nit_col (begc:endc)) ; this%pot_f_nit_col (:) = nan - allocate(this%pot_f_denit_vr_col (begc:endc,1:nlevdecomp_full)) ; this%pot_f_denit_vr_col (:,:) = nan - allocate(this%pot_f_denit_col (begc:endc)) ; this%pot_f_denit_col (:) = nan - allocate(this%actual_immob_no3_vr_col (begc:endc,1:nlevdecomp_full)) ; this%actual_immob_no3_vr_col (:,:) = nan - allocate(this%actual_immob_nh4_vr_col (begc:endc,1:nlevdecomp_full)) ; this%actual_immob_nh4_vr_col (:,:) = nan - allocate(this%smin_no3_to_plant_vr_col (begc:endc,1:nlevdecomp_full)) ; this%smin_no3_to_plant_vr_col (:,:) = nan - allocate(this%smin_nh4_to_plant_vr_col (begc:endc,1:nlevdecomp_full)) ; this%smin_nh4_to_plant_vr_col (:,:) = nan - allocate(this%f_nit_col (begc:endc)) ; this%f_nit_col (:) = nan - allocate(this%f_denit_col (begc:endc)) ; this%f_denit_col (:) = nan - allocate(this%n2_n2o_ratio_denit_vr_col (begc:endc,1:nlevdecomp_full)) ; this%n2_n2o_ratio_denit_vr_col (:,:) = nan - allocate(this%f_n2o_denit_col (begc:endc)) ; this%f_n2o_denit_col (:) = nan - allocate(this%f_n2o_denit_vr_col (begc:endc,1:nlevdecomp_full)) ; this%f_n2o_denit_vr_col (:,:) = nan - allocate(this%f_n2o_nit_col (begc:endc)) ; this%f_n2o_nit_col (:) = nan - allocate(this%f_n2o_nit_vr_col (begc:endc,1:nlevdecomp_full)) ; this%f_n2o_nit_vr_col (:,:) = nan - - allocate(this%smin_no3_massdens_vr_col (begc:endc,1:nlevdecomp_full)) ; this%smin_no3_massdens_vr_col (:,:) = nan - allocate(this%soil_bulkdensity_col (begc:endc,1:nlevdecomp_full)) ; this%soil_bulkdensity_col (:,:) = nan - allocate(this%k_nitr_t_vr_col (begc:endc,1:nlevdecomp_full)) ; this%k_nitr_t_vr_col (:,:) = nan - allocate(this%k_nitr_ph_vr_col (begc:endc,1:nlevdecomp_full)) ; this%k_nitr_ph_vr_col (:,:) = nan - allocate(this%k_nitr_h2o_vr_col (begc:endc,1:nlevdecomp_full)) ; this%k_nitr_h2o_vr_col (:,:) = nan - allocate(this%k_nitr_vr_col (begc:endc,1:nlevdecomp_full)) ; this%k_nitr_vr_col (:,:) = nan - allocate(this%wfps_vr_col (begc:endc,1:nlevdecomp_full)) ; this%wfps_vr_col (:,:) = nan - allocate(this%f_denit_base_vr_col (begc:endc,1:nlevdecomp_full)) ; this%f_denit_base_vr_col (:,:) = nan - allocate(this%diffus_col (begc:endc,1:nlevdecomp_full)) ; this%diffus_col (:,:) = spval - allocate(this%ratio_k1_col (begc:endc,1:nlevdecomp_full)) ; this%ratio_k1_col (:,:) = nan - allocate(this%ratio_no3_co2_col (begc:endc,1:nlevdecomp_full)) ; this%ratio_no3_co2_col (:,:) = spval - allocate(this%soil_co2_prod_col (begc:endc,1:nlevdecomp_full)) ; this%soil_co2_prod_col (:,:) = nan - allocate(this%fr_WFPS_col (begc:endc,1:nlevdecomp_full)) ; this%fr_WFPS_col (:,:) = spval - - allocate(this%fmax_denit_carbonsubstrate_vr_col (begc:endc,1:nlevdecomp_full)) ; - this%fmax_denit_carbonsubstrate_vr_col (:,:) = nan - allocate(this%fmax_denit_nitrate_vr_col (begc:endc,1:nlevdecomp_full)) ; - this%fmax_denit_nitrate_vr_col (:,:) = nan - - allocate(this%decomp_cascade_ntransfer_vr_col (begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions )) - allocate(this%decomp_cascade_sminn_flux_vr_col (begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions )) - allocate(this%decomp_cascade_ntransfer_col (begc:endc,1:ndecomp_cascade_transitions )) - allocate(this%decomp_cascade_sminn_flux_col (begc:endc,1:ndecomp_cascade_transitions )) - - this%decomp_cascade_ntransfer_vr_col (:,:,:) = nan - this%decomp_cascade_sminn_flux_vr_col (:,:,:) = nan - this%decomp_cascade_ntransfer_col (:,:) = nan - this%decomp_cascade_sminn_flux_col (:,:) = nan - - allocate(this%sminn_to_denit_decomp_cascade_vr_col (begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions )) - allocate(this%sminn_to_denit_decomp_cascade_col (begc:endc,1:ndecomp_cascade_transitions )) - allocate(this%sminn_to_denit_excess_vr_col (begc:endc,1:nlevdecomp_full )) - allocate(this%sminn_to_denit_excess_col (begc:endc )) - allocate(this%sminn_leached_vr_col (begc:endc,1:nlevdecomp_full )) - allocate(this%sminn_leached_col (begc:endc )) - allocate(this%decomp_npools_leached_col (begc:endc,1:ndecomp_pools )) - allocate(this%decomp_npools_transport_tendency_col (begc:endc,1:nlevdecomp_full,1:ndecomp_pools )) - - this%sminn_to_denit_decomp_cascade_vr_col (:,:,:) = nan - this%sminn_to_denit_decomp_cascade_col (:,:) = nan - this%sminn_to_denit_excess_vr_col (:,:) = nan - this%sminn_to_denit_excess_col (:) = nan - this%sminn_leached_vr_col (:,:) = nan - this%sminn_leached_col (:) = nan - this%decomp_npools_leached_col (:,:) = nan - this%decomp_npools_transport_tendency_col (:,:,:) = nan - - allocate(this%decomp_npools_sourcesink_col (begc:endc,1:nlevdecomp_full,1:ndecomp_pools)) - this%decomp_npools_sourcesink_col (:,:,:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use histFileMod , only : hist_addfld1d, hist_addfld_decomp - ! - ! !ARGUMENTS: - class(soilbiogeochem_nitrogenflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: k,l - integer :: begc, endc - character(24) :: fieldname - character(100) :: longname - character(8) :: vr_suffix - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - begc = bounds%begc; endc= bounds%endc - - ! add suffix if number of soil decomposition depths is greater than 1 - if (nlevdecomp > 1) then - vr_suffix = "_vr" - else - vr_suffix = "" - endif - - !------------------------------- - ! N flux variables - native to column - !------------------------------- - - this%ndep_to_sminn_col(begc:endc) = spval - call hist_addfld1d (fname='NDEP_TO_SMINN', units='gN/m^2/s', & - avgflag='A', long_name='atmospheric N deposition to soil mineral N', & - ptr_col=this%ndep_to_sminn_col, default='inactive') - - this%nfix_to_sminn_col(begc:endc) = spval - call hist_addfld1d (fname='NFIX_TO_SMINN', units='gN/m^2/s', & - avgflag='A', long_name='symbiotic/asymbiotic N fixation to soil mineral N', & - ptr_col=this%nfix_to_sminn_col, default='inactive') - - this%ffix_to_sminn_col(begc:endc) = spval - call hist_addfld1d (fname='FFIX_TO_SMINN', units='gN/m^2/s', & - avgflag='A', long_name='free living N fixation to soil mineral N', & - ptr_col=this%ffix_to_sminn_col, default='inactive') - - do l = 1, ndecomp_cascade_transitions - ! vertically integrated fluxes - !-- mineralization/immobilization fluxes (none from CWD) - if ( .not. decomp_cascade_con%is_cwd(decomp_cascade_con%cascade_donor_pool(l)) ) then - this%decomp_cascade_sminn_flux_col(begc:endc,l) = spval - data1dptr => this%decomp_cascade_sminn_flux_col(:,l) - if ( decomp_cascade_con%cascade_receiver_pool(l) /= 0 ) then - fieldname = 'SMINN_TO_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l)))//'N_'//& - trim(decomp_cascade_con%decomp_pool_name_short(decomp_cascade_con%cascade_donor_pool(l))) - longname = 'mineral N flux for decomp. of '& - //trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//& - 'to '//trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l))) - else - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& - //'N_TO_SMINN' - longname = 'mineral N flux for decomp. of '& - //trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l))) - endif - call hist_addfld1d (fname=fieldname, units='gN/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - end if - - !-- transfer fluxes (none from terminal pool, if present) - if ( decomp_cascade_con%cascade_receiver_pool(l) /= 0 ) then - this%decomp_cascade_ntransfer_col(begc:endc,l) = spval - data1dptr => this%decomp_cascade_ntransfer_col(:,l) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//'N_TO_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l)))//'N' - longname = 'decomp. of '//trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l)))//& - ' N to '//trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_receiver_pool(l)))//' N' - call hist_addfld1d (fname=fieldname, units='gN/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - end if - - ! vertically resolved fluxes - if ( nlevdecomp_full > 1 ) then - !-- mineralization/immobilization fluxes (none from CWD) - if ( .not. decomp_cascade_con%is_cwd(decomp_cascade_con%cascade_donor_pool(l)) ) then - this%decomp_cascade_sminn_flux_vr_col(begc:endc,:,l) = spval - data2dptr => this%decomp_cascade_sminn_flux_vr_col(:,:,l) - if ( decomp_cascade_con%cascade_receiver_pool(l) /= 0 ) then - fieldname = 'SMINN_TO_'& - //trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l)))//'N_'//& - trim(decomp_cascade_con%decomp_pool_name_short(decomp_cascade_con%cascade_donor_pool(l)))//trim(vr_suffix) - longname = 'mineral N flux for decomp. of '& - //trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//& - 'to '//trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l))) - else - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& - //'N_TO_SMINN'//trim(vr_suffix) - longname = 'mineral N flux for decomp. of '& - //trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l))) - endif - call hist_addfld_decomp (fname=fieldname, units='gN/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - - !-- transfer fluxes (none from terminal pool, if present) - if ( decomp_cascade_con%cascade_receiver_pool(l) /= 0 ) then - this%decomp_cascade_ntransfer_vr_col(begc:endc,:,l) = spval - data2dptr => this%decomp_cascade_ntransfer_vr_col(:,:,l) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//'N_TO_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l)))& - //'N'//trim(vr_suffix) - longname = 'decomp. of '& - //trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l)))//& - ' N to '//trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_receiver_pool(l)))//' N' - call hist_addfld_decomp (fname=fieldname, units='gN/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - - endif - end do - - this%denit_col(begc:endc) = spval - call hist_addfld1d (fname='DENIT', units='gN/m^2/s', & - avgflag='A', long_name='total rate of denitrification', & - ptr_col=this%denit_col, default='inactive') - - this%som_n_leached_col(begc:endc) = spval - call hist_addfld1d (fname='SOM_N_LEACHED', units='gN/m^2/s', & - avgflag='A', long_name='total flux of N from SOM pools due to leaching', & - ptr_col=this%som_n_leached_col, default='inactive') - - do k = 1, ndecomp_pools - if ( .not. decomp_cascade_con%is_cwd(k) ) then - this%decomp_npools_leached_col(begc:endc,k) = spval - data1dptr => this%decomp_npools_leached_col(:,k) - fieldname = 'M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'N_TO_LEACHING' - longname = trim(decomp_cascade_con%decomp_pool_name_long(k))//' N leaching loss' - call hist_addfld1d (fname=fieldname, units='gN/m^2/s', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - - this%decomp_npools_transport_tendency_col(begc:endc,:,k) = spval - data2dptr => this%decomp_npools_transport_tendency_col(:,:,k) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(k))//'N_TNDNCY_VERT_TRANSPORT' - longname = trim(decomp_cascade_con%decomp_pool_name_long(k))//' N tendency due to vertical transport' - call hist_addfld_decomp (fname=fieldname, units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - end if - end do - - if (.not. use_nitrif_denitrif) then - do l = 1, ndecomp_cascade_transitions - !-- denitrification fluxes (none from CWD) - if ( .not. decomp_cascade_con%is_cwd(decomp_cascade_con%cascade_donor_pool(l)) ) then - this%sminn_to_denit_decomp_cascade_col(begc:endc,l) = spval - data1dptr => this%sminn_to_denit_decomp_cascade_col(:,l) - fieldname = 'SMINN_TO_DENIT_'//trim(decomp_cascade_con%cascade_step_name(l)) - longname = 'denitrification for decomp. of '& - //trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l)))//& - 'to '//trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l))) - call hist_addfld1d (fname=fieldname, units='gN/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - endif - - if ( nlevdecomp_full > 1 ) then - !-- denitrification fluxes (none from CWD) - if ( .not. decomp_cascade_con%is_cwd(decomp_cascade_con%cascade_donor_pool(l)) ) then - this%sminn_to_denit_decomp_cascade_vr_col(begc:endc,:,l) = spval - data2dptr => this%sminn_to_denit_decomp_cascade_vr_col(:,:,l) - fieldname = 'SMINN_TO_DENIT_'//trim(decomp_cascade_con%cascade_step_name(l))//trim(vr_suffix) - longname = 'denitrification for decomp. of '& - //trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l)))//& - 'to '//trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l))) - call hist_addfld_decomp (fname=fieldname, units='gN/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - endif - end do - end if - - if (.not. use_nitrif_denitrif) then - this%sminn_to_denit_excess_col(begc:endc) = spval - call hist_addfld1d (fname='SMINN_TO_DENIT_EXCESS', units='gN/m^2/s', & - avgflag='A', long_name='denitrification from excess mineral N pool', & - ptr_col=this%sminn_to_denit_excess_col, default='inactive') - end if - - if (.not. use_nitrif_denitrif) then - this%sminn_leached_col(begc:endc) = spval - call hist_addfld1d (fname='SMINN_LEACHED', units='gN/m^2/s', & - avgflag='A', long_name='soil mineral N pool loss to leaching', & - ptr_col=this%sminn_leached_col, default='inactive') - end if - - if (.not. use_nitrif_denitrif) then - if ( nlevdecomp_full > 1 ) then - this%sminn_to_denit_excess_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SMINN_TO_DENIT_EXCESS'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='denitrification from excess mineral N pool', & - ptr_col=this%sminn_to_denit_excess_vr_col, default='inactive') - - this%sminn_leached_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SMINN_LEACHED'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='soil mineral N pool loss to leaching', & - ptr_col=this%sminn_leached_vr_col, default='inactive') - endif - end if - - if (use_nitrif_denitrif) then - this%f_nit_col(begc:endc) = spval - call hist_addfld1d (fname='F_NIT', units='gN/m^2/s', & - avgflag='A', long_name='nitrification flux', & - ptr_col=this%f_nit_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%f_denit_col(begc:endc) = spval - call hist_addfld1d (fname='F_DENIT', units='gN/m^2/s', & - avgflag='A', long_name='denitrification flux', & - ptr_col=this%f_denit_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%pot_f_nit_col(begc:endc) = spval - call hist_addfld1d (fname='POT_F_NIT', units='gN/m^2/s', & - avgflag='A', long_name='potential nitrification flux', & - ptr_col=this%pot_f_nit_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%pot_f_denit_col(begc:endc) = spval - call hist_addfld1d (fname='POT_F_DENIT', units='gN/m^2/s', & - avgflag='A', long_name='potential denitrification flux', & - ptr_col=this%pot_f_denit_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%smin_no3_leached_col(begc:endc) = spval - call hist_addfld1d (fname='SMIN_NO3_LEACHED', units='gN/m^2/s', & - avgflag='A', long_name='soil NO3 pool loss to leaching', & - ptr_col=this%smin_no3_leached_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%smin_no3_runoff_col(begc:endc) = spval - call hist_addfld1d (fname='SMIN_NO3_RUNOFF', units='gN/m^2/s', & - avgflag='A', long_name='soil NO3 pool loss to runoff', & - ptr_col=this%smin_no3_runoff_col, default='inactive') - end if - - if (use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%f_nit_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='F_NIT'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='nitrification flux', & - ptr_col=this%f_nit_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%f_denit_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='F_DENIT'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='denitrification flux', & - ptr_col=this%f_denit_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%pot_f_nit_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='POT_F_NIT'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='potential nitrification flux', & - ptr_col=this%pot_f_nit_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%pot_f_denit_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='POT_F_DENIT'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='potential denitrification flux', & - ptr_col=this%pot_f_denit_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%smin_no3_leached_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SMIN_NO3_LEACHED'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='soil NO3 pool loss to leaching', & - ptr_col=this%smin_no3_leached_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%smin_no3_runoff_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SMIN_NO3_RUNOFF'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='soil NO3 pool loss to runoff', & - ptr_col=this%smin_no3_runoff_vr_col, default='inactive') - endif - - if (use_nitrif_denitrif) then - this%n2_n2o_ratio_denit_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='n2_n2o_ratio_denit', units='gN/gN', type2d='levdcmp', & - avgflag='A', long_name='n2_n2o_ratio_denit', & - ptr_col=this%n2_n2o_ratio_denit_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%actual_immob_no3_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='ACTUAL_IMMOB_NO3', units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='immobilization of NO3', & - ptr_col=this%actual_immob_no3_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%actual_immob_nh4_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='ACTUAL_IMMOB_NH4', units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='immobilization of NH4', & - ptr_col=this%actual_immob_nh4_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%smin_no3_to_plant_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SMIN_NO3_TO_PLANT', units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='plant uptake of NO3', & - ptr_col=this%smin_no3_to_plant_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%smin_nh4_to_plant_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SMIN_NH4_TO_PLANT', units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='plant uptake of NH4', & - ptr_col=this%smin_nh4_to_plant_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%smin_no3_massdens_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SMIN_NO3_MASSDENS', units='ugN/cm^3 soil', type2d='levdcmp', & - avgflag='A', long_name='SMIN_NO3_MASSDENS', & - ptr_col=this%smin_no3_massdens_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%k_nitr_t_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='K_NITR_T', units='unitless', type2d='levdcmp', & - avgflag='A', long_name='K_NITR_T', & - ptr_col=this%k_nitr_t_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%k_nitr_ph_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='K_NITR_PH', units='unitless', type2d='levdcmp', & - avgflag='A', long_name='K_NITR_PH', & - ptr_col=this%k_nitr_ph_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%k_nitr_h2o_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='K_NITR_H2O', units='unitless', type2d='levdcmp', & - avgflag='A', long_name='K_NITR_H2O', & - ptr_col=this%k_nitr_h2o_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%k_nitr_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='K_NITR', units='1/s', type2d='levdcmp', & - avgflag='A', long_name='K_NITR', & - ptr_col=this%k_nitr_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%wfps_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='WFPS', units='percent', type2d='levdcmp', & - avgflag='A', long_name='WFPS', & - ptr_col=this%wfps_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%fmax_denit_carbonsubstrate_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='FMAX_DENIT_CARBONSUBSTRATE', units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='FMAX_DENIT_CARBONSUBSTRATE', & - ptr_col=this%fmax_denit_carbonsubstrate_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%fmax_denit_nitrate_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='FMAX_DENIT_NITRATE', units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='FMAX_DENIT_NITRATE', & - ptr_col=this%fmax_denit_nitrate_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%f_denit_base_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='F_DENIT_BASE', units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='F_DENIT_BASE', & - ptr_col=this%f_denit_base_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%diffus_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='diffus', units='m^2/s', type2d='levdcmp', & - avgflag='A', long_name='diffusivity', & - ptr_col=this%diffus_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%ratio_k1_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='ratio_k1', units='none', type2d='levdcmp', & - avgflag='A', long_name='ratio_k1', & - ptr_col=this%ratio_k1_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%ratio_no3_co2_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='ratio_no3_co2', units='ratio', type2d='levdcmp', & - avgflag='A', long_name='ratio_no3_co2', & - ptr_col=this%ratio_no3_co2_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%soil_co2_prod_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='soil_co2_prod', units='ug C / g soil / day', type2d='levdcmp', & - avgflag='A', long_name='soil_co2_prod', & - ptr_col=this%soil_co2_prod_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%fr_WFPS_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='fr_WFPS', units='fraction', type2d='levdcmp', & - avgflag='A', long_name='fr_WFPS', & - ptr_col=this%fr_WFPS_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%soil_bulkdensity_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='soil_bulkdensity', units='kg/m3', type2d='levdcmp', & - avgflag='A', long_name='soil_bulkdensity', & - ptr_col=this%soil_bulkdensity_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%anaerobic_frac_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='anaerobic_frac', units='m3/m3', type2d='levdcmp', & - avgflag='A', long_name='anaerobic_frac', & - ptr_col=this%anaerobic_frac_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%r_psi_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='r_psi', units='m', type2d='levdcmp', & - avgflag='A', long_name='r_psi', & - ptr_col=this%r_psi_col, default='inactive') - end if - - - if ( use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%potential_immob_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='POTENTIAL_IMMOB'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='potential N immobilization', & - ptr_col=this%potential_immob_vr_col, default='inactive') - end if - - if ( use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%actual_immob_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='ACTUAL_IMMOB'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='actual N immobilization', & - ptr_col=this%actual_immob_vr_col, default='inactive') - end if - - if ( use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%sminn_to_plant_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SMINN_TO_PLANT'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='plant uptake of soil mineral N', & - ptr_col=this%sminn_to_plant_vr_col, default='inactive') - end if - - if ( use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%supplement_to_sminn_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SUPPLEMENT_TO_SMINN'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='supplemental N supply', & - ptr_col=this%supplement_to_sminn_vr_col, default='inactive') - end if - - if ( use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%gross_nmin_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='GROSS_NMIN'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='gross rate of N mineralization', & - ptr_col=this%gross_nmin_vr_col, default='inactive') - end if - - if ( use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%net_nmin_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='NET_NMIN'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='net rate of N mineralization', & - ptr_col=this%net_nmin_vr_col, default='inactive') - end if - - this%potential_immob_col(begc:endc) = spval - call hist_addfld1d (fname='POTENTIAL_IMMOB', units='gN/m^2/s', & - avgflag='A', long_name='potential N immobilization', & - ptr_col=this%potential_immob_col, default='inactive') - - this%actual_immob_col(begc:endc) = spval - call hist_addfld1d (fname='ACTUAL_IMMOB', units='gN/m^2/s', & - avgflag='A', long_name='actual N immobilization', & - ptr_col=this%actual_immob_col, default='inactive') - - this%sminn_to_plant_col(begc:endc) = spval - call hist_addfld1d (fname='SMINN_TO_PLANT', units='gN/m^2/s', & - avgflag='A', long_name='plant uptake of soil mineral N', & - ptr_col=this%sminn_to_plant_col, default='inactive') - - this%supplement_to_sminn_col(begc:endc) = spval - call hist_addfld1d (fname='SUPPLEMENT_TO_SMINN', units='gN/m^2/s', & - avgflag='A', long_name='supplemental N supply', & - ptr_col=this%supplement_to_sminn_col, default='inactive') - - this%gross_nmin_col(begc:endc) = spval - call hist_addfld1d (fname='GROSS_NMIN', units='gN/m^2/s', & - avgflag='A', long_name='gross rate of N mineralization', & - ptr_col=this%gross_nmin_col, default='inactive') - - this%net_nmin_col(begc:endc) = spval - call hist_addfld1d (fname='NET_NMIN', units='gN/m^2/s', & - avgflag='A', long_name='net rate of N mineralization', & - ptr_col=this%net_nmin_col, default='inactive') - - if (use_nitrif_denitrif) then - this%f_n2o_nit_col(begc:endc) = spval - call hist_addfld1d (fname='F_N2O_NIT', units='gN/m^2/s', & - avgflag='A', long_name='nitrification N2O flux', & - ptr_col=this%f_n2o_nit_col, default='inactive') - - this%f_n2o_denit_col(begc:endc) = spval - call hist_addfld1d (fname='F_N2O_DENIT', units='gN/m^2/s', & - avgflag='A', long_name='denitrification N2O flux', & - ptr_col=this%f_n2o_denit_col, default='inactive') - end if - - if (use_crop) then - this%fert_to_sminn_col(begc:endc) = spval - call hist_addfld1d (fname='FERT_TO_SMINN', units='gN/m^2/s', & - avgflag='A', long_name='fertilizer to soil mineral N', & - ptr_col=this%fert_to_sminn_col, default='inactive') - end if - - if (use_crop .and. .not. use_fun) then - this%soyfixn_to_sminn_col(begc:endc) = spval - call hist_addfld1d (fname='SOYFIXN_TO_SMINN', units='gN/m^2/s', & - avgflag='A', long_name='Soybean fixation to soil mineral N', & - ptr_col=this%soyfixn_to_sminn_col, default='inactive') - end if - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !DESCRIPTION: - ! Initializes time varying variables used only in coupled carbon-nitrogen mode (CN): - ! - ! !USES: - use landunit_varcon , only : istsoil, istcrop - ! - ! !ARGUMENTS: - class(soilbiogeochem_nitrogenflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: c,l - integer :: num_special_col ! number of good values in special_col filter - integer :: special_col(bounds%endc-bounds%begc+1) ! special landunit filter - columns - !--------------------------------------------------------------------- - - ! Set column filters - - num_special_col = 0 - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - num_special_col = num_special_col + 1 - special_col(num_special_col) = c - end if - end do - - !----------------------------------------------- - ! initialize nitrogen flux variables - !----------------------------------------------- - - call this%SetValues (& - num_column=num_special_col, filter_column=special_col, value_column=0._r8) - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart (this, bounds, ncid, flag ) - ! - ! !DESCRIPTION: - ! Read/write CN restart data for carbon state - ! - ! !USES: - use restUtilMod - use ncdio_pio - ! - ! !ARGUMENTS: - class(soilbiogeochem_nitrogenflux_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag !'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - logical :: readvar ! determine if variable is on initial file - real(r8), pointer :: ptr2d(:,:) ! temp. pointers for slicing larger arrays - real(r8), pointer :: ptr1d(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - if (use_nitrif_denitrif) then - ! pot_f_nit_vr - if (use_vertsoilc) then - ptr2d => this%pot_f_nit_vr_col(:,:) - call restartvar(ncid=ncid, flag=flag, varname='pot_f_nit_vr_vr', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='potential soil nitrification flux', units='gN/m3/s', & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%pot_f_nit_vr_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname='pot_f_nit_vr', xtype=ncd_double, & - dim1name='column', & - long_name='soil nitrification flux', units='gN/m3/s', & - interpinic_flag='interp', readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - call endrun(msg= 'ERROR:: pot_f_nit_vr'//' is required on an initialization dataset' ) - end if - end if - - if (use_nitrif_denitrif) then - ! f_nit_vr - if (use_vertsoilc) then - ptr2d => this%f_nit_vr_col(:,:) - call restartvar(ncid=ncid, flag=flag, varname='f_nit_vr_vr', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='soil nitrification flux', units='gN/m3/s', & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%f_nit_vr_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname='f_nit_vr', xtype=ncd_double, & - dim1name='column', & - long_name='soil nitrification flux', units='gN/m3/s', & - interpinic_flag='interp', readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - call endrun(msg='ERROR:: f_nit_vr'//' is required on an initialization dataset'//& - errMsg(sourcefile, __LINE__)) - end if - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine SetValues ( this, & - num_column, filter_column, value_column) - ! - ! !DESCRIPTION: - ! Set nitrogen flux variables - ! - ! !ARGUMENTS: - ! !ARGUMENTS: - class(soilbiogeochem_nitrogenflux_type) :: this - integer , intent(in) :: num_column - integer , intent(in) :: filter_column(:) - real(r8), intent(in) :: value_column - ! - ! !LOCAL VARIABLES: - integer :: fi,i,j,k,l ! loop index - !------------------------------------------------------------------------ - - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - - if (.not. use_nitrif_denitrif) then - this%sminn_to_denit_excess_vr_col(i,j) = value_column - this%sminn_leached_vr_col(i,j) = value_column - this%sminn_to_plant_fun_vr_col(i,j) = value_column - else - this%f_nit_vr_col(i,j) = value_column - this%f_denit_vr_col(i,j) = value_column - this%smin_no3_leached_vr_col(i,j) = value_column - this%smin_no3_runoff_vr_col(i,j) = value_column - this%n2_n2o_ratio_denit_vr_col(i,j) = value_column - this%pot_f_nit_vr_col(i,j) = value_column - this%pot_f_denit_vr_col(i,j) = value_column - this%actual_immob_no3_vr_col(i,j) = value_column - this%actual_immob_nh4_vr_col(i,j) = value_column - this%smin_no3_to_plant_vr_col(i,j) = value_column - this%smin_nh4_to_plant_vr_col(i,j) = value_column - this%f_n2o_denit_vr_col(i,j) = value_column - this%f_n2o_nit_vr_col(i,j) = value_column - - this%smin_no3_massdens_vr_col(i,j) = value_column - this%k_nitr_t_vr_col(i,j) = value_column - this%k_nitr_ph_vr_col(i,j) = value_column - this%k_nitr_h2o_vr_col(i,j) = value_column - this%k_nitr_vr_col(i,j) = value_column - this%wfps_vr_col(i,j) = value_column - this%fmax_denit_carbonsubstrate_vr_col(i,j) = value_column - this%fmax_denit_nitrate_vr_col(i,j) = value_column - this%f_denit_base_vr_col(i,j) = value_column - - this%diffus_col(i,j) = value_column - this%ratio_k1_col(i,j) = value_column - this%ratio_no3_co2_col(i,j) = value_column - this%soil_co2_prod_col(i,j) = value_column - this%fr_WFPS_col(i,j) = value_column - this%soil_bulkdensity_col(i,j) = value_column - - this%r_psi_col(i,j) = value_column - this%anaerobic_frac_col(i,j) = value_column - end if - this%potential_immob_vr_col(i,j) = value_column - this%actual_immob_vr_col(i,j) = value_column - this%sminn_to_plant_vr_col(i,j) = value_column - this%supplement_to_sminn_vr_col(i,j) = value_column - this%gross_nmin_vr_col(i,j) = value_column - this%net_nmin_vr_col(i,j) = value_column - this%sminn_to_plant_fun_no3_vr_col(i,j) = value_column - this%sminn_to_plant_fun_nh4_vr_col(i,j) = value_column - end do - end do - - do fi = 1,num_column - i = filter_column(fi) - - this%ndep_to_sminn_col(i) = value_column - this%nfix_to_sminn_col(i) = value_column - this%ffix_to_sminn_col(i) = value_column - this%fert_to_sminn_col(i) = value_column - this%soyfixn_to_sminn_col(i) = value_column - this%potential_immob_col(i) = value_column - this%actual_immob_col(i) = value_column - this%sminn_to_plant_col(i) = value_column - this%supplement_to_sminn_col(i) = value_column - this%gross_nmin_col(i) = value_column - this%net_nmin_col(i) = value_column - this%denit_col(i) = value_column - this%sminn_to_plant_fun_col(i) = value_column - if (use_nitrif_denitrif) then - this%f_nit_col(i) = value_column - this%pot_f_nit_col(i) = value_column - this%f_denit_col(i) = value_column - this%pot_f_denit_col(i) = value_column - this%f_n2o_denit_col(i) = value_column - this%f_n2o_nit_col(i) = value_column - this%smin_no3_leached_col(i) = value_column - this%smin_no3_runoff_col(i) = value_column - else - this%sminn_to_denit_excess_col(i) = value_column - this%sminn_leached_col(i) = value_column - end if - this%ninputs_col(i) = value_column - this%noutputs_col(i) = value_column - this%som_n_leached_col(i) = value_column - end do - - do k = 1, ndecomp_pools - do fi = 1,num_column - i = filter_column(fi) - this%decomp_npools_leached_col(i,k) = value_column - end do - end do - - do k = 1, ndecomp_pools - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%decomp_npools_transport_tendency_col(i,j,k) = value_column - end do - end do - end do - - do l = 1, ndecomp_cascade_transitions - do fi = 1,num_column - i = filter_column(fi) - this%decomp_cascade_ntransfer_col(i,l) = value_column - this%decomp_cascade_sminn_flux_col(i,l) = value_column - if (.not. use_nitrif_denitrif) then - this%sminn_to_denit_decomp_cascade_col(i,l) = value_column - end if - end do - end do - - do l = 1, ndecomp_cascade_transitions - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%decomp_cascade_ntransfer_vr_col(i,j,l) = value_column - this%decomp_cascade_sminn_flux_vr_col(i,j,l) = value_column - if (.not. use_nitrif_denitrif) then - this%sminn_to_denit_decomp_cascade_vr_col(i,j,l) = value_column - end if - end do - end do - end do - - do k = 1, ndecomp_pools - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%decomp_npools_sourcesink_col(i,j,k) = value_column - end do - end do - end do - - end subroutine SetValues - -end module soilbiogeochemNitrogenFluxType - diff --git a/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 b/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 deleted file mode 100644 index 9403bd6c83..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 +++ /dev/null @@ -1,717 +0,0 @@ -module SoilBiogeochemNitrogenStateType - -#include "shr_assert.h" - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use spmdMod , only : masterproc - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools, nlevcan - use clm_varpar , only : nlevdecomp_full, nlevdecomp, nlevsoi - use clm_varcon , only : spval, dzsoi_decomp, zisoi - use clm_varctl , only : use_nitrif_denitrif, use_vertsoilc, use_century_decomp - use clm_varctl , only : iulog, override_bgc_restart_mismatch_dump, spinup_state - use landunit_varcon , only : istcrop, istsoil - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use LandunitType , only : lun - use ColumnType , only : col - use GridcellType , only : grc - use SoilBiogeochemStateType , only : get_spinup_latitude_term - ! - ! !PUBLIC TYPES: - implicit none - private - - type, public :: soilbiogeochem_nitrogenstate_type - - real(r8), pointer :: decomp_npools_vr_col (:,:,:) ! col (gN/m3) vertically-resolved decomposing (litter, cwd, soil) N pools - real(r8), pointer :: sminn_vr_col (:,:) ! col (gN/m3) vertically-resolved soil mineral N - real(r8), pointer :: ntrunc_vr_col (:,:) ! col (gN/m3) vertically-resolved column-level sink for N truncation - - ! nitrif_denitrif - real(r8), pointer :: smin_no3_vr_col (:,:) ! col (gN/m3) vertically-resolved soil mineral NO3 - real(r8), pointer :: smin_no3_col (:) ! col (gN/m2) soil mineral NO3 pool - real(r8), pointer :: smin_nh4_vr_col (:,:) ! col (gN/m3) vertically-resolved soil mineral NH4 - real(r8), pointer :: smin_nh4_col (:) ! col (gN/m2) soil mineral NH4 pool - - ! summary (diagnostic) state variables, not involved in mass balance - real(r8), pointer :: decomp_npools_col (:,:) ! col (gN/m2) decomposing (litter, cwd, soil) N pools - real(r8), pointer :: decomp_npools_1m_col (:,:) ! col (gN/m2) diagnostic: decomposing (litter, cwd, soil) N pools to 1 meter - real(r8), pointer :: sminn_col (:) ! col (gN/m2) soil mineral N - real(r8), pointer :: ntrunc_col (:) ! col (gN/m2) column-level sink for N truncation - real(r8), pointer :: cwdn_col (:) ! col (gN/m2) Diagnostic: coarse woody debris N - real(r8), pointer :: totlitn_col (:) ! col (gN/m2) total litter nitrogen - real(r8), pointer :: totsomn_col (:) ! col (gN/m2) total soil organic matter nitrogen - real(r8), pointer :: totlitn_1m_col (:) ! col (gN/m2) total litter nitrogen to 1 meter - real(r8), pointer :: totsomn_1m_col (:) ! col (gN/m2) total soil organic matter nitrogen to 1 meter - real(r8), pointer :: dyn_nbal_adjustments_col (:) ! (gN/m2) adjustments to each column made in this timestep via dynamic column adjustments (note: this variable only makes sense at the column-level: it is meaningless if averaged to the gridcell-level) - - ! Track adjustments to no3 and nh4 pools separately, since those aren't included in - ! the N balance check - real(r8), pointer :: dyn_no3bal_adjustments_col (:) ! (gN/m2) NO3 adjustments to each column made in this timestep via dynamic column area adjustments (only makes sense at the column-level: meaningless if averaged to the gridcell-level) - real(r8), pointer :: dyn_nh4bal_adjustments_col (:) ! (gN/m2) NH4 adjustments to each column made in this timestep via dynamic column adjustments (only makes sense at the column-level: meaningless if averaged to the gridcell-level) - real(r8) :: totvegcthresh ! threshold for total vegetation carbon to zero out decomposition pools - - contains - - procedure , public :: Init - procedure , public :: Restart - procedure , public :: SetValues - procedure , private :: InitAllocate - procedure , private :: InitHistory - procedure , private :: InitCold - - end type soilbiogeochem_nitrogenstate_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, & - decomp_cpools_vr_col, decomp_cpools_col, decomp_cpools_1m_col) - - class(soilbiogeochem_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: decomp_cpools_vr_col (bounds%begc:, 1:, 1:) - real(r8) , intent(in) :: decomp_cpools_col (bounds%begc:, 1:) - real(r8) , intent(in) :: decomp_cpools_1m_col (bounds%begc:, 1:) - - this%totvegcthresh = nan - call this%InitAllocate (bounds ) - - call this%InitHistory (bounds) - - call this%InitCold ( bounds, & - decomp_cpools_vr_col, decomp_cpools_col, decomp_cpools_1m_col) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !ARGUMENTS: - class (soilbiogeochem_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc,endc - !------------------------------------------------------------------------ - - begc = bounds%begc; endc = bounds%endc - - allocate(this%sminn_vr_col (begc:endc,1:nlevdecomp_full)) ; this%sminn_vr_col (:,:) = nan - allocate(this%ntrunc_vr_col (begc:endc,1:nlevdecomp_full)) ; this%ntrunc_vr_col (:,:) = nan - allocate(this%smin_no3_vr_col (begc:endc,1:nlevdecomp_full)) ; this%smin_no3_vr_col (:,:) = nan - allocate(this%smin_nh4_vr_col (begc:endc,1:nlevdecomp_full)) ; this%smin_nh4_vr_col (:,:) = nan - allocate(this%smin_no3_col (begc:endc)) ; this%smin_no3_col (:) = nan - allocate(this%smin_nh4_col (begc:endc)) ; this%smin_nh4_col (:) = nan - allocate(this%cwdn_col (begc:endc)) ; this%cwdn_col (:) = nan - allocate(this%sminn_col (begc:endc)) ; this%sminn_col (:) = nan - allocate(this%ntrunc_col (begc:endc)) ; this%ntrunc_col (:) = nan - allocate(this%totlitn_col (begc:endc)) ; this%totlitn_col (:) = nan - allocate(this%totsomn_col (begc:endc)) ; this%totsomn_col (:) = nan - allocate(this%totlitn_1m_col (begc:endc)) ; this%totlitn_1m_col (:) = nan - allocate(this%totsomn_1m_col (begc:endc)) ; this%totsomn_1m_col (:) = nan - allocate(this%dyn_nbal_adjustments_col (begc:endc)) ; this%dyn_nbal_adjustments_col (:) = nan - allocate(this%dyn_no3bal_adjustments_col (begc:endc)) ; this%dyn_no3bal_adjustments_col (:) = nan - allocate(this%dyn_nh4bal_adjustments_col (begc:endc)) ; this%dyn_nh4bal_adjustments_col (:) = nan - allocate(this%decomp_npools_col (begc:endc,1:ndecomp_pools)) ; this%decomp_npools_col (:,:) = nan - allocate(this%decomp_npools_1m_col (begc:endc,1:ndecomp_pools)) ; this%decomp_npools_1m_col (:,:) = nan - - allocate(this%decomp_npools_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools)); - this%decomp_npools_vr_col(:,:,:)= nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! add history fields for all CN variables, always set as default='inactive' - ! - ! !USES: - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools - use clm_varpar , only : nlevdecomp, nlevdecomp_full, nlevgrnd - use histFileMod, only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp - use decompMod , only : bounds_type - ! - ! !ARGUMENTS: - class(soilbiogeochem_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: k,l,ii,jj - character(10) :: active - character(8) :: vr_suffix - integer :: begc,endc - character(24) :: fieldname - character(100) :: longname - real(r8), pointer :: data1dptr(:) ! temp. pointer for slicing larger arrays - real(r8), pointer :: data2dptr(:,:) ! temp. pointer for slicing larger arrays - !--------------------------------------------------------------------- - - begc = bounds%begc; endc = bounds%endc - - if ( nlevdecomp_full > 1 ) then - this%decomp_npools_vr_col(begc:endc,:,:) = spval - this%decomp_npools_1m_col(begc:endc,:) = spval - end if - this%decomp_npools_col(begc:endc,:) = spval - do l = 1, ndecomp_pools - if ( nlevdecomp_full > 1 ) then - data2dptr => this%decomp_npools_vr_col(:,:,l) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(l))//'N_vr' - longname = trim(decomp_cascade_con%decomp_pool_name_history(l))//' N (vertically resolved)' - call hist_addfld2d (fname=fieldname, units='gN/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - - data1dptr => this%decomp_npools_col(:,l) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(l))//'N' - longname = trim(decomp_cascade_con%decomp_pool_name_history(l))//' N' - call hist_addfld1d (fname=fieldname, units='gN/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - - if ( nlevdecomp_full > 1 ) then - data1dptr => this%decomp_npools_1m_col(:,l) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(l))//'N_1m' - longname = trim(decomp_cascade_con%decomp_pool_name_history(l))//' N to 1 meter' - call hist_addfld1d (fname=fieldname, units='gN/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default = 'inactive') - endif - end do - - - if ( nlevdecomp_full > 1 ) then - - this%sminn_col(begc:endc) = spval - call hist_addfld1d (fname='SMINN', units='gN/m^2', & - avgflag='A', long_name='soil mineral N', & - ptr_col=this%sminn_col, default='inactive') - - this%totlitn_1m_col(begc:endc) = spval - call hist_addfld1d (fname='TOTLITN_1m', units='gN/m^2', & - avgflag='A', long_name='total litter N to 1 meter', & - ptr_col=this%totlitn_1m_col, default='inactive') - - this%totsomn_1m_col(begc:endc) = spval - call hist_addfld1d (fname='TOTSOMN_1m', units='gN/m^2', & - avgflag='A', long_name='total soil organic matter N to 1 meter', & - ptr_col=this%totsomn_1m_col, default='inactive') - endif - - this%ntrunc_col(begc:endc) = spval - call hist_addfld1d (fname='COL_NTRUNC', units='gN/m^2', & - avgflag='A', long_name='column-level sink for N truncation', & - ptr_col=this%ntrunc_col, default='inactive') - - ! add suffix if number of soil decomposition depths is greater than 1 - if (nlevdecomp > 1) then - vr_suffix = "_vr" - else - vr_suffix = "" - endif - - if (use_nitrif_denitrif) then - if ( nlevdecomp_full > 1 ) then - data2dptr => this%smin_no3_vr_col(begc:endc,1:nlevsoi) - call hist_addfld_decomp (fname='SMIN_NO3'//trim(vr_suffix), units='gN/m^3', type2d='levsoi', & - avgflag='A', long_name='soil mineral NO3 (vert. res.)', & - ptr_col=data2dptr, default='inactive') - - data2dptr => this%smin_nh4_vr_col(begc:endc,1:nlevsoi) - call hist_addfld_decomp (fname='SMIN_NH4'//trim(vr_suffix), units='gN/m^3', type2d='levsoi', & - avgflag='A', long_name='soil mineral NH4 (vert. res.)', & - ptr_col=data2dptr, default='inactive') - - data2dptr => this%sminn_vr_col(begc:endc,1:nlevsoi) - call hist_addfld_decomp (fname='SMINN'//trim(vr_suffix), units='gN/m^3', type2d='levsoi', & - avgflag='A', long_name='soil mineral N', & - ptr_col=data2dptr, default='inactive') - - this%smin_no3_col(begc:endc) = spval - call hist_addfld1d (fname='SMIN_NO3', units='gN/m^2', & - avgflag='A', long_name='soil mineral NO3', & - ptr_col=this%smin_no3_col, default='inactive') - - this%smin_nh4_col(begc:endc) = spval - call hist_addfld1d (fname='SMIN_NH4', units='gN/m^2', & - avgflag='A', long_name='soil mineral NH4', & - ptr_col=this%smin_nh4_col, default='inactive') - endif - else - if ( nlevdecomp_full > 1 ) then - data2dptr => this%sminn_vr_col(begc:endc,1:nlevsoi) - call hist_addfld_decomp (fname='SMINN'//trim(vr_suffix), units='gN/m^3', type2d='levsoi', & - avgflag='A', long_name='soil mineral N', & - ptr_col=data2dptr, default='inactive') - end if - - end if - - this%totlitn_col(begc:endc) = spval - call hist_addfld1d (fname='TOTLITN', units='gN/m^2', & - avgflag='A', long_name='total litter N', & - ptr_col=this%totlitn_col, default='inactive') - - this%totsomn_col(begc:endc) = spval - call hist_addfld1d (fname='TOTSOMN', units='gN/m^2', & - avgflag='A', long_name='total soil organic matter N', & - ptr_col=this%totsomn_col, default='inactive') - - this%dyn_nbal_adjustments_col(begc:endc) = spval - call hist_addfld1d (fname='DYN_COL_SOIL_ADJUSTMENTS_N', units='gN/m^2', & - avgflag='SUM', & - long_name='Adjustments in soil nitrogen due to dynamic column areas; & - &only makes sense at the column level: should not be averaged to gridcell', & - ptr_col=this%dyn_nbal_adjustments_col, default='inactive') - - if (use_nitrif_denitrif) then - call hist_addfld1d (fname='DYN_COL_SOIL_ADJUSTMENTS_NO3', units='gN/m^2', & - avgflag='SUM', & - long_name='Adjustments in soil NO3 due to dynamic column areas; & - &only makes sense at the column level: should not be averaged to gridcell', & - ptr_col=this%dyn_no3bal_adjustments_col, default='inactive') - - call hist_addfld1d (fname='DYN_COL_SOIL_ADJUSTMENTS_NH4', units='gN/m^2', & - avgflag='SUM', & - long_name='Adjustments in soil NH4 due to dynamic column areas; & - &only makes sense at the column level: should not be averaged to gridcell', & - ptr_col=this%dyn_nh4bal_adjustments_col, default='inactive') - end if - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds, & - decomp_cpools_vr_col, decomp_cpools_col, decomp_cpools_1m_col) - ! - ! !DESCRIPTION: - ! Initializes time varying variables used only in coupled carbon-nitrogen mode (CN): - ! - ! !USES: - use decompMod , only : bounds_type - ! - ! !ARGUMENTS: - class(soilbiogeochem_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: decomp_cpools_vr_col(bounds%begc:,:,:) - real(r8) , intent(in) :: decomp_cpools_col(bounds%begc:,:) - real(r8) , intent(in) :: decomp_cpools_1m_col(bounds%begc:,:) - ! - ! !LOCAL VARIABLES: - integer :: fc,g,l,c,j,k ! indices - integer :: num_special_col ! number of good values in special_col filter - integer :: special_col (bounds%endc-bounds%begc+1) ! special landunit filter - columns - !------------------------------------------------------------------------ - - SHR_ASSERT_ALL((ubound(decomp_cpools_col) == (/bounds%endc,ndecomp_pools/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(decomp_cpools_1m_col) == (/bounds%endc,ndecomp_pools/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(decomp_cpools_vr_col) == (/bounds%endc,nlevdecomp_full,ndecomp_pools/)), errMsg(sourcefile, __LINE__)) - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - - ! column nitrogen state variables - this%ntrunc_col(c) = 0._r8 - this%sminn_col(c) = 0._r8 - do j = 1, nlevdecomp - do k = 1, ndecomp_pools - this%decomp_npools_vr_col(c,j,k) = decomp_cpools_vr_col(c,j,k) / decomp_cascade_con%initial_cn_ratio(k) - end do - this%sminn_vr_col(c,j) = 0._r8 - this%ntrunc_vr_col(c,j) = 0._r8 - end do - if ( nlevdecomp > 1 ) then - do j = nlevdecomp+1, nlevdecomp_full - do k = 1, ndecomp_pools - this%decomp_npools_vr_col(c,j,k) = 0._r8 - end do - this%sminn_vr_col(c,j) = 0._r8 - this%ntrunc_vr_col(c,j) = 0._r8 - end do - end if - do k = 1, ndecomp_pools - this%decomp_npools_col(c,k) = decomp_cpools_col(c,k) / decomp_cascade_con%initial_cn_ratio(k) - this%decomp_npools_1m_col(c,k) = decomp_cpools_1m_col(c,k) / decomp_cascade_con%initial_cn_ratio(k) - end do - - if (use_nitrif_denitrif) then - do j = 1, nlevdecomp_full - this%smin_nh4_vr_col(c,j) = 0._r8 - this%smin_no3_vr_col(c,j) = 0._r8 - end do - this%smin_nh4_col(c) = 0._r8 - this%smin_no3_col(c) = 0._r8 - end if - this%totlitn_col(c) = 0._r8 - this%totsomn_col(c) = 0._r8 - this%totlitn_1m_col(c) = 0._r8 - this%totsomn_1m_col(c) = 0._r8 - this%cwdn_col(c) = 0._r8 - - end if - end do - - ! initialize fields for special filters - - num_special_col = 0 - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - num_special_col = num_special_col + 1 - special_col(num_special_col) = c - end if - end do - - call this%SetValues (num_column=num_special_col, filter_column=special_col, value_column=0._r8) - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart ( this, bounds, ncid, flag, totvegc_col ) - ! - ! !DESCRIPTION: - ! Read/write CN restart data for nitrogen state - ! - ! !USES: - use shr_infnan_mod , only : isnan => shr_infnan_isnan, nan => shr_infnan_nan, assignment(=) - use clm_time_manager , only : is_restart, get_nstep - use restUtilMod - use ncdio_pio - ! - ! !ARGUMENTS: - class (soilbiogeochem_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid - character(len=*) , intent(in) :: flag !'read' or 'write' or 'define' - real(r8) , intent(in) :: totvegc_col(bounds%begc:bounds%endc) ! (gC/m2) total vegetation carbon - - ! - ! !LOCAL VARIABLES: - integer :: i,j,k,l,c - logical :: readvar - integer :: idata - logical :: exit_spinup = .false. - logical :: enter_spinup = .false. - real(r8) :: m ! multiplier for the exit_spinup code - real(r8), pointer :: ptr2d(:,:) ! temp. pointers for slicing larger arrays - real(r8), pointer :: ptr1d(:) ! temp. pointers for slicing larger arrays - character(len=128) :: varname ! temporary - integer :: itemp ! temporary - integer , pointer :: iptemp(:) ! pointer to memory to be allocated - ! spinup state as read from restart file, for determining whether to enter or exit spinup mode. - integer :: restart_file_spinup_state - ! flags for comparing the model and restart decomposition cascades - integer :: decomp_cascade_state, restart_file_decomp_cascade_state - !------------------------------------------------------------------------ - - ! sminn - if (use_vertsoilc) then - ptr2d => this%sminn_vr_col - call restartvar(ncid=ncid, flag=flag, varname="sminn_vr", xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%sminn_vr_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname="sminn", xtype=ncd_double, & - dim1name='column', & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - call endrun(msg='ERROR::'//trim(varname)//' is required on an initialization dataset'//& - errMsg(sourcefile, __LINE__)) - end if - - ! decomposing N pools - do k = 1, ndecomp_pools - varname=trim(decomp_cascade_con%decomp_pool_name_restart(k))//'n' - if (use_vertsoilc) then - ptr2d => this%decomp_npools_vr_col(:,:,k) - call restartvar(ncid=ncid, flag=flag, varname=trim(varname)//"_vr", xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%decomp_npools_vr_col(:,1,k) - call restartvar(ncid=ncid, flag=flag, varname=varname, xtype=ncd_double, & - dim1name='column', & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - call endrun(msg='ERROR:: '//trim(varname)//' is required on an initialization dataset'//& - errMsg(sourcefile, __LINE__)) - end if - end do - - if (use_vertsoilc) then - ptr2d => this%ntrunc_vr_col - call restartvar(ncid=ncid, flag=flag, varname="col_ntrunc_vr", xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%ntrunc_vr_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname="col_ntrunc", xtype=ncd_double, & - dim1name='column', & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - - if (use_nitrif_denitrif) then - ! smin_no3_vr - if (use_vertsoilc) then - ptr2d => this%smin_no3_vr_col(:,:) - call restartvar(ncid=ncid, flag=flag, varname='smin_no3_vr', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%smin_no3_vr_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname='smin_no3', xtype=ncd_double, & - dim1name='column', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - call endrun(msg= 'ERROR:: smin_no3_vr'//' is required on an initialization dataset' ) - end if - end if - - if (use_nitrif_denitrif) then - ! smin_nh4 - if (use_vertsoilc) then - ptr2d => this%smin_nh4_vr_col(:,:) - call restartvar(ncid=ncid, flag=flag, varname='smin_nh4_vr', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%smin_nh4_vr_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname='smin_nh4', xtype=ncd_double, & - dim1name='column', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - call endrun(msg= 'ERROR:: smin_nh4_vr'//' is required on an initialization dataset' ) - end if - end if - - ! decomp_cascade_state - the purpose of this is to check to make sure the bgc used - ! matches what the restart file was generated with. - ! add info about the SOM decomposition cascade - - if (use_century_decomp) then - decomp_cascade_state = 1 - else - decomp_cascade_state = 0 - end if - ! add info about the nitrification / denitrification state - if (use_nitrif_denitrif) then - decomp_cascade_state = decomp_cascade_state + 10 - end if - if (flag == 'write') itemp = decomp_cascade_state - call restartvar(ncid=ncid, flag=flag, varname='decomp_cascade_state', xtype=ncd_int, & - long_name='BGC of the model that wrote this restart file:' & - // ' 1s column: 0 = CLM-CN cascade, 1 = Century cascade;' & - // ' 10s column: 0 = CLM-CN denitrification, 10 = Century denitrification', units='', & - interpinic_flag='skip', readvar=readvar, data=itemp) - if (flag=='read') then - if (.not. readvar) then - ! assume, for sake of backwards compatibility, that if decomp_cascade_state - ! is not in the restart file, then the current model state is the same as - ! the prior model state - restart_file_decomp_cascade_state = decomp_cascade_state - if ( masterproc ) write(iulog,*) ' CNRest: WARNING! Restart file does not ' & - // ' contain info on decomp_cascade_state used to generate the restart file. ' - if ( masterproc ) write(iulog,*) ' Assuming the same as current setting: ', decomp_cascade_state - else - restart_file_decomp_cascade_state = itemp - if (decomp_cascade_state /= restart_file_decomp_cascade_state ) then - if ( masterproc ) then - write(iulog,*) 'CNRest: ERROR--the decomposition cascade differs between the current ' & - // ' model state and the model that wrote the restart file. ' - write(iulog,*) 'The model will be horribly out of equilibrium until after a lengthy spinup. ' - write(iulog,*) 'Stopping here since this is probably an error in configuring the run. ' - write(iulog,*) 'If you really wish to proceed, then override by setting ' - write(iulog,*) 'override_bgc_restart_mismatch_dump to .true. in the namelist' - if ( .not. override_bgc_restart_mismatch_dump ) then - call endrun(msg= ' CNRest: Stopping. Decomposition cascade mismatch error.'//& - errMsg(sourcefile, __LINE__)) - endif - endif - endif - end if - end if - - !-------------------------------- - ! Spinup state - !-------------------------------- - - ! Do nothing for write - ! Note that the call to write spinup_state out was done in soilbiogeochem_carbonstate_inst and - ! cannot be called again because it will try to define the variable twice - ! when the flag below is set to define - if (flag == 'read') then - call restartvar(ncid=ncid, flag=flag, varname='spinup_state', xtype=ncd_int, & - long_name='Spinup state of the model that wrote this restart file: ' & - // ' 0 = normal model mode, 1 = AD spinup', units='', & - interpinic_flag='copy', readvar=readvar, data=idata) - if (readvar) then - restart_file_spinup_state = idata - else - ! assume, for sake of backwards compatibility, that if spinup_state is not in - ! the restart file then current model state is the same as prior model state - restart_file_spinup_state = spinup_state - if ( masterproc ) then - write(iulog,*) ' WARNING! Restart file does not contain info ' & - // ' on spinup state used to generate the restart file. ' - write(iulog,*) ' Assuming the same as current setting: ', spinup_state - end if - end if - end if - - ! now compare the model and restart file spinup states, and either take the - ! model into spinup mode or out of it if they are not identical - ! taking model out of spinup mode requires multiplying each decomposing pool - ! by the associated AD factor. - ! putting model into spinup mode requires dividing each decomposing pool - ! by the associated AD factor. - ! only allow this to occur on first timestep of model run. - - if (flag == 'read' .and. spinup_state /= restart_file_spinup_state ) then - if (spinup_state == 0 .and. restart_file_spinup_state >= 1 ) then - if ( masterproc ) write(iulog,*) ' NitrogenStateType Restart: taking SOM pools out of AD spinup mode' - exit_spinup = .true. - else if (spinup_state >= 1 .and. restart_file_spinup_state == 0 ) then - if ( masterproc ) write(iulog,*) ' NitrogenStateType Restart: taking SOM pools into AD spinup mode' - enter_spinup = .true. - else - call endrun(msg=' Error in entering/exiting spinup. spinup_state ' & - // ' != restart_file_spinup_state, but do not know what to do'//& - errMsg(sourcefile, __LINE__)) - end if - if (get_nstep() >= 2) then - call endrun(msg=' Error in entering/exiting spinup - should occur only when nstep = 1'//& - errMsg(sourcefile, __LINE__)) - endif - if ( exit_spinup .and. isnan(this%totvegcthresh) )then - call endrun(msg=' Error in exit spinup - totvegcthresh was not set with SetTotVgCThresh'//& - errMsg(sourcefile, __LINE__)) - end if - do k = 1, ndecomp_pools - if ( exit_spinup ) then - m = decomp_cascade_con%spinup_factor(k) - else if ( enter_spinup ) then - m = 1. / decomp_cascade_con%spinup_factor(k) - end if - do c = bounds%begc, bounds%endc - l = col%landunit(c) - do j = 1, nlevdecomp - if ( abs(m - 1._r8) .gt. 0.000001_r8 .and. exit_spinup) then - this%decomp_npools_vr_col(c,j,k) = this%decomp_npools_vr_col(c,j,k) * m * & - get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) - ! If there is no vegetation nitrogen, - ! implying that all vegetation has - ! died, then - ! reset decomp pools to near zero during exit_spinup to - ! avoid very - ! large and inert soil carbon stocks; note that only - ! pools with spinup factor > 1 - ! will be affected, which means that total SOMN and LITN - ! pools will not be set to 0. - if (totvegc_col(c) <= this%totvegcthresh .and. lun%itype(l) /= istcrop) then - this%decomp_npools_vr_col(c,j,k) = 0._r8 - endif - elseif ( abs(m - 1._r8) .gt. 0.000001_r8 .and. enter_spinup) then - this%decomp_npools_vr_col(c,j,k) = this%decomp_npools_vr_col(c,j,k) * m / & - get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) - else - this%decomp_npools_vr_col(c,j,k) = this%decomp_npools_vr_col(c,j,k) * m - endif - end do - end do - end do - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine SetValues ( this, num_column, filter_column, value_column ) - ! - ! !DESCRIPTION: - ! Set nitrogen state variables - ! - ! !ARGUMENTS: - class (soilbiogeochem_nitrogenstate_type) :: this - integer , intent(in) :: num_column - integer , intent(in) :: filter_column(:) - real(r8), intent(in) :: value_column - ! - ! !LOCAL VARIABLES: - integer :: fi,i ! loop index - integer :: j,k ! indices - !------------------------------------------------------------------------ - - do fi = 1,num_column - i = filter_column(fi) - - this%sminn_col(i) = value_column - this%ntrunc_col(i) = value_column - this%cwdn_col(i) = value_column - if (use_nitrif_denitrif) then - this%smin_no3_col(i) = value_column - this%smin_nh4_col(i) = value_column - end if - this%totlitn_col(i) = value_column - this%totsomn_col(i) = value_column - this%totsomn_1m_col(i) = value_column - this%totlitn_1m_col(i) = value_column - end do - - do j = 1,nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%sminn_vr_col(i,j) = value_column - this%ntrunc_vr_col(i,j) = value_column - if (use_nitrif_denitrif) then - this%smin_no3_vr_col(i,j) = value_column - this%smin_nh4_vr_col(i,j) = value_column - end if - end do - end do - - ! column and decomp_pools - do k = 1, ndecomp_pools - do fi = 1,num_column - i = filter_column(fi) - this%decomp_npools_col(i,k) = value_column - this%decomp_npools_1m_col(i,k) = value_column - end do - end do - - ! column levdecomp, and decomp_pools - do j = 1,nlevdecomp_full - do k = 1, ndecomp_pools - do fi = 1,num_column - i = filter_column(fi) - this%decomp_npools_vr_col(i,j,k) = value_column - end do - end do - end do - - end subroutine SetValues - -end module SoilBiogeochemNitrogenStateType diff --git a/src/soilbiogeochem/SoilBiogeochemPotentialMod.F90 b/src/soilbiogeochem/SoilBiogeochemPotentialMod.F90 deleted file mode 100644 index 2349a63fd4..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemPotentialMod.F90 +++ /dev/null @@ -1,266 +0,0 @@ -module SoilBiogeochemPotentialMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculate potential decomp rates and total immobilization demand. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use clm_varpar , only : nlevdecomp, ndecomp_cascade_transitions, ndecomp_pools - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use clm_varctl , only : use_fates, iulog - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: readParams - public :: SoilBiogeochemPotential - ! - type, private :: params_type - real(r8) :: dnp !denitrification proportion - end type Params_type - ! - type(params_type), private :: params_inst - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !DESCRIPTION: - ! Read parameters - ! - ! !USES: - use ncdio_pio , only: file_desc_t,ncd_io - use abortutils , only: endrun - use shr_log_mod , only: errMsg => shr_log_errMsg - ! - ! !ARGUMENTS: - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNDecompParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - tString='dnp' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%dnp=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemPotential (bounds, num_soilc, filter_soilc, & - soilbiogeochem_state_inst, soilbiogeochem_carbonstate_inst, soilbiogeochem_carbonflux_inst, & - soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst, & - cn_decomp_pools, p_decomp_cpool_loss, pmnf_decomp_cascade) - ! - ! !USES: - use shr_log_mod, only : errMsg => shr_log_errMsg - ! - ! !ARGUMENT: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(soilbiogeochem_state_type) , intent(inout) :: soilbiogeochem_state_inst - type(soilbiogeochem_carbonstate_type) , intent(in) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - real(r8) , intent(out) :: cn_decomp_pools(bounds%begc:,1:,1:) ! c:n ratios of applicable pools - real(r8) , intent(out) :: p_decomp_cpool_loss(bounds%begc:,1:,1:) ! potential C loss from one pool to another - real(r8) , intent(out) :: pmnf_decomp_cascade(bounds%begc:,1:,1:) ! potential mineral N flux, from one pool to another - ! - ! !LOCAL VARIABLES: - integer :: c,j,k,l,m !indices - integer :: fc !filter column index - integer :: begc,endc !bounds - real(r8):: immob(bounds%begc:bounds%endc,1:nlevdecomp) !potential N immobilization - real(r8):: ratio !temporary variable - integer, parameter :: i_atm = 0 !TODO - this appears in two places - move it to 1 - !----------------------------------------------------------------------- - - begc = bounds%begc; endc = bounds%endc - - SHR_ASSERT_ALL((ubound(cn_decomp_pools) == (/endc,nlevdecomp,ndecomp_pools/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(p_decomp_cpool_loss) == (/endc,nlevdecomp,ndecomp_cascade_transitions/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(pmnf_decomp_cascade) == (/endc,nlevdecomp,ndecomp_cascade_transitions/)) , errMsg(sourcefile, __LINE__)) - - associate( & - cascade_donor_pool => decomp_cascade_con%cascade_donor_pool , & ! Input: [integer (:) ] which pool is C taken from for a given decomposition step - cascade_receiver_pool => decomp_cascade_con%cascade_receiver_pool , & ! Input: [integer (:) ] which pool is C added to for a given decomposition step - floating_cn_ratio_decomp_pools => decomp_cascade_con%floating_cn_ratio_decomp_pools , & ! Input: [logical (:) ] TRUE => pool has fixed C:N ratio - initial_cn_ratio => decomp_cascade_con%initial_cn_ratio , & ! Input: [real(r8) (:) ] c:n ratio for initialization of pools - - fpi_vr => soilbiogeochem_state_inst%fpi_vr_col , & ! Input: [real(r8) (:,:) ] fraction of potential immobilization (no units) - rf_decomp_cascade => soilbiogeochem_state_inst%rf_decomp_cascade_col , & ! Input: [real(r8) (:,:,:) ] respired fraction in decomposition step (frac) - pathfrac_decomp_cascade => soilbiogeochem_state_inst%pathfrac_decomp_cascade_col , & ! Input: [real(r8) (:,:,:) ] what fraction of C leaving a given pool passes through a given transition (frac) - - decomp_npools_vr => soilbiogeochem_nitrogenstate_inst%decomp_npools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) vertically-resolved decomposing (litter, cwd, soil) N pools - - decomp_cpools_vr => soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) vertically-resolved decomposing (litter, cwd, soil) c pools - - decomp_cascade_ntransfer_vr => soilbiogeochem_nitrogenflux_inst%decomp_cascade_ntransfer_vr_col , & ! Output: [real(r8) (:,:,:) ] vert-res transfer of N from donor to receiver pool along decomp. cascade (gN/m3/s) - decomp_cascade_sminn_flux_vr => soilbiogeochem_nitrogenflux_inst%decomp_cascade_sminn_flux_vr_col , & ! Output: [real(r8) (:,:,:) ] vert-res mineral N flux for transition along decomposition cascade (gN/m3/s) - potential_immob_vr => soilbiogeochem_nitrogenflux_inst%potential_immob_vr_col , & ! Output: [real(r8) (:,:) ] - sminn_to_denit_decomp_cascade_vr => soilbiogeochem_nitrogenflux_inst%sminn_to_denit_decomp_cascade_vr_col , & ! Output: [real(r8) (:,:,:) ] - gross_nmin_vr => soilbiogeochem_nitrogenflux_inst%gross_nmin_vr_col , & ! Output: [real(r8) (:,:) ] - net_nmin_vr => soilbiogeochem_nitrogenflux_inst%net_nmin_vr_col , & ! Output: [real(r8) (:,:) ] - gross_nmin => soilbiogeochem_nitrogenflux_inst%gross_nmin_col , & ! Output: [real(r8) (:) ] gross rate of N mineralization (gN/m2/s) - net_nmin => soilbiogeochem_nitrogenflux_inst%net_nmin_col , & ! Output: [real(r8) (:) ] net rate of N mineralization (gN/m2/s) - - w_scalar => soilbiogeochem_carbonflux_inst%w_scalar_col , & ! Input: [real(r8) (:,:) ] fraction by which decomposition is limited by moisture availability - decomp_cascade_hr_vr => soilbiogeochem_carbonflux_inst%decomp_cascade_hr_vr_col , & ! Output: [real(r8) (:,:,:) ] vertically-resolved het. resp. from decomposing C pools (gC/m3/s) - decomp_cascade_ctransfer_vr => soilbiogeochem_carbonflux_inst%decomp_cascade_ctransfer_vr_col , & ! Output: [real(r8) (:,:,:) ] vertically-resolved het. resp. from decomposing C pools (gC/m3/s) - decomp_k => soilbiogeochem_carbonflux_inst%decomp_k_col , & ! Output: [real(r8) (:,:,:) ] rate constant for decomposition (1./sec) - phr_vr => soilbiogeochem_carbonflux_inst%phr_vr_col , & ! Output: [real(r8) (:,:) ] potential HR (gC/m3/s) - fphr => soilbiogeochem_carbonflux_inst%fphr_col & ! Output: [real(r8) (:,:) ] fraction of potential SOM + LITTER heterotrophic - ) - - if ( .not. use_fates ) then - ! set initial values for potential C and N fluxes - p_decomp_cpool_loss(begc:endc, :, :) = 0._r8 - pmnf_decomp_cascade(begc:endc, :, :) = 0._r8 - - ! column loop to calculate potential decomp rates and total immobilization demand - - !! calculate c:n ratios of applicable pools - do l = 1, ndecomp_pools - if ( floating_cn_ratio_decomp_pools(l) ) then - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - if ( decomp_npools_vr(c,j,l) > 0._r8 ) then - cn_decomp_pools(c,j,l) = decomp_cpools_vr(c,j,l) / decomp_npools_vr(c,j,l) - end if - end do - end do - else - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - cn_decomp_pools(c,j,l) = initial_cn_ratio(l) - end do - end do - end if - end do - - ! calculate the non-nitrogen-limited fluxes - ! these fluxes include the "/ dt" term to put them on a - ! per second basis, since the rate constants have been - ! calculated on a per timestep basis. - - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (decomp_cpools_vr(c,j,cascade_donor_pool(k)) > 0._r8 .and. & - decomp_k(c,j,cascade_donor_pool(k)) > 0._r8 ) then - p_decomp_cpool_loss(c,j,k) = decomp_cpools_vr(c,j,cascade_donor_pool(k)) & - * decomp_k(c,j,cascade_donor_pool(k)) * pathfrac_decomp_cascade(c,j,k) - if ( .not. floating_cn_ratio_decomp_pools(cascade_receiver_pool(k)) ) then !! not transition of cwd to litter - - if (cascade_receiver_pool(k) /= i_atm ) then ! not 100% respiration - ratio = 0._r8 - - if (decomp_npools_vr(c,j,cascade_donor_pool(k)) > 0._r8) then - ratio = cn_decomp_pools(c,j,cascade_receiver_pool(k))/cn_decomp_pools(c,j,cascade_donor_pool(k)) - endif - - pmnf_decomp_cascade(c,j,k) = (p_decomp_cpool_loss(c,j,k) * (1.0_r8 - rf_decomp_cascade(c,j,k) - ratio) & - / cn_decomp_pools(c,j,cascade_receiver_pool(k)) ) - - else ! 100% respiration - pmnf_decomp_cascade(c,j,k) = - p_decomp_cpool_loss(c,j,k) / cn_decomp_pools(c,j,cascade_donor_pool(k)) - endif - - else ! CWD -> litter - pmnf_decomp_cascade(c,j,k) = 0._r8 - end if - end if - end do - - end do - end do - - ! Sum up all the potential immobilization fluxes (positive pmnf flux) - ! and all the mineralization fluxes (negative pmnf flux) - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - immob(c,j) = 0._r8 - end do - end do - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pmnf_decomp_cascade(c,j,k) > 0._r8) then - immob(c,j) = immob(c,j) + pmnf_decomp_cascade(c,j,k) - else - gross_nmin_vr(c,j) = gross_nmin_vr(c,j) - pmnf_decomp_cascade(c,j,k) - end if - end do - end do - end do - - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - potential_immob_vr(c,j) = immob(c,j) - end do - end do - else ! use_fates - ! As a first step we are making this a C-only model, so no N downregulation of fluxes. - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - ! - p_decomp_cpool_loss(c,j,k) = decomp_cpools_vr(c,j,cascade_donor_pool(k)) & - * decomp_k(c,j,cascade_donor_pool(k)) * pathfrac_decomp_cascade(c,j,k) - ! - end do - end do - end do - end if - - ! Add up potential hr for methane calculations - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - phr_vr(c,j) = 0._r8 - end do - end do - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - phr_vr(c,j) = phr_vr(c,j) + rf_decomp_cascade(c,j,k) * p_decomp_cpool_loss(c,j,k) - end do - end do - end do - - end associate - - end subroutine SoilBiogeochemPotential - -end module SoilBiogeochemPotentialMod diff --git a/src/soilbiogeochem/SoilBiogeochemPrecisionControlMod.F90 b/src/soilbiogeochem/SoilBiogeochemPrecisionControlMod.F90 deleted file mode 100644 index c50bbd49ef..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemPrecisionControlMod.F90 +++ /dev/null @@ -1,173 +0,0 @@ -module SoilBiogeochemPrecisionControlMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! controls on very low values in critical state variables - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varpar , only : ndecomp_pools - use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use ColumnType , only : col - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public:: SoilBiogeochemPrecisionControlInit ! Initialization - public:: SoilBiogeochemPrecisionControl ! Apply precision control to soil biogeochemistry carbon and nitrogen states - - ! !PUBLIC DATA: - real(r8), public :: ccrit ! critical carbon state value for truncation (gC/m2) - real(r8), public :: ncrit ! critical nitrogen state value for truncation (gN/m2) - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemPrecisionControlInit( soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonstate_inst, soilbiogeochem_nitrogenstate_inst) - - ! - ! !DESCRIPTION: - ! Initialization of soil biogeochemistry precision control - ! - ! !USES: - ! - ! !ARGUMENTS: - type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c13_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c14_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - real(r8), parameter :: totvegcthresh = 0.1_r8 ! Total vegetation carbon threshold to zero out decomposition pools - !----------------------------------------------------------------------- - ccrit = 1.e-8_r8 ! critical carbon state value for truncation (gC/m2) - ncrit = 1.e-8_r8 ! critical nitrogen state value for truncation (gN/m2) - - !call soilbiogeochem_carbonstate_inst%setTotVgCThresh( totvegcthresh ) - !call soilbiogeochem_nitrogenstate_inst%setTotVgCThresh( totvegcthresh ) - - end subroutine SoilBiogeochemPrecisionControlInit - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemPrecisionControl(num_soilc, filter_soilc, & - soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonstate_inst, soilbiogeochem_nitrogenstate_inst) - - ! - ! !DESCRIPTION: - ! On the radiation time step, force leaf and deadstem c and n to 0 if - ! they get too small. - ! - ! !USES: - use clm_varctl , only : iulog, use_nitrif_denitrif, use_cn - use clm_varpar , only : nlevdecomp - use CNSharedParamsMod, only: use_fun - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c13_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c14_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c,j,k ! indices - integer :: fc ! filter indices - real(r8):: cc,cn ! truncation terms for column-level corrections - real(r8):: cc13 ! truncation terms for column-level corrections - real(r8):: cc14 ! truncation terms for column-level corrections - !----------------------------------------------------------------------- - - ! soilbiogeochem_carbonstate_inst%ctrunc_vr_col Output: [real(r8) (:,:) ] (gC/m3) column-level sink for C truncation - ! soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col Output: [real(r8) (:,:,:) ] (gC/m3) vertically-resolved decomposing (litter, cwd, soil) c pools - - ! soilbiogeochem_nitrogenstate_inst%ntrunc_vr_col Output: [real(r8) (:,:) ] (gN/m3) column-level sink for N truncation - ! soilbiogeochem_nitrogenstate_inst%decomp_npools_vr_col Output: [real(r8) (:,:,:) ] (gC/m3) vertically-resolved decomposing (litter, cwd, soil) N pools - ! soilbiogeochem_nitrogenstate_inst%smin_nh4_vr_col Output: [real(r8) (:,:) ] (gN/m3) soil mineral NH4 - ! soilbiogeochem_nitrogenstate_inst%smin_no3_vr_col Output: [real(r8) (:,:) ] (gN/m3) soil mineral NO3 - - associate(& - cs => soilbiogeochem_carbonstate_inst , & - ns => soilbiogeochem_nitrogenstate_inst , & - c13cs => c13_soilbiogeochem_carbonstate_inst , & - c14cs => c14_soilbiogeochem_carbonstate_inst & - ) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - do j = 1,nlevdecomp - ! initialize the column-level C and N truncation terms - cc = 0._r8 - cn = 0._r8 - - ! do tests on state variables for precision control - ! for linked C-N state variables, perform precision test on - ! the C component, but truncate both C and N components - - - ! all decomposing pools C and N - do k = 1, ndecomp_pools - - if (abs(cs%decomp_cpools_vr_col(c,j,k)) < ccrit) then - cc = cc + cs%decomp_cpools_vr_col(c,j,k) - cs%decomp_cpools_vr_col(c,j,k) = 0._r8 - - if (use_cn) then - cn = cn + ns%decomp_npools_vr_col(c,j,k) - ns%decomp_npools_vr_col(c,j,k) = 0._r8 - endif - - end if - - end do - - ! not doing precision control on soil mineral N, since it will - ! be getting the N truncation flux anyway. - - cs%ctrunc_vr_col(c,j) = cs%ctrunc_vr_col(c,j) + cc - - if (use_cn) then - ns%ntrunc_vr_col(c,j) = ns%ntrunc_vr_col(c,j) + cn - endif - end do - - end do ! end of column loop - - if(.not.use_fun)then - if (use_nitrif_denitrif) then - ! remove small negative perturbations for stability purposes, if any should arise. - - do fc = 1,num_soilc - c = filter_soilc(fc) - do j = 1,nlevdecomp - if (abs(ns%smin_no3_vr_col(c,j)) < ncrit/1e4_r8) then - if ( ns%smin_no3_vr_col(c,j) < 0._r8 ) then - !write(iulog, *) '-10^-12 < smin_no3 < 0. resetting to zero.' - !write(iulog, *) 'smin_no3_vr_col(c,j), c, j: ', ns%smin_no3_vr_col(c,j), c, j - ns%smin_no3_vr_col(c,j) = 0._r8 - endif - end if - if (abs(ns%smin_nh4_vr_col(c,j)) < ncrit/1e4_r8) then - if ( ns%smin_nh4_vr_col(c,j) < 0._r8 ) then - !write(iulog, *) '-10^-12 < smin_nh4 < 0. resetting to zero.' - !write(iulog, *) 'smin_nh4_vr_col(c,j), c, j: ', ns%smin_nh4_vr_col(c,j), c, j - ns%smin_nh4_vr_col(c,j) = 0._r8 - endif - end if - end do - end do - endif - endif - - end associate - - end subroutine SoilBiogeochemPrecisionControl - -end module SoilBiogeochemPrecisionControlMod diff --git a/src/soilbiogeochem/SoilBiogeochemStateType.F90 b/src/soilbiogeochem/SoilBiogeochemStateType.F90 deleted file mode 100644 index 46586ef393..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemStateType.F90 +++ /dev/null @@ -1,336 +0,0 @@ -module SoilBiogeochemStateType - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use abortutils , only : endrun - use spmdMod , only : masterproc - use clm_varpar , only : nlevsno, nlevgrnd, nlevlak, nlevsoifl, nlevsoi - use clm_varpar , only : ndecomp_cascade_transitions, nlevdecomp, nlevdecomp_full - use clm_varcon , only : spval, ispval, c14ratio, grlnd - use landunit_varcon, only : istsoil, istcrop - use clm_varpar , only : nlevsno, nlevgrnd, nlevlak - use clm_varctl , only : use_vertsoilc, use_cn - use clm_varctl , only : iulog - use LandunitType , only : lun - use ColumnType , only : col - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: get_spinup_latitude_term - ! - ! !PUBLIC TYPES: - type, public :: soilbiogeochem_state_type - - real(r8) , pointer :: leaf_prof_patch (:,:) ! (1/m) profile of leaves (vertical profiles for calculating fluxes) - real(r8) , pointer :: froot_prof_patch (:,:) ! (1/m) profile of fine roots (vertical profiles for calculating fluxes) - real(r8) , pointer :: croot_prof_patch (:,:) ! (1/m) profile of coarse roots (vertical profiles for calculating fluxes) - real(r8) , pointer :: stem_prof_patch (:,:) ! (1/m) profile of stems (vertical profiles for calculating fluxes) - real(r8) , pointer :: fpi_vr_col (:,:) ! (no units) fraction of potential immobilization - real(r8) , pointer :: fpi_col (:) ! (no units) fraction of potential immobilization - real(r8), pointer :: fpg_col (:) ! (no units) fraction of potential gpp - real(r8) , pointer :: rf_decomp_cascade_col (:,:,:) ! (frac) respired fraction in decomposition step - real(r8) , pointer :: pathfrac_decomp_cascade_col (:,:,:) ! (frac) what fraction of C leaving a given pool passes through a given transition - real(r8) , pointer :: nfixation_prof_col (:,:) ! (1/m) profile for N fixation additions - real(r8) , pointer :: ndep_prof_col (:,:) ! (1/m) profile for N fixation additions - real(r8) , pointer :: som_adv_coef_col (:,:) ! (m2/s) SOM advective flux - real(r8) , pointer :: som_diffus_coef_col (:,:) ! (m2/s) SOM diffusivity due to bio/cryo-turbation - real(r8) , pointer :: plant_ndemand_col (:) ! column-level plant N demand - - contains - - procedure, public :: Init - procedure, public :: Restart - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - end type soilbiogeochem_state_type - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(soilbiogeochem_state_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate ( bounds ) - if (use_cn) then - call this%InitHistory ( bounds ) - end if - call this%InitCold ( bounds ) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(soilbiogeochem_state_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - allocate(this%leaf_prof_patch (begp:endp,1:nlevdecomp_full)) ; this%leaf_prof_patch (:,:) = spval - allocate(this%froot_prof_patch (begp:endp,1:nlevdecomp_full)) ; this%froot_prof_patch (:,:) = spval - allocate(this%croot_prof_patch (begp:endp,1:nlevdecomp_full)) ; this%croot_prof_patch (:,:) = spval - allocate(this%stem_prof_patch (begp:endp,1:nlevdecomp_full)) ; this%stem_prof_patch (:,:) = spval - allocate(this%fpi_vr_col (begc:endc,1:nlevdecomp_full)) ; this%fpi_vr_col (:,:) = nan - allocate(this%fpi_col (begc:endc)) ; this%fpi_col (:) = nan - allocate(this%fpg_col (begc:endc)) ; this%fpg_col (:) = nan - allocate(this%nfixation_prof_col (begc:endc,1:nlevdecomp_full)) ; this%nfixation_prof_col (:,:) = spval - allocate(this%ndep_prof_col (begc:endc,1:nlevdecomp_full)) ; this%ndep_prof_col (:,:) = spval - allocate(this%som_adv_coef_col (begc:endc,1:nlevdecomp_full)) ; this%som_adv_coef_col (:,:) = spval - allocate(this%som_diffus_coef_col (begc:endc,1:nlevdecomp_full)) ; this%som_diffus_coef_col (:,:) = spval - allocate(this%plant_ndemand_col (begc:endc)) ; this%plant_ndemand_col (:) = nan - - allocate(this%rf_decomp_cascade_col(begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions)); - this%rf_decomp_cascade_col(:,:,:) = nan - - allocate(this%pathfrac_decomp_cascade_col(begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions)); - this%pathfrac_decomp_cascade_col(:,:,:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use histFileMod , only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp, no_snow_normal - use CNSharedParamsMod , only : use_fun - ! - ! !ARGUMENTS: - class(soilbiogeochem_state_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - character(8) :: vr_suffix - character(10) :: active - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - this%croot_prof_patch(begp:endp,:) = spval - call hist_addfld_decomp (fname='CROOT_PROF', units='1/m', type2d='levdcmp', & - avgflag='A', long_name='profile for litter C and N inputs from coarse roots', & - ptr_patch=this%croot_prof_patch, default='inactive') - - this%froot_prof_patch(begp:endp,:) = spval - call hist_addfld_decomp (fname='FROOT_PROF', units='1/m', type2d='levdcmp', & - avgflag='A', long_name='profile for litter C and N inputs from fine roots', & - ptr_patch=this%froot_prof_patch, default='inactive') - - this%leaf_prof_patch(begp:endp,:) = spval - call hist_addfld_decomp (fname='LEAF_PROF', units='1/m', type2d='levdcmp', & - avgflag='A', long_name='profile for litter C and N inputs from leaves', & - ptr_patch=this%leaf_prof_patch, default='inactive') - - this%stem_prof_patch(begp:endp,:) = spval - call hist_addfld_decomp (fname='STEM_PROF', units='1/m', type2d='levdcmp', & - avgflag='A', long_name='profile for litter C and N inputs from stems', & - ptr_patch=this%stem_prof_patch, default='inactive') - - this%nfixation_prof_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='NFIXATION_PROF', units='1/m', type2d='levdcmp', & - avgflag='A', long_name='profile for biological N fixation', & - ptr_col=this%nfixation_prof_col, default='inactive') - - this%ndep_prof_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='NDEP_PROF', units='1/m', type2d='levdcmp', & - avgflag='A', long_name='profile for atmospheric N deposition', & - ptr_col=this%ndep_prof_col, default='inactive') - - this%som_adv_coef_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SOM_ADV_COEF', units='m/s', type2d='levdcmp', & - avgflag='A', long_name='advection term for vertical SOM translocation', & - ptr_col=this%som_adv_coef_col, default='inactive') - - this%som_diffus_coef_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SOM_DIFFUS_COEF', units='m^2/s', type2d='levdcmp', & - avgflag='A', long_name='diffusion coefficient for vertical SOM translocation', & - ptr_col=this%som_diffus_coef_col, default='inactive') - - if ( nlevdecomp_full > 1 ) then - this%fpi_col(begc:endc) = spval - call hist_addfld1d (fname='FPI', units='proportion', & - avgflag='A', long_name='fraction of potential immobilization', & - ptr_col=this%fpi_col, default='inactive') - endif - - if (.not. use_fun) then - this%fpg_col(begc:endc) = spval - call hist_addfld1d (fname='FPG', units='proportion', & - avgflag='A', long_name='fraction of potential gpp', & - ptr_col=this%fpg_col, default='inactive') - end if - - if (nlevdecomp > 1) then - vr_suffix = "_vr" - else - vr_suffix = "" - endif - this%fpi_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='FPI'//trim(vr_suffix), units='proportion', type2d='levdcmp', & - avgflag='A', long_name='fraction of potential immobilization', & - ptr_col=this%fpi_vr_col, default='inactive') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine initCold(this, bounds) - ! - ! !USES: - use spmdMod , only : masterproc - use fileutils , only : getfil - use ncdio_pio - ! - ! !ARGUMENTS: - class(soilbiogeochem_state_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g,l,c,p,n,j,m ! indices - integer :: dimid ! dimension id - integer :: ier ! error status - logical :: readvar - integer :: begc, endc - !----------------------------------------------------------------------- - - begc = bounds%begc; endc= bounds%endc - - ! -------------------------------------------------------------------- - ! Initialize terms needed for dust model - ! -------------------------------------------------------------------- - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - this%fpi_col (c) = spval - this%fpg_col (c) = spval - do j = 1,nlevdecomp_full - this%fpi_vr_col(c,j) = spval - end do - end if - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - ! initialize fpi_vr so that levels below nlevsoi are not nans - this%fpi_vr_col(c,1:nlevdecomp_full) = 0._r8 - this%som_adv_coef_col(c,1:nlevdecomp_full) = 0._r8 - this%som_diffus_coef_col(c,1:nlevdecomp_full) = 0._r8 - - ! initialize the profiles for converting to vertically resolved carbon pools - this%nfixation_prof_col(c,1:nlevdecomp_full) = 0._r8 - this%ndep_prof_col(c,1:nlevdecomp_full) = 0._r8 - end if - end do - - end subroutine initCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag) - ! - ! !USES: - use shr_log_mod, only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc - use abortutils , only : endrun - use restUtilMod - use ncdio_pio - ! - ! !ARGUMENTS: - class(soilbiogeochem_state_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid - character(len=*) , intent(in) :: flag - ! - ! !LOCAL VARIABLES: - integer, pointer :: temp1d(:) ! temporary - integer :: p,j,c,i ! indices - logical :: readvar ! determine if variable is on initial file - real(r8), pointer :: ptr2d(:,:) ! temp. pointers for slicing larger arrays - real(r8), pointer :: ptr1d(:) ! temp. pointers for slicing larger arrays - !----------------------------------------------------------------------- - - if (use_vertsoilc) then - ptr2d => this%fpi_vr_col - call restartvar(ncid=ncid, flag=flag, varname='fpi_vr', xtype=ncd_double, & - dim1name='column',dim2name='levgrnd', switchdim=.true., & - long_name='fraction of potential immobilization', units='unitless', & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%fpi_vr_col(:,1) ! nlevdecomp = 1; so treat as 1D variable - call restartvar(ncid=ncid, flag=flag, varname='fpi', xtype=ncd_double, & - dim1name='column', & - long_name='fraction of potential immobilization', units='unitless', & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - - if (use_vertsoilc) then - ptr2d => this%som_adv_coef_col - call restartvar(ncid=ncid, flag=flag, varname='som_adv_coef_vr', xtype=ncd_double, & - dim1name='column',dim2name='levgrnd', switchdim=.true., & - long_name='SOM advective flux', units='m/s', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - end if - - if (use_vertsoilc) then - ptr2d => this%som_diffus_coef_col - call restartvar(ncid=ncid, flag=flag, varname='som_diffus_coef_vr', xtype=ncd_double, & - dim1name='column',dim2name='levgrnd', switchdim=.true., & - long_name='SOM diffusivity due to bio/cryo-turbation', units='m^2/s', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - end if - - call restartvar(ncid=ncid, flag=flag, varname='fpg', xtype=ncd_double, & - dim1name='column', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fpg_col) - - end subroutine Restart - - - function get_spinup_latitude_term(latitude) result(ans) - - !!DESCRIPTION: - ! calculate a logistic function to scale spinup factors so that spinup is more accelerated in high latitude regions - ! - ! !REVISION HISTORY - ! charlie koven, nov. 2015 - ! - ! !ARGUMENTS: - real(r8), intent(in) :: latitude - ! - ! !LOCAL VARIABLES: - real(r8) :: ans - - ans = 1._r8 + 50._r8 / ( 1._r8 + exp(-0.15_r8 * (abs(latitude) - 60._r8) ) ) - - return - end function get_spinup_latitude_term - -end module SoilBiogeochemStateType diff --git a/src/soilbiogeochem/SoilBiogeochemVerticalProfileMod.F90 b/src/soilbiogeochem/SoilBiogeochemVerticalProfileMod.F90 deleted file mode 100644 index 94c8c55d6a..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemVerticalProfileMod.F90 +++ /dev/null @@ -1,277 +0,0 @@ -module SoilBiogeochemVerticalProfileMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculate vertical profiles for distributing soil and litter C and N - ! - ! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public:: SoilBiogeochemVerticalProfile - ! - real(r8), public :: surfprof_exp = 10. ! how steep profile is for surface components (1/ e_folding depth) (1/m) - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemVerticalProfile(bounds, num_soilc,filter_soilc,num_soilp,filter_soilp, & - canopystate_inst, soilstate_inst, soilbiogeochem_state_inst) - ! - ! !DESCRIPTION: - ! calculate vertical profiles for distributing soil and litter C and N - ! - ! BUG(wjs, 2014-12-15, bugz 2107) - ! Because of this routine's placement in the driver sequence (it is - ! called very early in each timestep, before weights are adjusted and filters are - ! updated), it may be necessary for this routine to compute values over inactive as well - ! as active points (since some inactive points may soon become active) - so that's what - ! is done now. Currently, it seems to be okay to do this, because the variables computed - ! here seem to only depend on quantities that are valid over inactive as well as active - ! points. However, note that this routine is (mistakenly) called from two places - ! currently - the above note applies to its call from the driver, but its call from - ! CNDecompMod uses the standard filters that just apply over active points - ! - ! !USES: - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_varcon , only : zsoi, dzsoi, zisoi, dzsoi_decomp, zmin_bedrock - use clm_varpar , only : nlevdecomp, nlevgrnd, nlevdecomp_full, maxpatch_pft - use clm_varctl , only : use_vertsoilc, iulog, use_bedrock - use pftconMod , only : noveg, pftcon - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use CanopyStateType , only : canopystate_type - use SoilStateType , only : soilstate_type - use ColumnType , only : col - use PatchType , only : patch - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(canopystate_type) , intent(in) :: canopystate_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(soilbiogeochem_state_type) , intent(inout) :: soilbiogeochem_state_inst - ! - ! !LOCAL VARIABLES: - real(r8) :: surface_prof(1:nlevdecomp) - real(r8) :: surface_prof_tot - real(r8) :: rootfr_tot - real(r8) :: cinput_rootfr(bounds%begp:bounds%endp, 1:nlevdecomp_full) ! pft-native root fraction used for calculating inputs - real(r8) :: col_cinput_rootfr(bounds%begc:bounds%endc, 1:nlevdecomp_full) ! col-native root fraction used for calculating inputs - integer :: c, j, fc, p, fp, pi - integer :: alt_ind - ! debugging temp variables - real(r8) :: froot_prof_sum - real(r8) :: croot_prof_sum - real(r8) :: leaf_prof_sum - real(r8) :: stem_prof_sum - real(r8) :: ndep_prof_sum - real(r8) :: nfixation_prof_sum - real(r8) :: delta = 1.e-10 - integer :: begp, endp - integer :: begc, endc - character(len=32) :: subname = 'SoilBiogeochemVerticalProfile' - !----------------------------------------------------------------------- - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - associate( & - altmax_lastyear_indx => canopystate_inst%altmax_lastyear_indx_col , & ! Input: [integer (:) ] frost table depth (m) - - crootfr => soilstate_inst%crootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots in each soil layer (nlevgrnd) - - nfixation_prof => soilbiogeochem_state_inst%nfixation_prof_col , & ! Input : [real(r8) (:,:) ] (1/m) profile for N fixation additions - ndep_prof => soilbiogeochem_state_inst%ndep_prof_col , & ! Input : [real(r8) (:,:) ] (1/m) profile for N fixation additions - leaf_prof => soilbiogeochem_state_inst%leaf_prof_patch , & ! Output : [real(r8) (:,:) ] (1/m) profile of leaves - froot_prof => soilbiogeochem_state_inst%froot_prof_patch , & ! Output : [real(r8) (:,:) ] (1/m) profile of fine roots - croot_prof => soilbiogeochem_state_inst%croot_prof_patch , & ! Output : [real(r8) (:,:) ] (1/m) profile of coarse roots - stem_prof => soilbiogeochem_state_inst%stem_prof_patch & ! Output : [real(r8) (:,:) ] (1/m) profile of stems - ) - - if (use_vertsoilc) then - - ! define a single shallow surface profile for surface additions (leaves, stems, and N deposition) - surface_prof(:) = 0._r8 - do j = 1, nlevdecomp - surface_prof(j) = exp(-surfprof_exp * zsoi(j)) / dzsoi_decomp(j) - if (use_bedrock) then - if (zsoi(j) > zmin_bedrock) then - surface_prof(j) = 0._r8 - end if - end if - end do - - ! initialize profiles to zero - leaf_prof(begp:endp, :) = 0._r8 - froot_prof(begp:endp, :) = 0._r8 - croot_prof(begp:endp, :) = 0._r8 - stem_prof(begp:endp, :) = 0._r8 - nfixation_prof(begc:endc, :) = 0._r8 - ndep_prof(begc:endc, :) = 0._r8 - - cinput_rootfr(begp:endp, :) = 0._r8 - col_cinput_rootfr(begc:endc, :) = 0._r8 - - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - if (patch%itype(p) /= noveg) then - do j = 1, nlevdecomp - cinput_rootfr(p,j) = crootfr(p,j) / dzsoi_decomp(j) - end do - - else - cinput_rootfr(p,1) = 0. - endif - end do - - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - ! integrate rootfr over active layer of soil column - rootfr_tot = 0._r8 - surface_prof_tot = 0._r8 - do j = 1, min(max(altmax_lastyear_indx(c), 1), nlevdecomp) - rootfr_tot = rootfr_tot + cinput_rootfr(p,j) * dzsoi_decomp(j) - surface_prof_tot = surface_prof_tot + surface_prof(j) * dzsoi_decomp(j) - end do - if ( (altmax_lastyear_indx(c) > 0) .and. (rootfr_tot > 0._r8) .and. (surface_prof_tot > 0._r8) ) then - ! where there is not permafrost extending to the surface, integrate the profiles over the active layer - ! this is equivalnet to integrating over all soil layers outside of permafrost regions - do j = 1, min(max(altmax_lastyear_indx(c), 1), nlevdecomp) - froot_prof(p,j) = cinput_rootfr(p,j) / rootfr_tot - croot_prof(p,j) = cinput_rootfr(p,j) / rootfr_tot - - if (j > col%nbedrock(c) .and. cinput_rootfr(p,j) > 0._r8) then - write(iulog,*) 'cinput_rootfr > 0 in bedrock' - end if - ! set all surface processes to shallower profile - leaf_prof(p,j) = surface_prof(j)/ surface_prof_tot - stem_prof(p,j) = surface_prof(j)/ surface_prof_tot - end do - else - ! if fully frozen, or no roots, put everything in the top layer - froot_prof(p,1) = 1./dzsoi_decomp(1) - croot_prof(p,1) = 1./dzsoi_decomp(1) - leaf_prof(p,1) = 1./dzsoi_decomp(1) - stem_prof(p,1) = 1./dzsoi_decomp(1) - endif - - end do - - !! aggregate root profile to column - ! call p2c (decomp, nlevdecomp_full, & - ! cinput_rootfr(bounds%begp:bounds%endp, :), & - ! col_cinput_rootfr(bounds%begc:bounds%endc, :), & - ! 'unity') - do pi = 1,maxpatch_pft - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - do j = 1,nlevdecomp - col_cinput_rootfr(c,j) = col_cinput_rootfr(c,j) + cinput_rootfr(p,j) * patch%wtcol(p) - end do - end if - end do - end do - - ! repeat for column-native profiles: Ndep and Nfix - do fc = 1,num_soilc - c = filter_soilc(fc) - rootfr_tot = 0._r8 - surface_prof_tot = 0._r8 - ! redo column ntegration over active layer for column-native profiles - do j = 1, min(max(altmax_lastyear_indx(c), 1), nlevdecomp) - rootfr_tot = rootfr_tot + col_cinput_rootfr(c,j) * dzsoi_decomp(j) - surface_prof_tot = surface_prof_tot + surface_prof(j) * dzsoi_decomp(j) - end do - if ( (altmax_lastyear_indx(c) > 0) .and. (rootfr_tot > 0._r8) .and. (surface_prof_tot > 0._r8) ) then - do j = 1, min(max(altmax_lastyear_indx(c), 1), nlevdecomp) - nfixation_prof(c,j) = col_cinput_rootfr(c,j) / rootfr_tot - ndep_prof(c,j) = surface_prof(j)/ surface_prof_tot - end do - else - nfixation_prof(c,1) = 1./dzsoi_decomp(1) - ndep_prof(c,1) = 1./dzsoi_decomp(1) - endif - end do - - else - - ! for one layer decomposition model, set profiles to unity - leaf_prof(begp:endp, :) = 1._r8 - froot_prof(begp:endp, :) = 1._r8 - croot_prof(begp:endp, :) = 1._r8 - stem_prof(begp:endp, :) = 1._r8 - nfixation_prof(begc:endc, :) = 1._r8 - ndep_prof(begc:endc, :) = 1._r8 - - end if - - - ! check to make sure integral of all profiles = 1. - do fc = 1,num_soilc - c = filter_soilc(fc) - ndep_prof_sum = 0. - nfixation_prof_sum = 0. - do j = 1, nlevdecomp - ndep_prof_sum = ndep_prof_sum + ndep_prof(c,j) * dzsoi_decomp(j) - nfixation_prof_sum = nfixation_prof_sum + nfixation_prof(c,j) * dzsoi_decomp(j) - end do - if ( ( abs(ndep_prof_sum - 1._r8) > delta ) .or. ( abs(nfixation_prof_sum - 1._r8) > delta ) ) then - write(iulog, *) 'profile sums: ', ndep_prof_sum, nfixation_prof_sum - write(iulog, *) 'c: ', c - write(iulog, *) 'altmax_lastyear_indx: ', altmax_lastyear_indx(c) - write(iulog, *) 'nfixation_prof: ', nfixation_prof(c,:) - write(iulog, *) 'ndep_prof: ', ndep_prof(c,:) - write(iulog, *) 'cinput_rootfr: ', cinput_rootfr(c,:) - write(iulog, *) 'dzsoi_decomp: ', dzsoi_decomp(:) - write(iulog, *) 'surface_prof: ', surface_prof(:) - write(iulog, *) 'npfts(c): ', col%npatches(c) - do p = col%patchi(c), col%patchi(c) + col%npatches(c) -1 - write(iulog, *) 'p, itype(p), wtcol(p): ', p, patch%itype(p), patch%wtcol(p) - write(iulog, *) 'cinput_rootfr(p,:): ', cinput_rootfr(p,:) - end do - call endrun(msg=" ERROR: _prof_sum-1>delta"//errMsg(sourcefile, __LINE__)) - endif - end do - - do fp = 1,num_soilp - p = filter_soilp(fp) - froot_prof_sum = 0. - croot_prof_sum = 0. - leaf_prof_sum = 0. - stem_prof_sum = 0. - do j = 1, nlevdecomp - froot_prof_sum = froot_prof_sum + froot_prof(p,j) * dzsoi_decomp(j) - croot_prof_sum = croot_prof_sum + croot_prof(p,j) * dzsoi_decomp(j) - leaf_prof_sum = leaf_prof_sum + leaf_prof(p,j) * dzsoi_decomp(j) - stem_prof_sum = stem_prof_sum + stem_prof(p,j) * dzsoi_decomp(j) - end do - if ( ( abs(froot_prof_sum - 1._r8) > delta ) .or. ( abs(croot_prof_sum - 1._r8) > delta ) .or. & - ( abs(stem_prof_sum - 1._r8) > delta ) .or. ( abs(leaf_prof_sum - 1._r8) > delta ) ) then - write(iulog, *) 'profile sums: ', froot_prof_sum, croot_prof_sum, leaf_prof_sum, stem_prof_sum - call endrun(msg=' ERROR: sum-1 > delta'//errMsg(sourcefile, __LINE__)) - endif - end do - - end associate - - end subroutine SoilBiogeochemVerticalProfile - -end module SoilBiogeochemVerticalProfileMod
    Driver Dry-Deposition Namelist Options